diff -r 6fd3c7b38f7c st.c --- a/st.c Fri Sep 03 00:15:43 2010 +0200 +++ b/st.c Wed Sep 08 20:31:22 2010 -0300 @@ -106,6 +106,8 @@ Display* dis; Window win; Pixmap buf; + XIM xim; + XIC xic; int scr; int w; /* window width */ int h; /* window height */ @@ -1212,6 +1214,14 @@ /* gc */ dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL); + /* input methods */ + xw.xim = XOpenIM(xw.dis, NULL, NULL, NULL); + xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing | + XIMStatusNothing, + XNClientWindow, xw.win, + XNFocusWindow, xw.win, + NULL); + /* event mask */ XSelectInput(xw.dis, xw.win, ExposureMask | KeyPressMask | StructureNotifyMask | FocusChangeMask | PointerMotionMask @@ -1382,10 +1392,11 @@ int len; int meta; int shift; + Status status; meta = e->state & Mod1Mask; shift = e->state & ShiftMask; - len = XLookupString(e, buf, sizeof(buf), &ksym, NULL); + len = XmbLookupString(xw.xic, e, buf, sizeof(buf), &ksym, &status); if((customkey = kmap(ksym))) ttywrite(customkey, strlen(customkey)); @@ -1456,6 +1467,8 @@ } while(XPending(xw.dis)) { XNextEvent(xw.dis, &ev); + if (XFilterEvent(&ev, xw.win)) + continue; if(handler[ev.type]) (handler[ev.type])(&ev); }