From ac6561019b6b2a25aeb970a536123f8f262af96e Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 27 May 2009 18:46:58 +0200 Subject: [PATCH] =?utf8?q?Don=E2=80=99t=20kill=20workspaces=20on=20which?= =?utf8?q?=20you=20currently=20are=20when=20changing=20screen=20configurat?= =?utf8?q?ion?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/util.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/util.c b/src/util.c index 6b931995..3cbb93d9 100644 --- a/src/util.c +++ b/src/util.c @@ -254,7 +254,7 @@ void unmap_workspace(xcb_connection_t *conn, Workspace *u_ws) { /* Ignore notify events because they would cause focus to be changed */ ignore_enter_notify_forall(conn, u_ws, true); - /* Unmap all clients of the current workspace */ + /* Unmap all clients of the given workspace */ int unmapped_clients = 0; FOR_TABLE(u_ws) CIRCLEQ_FOREACH(client, &(u_ws->table[cols][rows]->clients), clients) { @@ -271,10 +271,12 @@ void unmap_workspace(xcb_connection_t *conn, Workspace *u_ws) { unmapped_clients++; } - /* If we did not unmap any clients, the workspace is empty and we can destroy it */ - if (unmapped_clients == 0) { + /* If we did not unmap any clients, the workspace is empty and we can destroy it, at least + * if it is not the current workspace. */ + if (unmapped_clients == 0 && u_ws != c_ws) { /* Re-assign the workspace of all dock clients which use this workspace */ Client *dock; + LOG("workspace %p is empty\n", u_ws); SLIST_FOREACH(dock, &(u_ws->screen->dock_clients), dock_clients) { if (dock->workspace != u_ws) continue; @@ -285,7 +287,7 @@ void unmap_workspace(xcb_connection_t *conn, Workspace *u_ws) { u_ws->screen = NULL; } - /* Unmap the stack windows on the current workspace, if any */ + /* Unmap the stack windows on the given workspace, if any */ SLIST_FOREACH(stack_win, &stack_wins, stack_windows) if (stack_win->container->workspace == u_ws) xcb_unmap_window(conn, stack_win->window); -- 2.39.5