/* 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) {
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;
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);