Repository navigation
Allow swipe recording after a provisional long press - #1392
Closed
lamhoangtung wants to merge 1 commit into
Closed
lamhoangtung wants to merge 1 commit into
lamhoangtung wants to merge 1 commit into
Conversation
lujjjh
reviewed
Sep 13, 2026
| guard !pressedButtons.isEmpty, | ||
| wheelMapping == nil, | ||
| recognition == nil else { | ||
| recognition == nil || recognition == .longPress else { |
Collaborator
There was a problem hiding this comment.
This also allows a long press to become a swipe after the trigger button has already been released, as long as another button remains held.
For example:
- Hold A, then press and hold B until Long Press is recognized.
- Release B while keeping A held.
- Move the pointer past the swipe threshold.
The recorder now produces “hold A + swipe B,” even though B was already released before the movement.
Could we require all buttons participating in the recorded trigger to remain held before allowing this reclassification, or freeze the outcome on the first release? The new release test only covers a single button; ordered and simultaneous combinations with both release orders would help cover this case.
lujjjh
added a commit
that referenced
this pull request
Oct 3, 2026
Allow swipes to replace the recorder’s provisional long press while all participating buttons remain held. Releasing any participating button prevents further swipe reclassification. Runtime recognition is unchanged. Supersedes #1392 by @lamhoangtung and addresses its review feedback on partially released button combinations. Closes #1391. Validation: all 972 tests pass, including coverage for ordered and simultaneous combinations in both release orders. SwiftFormat and SwiftLint pass. Co-authored-by: lamhoangtung <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved swipe and long-press recognition in button mappings. A swipe can now take precedence over a provisional long press while the participating buttons remain held; releasing a button before the swipe is recognized preserves the long press. * Swipes continue to trigger when no long-press action is configured or the setting is **Auto**. Once a long press or swipe is recognized, later movement no longer changes the result. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: lamhoangtung <[email protected]>
Collaborator
|
Closing this in favor of #1413, with you credited as a co-author. |
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.
When a user holds a button for 500 ms before dragging in the advanced Button Mappings recorder, the preview becomes Long Press and all later movement is ignored. This makes recording a swipe require racing the long-press timer.
Allow a swipe to replace the provisional long press while the button remains held, matching the recorder's existing behavior for ordered button and wheel inputs. Release without sufficient movement still records Long Press; committed swipe and released outcomes remain unchanged. Runtime recognition is unchanged.
Closes #1391.
Validation: 21 ButtonMappingRecordingEngineTests passed with
xcodebuild teston macOS. Regression tests cover all four directions with Logitech Control 0xC3, accumulated movement after the long-press threshold, and movement after release. SwiftFormat and SwiftLint passed for the changed files.