move setActiveMonitor backup later in onDisconnect

This commit is contained in:
vaxerski 2022-12-21 15:17:24 +00:00
parent 41cdfb7420
commit e9bd2ee996

View file

@ -173,9 +173,6 @@ void CMonitor::onDisconnect() {
} }
} }
if (g_pCompositor->m_pLastMonitor == this)
g_pCompositor->setActiveMonitor(BACKUPMON);
// remove mirror // remove mirror
if (pMirrorOf) { if (pMirrorOf) {
pMirrorOf->mirrors.erase(std::find_if(pMirrorOf->mirrors.begin(), pMirrorOf->mirrors.end(), [&](const auto& other) { return other == this; })); pMirrorOf->mirrors.erase(std::find_if(pMirrorOf->mirrors.begin(), pMirrorOf->mirrors.end(), [&](const auto& other) { return other == this; }));
@ -239,6 +236,9 @@ void CMonitor::onDisconnect() {
g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", szName}); g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", szName});
if (g_pCompositor->m_pLastMonitor == this)
g_pCompositor->setActiveMonitor(BACKUPMON);
std::erase_if(g_pCompositor->m_vMonitors, [&](std::shared_ptr<CMonitor>& el) { return el.get() == this; }); std::erase_if(g_pCompositor->m_vMonitors, [&](std::shared_ptr<CMonitor>& el) { return el.get() == this; });
} }