Fixed text input events with UIM
authorSam Lantinga <slouken@libsdl.org>
Wed, 02 Nov 2016 02:56:54 -0700
changeset 105728b8a45c000f9
parent 10571 be7bd04d8342
child 10573 422723a6efc3
Fixed text input events with UIM

Alex Baines

I realized overnight that my patch probably broke text input events with UIM, and I confirmed that it does. Can't believe I overlooked that... I've been making stupid mistakes in these patches recently, sorry.

Anyway, *this* one seems to fix it properly. Knowing my luck it probably breaks something else.
src/video/x11/SDL_x11events.c
     1.1 --- a/src/video/x11/SDL_x11events.c	Wed Nov 02 02:50:27 2016 -0700
     1.2 +++ b/src/video/x11/SDL_x11events.c	Wed Nov 02 02:56:54 2016 -0700
     1.3 @@ -585,9 +585,6 @@
     1.4  #endif
     1.5          }
     1.6          return;
     1.7 -    } else if (orig_keycode == videodata->filter_code && xevent.xkey.time == videodata->filter_time) {
     1.8 -        /* This is a duplicate event, resent by an IME - skip it. */
     1.9 -        return;
    1.10      }
    1.11  
    1.12      /* Send a SDL_SYSWMEVENT if the application wants them */
    1.13 @@ -802,7 +799,10 @@
    1.14              }
    1.15  #endif
    1.16              if (!handled_by_ime) {
    1.17 -                SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]);
    1.18 +                /* Don't send the key if it looks like a duplicate of a filtered key sent by an IME */
    1.19 +                if (xevent.xkey.keycode != videodata->filter_code || xevent.xkey.time != videodata->filter_time) {
    1.20 +                    SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]);
    1.21 +                }
    1.22                  if(*text) {
    1.23                      SDL_SendKeyboardText(text);
    1.24                  }