summaryrefslogtreecommitdiff
path: root/xlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlib.c')
-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;