From 8a97b11b22422bcb6907a66010388856317c7ff5 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Tue, 7 Apr 2026 13:15:10 +0100 Subject: desktop/popup: cache popup extents caches popup extents in the head to avoid potentially expensive traversals --- src/desktop/view/Window.cpp | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'src/desktop/view/Window.cpp') diff --git a/src/desktop/view/Window.cpp b/src/desktop/view/Window.cpp index 57dae3ec..b9c90ac9 100644 --- a/src/desktop/view/Window.cpp +++ b/src/desktop/view/Window.cpp @@ -219,23 +219,7 @@ SBoxExtents CWindow::getFullWindowExtents() const { maxExtents.bottomRight.y = std::max(EXTENTS.bottomRight.y, maxExtents.bottomRight.y); if (m_wlSurface->exists() && !m_isX11 && m_popupHead) { - CBox surfaceExtents = {0, 0, 0, 0}; - // TODO: this could be better, perhaps make a getFullWindowRegion? - m_popupHead->breadthfirst( - [](WP popup, void* data) { - if (!popup->wlSurface() || !popup->wlSurface()->resource()) - return; - - CBox* pSurfaceExtents = sc(data); - CBox surf = CBox{popup->coordsRelativeToParent(), popup->size()}; - pSurfaceExtents->x = std::min(surf.x, pSurfaceExtents->x); - pSurfaceExtents->y = std::min(surf.y, pSurfaceExtents->y); - if (surf.x + surf.w > pSurfaceExtents->width) - pSurfaceExtents->width = surf.x + surf.w - pSurfaceExtents->x; - if (surf.y + surf.h > pSurfaceExtents->height) - pSurfaceExtents->height = surf.y + surf.h - pSurfaceExtents->y; - }, - &surfaceExtents); + const auto& surfaceExtents = m_popupHead->popupTreeExtents(); maxExtents.topLeft.x = std::max(-surfaceExtents.x, maxExtents.topLeft.x); -- cgit v1.2.3