diff options
author | vaxerski <[email protected]> | 2023-09-15 21:01:54 +0100 |
---|---|---|
committer | vaxerski <[email protected]> | 2023-09-15 21:01:54 +0100 |
commit | b9b38424b0c431ddb43109e029893765a7422a32 (patch) | |
tree | 8f8fa66d581ac2e24912666f4c3200d4a512fb37 | |
parent | 56adec7c1a49c079f320ba3c0c5ae3948946a9e5 (diff) | |
download | Hyprland-b9b38424b0c431ddb43109e029893765a7422a32.tar.gz Hyprland-b9b38424b0c431ddb43109e029893765a7422a32.zip |
input: fix hints not being used if committed at the beginning
-rw-r--r-- | src/managers/input/InputManager.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 6b0841f5..632dc251 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -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); } @@ -1586,7 +1594,7 @@ void CInputManager::setCursorIconOnBorder(CWindow* w) { wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y}; eBorderIconDirection direction = BORDERICON_NONE; wlr_box boxFullGrabInput = {box.x - *PEXTENDBORDERGRAB - BORDERSIZE, box.y - *PEXTENDBORDERGRAB - BORDERSIZE, box.width + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE), - box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)}; + box.height + 2 * (*PEXTENDBORDERGRAB + BORDERSIZE)}; if (!wlr_box_contains_point(&boxFullGrabInput, mouseCoords.x, mouseCoords.y) || (!m_lCurrentlyHeldButtons.empty() && !currentlyDraggedWindow)) { direction = BORDERICON_NONE; |