Skip to content

Commit

Permalink
Only update modifier state for keys that are pressed in another appli…
Browse files Browse the repository at this point in the history
…cation

Fixes #4432
  • Loading branch information
slouken committed Apr 7, 2022
1 parent 8597735 commit 49b9e34
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/video/x11/SDL_x11events.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,22 @@ X11_ReconcileKeyboardState(_THIS)
SDL_bool sdlKeyPressed = keyboardState[scancode] == SDL_PRESSED;

if (x11KeyPressed && !sdlKeyPressed) {
SDL_SendKeyboardKey(SDL_PRESSED, scancode);
/* Only update modifier state for keys that are pressed in another application */
switch (SDL_GetKeyFromScancode(scancode)) {
case SDLK_LCTRL:
case SDLK_RCTRL:
case SDLK_LSHIFT:
case SDLK_RSHIFT:
case SDLK_LALT:
case SDLK_RALT:
case SDLK_LGUI:
case SDLK_RGUI:
case SDLK_MODE:
SDL_SendKeyboardKey(SDL_PRESSED, scancode);
break;
default:
break;
}
} else if (!x11KeyPressed && sdlKeyPressed) {
SDL_SendKeyboardKey(SDL_RELEASED, scancode);
}
Expand Down

0 comments on commit 49b9e34

Please sign in to comment.