From 9a3a7c8824270071bd93e49e19c26b204e584386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Tue, 5 Mar 2013 18:04:30 +0100 Subject: [PATCH] don't release clients reparented somewhere else this broke re-embedding clients XReparentWindow causes an unmap of mapped clients, currently leading into releaseClient() This will (among other) eg. reparent the client to the root and this is (usually?) executed after the original XReparentWindow, so the client does not end up where it's supposed to be. REVIEW: 109484 --- events.cpp | 12 +++++++++++- xcbutils.h | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) 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) {