diff --git a/events.cpp b/events.cpp index b57e8ee4f5..684845cb0a 100644 --- a/events.cpp +++ b/events.cpp @@ -740,7 +740,17 @@ void Client::unmapNotifyEvent(XUnmapEvent* e) if (ignore) return; } - releaseWindow(); + + // check whether this is result of an XReparentWindow - client then won't be parented by wrapper + // in this case do not release the client (causes reparent to root, removal from saveSet and what not) + // but just destroy the client + Xcb::Tree tree(client); + xcb_window_t daddy = tree.parent(); + if (daddy == wrapper) { + releaseWindow(); // unmapped from a regular client state + } else { + destroyClient(); // the client was moved to some other parent + } } void Client::destroyNotifyEvent(XDestroyWindowEvent* e) diff --git a/xcbutils.h b/xcbutils.h index 7a7add41d2..336db9f4fc 100644 --- a/xcbutils.h +++ b/xcbutils.h @@ -179,6 +179,11 @@ public: inline WindowId *children() { return xcb_query_tree_children(data()); } + inline xcb_window_t parent() { + if (isNull()) + return XCB_WINDOW_NONE; + return (*this)->parent; + } }; inline xcb_get_input_focus_cookie_t get_input_focus(xcb_connection_t *c, xcb_window_t) {