Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an opt-in “Prevent pointer movement” setting for Gesture Button handling, allowing LinearMouse to keep the system cursor stationary while a gesture trigger is held (including through the post-gesture cooldown) by warping the pointer back when mouseMoved events are suppressed. This fits into the existing EventTransformer pipeline and configuration system by extending the gesture scheme model, UI state, and transformer behavior, with accompanying schema/localization updates and unit tests.
Changes:
- Extend gesture configuration (
suppressPointerMovement) end-to-end: model Codable, schema (.d.ts+ generated JSON), and UI binding. - Update
GestureButtonTransformerto optionally warp the cursor to counter macOS cursor movement on discardedmouseMovedevents, and injectwarpPointerfor testability. - Add/adjust unit tests to cover default behavior and suppression behavior.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| LinearMouseUnitTests/Model/Scheme/Buttons/GestureTests.swift | Adds encode/decode regression coverage for suppressPointerMovement. |
| LinearMouseUnitTests/EventTransformer/GestureButtonTransformerTests.swift | Adds tests for default vs suppressed pointer movement and injects warpPointer for verification. |
| LinearMouseUnitTests/EventTransformer/ButtonMappingTransformerTests.swift | Updates initializer call site to pass the new parameter. |
| LinearMouse/UI/ButtonsSettings/GestureButtonSection/GestureButtonSection.swift | Adds the new toggle to Gesture Button settings UI. |
| LinearMouse/UI/ButtonsSettings/ButtonsSettingsState.swift | Adds state binding plumbing for gestureSuppressPointerMovement. |
| LinearMouse/Model/Configuration/Scheme/Buttons/Gesture/Gesture.swift | Adds the new optional config field and Codable support. |
| LinearMouse/Localizable.xcstrings | Adds localized strings for the new toggle title/description. |
| LinearMouse/EventTransformer/GestureButtonTransformer.swift | Implements optional cursor warping while tracking/cooldown; adds warpPointer injection. |
| LinearMouse/EventTransformer/EventTransformerManager.swift | Wires scheme config into the transformer initializer. |
| Documentation/Configuration.json | Adds the generated JSON schema property for the new option. |
| Documentation/Configuration.d.ts | Adds the new option to the TypeScript configuration definition with metadata. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Thanks for the contribution. Button Mappings now supports swipe gestures, and I plan to move the standalone Gesture Button feature into it. I think preventing pointer movement could be the default behavior when a mapping includes a swipe gesture, rather than a separate option. A pull request implementing this behavior in Button Mappings would be welcome. |
Keep the pointer stationary while a swipe mapping is pending and until its buttons are released, without affecting direction detection. Supersedes #1372, which covered pointer locking for Gesture Button only. Includes regression tests for recognition, release, cancellation, and concurrent buttons. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Pointer movement is held in place while mapped swipe gestures are being recognized, preventing the cursor from drifting during a swipe. * The pointer returns to normal movement when the gesture ends, is canceled, or times out. Clicks from unrecognized swipes remain anchored to the original pointer position. * When multiple mapped buttons are active, the pointer remains anchored until all relevant buttons are released. Movement deltas are preserved even when reported pointer coordinates conflict. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Closes #1356.
Summary
Implementation
macOS can move the pointer even when an HID event tap discards a
mouseMovedevent. When this option is enabled, the gesture transformer discards the event and restores the pointer to its previous location.This behavior applies while the gesture is tracking and during the cooldown period until the user releases the trigger.
Screenshot
Testing
GestureButtonTransformerTestssuite.