summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2006-10-15 07:01:06 +0000
committerRich Felker <dalias@aerifal.cx>2006-10-15 07:01:06 +0000
commit7674683e6968653ca588d820f72a3b29faad2e61 (patch)
tree057ba28b32e18dd995f55b344a530b35dbd44259
parent66dfc3344b3770f9dda6c5f38a5838d8b9651070 (diff)
downloaduuterm-7674683e6968653ca588d820f72a3b29faad2e61.tar.gz
preliminaries for input method support
-rw-r--r--xlib.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/xlib.c b/xlib.c
index 68faaf5..60d86b1 100644
--- a/xlib.c
+++ b/xlib.c
@@ -75,6 +75,7 @@ int uudisp_open(struct uudisp *d)
XSizeHints size_hints;
XClassHint class_hint;
XWMHints wm_hints;
+ unsigned long fevent;
char *fake_argv[2] = { "uuterm-x11", NULL };
char *s;
int px_w, px_h;
@@ -98,8 +99,6 @@ int uudisp_open(struct uudisp *d)
0, 0, px_w, px_h, 2,
BlackPixel(p->display, p->screen),
BlackPixel(p->display, p->screen));
- XSelectInput(p->display, p->window,
- KeyPressMask|ExposureMask|StructureNotifyMask);
size_hints.width_inc = d->cell_w;
size_hints.height_inc = d->cell_h;
@@ -119,6 +118,11 @@ int uudisp_open(struct uudisp *d)
}
if (p->im) p->ic = XCreateIC(p->im, XNInputStyle, XIMPreeditNothing|XIMStatusNothing, NULL);
+ if (p->ic) XGetICValues(p->ic, XNFilterEvents, &fevent, NULL);
+ else fevent = 0;
+ XSelectInput(p->display, p->window,
+ KeyPressMask|ExposureMask|StructureNotifyMask|fevent);
+
resize_window(d, px_w, px_h);
p->wingc = XCreateGC(p->display, p->window, 0, &values);
@@ -247,7 +251,14 @@ void uudisp_next_event(struct uudisp *d, void *fds)
while (XPending(p->display)) {
XNextEvent(p->display, &ev);
+ if (XFilterEvent(&ev, 0)) continue;
switch (ev.type) {
+ case FocusIn:
+ if (p->ic) XSetICFocus(p->ic);
+ break;
+ case FocusOut:
+ if (p->ic) XUnsetICFocus(p->ic);
+ break;
case Expose:
y1 = ev.xexpose.y / d->cell_h;
y2 = y1 + ev.xexpose.height / d->cell_h + 1;