http://bugs.winehq.org/show_bug.cgi?id=57097
Rémi Bernon rbernon@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |rbernon@codeweavers.com
--- Comment #7 from Rémi Bernon rbernon@codeweavers.com --- The switch is correct and it is there to set the proper Win32 scan code to vkey tables depending on the keyboard layout language. The issue with winewayland layouts seems to be coming from a mismatch in keyboard layout selection:
Whenever winewayland receives keymap change notification, we change the focused window active layout by sending it an WM_INPUTLANGCHANGEREQUEST window message. This message, then calls NtUserActivateKeyboardLayout with the selected layout. This sends a WM_INPUTLANGCHANGE message to the focused window, changing its thread info kbd_layout to the active layout.
When winewayland receives a keyboard input, we send the keyboard input as a raw scancode, which is supposed to later be translated to the proper vkey according to the active keyboard layout.
However, that conversion happens in send_hardware_message which is called directly from NtUserSendHardwareMessage, which is itself called directly from the winewayland keyboard input handler, in the context of the winewayland event thread, which is an internal thread and different from any window thread.
That thread never changed its active layout and still uses the default keyboard layout, which is always matching the user locale (may be changed with LC_ALL env var).
The keyboard layout problem can be worked around by setting LC_ALL= to the language of the desired keyboard layout.
It then could probably be fixed by calling NtUserActivateKeyboardLayout in the context of the winewayland thread, in addition to sending the WM_INPUTLANGCHANGEREQUEST message, although that message could also be hooked by application to refuse such keyboard layout activation and that should be handled.
Alternatively, the hardware message scan code -> vkey conversion could be moved to the receiving window thread, which has the right keyboard layout activated, but that would require some changes in wineserver, as it currently relies on keyboard hardware message vkey being set.