From fd32ec12d56be6e6e1470e1d3bf93cc6d4133c3c Mon Sep 17 00:00:00 2001 From: dewyatt Date: Wed, 15 Sep 2010 00:28:19 -0400 Subject: [PATCH] Ensure compositions are committed when keyboard focus changes. There may be a better way to do this. --- src/events/SDL_keyboard.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index cdee58f88..06fba0eb3 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -612,6 +612,11 @@ SDL_SetKeyboardFocus(SDL_Window * window) if (keyboard->focus && keyboard->focus != window) { SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); + + //Ensures IME compositions are committed + if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { + SDL_GetVideoDevice()->StopTextInput(SDL_GetVideoDevice()); + } } keyboard->focus = window;