summaryrefslogtreecommitdiff
path: root/src/desktop/Popup.cpp
diff options
context:
space:
mode:
authorVaxry <vaxry@vaxry.net>2024-02-29 21:51:50 +0000
committerVaxry <vaxry@vaxry.net>2024-02-29 21:51:50 +0000
commitf590505daf90dfb4059289a906863b59663e70a6 (patch)
treed47e3c2db284b84489c77512182507c311023366 /src/desktop/Popup.cpp
parentf801d15947e151a8129ff82c99abb208e4767322 (diff)
popup: minor fixes to xdg geometries
fixes #4900
Diffstat (limited to 'src/desktop/Popup.cpp')
-rw-r--r--src/desktop/Popup.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/desktop/Popup.cpp b/src/desktop/Popup.cpp
index ad0a1a25..7c6eb1c9 100644
--- a/src/desktop/Popup.cpp
+++ b/src/desktop/Popup.cpp
@@ -100,10 +100,12 @@ void CPopup::onDestroy() {
}
void CPopup::onMap() {
- m_vLastSize = {m_pWLR->current.geometry.width, m_pWLR->current.geometry.height};
+ m_vLastSize = {m_pWLR->base->current.geometry.width, m_pWLR->base->current.geometry.height};
const auto COORDS = coordsGlobal();
- CBox box = {COORDS, m_vLastSize};
+ CBox box;
+ wlr_surface_get_extends(m_sWLSurface.wlr(), box.pWlr());
+ box.applyFromWlr().translate(COORDS);
g_pHyprRenderer->damageBox(&box);
m_vLastPos = coordsRelativeToParent();
@@ -116,10 +118,12 @@ void CPopup::onMap() {
}
void CPopup::onUnmap() {
- m_vLastSize = {m_pWLR->current.geometry.width, m_pWLR->current.geometry.height};
+ m_vLastSize = {m_pWLR->base->current.geometry.width, m_pWLR->base->current.geometry.height};
const auto COORDS = coordsGlobal();
- CBox box = {COORDS, m_vLastSize};
+ CBox box;
+ wlr_surface_get_extends(m_sWLSurface.wlr(), box.pWlr());
+ box.applyFromWlr().translate(COORDS);
g_pHyprRenderer->damageBox(&box);
m_pSubsurfaceHead.reset();
@@ -136,10 +140,10 @@ void CPopup::onCommit() {
const auto COORDS = coordsGlobal();
const auto COORDSLOCAL = coordsRelativeToParent();
- if (m_vLastSize != Vector2D{m_pWLR->current.geometry.width, m_pWLR->current.geometry.height} || m_bRequestedReposition || m_vLastPos != COORDSLOCAL) {
+ if (m_vLastSize != Vector2D{m_pWLR->base->current.geometry.width, m_pWLR->base->current.geometry.height} || m_bRequestedReposition || m_vLastPos != COORDSLOCAL) {
CBox box = {localToGlobal(m_vLastPos), m_vLastSize};
g_pHyprRenderer->damageBox(&box);
- m_vLastSize = {m_pWLR->current.geometry.width, m_pWLR->current.geometry.height};
+ m_vLastSize = {m_pWLR->base->current.geometry.width, m_pWLR->base->current.geometry.height};
box = {COORDS, m_vLastSize};
g_pHyprRenderer->damageBox(&box);
@@ -179,6 +183,8 @@ Vector2D CPopup::coordsRelativeToParent() {
CPopup* current = this;
+ offset -= {m_pWLR->base->current.geometry.x, m_pWLR->base->current.geometry.y};
+
while (current->m_pParent) {
offset += {current->m_sWLSurface.wlr()->current.dx, current->m_sWLSurface.wlr()->current.dy};