From 3bbdf9dc5ad2851f5d9f317362fc16705e4fd990 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Thu, 26 Jun 2025 09:32:44 -0700 Subject: protocols: add ext-workspace implementation (#10818) --- src/helpers/Monitor.cpp | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'src/helpers/Monitor.cpp') diff --git a/src/helpers/Monitor.cpp b/src/helpers/Monitor.cpp index db06a49d..580e806a 100644 --- a/src/helpers/Monitor.cpp +++ b/src/helpers/Monitor.cpp @@ -1026,7 +1026,7 @@ void CMonitor::setupDefaultWS(const SMonitorRule& monitorRule) { m_activeWorkspace = PNEWWORKSPACE; - PNEWWORKSPACE->setActive(true); + PNEWWORKSPACE->m_events.activeChange.emit(); PNEWWORKSPACE->m_visible = true; PNEWWORKSPACE->m_lastMonitor = ""; } @@ -1183,11 +1183,14 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo return; const auto POLDWORKSPACE = m_activeWorkspace; - if (POLDWORKSPACE) + m_activeWorkspace = pWorkspace; + + if (POLDWORKSPACE) { POLDWORKSPACE->m_visible = false; - pWorkspace->m_visible = true; + POLDWORKSPACE->m_events.activeChange.emit(); + } - m_activeWorkspace = pWorkspace; + pWorkspace->m_visible = true; if (!internal) { const auto ANIMTOLEFT = POLDWORKSPACE && (shouldWraparound(pWorkspace->m_id, POLDWORKSPACE->m_id) ^ (pWorkspace->m_id > POLDWORKSPACE->m_id)); @@ -1230,6 +1233,8 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo EMIT_HOOK_EVENT("workspace", pWorkspace); } + pWorkspace->m_events.activeChange.emit(); + g_pHyprRenderer->damageMonitor(m_self.lock()); g_pCompositor->updateFullscreenFadeOnWorkspace(pWorkspace); @@ -1250,6 +1255,8 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) { if (m_activeSpecialWorkspace == pWorkspace) return; + const auto POLDSPECIAL = m_activeSpecialWorkspace; + m_specialFade->setConfig(g_pConfigManager->getAnimationPropertyConfig(pWorkspace ? "specialWorkspaceIn" : "specialWorkspaceOut")); *m_specialFade = pWorkspace ? 1.F : 0.F; @@ -1265,6 +1272,9 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) { } m_activeSpecialWorkspace.reset(); + if (POLDSPECIAL) + POLDSPECIAL->m_events.activeChange.emit(); + g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m_id); if (!(g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_pinned && g_pCompositor->m_lastWindow->m_monitor == m_self)) { @@ -1288,7 +1298,7 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) { m_activeSpecialWorkspace->startAnim(false, false); } - bool animate = true; + bool wasActive = false; //close if open elsewhere const auto PMONITORWORKSPACEOWNER = pWorkspace->m_monitor.lock(); if (const auto PMWSOWNER = pWorkspace->m_monitor.lock(); PMWSOWNER && PMWSOWNER->m_activeSpecialWorkspace == pWorkspace) { @@ -1300,14 +1310,24 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) { const auto PACTIVEWORKSPACE = PMWSOWNER->m_activeWorkspace; g_pCompositor->updateFullscreenFadeOnWorkspace(PACTIVEWORKSPACE); - animate = false; + wasActive = true; } // open special pWorkspace->m_monitor = m_self; m_activeSpecialWorkspace = pWorkspace; m_activeSpecialWorkspace->m_visible = true; - if (animate) + + if (POLDSPECIAL) + POLDSPECIAL->m_events.activeChange.emit(); + + if (PMONITORWORKSPACEOWNER != m_self) + pWorkspace->m_events.monitorChange.emit(); + + if (!wasActive) + pWorkspace->m_events.activeChange.emit(); + + if (!wasActive) pWorkspace->startAnim(true, true); for (auto const& w : g_pCompositor->m_windows) { -- cgit v1.2.3