Add mon in mon out events and fix crash

This commit is contained in:
vaxerski 2022-05-31 17:17:44 +02:00
parent 0d7131d30e
commit e73df80782
2 changed files with 8 additions and 3 deletions

View file

@ -141,7 +141,9 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
//
if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet
g_pCompositor->m_pLastMonitor = PNEWMONITOR;
g_pCompositor->m_pLastMonitor = PNEWMONITOR;
g_pEventManager->postEvent(SHyprIPCEvent("monitoradded", PNEWMONITOR->szName));
// ready to process cuz we have a monitor
g_pCompositor->m_bReadyToProcess = true;
@ -341,6 +343,8 @@ void Events::listener_monitorDestroy(void* owner, void* data) {
Debug::log(LOG, "Removed monitor %s!", pMonitor->szName.c_str());
g_pEventManager->postEvent(SHyprIPCEvent("monitorremoved", pMonitor->szName));
g_pCompositor->m_lMonitors.remove(*pMonitor);
// update the pMostHzMonitor