summaryrefslogtreecommitdiff
path: root/src/events/Devices.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/events/Devices.cpp')
-rw-r--r--src/events/Devices.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/events/Devices.cpp b/src/events/Devices.cpp
index 11c27418..cb6ea874 100644
--- a/src/events/Devices.cpp
+++ b/src/events/Devices.cpp
@@ -106,6 +106,23 @@ void Events::listener_destroyConstraint(void* owner, void* data) {
if (PCONSTRAINT->pMouse->currentConstraint == PCONSTRAINT->constraint) {
PCONSTRAINT->pMouse->hyprListener_commitConstraint.removeCallback();
+
+ const auto PWINDOW = g_pCompositor->getConstraintWindow(g_pCompositor->m_sSeat.mouse);
+
+ if (PWINDOW) {
+ if (PWINDOW->m_bIsX11) {
+ wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr,
+ PCONSTRAINT->constraint->current.cursor_hint.x + PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y + PCONSTRAINT->constraint->current.cursor_hint.y);
+
+ wlr_seat_pointer_warp(PCONSTRAINT->constraint->seat, PCONSTRAINT->constraint->current.cursor_hint.x, PCONSTRAINT->constraint->current.cursor_hint.y);
+ } else {
+ wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr,
+ PCONSTRAINT->constraint->current.cursor_hint.x + PWINDOW->m_vRealPosition.vec().x, PCONSTRAINT->constraint->current.cursor_hint.y + PWINDOW->m_vRealPosition.vec().y);
+
+ wlr_seat_pointer_warp(PCONSTRAINT->constraint->seat, PCONSTRAINT->constraint->current.cursor_hint.x, PCONSTRAINT->constraint->current.cursor_hint.y);
+ }
+ }
+
PCONSTRAINT->pMouse->currentConstraint = nullptr;
}