fix(windows): simplify keyboard refresh and make it more on-demand - #16435
Open
mcdurdin wants to merge 2 commits into
Open
fix(windows): simplify keyboard refresh and make it more on-demand#16435mcdurdin wants to merge 2 commits into
mcdurdin wants to merge 2 commits into
Conversation
User Test ResultsTest specification and instructions Test Artifacts |
mcdurdin
commented
Aug 25, 2026
| /** | ||
| * Read the keyboard switch hotkeys, and base layout settings | ||
| */ | ||
| void LoadKeyboardSettings() { |
Member
Author
There was a problem hiding this comment.
Factored out of RefreshKeyboards
mcdurdin
force-pushed
the
fix/windows/15333-simplify-keyboard-refresh
branch
from
August 25, 2026 13:56
1ca00cd to
3778fa2
Compare
Contributor
Test Specs
Test Results
|
mcdurdin
force-pushed
the
fix/windows/15333-simplify-keyboard-refresh
branch
from
August 25, 2026 15:36
3778fa2 to
1a09e3e
Compare
rc-swag
reviewed
Aug 26, 2026
| case Message.wParam of | ||
| skHKL, // A windows language has been selected so select the most appropriate Keyman keyboard | ||
| skSelectHKL: // Select the requested Windows language (and therefore the most appropriate Keyman keyboard) | ||
| FLastHKL := Message.lParam; |
Contributor
There was a problem hiding this comment.
I may answer this later in the review but marking it so I don't forget. This deleted message seems unrelated to the new code.
Clean up the keyboard refresh process. Keyman COM API will post a `wm_keyman_refresh`, `KR_REQUEST_REFRESH` message when changes have been made to the list of installed keyboards (or some other keyboard-related settings change). Keyman Engine (any arch) will handle this message, in any process, and post a message to the master controller (keyman.exe, TfrmKeyman7Main), `wm_keyman_refresh`, `KR_PRE_REFRESH`. Keyman Engine (keyman32) will handle _this_ message in the master controller thread context, and increment the global refresh tag. It also asks the other architecture host process(es) to update their global refresh counter to the same value (by posting `wm_keyman_refresh`, `KM_PRE_REFRESH` to those process(es).) This refresh tag is then compared on-demand in each thread to the thread's current refresh tag value, when a keyboard activation is received, on set focus, or on a keystroke, and the keyboard list is refreshed at that point. This means that keyboard installation no longer triggers a large amount of activity reloading all the keyboards on all windowed threads, but rather they will gradually reload as the user interacts with them. It also fixes #15333, which related to having threads with only child windows -- that is, that were parented by top-level windows from other threads -- which thus never received the global broadcast in the earlier design. For example, VSCode, Notepad in Win11, Chrome. Fixes: #15333
mcdurdin
force-pushed
the
fix/windows/15333-simplify-keyboard-refresh
branch
from
August 26, 2026 08:16
1a09e3e to
0e332b6
Compare
rc-swag
approved these changes
Aug 27, 2026
| if(Globals::get_hwndHostARM64() != NULL) { | ||
| PostMessage(Globals::get_hwndHostARM64(), wm_keyman_refresh, KR_PRE_REFRESH, Globals::get_RefreshTag()); | ||
| } | ||
| #else |
Contributor
There was a problem hiding this comment.
Suggested change
| #else | |
| #else |
Co-authored-by: Ross Cruickshank <rc-swag@users.noreply.github.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Clean up the keyboard refresh process. Keyman COM API will post a
wm_keyman_refresh,KR_REQUEST_REFRESHmessage when changes have been made to the list of installed keyboards (or some other keyboard-related settings change).Keyman Engine (any arch) will handle this message, in any process, and post a message to the master controller (keyman.exe, TfrmKeyman7Main),
wm_keyman_refresh,KR_PRE_REFRESH.Keyman Engine (keyman32) will handle this message in the master controller thread context, and increment the global refresh tag. It also asks the other architecture host process(es) to update their global refresh counter to the same value (by posting
wm_keyman_refresh,KM_PRE_REFRESHto those process(es).)This refresh tag is then compared on-demand in each thread to the thread's current refresh tag value, when a keyboard activation is received, on set focus, or on a keystroke, and the keyboard list is refreshed at that point.
This means that keyboard installation no longer triggers a large amount of activity reloading all the keyboards on all windowed threads, but rather they will gradually reload as the user interacts with them. It also fixes #15333, which related to having threads with only child windows -- that is, that were parented by top-level windows from other threads -- which thus never received the global broadcast in the earlier design. For example, VSCode, Notepad in Win11, Chrome.
Finally, include some cleanup of unused
wm_keyman_controlandwm_keyman_refreshvalues, and some other unused messages, which were making the implementation harder to understand.Fixes: #15333
User Testing
TEST_BASIC_USE: Verify that Keyman continues to work as normal in everyday use - switching apps, keyboards, typing, installing new keyboards. Watch for unexpected glitches.
TEST_TEXT_EDITOR: Open the Keyman text editor. While it is open, install a new keyboard. Verify that the text editor refreshes its list of available fonts after a keyboard is installed.