X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fframe.cc;h=c5b144c5f3cbd4f8104389cb7529c008a77c8fef;hb=6bad7e676ad841ffce8e2a05f0d8538f149454ea;hp=ac631d01fb68b80fa7dc6a0238b6819678fcb1b0;hpb=f11bd1b0cc5973590d1ee547736ac00f50447efa;p=chaz%2Fopenbox diff --git a/src/frame.cc b/src/frame.cc index ac631d01..c5b144c5 100644 --- a/src/frame.cc +++ b/src/frame.cc @@ -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()); + } }