From 7674683e6968653ca588d820f72a3b29faad2e61 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 15 Oct 2006 07:01:06 +0000 Subject: preliminaries for input method support --- xlib.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'xlib.c') 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; -- cgit v1.2.3