Don’t kill workspaces on which you currently are when changing screen configuration

This commit is contained in:
Michael Stapelberg 2009-05-27 18:46:58 +02:00
parent d4fb34abdd
commit ac6561019b
1 changed files with 6 additions and 4 deletions

View 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);