src/video/SDL_video.c
changeset 9745 885b6b5c8426
parent 9642 cd237569d0f6
child 9776 952ff8a5076f
     1.1 --- a/src/video/SDL_video.c	Mon Jun 15 20:24:51 2015 -0700
     1.2 +++ b/src/video/SDL_video.c	Mon Jun 15 23:44:08 2015 -0700
     1.3 @@ -2122,28 +2122,30 @@
     1.4  void
     1.5  SDL_UpdateWindowGrab(SDL_Window * window)
     1.6  {
     1.7 -    if (_this->SetWindowGrab) {
     1.8 -        SDL_Window *grabbed_window;
     1.9 -        SDL_bool grabbed;
    1.10 -        if ((SDL_GetMouse()->relative_mode || (window->flags & SDL_WINDOW_INPUT_GRABBED)) &&
    1.11 -             (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
    1.12 -            grabbed = SDL_TRUE;
    1.13 -        } else {
    1.14 -            grabbed = SDL_FALSE;
    1.15 -        }
    1.16 -
    1.17 -        grabbed_window = _this->grabbed_window;
    1.18 -        if (grabbed) {
    1.19 -            if (grabbed_window && (grabbed_window != window)) {
    1.20 -                /* stealing a grab from another window! */
    1.21 -                grabbed_window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
    1.22 +    SDL_Window *grabbed_window;
    1.23 +    SDL_bool grabbed;
    1.24 +    if ((SDL_GetMouse()->relative_mode || (window->flags & SDL_WINDOW_INPUT_GRABBED)) &&
    1.25 +         (window->flags & SDL_WINDOW_INPUT_FOCUS)) {
    1.26 +        grabbed = SDL_TRUE;
    1.27 +    } else {
    1.28 +        grabbed = SDL_FALSE;
    1.29 +    }
    1.30 +
    1.31 +    grabbed_window = _this->grabbed_window;
    1.32 +    if (grabbed) {
    1.33 +        if (grabbed_window && (grabbed_window != window)) {
    1.34 +            /* stealing a grab from another window! */
    1.35 +            grabbed_window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
    1.36 +            if (_this->SetWindowGrab) {
    1.37                  _this->SetWindowGrab(_this, grabbed_window, SDL_FALSE);
    1.38              }
    1.39 -            _this->grabbed_window = window;
    1.40 -        } else if (grabbed_window == window) {
    1.41 -            _this->grabbed_window = NULL;  /* ungrabbing. */
    1.42          }
    1.43 -
    1.44 +        _this->grabbed_window = window;
    1.45 +    } else if (grabbed_window == window) {
    1.46 +        _this->grabbed_window = NULL;  /* ungrabbing. */
    1.47 +    }
    1.48 +
    1.49 +    if (_this->SetWindowGrab) {
    1.50          _this->SetWindowGrab(_this, window, grabbed);
    1.51      }
    1.52  }