]> git.sur5r.net Git - i3/i3/commitdiff
Don’t kill workspaces on which you currently are when changing screen configuration
authorMichael Stapelberg <michael@stapelberg.de>
Wed, 27 May 2009 16:46:58 +0000 (18:46 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 27 May 2009 16:46:58 +0000 (18:46 +0200)
src/util.c

index 6b93199591cfb30a0268b5e362e301830b875125..3cbb93d976e525cbc234608a95abb1ab2b46131f 100644 (file)
@@ -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);