Commit 9924a8e392a7d69c4f98d0e570e552ccf2a9e809

Sam Lantinga 2018-06-14T00:51:45

Fixed bug 4094 - No SDL_TEXTEDITING after pressing Alt key on Raspberry Pi Linux This was reproducible by running an SDL app on the console from an ssh login. In this case the terminal wasn't owned by the user running the app, so we were using the default keymap, which didn't have state transitions defined for ctrl and alt, so once we entered that state keypresses would no longer transition out of that state, nor would they generate text. As a workaround, we'll just reset to the default shift state if that happens, which means we'll get text for keys pressed while ctrl is held down, but I don't think that's a big problem. Note that in this case we also can't mute the keyboard, so the keypresses go to the console, which probably isn't what you want...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/core/linux/SDL_evdev_kbd.c b/src/core/linux/SDL_evdev_kbd.c
index 250e644..8b1d524 100644
--- a/src/core/linux/SDL_evdev_kbd.c
+++ b/src/core/linux/SDL_evdev_kbd.c
@@ -609,7 +609,10 @@ SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int d
     shift_final = (kbd->shift_state | kbd->slockstate) ^ kbd->lockstate;
     key_map = kbd->key_maps[shift_final];
     if (!key_map) {
+        /* Unsupported shift state (e.g. ctrl = 4, alt = 8), just reset to the default state */
+        kbd->shift_state = 0;
         kbd->slockstate = 0;
+        kbd->lockstate = 0;
         return;
     }