src/events/SDL_keyboard.c
changeset 8927 be64f5daf64b
parent 8149 681eb46b8ac4
child 9619 b94b6d0bff0f
     1.1 --- a/src/events/SDL_keyboard.c	Sat May 24 01:27:19 2014 -0400
     1.2 +++ b/src/events/SDL_keyboard.c	Sat May 24 01:30:37 2014 -0400
     1.3 @@ -25,6 +25,7 @@
     1.4  #include "SDL_timer.h"
     1.5  #include "SDL_events.h"
     1.6  #include "SDL_events_c.h"
     1.7 +#include "SDL_assert.h"
     1.8  #include "../video/SDL_sysvideo.h"
     1.9  
    1.10  
    1.11 @@ -619,6 +620,16 @@
    1.12  
    1.13      /* See if the current window has lost focus */
    1.14      if (keyboard->focus && keyboard->focus != window) {
    1.15 +
    1.16 +        /* new window shouldn't think it has mouse captured. */
    1.17 +        SDL_assert(!window || !(window->flags & SDL_WINDOW_MOUSE_CAPTURE));
    1.18 +
    1.19 +        /* old window must lose an existing mouse capture. */
    1.20 +        if (keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE) {
    1.21 +            SDL_CaptureMouse(SDL_FALSE);  /* drop the capture. */
    1.22 +            SDL_assert(!(keyboard->focus->flags & SDL_WINDOW_MOUSE_CAPTURE));
    1.23 +        }
    1.24 +
    1.25          SDL_SendWindowEvent(keyboard->focus, SDL_WINDOWEVENT_FOCUS_LOST,
    1.26                              0, 0);
    1.27