diff options
author | vaxerski <[email protected]> | 2023-04-28 21:40:40 +0100 |
---|---|---|
committer | vaxerski <[email protected]> | 2023-04-28 21:40:44 +0100 |
commit | fbb938fcf228b84dc82b5ad4f85387448d1a2d9f (patch) | |
tree | 4f4d9961a260028e2451793be0d3221b38989f78 | |
parent | 093755d53faa6f44f463a683c1ef9a823afb60db (diff) | |
download | Hyprland-fbb938fcf228b84dc82b5ad4f85387448d1a2d9f.tar.gz Hyprland-fbb938fcf228b84dc82b5ad4f85387448d1a2d9f.zip |
internal: don't change ws on active swap
-rw-r--r-- | src/Compositor.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp index a8764e0e..4222735a 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1869,33 +1869,35 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, CMonitor* pMoni // fix old mon int nextWorkspaceOnMonitorID = -1; - for (auto& w : m_vWorkspaces) { - if (w->m_iMonitorID == POLDMON->ID && w->m_iID != pWorkspace->m_iID && !w->m_bIsSpecialWorkspace) { - nextWorkspaceOnMonitorID = w->m_iID; - break; + if (!SWITCHINGISACTIVE) + nextWorkspaceOnMonitorID = pWorkspace->m_iID; + else { + for (auto& w : m_vWorkspaces) { + if (w->m_iMonitorID == POLDMON->ID && w->m_iID != pWorkspace->m_iID && !w->m_bIsSpecialWorkspace) { + nextWorkspaceOnMonitorID = w->m_iID; + break; + } } - } - if (nextWorkspaceOnMonitorID == -1) { - nextWorkspaceOnMonitorID = 1; + if (nextWorkspaceOnMonitorID == -1) { + nextWorkspaceOnMonitorID = 1; - while (getWorkspaceByID(nextWorkspaceOnMonitorID) || [&]() -> bool { - const auto B = g_pConfigManager->getBoundMonitorForWS(std::to_string(nextWorkspaceOnMonitorID)); - return B && B != POLDMON; - }()) - nextWorkspaceOnMonitorID++; + while (getWorkspaceByID(nextWorkspaceOnMonitorID) || [&]() -> bool { + const auto B = g_pConfigManager->getBoundMonitorForWS(std::to_string(nextWorkspaceOnMonitorID)); + return B && B != POLDMON; + }()) + nextWorkspaceOnMonitorID++; - Debug::log(LOG, "moveWorkspaceToMonitor: Plugging gap with new %d", nextWorkspaceOnMonitorID); + Debug::log(LOG, "moveWorkspaceToMonitor: Plugging gap with new %d", nextWorkspaceOnMonitorID); - g_pCompositor->createNewWorkspace(nextWorkspaceOnMonitorID, POLDMON->ID); - } - - Debug::log(LOG, "moveWorkspaceToMonitor: Plugging gap with existing %d", nextWorkspaceOnMonitorID); + g_pCompositor->createNewWorkspace(nextWorkspaceOnMonitorID, POLDMON->ID); + } - POLDMON->changeWorkspace(nextWorkspaceOnMonitorID); + Debug::log(LOG, "moveWorkspaceToMonitor: Plugging gap with existing %d", nextWorkspaceOnMonitorID); + POLDMON->changeWorkspace(nextWorkspaceOnMonitorID); + } // move the workspace - pWorkspace->m_iMonitorID = pMonitor->ID; pWorkspace->moveToMonitor(pMonitor->ID); |