diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-08-21 01:15:00 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2023-08-21 01:15:00 +0200 |
| commit | 63b2189ce81f08ca77894f50e3d484902283189a (patch) | |
| tree | 930d87b3be70d7e798e8f1655ae1a016f9473fc6 /src/events/Popups.cpp | |
| parent | 025c023e4bbe22fc61a9dc39a33c0c14495230be (diff) | |
xdgshell: damage old popup coords after a reposition
fixes #3038. I updated the shell ver without properly supporting .reposition
Diffstat (limited to 'src/events/Popups.cpp')
| -rw-r--r-- | src/events/Popups.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/events/Popups.cpp b/src/events/Popups.cpp index b76c70af..0c1594a5 100644 --- a/src/events/Popups.cpp +++ b/src/events/Popups.cpp @@ -60,6 +60,7 @@ void createNewPopup(wlr_xdg_popup* popup, SXDGPopup* pHyprPopup) { pHyprPopup->hyprListener_unmapPopupXDG.initCallback(&popup->base->surface->events.unmap, &Events::listener_unmapPopupXDG, pHyprPopup, "HyprPopup"); pHyprPopup->hyprListener_newPopupFromPopupXDG.initCallback(&popup->base->events.new_popup, &Events::listener_newPopupFromPopupXDG, pHyprPopup, "HyprPopup"); pHyprPopup->hyprListener_commitPopupXDG.initCallback(&popup->base->surface->events.commit, &Events::listener_commitPopupXDG, pHyprPopup, "HyprPopup"); + pHyprPopup->hyprListener_repositionPopupXDG.initCallback(&popup->events.reposition, &Events::listener_repositionPopupXDG, pHyprPopup, "HyprPopup"); const auto PMONITOR = g_pCompositor->m_pLastMonitor; @@ -170,6 +171,21 @@ void Events::listener_mapPopupXDG(void* owner, void* data) { Debug::log(LOG, "XDG Popup got assigned a surfaceTreeNode %lx", PPOPUP->pSurfaceTree); } +void Events::listener_repositionPopupXDG(void* owner, void* data) { + SXDGPopup* PPOPUP = (SXDGPopup*)owner; + + Debug::log(LOG, "XDG Popup %lx asks for a reposition", PPOPUP); + + int lx = 0, ly = 0; + addPopupGlobalCoords(PPOPUP, &lx, &ly); + + wlr_box extents; + wlr_surface_get_extends(PPOPUP->popup->base->surface, &extents); + + PPOPUP->lastPos = {lx - extents.x, ly - extents.y}; + PPOPUP->repositionRequested = true; +} + void Events::listener_unmapPopupXDG(void* owner, void* data) { SXDGPopup* PPOPUP = (SXDGPopup*)owner; Debug::log(LOG, "XDG Popup unmapped"); @@ -207,9 +223,17 @@ void Events::listener_commitPopupXDG(void* owner, void* data) { PPOPUP->ly = PPOPUP->parentWindow->m_vRealPosition.vec().y; } - int lx = 0, ly = 0; + int lx = 0, ly = 0; addPopupGlobalCoords(PPOPUP, &lx, &ly); + wlr_box extents; + wlr_surface_get_extends(PPOPUP->popup->base->surface, &extents); + + if (PPOPUP->repositionRequested) + g_pHyprRenderer->damageBox(PPOPUP->lastPos.x, PPOPUP->lastPos.y, extents.width + 2, extents.height + 2); + + PPOPUP->repositionRequested = false; + g_pHyprRenderer->damageSurface(PPOPUP->popup->base->surface, lx, ly); } |
