From: Michael Stapelberg Date: Wed, 27 May 2009 16:46:58 +0000 (+0200) Subject: Don’t kill workspaces on which you currently are when changing screen configuration X-Git-Tag: 3.b~90 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ac6561019b6b2a25aeb970a536123f8f262af96e;p=i3%2Fi3 Don’t kill workspaces on which you currently are when changing screen configuration --- 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);