summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2007-05-13 16:39:04 +0000
committerDana Jansens <danakj@orodu.net>2007-05-13 16:39:04 +0000
commit2fdad9a0ff8f0f379a0f4dca8f25895bb5b49d0f (patch)
treef8669c27ef53ca173ca9171e1eaf5f8924a46a45
parentfd9b6a43cfc31da8fd8b6f583456908c41f504b6 (diff)
no more losing focus from wm_torture -t map_response
when a focusin comes for an invalid target, set that focus has wandered off, so that when the focusout comes in afterwards we can react accordingly
-rw-r--r--openbox/event.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/openbox/event.c b/openbox/event.c
index 9d8c5f3c..9e72408d 100644
--- a/openbox/event.c
+++ b/openbox/event.c
@@ -356,8 +356,13 @@ static Bool event_look_for_focusin(Display *d, XEvent *e, XPointer arg)
Bool event_look_for_focusin_client(Display *d, XEvent *e, XPointer arg)
{
+ ObWindow *w;
+
+ /* It is possible to get FocusIn events or unmanaged windows, meaning
+ they won't be for any known client */
return e->type == FocusIn && wanted_focusevent(e, TRUE) &&
- e->xfocus.window != screen_support_win;
+ (w = g_hash_table_lookup(window_map, &e->xfocus.window)) &&
+ WINDOW_IS_CLIENT(w);
}
static void print_focusevent(XEvent *e)
@@ -508,7 +513,19 @@ static void event_process(const XEvent *ec, gpointer data)
if (!focus_left_screen)
focus_fallback(TRUE);
}
- } else if (client && client != focus_client) {
+ }
+ else if (!client) {
+ /* It is possible to get FocusIn events or unmanaged windows,
+ meaning they won't be for any known client
+
+ If this happens, set the client to NULL so we know focus
+ has wandered off, and we'll get a focus out for it
+ shortly.
+ */
+ ob_debug_type(OB_DEBUG_FOCUS, "Focus went to an invalid target\n");
+ focus_set_client(NULL);
+ }
+ else if (client != focus_client) {
focus_left_screen = FALSE;
frame_adjust_focus(client->frame, TRUE);
focus_set_client(client);