mirror of
https://github.com/encounter/SDL.git
synced 2025-12-08 13:15:10 +00:00
Skip duplicate key events sent by IMEs like uim.
This commit is contained in:
@@ -574,6 +574,9 @@ X11_DispatchEvent(_THIS)
|
|||||||
if (orig_keycode) {
|
if (orig_keycode) {
|
||||||
#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H)
|
#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H)
|
||||||
SDL_Scancode scancode = videodata->key_layout[orig_keycode];
|
SDL_Scancode scancode = videodata->key_layout[orig_keycode];
|
||||||
|
videodata->filter_code = orig_keycode;
|
||||||
|
videodata->filter_time = xevent.xkey.time;
|
||||||
|
|
||||||
if (orig_event_type == KeyPress) {
|
if (orig_event_type == KeyPress) {
|
||||||
SDL_SendKeyboardKey(SDL_PRESSED, scancode);
|
SDL_SendKeyboardKey(SDL_PRESSED, scancode);
|
||||||
} else {
|
} else {
|
||||||
@@ -582,6 +585,9 @@ X11_DispatchEvent(_THIS)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
} else if (orig_keycode == videodata->filter_code && xevent.xkey.time == videodata->filter_time) {
|
||||||
|
/* This is a duplicate event, resent by an IME - skip it. */
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send a SDL_SYSWMEVENT if the application wants them */
|
/* Send a SDL_SYSWMEVENT if the application wants them */
|
||||||
|
|||||||
@@ -133,6 +133,10 @@ typedef struct SDL_VideoData
|
|||||||
#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
|
#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
|
||||||
XkbDescPtr xkb;
|
XkbDescPtr xkb;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
KeyCode filter_code;
|
||||||
|
Time filter_time;
|
||||||
|
|
||||||
} SDL_VideoData;
|
} SDL_VideoData;
|
||||||
|
|
||||||
extern SDL_bool X11_UseDirectColorVisuals(void);
|
extern SDL_bool X11_UseDirectColorVisuals(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user