summaryrefslogtreecommitdiff
path: root/src/helpers
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2023-11-12 13:34:42 +0000
committerVaxry <vaxry@vaxry.net>2023-11-12 13:34:54 +0000
commit69e314207d193eb67be0ae153d50c6c6bcee4b60 (patch)
tree062189da23659b0206ed3b6287652c09959d2b59 /src/helpers
parent1bfd4a2bff5f67872b868d519fbb45b32aa72b1f (diff)
internal: replace INT_MAX with WORKSPACE_INVALID
Diffstat (limited to 'src/helpers')
-rw-r--r--src/helpers/MiscFunctions.cpp16
-rw-r--r--src/helpers/Monitor.cpp2
2 files changed, 8 insertions, 10 deletions
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp
index 376ac032..7a9c5e5e 100644
--- a/src/helpers/MiscFunctions.cpp
+++ b/src/helpers/MiscFunctions.cpp
@@ -247,7 +247,7 @@ bool isDirection(const char& arg) {
}
int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
- int result = INT_MAX;
+ int result = WORKSPACE_INVALID;
if (in.starts_with("special")) {
outName = "special";
@@ -280,17 +280,17 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
}
} else if (in.starts_with("prev")) {
if (!g_pCompositor->m_pLastMonitor)
- return INT_MAX;
+ return WORKSPACE_INVALID;
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(g_pCompositor->m_pLastMonitor->activeWorkspace);
if (!PWORKSPACE)
- return INT_MAX;
+ return WORKSPACE_INVALID;
const auto PLASTWORKSPACE = g_pCompositor->getWorkspaceByID(PWORKSPACE->m_sPrevWorkspace.iID);
if (!PLASTWORKSPACE)
- return INT_MAX;
+ return WORKSPACE_INVALID;
outName = PLASTWORKSPACE->m_szName;
return PLASTWORKSPACE->m_iID;
@@ -298,8 +298,7 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
if (in[0] == 'r' && (in[1] == '-' || in[1] == '+') && isNumber(in.substr(2))) {
if (!g_pCompositor->m_pLastMonitor) {
Debug::log(ERR, "Relative monitor workspace on monitor null!");
- result = INT_MAX;
- return result;
+ return WORKSPACE_INVALID;
}
result = (int)getPlusMinusKeywordResult(in.substr(1), 0);
@@ -433,8 +432,7 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
if (!g_pCompositor->m_pLastMonitor) {
Debug::log(ERR, "Relative monitor workspace on monitor null!");
- result = INT_MAX;
- return result;
+ return WORKSPACE_INVALID;
}
// monitor relative
@@ -483,7 +481,7 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
result = std::max((int)getPlusMinusKeywordResult(in, g_pCompositor->m_pLastMonitor->activeWorkspace), 1);
else {
Debug::log(ERR, "Relative workspace on no mon!");
- result = INT_MAX;
+ return WORKSPACE_INVALID;
}
} else if (isNumber(in))
result = std::max(std::stoi(in), 1);
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp
index 743c938e..20880d8d 100644
--- a/src/helpers/Monitor.cpp
+++ b/src/helpers/Monitor.cpp
@@ -353,7 +353,7 @@ void CMonitor::setupDefaultWS(const SMonitorRule& monitorRule) {
findAvailableDefaultWS() :
getWorkspaceIDFromString(g_pConfigManager->getDefaultWorkspaceFor(szName), newDefaultWorkspaceName);
- if (WORKSPACEID == INT_MAX || (WORKSPACEID >= SPECIAL_WORKSPACE_START && WORKSPACEID <= -2)) {
+ if (WORKSPACEID == WORKSPACE_INVALID || (WORKSPACEID >= SPECIAL_WORKSPACE_START && WORKSPACEID <= -2)) {
WORKSPACEID = g_pCompositor->m_vWorkspaces.size() + 1;
newDefaultWorkspaceName = std::to_string(WORKSPACEID);