Use boolean value for input grab mode, like we do for fullscreen mode.
authorSam Lantinga <slouken@libsdl.org>
Sun, 27 Feb 2011 20:06:45 -0800
changeset 5403424f036f7c68
parent 5402 5d102cd8aef3
child 5404 6717e01acbe0
Use boolean value for input grab mode, like we do for fullscreen mode.
include/SDL_video.h
src/video/SDL_video.c
     1.1 --- a/include/SDL_video.h	Sat Feb 26 21:39:34 2011 -0800
     1.2 +++ b/include/SDL_video.h	Sun Feb 27 20:06:45 2011 -0800
     1.3 @@ -588,21 +588,21 @@
     1.4  /**
     1.5   *  \brief Set a window's input grab mode.
     1.6   *  
     1.7 - *  \param mode This is 1 to grab input, and 0 to release input.
     1.8 + *  \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
     1.9   *  
    1.10   *  \sa SDL_GetWindowGrab()
    1.11   */
    1.12  extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
    1.13 -                                               int mode);
    1.14 +                                               SDL_bool grabbed);
    1.15  
    1.16  /**
    1.17   *  \brief Get a window's input grab mode.
    1.18   *  
    1.19 - *  \return This returns 1 if input is grabbed, and 0 otherwise.
    1.20 + *  \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
    1.21   *  
    1.22   *  \sa SDL_SetWindowGrab()
    1.23   */
    1.24 -extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_Window * window);
    1.25 +extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
    1.26  
    1.27  /**
    1.28   *  \brief Destroy a window.
     2.1 --- a/src/video/SDL_video.c	Sat Feb 26 21:39:34 2011 -0800
     2.2 +++ b/src/video/SDL_video.c	Sun Feb 27 20:06:45 2011 -0800
     2.3 @@ -108,9 +108,6 @@
     2.4          return retval; \
     2.5      }
     2.6  
     2.7 -/* Various local functions */
     2.8 -static void SDL_UpdateWindowGrab(SDL_Window * window);
     2.9 -
    2.10  /* Support for framebuffer emulation using an accelerated renderer */
    2.11  
    2.12  #define SDL_WINDOWTEXTUREDATA   "_SDL_WindowTextureData"
    2.13 @@ -1672,22 +1669,6 @@
    2.14      return _this->UpdateWindowFramebuffer(_this, window, rects, numrects);
    2.15  }
    2.16  
    2.17 -void
    2.18 -SDL_SetWindowGrab(SDL_Window * window, int mode)
    2.19 -{
    2.20 -    CHECK_WINDOW_MAGIC(window, );
    2.21 -
    2.22 -    if ((!!mode == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) {
    2.23 -        return;
    2.24 -    }
    2.25 -    if (mode) {
    2.26 -        window->flags |= SDL_WINDOW_INPUT_GRABBED;
    2.27 -    } else {
    2.28 -        window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
    2.29 -    }
    2.30 -    SDL_UpdateWindowGrab(window);
    2.31 -}
    2.32 -
    2.33  static void
    2.34  SDL_UpdateWindowGrab(SDL_Window * window)
    2.35  {
    2.36 @@ -1696,7 +1677,23 @@
    2.37      }
    2.38  }
    2.39  
    2.40 -int
    2.41 +void
    2.42 +SDL_SetWindowGrab(SDL_Window * window, SDL_bool grabbed)
    2.43 +{
    2.44 +    CHECK_WINDOW_MAGIC(window, );
    2.45 +
    2.46 +    if ((!!grabbed == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) {
    2.47 +        return;
    2.48 +    }
    2.49 +    if (grabbed) {
    2.50 +        window->flags |= SDL_WINDOW_INPUT_GRABBED;
    2.51 +    } else {
    2.52 +        window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
    2.53 +    }
    2.54 +    SDL_UpdateWindowGrab(window);
    2.55 +}
    2.56 +
    2.57 +SDL_bool
    2.58  SDL_GetWindowGrab(SDL_Window * window)
    2.59  {
    2.60      CHECK_WINDOW_MAGIC(window, 0);