This repository was archived by the owner on Feb 25, 2025. It is now read-only.
[Win32, Keyboard] Process VK_PACKET; Unprintable keys block text#31379
Merged
dkwingsmt merged 27 commits intoflutter:mainfrom Feb 16, 2022
Merged
[Win32, Keyboard] Process VK_PACKET; Unprintable keys block text#31379dkwingsmt merged 27 commits intoflutter:mainfrom
dkwingsmt merged 27 commits intoflutter:mainfrom
Conversation
Fix embedder test Implement and finish tests
gspencergoog
approved these changes
Feb 16, 2022
|
|
||
| // Set this flag to enforce prev_state to be 0. | ||
| // | ||
| // This occurs in rare cases when the message is synthesized. |
Contributor
There was a problem hiding this comment.
Can you maybe describe at least one of the cases?
Contributor
Author
There was a problem hiding this comment.
Yes, it's actually used here and is found during actual device test. It's understandable: The F key never had a key down message, and only got a key up message. It seems that the 3rd party IME blocked its key down message and turned it into the series of backspace and char messages. So the OS probably regularized its state by saying, that although it is a key up message, the key was up somehow.
Contributor
There was a problem hiding this comment.
Sorry, I should have been more specific: I meant describe it in the comment in the code... It's OK, though.
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Feb 16, 2022
8 tasks
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.

This PR fixes issues that have been impacting the Vietnamese IME, UniKeyNT Telex Mode, the windows part of flutter/flutter#82673.
This IME adds or removes diacritics of the entire word when the last letter of the word is typed by forging Backspace keys and new characters. For example,
To get
ào, you typeaof. The detailed messages are:The first change of this PR is to process the
VK_PACKETsession, which is easy because we can just ignore theVK_PACKETmessages and take the body char messages as standalone char messages.The second change, which is way harder, is to fix a racing condition. Both the engine and the framework maintains a state of the text input field currently being edited. Sometimes the framework sends an updated state to the engine, sometimes the other way around. More specifically,
However, since all the messages triggered by the KeyF press are so tightly queued, that the first text state update above will usually, but not always, arrive after the second text state update is done locally. The symptom is that after pressing
f, the resulting text can be eitherào,ao,o, or some other random values.The best way to fix it might be to make
EditableTextwait for the text state update to finish (https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/widgets/editable_text.dart#L2171). However this might be too big of a change.The fix proposed in this PR is to make unprintable chars (such as Backspace) take up a placeholder char in the char queue, and remove this char only when the corresponding keydown message has arrived. Since the platform messenger maintains message order, and that
TextInput._instance._setEditingState(value)synchronously pushes an message to the messenger, it's guaranteed that the text state update arrives at the engine before the response of the key down event. However, this fix does not prevent the case if a key without any characters would like to change the text state.Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.