From 0448e707fce798d6864320ef629ae681845bde26 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Tue, 7 Apr 2026 14:09:06 +0100 Subject: desktop/popup: cache tree count --- src/desktop/view/Window.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/desktop/view/Window.cpp') diff --git a/src/desktop/view/Window.cpp b/src/desktop/view/Window.cpp index b9c90ac9..35a706a1 100644 --- a/src/desktop/view/Window.cpp +++ b/src/desktop/view/Window.cpp @@ -742,7 +742,10 @@ bool CWindow::isInCurvedCorner(double x, double y) { // checks if the wayland window has a popup at pos bool CWindow::hasPopupAt(const Vector2D& pos) { - if (m_isX11) + if (m_isX11 || !m_popupHead) + return false; + + if (m_popupHead->popupTreeCount() == 0) return false; auto popup = m_popupHead->at(pos); @@ -933,9 +936,7 @@ int CWindow::popupsCount() { if (m_isX11 || !m_popupHead) return 0; - int no = -1; - m_popupHead->breadthfirst([](WP p, void* d) { *sc(d) += 1; }, &no); - return no; + return m_popupHead->popupTreeCount(); } int CWindow::surfacesCount() { -- cgit v1.2.3