summaryrefslogtreecommitdiff
path: root/src/desktop/WLSurface.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2024-03-02 21:04:55 +0000
committerGitHub <noreply@github.com>2024-03-02 21:04:55 +0000
commitd72ea5f2a7fdb0d0a7bf914412327195b05199b0 (patch)
tree0ebc3bb4c8320e88cfa9010d314122c9533dcc0e /src/desktop/WLSurface.cpp
parent328ab431655f207a5ee59737291f8e8d85fab992 (diff)
input: Rewritten pointer constraints (#4889)
* rewritten constraints * send pointer enter on activate if not pointer focus * minor cleanup * simulate movement on commit * don't ignore oneshot prop * various fixes * dont send motion on confined * update pos hint on region change
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();
+}