unify setting of the active monitor

This commit is contained in:
vaxerski
2022-11-19 16:41:36 +00:00
parent f88feec02b
commit e427d9f622
5 changed files with 28 additions and 33 deletions

View File

@@ -1874,7 +1874,7 @@ void CCompositor::warpCursorTo(const Vector2D& pos) {
const auto PMONITORNEW = getMonitorFromVector(pos);
if (PMONITORNEW != m_pLastMonitor)
m_pLastMonitor = PMONITORNEW;
setActiveMonitor(PMONITORNEW);
}
SLayerSurface* CCompositor::getLayerSurfaceFromWlr(wlr_layer_surface_v1* pLS) {
@@ -1987,3 +1987,13 @@ CWorkspace* CCompositor::createNewWorkspace(const int& id, const int& monid, con
return PWORKSPACE;
}
void CCompositor::setActiveMonitor(CMonitor* pMonitor) {
if (m_pLastMonitor == pMonitor)
return;
const auto PWORKSPACE = getWorkspaceByID(pMonitor->activeWorkspace);
g_pEventManager->postEvent(SHyprIPCEvent{"focusedmon", pMonitor->szName + "," + PWORKSPACE->m_szName});
m_pLastMonitor = pMonitor;
}