From 2bf7f9e4136ebef6db1159c636b163ecb96f23cc Mon Sep 17 00:00:00 2001 From: vaxerski Date: Wed, 22 Feb 2023 23:16:11 +0000 Subject: [PATCH] fixup constraint snapping on no hint --- src/events/Devices.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/events/Devices.cpp b/src/events/Devices.cpp index a41ba98e..ddb9365a 100644 --- a/src/events/Devices.cpp +++ b/src/events/Devices.cpp @@ -111,7 +111,7 @@ void Events::listener_newConstraint(wl_listener* listener, void* data) { if (!CONSTRAINT->hintSet) { const auto PWINDOW = g_pCompositor->getConstraintWindow(g_pCompositor->m_sSeat.mouse); - CONSTRAINT->positionHint = g_pInputManager->getMouseCoordsInternal() - PWINDOW->m_vRealPosition.goalv(); + CONSTRAINT->positionHint = Vector2D{-1, -1}; } } } @@ -124,7 +124,7 @@ void Events::listener_destroyConstraint(void* owner, void* data) { const auto PWINDOW = g_pCompositor->getConstraintWindow(g_pCompositor->m_sSeat.mouse); - if (PWINDOW) { + if (PWINDOW && PCONSTRAINT->positionHint != Vector2D{-1, -1}) { if (PWINDOW->m_bIsX11) { wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, PCONSTRAINT->positionHint.x + PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y + PCONSTRAINT->positionHint.y);