From a311ab067957c828f13f03ae3d55b60da60abfc5 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 31 Jul 2010 10:21:22 +0200 Subject: [PATCH] Don't destroy client windows in unmanage When a client is unmanaged, we destroy our frame window. But since the client's own window was still a child of the frame window, it was destroyed, too. This commit fixes this by reparenting the client's window back to the root window first. Signed-off-by: Uli Schlachter --- event.c | 1 - objects/client.c | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/event.c b/event.c index 200b78c9..fe605e2a 100644 --- a/event.c +++ b/event.c @@ -630,7 +630,6 @@ event_handle_unmapnotify(xcb_unmap_notify_event_t *ev) if((c = client_getbywin(ev->window))) { client_unmanage(c); - xcb_unmap_window(globalconf.connection, ev->window); } else for(int i = 0; i < globalconf.embedded.len; i++) diff --git a/objects/client.c b/objects/client.c index 19721450..d4bb7600 100644 --- a/objects/client.c +++ b/objects/client.c @@ -1031,12 +1031,16 @@ client_unmanage(client_t *c) ewmh_update_net_client_list(c->phys_screen); + xcb_screen_t *s = xutil_screen_get(globalconf.connection, c->phys_screen); + xcb_unmap_window(globalconf.connection, c->window); + xcb_reparent_window(globalconf.connection, c->window, s->root, + c->geometry.x, c->geometry.y); + xcb_destroy_window(globalconf.connection, c->frame_window); + /* Remove this window from the save set since this shouldn't be made visible * after a restart anymore. */ xcb_change_save_set(globalconf.connection, XCB_SET_MODE_DELETE, c->window); - xcb_destroy_window(globalconf.connection, c->frame_window); - /* set client as invalid */ c->invalid = true;