Add remappable support for horizontal scroll wheel tilt actions#359
Open
srako wants to merge 3 commits into
Open
Add remappable support for horizontal scroll wheel tilt actions#359srako wants to merge 3 commits into
srako wants to merge 3 commits into
Conversation
…buttons Add WheelLeft and WheelRight to the ButtonId enum so the main scroll wheel's horizontal tilt — which arrives as a horizontal scroll event at the OS hook, not as a button press — can be intercepted and remapped to any Action, just like a physical button. Core changes: - binding.rs: WheelLeft/WheelRight variants, ALL array, labels, and default bindings (native horizontal scroll, pass-through) - hook_runtime.rs: intercept MouseEvent::Scroll with non-zero delta_x from a non-trackpad source; look up the bound action and dispatch it with a 250ms per-direction cooldown so one deliberate tilt fires once - mouse_buttons.rs: GUI hotspots flanking the middle-click area - geometry.rs: with_wheel_tilt() auto-derives tilt hotspots from the MiddleClick position; default_labels() updated for the new buttons Default behavior is unchanged: unbound or default-bound tilt events pass through as native horizontal scroll. Only when the user maps WheelLeft/WheelRight to a non-default action does the hook suppress the scroll event and fire the bound action instead.
Greptile SummaryThis PR makes horizontal wheel tilt actions remappable. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (3): Last reviewed commit: "fix(wheel): suppress entire tilt burst t..." | Re-trigger Greptile |
…mbwheel Two bugs found in code review (PR AprilNEA#359): 1. (P1) Horizontal scroll from a thumbwheel (or any non-tilt source) was suppressed whenever WheelLeft/WheelRight had a custom binding, breaking native thumbwheel scrolling. Fix: only suppress when we actually fire the action; pass through when the cooldown blocks the fire so continuous horizontal wheels keep scrolling. 2. (P2) Action::None suppressed native horizontal scroll instead of passing it through. Fix: treat None the same as the default binding — pass through so the user keeps native scrolling.
Greptile review (PR AprilNEA#359, comment 3) found that the previous fix for thumbwheel compatibility (passing through when the cooldown blocks) introduced a scroll leak: the remaining events in a wheel-tilt burst pass through as native horizontal scroll, so a tilt mapped to e.g. Mission Control also nudges the page sideways. Fix: always Suppress when a custom action is bound, regardless of whether the cooldown allows a fire. The cooldown still prevents repeated dispatches, and the entire burst is consumed so no native scroll leaks. Document the known limitation: on devices with both a tilt wheel and a thumbwheel (e.g. MX Master 3S), mapping WheelLeft/WheelRight will also intercept the thumbwheel's native scroll. Users who need native thumbwheel scroll should not remap these buttons.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…buttons
Add WheelLeft and WheelRight to the ButtonId enum so the main scroll wheel's horizontal tilt — which arrives as a horizontal scroll event at the OS hook, not as a button press — can be intercepted and remapped to any Action, just like a physical button.
Core changes:
Default behavior is unchanged: unbound or default-bound tilt events pass through as native horizontal scroll. Only when the user maps WheelLeft/WheelRight to a non-default action does the hook suppress the scroll event and fire the bound action instead.