src/video/SDL_video.c
changeset 6662 698c2e533a7e
parent 6654 2ecfb25be1e2
child 6670 d4883f657288
     1.1 --- a/src/video/SDL_video.c	Wed Nov 07 11:13:28 2012 -0800
     1.2 +++ b/src/video/SDL_video.c	Wed Nov 07 15:55:43 2012 -0800
     1.3 @@ -1850,11 +1850,18 @@
     1.4      return 0;
     1.5  }
     1.6  
     1.7 -static void
     1.8 +void
     1.9  SDL_UpdateWindowGrab(SDL_Window * window)
    1.10  {
    1.11 -    if ((window->flags & SDL_WINDOW_INPUT_FOCUS) && _this->SetWindowGrab) {
    1.12 -        _this->SetWindowGrab(_this, window);
    1.13 +    if (_this->SetWindowGrab) {
    1.14 +        SDL_bool grabbed;
    1.15 +        if ((window->flags & SDL_WINDOW_INPUT_GRABBED) &&
    1.16 +            (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
    1.17 +            grabbed = SDL_TRUE;
    1.18 +        } else {
    1.19 +            grabbed = SDL_FALSE;
    1.20 +        }
    1.21 +        _this->SetWindowGrab(_this, window, grabbed);
    1.22      }
    1.23  }
    1.24  
    1.25 @@ -1924,10 +1931,7 @@
    1.26          _this->SetWindowGammaRamp(_this, window, window->gamma);
    1.27      }
    1.28  
    1.29 -    if ((window->flags & (SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_FULLSCREEN)) &&
    1.30 -        _this->SetWindowGrab) {
    1.31 -        _this->SetWindowGrab(_this, window);
    1.32 -    }
    1.33 +    SDL_UpdateWindowGrab(window);
    1.34  }
    1.35  
    1.36  void
    1.37 @@ -1937,10 +1941,7 @@
    1.38          _this->SetWindowGammaRamp(_this, window, window->saved_gamma);
    1.39      }
    1.40  
    1.41 -    if ((window->flags & (SDL_WINDOW_INPUT_GRABBED | SDL_WINDOW_FULLSCREEN)) &&
    1.42 -        _this->SetWindowGrab) {
    1.43 -        _this->SetWindowGrab(_this, window);
    1.44 -    }
    1.45 +    SDL_UpdateWindowGrab(window);
    1.46  
    1.47      /* If we're fullscreen on a single-head system and lose focus, minimize */
    1.48      if ((window->flags & SDL_WINDOW_FULLSCREEN) && _this->num_displays == 1) {