mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-05 16:45:33 +02:00
Remove legacy SDL2 input grab API
This commit is contained in:
committed by
Sam Lantinga
parent
cf3cf0e106
commit
f14fb979c1
@@ -462,7 +462,6 @@ SDL3_0.0.0 {
|
||||
SDL_GetWindowFlags;
|
||||
SDL_GetWindowFromID;
|
||||
SDL_GetWindowFullscreenMode;
|
||||
SDL_GetWindowGrab;
|
||||
SDL_GetWindowICCProfile;
|
||||
SDL_GetWindowID;
|
||||
SDL_GetWindowKeyboardGrab;
|
||||
@@ -752,7 +751,6 @@ SDL3_0.0.0 {
|
||||
SDL_SetWindowFocusable;
|
||||
SDL_SetWindowFullscreen;
|
||||
SDL_SetWindowFullscreenMode;
|
||||
SDL_SetWindowGrab;
|
||||
SDL_SetWindowHitTest;
|
||||
SDL_SetWindowIcon;
|
||||
SDL_SetWindowInputFocus;
|
||||
|
||||
@@ -487,7 +487,6 @@
|
||||
#define SDL_GetWindowFlags SDL_GetWindowFlags_REAL
|
||||
#define SDL_GetWindowFromID SDL_GetWindowFromID_REAL
|
||||
#define SDL_GetWindowFullscreenMode SDL_GetWindowFullscreenMode_REAL
|
||||
#define SDL_GetWindowGrab SDL_GetWindowGrab_REAL
|
||||
#define SDL_GetWindowICCProfile SDL_GetWindowICCProfile_REAL
|
||||
#define SDL_GetWindowID SDL_GetWindowID_REAL
|
||||
#define SDL_GetWindowKeyboardGrab SDL_GetWindowKeyboardGrab_REAL
|
||||
@@ -776,7 +775,6 @@
|
||||
#define SDL_SetWindowFocusable SDL_SetWindowFocusable_REAL
|
||||
#define SDL_SetWindowFullscreen SDL_SetWindowFullscreen_REAL
|
||||
#define SDL_SetWindowFullscreenMode SDL_SetWindowFullscreenMode_REAL
|
||||
#define SDL_SetWindowGrab SDL_SetWindowGrab_REAL
|
||||
#define SDL_SetWindowHitTest SDL_SetWindowHitTest_REAL
|
||||
#define SDL_SetWindowIcon SDL_SetWindowIcon_REAL
|
||||
#define SDL_SetWindowInputFocus SDL_SetWindowInputFocus_REAL
|
||||
|
||||
@@ -518,7 +518,6 @@ SDL_DYNAPI_PROC(float,SDL_GetWindowDisplayScale,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_GetWindowFlags,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowFromID,(Uint32 a),(a),return)
|
||||
SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetWindowFullscreenMode,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowGrab,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(void*,SDL_GetWindowICCProfile,(SDL_Window *a, size_t *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(Uint32,SDL_GetWindowID,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowKeyboardGrab,(SDL_Window *a),(a),return)
|
||||
@@ -796,7 +795,6 @@ SDL_DYNAPI_PROC(int,SDL_SetWindowBordered,(SDL_Window *a, SDL_bool b),(a,b),retu
|
||||
SDL_DYNAPI_PROC(int,SDL_SetWindowFocusable,(SDL_Window *a, SDL_bool b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetWindowFullscreen,(SDL_Window *a, SDL_bool b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetWindowFullscreenMode,(SDL_Window *a, const SDL_DisplayMode *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetWindowGrab,(SDL_Window *a, SDL_bool b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetWindowHitTest,(SDL_Window *a, SDL_HitTest b, void *c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetWindowIcon,(SDL_Window *a, SDL_Surface *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(int,SDL_SetWindowInputFocus,(SDL_Window *a),(a),return)
|
||||
|
||||
@@ -2300,7 +2300,7 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
|
||||
/* Ctrl-G toggle mouse grab */
|
||||
SDL_Window *window = SDL_GetWindowFromID(event->key.windowID);
|
||||
if (window) {
|
||||
SDL_SetWindowGrab(window, !SDL_GetWindowGrab(window));
|
||||
SDL_SetWindowMouseGrab(window, !SDL_GetWindowMouseGrab(window));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1911,12 +1911,7 @@ static void ApplyWindowFlags(SDL_Window *window, SDL_WindowFlags flags)
|
||||
}
|
||||
|
||||
if (flags & SDL_WINDOW_MOUSE_GRABBED) {
|
||||
/* We must specifically call SDL_SetWindowGrab() and not
|
||||
SDL_SetWindowMouseGrab() here because older applications may use
|
||||
this flag plus SDL_HINT_GRAB_KEYBOARD to indicate that they want
|
||||
the keyboard grabbed too and SDL_SetWindowMouseGrab() won't do that.
|
||||
*/
|
||||
SDL_SetWindowGrab(window, SDL_TRUE);
|
||||
SDL_SetWindowMouseGrab(window, SDL_TRUE);
|
||||
}
|
||||
if (flags & SDL_WINDOW_KEYBOARD_GRABBED) {
|
||||
SDL_SetWindowKeyboardGrab(window, SDL_TRUE);
|
||||
@@ -3311,23 +3306,6 @@ void SDL_UpdateWindowGrab(SDL_Window *window)
|
||||
}
|
||||
}
|
||||
|
||||
int SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed)
|
||||
{
|
||||
int ret_mouse_grab = 0;
|
||||
int ret_keyboard_grab = 0;
|
||||
|
||||
CHECK_WINDOW_MAGIC(window, -1);
|
||||
CHECK_WINDOW_NOT_POPUP(window, -1);
|
||||
|
||||
ret_mouse_grab = SDL_SetWindowMouseGrab(window, grabbed);
|
||||
|
||||
if (SDL_GetHintBoolean(SDL_HINT_GRAB_KEYBOARD, SDL_FALSE)) {
|
||||
ret_keyboard_grab = SDL_SetWindowKeyboardGrab(window, grabbed);
|
||||
}
|
||||
|
||||
return (!ret_mouse_grab && !ret_keyboard_grab) ? 0 : -1;
|
||||
}
|
||||
|
||||
int SDL_SetWindowKeyboardGrab(SDL_Window *window, SDL_bool grabbed)
|
||||
{
|
||||
CHECK_WINDOW_MAGIC(window, -1);
|
||||
@@ -3388,11 +3366,6 @@ int SDL_SetWindowMouseGrab(SDL_Window *window, SDL_bool grabbed)
|
||||
return 0;
|
||||
}
|
||||
|
||||
SDL_bool SDL_GetWindowGrab(SDL_Window *window)
|
||||
{
|
||||
return SDL_GetWindowKeyboardGrab(window) || SDL_GetWindowMouseGrab(window);
|
||||
}
|
||||
|
||||
SDL_bool SDL_GetWindowKeyboardGrab(SDL_Window *window)
|
||||
{
|
||||
CHECK_WINDOW_MAGIC(window, SDL_FALSE);
|
||||
|
||||
Reference in New Issue
Block a user