Mercurial > sdl-ios-xcode
changeset 4890:443771460df9
Fixed crash on systems that don't have StopTextInput
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 18 Sep 2010 18:31:01 -0700 |
parents | 8c9cbb623d55 |
children | 9e1f6d3fb870 |
files | src/events/SDL_keyboard.c |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/events/SDL_keyboard.c Sat Sep 18 18:15:08 2010 -0700 +++ b/src/events/SDL_keyboard.c Sat Sep 18 18:31:01 2010 -0700 @@ -612,11 +612,14 @@ 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()); - } + + /* Ensures IME compositions are committed */ + if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { + SDL_VideoDevice *video = SDL_GetVideoDevice(); + if (video && video->StopTextInput) { + video->StopTextInput(video); + } + } } keyboard->focus = window; @@ -626,7 +629,10 @@ 0, 0); if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { - SDL_StartTextInput(); + SDL_VideoDevice *video = SDL_GetVideoDevice(); + if (video && video->StartTextInput) { + video->StartTextInput(video); + } } } }