This repository was archived by the owner on Feb 25, 2025. It is now read-only.
[Windows] Dispatch non-surrogate events at WM_KEYDOWN #27391
Closed
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 changes the current strategy that delays all character events to WM_CHAR, so that non-surrogate events are dispatched at WM_KEYDOWN, and only surrogate events are still dispatched at WM_CHAR. This fixes the issue mentioned at flutter/flutter#78005 (comment), which is caused by #27064.
flutter/flutter#85587 noticed that Ctrl-Digit (such as Ctrl-1) key presses yield non-zero characters but will not be followed by WM_CHAR, causing its following WM_KEYUP to be lost. It tried to fix it by considering all key presses with Control modifier as non-character. However, this fix is flawed for conflicting with AltGr-Letter (Such as AltGr-Q) key presses, which intrinsically come with a CtrlLeft modifier.
This PR basically reverts #27064 and uses a different method. It is noticed that delaying WM_KEYDOWN to WM_CHAR is only for combining surrogates, and the characters of Ctrl-Digit events are BMP characters. Therefore all BMP characters do not need to be delayed, and it will no longer matter if a WM_CHAR follows a WM_KEYDOWN if the character is a BMP.
Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.