From df722cbb86bdc3b45827234c34e6ab90d02d5068 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 31 May 2022 12:33:08 +0200 Subject: Added relative monitor workspace offset --- src/Compositor.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/Compositor.cpp') diff --git a/src/Compositor.cpp b/src/Compositor.cpp index f11a2a4d..01566985 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1021,4 +1021,19 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, SMonitor* pMoni g_pLayoutManager->getCurrentLayout()->recalculateMonitor(POLDMON->ID); g_pInputManager->refocus(); +} + +bool CCompositor::workspaceIDOutOfBounds(const int& id) { + int lowestID = 99999; + int highestID = -99999; + + for (auto& w : m_lWorkspaces) { + if (w.m_iID < lowestID) + lowestID = w.m_iID; + + if (w.m_iID > highestID) + highestID = w.m_iID; + } + + return std::clamp(id, lowestID, highestID) != id; } \ No newline at end of file -- cgit v1.2.3