diff options
| author | Vaxry <vaxry@vaxry.net> | 2026-04-07 13:15:10 +0100 |
|---|---|---|
| committer | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-04-07 12:07:36 -0400 |
| commit | 8a97b11b22422bcb6907a66010388856317c7ff5 (patch) | |
| tree | fe9ff326b0ae440de812bbfc2d3d61d400bd3c7e /src/desktop/view/Window.cpp | |
| parent | 10c8a863d271dac1c51af73e0e7fb23784b6c13d (diff) | |
desktop/popup: cache popup extents
caches popup extents in the head to avoid potentially expensive traversals
Diffstat (limited to 'src/desktop/view/Window.cpp')
| -rw-r--r-- | src/desktop/view/Window.cpp | 18 |
1 files changed, 1 insertions, 17 deletions
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<Desktop::View::CPopup> popup, void* data) { - if (!popup->wlSurface() || !popup->wlSurface()->resource()) - return; - - CBox* pSurfaceExtents = sc<CBox*>(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); |
