]> Dogcows Code - chaz/openbox/blobdiff - openbox/event.c
inherit above/below more carefully
[chaz/openbox] / openbox / event.c
index cd0163f27119a21cc09b26db568a4b5728ef30f8..bb138d3dca77815f0766410e492776f7bf4be2fb 100644 (file)
@@ -321,6 +321,8 @@ static void event_client_dest(ObClient *client, gpointer data)
         focus_in = NULL;
     if (client == focus_out)
         focus_out = NULL;
+    if (client == focus_hilite)
+        focus_hilite = NULL;
 }
 
 static void event_done(gpointer data)
@@ -353,8 +355,15 @@ static void event_done(gpointer data)
     focus_hilite = focus_in;
 
     if (focus_client != last) {
-        if (!focus_client)
-            focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS);
+        if (!focus_client) {
+            Window w;
+            int r;
+
+            /* is focus anywhere valid? */
+            XGetInputFocus(ob_display, &w, &r);
+            if (!w || w == RootWindow(ob_display, ob_screen))
+                focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS);
+        }
         last = focus_client;
     }
 
@@ -463,11 +472,9 @@ static void event_process(const XEvent *ec, gpointer data)
                     e->type == MotionNotify)
                     mouse_event(client, e);
                 else if (e->type == KeyPress)
-                    /* when in the middle of a focus cycling action, this
-                       causes the window which appears to be focused to be
-                       the one on which the actions will be executed */
-                    keyboard_event((focus_cycle_target ?
-                                    focus_cycle_target : client), e);
+                    keyboard_event((focus_cycle_target ? focus_cycle_target :
+                                    (focus_hilite ? focus_hilite : client)),
+                                   e);
             }
         }
     }
This page took 0.027371 seconds and 4 git commands to generate.