This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
[Win32, Keyboard] Unify key changes in keyboard tests #31299
Merged
fluttergithubbot
merged 14 commits into
flutter:main
from
dkwingsmt:win-key-unify-key-changes
Feb 14, 2022
Merged
[Win32, Keyboard] Unify key changes in keyboard tests #31299
fluttergithubbot
merged 14 commits into
flutter:main
from
dkwingsmt:win-key-unify-key-changes
Feb 14, 2022
Conversation
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
gspencergoog
approved these changes
Feb 14, 2022
Contributor
gspencergoog
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| va_end(args); | ||
| window_->InjectMessageList(count, messages); | ||
| void InjectKeyboardChanges(std::vector<KeyboardChange> changes) { | ||
| window_->InjectKeyboardChanges(changes); |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe assert that window_ is initialized here.
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Feb 15, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
affects: text input
platform-windows
waiting for tree to go green
This PR is approved and tested, but waiting for the tree to be green to land.
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.

This PR refactors
keyboard_win32_unittests.ccso that, dispatching win32 messages and setting key states can be put into a single sequence, which is injected into the tester.This is required for accurate keyboard simulation. It's already possible to queue multiple messages to inject at the same time in order to allow peeking, but the key state changes must be applied either before all of them or after. However, when multiple modifier events must be injected with a single sequence, the key state changes must be interlaced within the messages. For example, when dispatching an AltGr key down (for which Win32 dispatches a ControlLeft down then a AltRight down), the correct sequence must be:
The current tests have been working fine because we haven't added Alt keys into critical keys yet, i.e. their key state don't matter (see flutter/flutter#76736). But as I'm about to resolve this issue, we must have a way to interlace the key changes.
Nevertheless, no production code or the semantic of tests are changed by this PR. This is only a refactor.
Another design was considered, where
testing::Win32Messageis appended with akey_state_changefield. But this mixes several concepts together, and isn't flexible enough for more complicated scenarios, such as key state changes that accompany key messages that are synthesized by Flutter (the ControlLeft key up synthesized right before AltGr key up).This is a prerequisite to a fix to flutter/flutter#76736.
Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.