sdl2-compat: updated after latest SDL2 and SDL3 additions.

From bc7e36b1411db2c34778a39823c9314dae0ecf18 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Fri, 25 Aug 2023 21:51:56 +0300
Subject: [PATCH] updated after latest SDL2 and SDL3 additions.

---
 src/dynapi/SDL_dynapi_overrides.h |  1 +
 src/dynapi/SDL_dynapi_procs.h     |  3 +++
 src/sdl2_protos.h                 |  3 +++
 src/sdl3_include_wrapper.h        | 13 ++++++++++---
 src/sdl3_syms.h                   |  3 +++
 5 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h
index 0b59a21..7f07db0 100644
--- a/src/dynapi/SDL_dynapi_overrides.h
+++ b/src/dynapi/SDL_dynapi_overrides.h
@@ -896,3 +896,4 @@
 #define SDL_GDKSuspendComplete SDL_GDKSuspendComplete_REAL
 #define SDL_HasWindowSurface SDL_HasWindowSurface_REAL
 #define SDL_DestroyWindowSurface SDL_DestroyWindowSurface_REAL
+#define SDL_GDKGetDefaultUser SDL_GDKGetDefaultUser_REAL
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index 17b4a83..6dc36d3 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -981,3 +981,6 @@ SDL_DYNAPI_PROC(void,SDL_GDKSuspendComplete,(void),(),)
 #endif
 SDL_DYNAPI_PROC(SDL_bool,SDL_HasWindowSurface,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_DestroyWindowSurface,(SDL_Window *a),(a),return)
+#if defined(__GDK__)
+SDL_DYNAPI_PROC(int,SDL_GDKGetDefaultUser,(XUserHandle *a),(a),return)
+#endif
diff --git a/src/sdl2_protos.h b/src/sdl2_protos.h
index 87f4886..cd8c488 100644
--- a/src/sdl2_protos.h
+++ b/src/sdl2_protos.h
@@ -963,6 +963,9 @@ SDL2_PROTO(void,GDKSuspendComplete,(void))
 #endif
 SDL2_PROTO(SDL_bool,HasWindowSurface,(SDL_Window *a))
 SDL2_PROTO(int,DestroyWindowSurface,(SDL_Window *a))
+#if defined(__GDK__)
+SDL2_PROTO(int,GDKGetDefaultUser,(XUserHandle *a))
+#endif
 
 #undef SDL2_PROTO
 
diff --git a/src/sdl3_include_wrapper.h b/src/sdl3_include_wrapper.h
index 6087176..20d3564 100644
--- a/src/sdl3_include_wrapper.h
+++ b/src/sdl3_include_wrapper.h
@@ -925,18 +925,20 @@
 #define SDL_WriteS32BE IGNORE_THIS_VERSION_OF_SDL_WriteS32BE
 #define SDL_WriteS64LE IGNORE_THIS_VERSION_OF_SDL_WriteS64LE
 #define SDL_WriteS64BE IGNORE_THIS_VERSION_OF_SDL_WriteS64BE
+#define SDL_GDKGetDefaultUser IGNORE_THIS_VERSION_OF_SDL_GDKGetDefaultUser
+
 
 #define SDL_FUNCTION_POINTER_IS_VOID_POINTER 1
 #define SDL_DISABLE_OLD_NAMES 1
 #define __BUILDING_SDL2_COMPAT__ 1
-#include <SDL3/SDL.h>
-#define SDL_MAIN_HANDLED 1
-#include <SDL3/SDL_main.h>
 
+#include <SDL3/SDL.h>
 #if !SDL_VERSION_ATLEAST(3,0,0)
 #error You need to compile against SDL >= 3.0.0 headers.
 #endif
 
+#define SDL_MAIN_HANDLED 1
+#include <SDL3/SDL_main.h>
 #include <SDL3/SDL_syswm.h>
 #include <SDL3/SDL_vulkan.h>
 
@@ -952,6 +954,7 @@
 #undef CreateMutex
 #endif  /* _WIN32 */
 
+
 #ifdef SDL_AddEventWatch
 #undef SDL_AddEventWatch
 #endif
@@ -4540,6 +4543,10 @@
 #undef SDL_WriteS64BE
 #endif
 
+#ifdef SDL_GDKGetDefaultUser
+#undef SDL_GDKGetDefaultUser
+#endif
+
 /* undefine these macros too: */
 /* redefine as SDL3_xxx, if needed. */
 
diff --git a/src/sdl3_syms.h b/src/sdl3_syms.h
index 25750d2..e0a33e3 100644
--- a/src/sdl3_syms.h
+++ b/src/sdl3_syms.h
@@ -908,6 +908,9 @@ SDL3_SYM(int,PauseAudioDevice,(SDL_AudioDeviceID a),(a),return)
 SDL3_SYM(int,ResumeAudioDevice,(SDL_AudioDeviceID a),(a),return)
 SDL3_SYM(SDL_bool,IsAudioDevicePaused,(SDL_AudioDeviceID a),(a),return)
 SDL3_SYM(SDL_AudioDeviceID,GetAudioStreamBinding,(SDL_AudioStream *a),(a),return)
+#if defined(__GDK__)
+SDL3_SYM_PASSTHROUGH(int,GDKGetDefaultUser,(XUserHandle *a),(a),return)
+#endif
 
 #undef SDL3_SYM
 #undef SDL3_SYM_PASSTHROUGH