From 9924a8e392a7d69c4f98d0e570e552ccf2a9e809 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 14 Jun 2018 00:51:45 -0700 Subject: [PATCH] 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... --- src/core/linux/SDL_evdev_kbd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/linux/SDL_evdev_kbd.c b/src/core/linux/SDL_evdev_kbd.c index 250e6440b4c77..8b1d5243e6299 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; }