src/events/SDL_keyboard.c
changeset 4890 443771460df9
parent 4882 e725a6a60c32
child 5081 25d4feb7c127
     1.1 --- a/src/events/SDL_keyboard.c	Sat Sep 18 18:15:08 2010 -0700
     1.2 +++ b/src/events/SDL_keyboard.c	Sat Sep 18 18:31:01 2010 -0700
     1.3 @@ -612,11 +612,14 @@
     1.4      if (keyboard->focus && keyboard->focus != window) {
     1.5          SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST,
     1.6                              0, 0);
     1.7 -
     1.8 -        //Ensures IME compositions are committed
     1.9 -        if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
    1.10 -            SDL_GetVideoDevice()->StopTextInput(SDL_GetVideoDevice());
    1.11 -        }
    1.12 +
    1.13 +        /* Ensures IME compositions are committed */
    1.14 +        if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
    1.15 +            SDL_VideoDevice *video = SDL_GetVideoDevice();
    1.16 +            if (video && video->StopTextInput) {
    1.17 +                video->StopTextInput(video);
    1.18 +            }
    1.19 +        }
    1.20      }
    1.21  
    1.22      keyboard->focus = window;
    1.23 @@ -626,7 +629,10 @@
    1.24                              0, 0);
    1.25  
    1.26          if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
    1.27 -            SDL_StartTextInput();
    1.28 +            SDL_VideoDevice *video = SDL_GetVideoDevice();
    1.29 +            if (video && video->StartTextInput) {
    1.30 +                video->StartTextInput(video);
    1.31 +            }
    1.32          }
    1.33      }
    1.34  }