diff options
author | Mirkwood <[email protected]> | 2024-08-15 14:03:23 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-08-15 13:03:23 +0100 |
commit | 069faa4027d016549ee72afcd7df3b2c1e7ee578 (patch) | |
tree | bc68c8d3d2cb53ebcbd5dc2dbf935328939c3405 /src/helpers | |
parent | c30dfe92eee017bc70e131fa30d3c87b56d0a143 (diff) | |
download | Hyprland-069faa4027d016549ee72afcd7df3b2c1e7ee578.tar.gz Hyprland-069faa4027d016549ee72afcd7df3b2c1e7ee578.zip |
helpers: fix: revert to signed arithmetic for cycling through workspaces (#7339)
The code clearly expects signed types there.
Fixes #7329
Diffstat (limited to 'src/helpers')
-rw-r--r-- | src/helpers/MiscFunctions.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/helpers/MiscFunctions.cpp b/src/helpers/MiscFunctions.cpp index a81aa7d1..86f24e3a 100644 --- a/src/helpers/MiscFunctions.cpp +++ b/src/helpers/MiscFunctions.cpp @@ -472,7 +472,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) { std::sort(validWSes.begin(), validWSes.end()); - size_t currentItem = -1; + ssize_t currentItem = -1; if (absolute) { // 1-index @@ -481,7 +481,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) { // clamp if (currentItem < 0) { currentItem = 0; - } else if (currentItem >= validWSes.size()) { + } else if (currentItem >= (ssize_t)validWSes.size()) { currentItem = validWSes.size() - 1; } } else { @@ -490,7 +490,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) { // get the current item WORKSPACEID activeWSID = g_pCompositor->m_pLastMonitor->activeWorkspace ? g_pCompositor->m_pLastMonitor->activeWorkspace->m_iID : 1; - for (size_t i = 0; i < validWSes.size(); i++) { + for (ssize_t i = 0; i < (ssize_t)validWSes.size(); i++) { if (validWSes[i] == activeWSID) { currentItem = i; break; @@ -501,7 +501,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) { currentItem += remains; // sanitize - if (currentItem >= validWSes.size()) { + if (currentItem >= (ssize_t)validWSes.size()) { currentItem = currentItem % validWSes.size(); } else if (currentItem < 0) { currentItem = validWSes.size() + currentItem; |