sdl2-compat: update after SDL_GetWindowGrab and SDL_SetWindowGrab removal from SDL3

From 44fec4dc89fef4432abdbde8039f8eadbf92cec9 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Mon, 25 Mar 2024 03:24:10 +0300
Subject: [PATCH] update after SDL_GetWindowGrab and SDL_SetWindowGrab removal
 from SDL3

---
 src/sdl2_compat.c          | 11 ++++++++++-
 src/sdl3_include_wrapper.h | 10 ----------
 src/sdl3_syms.h            |  2 --
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 27f33e3..fb32389 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -6461,7 +6461,16 @@ SDL_RestoreWindow(SDL_Window *window)
 DECLSPEC void SDLCALL
 SDL_SetWindowGrab(SDL_Window *window, SDL_bool grabbed)
 {
-    SDL3_SetWindowGrab(window, grabbed);
+    SDL3_SetWindowMouseGrab(window, grabbed);
+    if (SDL3_GetHintBoolean("SDL_GRAB_KEYBOARD", SDL_FALSE)) {
+        SDL3_SetWindowKeyboardGrab(window, grabbed);
+    }
+}
+
+DECLSPEC SDL_bool SDLCALL
+SDL_GetWindowGrab(SDL_Window *window)
+{
+    return SDL3_GetWindowKeyboardGrab(window) || SDL3_GetWindowMouseGrab(window);
 }
 
 DECLSPEC void SDLCALL
diff --git a/src/sdl3_include_wrapper.h b/src/sdl3_include_wrapper.h
index 600ee2a..511148a 100644
--- a/src/sdl3_include_wrapper.h
+++ b/src/sdl3_include_wrapper.h
@@ -494,7 +494,6 @@
 #define SDL_GetWindowFlags IGNORE_THIS_VERSION_OF_SDL_GetWindowFlags
 #define SDL_GetWindowFromID IGNORE_THIS_VERSION_OF_SDL_GetWindowFromID
 #define SDL_GetWindowFullscreenMode IGNORE_THIS_VERSION_OF_SDL_GetWindowFullscreenMode
-#define SDL_GetWindowGrab IGNORE_THIS_VERSION_OF_SDL_GetWindowGrab
 #define SDL_GetWindowICCProfile IGNORE_THIS_VERSION_OF_SDL_GetWindowICCProfile
 #define SDL_GetWindowID IGNORE_THIS_VERSION_OF_SDL_GetWindowID
 #define SDL_GetWindowKeyboardGrab IGNORE_THIS_VERSION_OF_SDL_GetWindowKeyboardGrab
@@ -783,7 +782,6 @@
 #define SDL_SetWindowFocusable IGNORE_THIS_VERSION_OF_SDL_SetWindowFocusable
 #define SDL_SetWindowFullscreen IGNORE_THIS_VERSION_OF_SDL_SetWindowFullscreen
 #define SDL_SetWindowFullscreenMode IGNORE_THIS_VERSION_OF_SDL_SetWindowFullscreenMode
-#define SDL_SetWindowGrab IGNORE_THIS_VERSION_OF_SDL_SetWindowGrab
 #define SDL_SetWindowHitTest IGNORE_THIS_VERSION_OF_SDL_SetWindowHitTest
 #define SDL_SetWindowIcon IGNORE_THIS_VERSION_OF_SDL_SetWindowIcon
 #define SDL_SetWindowInputFocus IGNORE_THIS_VERSION_OF_SDL_SetWindowInputFocus
@@ -2914,10 +2912,6 @@
 #undef SDL_GetWindowFullscreenMode
 #endif
 
-#ifdef SDL_GetWindowGrab
-#undef SDL_GetWindowGrab
-#endif
-
 #ifdef SDL_GetWindowICCProfile
 #undef SDL_GetWindowICCProfile
 #endif
@@ -4070,10 +4064,6 @@
 #undef SDL_SetWindowFullscreenMode
 #endif
 
-#ifdef SDL_SetWindowGrab
-#undef SDL_SetWindowGrab
-#endif
-
 #ifdef SDL_SetWindowHitTest
 #undef SDL_SetWindowHitTest
 #endif
diff --git a/src/sdl3_syms.h b/src/sdl3_syms.h
index 1ef06b3..93c6740 100644
--- a/src/sdl3_syms.h
+++ b/src/sdl3_syms.h
@@ -498,8 +498,6 @@ SDL3_SYM(int,SetWindowFullscreen,(SDL_Window *a, SDL_bool b),(a,b),return)
 SDL3_SYM_PASSTHROUGH(SDL_Surface*,GetWindowSurface,(SDL_Window *a),(a),return)
 SDL3_SYM_PASSTHROUGH(int,UpdateWindowSurface,(SDL_Window *a),(a),return)
 SDL3_SYM_PASSTHROUGH(int,UpdateWindowSurfaceRects,(SDL_Window *a, const SDL_Rect *b, int c),(a,b,c),return)
-SDL3_SYM(int,SetWindowGrab,(SDL_Window *a, SDL_bool b),(a,b),return)
-SDL3_SYM_PASSTHROUGH(SDL_bool,GetWindowGrab,(SDL_Window *a),(a),return)
 SDL3_SYM_PASSTHROUGH(void,DestroyWindow,(SDL_Window *a),(a),)
 SDL3_SYM_RENAMED(SDL_bool,IsScreenSaverEnabled,ScreenSaverEnabled,(void),(),return)
 SDL3_SYM(int,EnableScreenSaver,(void),(),return)