From 0f1484c2f46245c7f02efa9db704ff63b3051601 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 3 Aug 2025 16:42:54 +0200 Subject: [PATCH] subsurface: check surface size in damageLastArea akin to CPopup, which already does this --- src/desktop/Subsurface.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/desktop/Subsurface.cpp b/src/desktop/Subsurface.cpp index d13a1344..ba7340f1 100644 --- a/src/desktop/Subsurface.cpp +++ b/src/desktop/Subsurface.cpp @@ -172,8 +172,16 @@ void CSubsurface::onUnmap() { } void CSubsurface::damageLastArea() { - const auto COORDS = coordsGlobal() + m_lastPosition - m_subsurface->m_position; - CBox box{COORDS, m_lastSize}; + const auto COORDS = coordsGlobal() + m_lastPosition - m_subsurface->m_position; + + const Vector2D MAX_DAMAGE_SIZE = m_wlSurface && m_wlSurface->resource() ? + Vector2D{ + std::max(m_lastSize.x, m_wlSurface->resource()->m_current.size.x), + std::max(m_lastSize.y, m_wlSurface->resource()->m_current.size.y), + } : + m_lastSize; + + CBox box{COORDS, m_lastSize}; box.expand(4); g_pHyprRenderer->damageBox(box); }