Use boolean value for input grab mode, like we do for fullscreen mode.
This commit is contained in:
parent
ce2aa2ee1d
commit
ade868c17f
2 changed files with 21 additions and 24 deletions
|
@ -588,21 +588,21 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window,
|
||||||
/**
|
/**
|
||||||
* \brief Set a window's input grab mode.
|
* \brief Set a window's input grab mode.
|
||||||
*
|
*
|
||||||
* \param mode This is 1 to grab input, and 0 to release input.
|
* \param grabbed This is SDL_TRUE to grab input, and SDL_FALSE to release input.
|
||||||
*
|
*
|
||||||
* \sa SDL_GetWindowGrab()
|
* \sa SDL_GetWindowGrab()
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
|
extern DECLSPEC void SDLCALL SDL_SetWindowGrab(SDL_Window * window,
|
||||||
int mode);
|
SDL_bool grabbed);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get a window's input grab mode.
|
* \brief Get a window's input grab mode.
|
||||||
*
|
*
|
||||||
* \return This returns 1 if input is grabbed, and 0 otherwise.
|
* \return This returns SDL_TRUE if input is grabbed, and SDL_FALSE otherwise.
|
||||||
*
|
*
|
||||||
* \sa SDL_SetWindowGrab()
|
* \sa SDL_SetWindowGrab()
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetWindowGrab(SDL_Window * window);
|
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window * window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Destroy a window.
|
* \brief Destroy a window.
|
||||||
|
|
|
@ -108,9 +108,6 @@ static SDL_VideoDevice *_this = NULL;
|
||||||
return retval; \
|
return retval; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Various local functions */
|
|
||||||
static void SDL_UpdateWindowGrab(SDL_Window * window);
|
|
||||||
|
|
||||||
/* Support for framebuffer emulation using an accelerated renderer */
|
/* Support for framebuffer emulation using an accelerated renderer */
|
||||||
|
|
||||||
#define SDL_WINDOWTEXTUREDATA "_SDL_WindowTextureData"
|
#define SDL_WINDOWTEXTUREDATA "_SDL_WindowTextureData"
|
||||||
|
@ -1672,22 +1669,6 @@ SDL_UpdateWindowSurfaceRects(SDL_Window * window, SDL_Rect * rects,
|
||||||
return _this->UpdateWindowFramebuffer(_this, window, rects, numrects);
|
return _this->UpdateWindowFramebuffer(_this, window, rects, numrects);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
SDL_SetWindowGrab(SDL_Window * window, int mode)
|
|
||||||
{
|
|
||||||
CHECK_WINDOW_MAGIC(window, );
|
|
||||||
|
|
||||||
if ((!!mode == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mode) {
|
|
||||||
window->flags |= SDL_WINDOW_INPUT_GRABBED;
|
|
||||||
} else {
|
|
||||||
window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
|
|
||||||
}
|
|
||||||
SDL_UpdateWindowGrab(window);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SDL_UpdateWindowGrab(SDL_Window * window)
|
SDL_UpdateWindowGrab(SDL_Window * window)
|
||||||
{
|
{
|
||||||
|
@ -1696,7 +1677,23 @@ SDL_UpdateWindowGrab(SDL_Window * window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
|
SDL_SetWindowGrab(SDL_Window * window, SDL_bool grabbed)
|
||||||
|
{
|
||||||
|
CHECK_WINDOW_MAGIC(window, );
|
||||||
|
|
||||||
|
if ((!!grabbed == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (grabbed) {
|
||||||
|
window->flags |= SDL_WINDOW_INPUT_GRABBED;
|
||||||
|
} else {
|
||||||
|
window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
|
||||||
|
}
|
||||||
|
SDL_UpdateWindowGrab(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_bool
|
||||||
SDL_GetWindowGrab(SDL_Window * window)
|
SDL_GetWindowGrab(SDL_Window * window)
|
||||||
{
|
{
|
||||||
CHECK_WINDOW_MAGIC(window, 0);
|
CHECK_WINDOW_MAGIC(window, 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue