Fixed crash on systems that don't have StopTextInput
This commit is contained in:
parent
7fcd8b7560
commit
eaca51873a
1 changed files with 12 additions and 6 deletions
|
@ -612,11 +612,14 @@ SDL_SetKeyboardFocus(SDL_Window * window)
|
||||||
if (keyboard->focus && keyboard->focus != window) {
|
if (keyboard->focus && keyboard->focus != 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
keyboard->focus = window;
|
keyboard->focus = 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue