diff options
| author | Aurélien Aptel <aurelien.aptel@gmail.com> | 2010-09-21 16:04:13 +0200 |
|---|---|---|
| committer | Aurélien Aptel <aurelien.aptel@gmail.com> | 2010-09-21 16:04:13 +0200 |
| commit | 3470e3af23f4b98ce4293f6090c8df59a08329d9 (patch) | |
| tree | f5ace8ab349acb74cdda933bdf330d28f9e21551 | |
| parent | s/hasfocus/focus/ for consistency. (diff) | |
| download | st-3470e3af23f4b98ce4293f6090c8df59a08329d9.tar.gz st-3470e3af23f4b98ce4293f6090c8df59a08329d9.zip | |
compose key patch. thx federico luna.
| -rw-r--r-- | st.c | 14 |
1 files changed, 13 insertions, 1 deletions
| @@ -107,6 +107,8 @@ typedef struct { | |||
| 107 | Colormap cmap; | 107 | Colormap cmap; |
| 108 | Window win; | 108 | Window win; |
| 109 | Pixmap buf; | 109 | Pixmap buf; |
| 110 | XIM xim; | ||
| 111 | XIC xic; | ||
| 110 | int scr; | 112 | int scr; |
| 111 | int w; /* window width */ | 113 | int w; /* window width */ |
| 112 | int h; /* window height */ | 114 | int h; /* window height */ |
| @@ -1228,6 +1230,13 @@ xinit(void) { | |||
| 1228 | | CWColormap, | 1230 | | CWColormap, |
| 1229 | &attrs); | 1231 | &attrs); |
| 1230 | xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr)); | 1232 | xw.buf = XCreatePixmap(xw.dis, xw.win, xw.bufw, xw.bufh, XDefaultDepth(xw.dis, xw.scr)); |
| 1233 | |||
| 1234 | |||
| 1235 | /* input methods */ | ||
| 1236 | xw.xim = XOpenIM(xw.dis, NULL, NULL, NULL); | ||
| 1237 | xw.xic = XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing | ||
| 1238 | | XIMStatusNothing, XNClientWindow, xw.win, | ||
| 1239 | XNFocusWindow, xw.win, NULL); | ||
| 1231 | /* gc */ | 1240 | /* gc */ |
| 1232 | dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL); | 1241 | dc.gc = XCreateGC(xw.dis, xw.win, 0, NULL); |
| 1233 | 1242 | ||
| @@ -1411,10 +1420,11 @@ kpress(XEvent *ev) { | |||
| 1411 | int len; | 1420 | int len; |
| 1412 | int meta; | 1421 | int meta; |
| 1413 | int shift; | 1422 | int shift; |
| 1423 | Status status; | ||
| 1414 | 1424 | ||
| 1415 | meta = e->state & Mod1Mask; | 1425 | meta = e->state & Mod1Mask; |
| 1416 | shift = e->state & ShiftMask; | 1426 | shift = e->state & ShiftMask; |
| 1417 | len = XLookupString(e, buf, sizeof(buf), &ksym, NULL); | 1427 | len = XmbLookupString(xw.xic, e, buf, sizeof(buf), &ksym, &status); |
| 1418 | 1428 | ||
| 1419 | if((customkey = kmap(ksym))) | 1429 | if((customkey = kmap(ksym))) |
| 1420 | ttywrite(customkey, strlen(customkey)); | 1430 | ttywrite(customkey, strlen(customkey)); |
| @@ -1484,6 +1494,8 @@ run(void) { | |||
| 1484 | } | 1494 | } |
| 1485 | while(XPending(xw.dis)) { | 1495 | while(XPending(xw.dis)) { |
| 1486 | XNextEvent(xw.dis, &ev); | 1496 | XNextEvent(xw.dis, &ev); |
| 1497 | if (XFilterEvent(&ev, xw.win)) | ||
| 1498 | continue; | ||
| 1487 | if(handler[ev.type]) | 1499 | if(handler[ev.type]) |
| 1488 | (handler[ev.type])(&ev); | 1500 | (handler[ev.type])(&ev); |
| 1489 | } | 1501 | } |
