diff options
| author | Vaxry <vaxry@vaxry.net> | 2025-12-16 15:56:04 +0000 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2025-12-16 15:56:04 +0000 |
| commit | cbfdbe9fa162437ac80d87e7cf2669f3dfa6145b (patch) | |
| tree | e376e8c160ad971a777754a75463adc2d0b76469 | |
| parent | c94a981711009078c9b5f77f685f1483222071b4 (diff) | |
desktop/popup: fix invalid surface coord
| -rw-r--r-- | src/desktop/view/Popup.cpp | 12 | ||||
| -rw-r--r-- | src/desktop/view/Popup.hpp | 10 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/desktop/view/Popup.cpp b/src/desktop/view/Popup.cpp index 96a73f45..934baf50 100644 --- a/src/desktop/view/Popup.cpp +++ b/src/desktop/view/Popup.cpp @@ -91,7 +91,7 @@ std::optional<CBox> CPopup::surfaceLogicalBox() const { if (!visible()) return std::nullopt; - return CBox{t1ParentCoords(), size()}; + return CBox{coordsGlobal(), size()}; } bool CPopup::desktopComponent() const { @@ -338,14 +338,14 @@ void CPopup::reposition() { m_resource->applyPositioning(box, COORDS); } -SP<Desktop::View::CWLSurface> CPopup::getT1Owner() { +SP<Desktop::View::CWLSurface> CPopup::getT1Owner() const { if (m_windowOwner) return m_windowOwner->wlSurface(); else return m_layerOwner->wlSurface(); } -Vector2D CPopup::coordsRelativeToParent() { +Vector2D CPopup::coordsRelativeToParent() const { Vector2D offset; if (!m_resource) @@ -365,11 +365,11 @@ Vector2D CPopup::coordsRelativeToParent() { return offset; } -Vector2D CPopup::coordsGlobal() { +Vector2D CPopup::coordsGlobal() const { return localToGlobal(coordsRelativeToParent()); } -Vector2D CPopup::localToGlobal(const Vector2D& rel) { +Vector2D CPopup::localToGlobal(const Vector2D& rel) const { return t1ParentCoords() + rel; } @@ -483,7 +483,7 @@ bool CPopup::inert() const { return m_inert; } -PHLMONITOR CPopup::getMonitor() { +PHLMONITOR CPopup::getMonitor() const { if (!m_windowOwner.expired()) return m_windowOwner->m_monitor.lock(); if (!m_layerOwner.expired()) diff --git a/src/desktop/view/Popup.hpp b/src/desktop/view/Popup.hpp index 86b11acb..1654fc60 100644 --- a/src/desktop/view/Popup.hpp +++ b/src/desktop/view/Popup.hpp @@ -30,10 +30,10 @@ namespace Desktop::View { virtual bool desktopComponent() const; virtual std::optional<CBox> surfaceLogicalBox() const; - SP<Desktop::View::CWLSurface> getT1Owner(); - Vector2D coordsRelativeToParent(); - Vector2D coordsGlobal(); - PHLMONITOR getMonitor(); + SP<Desktop::View::CWLSurface> getT1Owner() const; + Vector2D coordsRelativeToParent() const; + Vector2D coordsGlobal() const; + PHLMONITOR getMonitor() const; Vector2D size() const; @@ -99,7 +99,7 @@ namespace Desktop::View { void sendScale(); void fullyDestroy(); - Vector2D localToGlobal(const Vector2D& rel); + Vector2D localToGlobal(const Vector2D& rel) const; Vector2D t1ParentCoords() const; static void bfHelper(std::vector<SP<CPopup>> const& nodes, std::function<void(SP<CPopup>, void*)> fn, void* data); }; |
