handle windows that get embedded such as systray stuff.
authorDana Jansens <danakj@orodu.net>
Fri, 25 Jun 2010 16:11:27 +0000 (18:11 +0200)
committerDana Jansens <danakj@orodu.net>
Sat, 26 Jun 2010 23:30:51 +0000 (01:30 +0200)
stop redirecting and watching them when they are reparented away from root and
 vice versa

openbox/event.c

index 9033972a681e8f19b4e895fc57fa5574a9a7e303..a8a0b50ee19afc5c21c130b605966d79a358310c 100644 (file)
@@ -203,6 +203,9 @@ static Window event_get_window(XEvent *e)
     case DestroyNotify:
         window = e->xdestroywindow.window;
         break;
+    case ReparentNotify:
+        window = e->xreparent.window;
+        break;
     case ConfigureRequest:
         window = e->xconfigurerequest.window;
         break;
@@ -636,11 +639,15 @@ static void event_process(const XEvent *ec, gpointer data)
         if (client && client != focus_client)
             frame_adjust_focus(client->frame, FALSE);
     }
-    else if (e->type == CreateNotify) {
-        XCreateWindowEvent const *xe = &e->xcreatewindow;
-
-        if (!obwin && xe->parent == obt_root(ob_screen))
-            obwin = UNMANAGED_AS_WINDOW(unmanaged_new(xe->window));
+    else if (e->type == CreateNotify &&
+             !obwin && e->xcreatewindow.parent == obt_root(ob_screen))
+    {
+        obwin = UNMANAGED_AS_WINDOW(unmanaged_new(e->xcreatewindow.window));
+    }
+    else if (e->type == ReparentNotify &&
+             !obwin && e->xreparent.parent == obt_root(ob_screen))
+    {
+        obwin = UNMANAGED_AS_WINDOW(unmanaged_new(e->xreparent.window));
     }
     else if (obwin && event_handle_window(obwin, e))
         /* handled it ! */;
@@ -1848,6 +1855,9 @@ static void event_handle_unmanaged(ObUnmanaged *um, XEvent *e)
         unmanaged_destroy(um);
         window_manage(w);
         break;
+    case ReparentNotify:
+        unmanaged_destroy(um);
+        break;
     case ConfigureRequest:
         xwc.x = e->xconfigurerequest.x;
         xwc.y = e->xconfigurerequest.y;