From 1f69f36993da40c485b3f4e03dfd79f845e2ca1f Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Tue, 23 Oct 2012 10:17:29 +0200 Subject: [PATCH] Client: Properly get rid of titlebars on unmanage Signed-off-by: Uli Schlachter --- objects/client.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/objects/client.c b/objects/client.c index 88db483a..1cb62b94 100644 --- a/objects/client.c +++ b/objects/client.c @@ -990,6 +990,25 @@ client_unmanage(client_t *c, bool window_valid) if(strut_has_value(&c->strut)) screen_emit_signal(globalconf.L, c->screen, "property::workarea", 0); + /* Get rid of all titlebars */ + for (client_titlebar_t bar = CLIENT_TITLEBAR_TOP; bar < CLIENT_TITLEBAR_COUNT; bar++) { + if (c->titlebar[bar].drawable == NULL) + continue; + + luaA_object_push(globalconf.L, c); + luaA_object_push_item(globalconf.L, -1, c->titlebar[bar].drawable); + + /* Make the drawable unusable */ + drawable_set_surface(c->titlebar[bar].drawable, -1, NULL); + if (c->titlebar[bar].pixmap != XCB_NONE) + xcb_free_pixmap(globalconf.connection, c->titlebar[bar].pixmap); + + /* And forget about it */ + luaA_object_unref_item(globalconf.L, -2, c->titlebar[bar].drawable); + c->titlebar[bar].drawable = NULL; + lua_pop(globalconf.L, 2); + } + /* Clear our event mask so that we don't receive any events from now on, * especially not for the following requests. */ if(window_valid)