popup: minor fixes to xdg geometries

fixes #4900
This commit is contained in:
Vaxry 2024-02-29 21:51:50 +00:00
parent f801d15947
commit f590505daf

View File

@ -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};