Rebased and updated with an (hopefully) improved version, which now unconditionally uses fixed keycode to scancode mapping, as well as static scancode to vkey mapping tables.
The Xkb layouts are also all translated into KBDTABLES and exposed to win32u through a new KbdLayerDescriptor driver entry point, instead of all the individual mapping callbacks. The various Win32 keyboard mapping functions are now implemented using KBDTABLES only.
It includes most of https://gitlab.winehq.org/wine/wine/-/merge_requests/2408, except for the registry entries, which are probably not very useful and were subject to race conditions in that MR. This allow us to completely drop the old and bogus keyboard layout detection code, and properly detect the layouts from Xkb rules.
This should also support Win32 keyboard layout activation, when Xkb group changes (which happens when switching to another Linux keyboard layout, within the active group of 4 layout that are mapped together, and pressing a key), as well as when Xkb rules are changed (when more than 4 layouts are used and the active group of 4 layouts is changed).