• Arkadiusz Hiler's avatar
    winex11.drv: Send missed KEYUP events on KeymapNotify. · 2bfe81e4
    Arkadiusz Hiler authored
    Full focus lost / focus gained events on the Windows side are not
    feasible for X11's FocusIn/FocusOut events generated by keyboard grabs
    (see XGrabKeyboard()) that are used for example for Atl+Tab handling.
    Using them would degrade user's experience by causing the window to
    minimize or flash multiple times depending on a game/window manager
    combo.
    
    Because of that the programs may miss on some KEYUP events that happen
    during the grab, and since there are no focus changes on the Windows
    side the state doesn't get resynced.
    
    This change attempts to improve user experience by syncing any missed
    key release events that happened while the window haven't had focus on
    the X11 side.
    
    There's no syncing of key presses as those are more problematic because
    of window manager quirks, e.g. on KDE it may end up syncing the Tab
    press portion of Alt+Tab. Luckily missing key events for keys that were
    pressed and not released while the WM had the keyboard grab is not
    nearly as confusing as stuck keys.
    
    For Warhammer: Chaosbane, theHunter: Call of the Wild, Far Cry Primal
    and many other games that end up with stuck Alt after Alt+Tabbing.
    2bfe81e4
keyboard.c 102 KB