Remove legacy SDL2 input grab API

This commit is contained in:
Cameron Gutman
2024-03-24 18:35:40 -05:00
committed by Sam Lantinga
parent cf3cf0e106
commit f14fb979c1
11 changed files with 21 additions and 155 deletions

View File

@@ -654,19 +654,6 @@ extern "C" {
*/
#define SDL_HINT_GDK_TEXTINPUT_TITLE "SDL_GDK_TEXTINPUT_TITLE"
/**
* A variable controlling whether grabbing input grabs the keyboard
*
* The variable can be set to the following values:
* "0" - Grab will affect only the mouse. (default)
* "1" - Grab will affect mouse and keyboard.
*
* By default SDL will not grab the keyboard so system shortcuts still work.
*
* This hint can be set anytime.
*/
#define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD"
/**
* A variable to control whether SDL_hid_enumerate() enumerates all HID devices or only controllers.
*

View File

@@ -285,8 +285,8 @@ extern DECLSPEC int SDLCALL SDL_SetRelativeMouseMode(SDL_bool enabled);
* mouse while the user is dragging something, until the user releases a mouse
* button. It is not recommended that you capture the mouse for long periods
* of time, such as the entire time your app is running. For that, you should
* probably use SDL_SetRelativeMouseMode() or SDL_SetWindowGrab(), depending
* on your goals.
* probably use SDL_SetRelativeMouseMode() or SDL_SetWindowMouseGrab(),
* depending on your goals.
*
* While captured, mouse events still report coordinates relative to the
* current (foreground) window, but those coordinates may be outside the

View File

@@ -1152,7 +1152,7 @@ extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window *win
* \sa SDL_MaximizeWindow
* \sa SDL_MinimizeWindow
* \sa SDL_SetWindowFullscreen
* \sa SDL_SetWindowGrab
* \sa SDL_SetWindowMouseGrab
* \sa SDL_ShowWindow
*/
extern DECLSPEC SDL_WindowFlags SDLCALL SDL_GetWindowFlags(SDL_Window *window);
@@ -1776,28 +1776,6 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window *window, con
*/
extern DECLSPEC int SDLCALL SDL_DestroyWindowSurface(SDL_Window *window);
/**
* Set a window's input grab mode.
*
* When input is grabbed, the mouse is confined to the window. This function
* will also grab the keyboard if `SDL_HINT_GRAB_KEYBOARD` is set. To grab the
* keyboard without also grabbing the mouse, use SDL_SetWindowKeyboardGrab().
*
* If the caller enables a grab while another window is currently grabbed, the
* other window loses its grab in favor of the caller's window.
*
* \param window the window for which the input grab mode should be set
* \param grabbed SDL_TRUE to grab input or SDL_FALSE to release input
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetGrabbedWindow
* \sa SDL_GetWindowGrab
*/
extern DECLSPEC int SDLCALL SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed);
/**
* Set a window's keyboard grab mode.
*
@@ -1826,7 +1804,6 @@ extern DECLSPEC int SDLCALL SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabb
*
* \sa SDL_GetWindowKeyboardGrab
* \sa SDL_SetWindowMouseGrab
* \sa SDL_SetWindowGrab
*/
extern DECLSPEC int SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window *window, SDL_bool grabbed);
@@ -1844,22 +1821,9 @@ extern DECLSPEC int SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window *window, SDL_bo
*
* \sa SDL_GetWindowMouseGrab
* \sa SDL_SetWindowKeyboardGrab
* \sa SDL_SetWindowGrab
*/
extern DECLSPEC int SDLCALL SDL_SetWindowMouseGrab(SDL_Window *window, SDL_bool grabbed);
/**
* Get a window's input grab mode.
*
* \param window the window to query
* \returns SDL_TRUE if input is grabbed, SDL_FALSE otherwise.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetWindowGrab
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window *window);
/**
* Get a window's keyboard grab mode.
*
@@ -1869,7 +1833,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowGrab(SDL_Window *window);
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetWindowKeyboardGrab
* \sa SDL_GetWindowGrab
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowKeyboardGrab(SDL_Window *window);
@@ -1882,7 +1845,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowKeyboardGrab(SDL_Window *window);
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_SetWindowKeyboardGrab
* \sa SDL_GetWindowGrab
*/
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowMouseGrab(SDL_Window *window);
@@ -1893,8 +1855,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowMouseGrab(SDL_Window *window);
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GetWindowGrab
* \sa SDL_SetWindowGrab
* \sa SDL_SetWindowMouseGrab
* \sa SDL_SetWindowKeyboardGrab
*/
extern DECLSPEC SDL_Window *SDLCALL SDL_GetGrabbedWindow(void);