summaryrefslogtreecommitdiff
path: root/src/helpers/Monitor.cpp
diff options
context:
space:
mode:
authoroutfoxxed <outfoxxed@outfoxxed.me>2025-06-26 09:32:44 -0700
committerGitHub <noreply@github.com>2025-06-26 18:32:44 +0200
commit3bbdf9dc5ad2851f5d9f317362fc16705e4fd990 (patch)
tree025d7a25435925b235f2e94d18e31931b622c0c0 /src/helpers/Monitor.cpp
parent1f337a7a5e22ec45a77e275ce2e6ca165b298358 (diff)
protocols: add ext-workspace implementation (#10818)
Diffstat (limited to 'src/helpers/Monitor.cpp')
-rw-r--r--src/helpers/Monitor.cpp34
1 files changed, 27 insertions, 7 deletions
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) {