Fixed bug 3545 - SDL_EVDEV_do_text_input() may be too eager to find error cases
authorSam Lantinga <slouken@libsdl.org>
Sun, 08 Jan 2017 20:03:18 -0800
changeset 107962a0d717d55be
parent 10795 e0fd1d8379cd
child 10797 c23bdf7436b3
Fixed bug 3545 - SDL_EVDEV_do_text_input() may be too eager to find error cases

Rob

I've ran into an issue where I successfully receive SDL_KEY[UP,DOWN] events but not SDL_TEXTINPUT or SDL_TEXTEDITING. In my case the code in SDL_EVDEV_do_text_input() is returning early (on error) prior to calling SDL_SendKeyboardText(). I'm running on the RaspberryPi 3, without X11.

In SDL_EVDEV_do_text_input() there is a condition to check keysyms with a type value below 0xf0, then subtract 0xf0 from type. Without understanding the purpose of this code, I disabled it, recompiled, and I'm getting correct SDL_TEXTINPUT events. I'm going to guess that my hack/fix is going to be problematic in some other environment, but after some initial testing it looks like everything is running fine in my setup.
src/core/linux/SDL_evdev.c
     1.1 --- a/src/core/linux/SDL_evdev.c	Sun Jan 08 19:04:38 2017 -0800
     1.2 +++ b/src/core/linux/SDL_evdev.c	Sun Jan 08 20:03:18 2017 -0800
     1.3 @@ -289,6 +289,12 @@
     1.4          return;
     1.5      }
     1.6      
     1.7 +    if (kbe.kb_value == K_HOLE || kbe.kb_value == K_NOSUCHMAP) {
     1.8 +        return;
     1.9 +    }
    1.10 +
    1.11 +    kbe.kb_value ^= 0xf000;
    1.12 +
    1.13      type = KTYP(kbe.kb_value);
    1.14      
    1.15      if (type < 0xf0) {