From e427d9f622d852c20d0f24966dbe35a34f600de4 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 19 Nov 2022 16:41:36 +0000 Subject: unify setting of the active monitor --- src/helpers/Monitor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/helpers/Monitor.cpp') diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index 76150f9b..cae53904 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -130,16 +130,16 @@ void CMonitor::onConnect(bool noRule) { forceFullFrames = 3; // force 3 full frames to make sure there is no blinking due to double-buffering. // + g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", szName}); + if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet - g_pCompositor->m_pLastMonitor = this; + g_pCompositor->setActiveMonitor(this); wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, scale); g_pHyprRenderer->arrangeLayersForMonitor(ID); g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID); - g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", szName}); - // ensure VRR (will enable if necessary) g_pConfigManager->ensureVRR(this); } @@ -161,7 +161,7 @@ void CMonitor::onDisconnect() { } if (g_pCompositor->m_pLastMonitor == this) - g_pCompositor->m_pLastMonitor = BACKUPMON; + g_pCompositor->setActiveMonitor(BACKUPMON); // remove mirror if (pMirrorOf) { @@ -365,6 +365,6 @@ void CMonitor::setMirror(const std::string& mirrorOf) { g_pCompositor->m_vMonitors.erase(std::remove_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](const auto& other) { return other.get() == this; })); } - g_pCompositor->m_pLastMonitor = g_pCompositor->m_vMonitors.front().get(); + g_pCompositor->setActiveMonitor(g_pCompositor->m_vMonitors.front().get()); } } -- cgit v1.2.3