Commit eaca5187 authored by Sam Lantinga's avatar Sam Lantinga

Fixed crash on systems that don't have StopTextInput

parent 7fcd8b75
...@@ -613,9 +613,12 @@ SDL_SetKeyboardFocus(SDL_Window * window) ...@@ -613,9 +613,12 @@ SDL_SetKeyboardFocus(SDL_Window * window)
SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST, SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST,
0, 0); 0, 0);
//Ensures IME compositions are committed /* Ensures IME compositions are committed */
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
SDL_GetVideoDevice()->StopTextInput(SDL_GetVideoDevice()); SDL_VideoDevice *video = SDL_GetVideoDevice();
if (video && video->StopTextInput) {
video->StopTextInput(video);
}
} }
} }
...@@ -626,7 +629,10 @@ SDL_SetKeyboardFocus(SDL_Window * window) ...@@ -626,7 +629,10 @@ SDL_SetKeyboardFocus(SDL_Window * window)
0, 0); 0, 0);
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
SDL_StartTextInput(); SDL_VideoDevice *video = SDL_GetVideoDevice();
if (video && video->StartTextInput) {
video->StartTextInput(video);
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment