summaryrefslogtreecommitdiff
path: root/src/events/Popups.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2023-11-04 17:03:05 +0000
committerGitHub <noreply@github.com>2023-11-04 17:03:05 +0000
commit55b4f84fea33adee3ec4b0a69c2bca6e7a1f5754 (patch)
treebe7db4f841b4ac049527daae01e683701bf92b92 /src/events/Popups.cpp
parent73e78f05ad5cafa20ac5bf177c94ac9ecca37097 (diff)
Internal: Hyprland box implementation (#3755)
* box impl * remove unused operators * missed applyfromwlr
Diffstat (limited to 'src/events/Popups.cpp')
-rw-r--r--src/events/Popups.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/events/Popups.cpp b/src/events/Popups.cpp
index 559c8410..c8898c3b 100644
--- a/src/events/Popups.cpp
+++ b/src/events/Popups.cpp
@@ -64,9 +64,9 @@ void createNewPopup(wlr_xdg_popup* popup, SXDGPopup* pHyprPopup) {
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
- wlr_box box = {.x = PMONITOR->vecPosition.x - pHyprPopup->lx, .y = PMONITOR->vecPosition.y - pHyprPopup->ly, .width = PMONITOR->vecSize.x, .height = PMONITOR->vecSize.y};
+ CBox box = {PMONITOR->vecPosition.x - pHyprPopup->lx, PMONITOR->vecPosition.y - pHyprPopup->ly, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
- wlr_xdg_popup_unconstrain_from_box(popup, &box);
+ wlr_xdg_popup_unconstrain_from_box(popup, box.pWlr());
pHyprPopup->monitor = PMONITOR;
@@ -159,8 +159,9 @@ void Events::listener_mapPopupXDG(void* owner, void* data) {
int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly);
- wlr_box extents;
- wlr_surface_get_extends(PPOPUP->popup->base->surface, &extents);
+ CBox extents;
+ wlr_surface_get_extends(PPOPUP->popup->base->surface, extents.pWlr());
+ extents.applyFromWlr();
g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2);
@@ -180,17 +181,18 @@ void Events::listener_repositionPopupXDG(void* owner, void* data) {
int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly);
- wlr_box extents;
- wlr_surface_get_extends(PPOPUP->popup->base->surface, &extents);
+ CBox extents;
+ wlr_surface_get_extends(PPOPUP->popup->base->surface, extents.pWlr());
+ extents.applyFromWlr();
PPOPUP->lastPos = {lx - extents.x, ly - extents.y};
PPOPUP->repositionRequested = true;
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
- wlr_box box = {PMONITOR->vecPosition.x - lx + PPOPUP->popup->current.geometry.x, PMONITOR->vecPosition.y - ly + PPOPUP->popup->current.geometry.y, PMONITOR->vecSize.x,
- PMONITOR->vecSize.y};
- wlr_xdg_popup_unconstrain_from_box(PPOPUP->popup, &box);
+ CBox box = {PMONITOR->vecPosition.x - lx + PPOPUP->popup->current.geometry.x, PMONITOR->vecPosition.y - ly + PPOPUP->popup->current.geometry.y, PMONITOR->vecSize.x,
+ PMONITOR->vecSize.y};
+ wlr_xdg_popup_unconstrain_from_box(PPOPUP->popup, box.pWlr());
}
void Events::listener_unmapPopupXDG(void* owner, void* data) {
@@ -207,8 +209,9 @@ void Events::listener_unmapPopupXDG(void* owner, void* data) {
int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly);
- wlr_box extents;
- wlr_surface_get_extends(PPOPUP->popup->base->surface, &extents);
+ CBox extents;
+ wlr_surface_get_extends(PPOPUP->popup->base->surface, extents.pWlr());
+ extents.applyFromWlr();
g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2);
@@ -233,8 +236,9 @@ void Events::listener_commitPopupXDG(void* owner, void* data) {
int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly);
- wlr_box extents;
- wlr_surface_get_extends(PPOPUP->popup->base->surface, &extents);
+ CBox extents;
+ wlr_surface_get_extends(PPOPUP->popup->base->surface, extents.pWlr());
+ extents.applyFromWlr();
if (PPOPUP->repositionRequested)
g_pHyprRenderer->damageBox(PPOPUP->lastPos.x, PPOPUP->lastPos.y, extents.width + 2, extents.height + 2);