Skip duplicate key events sent by IMEs like uim.
1.1 --- a/src/video/x11/SDL_x11events.c Tue Nov 01 10:48:59 2016 -0700
1.2 +++ b/src/video/x11/SDL_x11events.c Tue Nov 01 17:38:05 2016 +0000
1.3 @@ -574,6 +574,9 @@
1.4 if (orig_keycode) {
1.5 #if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H)
1.6 SDL_Scancode scancode = videodata->key_layout[orig_keycode];
1.7 + videodata->filter_code = orig_keycode;
1.8 + videodata->filter_time = xevent.xkey.time;
1.9 +
1.10 if (orig_event_type == KeyPress) {
1.11 SDL_SendKeyboardKey(SDL_PRESSED, scancode);
1.12 } else {
1.13 @@ -582,6 +585,9 @@
1.14 #endif
1.15 }
1.16 return;
1.17 + } else if (orig_keycode == videodata->filter_code && xevent.xkey.time == videodata->filter_time) {
1.18 + /* This is a duplicate event, resent by an IME - skip it. */
1.19 + return;
1.20 }
1.21
1.22 /* Send a SDL_SYSWMEVENT if the application wants them */
2.1 --- a/src/video/x11/SDL_x11video.h Tue Nov 01 10:48:59 2016 -0700
2.2 +++ b/src/video/x11/SDL_x11video.h Tue Nov 01 17:38:05 2016 +0000
2.3 @@ -133,6 +133,10 @@
2.4 #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
2.5 XkbDescPtr xkb;
2.6 #endif
2.7 +
2.8 + KeyCode filter_code;
2.9 + Time filter_time;
2.10 +
2.11 } SDL_VideoData;
2.12
2.13 extern SDL_bool X11_UseDirectColorVisuals(void);