mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-17 04:53:48 -07:00
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
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user