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.
This commit is contained in:
Charles Taylor 2022-08-21 22:05:35 +10:00
parent 3c8c605541
commit 6ec932d11f

View file

@ -493,11 +493,12 @@ void CKeybindManager::changeworkspace(std::string args) {
// Workspace_back_and_forth being enabled means that an attempt to switch to // Workspace_back_and_forth being enabled means that an attempt to switch to
// the current workspace will instead switch to the previous. // the current workspace will instead switch to the previous.
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( const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID(
g_pCompositor->m_pLastMonitor->activeWorkspace); g_pCompositor->m_pLastMonitor->activeWorkspace);
static auto *const PBACKANDFORTH = &g_pConfigManager->getConfigValuePtr("binds:workspace_back_and_forth")->intValue;
if (*PBACKANDFORTH
&& PCURRENTWORKSPACE->m_iID == workspaceToChangeTo
&& PCURRENTWORKSPACE->m_iPrevWorkspaceID != -1) {
workspaceToChangeTo = PCURRENTWORKSPACE->m_iPrevWorkspaceID; workspaceToChangeTo = PCURRENTWORKSPACE->m_iPrevWorkspaceID;
isSwitchingToPrevious = true; isSwitchingToPrevious = true;