mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 02:05:58 +01:00
xdgshell: damage old popup coords after a reposition
fixes #3038. I updated the shell ver without properly supporting .reposition
This commit is contained in:
parent
025c023e4b
commit
63b2189ce8
3 changed files with 33 additions and 3 deletions
|
@ -39,6 +39,7 @@ namespace Events {
|
||||||
DYNLISTENFUNC(destroyPopupXDG);
|
DYNLISTENFUNC(destroyPopupXDG);
|
||||||
DYNLISTENFUNC(commitPopupXDG);
|
DYNLISTENFUNC(commitPopupXDG);
|
||||||
DYNLISTENFUNC(newPopupFromPopupXDG);
|
DYNLISTENFUNC(newPopupFromPopupXDG);
|
||||||
|
DYNLISTENFUNC(repositionPopupXDG);
|
||||||
|
|
||||||
// Surface XDG (window)
|
// Surface XDG (window)
|
||||||
LISTENER(newXDGSurface);
|
LISTENER(newXDGSurface);
|
||||||
|
|
|
@ -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_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_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_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;
|
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);
|
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) {
|
void Events::listener_unmapPopupXDG(void* owner, void* data) {
|
||||||
SXDGPopup* PPOPUP = (SXDGPopup*)owner;
|
SXDGPopup* PPOPUP = (SXDGPopup*)owner;
|
||||||
Debug::log(LOG, "XDG Popup unmapped");
|
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;
|
PPOPUP->ly = PPOPUP->parentWindow->m_vRealPosition.vec().y;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lx = 0, ly = 0;
|
int lx = 0, ly = 0;
|
||||||
addPopupGlobalCoords(PPOPUP, &lx, &ly);
|
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);
|
g_pHyprRenderer->damageSurface(PPOPUP->popup->base->surface, lx, ly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,10 +191,14 @@ struct SXDGPopup {
|
||||||
DYNLISTENER(mapPopupXDG);
|
DYNLISTENER(mapPopupXDG);
|
||||||
DYNLISTENER(unmapPopupXDG);
|
DYNLISTENER(unmapPopupXDG);
|
||||||
DYNLISTENER(commitPopupXDG);
|
DYNLISTENER(commitPopupXDG);
|
||||||
|
DYNLISTENER(repositionPopupXDG);
|
||||||
|
|
||||||
double lx;
|
double lx;
|
||||||
double ly;
|
double ly;
|
||||||
|
|
||||||
|
Vector2D lastPos = {};
|
||||||
|
bool repositionRequested = false;
|
||||||
|
|
||||||
SSurfaceTreeNode* pSurfaceTree = nullptr;
|
SSurfaceTreeNode* pSurfaceTree = nullptr;
|
||||||
|
|
||||||
// For the list lookup
|
// For the list lookup
|
||||||
|
@ -242,8 +246,9 @@ struct STablet {
|
||||||
|
|
||||||
std::string name = "";
|
std::string name = "";
|
||||||
|
|
||||||
bool operator==(const STablet& b) const {
|
//
|
||||||
return wlrDevice == b.wlrDevice;
|
bool operator==(const STablet& b) const {
|
||||||
|
return wlrDevice == b.wlrDevice;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue