From 25aec3ac8ce65ed224f025f8f6dfef73780577a4 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 26 Apr 2024 23:55:41 +0100 Subject: pointer-constraints: move to new impl --- src/desktop/WLSurface.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/desktop/WLSurface.cpp') diff --git a/src/desktop/WLSurface.cpp b/src/desktop/WLSurface.cpp index b102c5ce..4c2f6c84 100644 --- a/src/desktop/WLSurface.cpp +++ b/src/desktop/WLSurface.cpp @@ -103,6 +103,8 @@ void CWLSurface::destroy() { if (!m_pWLRSurface) return; + events.destroy.emit(); + m_pConstraint.reset(); hyprListener_destroy.removeCallback(); @@ -182,15 +184,14 @@ std::optional CWLSurface::getSurfaceBoxGlobal() { return {}; } -void CWLSurface::appendConstraint(wlr_pointer_constraint_v1* constraint) { - m_pConstraint = std::make_unique(constraint, this); +void CWLSurface::appendConstraint(std::weak_ptr constraint) { + m_pConstraint = constraint; } void CWLSurface::onCommit() { - if (m_pConstraint) - m_pConstraint->onCommit(); + ; } -CConstraint* CWLSurface::constraint() { - return m_pConstraint.get(); +std::shared_ptr CWLSurface::constraint() { + return m_pConstraint.lock(); } -- cgit v1.2.3