summaryrefslogtreecommitdiff
path: root/src/helpers/MiscFunctions.cpp
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/MiscFunctions.cpp
parent1bfd4a2bff5f67872b868d519fbb45b32aa72b1f (diff)
internal: replace INT_MAX with WORKSPACE_INVALID
Diffstat (limited to 'src/helpers/MiscFunctions.cpp')
-rw-r--r--src/helpers/MiscFunctions.cpp16
1 files changed, 7 insertions, 9 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);