[hackers] [st] compose key patch. thx federico luna. || Aurélien Aptel

From: <hg_AT_suckless.org>
Date: Tue, 21 Sep 2010 14:04:00 +0000 (UTC)

changeset: 149:96c41df08c94
tag: tip
user: Aurélien Aptel <aurelien.aptel_AT_gmail.com>
date: Tue Sep 21 16:04:13 2010 +0200
files: st.c
description:
compose key patch. thx federico luna.

diff -r 1cd0262c5b69 -r 96c41df08c94 st.c
--- a/st.c Sat Sep 11 16:07:36 2010 +0200
+++ b/st.c Tue Sep 21 16:04:13 2010 +0200
@@ -107,6 +107,8 @@
         Colormap cmap;
         Window win;
         Pixmap buf;
+ XIM xim;
+ XIC xic;
         int scr;
         int w; /* window width */
         int h; /* window height */
@@ -1228,6 +1230,13 @@
                         | CWColormap,
                         &attrs);
         xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr));
+
+
+ /* 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);
         /* gc */
         dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL);
         
@@ -1411,10 +1420,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));
@@ -1484,6 +1494,8 @@
                 }
                 while(XPending(xw.dis)) {
                         XNextEvent(xw.dis, &ev);
+ if (XFilterEvent(&ev, xw.win))
+ continue;
                         if(handler[ev.type])
                                 (handler[ev.type])(&ev);
                 }
Received on Tue Sep 21 2010 - 16:04:00 CEST

This archive was generated by hypermail 2.2.0 : Tue Sep 21 2010 - 16:12:03 CEST