]> Dogcows Code - chaz/openbox/commitdiff
hopefully fix some stuff with kde tray icons
authorMikael Magnusson <mikachu@comhem.se>
Tue, 24 Feb 2004 20:11:36 +0000 (20:11 +0000)
committerMikael Magnusson <mikachu@comhem.se>
Tue, 24 Feb 2004 20:11:36 +0000 (20:11 +0000)
openbox/frame.c

index c83f36dfba2732e6c25e100873970f75b4fe5d0e..74d5630ec1c84bbc7ea8fa4de353c7fb9837e8a2 100644 (file)
@@ -505,26 +505,35 @@ void frame_grab_client(ObFrame *self, ObClient *client)
 void frame_release_client(ObFrame *self, ObClient *client)
 {
     XEvent ev;
+    gboolean reparent = TRUE;
 
     g_assert(self->client == client);
 
     /* check if the app has already reparented its window away */
-    if (XCheckTypedWindowEvent(ob_display, client->window,
-                              ReparentNotify, &ev)) {
-       XPutBackEvent(ob_display, &ev);
-
-       /* re-map the window since the unmanaging process unmaps it */
+    while (XCheckTypedWindowEvent(ob_display, client->window,
+                                  ReparentNotify, &ev))
+    {
+        /* This check makes sure we don't catch our own reparent action to
+           our frame window. This doesn't count as the app reparenting itself
+           away of course.
+
+           Reparent events that are generated by us are just discarded here.
+           They are of no consequence to us anyhow.
+        */
+        if (ev.xreparent.parent != self->plate) {
+            reparent = FALSE;
+            XPutBackEvent(ob_display, &ev);
+            break;
+        }
+    }
 
-        /* XXX ... um no it doesnt it unmaps its parent, the window itself
-           retains its mapped state, no?! XXX
-           XMapWindow(ob_display, client->window); */
-    } else {
-       /* according to the ICCCM - if the client doesn't reparent itself,
-          then we will reparent the window to root for them */
-       XReparentWindow(ob_display, client->window,
+    if (reparent) {
+        /* according to the ICCCM - if the client doesn't reparent itself,
+           then we will reparent the window to root for them */
+        XReparentWindow(ob_display, client->window,
                         RootWindow(ob_display, ob_screen),
-                       client->area.x,
-                       client->area.y);
+                        client->area.x,
+                        client->area.y);
     }
 
     /* remove all the windows for the frame from the window_map */
This page took 0.024959 seconds and 4 git commands to generate.