summaryrefslogtreecommitdiff
path: root/src/desktop/WLSurface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/desktop/WLSurface.cpp')
-rw-r--r--src/desktop/WLSurface.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/desktop/WLSurface.cpp b/src/desktop/WLSurface.cpp
index 9ec121bb..b102c5ce 100644
--- a/src/desktop/WLSurface.cpp
+++ b/src/desktop/WLSurface.cpp
@@ -103,7 +103,10 @@ void CWLSurface::destroy() {
if (!m_pWLRSurface)
return;
+ m_pConstraint.reset();
+
hyprListener_destroy.removeCallback();
+ hyprListener_commit.removeCallback();
m_pWLRSurface->data = nullptr;
m_pWindowOwner = nullptr;
m_pLayerOwner = nullptr;
@@ -123,6 +126,11 @@ void CWLSurface::destroy() {
Debug::log(LOG, "CWLSurface {:x} called destroy()", (uintptr_t)this);
}
+static void onCommit(void* owner, void* data) {
+ const auto SURF = (CWLSurface*)owner;
+ SURF->onCommit();
+}
+
void CWLSurface::init() {
if (!m_pWLRSurface)
return;
@@ -133,6 +141,7 @@ void CWLSurface::init() {
hyprListener_destroy.initCallback(
&m_pWLRSurface->events.destroy, [&](void* owner, void* data) { destroy(); }, this, "CWLSurface");
+ hyprListener_commit.initCallback(&m_pWLRSurface->events.commit, ::onCommit, this, "CWLSurface");
Debug::log(LOG, "CWLSurface {:x} called init()", (uintptr_t)this);
}
@@ -172,3 +181,16 @@ std::optional<CBox> CWLSurface::getSurfaceBoxGlobal() {
return {};
}
+
+void CWLSurface::appendConstraint(wlr_pointer_constraint_v1* constraint) {
+ m_pConstraint = std::make_unique<CConstraint>(constraint, this);
+}
+
+void CWLSurface::onCommit() {
+ if (m_pConstraint)
+ m_pConstraint->onCommit();
+}
+
+CConstraint* CWLSurface::constraint() {
+ return m_pConstraint.get();
+}