diff options
author | vaxerski <[email protected]> | 2022-05-19 15:29:26 +0200 |
---|---|---|
committer | vaxerski <[email protected]> | 2022-05-19 15:29:26 +0200 |
commit | 36be9c4a11833dfceea8a2edeee0087d2f1620b1 (patch) | |
tree | 925334668428ab52b202142d56f5c7b11ec50dde | |
parent | e225d949e7f6db926d80ed50a74da2436ac28b85 (diff) | |
download | Hyprland-36be9c4a11833dfceea8a2edeee0087d2f1620b1.tar.gz Hyprland-36be9c4a11833dfceea8a2edeee0087d2f1620b1.zip |
warp to middle on remove constraint
-rw-r--r-- | src/events/Devices.cpp | 17 |
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; } |