]> Dogcows Code - chaz/openbox/blobdiff - src/frame.cc
map the window if it was reparented, on release
[chaz/openbox] / src / frame.cc
index ac631d01fb68b80fa7dc6a0238b6819678fcb1b0..c5b144c5f3cbd4f8104389cb7529c008a77c8fef 100644 (file)
@@ -429,13 +429,21 @@ void OBFrame::grabClient()
 
 void OBFrame::releaseClient()
 {
-  // XXX: check for a reparent before reparenting?
-  
-  // according to the ICCCM - if the client doesn't reparent to
-  // root, then we have to do it for them
-  XReparentWindow(otk::OBDisplay::display, _client->window(),
-                  _screen->rootWindow(),
-                  _client->area().x(), _client->area().y());
+  XEvent ev;
+
+  // check if the app has already reparented its window away
+  if (XCheckTypedWindowEvent(otk::OBDisplay::display, _client->window(),
+                             ReparentNotify, &ev)) {
+    XPutBackEvent(otk::OBDisplay::display, &ev);
+    // re-map the window since the unmanaging process unmaps it
+    XMapWindow(otk::OBDisplay::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(otk::OBDisplay::display, _client->window(),
+                    _screen->rootWindow(),
+                    _client->area().x(), _client->area().y());
+  }
 }
 
 
This page took 0.020374 seconds and 4 git commands to generate.