diff --git a/src/events/Popups.cpp b/src/events/Popups.cpp index f88e6917..b56d0792 100644 --- a/src/events/Popups.cpp +++ b/src/events/Popups.cpp @@ -173,11 +173,6 @@ void Events::listener_unmapPopupXDG(void* owner, void* data) { ASSERT(PPOPUP); - if (PPOPUP->parentWindow) - std::erase(PPOPUP->parentWindow->m_lPopupSurfaces, PPOPUP->popup->base->surface); - else if (PPOPUP->parentLS) - std::erase(PPOPUP->parentLS->popupSurfaces, PPOPUP->popup->base->surface); - SubsurfaceTree::destroySurfaceTree(PPOPUP->pSurfaceTree); int lx = 0, ly = 0; @@ -188,6 +183,11 @@ void Events::listener_unmapPopupXDG(void* owner, void* data) { g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2); + if (PPOPUP->parentWindow) + std::erase(PPOPUP->parentWindow->m_lPopupSurfaces, PPOPUP->popup->base->surface); + else if (PPOPUP->parentLS) + std::erase(PPOPUP->parentLS->popupSurfaces, PPOPUP->popup->base->surface); + PPOPUP->pSurfaceTree = nullptr; g_pInputManager->simulateMouseMovement(); // to focus and return back to an appropriate surface