Reset the keyboard before we lose focus so the correct window is listed in focus events.
This commit is contained in:
parent
5cfc2f618a
commit
ea720974f5
1 changed files with 5 additions and 3 deletions
|
@ -612,6 +612,11 @@ SDL_SetKeyboardFocus(SDL_Window * window)
|
|||
{
|
||||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
|
||||
if (keyboard->focus && !window) {
|
||||
/* We won't get anymore keyboard messages, so reset keyboard state */
|
||||
SDL_ResetKeyboard();
|
||||
}
|
||||
|
||||
/* See if the current window has lost focus */
|
||||
if (keyboard->focus && keyboard->focus != window) {
|
||||
SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST,
|
||||
|
@ -638,9 +643,6 @@ SDL_SetKeyboardFocus(SDL_Window * window)
|
|||
video->StartTextInput(video);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* We won't get anymore keyboard messages, so reset keyboard state */
|
||||
SDL_ResetKeyboard();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue