From 72d82f399378f953f9a85916eae23e42c91b52a2 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 9 Apr 2009 11:19:56 +0200 Subject: [PATCH] =?UTF-8?q?Bugfix:=20Delete=20empty=20workspaces=20even=20?= =?UTF-8?q?when=20they=E2=80=99re=20not=20the=20active=20workspace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes ticket #23 --- src/handlers.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/handlers.c b/src/handlers.c index e5835184..deb13b22 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -635,6 +635,17 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti if (client->container != NULL) cleanup_table(conn, client->container->workspace); + /* Let’s see how many clients there are left on the workspace to delete it if it’s empty */ + bool workspace_empty = true; + FOR_TABLE(client->workspace) + if (!CIRCLEQ_EMPTY(&(client->workspace->table[cols][rows]->clients))) { + workspace_empty = false; + break; + } + + if (workspace_empty) + client->workspace->screen = NULL; + free(client); render_layout(conn);