SDL: Renaming SDL_eventaction to SDL_EventAction (c8a06)

From c8a066019b686351afc614a44a2111111c42d697 Mon Sep 17 00:00:00 2001
From: Petar Popovic <[EMAIL REDACTED]>
Date: Mon, 8 Apr 2024 18:01:31 +0200
Subject: [PATCH] Renaming SDL_eventaction to SDL_EventAction

---
 build-scripts/SDL_migration.cocci | 5 +++++
 docs/README-migration.md          | 3 +++
 include/SDL3/SDL_events.h         | 4 ++--
 include/SDL3/SDL_oldnames.h       | 2 ++
 src/dynapi/SDL_dynapi_procs.h     | 2 +-
 src/events/SDL_events.c           | 4 ++--
 6 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci
index ca06ac65ae350..085cef5399b53 100644
--- a/build-scripts/SDL_migration.cocci
+++ b/build-scripts/SDL_migration.cocci
@@ -3119,3 +3119,8 @@ typedef SDL_RWops, SDL_IOStream;
 - SDL_LogSetOutputFunction
 + SDL_SetLogOutputFunction
   (...)
+@@
+typedef SDL_eventaction, SDL_EventAction;
+@@
+- SDL_eventaction
++ SDL_EventAction
diff --git a/docs/README-migration.md b/docs/README-migration.md
index b87c636178459..7becc558a1a6f 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -411,6 +411,9 @@ The following functions have been removed:
 * SDL_EventState() - replaced with SDL_SetEventEnabled()
 * SDL_GetEventState() - replaced with SDL_EventEnabled()
 
+The following enums have been renamed:
+* SDL_eventaction => SDL_EventAction
+
 ## SDL_gamecontroller.h
 
 SDL_gamecontroller.h has been renamed SDL_gamepad.h, and all APIs have been renamed to match.
diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h
index 0fddf1f24829d..4b1d139174db8 100644
--- a/include/SDL3/SDL_events.h
+++ b/include/SDL3/SDL_events.h
@@ -828,7 +828,7 @@ typedef enum
     SDL_ADDEVENT,
     SDL_PEEKEVENT,
     SDL_GETEVENT
-} SDL_eventaction;
+} SDL_EventAction;
 
 /**
  * Check the event queue for messages and optionally return them.
@@ -868,7 +868,7 @@ typedef enum
  * \sa SDL_PumpEvents
  * \sa SDL_PushEvent
  */
-extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType);
+extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action, Uint32 minType, Uint32 maxType);
 /* @} */
 
 /**
diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h
index 36632a3b47e4d..7d4ffe5c3ae47 100644
--- a/include/SDL3/SDL_oldnames.h
+++ b/include/SDL3/SDL_oldnames.h
@@ -154,6 +154,7 @@
 #define SDL_WINDOWEVENT_SHOWN SDL_EVENT_WINDOW_SHOWN
 #define SDL_WINDOWEVENT_SIZE_CHANGED SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED
 #define SDL_WINDOWEVENT_TAKE_FOCUS SDL_EVENT_WINDOW_TAKE_FOCUS
+#define SDL_eventaction SDL_EventAction
 
 /* ##SDL_gamecontroller.h */
 #define SDL_CONTROLLER_AXIS_INVALID SDL_GAMEPAD_AXIS_INVALID
@@ -652,6 +653,7 @@
 #define SDL_WINDOWEVENT_SHOWN SDL_WINDOWEVENT_SHOWN_renamed_SDL_EVENT_WINDOW_SHOWN
 #define SDL_WINDOWEVENT_SIZE_CHANGED SDL_WINDOWEVENT_SIZE_CHANGED_renamed_SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED
 #define SDL_WINDOWEVENT_TAKE_FOCUS SDL_WINDOWEVENT_TAKE_FOCUS_renamed_SDL_EVENT_WINDOW_TAKE_FOCUS
+#define SDL_eventaction SDL_eventaction_renamed_SDL_EventAction
 
 /* ##SDL_gamecontroller.h */
 #define SDL_CONTROLLER_AXIS_INVALID SDL_CONTROLLER_AXIS_INVALID_renamed_SDL_GAMEPAD_AXIS_INVALID
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index aadd2e53c13c0..7089f76290277 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -647,7 +647,7 @@ SDL_DYNAPI_PROC(int,SDL_OpenURL,(const char *a),(a),return)
 SDL_DYNAPI_PROC(SDL_Storage*,SDL_OpenUserStorage,(const char *a, const char *b, SDL_PropertiesID c),(a,b,c),return)
 SDL_DYNAPI_PROC(int,SDL_PauseAudioDevice,(SDL_AudioDeviceID a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_PauseHaptic,(SDL_Haptic *a),(a),return)
-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,(SDL_Event *a, int b, SDL_EventAction c, Uint32 d, Uint32 e),(a,b,c,d,e),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_PenConnected,(SDL_PenID a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_PlayHapticRumble,(SDL_Haptic *a, float b, Uint32 c),(a,b,c),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_PollEvent,(SDL_Event *a),(a),return)
diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c
index 93af8aa1f9a5e..01c7028d623ec 100644
--- a/src/events/SDL_events.c
+++ b/src/events/SDL_events.c
@@ -839,7 +839,7 @@ static int SDL_SendWakeupEvent(void)
 }
 
 /* Lock the event queue, take a peep at it, and unlock it */
-static int SDL_PeepEventsInternal(SDL_Event *events, int numevents, SDL_eventaction action,
+static int SDL_PeepEventsInternal(SDL_Event *events, int numevents, SDL_EventAction action,
                                   Uint32 minType, Uint32 maxType, SDL_bool include_sentinel)
 {
     int i, used, sentinels_expected = 0;
@@ -904,7 +904,7 @@ static int SDL_PeepEventsInternal(SDL_Event *events, int numevents, SDL_eventact
 
     return used;
 }
-int SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action,
+int SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action,
                    Uint32 minType, Uint32 maxType)
 {
     return SDL_PeepEventsInternal(events, numevents, action, minType, maxType, SDL_FALSE);