sdl2-compat: prototype corrections for SDL_event functions

From 6c25030bb797da5790d77eac712d3916de26d339 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Fri, 3 Mar 2023 01:11:10 +0300
Subject: [PATCH] prototype corrections for SDL_event functions

---
 src/dynapi/SDL_dynapi_procs.h | 20 ++++++++++----------
 src/sdl2_compat.c             |  6 ++----
 src/sdl2_compat.h             |  3 +++
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index e3aaace..5d83d27 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -148,20 +148,20 @@ SDL_DYNAPI_PROC(const char*,SDL_GetError,(void),(),return)
 SDL_DYNAPI_PROC(void,SDL_ClearError,(void),(),)
 SDL_DYNAPI_PROC(int,SDL_Error,(SDL_errorcode a),(a),return)
 SDL_DYNAPI_PROC(void,SDL_PumpEvents,(void),(),)
-SDL_DYNAPI_PROC(int,SDL_PeepEvents,(SDL_Event *a, int b, SDL_eventaction c, Uint32 d, Uint32 e),(a,b,c,d,e),return)
+SDL_DYNAPI_PROC(int,SDL_PeepEvents,(SDL2_Event *a, int b, SDL_eventaction c, Uint32 d, Uint32 e),(a,b,c,d,e),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_HasEvent,(Uint32 a),(a),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_HasEvents,(Uint32 a, Uint32 b),(a,b),return)
 SDL_DYNAPI_PROC(void,SDL_FlushEvent,(Uint32 a),(a),)
 SDL_DYNAPI_PROC(void,SDL_FlushEvents,(Uint32 a, Uint32 b),(a,b),)
-SDL_DYNAPI_PROC(int,SDL_PollEvent,(SDL_Event *a),(a),return)
-SDL_DYNAPI_PROC(int,SDL_WaitEvent,(SDL_Event *a),(a),return)
-SDL_DYNAPI_PROC(int,SDL_WaitEventTimeout,(SDL_Event *a, int b),(a,b),return)
-SDL_DYNAPI_PROC(int,SDL_PushEvent,(SDL_Event *a),(a),return)
-SDL_DYNAPI_PROC(void,SDL_SetEventFilter,(SDL_EventFilter a, void *b),(a,b),)
-SDL_DYNAPI_PROC(SDL_bool,SDL_GetEventFilter,(SDL_EventFilter *a, void **b),(a,b),return)
-SDL_DYNAPI_PROC(void,SDL_AddEventWatch,(SDL_EventFilter a, void *b),(a,b),)
-SDL_DYNAPI_PROC(void,SDL_DelEventWatch,(SDL_EventFilter a, void *b),(a,b),)
-SDL_DYNAPI_PROC(void,SDL_FilterEvents,(SDL_EventFilter a, void *b),(a,b),)
+SDL_DYNAPI_PROC(int,SDL_PollEvent,(SDL2_Event *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_WaitEvent,(SDL2_Event *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_WaitEventTimeout,(SDL2_Event *a, int b),(a,b),return)
+SDL_DYNAPI_PROC(int,SDL_PushEvent,(SDL2_Event *a),(a),return)
+SDL_DYNAPI_PROC(void,SDL_SetEventFilter,(SDL2_EventFilter a, void *b),(a,b),)
+SDL_DYNAPI_PROC(SDL_bool,SDL_GetEventFilter,(SDL2_EventFilter *a, void **b),(a,b),return)
+SDL_DYNAPI_PROC(void,SDL_AddEventWatch,(SDL2_EventFilter a, void *b),(a,b),)
+SDL_DYNAPI_PROC(void,SDL_DelEventWatch,(SDL2_EventFilter a, void *b),(a,b),)
+SDL_DYNAPI_PROC(void,SDL_FilterEvents,(SDL2_EventFilter a, void *b),(a,b),)
 SDL_DYNAPI_PROC(Uint8,SDL_EventState,(Uint32 a, int b),(a,b),return)
 SDL_DYNAPI_PROC(Uint32,SDL_RegisterEvents,(int a),(a),return)
 SDL_DYNAPI_PROC(char*,SDL_GetBasePath,(void),(),return)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index ddbe9e7..d17b110 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -1020,7 +1020,7 @@ typedef struct SDL2_SysWMEvent
     SDL2_SysWMmsg *msg;
 } SDL2_SysWMEvent;
 
-typedef union SDL2_Event
+union SDL2_Event
 {
     Uint32 type;
     SDL2_CommonEvent common;
@@ -1054,13 +1054,11 @@ typedef union SDL2_Event
     SDL2_DollarGestureEvent dgesture;
     SDL2_DropEvent drop;
     Uint8 padding[sizeof(void *) <= 8 ? 56 : sizeof(void *) == 16 ? 64 : 3 * sizeof(void *)];
-} SDL2_Event;
+};
 
 /* Make sure we haven't broken binary compatibility */
 SDL_COMPILE_TIME_ASSERT(SDL2_Event, sizeof(SDL2_Event) == sizeof(((SDL2_Event *)NULL)->padding));
 
-typedef int (SDLCALL *SDL2_EventFilter) (void *userdata, SDL2_Event *event);
-
 typedef struct EventFilterWrapperData
 {
     SDL2_EventFilter filter2;
diff --git a/src/sdl2_compat.h b/src/sdl2_compat.h
index 2156577..cc7a2f2 100644
--- a/src/sdl2_compat.h
+++ b/src/sdl2_compat.h
@@ -38,6 +38,9 @@ typedef Sint64 SDL2_GestureID;
 typedef struct SDL2_RWops SDL2_RWops;
 typedef struct SDL2_DisplayMode SDL2_DisplayMode;
 
+typedef union SDL2_Event SDL2_Event;
+typedef int (SDLCALL *SDL2_EventFilter) (void *userdata, SDL2_Event *event);
+
 struct SDL_AudioCVT;
 typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT *cvt, SDL_AudioFormat format);