pointer-constraints: move to new impl

This commit is contained in:
Vaxry
2024-04-26 23:55:41 +01:00
parent f94264928a
commit 25aec3ac8c
20 changed files with 404 additions and 590 deletions

View File

@@ -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<CBox> CWLSurface::getSurfaceBoxGlobal() {
return {};
}
void CWLSurface::appendConstraint(wlr_pointer_constraint_v1* constraint) {
m_pConstraint = std::make_unique<CConstraint>(constraint, this);
void CWLSurface::appendConstraint(std::weak_ptr<CPointerConstraint> constraint) {
m_pConstraint = constraint;
}
void CWLSurface::onCommit() {
if (m_pConstraint)
m_pConstraint->onCommit();
;
}
CConstraint* CWLSurface::constraint() {
return m_pConstraint.get();
std::shared_ptr<CPointerConstraint> CWLSurface::constraint() {
return m_pConstraint.lock();
}