diff options
| author | Charles Taylor <taylorc822@gmail.com> | 2022-08-21 22:05:35 +1000 |
|---|---|---|
| committer | Charles Taylor <taylorc822@gmail.com> | 2022-08-21 22:05:35 +1000 |
| commit | 6ec932d11fcc490f3d3f8c544af8fa1a5c8ef4f7 (patch) | |
| tree | 2ef03122e64ee61484d4b2e5a716a4114f4b5587 /src/managers/KeybindManager.cpp | |
| parent | 3c8c605541d6b3e046951ba8710dfb2e9452a3de (diff) | |
fix bug which allowed a switch to workspace ID -1.
This only happened for the workspace_back_and_forth setting, since it
was missing a check.
Diffstat (limited to 'src/managers/KeybindManager.cpp')
| -rw-r--r-- | src/managers/KeybindManager.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 374525a2..ddf65b42 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -493,11 +493,12 @@ void CKeybindManager::changeworkspace(std::string args) { // Workspace_back_and_forth being enabled means that an attempt to switch to // the current workspace will instead switch to the previous. + const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID( + g_pCompositor->m_pLastMonitor->activeWorkspace); static auto *const PBACKANDFORTH = &g_pConfigManager->getConfigValuePtr("binds:workspace_back_and_forth")->intValue; - if (*PBACKANDFORTH && g_pCompositor->m_pLastMonitor->activeWorkspace == workspaceToChangeTo) { - - const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID( - g_pCompositor->m_pLastMonitor->activeWorkspace); + if (*PBACKANDFORTH + && PCURRENTWORKSPACE->m_iID == workspaceToChangeTo + && PCURRENTWORKSPACE->m_iPrevWorkspaceID != -1) { workspaceToChangeTo = PCURRENTWORKSPACE->m_iPrevWorkspaceID; isSwitchingToPrevious = true; |
