diff options
Diffstat (limited to 'src/helpers/Monitor.cpp')
| -rw-r--r-- | src/helpers/Monitor.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 6cc0087a..593e4444 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -22,11 +22,11 @@ #include "../protocols/core/DataDevice.hpp" #include "../render/Renderer.hpp" #include "../managers/EventManager.hpp" -#include "../managers/LayoutManager.hpp" #include "../managers/animation/AnimationManager.hpp" #include "../managers/animation/DesktopAnimationManager.hpp" #include "../managers/input/InputManager.hpp" #include "../hyprerror/HyprError.hpp" +#include "../layout/LayoutManager.hpp" #include "../i18n/Engine.hpp" #include "sync/SyncTimeline.hpp" #include "time/Time.hpp" @@ -306,7 +306,7 @@ void CMonitor::onConnect(bool noRule) { Desktop::focusState()->rawMonitorFocus(m_self.lock()); g_pHyprRenderer->arrangeLayersForMonitor(m_id); - g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m_id); + g_layoutManager->recalculateMonitor(m_self.lock()); // ensure VRR (will enable if necessary) g_pConfigManager->ensureVRR(m_self.lock()); @@ -1119,7 +1119,7 @@ void CMonitor::setupDefaultWS(const SMonitorRule& monitorRule) { // workspace exists, move it to the newly connected monitor g_pCompositor->moveWorkspaceToMonitor(PNEWWORKSPACE, m_self.lock()); m_activeWorkspace = PNEWWORKSPACE; - g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m_id); + g_layoutManager->recalculateMonitor(m_self.lock()); g_pDesktopAnimationManager->startAnimation(PNEWWORKSPACE, CDesktopAnimationManager::ANIMATION_TYPE_IN, true, true); } else { if (newDefaultWorkspaceName.empty()) @@ -1323,13 +1323,13 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo pWindow = pWorkspace->getFirstWindow(); } - Desktop::focusState()->fullWindowFocus(pWindow); + Desktop::focusState()->fullWindowFocus(pWindow, Desktop::FOCUS_REASON_KEYBIND); } if (!noMouseMove) g_pInputManager->simulateMouseMovement(); - g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m_id); + g_layoutManager->recalculateMonitor(m_self.lock()); g_pEventManager->postEvent(SHyprIPCEvent{"workspace", pWorkspace->m_name}); g_pEventManager->postEvent(SHyprIPCEvent{"workspacev2", std::format("{},{}", pWorkspace->m_id, pWorkspace->m_name)}); @@ -1392,11 +1392,11 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) { if (POLDSPECIAL) POLDSPECIAL->m_events.activeChanged.emit(); - g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m_id); + g_layoutManager->recalculateMonitor(m_self.lock()); if (!(Desktop::focusState()->window() && Desktop::focusState()->window()->m_pinned && Desktop::focusState()->window()->m_monitor == m_self)) { if (const auto PLAST = m_activeWorkspace->getLastFocusedWindow(); PLAST) - Desktop::focusState()->fullWindowFocus(PLAST); + Desktop::focusState()->fullWindowFocus(PLAST, Desktop::FOCUS_REASON_KEYBIND); else g_pInputManager->refocus(); } @@ -1421,7 +1421,7 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) { const auto PMONITORWORKSPACEOWNER = pWorkspace->m_monitor.lock(); if (const auto PMWSOWNER = pWorkspace->m_monitor.lock(); PMWSOWNER && PMWSOWNER->m_activeSpecialWorkspace == pWorkspace) { PMWSOWNER->m_activeSpecialWorkspace.reset(); - g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMWSOWNER->m_id); + g_layoutManager->recalculateMonitor(PMWSOWNER); g_pEventManager->postEvent(SHyprIPCEvent{"activespecial", "," + PMWSOWNER->m_name}); g_pEventManager->postEvent(SHyprIPCEvent{"activespecialv2", ",," + PMWSOWNER->m_name}); @@ -1480,17 +1480,16 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) { } else pos = pos - PMONFROMMIDDLE->m_position + m_position; - *w->m_realPosition = pos; - w->m_position = pos; + w->layoutTarget()->setPositionGlobal(CBox{pos, w->layoutTarget()->position().size()}); } } } - g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m_id); + g_layoutManager->recalculateMonitor(m_self.lock()); if (!(Desktop::focusState()->window() && Desktop::focusState()->window()->m_pinned && Desktop::focusState()->window()->m_monitor == m_self)) { if (const auto PLAST = pWorkspace->getLastFocusedWindow(); PLAST) - Desktop::focusState()->fullWindowFocus(PLAST); + Desktop::focusState()->fullWindowFocus(PLAST, Desktop::FOCUS_REASON_KEYBIND); else g_pInputManager->refocus(); } |
