fixup constraint snapping on no hint

This commit is contained in:
Vaxry 2023-02-22 23:16:11 +00:00
parent 513bbb8047
commit 2bf7f9e413

View file

@ -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);