On Tue Apr 7 21:17:37 2026 +0000, Matteo Bruni wrote:
Thanks for the review! One general question: does the general approach / order seem reasonable? For a very high level view: - introduce a tiny bit more smarts into the old `X11DRV_KEYBOARD_DetectLayout()`[https://gitlab.winehq.org/Mystral/wine/-/commit/7ef5e7436f5b0a689d152aeedd22...] - introduce `struct layout` and store the `LANGID`s detected via xkbregistry, e.g. [https://gitlab.winehq.org/Mystral/wine/-/commit/b35f3171256d0c96d756506b1f66...] - add fallback `struct layout` entries if the Xkb + xkbregistry route fails [https://gitlab.winehq.org/Mystral/wine/-/commit/e96172e24c8c9c9b92360a76756e...] - always use `struct layout` for keyboard layout stuff, e.g. [https://gitlab.winehq.org/Mystral/wine/-/commit/6f3a9d4708c13f9a2749b5ae511d...] Well, I don't know about modifying the current code, or even about trying to shoehorn it into the new KBDTABLE mechanism. I would personally just leave it to die, and introduce the new proper layout detection, until a point where we can switch over to using it by default, possibly guarded with some registry configuration option if we're still still unsure about it. This way we can decide to keep it or ditch it depending on actual reported use cases, possibly ditch it after fixing the issues with the new mechanism.
I know I mentioned something about VNC before, but after checking again the issue isn't so much about layout detection and I think things should work as well (or as badly) as they are now. The detection is broken with VNC already with the current code, this is because VNC doesn't pass through keyboard layout information and simply exposes a server-side configured XKB layout to the applications. By default this is a single US keyboard, but it can be changed with setxkbmap as well. When VNC receives a key even, it remaps the keycode to whichever keycode would have generate that keysym with its layout. This means that if you have a FR client layout, and an US server layout, Wine will detect the layout as US too. The keycodes sent from the client would be the FR keycode, but they would be remapped by the XVNC server to match the keysym, and Wine would use keycode / keysym matching an US layout. As they are remapped by the XVNC server keysym would still correctly match whatever the user is typing. The only issues would be about key positions, for any application that relies on the keyboard physical layout. Note that this issue already exists with the current code, it is a problem coming from the VNC layout remapping and not something Wine can do anything about. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10550#note_135352