Reset the keyboard before we lose focus so the correct window is listed in focus events.
authorSam Lantinga <slouken@libsdl.org>
Thu, 08 Nov 2012 01:07:29 -0800
changeset 6665c0ea8c57034c
parent 6664 2deb17aefbaf
child 6666 018f8019ce36
Reset the keyboard before we lose focus so the correct window is listed in focus events.
src/events/SDL_keyboard.c
     1.1 --- a/src/events/SDL_keyboard.c	Wed Nov 07 20:17:27 2012 -0800
     1.2 +++ b/src/events/SDL_keyboard.c	Thu Nov 08 01:07:29 2012 -0800
     1.3 @@ -612,6 +612,11 @@
     1.4  {
     1.5      SDL_Keyboard *keyboard = &SDL_keyboard;
     1.6  
     1.7 +    if (keyboard->focus && !window) {
     1.8 +        /* We won't get anymore keyboard messages, so reset keyboard state */
     1.9 +        SDL_ResetKeyboard();
    1.10 +    }
    1.11 +
    1.12      /* See if the current window has lost focus */
    1.13      if (keyboard->focus && keyboard->focus != window) {
    1.14          SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST,
    1.15 @@ -638,9 +643,6 @@
    1.16                  video->StartTextInput(video);
    1.17              }
    1.18          }
    1.19 -    } else {
    1.20 -        /* We won't get anymore keyboard messages, so reset keyboard state */
    1.21 -        SDL_ResetKeyboard();
    1.22      }
    1.23  }
    1.24