]> Dogcows Code - chaz/openbox/blobdiff - openbox/event.c
watch for reverttoparent reverting to the root window, which will create a DetailInfe...
[chaz/openbox] / openbox / event.c
index 2ce29d5c00899f8ee516d194e3eed8035dc2846d..7e66cc28ed6318c550bad537d96665a8127e68a6 100644 (file)
@@ -312,6 +312,7 @@ static gboolean wanted_focusevent(XEvent *e)
 {
     gint mode = e->xfocus.mode;
     gint detail = e->xfocus.detail;
+    Window win = e->xany.window;
 
     if (e->type == FocusIn) {
 
@@ -326,6 +327,15 @@ static gboolean wanted_focusevent(XEvent *e)
 
         /* These are the ones we want.. */
 
+        if (win == RootWindow(ob_display, ob_screen)) {
+            /* This means focus reverted off of a client */
+            if (detail == NotifyPointerRoot || detail == NotifyDetailNone ||
+                detail == NotifyInferior)
+                return TRUE;
+            else
+                return FALSE;
+        }
+
         /* This means focus moved from the root window to a client */
         if (detail == NotifyVirtual)
             return TRUE;
@@ -334,8 +344,7 @@ static gboolean wanted_focusevent(XEvent *e)
             return TRUE;
 
         /* This means focus reverted off of a client */
-        if (detail == NotifyPointerRoot || detail == NotifyDetailNone ||
-            detail == NotifyInferior)
+        if (detail == NotifyInferior)
             return TRUE;
 
         /* Otherwise.. */
@@ -350,6 +359,10 @@ static gboolean wanted_focusevent(XEvent *e)
         if (mode == NotifyGrab)
             return FALSE;
 
+        /* Focus left the root window revertedto state */
+        if (win == RootWindow(ob_display, ob_screen))
+            return FALSE;
+
         /* These are the ones we want.. */
 
         /* This means focus moved from a client to the root window */
@@ -676,7 +689,8 @@ static void event_handle_client(ObClient *client, XEvent *e)
         } else if (ce.xfocus.detail == NotifyInferior) {
             ob_debug("Focus went to parent\n");
             /* Focus has been reverted to parent, which is our frame window,
-               so fall back to something other than the window which had it. */
+               or the root window, so fall back to something other than the
+               window which had it. */
             focus_fallback(FALSE);
         } else {
             /* Focus did move, so process the FocusIn event */
@@ -894,7 +908,10 @@ static void event_handle_client(ObClient *client, XEvent *e)
         }
         break;
     case UnmapNotify:
-        ob_debug("UnmapNotify for window 0x%x\n", client->window);
+        ob_debug("UnmapNotify for window 0x%x eventwin 0x%x sendevent %d "
+                 "ignores left %d\n",
+                 client->window, e->xunmap.event, e->xunmap.from_configure,
+                 client->ignore_unmaps);
         if (client->ignore_unmaps) {
             client->ignore_unmaps--;
             break;
@@ -920,6 +937,7 @@ static void event_handle_client(ObClient *client, XEvent *e)
            X server to deal with after we unmanage the window */
         XPutBackEvent(ob_display, e);
      
+        ob_debug("ReparentNotify for window 0x%x\n", client->window);
         client_unmanage(client);
         break;
     case MapRequest:
This page took 0.026941 seconds and 4 git commands to generate.