Redo: Add buttons to gestures #31819
Merged
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.
Description
This PR is a reland of #30339.
Changes compared with the previous attempt: (See here for diff)
PointerDeviceKind.unknown,PointerEventConverterwill synthesize itsbuttonsusing the following rule: ifbuttons = 0, returnkPrimaryButton; otherwise return unchanged.TestPointerto a better API. Itsbuttonscan no longer be set; instead set it using the new optional parameter in methodsdownandmove.Explanation
The previous attempt broke some device labs and the desktop embedder. Through investigation, it's likely because
adb shell inputas well as the desktop embedder send events that have device kindunknownand buttons0, which was not synthesized withkPrimaryButton. To fix this, this PR synthesizeskPrimaryButtonforPointerDeviceKind.unknown.All red device labs have been manually tested on real Android devices.
Related Issues
Tests
I added the following tests:
PointerEventConvertershould synthesize events fromunknown.Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?