From c5eb8f2e1ec31f181d996c9758f8ca31ce50a5c9 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 23 Nov 2021 22:23:22 +0100 Subject: [PATCH] fixed an issue with workspaces not being reloaded if on another monitor --- src/windowManager.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/windowManager.cpp b/src/windowManager.cpp index e2ba4f3..d6dd235 100644 --- a/src/windowManager.cpp +++ b/src/windowManager.cpp @@ -785,15 +785,24 @@ void CWindowManager::changeWorkspaceByID(int ID) { for (auto& workspace : workspaces) { if (workspace.getID() == ID) { + // set workspaces dirty + setAllWorkspaceWindowsDirtyByID(activeWorkspaces[workspace.getMonitor()]); + setAllWorkspaceWindowsDirtyByID(ID); + activeWorkspaces[workspace.getMonitor()] = workspace.getID(); LastWindow = -1; + // set the focus to any window on that workspace + for (auto& window : windows) { + if (window.getWorkspaceID() == ID && window.getDrawable() > 0) { + g_pWindowManager->setFocusedWindow(window.getDrawable()); + break; + } + } + // Update bar info updateBarInfo(); - - // mark new as dirty - setAllWorkspaceWindowsDirtyByID(activeWorkspaces[MONITOR->ID]); - + return; } }