changeset 4882:e725a6a60c32

Ensure compositions are committed when keyboard focus changes. There may be a better way to do this.
author dewyatt
date Wed, 15 Sep 2010 00:28:19 -0400
parents 0972c2893e68
children 511948f4919e
files src/events/SDL_keyboard.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/events/SDL_keyboard.c	Tue Sep 07 20:56:02 2010 -0700
+++ b/src/events/SDL_keyboard.c	Wed Sep 15 00:28:19 2010 -0400
@@ -612,6 +612,11 @@
     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;