aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/config/ConfigManager.cpp4
-rw-r--r--src/helpers/Workspace.hpp2
-rw-r--r--src/managers/KeybindManager.cpp28
3 files changed, 18 insertions, 16 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 079d9a8d..893f4ef0 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -34,8 +34,6 @@ void CConfigManager::setDefaultVars() {
configValues["general:apply_sens_to_raw"].intValue = 0;
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;
@@ -142,6 +140,8 @@ void CConfigManager::setDefaultVars() {
configValues["binds:pass_mouse_when_bound"].intValue = 1;
configValues["binds:scroll_event_delay"].intValue = 300;
+ configValues["binds:workspace_back_and_forth"].intValue = 0;
+ configValues["binds:allow_workspace_cycles"].intValue = 0;
configValues["gestures:workspace_swipe"].intValue = 0;
configValues["gestures:workspace_swipe_fingers"].intValue = 3;
diff --git a/src/helpers/Workspace.hpp b/src/helpers/Workspace.hpp
index 9243c9cc..3faebdd8 100644
--- a/src/helpers/Workspace.hpp
+++ b/src/helpers/Workspace.hpp
@@ -20,7 +20,7 @@ public:
uint64_t m_iMonitorID = -1;
// Previous workspace ID is stored during a workspace change, allowing travel
// to the previous workspace.
- int m_iPrevWorkspaceID = -1;
+ int m_iPrevWorkspaceID = -1;
bool m_bHasFullscreenWindow = false;
eFullscreenMode m_efFullscreenMode = FULLSCREEN_FULL;
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index ab22d98f..374525a2 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -464,22 +464,23 @@ void CKeybindManager::changeworkspace(std::string args) {
if (PWORKSPACE)
workspaceName = PWORKSPACE->m_szName;
} else if (args.find("previous") == 0) {
- const auto P_CURRENT_WORKSPACE = g_pCompositor->getWorkspaceByID(
+ const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID(
g_pCompositor->getMonitorFromCursor()->activeWorkspace);
// Do nothing if there's no previous workspace, otherwise switch to it.
- if (P_CURRENT_WORKSPACE->m_iPrevWorkspaceID == -1) {
+ if (PCURRENTWORKSPACE->m_iPrevWorkspaceID == -1) {
Debug::log(LOG, "No previous workspace to change to");
return;
}
else {
- workspaceToChangeTo = P_CURRENT_WORKSPACE->m_iPrevWorkspaceID;
+ workspaceToChangeTo = PCURRENTWORKSPACE->m_iPrevWorkspaceID;
isSwitchingToPrevious = true;
// 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;
+ static auto *const PALLOWWORKSPACECYCLES = &g_pConfigManager->getConfigValuePtr("binds:allow_workspace_cycles")->intValue;
+ if (!*PALLOWWORKSPACECYCLES)
+ PCURRENTWORKSPACE->m_iPrevWorkspaceID = -1;
}
} else {
workspaceToChangeTo = getWorkspaceIDFromString(args, workspaceName);
@@ -492,19 +493,20 @@ 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.
- if (g_pConfigManager->getConfigValuePtr("general:workspace_back_and_forth")->intValue == 1
- && g_pCompositor->getMonitorFromCursor()->activeWorkspace == workspaceToChangeTo) {
+ static auto *const PBACKANDFORTH = &g_pConfigManager->getConfigValuePtr("binds:workspace_back_and_forth")->intValue;
+ if (*PBACKANDFORTH && g_pCompositor->m_pLastMonitor->activeWorkspace == workspaceToChangeTo) {
- const auto P_CURRENT_WORKSPACE = g_pCompositor->getWorkspaceByID(
- g_pCompositor->getMonitorFromCursor()->activeWorkspace);
+ const auto PCURRENTWORKSPACE = g_pCompositor->getWorkspaceByID(
+ g_pCompositor->m_pLastMonitor->activeWorkspace);
- workspaceToChangeTo = P_CURRENT_WORKSPACE->m_iPrevWorkspaceID;
+ workspaceToChangeTo = PCURRENTWORKSPACE->m_iPrevWorkspaceID;
isSwitchingToPrevious = true;
// 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;
+ static auto *const PALLOWWORKSPACECYCLES = &g_pConfigManager->getConfigValuePtr("binds:allow_workspace_cycles")->intValue;
+ if (!*PALLOWWORKSPACECYCLES)
+ PCURRENTWORKSPACE->m_iPrevWorkspaceID = -1;
}
// remove constraints
@@ -518,7 +520,7 @@ void CKeybindManager::changeworkspace(std::string args) {
if (!isSwitchingToPrevious)
// Remember previous workspace.
- PWORKSPACETOCHANGETO->m_iPrevWorkspaceID = g_pCompositor->getMonitorFromCursor()->activeWorkspace;
+ PWORKSPACETOCHANGETO->m_iPrevWorkspaceID = g_pCompositor->m_pLastMonitor->activeWorkspace;
if (workspaceToChangeTo == SPECIAL_WORKSPACE_ID)
PWORKSPACETOCHANGETO->m_iMonitorID = PMONITOR->ID;