tcompose key patch. thx federico luna. - st - [fork] customized build of st, th… | |
git clone git://src.adamsgaard.dk/st | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 3470e3af23f4b98ce4293f6090c8df59a08329d9 | |
parent 6faedce53a8de8a81da1ba045ffbc2b7603128cd | |
Author: Aurélien Aptel <[email protected]> | |
Date: Tue, 21 Sep 2010 16:04:13 +0200 | |
compose key patch. thx federico luna. | |
Diffstat: | |
M st.c | 14 +++++++++++++- | |
1 file changed, 13 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/st.c b/st.c | |
t@@ -107,6 +107,8 @@ typedef struct { | |
Colormap cmap; | |
Window win; | |
Pixmap buf; | |
+ XIM xim; | |
+ XIC xic; | |
int scr; | |
int w; /* window width */ | |
int h; /* window height */ | |
t@@ -1228,6 +1230,13 @@ xinit(void) { | |
| CWColormap, | |
&attrs); | |
xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth… | |
+ | |
+ | |
+ /* input methods */ | |
+ xw.xim = XOpenIM(xw.dis, NULL, NULL, NULL); | |
+ xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing | |
+ | XIMStatusNothing, XNClientWindow,… | |
+ XNFocusWindow, xw.win, NULL); | |
/* gc */ | |
dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL); | |
t@@ -1411,10 +1420,11 @@ kpress(XEvent *ev) { | |
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)); | |
t@@ -1484,6 +1494,8 @@ run(void) { | |
} | |
while(XPending(xw.dis)) { | |
XNextEvent(xw.dis, &ev); | |
+ if (XFilterEvent(&ev, xw.win)) | |
+ continue; | |
if(handler[ev.type]) | |
(handler[ev.type])(&ev); | |
} |