From ef23ef60c5641c5903f9cf40571ead7ad6aba1b9 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Tue, 2 Apr 2024 20:32:39 +0100 Subject: Workspace/core: Refactor workspace storage (#5380) * refactor workspaces to use ptrs * clang-format --- src/managers/AnimationManager.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/managers/AnimationManager.cpp') diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp index ab81841c..a9a72941 100644 --- a/src/managers/AnimationManager.cpp +++ b/src/managers/AnimationManager.cpp @@ -79,11 +79,11 @@ void CAnimationManager::tick() { const float SPENT = av->getPercent(); // window stuff - const auto PWINDOW = (CWindow*)av->m_pWindow; - const auto PWORKSPACE = (CWorkspace*)av->m_pWorkspace; - const auto PLAYER = (SLayerSurface*)av->m_pLayer; - CMonitor* PMONITOR = nullptr; - bool animationsDisabled = animGlobalDisabled; + const auto PWINDOW = (CWindow*)av->m_pWindow; + PHLWORKSPACE PWORKSPACE = av->m_pWorkspace.lock(); + const auto PLAYER = (SLayerSurface*)av->m_pLayer; + CMonitor* PMONITOR = nullptr; + bool animationsDisabled = animGlobalDisabled; if (PWINDOW) { if (av->m_eDamagePolicy == AVARDAMAGE_ENTIRE) { @@ -111,7 +111,7 @@ void CAnimationManager::tick() { // TODO: just make this into a damn callback already vax... for (auto& w : g_pCompositor->m_vWindows) { - if (!w->m_bIsMapped || w->isHidden() || w->m_iWorkspaceID != PWORKSPACE->m_iID) + if (!w->m_bIsMapped || w->isHidden() || w->m_pWorkspace != PWORKSPACE) continue; if (w->m_bIsFloating && !w->m_bPinned) { @@ -129,7 +129,7 @@ void CAnimationManager::tick() { // damage any workspace window that is on any monitor for (auto& w : g_pCompositor->m_vWindows) { - if (!g_pCompositor->windowValidMapped(w.get()) || w->m_iWorkspaceID != PWORKSPACE->m_iID || w->m_bPinned) + if (!g_pCompositor->windowValidMapped(w.get()) || w->m_pWorkspace != PWORKSPACE || w->m_bPinned) continue; g_pHyprRenderer->damageWindow(w.get()); @@ -146,7 +146,7 @@ void CAnimationManager::tick() { animationsDisabled = animationsDisabled || PLAYER->noAnimations; } - const bool VISIBLE = PWINDOW ? g_pCompositor->isWorkspaceVisible(PWINDOW->m_iWorkspaceID) : true; + const bool VISIBLE = PWINDOW && PWINDOW->m_pWorkspace ? g_pCompositor->isWorkspaceVisible(PWINDOW->workspaceID()) : true; // beziers are with a switch unforto // TODO: maybe do something cleaner @@ -212,7 +212,7 @@ void CAnimationManager::tick() { g_pHyprRenderer->damageWindow(PWINDOW); } else if (PWORKSPACE) { for (auto& w : g_pCompositor->m_vWindows) { - if (!g_pCompositor->windowValidMapped(w.get()) || w->m_iWorkspaceID != PWORKSPACE->m_iID) + if (!g_pCompositor->windowValidMapped(w.get()) || w->m_pWorkspace != PWORKSPACE) continue; w->updateWindowDecos(); -- cgit v1.2.3