Repository navigation
Add Logitech control button support for gesture trigger and auto scroll - #1134
Merged
Merged
Conversation
…auto-scroll - Replace gesture button Picker with recording interface supporting any mouse button + modifier key combination (Mapping-based trigger) - Add backward-compatible migration from legacy "button" field to "trigger" - Route Logitech HID++ control events directly to GestureButtonTransformer and AutoScrollTransformer, bypassing synthetic events that caused cache key mismatches - Add gesture trigger to Logitech diversion whitelist so HID++ controls are properly diverted when configured as gesture triggers - Include .mouseMoved in GlobalEventTap event mask when gesture is enabled - Handle .mouseMoved in GestureButtonTransformer and AutoScrollTransformer for Logitech controls (which don't produce OS-level drag events) - Fix background-thread crash in AutoScrollTransformer by dispatching activate/deactivate to main thread - Change enabled defaults from false to true for auto-scroll and gesture to match existing Smoothed.enabled convention - Preserve gesture settings when disabling (set enabled=false instead of wiping config) - Add left/right/middle mouse CIDs (0x0050-0x0052) to native control ID set to prevent diverting OS-handled buttons
Use mouse-location window PID instead of frontmost app PID when resolving the event transformer for Logitech HID++ control events. This matches how GlobalEventTap resolves transformers for CGEvents, preventing cache key mismatches when the focused app is on a different display than the mouse pointer.
- Dispatch Logitech handleLogitechControlEvent to main thread in both AutoScrollTransformer and GestureButtonTransformer to fix data race - Move modifier flags check to press-only path in GestureButtonTransformer so release events aren't blocked when modifier is released first - Revert enabled defaults to ?? false for both autoScroll and gesture - Add deprecated "button" field back to JSON schema for backwards compat - Promote LogitechEventContext to standalone type (was nested in ButtonActionsTransformer but used by three transformer types) - Align desiredDivertedControlIDs PID resolution with event handler (use mouseLocationPid instead of frontmostPid) - Use NSEvent.mouseLocation instead of CGEvent(source: nil) in AutoScrollTransformer Logitech handler - Align Logitech dispatch order with transformer construction order - Add 9 unit tests for Gesture Codable migration (legacy button→trigger, enabled handling, encoding, round-trip)
NSEvent.mouseLocation is already in Cocoa coordinates (Y=0 at bottom), same as CGEvent.unflippedLocation which activate(at:) expects. The manual Y flip was incorrectly converting to Quartz coordinates.
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.
Summary
ButtonMappingButtonRecorder) supporting any mouse button + modifier key combination. Migratesbutton: Inttotrigger: Mappingwith backwards-compatible Codable (legacybuttonfield auto-migrates).GlobalEventTapbehavior) instead of the frontmost application, fixing gesture/auto-scroll triggers when focus and cursor are on different displays.handleLogitechControlEventin bothAutoScrollTransformerandGestureButtonTransformernow dispatches all state mutations to the main thread, fixing a data race with the CGEvent tap callback.GestureButtonTransformerLogitech handler only checks modifier flags on button press (not release), preventing stuck tracking state when modifier is released before the button.buttonfield retained in JSON schema so old configs validate.enabledfield preserved with?? falsedefault.LogitechEventContextpromoted to standalone type. Logitech dispatch order aligned with transformer construction order.desiredDivertedControlIDsusesmouseLocationPid.enabled = falseinstead of wiping the configuration.Test plan
"button": 2migrate correctly