From e68c07d8096ee5f83e29508c8762279ab80a924b Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 17 Mar 2024 01:05:26 +0000 Subject: [PATCH] renderer: don't render window on other mons during anim in fixes #5139 --- src/Window.cpp | 1 + src/Window.hpp | 1 + src/events/Windows.cpp | 3 +++ src/helpers/AnimatedVariable.hpp | 5 +++++ src/render/Renderer.cpp | 4 ++++ 5 files changed, 14 insertions(+) diff --git a/src/Window.cpp b/src/Window.cpp index 06b71763..c6c958ba 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -524,6 +524,7 @@ void CWindow::onMap() { "CWindow"); m_vReportedSize = m_vPendingReportedSize; + m_bAnimatingIn = true; for (const auto& ctrl : g_pHyprRenderer->m_vTearingControllers) { if (ctrl->pWlrHint->surface != m_pWLSurface.wlr()) diff --git a/src/Window.hpp b/src/Window.hpp index cb4fc057..11bd86c8 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -296,6 +296,7 @@ class CWindow { Vector2D m_vOriginalClosedPos; // these will be used for calculations later on in Vector2D m_vOriginalClosedSize; // drawing the closing animations SWindowDecorationExtents m_eOriginalClosedExtents; + bool m_bAnimatingIn = false; // For pinned (sticky) windows bool m_bPinned = false; diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp index 1e547efc..f38c1fb0 100644 --- a/src/events/Windows.cpp +++ b/src/events/Windows.cpp @@ -36,6 +36,9 @@ void setAnimToMove(void* data) { CBaseAnimatedVariable* animvar = (CBaseAnimatedVariable*)data; animvar->setConfig(PANIMCFG); + + if (animvar->getWindow() && !animvar->getWindow()->m_vRealPosition.isBeingAnimated() && !animvar->getWindow()->m_vRealSize.isBeingAnimated()) + animvar->getWindow()->m_bAnimatingIn = false; } void Events::listener_mapWindow(void* owner, void* data) { diff --git a/src/helpers/AnimatedVariable.hpp b/src/helpers/AnimatedVariable.hpp index 005f2832..88c775af 100644 --- a/src/helpers/AnimatedVariable.hpp +++ b/src/helpers/AnimatedVariable.hpp @@ -52,6 +52,7 @@ class CWorkspace; struct SLayerSurface; struct SAnimationPropertyConfig; class CHyprRenderer; +class CWindow; // Utility to define a concept as a list of possible type template @@ -135,6 +136,10 @@ class CBaseAnimatedVariable { m_bRemoveEndAfterRan = false; } + CWindow* getWindow() { + return (CWindow*)m_pWindow; + } + protected: void* m_pWindow = nullptr; void* m_pWorkspace = nullptr; diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 58f4b31a..112be432 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -524,6 +524,10 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec* g_pHyprOpenGL->m_RenderData.clipBox = rg.getExtents(); } + // if window is tiled and it's flying in, don't render on other mons (for slide) + if (!ignorePosition && !pWindow->m_bIsFloating && pWindow->m_vRealPosition.isBeingAnimated() && pWindow->m_bAnimatingIn && pWindow->m_iMonitorID != pMonitor->ID) + return; + // render window decorations first, if not fullscreen full if (mode == RENDER_PASS_ALL || mode == RENDER_PASS_MAIN) {