diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-11-19 16:41:36 +0000 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-11-19 16:41:41 +0000 |
| commit | e427d9f622d852c20d0f24966dbe35a34f600de4 (patch) | |
| tree | 1e578faff6773b5d0d35c03f25214a298a73b982 /src/helpers/Monitor.cpp | |
| parent | f88feec02b362fd1a43c6760ef37af1e1c58cafd (diff) | |
unify setting of the active monitor
Diffstat (limited to 'src/helpers/Monitor.cpp')
| -rw-r--r-- | src/helpers/Monitor.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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()); } } |
