Synchronize modifier keys in RawKeyboard.keysPressed with modifier flags on events.#43948
Merged
gspencergoog merged 8 commits intoflutter:masterfrom Nov 6, 2019
Merged
Conversation
e96e3a3 to
28620e3
Compare
franciscojma86
approved these changes
Nov 6, 2019
Contributor
franciscojma86
left a comment
There was a problem hiding this comment.
LGTM modulo avoiding "we" in comments
Contributor
Author
|
Thanks! Don't worry, we'll fix that. :-) |
111ba31 to
756c2b4
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Currently, we listen to keyboard events to find out which keys should be represented in
RawKeyboard.instance.keysPressed, but that's not sufficient to represent the physical state of the keys, since modifier keys could have been pressed when the overall app did not have keyboard focus (especially on desktop platforms).This PR synchronizes the list of modifier keys in
keysPressedwith the modifier key flags that are present in the raw key event so that they can be relied upon to represent the current state of the keyboard. When synchronizing these states, we don't send any new key events, since they didn't happen when the app had keyboard focus, but if you ask "is this key down", we'll give the right answer.Related Issues
Fixes #40496
Tests
KeyEventSimulator.Breaking Change