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

@ -1054,6 +1054,7 @@ void CCompositor::moveWorkspaceToMonitor(CWorkspace* pWorkspace, SMonitor* pMoni
if (SWITCHINGISACTIVE) { // if it was active, preserve its' status. If it wasn't, don't. if (SWITCHINGISACTIVE) { // if it was active, preserve its' status. If it wasn't, don't.
Debug::log(LOG, "moveWorkspaceToMonitor: SWITCHINGISACTIVE, active %d -> %d", pMonitor->activeWorkspace, pWorkspace->m_iID); Debug::log(LOG, "moveWorkspaceToMonitor: SWITCHINGISACTIVE, active %d -> %d", pMonitor->activeWorkspace, pWorkspace->m_iID);
if (const auto PWORKSPACE = getWorkspaceByID(pMonitor->activeWorkspace); PWORKSPACE)
getWorkspaceByID(pMonitor->activeWorkspace)->startAnim(false, false); getWorkspaceByID(pMonitor->activeWorkspace)->startAnim(false, false);
pMonitor->activeWorkspace = pWorkspace->m_iID; pMonitor->activeWorkspace = pWorkspace->m_iID;

View file

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