From 0ea15ed9620e9cc57305c5d66b0b115f3aec8552 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 8 Jan 2011 00:38:10 +0100 Subject: [PATCH] fix a problem with workspace switching when the focus got to the target workspace MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This could explain some strange effects where workspaces would just stay blank. We’ll see. --- src/workspace.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/workspace.c b/src/workspace.c index b5095d11..0694b977 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -201,12 +201,21 @@ static void workspace_reassign_sticky(Con *con) { void workspace_show(const char *num) { Con *workspace, *current, *old; - old = con_get_workspace(focused); - workspace = workspace_get(num); + + /* disable fullscreen for the other workspaces and get the workspace we are + * currently on. */ + TAILQ_FOREACH(current, &(workspace->parent->nodes_head), nodes) { + if (current->fullscreen_mode == CF_OUTPUT) + old = current; + current->fullscreen_mode = CF_NONE; + } + + /* enable fullscreen for the target workspace. If it happens to be the + * same one we are currently on anyways, we can stop here. */ + workspace->fullscreen_mode = CF_OUTPUT; if (workspace == old) return; - workspace->fullscreen_mode = CF_OUTPUT; /* disable fullscreen */ TAILQ_FOREACH(current, &(workspace->parent->nodes_head), nodes) current->fullscreen_mode = CF_NONE; -- 2.39.5