diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-05-03 12:27:41 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-05-03 12:27:41 -0400 |
commit | 8033df9414b0e3512fa816c0d8433f94d135465f (patch) | |
tree | 2b6e24710b6549b2504f3d81341bad3466847501 | |
parent | de572a1bad4c390f14ab928c7f94d1f32a241552 (diff) | |
download | runes-8033df9414b0e3512fa816c0d8433f94d135465f.tar.gz runes-8033df9414b0e3512fa816c0d8433f94d135465f.zip |
ignore unrelated focus events
-rw-r--r-- | src/window-xlib.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/window-xlib.c b/src/window-xlib.c index 646bec9..7f8fa8e 100644 --- a/src/window-xlib.c +++ b/src/window-xlib.c @@ -217,10 +217,19 @@ void runes_window_backend_start_loop(RunesTerm *t) void *data; XGetICValues(w->ic, XNFilterEvents, &xim_mask, NULL); - common_mask = KeyPressMask|EnterWindowMask|LeaveWindowMask|FocusChangeMask; + /* we always want to receive keyboard events, and enter/leave window events + * are what allows keyboard focus switching to work when the mouse is over + * the window but hidden, for whatever reason */ + common_mask = KeyPressMask|EnterWindowMask|LeaveWindowMask; + /* the top level window is the only one that needs to worry about window + * size and focus changes */ XSelectInput( - w->dpy, w->border_w, xim_mask|common_mask|StructureNotifyMask); + w->dpy, w->border_w, + xim_mask|common_mask|StructureNotifyMask|FocusChangeMask); + /* we only care about mouse events if they are over the actual terminal + * area, and the terminal area is the only area we need to redraw, so it's + * the only thing we care about exposure events for */ XSelectInput( w->dpy, w->w, xim_mask|common_mask|ButtonPressMask|ButtonReleaseMask|ButtonMotionMask|PointerMotionHintMask|ExposureMask); @@ -781,6 +790,13 @@ static void runes_window_backend_handle_configure_event( static void runes_window_backend_handle_focus_event( RunesTerm *t, XFocusChangeEvent *e) { + /* we don't care about focus events that are only sent because the pointer + * is in the window, if focus is changing between two other unrelated + * windows */ + if (e->detail == NotifyPointer) { + return; + } + runes_window_backend_clear_urgent(t); if (e->type == FocusIn) { t->unfocused = 0; |