Skip to content

Draft: Sync keyboard depressed modifier keys properly

Leandro Ribeiro requested to merge leandrohrb/wine:fix-keyboard-alt-tab into wayland

When we Alt-tab to switch to another window, Wine Wayland receives the Alt key press from the compositor. When we switch back to the game window (using Alt-tab again), the game does not receive the Alt key press, because the focus was not the game window.

So on Wine we end up never receiving the event that says that the Alt key was release, and we get stuck as if Alt was pressed. Fortunately, when we get the focus back to the game window, the compositor sends us an event with the keyboard modifiers that are active.

So when we receive this keyboard modifiers event, we should compare the state of Alt, Shift and Control from the Wayland perspective with Wine's internal perspective. If they differ, we must update Wine's internal state, following what the compositor has told us.

We are already doing that for lock modifiers (capslock, numlock), but we are missing the depressed modifiers (alt, shift, ctrl).

Edited by Leandro Ribeiro

Merge request reports