From 62ef7834b042409acb99f0a030729c806be69335 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 28 May 2013 19:52:01 +0200 Subject: [PATCH] Bugfix: Unmap windows before reparenting them to the root window (fixes Mathematica) (Thanks psychon) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Some apps such as Mathematica send a synthetic UnmapNotify event without properly unmapping their window first. This change makes sure that happens and fixes an annoying bug with Mathematica where some unmanaged windows would stay around, but you couldn’t do anything with them. Thanks to psychon (current awesome maintainer) for helping with the diagnosis! fixes #787 --- src/tree.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tree.c b/src/tree.c index 32bec965..6d23750f 100644 --- a/src/tree.c +++ b/src/tree.c @@ -235,7 +235,12 @@ bool tree_close(Con *con, kill_window_t kill_window, bool dont_kill_parent, bool return false; } else { xcb_void_cookie_t cookie; - /* un-parent the window */ + /* Ignore any further events by clearing the event mask, + * unmap the window, + * then reparent it to the root window. */ + xcb_change_window_attributes(conn, con->window->id, + XCB_CW_EVENT_MASK, (uint32_t[]){ XCB_NONE }); + xcb_unmap_window(conn, con->window->id); cookie = xcb_reparent_window(conn, con->window->id, root, 0, 0); /* Ignore X11 errors for the ReparentWindow request. -- 2.39.5