From 164e92f8e376536fff89dac41cde654293e64522 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Thu, 14 Mar 2024 18:25:28 +0000 Subject: [PATCH] internal: minor fixups for fading out xwayland windows fixes #4935 --- src/Compositor.cpp | 12 ++++++++---- src/Window.cpp | 6 ++++++ src/Window.hpp | 1 + src/render/Renderer.cpp | 15 ++++++++++----- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/Compositor.cpp b/src/Compositor.cpp index 4d3fd65b..eda5b5ed 100644 --- a/src/Compositor.cpp +++ b/src/Compositor.cpp @@ -1433,11 +1433,15 @@ void CCompositor::cleanupFadingOut(const int& monid) { bool valid = windowExists(w); if (!valid || !w->m_bFadingOut || w->m_fAlpha.value() == 0.f) { - if (valid && !w->m_bReadyToDelete) - continue; + if (valid) { + w->m_bFadingOut = false; + + if (!w->m_bReadyToDelete) + continue; + + removeWindowFromVectorSafe(w); + } - w->m_bFadingOut = false; - removeWindowFromVectorSafe(w); std::erase(m_vWindowsFadingOut, w); Debug::log(LOG, "Cleanup: destroyed a window"); diff --git a/src/Window.cpp b/src/Window.cpp index 4c8ff509..06b71763 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -1137,3 +1137,9 @@ void CWindow::setSuspended(bool suspend) { wlr_xdg_toplevel_set_suspended(m_uSurface.xdg->toplevel, suspend); m_bSuspended = suspend; } + +bool CWindow::visibleOnMonitor(CMonitor* pMonitor) { + CBox wbox = {m_vRealPosition.value(), m_vRealSize.value()}; + + return wlr_output_layout_intersects(g_pCompositor->m_sWLROutputLayout, pMonitor->output, wbox.pWlr()); +} diff --git a/src/Window.hpp b/src/Window.hpp index 2a19cfa5..cb4fc057 100644 --- a/src/Window.hpp +++ b/src/Window.hpp @@ -395,6 +395,7 @@ class CWindow { bool canBeTorn(); bool shouldSendFullscreenState(); void setSuspended(bool suspend); + bool visibleOnMonitor(CMonitor* pMonitor); int getRealBorderSize(); void updateSpecialRenderData(); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index fd3309e1..a9c7c11a 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -335,7 +335,7 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, CWorkspace* pWork // Non-floating main for (auto& w : g_pCompositor->m_vWindows) { - if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut) + if (w->isHidden() || (!w->m_bIsMapped && !w->m_bFadingOut)) continue; if (w->m_bIsFloating) @@ -362,7 +362,7 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, CWorkspace* pWork // Non-floating popup for (auto& w : g_pCompositor->m_vWindows) { - if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut) + if (w->isHidden() || (!w->m_bIsMapped && !w->m_bFadingOut)) continue; if (w->m_bIsFloating) @@ -380,7 +380,7 @@ void CHyprRenderer::renderWorkspaceWindows(CMonitor* pMonitor, CWorkspace* pWork // floating on top for (auto& w : g_pCompositor->m_vWindows) { - if (w->isHidden() && !w->m_bIsMapped && !w->m_bFadingOut) + if (w->isHidden() || (!w->m_bIsMapped && !w->m_bFadingOut)) continue; if (!w->m_bIsFloating || w->m_bPinned) @@ -410,6 +410,9 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, CMonitor* pMonitor, timespec* return; } + if (!pWindow->m_bIsMapped) + return; + TRACY_GPU_ZONE("RenderWindow"); const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID); @@ -2414,8 +2417,10 @@ void CHyprRenderer::recheckSolitaryForMonitor(CMonitor* pMonitor) { } for (auto& w : g_pCompositor->m_vWindows) { - if (w->m_iWorkspaceID == PCANDIDATE->m_iWorkspaceID && w->m_bIsFloating && w->m_bCreatedOverFullscreen && !w->isHidden() && (w->m_bIsMapped || w->m_bFadingOut) && - w.get() != PCANDIDATE) + if (w.get() == PCANDIDATE || (!w->m_bIsMapped && !w->m_bFadingOut) || w->isHidden()) + continue; + + if (w->m_iWorkspaceID == PCANDIDATE->m_iWorkspaceID && w->m_bIsFloating && w->m_bCreatedOverFullscreen && w->visibleOnMonitor(pMonitor)) return; }