Add per-profile toggle to disable swipe gestures#222
Open
YouHusam wants to merge 6 commits into
Open
Conversation
Toggling swipe gestures (or switching profiles that differ on it) previously called force_reconnect(), which on a USB receiver re-scans devIdx slots with ~2s-per-timeout retries and could take 20+ seconds, dropping the device and losing button events during the window. The only thing that actually changes is one CID-reporting byte, so set_rawxy_preference() now queues an in-place re-divert applied on the listener thread instead of reconnecting. Use 0x23 (not 0x03) to disable RawXY: the flags byte only updates a field when its valid bit is set, so 0x03 left the firmware rawXY state (and the cursor lock) unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The swipe-gestures-enabled flag was a single global setting, so it couldn't differ between, say, a game profile (held button, cursor free) and the desktop (swipes). Move it into each profile dict and have the engine read it from the active profile. Combined with the in-place re-divert, switching apps now flips swipe<->hold mode instantly. The flag lived only in the (unreleased) v10 config on this branch, so the v10 migration is folded to seed it per-profile instead of bumping the version. Backend exposes get/setProfileSwipeGesturesEnabled; the UI checkbox now edits the selected profile like button mappings do. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ncodes Reinstate the 20s safety auto-release that was dropped when held-button handling was generalized, and extend it to cover held keyboard keys too (routed through _release_action), so a missed UP event can no longer leave a key or mouse button stuck down. The press handler arms the timer; the release handler cancels it. Complete the _EXTENDED_VKS set (right-hand modifiers, both Windows keys, the menu key and numpad-divide) so scancode injection sets the KEYEVENTF_EXTENDEDKEY flag correctly for those keys. Keep MAPVK_VK_TO_VSC rather than the _EX variant: _EX does not encode the 0xE0 prefix for the arrow/navigation cluster in practice, which would drop the extended flag. Also drop the dead is_up local in the event-pairing loop. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Add per-profile toggle to disable swipe gestures
What this does
Adds a per-profile "Enable swipe gestures" toggle for the thumb/gesture button. When swipes are turned off, the gesture button behaves like a real held key instead of a swipe pad:
Why the related input changes
To make held keys actually work in games:
Performance
Safety / robustness
Other
Notes for reviewers
send_key_combonow actually honors itshold_ms(previously the param was ignored and down+up went out in one batch), so one-shot keyboard actions hold for ~50 ms to satisfy polling-based games.Written with Claude Opus, manually reviewed, the code looks fine to me.
Tested with MX Master 3