aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurélien Aptel <aurelien.aptel@gmail.com>2010-09-21 16:04:13 +0200
committerAurélien Aptel <aurelien.aptel@gmail.com>2010-09-21 16:04:13 +0200
commit9bbc040ea6147386d3bb506f070998bfef0cb2a1 (patch)
treef5ace8ab349acb74cdda933bdf330d28f9e21551
parentad918b5a0bc1ebbd44ec43096eb54a52ccb853ca (diff)
downloadst-9bbc040ea6147386d3bb506f070998bfef0cb2a1.tar.gz
st-9bbc040ea6147386d3bb506f070998bfef0cb2a1.tar.bz2
compose key patch. thx federico luna.
-rw-r--r--st.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/st.c b/st.c
index 99ab085..d1b90ef 100644
--- a/st.c
+++ b/st.c
@@ -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 */
@@ -1228,6 +1230,13 @@ xinit(void) {
| 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 @@ 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));
@@ -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);
}