mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-30 05:18:13 +08:00
events: Raise keyboard keys before sending the focus lost message
Otherwise, the key raises may end up being ignored.
(cherry picked from commit e62d6a95b9)
This commit is contained in:
@@ -333,6 +333,11 @@ bool SDL_SetKeyboardFocus(SDL_Window *window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
// See if the current window has lost focus
|
||||||
if (keyboard->focus && keyboard->focus != window) {
|
if (keyboard->focus && keyboard->focus != window) {
|
||||||
SDL_SendWindowEvent(keyboard->focus, SDL_EVENT_WINDOW_FOCUS_LOST, 0, 0);
|
SDL_SendWindowEvent(keyboard->focus, SDL_EVENT_WINDOW_FOCUS_LOST, 0, 0);
|
||||||
@@ -346,9 +351,6 @@ bool SDL_SetKeyboardFocus(SDL_Window *window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (keyboard->focus && !window) {
|
if (keyboard->focus && !window) {
|
||||||
// We won't get anymore keyboard messages, so reset keyboard state
|
|
||||||
SDL_ResetKeyboard();
|
|
||||||
|
|
||||||
// Also leave mouse relative mode
|
// Also leave mouse relative mode
|
||||||
if (mouse->relative_mode) {
|
if (mouse->relative_mode) {
|
||||||
SDL_SetRelativeMouseMode(false);
|
SDL_SetRelativeMouseMode(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user