input: fix hints not being used if committed at the beginning

This commit is contained in:
vaxerski 2023-09-15 21:01:54 +01:00
parent 56adec7c1a
commit b9b38424b0

View File

@ -1215,8 +1215,16 @@ void CInputManager::constrainMouse(SMouse* pMouse, wlr_pointer_constraint_v1* co
pMouse->hyprListener_commitConstraint.removeCallback();
if (pMouse->currentConstraint) {
if (constraint && constraint->current.committed & WLR_POINTER_CONSTRAINT_V1_STATE_CURSOR_HINT)
warpMouseToConstraintMiddle(constraintFromWlr(constraint));
if (constraint) {
const auto PCONSTRAINT = constraintFromWlr(constraint);
if (constraint->current.committed & WLR_POINTER_CONSTRAINT_V1_STATE_CURSOR_HINT) {
PCONSTRAINT->hintSet = true;
PCONSTRAINT->positionHint = {constraint->current.cursor_hint.x, constraint->current.cursor_hint.y};
}
if (constraint->current.committed & WLR_POINTER_CONSTRAINT_V1_STATE_CURSOR_HINT && constraint->type == WLR_POINTER_CONSTRAINT_V1_LOCKED)
warpMouseToConstraintMiddle(PCONSTRAINT);
}
wlr_pointer_constraint_v1_send_deactivated(pMouse->currentConstraint);
}