Thanks. But I am not very good at c. I had contact the fcitx developer
named Weng Xuetian which had once help in writing st. He said that he
had fixed a problem a long time ago in commit 84ceefe08. Look at:

http://git.suckless.org/st/commit/?id=84ceefe0890ee235dd736543fe30479393562fb6

Any idea how to fix that?

On Mon, May 25, 2015 at 09:23:12AM +0200, Roberto E. Vargas Caballero wrote:
Hi,

On Sat, May 23, 2015 at 03:43:08PM +0800, Ivan Tham wrote:
>>I typed ``Ctrl + Space`` in st but it seems like it doesn't work. Fcitx
>>is a Chinese IME for XIM.
>
>As far as I know no IME works with st (please correct me if I am

St has code to deal with input methods. I cannot test it because
I am not user of such methods, but the code that deals with XIM is:

xinit():
       /* input methods */
       if((xw.xim = XOpenIM(xw.dpy, NULL, NULL, NULL)) == NULL) {
               XSetLocaleModifiers("@im=local");
               if((xw.xim =  XOpenIM(xw.dpy, NULL, NULL, NULL)) == NULL) {
                       XSetLocaleModifiers("@im=");
                       if((xw.xim = XOpenIM(xw.dpy,
                                       NULL, NULL, NULL)) == NULL) {
                               die("XOpenIM failed. Could not open input"
                                       " device.\n");
                       }
               }
       }
       xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing
                                          | XIMStatusNothing, XNClientWindow, 
xw.win,
                                          XNFocusWindow, xw.win, NULL);
       if(xw.xic == NULL)
               die("XCreateIC failed. Could not obtain input method.\n");

----------------------------------------------------------------------------
void
focus(XEvent *ev) {
       XFocusChangeEvent *e = &ev->xfocus;

       if(e->mode == NotifyGrab)
               return;

       if(ev->type == FocusIn) {
               XSetICFocus(xw.xic);
               xw.state |= WIN_FOCUSED;
               xseturgency(0);
               if(IS_SET(MODE_FOCUS))
                       ttywrite("\033[I", 3);
       } else {
               XUnsetICFocus(xw.xic);
               xw.state &= ~WIN_FOCUSED;
               if(IS_SET(MODE_FOCUS))
                       ttywrite("\033[O", 3);
       }
}

-----------------------------------------------------------------------------
kpress():
       len = XmbLookupString(xw.xic, e, buf, sizeof buf, &ksym, &status);
       /* 1. shortcuts */
       for(bp = shortcuts; bp < shortcuts + LEN(shortcuts); bp++) {
               if(ksym == bp->keysym && match(bp->mod, e->state)) {
                       bp->func(&(bp->arg));
                       return;
               }
       }
-----------------------------------------------------------------------------

>having trouble figuring out where to start (Is it a X text protocol?
>It probably is with XIM but not with ibus. Would I have to use an ibus
>API to get st to work with ibus? Etc...).

So I think it should work. With this information you can debug the issue.


Regards,




--
_____________________________________
< Do what you like, like what you do. >
-------------------------------------
       \   ^__^
        \  (oo)\_______
           (__)\       )\/\
               ||----w |
               ||     ||
commit 84ceefe0890ee235dd736543fe30479393562fb6
Author: Weng Xuetian <wen...@gmail.com>
Date:   Wed Jul 16 18:36:46 2014 -0400

    Fix st with input method.
    
    XFilterEvent need to be called against every event, otherwise it would
    missing some message in the xim protocol and misbehave on some im server.
    
    Signed-off-by: Roberto E. Vargas Caballero <k...@shike2.com>

diff --git a/st.c b/st.c
index 040638a..546db41 100644
--- a/st.c
+++ b/st.c
@@ -3786,6 +3786,8 @@ run(void) {
        /* Waiting for window mapping */
        while(1) {
                XNextEvent(xw.dpy, &ev);
+               if(XFilterEvent(&ev, None))
+                       continue;
                if(ev.type == ConfigureNotify) {
                        w = ev.xconfigure.width;
                        h = ev.xconfigure.height;

Attachment: signature.asc
Description: PGP signature

Reply via email to