-
Notifications
You must be signed in to change notification settings - Fork 6k
[Windows, Keyboard] Enqueue keyboard message #34222
Conversation
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.
| clear_key_calls(); | ||
| } | ||
|
|
||
| TEST(KeyboardTest, DisorderlyRespondedEvents) { |
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.
Wouldn't you still want to test that events that used to arrive before the framework response no longer do? Or are the other test changes sufficient to guarantee that?
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.
Other test changes are sufficient to guarantee that even when the platform messages arrive too fast for the framework to handle, nothing will be responded out of order and the events turn out to be normal, such as here.
Co-authored-by: Greg Spencer <[email protected]>

This PR changes how Win32 processes keyboard messages. The messages are now put into a queue, and the next message will not be processed at all until the previous message has been responded by the framework (or if the message does not need a response, such as a single
WM_CHAR).This fixes a racing condition described in flutter/flutter#82673 (comment). A similar strategy has been applied to macOS in #32120.
A previous attempt, #31379, alleviates the problem but failed to handle more complex scenarios.
A few unit tests have to be altered. Previously later key events will be dispatched before the framework responds to the first event. Now they will only be dispatched after the response. No perceptive changes are made.
A unit test "DisorderlyRespondedEvents" is removed, because it will no longer happen. Events will always be responded in order.
Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.