SDL: Renamed SDL events for clarity

From 7b50bae52456430f199a89c99535d65dd9c297ea Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 23 Jan 2023 17:54:09 -0800
Subject: [PATCH] Renamed SDL events for clarity

Fixes https://github.com/libsdl-org/SDL/issues/6877
---
 build-scripts/SDL_migration.cocci           | 316 ++++++++++++++++++++
 docs/README-android.md                      |  12 +-
 docs/README-ios.md                          |  14 +-
 docs/README-macos.md                        |  10 +-
 docs/README-migration.md                    |  99 +++++-
 docs/README-raspberrypi.md                  |   2 +-
 docs/README-touch.md                        |  12 +-
 docs/README-winrt.md                        |   2 +-
 include/SDL3/SDL_events.h                   | 214 ++++++-------
 include/SDL3/SDL_hints.h                    |  32 +-
 include/SDL3/SDL_keyboard.h                 |   6 +-
 include/SDL3/SDL_locale.h                   |   2 +-
 include/SDL3/SDL_oldnames.h                 | 150 +++++++++-
 include/SDL3/SDL_quit.h                     |  12 +-
 include/SDL3/SDL_syswm.h                    |   2 +-
 src/audio/SDL_audio.c                       |  14 +-
 src/core/android/SDL_android.c              |  22 +-
 src/core/gdk/SDL_gdk.cpp                    |   4 +-
 src/core/haiku/SDL_BApp.h                   |  18 +-
 src/core/winrt/SDL_winrtapp_direct3d.cpp    |  46 +--
 src/events/SDL_clipboardevents.c            |   4 +-
 src/events/SDL_displayevents.c              |   2 +-
 src/events/SDL_dropevents.c                 |  10 +-
 src/events/SDL_events.c                     | 220 +++++++-------
 src/events/SDL_keyboard.c                   |  24 +-
 src/events/SDL_mouse.c                      |  18 +-
 src/events/SDL_quit.c                       |   2 +-
 src/events/SDL_touch.c                      |  12 +-
 src/events/SDL_windowevents.c               |  48 +--
 src/joystick/SDL_gamepad.c                  |  48 +--
 src/joystick/SDL_joystick.c                 |  46 +--
 src/render/SDL_render.c                     |  32 +-
 src/render/direct3d/SDL_render_d3d.c        |   4 +-
 src/render/direct3d11/SDL_render_d3d11.c    |   4 +-
 src/render/direct3d12/SDL_render_d3d12.c    |   4 +-
 src/render/opengl/SDL_render_gl.c           |   4 +-
 src/render/opengles2/SDL_render_gles2.c     |   2 +-
 src/render/software/SDL_render_sw.c         |   2 +-
 src/sensor/SDL_sensor.c                     |   4 +-
 src/test/SDL_test_common.c                  | 138 ++++-----
 src/video/SDL_video.c                       |  54 ++--
 src/video/android/SDL_androidevents.c       |  34 +--
 src/video/android/SDL_androidvideo.c        |   4 +-
 src/video/android/SDL_androidwindow.c       |   2 +-
 src/video/cocoa/SDL_cocoakeyboard.m         |   2 +-
 src/video/cocoa/SDL_cocoametalview.m        |   2 +-
 src/video/cocoa/SDL_cocoawindow.m           |  38 +--
 src/video/emscripten/SDL_emscriptenevents.c |  26 +-
 src/video/emscripten/SDL_emscriptenvideo.c  |   2 +-
 src/video/haiku/SDL_BApp.h                  |  18 +-
 src/video/kmsdrm/SDL_kmsdrmvideo.c          |   6 +-
 src/video/n3ds/SDL_n3dsevents.c             |   2 +-
 src/video/uikit/SDL_uikitmodes.m            |   2 +-
 src/video/uikit/SDL_uikitviewcontroller.m   |   2 +-
 src/video/wayland/SDL_waylandevents.c       |   6 +-
 src/video/wayland/SDL_waylandvideo.c        |   2 +-
 src/video/wayland/SDL_waylandwindow.c       |  22 +-
 src/video/windows/SDL_windowsevents.c       |  38 +--
 src/video/windows/SDL_windowsmodes.c        |   4 +-
 src/video/windows/SDL_windowswindow.c       |   2 +-
 src/video/winrt/SDL_winrtkeyboard.cpp       |   2 +-
 src/video/x11/SDL_x11events.c               |  48 +--
 src/video/x11/SDL_x11window.c               |   4 +-
 test/checkkeys.c                            |  18 +-
 test/checkkeysthreads.c                     |  14 +-
 test/gamepadmap.c                           |  20 +-
 test/loopwave.c                             |   8 +-
 test/relative_mode.markdown                 |   2 +-
 test/testatomic.c                           |   2 +-
 test/testaudiocapture.c                     |   8 +-
 test/testaudiohotplug.c                     |   8 +-
 test/testautomation_events.c                |   6 +-
 test/testcustomcursor.c                     |   2 +-
 test/testdrawchessboard.c                   |   6 +-
 test/testdropfile.c                         |  10 +-
 test/testgamepad.c                          |  38 +--
 test/testgeometry.c                         |   2 +-
 test/testgl.c                               |   2 +-
 test/testgles.c                             |   2 +-
 test/testgles2.c                            |   2 +-
 test/testgles2_sdf.c                        |   4 +-
 test/testhittesting.c                       |  10 +-
 test/testhotplug.c                          |  12 +-
 test/testime.c                              |   6 +-
 test/testintersections.c                    |   6 +-
 test/testjoystick.c                         |  20 +-
 test/testlocale.c                           |   6 +-
 test/testmessage.c                          |   2 +-
 test/testmouse.c                            |  14 +-
 test/testnative.c                           |   4 +-
 test/testoffscreen.c                        |   2 +-
 test/testoverlay.c                          |  10 +-
 test/testrelative.c                         |   2 +-
 test/testsensor.c                           |  10 +-
 test/testshader.c                           |   4 +-
 test/testshape.c                            |   6 +-
 test/testspriteminimal.c                    |   2 +-
 test/teststreaming.c                        |   4 +-
 test/testvulkan.c                           |   2 +-
 test/testwm.c                               |  16 +-
 test/testyuv.c                              |   6 +-
 101 files changed, 1375 insertions(+), 862 deletions(-)

diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci
index 65d4c1e1b39d..326dd2144f83 100644
--- a/build-scripts/SDL_migration.cocci
+++ b/build-scripts/SDL_migration.cocci
@@ -2005,3 +2005,319 @@ expression e;
 @@
 - e | 0
 + e
+@@
+@@
+- SDL_FIRSTEVENT
++ SDL_EVENT_FIRST
+@@
+@@
+- SDL_QUIT
++ SDL_EVENT_QUIT
+@@
+@@
+- SDL_APP_TERMINATING
++ SDL_EVENT_TERMINATING
+@@
+@@
+- SDL_APP_LOWMEMORY
++ SDL_EVENT_LOW_MEMORY
+@@
+@@
+- SDL_APP_WILLENTERBACKGROUND
++ SDL_EVENT_WILL_ENTER_BACKGROUND
+@@
+@@
+- SDL_APP_DIDENTERBACKGROUND
++ SDL_EVENT_DID_ENTER_BACKGROUND
+@@
+@@
+- SDL_APP_WILLENTERFOREGROUND
++ SDL_EVENT_WILL_ENTER_FOREGROUND
+@@
+@@
+- SDL_APP_DIDENTERFOREGROUND
++ SDL_EVENT_DID_ENTER_FOREGROUND
+@@
+@@
+- SDL_LOCALECHANGED
++ SDL_EVENT_LOCALE_CHANGED
+@@
+@@
+- SDL_DISPLAYEVENT_ORIENTATION
++ SDL_EVENT_DISPLAY_ORIENTATION
+@@
+@@
+- SDL_DISPLAYEVENT_CONNECTED
++ SDL_EVENT_DISPLAY_CONNECTED
+@@
+@@
+- SDL_DISPLAYEVENT_DISCONNECTED
++ SDL_EVENT_DISPLAY_DISCONNECTED
+@@
+@@
+- SDL_DISPLAYEVENT_MOVED
++ SDL_EVENT_DISPLAY_MOVED
+@@
+@@
+- SDL_DISPLAYEVENT_FIRST
++ SDL_EVENT_DISPLAY_FIRST
+@@
+@@
+- SDL_DISPLAYEVENT_LAST
++ SDL_EVENT_DISPLAY_LAST
+@@
+@@
+- SDL_SYSWMEVENT
++ SDL_EVENT_SYSWM
+@@
+@@
+- SDL_WINDOWEVENT_SHOWN
++ SDL_EVENT_WINDOW_SHOWN
+@@
+@@
+- SDL_WINDOWEVENT_HIDDEN
++ SDL_EVENT_WINDOW_HIDDEN
+@@
+@@
+- SDL_WINDOWEVENT_EXPOSED
++ SDL_EVENT_WINDOW_EXPOSED
+@@
+@@
+- SDL_WINDOWEVENT_MOVED
++ SDL_EVENT_WINDOW_MOVED
+@@
+@@
+- SDL_WINDOWEVENT_RESIZED
++ SDL_EVENT_WINDOW_RESIZED
+@@
+@@
+- SDL_WINDOWEVENT_SIZE_CHANGED
++ SDL_EVENT_WINDOW_SIZE_CHANGED
+@@
+@@
+- SDL_WINDOWEVENT_MINIMIZED
++ SDL_EVENT_WINDOW_MINIMIZED
+@@
+@@
+- SDL_WINDOWEVENT_MAXIMIZED
++ SDL_EVENT_WINDOW_MAXIMIZED
+@@
+@@
+- SDL_WINDOWEVENT_RESTORED
++ SDL_EVENT_WINDOW_RESTORED
+@@
+@@
+- SDL_WINDOWEVENT_ENTER
++ SDL_EVENT_WINDOW_MOUSE_ENTER
+@@
+@@
+- SDL_WINDOWEVENT_LEAVE
++ SDL_EVENT_WINDOW_MOUSE_LEAVE
+@@
+@@
+- SDL_WINDOWEVENT_FOCUS_GAINED
++ SDL_EVENT_WINDOW_FOCUS_GAINED
+@@
+@@
+- SDL_WINDOWEVENT_FOCUS_LOST
++ SDL_EVENT_WINDOW_FOCUS_LOST
+@@
+@@
+- SDL_WINDOWEVENT_CLOSE
++ SDL_EVENT_WINDOW_CLOSE_REQUESTED
+@@
+@@
+- SDL_WINDOWEVENT_TAKE_FOCUS
++ SDL_EVENT_WINDOW_TAKE_FOCUS
+@@
+@@
+- SDL_WINDOWEVENT_HIT_TEST
++ SDL_EVENT_WINDOW_HIT_TEST
+@@
+@@
+- SDL_WINDOWEVENT_ICCPROF_CHANGED
++ SDL_EVENT_WINDOW_ICCPROF_CHANGED
+@@
+@@
+- SDL_WINDOWEVENT_DISPLAY_CHANGED
++ SDL_EVENT_WINDOW_DISPLAY_CHANGED
+@@
+@@
+- SDL_WINDOWEVENT_FIRST
++ SDL_EVENT_WINDOW_FIRST
+@@
+@@
+- SDL_WINDOWEVENT_LAST
++ SDL_EVENT_WINDOW_LAST
+@@
+@@
+- SDL_KEYDOWN
++ SDL_EVENT_KEY_DOWN
+@@
+@@
+- SDL_KEYUP
++ SDL_EVENT_KEY_UP
+@@
+@@
+- SDL_TEXTEDITING
++ SDL_EVENT_TEXT_EDITING
+@@
+@@
+- SDL_TEXTINPUT
++ SDL_EVENT_TEXT_INPUT
+@@
+@@
+- SDL_KEYMAPCHANGED
++ SDL_EVENT_KEYMAP_CHANGED
+@@
+@@
+- SDL_TEXTEDITING_EXT
++ SDL_EVENT_TEXTEDITING_EXT
+@@
+@@
+- SDL_MOUSEMOTION
++ SDL_EVENT_MOUSE_MOTION
+@@
+@@
+- SDL_MOUSEBUTTONDOWN
++ SDL_EVENT_MOUSE_BUTTONDOWN
+@@
+@@
+- SDL_MOUSEBUTTONUP
++ SDL_EVENT_MOUSE_BUTTONUP
+@@
+@@
+- SDL_MOUSEWHEEL
++ SDL_EVENT_MOUSE_WHEEL
+@@
+@@
+- SDL_JOYAXISMOTION
++ SDL_EVENT_JOYSTICK_AXIS_MOTION
+@@
+@@
+- SDL_JOYHATMOTION
++ SDL_EVENT_JOYSTICK_HAT_MOTION
+@@
+@@
+- SDL_JOYBUTTONDOWN
++ SDL_EVENT_JOYSTICK_BUTTON_DOWN
+@@
+@@
+- SDL_JOYBUTTONUP
++ SDL_EVENT_JOYSTICK_BUTTON_UP
+@@
+@@
+- SDL_JOYDEVICEADDED
++ SDL_EVENT_JOYSTICK_ADDED
+@@
+@@
+- SDL_JOYDEVICEREMOVED
++ SDL_EVENT_JOYSTICK_REMOVED
+@@
+@@
+- SDL_JOYBATTERYUPDATED
++ SDL_EVENT_JOYSTICK_BATTERY_UPDATED
+@@
+@@
+- SDL_GAMEPADAXISMOTION
++ SDL_EVENT_GAMEPAD_AXIS_MOTION
+@@
+@@
+- SDL_GAMEPADBUTTONDOWN
++ SDL_EVENT_GAMEPAD_BUTTON_DOWN
+@@
+@@
+- SDL_GAMEPADBUTTONUP
++ SDL_EVENT_GAMEPAD_BUTTON_UP
+@@
+@@
+- SDL_GAMEPADADDED
++ SDL_EVENT_GAMEPAD_ADDED
+@@
+@@
+- SDL_GAMEPADREMOVED
++ SDL_EVENT_GAMEPAD_REMOVED
+@@
+@@
+- SDL_GAMEPADREMAPPED
++ SDL_EVENT_GAMEPAD_REMAPPED
+@@
+@@
+- SDL_GAMEPADTOUCHPADDOWN
++ SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN
+@@
+@@
+- SDL_GAMEPADTOUCHPADMOTION
++ SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION
+@@
+@@
+- SDL_GAMEPADTOUCHPADUP
++ SDL_EVENT_GAMEPAD_TOUCHPAD_UP
+@@
+@@
+- SDL_GAMEPADSENSORUPDATE
++ SDL_EVENT_GAMEPAD_SENSOR_UPDATE
+@@
+@@
+- SDL_FINGERDOWN
++ SDL_EVENT_FINGER_DOWN
+@@
+@@
+- SDL_FINGERUP
++ SDL_EVENT_FINGER_UP
+@@
+@@
+- SDL_FINGERMOTION
++ SDL_EVENT_FINGER_MOTION
+@@
+@@
+- SDL_CLIPBOARDUPDATE
++ SDL_EVENT_CLIPBOARD_UPDATE
+@@
+@@
+- SDL_DROPFILE
++ SDL_EVENT_DROP_FILE
+@@
+@@
+- SDL_DROPTEXT
++ SDL_EVENT_DROP_TEXT
+@@
+@@
+- SDL_DROPBEGIN
++ SDL_EVENT_DROP_BEGIN
+@@
+@@
+- SDL_DROPCOMPLETE
++ SDL_EVENT_DROP_COMPLETE
+@@
+@@
+- SDL_AUDIODEVICEADDED
++ SDL_EVENT_AUDIO_DEVICE_ADDED
+@@
+@@
+- SDL_AUDIODEVICEREMOVED
++ SDL_EVENT_AUDIO_DEVICE_REMOVED
+@@
+@@
+- SDL_SENSORUPDATE
++ SDL_EVENT_SENSOR_UPDATE
+@@
+@@
+- SDL_RENDER_TARGETS_RESET
++ SDL_EVENT_RENDER_TARGETS_RESET
+@@
+@@
+- SDL_RENDER_DEVICE_RESET
++ SDL_EVENT_RENDER_DEVICE_RESET
+@@
+@@
+- SDL_POLLSENTINEL
++ SDL_EVENT_POLL_SENTINEL
+@@
+@@
+- SDL_USEREVENT
++ SDL_EVENT_USER
+@@
+@@
+- SDL_LASTEVENT
++ SDL_EVENT_LAST
diff --git a/docs/README-android.md b/docs/README-android.md
index 4980aec84377..01a79d8edabe 100644
--- a/docs/README-android.md
+++ b/docs/README-android.md
@@ -195,20 +195,20 @@ app can continue to operate as it was.
 
 However, there's a chance (on older hardware, or on systems under heavy load),
 where the GL context can not be restored. In that case you have to listen for
-a specific message (SDL_RENDER_DEVICE_RESET) and restore your textures
+a specific message (SDL_EVENT_RENDER_DEVICE_RESET) and restore your textures
 manually or quit the app.
 
 You should not use the SDL renderer API while the app going in background:
-- SDL_APP_WILLENTERBACKGROUND:
+- SDL_EVENT_WILL_ENTER_BACKGROUND:
     after you read this message, GL context gets backed-up and you should not
     use the SDL renderer API.
 
     When this event is received, you have to set the render target to NULL, if you're using it.
     (eg call SDL_SetRenderTarget(renderer, NULL))
 
-- SDL_APP_DIDENTERFOREGROUND:
+- SDL_EVENT_DID_ENTER_FOREGROUND:
    GL context is restored, and the SDL renderer API is available (unless you
-   receive SDL_RENDER_DEVICE_RESET).
+   receive SDL_EVENT_RENDER_DEVICE_RESET).
 
 Mouse / Touch events
 ================================================================================
@@ -456,12 +456,12 @@ Two legitimate ways:
 Activity by calling Activity.finish().
 
 - Android OS can decide to terminate your application by calling onDestroy()
-(see Activity life cycle). Your application will receive a SDL_QUIT event you 
+(see Activity life cycle). Your application will receive an SDL_EVENT_QUIT you 
 can handle to save things and quit.
 
 Don't call exit() as it stops the activity badly.
 
-NB: "Back button" can be handled as a SDL_KEYDOWN/UP events, with Keycode
+NB: "Back button" can be handled as a SDL_EVENT_KEY_DOWN/UP events, with Keycode
 SDLK_AC_BACK, for any purpose.
 
 Known issues
diff --git a/docs/README-ios.md b/docs/README-ios.md
index 25745f6ff89d..52d765ada13f 100644
--- a/docs/README-ios.md
+++ b/docs/README-ios.md
@@ -73,34 +73,34 @@ e.g.
     {
         switch (event->type)
         {
-        case SDL_APP_TERMINATING:
+        case SDL_EVENT_TERMINATING:
             /* Terminate the app.
                Shut everything down before returning from this function.
             */
             return 0;
-        case SDL_APP_LOWMEMORY:
+        case SDL_EVENT_LOW_MEMORY:
             /* You will get this when your app is paused and iOS wants more memory.
                Release as much memory as possible.
             */
             return 0;
-        case SDL_APP_WILLENTERBACKGROUND:
+        case SDL_EVENT_WILL_ENTER_BACKGROUND:
             /* Prepare your app to go into the background.  Stop loops, etc.
                This gets called when the user hits the home button, or gets a call.
             */
             return 0;
-        case SDL_APP_DIDENTERBACKGROUND:
+        case SDL_EVENT_DID_ENTER_BACKGROUND:
             /* This will get called if the user accepted whatever sent your app to the background.
-               If the user got a phone call and canceled it, you'll instead get an SDL_APP_DIDENTERFOREGROUND event and restart your loops.
+               If the user got a phone call and canceled it, you'll instead get an SDL_EVENT_DID_ENTER_FOREGROUND event and restart your loops.
                When you get this, you have 5 seconds to save all your state or the app will be terminated.
                Your app is NOT active at this point.
             */
             return 0;
-        case SDL_APP_WILLENTERFOREGROUND:
+        case SDL_EVENT_WILL_ENTER_FOREGROUND:
             /* This call happens when your app is coming back to the foreground.
                Restore all your state here.
             */
             return 0;
-        case SDL_APP_DIDENTERFOREGROUND:
+        case SDL_EVENT_DID_ENTER_FOREGROUND:
             /* Restart your loops here.
                Your app is interactive and getting CPU again.
             */
diff --git a/docs/README-macos.md b/docs/README-macos.md
index 1ce7bad66dc5..4f2db5c858c6 100644
--- a/docs/README-macos.md
+++ b/docs/README-macos.md
@@ -44,7 +44,7 @@ use the traditional autoconf/automake/make method, or use Xcode.
 If you register your own NSApplicationDelegate (using [NSApp setDelegate:]),
 SDL will not register its own. This means that SDL will not terminate using
 SDL_Quit if it receives a termination request, it will terminate like a
-normal app, and it will not send a SDL_DROPFILE when you request to open a
+normal app, and it will not send a SDL_EVENT_DROP_FILE when you request to open a
 file with the app. To solve these issues, put the following code in your
 NSApplicationDelegate implementation:
 
@@ -52,9 +52,9 @@ NSApplicationDelegate implementation:
 ```objc
 - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
 {
-    if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
+    if (SDL_GetEventState(SDL_EVENT_QUIT) == SDL_ENABLE) {
         SDL_Event event;
-        event.type = SDL_QUIT;
+        event.type = SDL_EVENT_QUIT;
         SDL_PushEvent(&event);
     }
     
@@ -63,9 +63,9 @@ NSApplicationDelegate implementation:
     
 - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
 {
-    if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) {
+    if (SDL_GetEventState(SDL_EVENT_DROP_FILE) == SDL_ENABLE) {
         SDL_Event event;
-        event.type = SDL_DROPFILE;
+        event.type = SDL_EVENT_DROP_FILE;
         event.drop.file = SDL_strdup([filename UTF8String]);
         return (SDL_PushEvent(&event) > 0);
     }
diff --git a/docs/README-migration.md b/docs/README-migration.md
index 6fea417ac7a8..0edbfb2fc424 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -121,23 +121,66 @@ You should set the event.common.timestamp field before passing an event to SDL_P
 
 Mouse events use floating point values for mouse coordinates and relative motion values. You can get sub-pixel motion depending on the platform and display scaling.
 
-The SDL_DISPLAYEVENT_* events have been moved to top level events, and SDL_DISPLAYEVENT has been removed. In general, handling this change just means checking for the individual events instead of first checking for SDL_DISPLAYEVENT and then checking for display events. You can compare the event >= SDL_DISPLAYEVENT_FIRST and <= SDL_DISPLAYEVENT_LAST if you need to see whether it's a display event.
+The SDL_DISPLAYEVENT_* events have been moved to top level events, and SDL_DISPLAYEVENT has been removed. In general, handling this change just means checking for the individual events instead of first checking for SDL_DISPLAYEVENT and then checking for display events. You can compare the event >= SDL_EVENT_DISPLAY_FIRST and <= SDL_EVENT_DISPLAY_LAST if you need to see whether it's a display event.
 
-The SDL_WINDOWEVENT_* events have been moved to top level events, and SDL_WINDOWEVENT has been removed. In general, handling this change just means checking for the individual events instead of first checking for SDL_WINDOWEVENT and then checking for window events. You can compare the event >= SDL_WINDOWEVENT_FIRST and <= SDL_WINDOWEVENT_LAST if you need to see whether it's a window event.
+The SDL_WINDOWEVENT_* events have been moved to top level events, and SDL_WINDOWEVENT has been removed. In general, handling this change just means checking for the individual events instead of first checking for SDL_WINDOWEVENT and then checking for window events. You can compare the event >= SDL_EVENT_WINDOW_FIRST and <= SDL_EVENT_WINDOW_LAST if you need to see whether it's a window event.
 
 SDL_QUERY, SDL_IGNORE, SDL_ENABLE, and SDL_DISABLE have been removed. You can use the functions SDL_SetEventEnabled() and SDL_EventEnabled() to set and query event processing state.
 
 The following symbols have been renamed:
-* SDL_CONTROLLERAXISMOTION => SDL_GAMEPADAXISMOTION
-* SDL_CONTROLLERBUTTONDOWN => SDL_GAMEPADBUTTONDOWN
-* SDL_CONTROLLERBUTTONUP => SDL_GAMEPADBUTTONUP
-* SDL_CONTROLLERDEVICEADDED => SDL_GAMEPADADDED
-* SDL_CONTROLLERDEVICEREMAPPED => SDL_GAMEPADREMAPPED
-* SDL_CONTROLLERDEVICEREMOVED => SDL_GAMEPADREMOVED
-* SDL_CONTROLLERSENSORUPDATE => SDL_GAMEPADSENSORUPDATE
-* SDL_CONTROLLERTOUCHPADDOWN => SDL_GAMEPADTOUCHPADDOWN
-* SDL_CONTROLLERTOUCHPADMOTION => SDL_GAMEPADTOUCHPADMOTION
-* SDL_CONTROLLERTOUCHPADUP => SDL_GAMEPADTOUCHPADUP
+* SDL_APP_DIDENTERBACKGROUND => SDL_EVENT_DID_ENTER_BACKGROUND
+* SDL_APP_DIDENTERFOREGROUND => SDL_EVENT_DID_ENTER_FOREGROUND
+* SDL_APP_LOWMEMORY => SDL_EVENT_LOW_MEMORY
+* SDL_APP_TERMINATING => SDL_EVENT_TERMINATING
+* SDL_APP_WILLENTERBACKGROUND => SDL_EVENT_WILL_ENTER_BACKGROUND
+* SDL_APP_WILLENTERFOREGROUND => SDL_EVENT_WILL_ENTER_FOREGROUND
+* SDL_AUDIODEVICEADDED => SDL_EVENT_AUDIO_DEVICE_ADDED
+* SDL_AUDIODEVICEREMOVED => SDL_EVENT_AUDIO_DEVICE_REMOVED
+* SDL_CLIPBOARDUPDATE => SDL_EVENT_CLIPBOARD_UPDATE
+* SDL_CONTROLLERAXISMOTION => SDL_EVENT_GAMEPAD_AXIS_MOTION
+* SDL_CONTROLLERBUTTONDOWN => SDL_EVENT_GAMEPAD_BUTTON_DOWN
+* SDL_CONTROLLERBUTTONUP => SDL_EVENT_GAMEPAD_BUTTON_UP
+* SDL_CONTROLLERDEVICEADDED => SDL_EVENT_GAMEPAD_ADDED
+* SDL_CONTROLLERDEVICEREMAPPED => SDL_EVENT_GAMEPAD_REMAPPED
+* SDL_CONTROLLERDEVICEREMOVED => SDL_EVENT_GAMEPAD_REMOVED
+* SDL_CONTROLLERSENSORUPDATE => SDL_EVENT_GAMEPAD_SENSOR_UPDATE
+* SDL_CONTROLLERTOUCHPADDOWN => SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN
+* SDL_CONTROLLERTOUCHPADMOTION => SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION
+* SDL_CONTROLLERTOUCHPADUP => SDL_EVENT_GAMEPAD_TOUCHPAD_UP
+* SDL_DROPBEGIN => SDL_EVENT_DROP_BEGIN
+* SDL_DROPCOMPLETE => SDL_EVENT_DROP_COMPLETE
+* SDL_DROPFILE => SDL_EVENT_DROP_FILE
+* SDL_DROPTEXT => SDL_EVENT_DROP_TEXT
+* SDL_FINGERDOWN => SDL_EVENT_FINGER_DOWN
+* SDL_FINGERMOTION => SDL_EVENT_FINGER_MOTION
+* SDL_FINGERUP => SDL_EVENT_FINGER_UP
+* SDL_FIRSTEVENT => SDL_EVENT_FIRST
+* SDL_JOYAXISMOTION => SDL_EVENT_JOYSTICK_AXIS_MOTION
+* SDL_JOYBATTERYUPDATED => SDL_EVENT_JOYSTICK_BATTERY_UPDATED
+* SDL_JOYBUTTONDOWN => SDL_EVENT_JOYSTICK_BUTTON_DOWN
+* SDL_JOYBUTTONUP => SDL_EVENT_JOYSTICK_BUTTON_UP
+* SDL_JOYDEVICEADDED => SDL_EVENT_JOYSTICK_ADDED
+* SDL_JOYDEVICEREMOVED => SDL_EVENT_JOYSTICK_REMOVED
+* SDL_JOYHATMOTION => SDL_EVENT_JOYSTICK_HAT_MOTION
+* SDL_KEYDOWN => SDL_EVENT_KEY_DOWN
+* SDL_KEYMAPCHANGED => SDL_EVENT_KEYMAP_CHANGED
+* SDL_KEYUP => SDL_EVENT_KEY_UP
+* SDL_LASTEVENT => SDL_EVENT_LAST
+* SDL_LOCALECHANGED => SDL_EVENT_LOCALECHANGED
+* SDL_MOUSEBUTTONDOWN => SDL_EVENT_MOUSE_BUTTONDOWN
+* SDL_MOUSEBUTTONUP => SDL_EVENT_MOUSE_BUTTONUP
+* SDL_MOUSEMOTION => SDL_EVENT_MOUSE_MOTION
+* SDL_MOUSEWHEEL => SDL_EVENT_MOUSE_WHEEL
+* SDL_POLLSENTINEL => SDL_EVENT_POLL_SENTINEL
+* SDL_QUIT => SDL_EVENT_QUIT
+* SDL_RENDER_DEVICE_RESET => SDL_EVENT_RENDER_DEVICE_RESET
+* SDL_RENDER_TARGETS_RESET => SDL_EVENT_RENDER_TARGETS_RESET
+* SDL_SENSORUPDATE => SDL_EVENT_SENSOR_UPDATE
+* SDL_SYSWMEVENT => SDL_EVENT_SYSWM
+* SDL_TEXTEDITING => SDL_EVENT_TEXT_EDITING
+* SDL_TEXTEDITING_EXT => SDL_EVENT_TEXTEDITING_EXT
+* SDL_TEXTINPUT => SDL_EVENT_TEXT_INPUT
+* SDL_USEREVENT => SDL_EVENT_USER
 
 The following structures have been renamed:
 * SDL_ControllerAxisEvent => SDL_GamepadAxisEvent
@@ -154,11 +197,11 @@ The following functions have been removed:
 
 SDL_gamecontroller.h has been renamed SDL_gamepad.h, and all APIs have been renamed to match.
 
-The SDL_GAMEPADADDED event now provides the joystick instance ID in the which member of the cdevice event structure.
+The SDL_EVENT_GAMEPAD_ADDED event now provides the joystick instance ID in the which member of the cdevice event structure.
 
 The functions SDL_GetGamepads(), SDL_GetGamepadInstanceName(), SDL_GetGamepadInstancePath(), SDL_GetGamepadInstancePlayerIndex(), SDL_GetGamepadInstanceGUID(), SDL_GetGamepadInstanceVendor(), SDL_GetGamepadInstanceProduct(), SDL_GetGamepadInstanceProductVersion(), and SDL_GetGamepadInstanceType() have been added to directly query the list of available gamepads.
 
-SDL_GameControllerGetSensorDataWithTimestamp() has been removed. If you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_GAMEPADSENSORUPDATE events.
+SDL_GameControllerGetSensorDataWithTimestamp() has been removed. If you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_EVENT_GAMEPAD_SENSOR_UPDATE events.
 
 The following enums have been renamed:
 * SDL_GameControllerAxis => SDL_GamepadAxis
@@ -337,7 +380,7 @@ Rather than iterating over joysticks using device index, there is a new function
 }

-The SDL_JOYDEVICEADDED event now provides the joystick instance ID in the which member of the jdevice event structure.
+The SDL_EVENT_JOYSTICK_ADDED event now provides the joystick instance ID in the which member of the jdevice event structure.

The functions SDL_GetJoysticks(), SDL_GetJoystickInstanceName(), SDL_GetJoystickInstancePath(), SDL_GetJoystickInstancePlayerIndex(), SDL_GetJoystickInstanceGUID(), SDL_GetJoystickInstanceVendor(), SDL_GetJoystickInstanceProduct(), SDL_GetJoystickInstanceProductVersion(), and SDL_GetJoystickInstanceType() have been added to directly query the list of available joysticks.

@@ -483,6 +526,30 @@ The following functions have been renamed:

  • SDL_MasksToPixelFormatEnum() => SDL_GetPixelFormatEnumForMasks()
  • SDL_PixelFormatEnumToMasks() => SDL_GetMasksForPixelFormatEnum()

+The following symbols have been renamed:
+* SDL_DISPLAYEVENT_DISCONNECTED => SDL_EVENT_DISPLAY_DISCONNECTED
+* SDL_DISPLAYEVENT_MOVED => SDL_EVENT_DISPLAY_MOVED
+* SDL_DISPLAYEVENT_ORIENTATION => SDL_EVENT_DISPLAY_ORIENTATION
+* SDL_WINDOWEVENT_CLOSE => SDL_EVENT_WINDOW_CLOSE
+* SDL_WINDOWEVENT_DISPLAY_CHANGED => SDL_EVENT_WINDOW_DISPLAY_CHANGED
+* SDL_WINDOWEVENT_ENTER => SDL_EVENT_WINDOW_ENTER
+* SDL_WINDOWEVENT_EXPOSED => SDL_EVENT_WINDOW_EXPOSED
+* SDL_WINDOWEVENT_FOCUS_GAINED => SDL_EVENT_WINDOW_FOCUS_GAINED
+* SDL_WINDOWEVENT_FOCUS_LOST => SDL_EVENT_WINDOW_FOCUS_LOST
+* SDL_WINDOWEVENT_HIDDEN => SDL_EVENT_WINDOW_HIDDEN
+* SDL_WINDOWEVENT_HIT_TEST => SDL_EVENT_WINDOW_HIT_TEST
+* SDL_WINDOWEVENT_ICCPROF_CHANGED => SDL_EVENT_WINDOW_ICCPROF_CHANGED
+* SDL_WINDOWEVENT_LEAVE => SDL_EVENT_WINDOW_LEAVE
+* SDL_WINDOWEVENT_MAXIMIZED => SDL_EVENT_WINDOW_MAXIMIZED
+* SDL_WINDOWEVENT_MINIMIZED => SDL_EVENT_WINDOW_MINIMIZED
+* SDL_WINDOWEVENT_MOVED => SDL_EVENT_WINDOW_MOVED
+* SDL_WINDOWEVENT_RESIZED => SDL_EVENT_WINDOW_RESIZED
+* SDL_WINDOWEVENT_RESTORED => SDL_EVENT_WINDOW_RESTORED
+* SDL_WINDOWEVENT_SHOWN => SDL_EVENT_WINDOW_SHOWN
+* SDL_WINDOWEVENT_SIZE_CHANGED => SDL_EVENT_WINDOW_SIZE_CHANGED
+* SDL_WINDOWEVENT_TAKE_FOCUS => SDL_EVENT_WINDOW_TAKE_FOCUS
+
+

SDL_platform.h

The preprocessor symbol __MACOSX__ has been renamed __MACOS__, and __IPHONEOS__ has been renamed __IOS__
@@ -748,7 +815,7 @@ Rather than iterating over sensors using device index, there is a new function S
}


-Removed SDL_SensorGetDataWithTimestamp(), if you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_SENSORUPDATE events.
+Removed SDL_SensorGetDataWithTimestamp(), if you want timestamps for the sensor data, you should use the sensor_timestamp member of SDL_EVENT_SENSOR_UPDATE events.


The following functions have been renamed:
diff --git a/docs/README-raspberrypi.md b/docs/README-raspberrypi.md
index 8d1334626162..e8cdf40df141 100644
--- a/docs/README-raspberrypi.md
+++ b/docs/README-raspberrypi.md
@@ -127,7 +127,7 @@ Text Input API support

The Text Input API is supported, with translation of scan codes done via the
kernel symbol tables. For this to work, SDL needs access to a valid console.
-If you notice there's no SDL_TEXTINPUT message being emitted, double check that
+If you notice there's no SDL_EVENT_TEXT_INPUT message being emitted, double check that
your app has read access to one of the following:
    
* /proc/self/fd/0
diff --git a/docs/README-touch.md b/docs/README-touch.md
index cebf5613a659..489e34061071 100644
--- a/docs/README-touch.md
+++ b/docs/README-touch.md
@@ -17,7 +17,7 @@ Unfortunately there is no windows support as of yet. Support for Windows 7 is pl
===========================================================================
Events
===========================================================================
-SDL_FINGERDOWN:
+SDL_EVENT_FINGER_DOWN:
Sent when a finger (or stylus) is placed on a touch device.
Fields:
* event.tfinger.touchId  - the Id of the touch device.
@@ -26,17 +26,17 @@ Fields:
* event.tfinger.y        - the y coordinate of the touch (0..1)
* event.tfinger.pressure - the pressure of the touch (0..1)

-SDL_FINGERMOTION:
+SDL_EVENT_FINGER_MOTION:
Sent when a finger (or stylus) is moved on the touch device.
Fields:
-Same as SDL_FINGERDOWN but with additional:
+Same as SDL_EVENT_FINGER_DOWN but with additional:
* event.tfinger.dx       - change in x coordinate during this motion event.
* event.tfinger.dy       - change in y coordinate during this motion event.

-SDL_FINGERUP:
+SDL_EVENT_FINGER_UP:
Sent when a finger (or stylus) is lifted from the touch device.
Fields:
-Same as SDL_FINGERDOWN.
+Same as SDL_EVENT_FINGER_DOWN.


===========================================================================
@@ -66,7 +66,7 @@ The most common reason to access SDL_Finger is to query the fingers outside the

To get a SDL_Finger, call SDL_GetTouchFinger(SDL_TouchID touchID, int index), where touchID is a SDL_TouchID, and index is the requested finger.
This returns a SDL_Finger *, or NULL if the finger does not exist, or has been removed.
-A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled.
+A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_EVENT_FINGER_UP event is _added_ to the event queue, and thus _before_ the SDL_EVENT_FINGER_UP event is polled.
As a result, be very careful to check for NULL return values.

A SDL_Finger has the following fields:
diff --git a/docs/README-winrt.md b/docs/README-winrt.md
index 8e7eecac08dd..ffb0ae822629 100644
--- a/docs/README-winrt.md
+++ b/docs/README-winrt.md
@@ -349,7 +349,7 @@ int main(int argc, char **argv)
    
    while (keep_going) {
        while (SDL_PollEvent(&evt)) {
-            if ((evt.type == SDL_KEYDOWN) && (evt.key.keysym.sym == SDLK_ESCAPE)) {
+            if ((evt.type == SDL_EVENT_KEY_DOWN) && (evt.key.keysym.sym == SDLK_ESCAPE)) {
                keep_going = SDL_FALSE;
            } 
        }
diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h
index 089610e27912..1e13f96f75ec 100644
--- a/include/SDL3/SDL_events.h
+++ b/include/SDL3/SDL_events.h
@@ -54,153 +54,153 @@ extern "C" {
 */
typedef enum
{
-    SDL_FIRSTEVENT     = 0,     /**< Unused (do not remove) */
+    SDL_EVENT_FIRST     = 0,     /**< Unused (do not remove) */

    /* Application events */
-    SDL_QUIT           = 0x100, /**< User-requested quit */
+    SDL_EVENT_QUIT           = 0x100, /**< User-requested quit */

    /* These application events have special meaning on iOS, see README-ios.md for details */
-    SDL_APP_TERMINATING,        /**< The application is being terminated by the OS
+    SDL_EVENT_TERMINATING,        /**< The application is being terminated by the OS
                                     Called on iOS in applicationWillTerminate()
                                     Called on Android in onDestroy()
                                */
-    SDL_APP_LOWMEMORY,          /**< The application is low on memory, free memory if possible.
+    SDL_EVENT_LOW_MEMORY,          /**< The application is low on memory, free memory if possible.
                                     Called on iOS in applicationDidReceiveMemoryWarning()
                                     Called on Android in onLowMemory()
                                */
-    SDL_APP_WILLENTERBACKGROUND, /**< The application is about to enter the background
+    SDL_EVENT_WILL_ENTER_BACKGROUND, /**< The application is about to enter the background
                                     Called on iOS in applicationWillResignActive()
                                     Called on Android in onPause()
                                */
-    SDL_APP_DIDENTERBACKGROUND, /**< The application did enter the background and may not get CPU for some time
+    SDL_EVENT_DID_

(Patch may be truncated, please check the link at the top of this post.)