add general:allow_workspace_cycles option

This commit is contained in:
Charles Taylor 2022-08-21 20:47:56 +10:00
parent d6ff7e40cf
commit 9ee42836d5
2 changed files with 9 additions and 4 deletions

View file

@ -35,6 +35,7 @@ void CConfigManager::setDefaultVars() {
configValues["general:main_mod"].strValue = "SUPER"; // exposed to the user for easier configuring
configValues["general:main_mod_internal"].intValue = g_pKeybindManager->stringToModMask("SUPER"); // actually used and automatically calculated
configValues["general:workspace_back_and_forth"].intValue = 0;
configValues["general:allow_workspace_cycles"].intValue = 0;
configValues["general:damage_tracking"].strValue = "full";
configValues["general:damage_tracking_internal"].intValue = DAMAGE_TRACKING_FULL;

View file

@ -476,8 +476,10 @@ void CKeybindManager::changeworkspace(std::string args) {
workspaceToChangeTo = P_CURRENT_WORKSPACE->m_iPrevWorkspaceID;
isSwitchingToPrevious = true;
// TODO: Add support for cycles
P_CURRENT_WORKSPACE->m_iPrevWorkspaceID = -1;
// If the previous workspace ID isn't reset, cycles can form when continually going
// to the previous workspace again and again.
if (!g_pConfigManager->getConfigValuePtr("general:allow_workspace_cycles")->intValue)
P_CURRENT_WORKSPACE->m_iPrevWorkspaceID = -1;
}
} else {
workspaceToChangeTo = getWorkspaceIDFromString(args, workspaceName);
@ -499,8 +501,10 @@ void CKeybindManager::changeworkspace(std::string args) {
workspaceToChangeTo = P_CURRENT_WORKSPACE->m_iPrevWorkspaceID;
isSwitchingToPrevious = true;
// TODO: Add support for cycles
P_CURRENT_WORKSPACE->m_iPrevWorkspaceID = -1;
// If the previous workspace ID isn't reset, cycles can form when continually going
// to the previous workspace again and again.
if (!g_pConfigManager->getConfigValuePtr("general:allow_workspace_cycles")->intValue)
P_CURRENT_WORKSPACE->m_iPrevWorkspaceID = -1;
}
// remove constraints