On Thu Apr 30 09:46:12 2026 +0000, Matteo Bruni wrote:
It's temporary until we add the full "Keyboard Layouts" DB to the registry and make the (already existing) real implementation of `NtUserGetKeyboardLayoutName()`, a few lines below, work. Otherwise, yes, the bug I'm attempting to fix with this rework very much depends on getting this right (or right enough). We want to use the detected keyboard layout LANGID for the layout name (i.e. usually the high WORD of the HKL), specifically when the locale doesn't match with the keyboard layout. The game uses the layout name alone to show proper key labels in the interface. Using the low WORD of the HKL to store the LANGID of the keyboard layout, at least in the case of layout variants (0xfxxxxxxx HKL), is another option, although that requires tweaking the "changing user locale" FIXME() and early exit in `NtUserActivateKeyboardLayout()` accordingly, and it's arguably a (temporary) step in the opposite direction to where we want to end up. Otherwise I could push the addition of the registry data (and updating all the drivers to make use of that, or at least not break in the new world) towards the front of the patch sequence, moving the fix I want to get to a bit further, so that this becomes "temporary" enough that I can drop this change. It seems to me that fixing layout ids is orthogonal to fixing the layout detection in winex11, and that it can be done in win32u only. If this is what you want to do first, and if the layout ids are indeed stable on Windows (which a couple of tests could help assert), then I think we can do that but it's probably just about adding some predefined "Layout Id" registry entries for well known layouts.
Later maybe it should live in some keyboard layout DLLs, but right now I think as the definition is mostly in win32u and user drivers that could probably go in wine.inf, or some win32u reg script. Whether we want to have all of them or only the most common ones is also a question (according to https://kbdlayout.info, native has 217 builtin layouts). -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10779#note_138352