SDL: Updated structure and field names for consistency

From cacac6cc341d5856d1857bdcf7390551eed54865 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 11 Feb 2024 08:03:26 -0800
Subject: [PATCH] Updated structure and field names for consistency

Type names are camel case and field names are snake case except for fields ending in id, which are capitalized.

Fixes https://github.com/libsdl-org/SDL/issues/6955
---
 build-scripts/SDL_migration.cocci         | 119 ++++++++++++++++++++--
 docs/README-migration.md                  |  15 +++
 include/SDL3/SDL_events.h                 |   8 +-
 include/SDL3/SDL_gamepad.h                |   6 +-
 include/SDL3/SDL_messagebox.h             |   4 +-
 include/SDL3/SDL_oldnames.h               |   6 ++
 include/SDL3/SDL_pixels.h                 |   4 +-
 include/SDL3/SDL_version.h                |  14 +--
 src/SDL.c                                 |   6 +-
 src/SDL_internal.h                        |   4 +-
 src/core/android/SDL_android.c            |   6 +-
 src/core/android/SDL_android.h            |   2 +-
 src/dynapi/SDL_dynapi_procs.h             |   2 +-
 src/events/SDL_events.c                   |   4 +-
 src/events/SDL_mouse.c                    |   4 +-
 src/events/SDL_touch.c                    |  12 +--
 src/joystick/SDL_gamepad.c                |  52 +++++-----
 src/render/SDL_render.c                   |   5 +-
 src/render/software/SDL_blendfillrect.c   |  12 +--
 src/render/software/SDL_blendline.c       |   2 +-
 src/render/software/SDL_blendpoint.c      |  12 +--
 src/render/software/SDL_draw.h            |   8 +-
 src/render/software/SDL_drawline.c        |   6 +-
 src/render/software/SDL_drawpoint.c       |   8 +-
 src/render/software/SDL_render_sw.c       |  12 +--
 src/render/software/SDL_rotate.c          |   4 +-
 src/render/software/SDL_triangle.c        |  10 +-
 src/test/SDL_test_common.c                |   8 +-
 src/test/SDL_test_compare.c               |   3 +-
 src/video/SDL_RLEaccel.c                  |  32 +++---
 src/video/SDL_blit.c                      |  18 ++--
 src/video/SDL_blit_0.c                    |   8 +-
 src/video/SDL_blit_1.c                    |   8 +-
 src/video/SDL_blit_A.c                    |  34 +++----
 src/video/SDL_blit_N.c                    |  82 +++++++--------
 src/video/SDL_blit_copy.c                 |   2 +-
 src/video/SDL_blit_slow.c                 |  30 +++---
 src/video/SDL_bmp.c                       |  12 +--
 src/video/SDL_fillrect.c                  |  16 +--
 src/video/SDL_pixels.c                    |  13 +--
 src/video/SDL_stretch.c                   |   4 +-
 src/video/SDL_surface.c                   |  18 ++--
 src/video/SDL_sysvideo.h                  |   4 +-
 src/video/SDL_video.c                     |  14 +--
 src/video/android/SDL_androidmessagebox.c |   4 +-
 src/video/android/SDL_androidmessagebox.h |   2 +-
 src/video/cocoa/SDL_cocoamessagebox.h     |   2 +-
 src/video/cocoa/SDL_cocoamessagebox.m     |  10 +-
 src/video/cocoa/SDL_cocoavideo.m          |   2 +-
 src/video/haiku/SDL_bmessagebox.cc        |   8 +-
 src/video/haiku/SDL_bmessagebox.h         |   2 +-
 src/video/ngage/SDL_ngageframebuffer.cpp  |   2 +-
 src/video/riscos/SDL_riscosmessagebox.c   |   4 +-
 src/video/riscos/SDL_riscosmessagebox.h   |   2 +-
 src/video/uikit/SDL_uikitmessagebox.h     |   2 +-
 src/video/uikit/SDL_uikitmessagebox.m     |  14 +--
 src/video/vita/SDL_vitamessagebox.c       |  16 +--
 src/video/vita/SDL_vitamessagebox.h       |   2 +-
 src/video/vivante/SDL_vivantevideo.h      |   4 +-
 src/video/wayland/SDL_waylandmessagebox.c |  10 +-
 src/video/wayland/SDL_waylandmessagebox.h |   2 +-
 src/video/windows/SDL_windowsmessagebox.c |  22 ++--
 src/video/windows/SDL_windowsmessagebox.h |   2 +-
 src/video/winrt/SDL_winrtmessagebox.cpp   |   6 +-
 src/video/winrt/SDL_winrtmessagebox.h     |   2 +-
 src/video/x11/SDL_x11messagebox.c         |  30 +++---
 src/video/x11/SDL_x11messagebox.h         |   2 +-
 test/testaudio.c                          |   2 +-
 test/testautomation_pixels.c              |  16 ++-
 test/testautomation_platform.c            |   4 +-
 test/testautomation_surface.c             |   6 +-
 test/testcustomcursor.c                   |   4 +-
 test/testutils.c                          |   4 +-
 test/testver.c                            |   4 +-
 74 files changed, 489 insertions(+), 356 deletions(-)

diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci
index bf036c1cdf78..88e272436d54 100644
--- a/build-scripts/SDL_migration.cocci
+++ b/build-scripts/SDL_migration.cocci
@@ -2413,21 +2413,41 @@ SDL_Event e1;
 - e1.caxis
 + e1.gaxis
 @@
+SDL_Event *e1;
+@@
+- e1->caxis
++ e1->gaxis
+@@
 SDL_Event e1;
 @@
 - e1.cbutton
 + e1.gbutton
 @@
+SDL_Event *e1;
+@@
+- e1->cbutton
++ e1->gbutton
+@@
 SDL_Event e1;
 @@
 - e1.cdevice
 + e1.gdevice
 @@
+SDL_Event *e1;
+@@
+- e1->cdevice
++ e1->gdevice
+@@
 SDL_Event e1;
 @@
 - e1.ctouchpad
 + e1.gtouchpad
 @@
+SDL_Event *e1;
+@@
+- e1->ctouchpad
++ e1->gtouchpad
+@@
 SDL_Event e1;
 @@
 - e1.csensor
@@ -2435,28 +2455,48 @@ SDL_Event e1;
 @@
 SDL_Event *e1;
 @@
-- e1->caxis
-+ e1->gaxis
+- e1->csensor
++ e1->gsensor
+@@
+SDL_Event e1;
+@@
+- e1.wheel.mouseX
++ e1.wheel.mouse_x
 @@
 SDL_Event *e1;
 @@
-- e1->cbutton
-+ e1->gbutton
+- e1->wheel.mouseX
++ e1->wheel.mouse_x
+@@
+SDL_Event e1;
+@@
+- e1.wheel.mouseY
++ e1.wheel.mouse_y
 @@
 SDL_Event *e1;
 @@
-- e1->cdevice
-+ e1->gdevice
+- e1->wheel.mouseY
++ e1->wheel.mouse_y
+@@
+SDL_Event e1;
+@@
+- e1.tfinger.touchId
++ e1.tfinger.touchID
 @@
 SDL_Event *e1;
 @@
-- e1->ctouchpad
-+ e1->gtouchpad
+- e1->tfinger.touchId
++ e1->tfinger.touchID
+@@
+SDL_Event e1;
+@@
+- e1.tfinger.fingerId
++ e1.tfinger.fingerID
 @@
 SDL_Event *e1;
 @@
-- e1->csensor
-+ e1->gsensor
+- e1->tfinger.fingerId
++ e1->tfinger.fingerID
 @@
 expression e1, e2, e3, e4;
 @@
@@ -2909,3 +2949,62 @@ expression e1, e2, e3, e4;
 - SDL_HasWindowSurface
 + SDL_WindowHasSurface
   (...)
+@@
+SDL_PixelFormat e1;
+@@
+- e1.BitsPerPixel
++ e1.bits_per_pixel
+@@
+SDL_PixelFormat *e1;
+@@
+- e1->BitsPerPixel
++ e1->bits_per_pixel
+@@
+SDL_PixelFormat e1;
+@@
+- e1.BytesPerPixel
++ e1.bytes_per_pixel
+@@
+SDL_PixelFormat *e1;
+@@
+- e1->BytesPerPixel
++ e1->bytes_per_pixel
+@@
+SDL_MessageBoxButtonData e1;
+@@
+- e1.buttonid
++ e1.buttonID
+@@
+SDL_MessageBoxButtonData *e1;
+@@
+- e1->buttonid
++ e1->buttonID
+@@
+SDL_GamepadBinding e1;
+@@
+- e1.inputType
++ e1.input_type
+@@
+SDL_GamepadBinding *e1;
+@@
+- e1->inputType
++ e1->input_type
+@@
+SDL_GamepadBinding e1;
+@@
+- e1.outputType
++ e1.output_type
+@@
+SDL_GamepadBinding *e1;
+@@
+- e1->outputType
++ e1->output_type
+@@
+@@
+- SDL_version
++ SDL_Version
+@@
+typedef SDL_version, SDL_Version;
+@@
+- SDL_version
++ SDL_Version
diff --git a/docs/README-migration.md b/docs/README-migration.md
index ffe3e761db77..b98a94cf5cdb 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -330,6 +330,10 @@ The SDL_EVENT_WINDOW_SIZE_CHANGED event has been removed, and you can use SDL_EV
 
 The gamepad event structures caxis, cbutton, cdevice, ctouchpad, and csensor have been renamed gaxis, gbutton, gdevice, gtouchpad, and gsensor.
 
+The mouseX and mouseY fields of SDL_MouseWheelEvent have been renamed mouse_x and mouse_y.
+
+The touchId and fingerId fields of SDL_TouchFingerEvent have been renamed touchID and fingerID.
+
 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.
 
 SDL_AddEventWatch() now returns -1 if it fails because it ran out of memory and couldn't add the event watch callback.
@@ -504,6 +508,8 @@ SDL_bool SDL_IsJoystickNVIDIASHIELDController(Uint16 vendor_id, Uint16 product_i
 }

+The inputType and outputType fields of SDL_GamepadBinding have been renamed input_type and output_type.
+
The following enums have been renamed:

  • SDL_GameControllerAxis => SDL_GamepadAxis
  • SDL_GameControllerBindType => SDL_GamepadBindingType
    @@ -871,6 +877,10 @@ Several platform-specific entry point functions have been removed as unnecessary
    #define SDL_GDKRunApp(MAIN_FUNC, RESERVED) SDL_RunApp(0, NULL, MAIN_FUNC, RESERVED)

+## SDL_messagebox.h
+
+The buttonid field of SDL_MessageBoxButtonData has been renamed buttonID.
+
## SDL_metal.h

SDL_Metal_GetDrawableSize() has been removed. SDL_GetWindowSizeInPixels() can be used in its place.
@@ -912,6 +922,8 @@ The following symbols have been renamed:

SDL_CalculateGammaRamp has been removed, because SDL_SetWindowGammaRamp has been removed as well due to poor support in modern operating systems (see [SDL_video.h](#sdl_videoh)).

+The BitsPerPixel and BytesPerPixel fields of SDL_PixelFormat have been renamed bits_per_pixel and bytes_per_pixel.
+
The following functions have been renamed:
* SDL_AllocFormat() => SDL_CreatePixelFormat()
* SDL_AllocPalette() => SDL_CreatePalette()
@@ -1528,6 +1540,9 @@ The following functions have been removed:
SDL_GetRevisionNumber() has been removed from the API, it always returned 0 in SDL 2.0.


+The following structures have been renamed:
+* SDL_version => SDL_Version
+
## SDL_video.h

Several video backends have had their names lower-cased ("kmsdrm", "rpi", "android", "psp", "ps2", "vita"). SDL already does a case-insensitive compare for SDL_HINT_VIDEO_DRIVER tests, but if your app is calling SDL_GetVideoDriver() or SDL_GetCurrentVideoDriver() and doing case-sensitive compares on those strings, please update your code.
diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h
index 6516612b01c5..d209801ede51 100644
--- a/include/SDL3/SDL_events.h
+++ b/include/SDL3/SDL_events.h
@@ -356,8 +356,8 @@ typedef struct SDL_MouseWheelEvent
    float x;            /**< The amount scrolled horizontally, positive to the right and negative to the left */
    float y;            /**< The amount scrolled vertically, positive away from the user and negative toward the user */
    Uint32 direction;   /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
-    float mouseX;       /**< X coordinate, relative to window */
-    float mouseY;       /**< Y coordinate, relative to window */
+    float mouse_x;      /**< X coordinate, relative to window */
+    float mouse_y;      /**< Y coordinate, relative to window */
} SDL_MouseWheelEvent;

/**
@@ -535,8 +535,8 @@ typedef struct SDL_TouchFingerEvent
    Uint32 type;        /**< ::SDL_EVENT_FINGER_MOTION or ::SDL_EVENT_FINGER_DOWN or ::SDL_EVENT_FINGER_UP */
    Uint32 reserved;
    Uint64 timestamp;   /**< In nanoseconds, populated using SDL_GetTicksNS() */
-    SDL_TouchID touchId; /**< The touch device id */
-    SDL_FingerID fingerId;
+    SDL_TouchID touchID; /**< The touch device id */
+    SDL_FingerID fingerID;
    float x;            /**< Normalized in the range 0...1 */
    float y;            /**< Normalized in the range 0...1 */
    float dx;           /**< Normalized in the range -1...1 */
diff --git a/include/SDL3/SDL_gamepad.h b/include/SDL3/SDL_gamepad.h
index ee39e872e962..db38086b7f46 100644
--- a/include/SDL3/SDL_gamepad.h
+++ b/include/SDL3/SDL_gamepad.h
@@ -178,9 +178,9 @@ typedef enum
    SDL_GAMEPAD_BINDTYPE_HAT
} SDL_GamepadBindingType;

-typedef struct
+typedef struct SDL_GamepadBinding
{
-    SDL_GamepadBindingType inputType;
+    SDL_GamepadBindingType input_type;
    union
    {
        int button;
@@ -200,7 +200,7 @@ typedef struct

    } input;

-    SDL_GamepadBindingType outputType;
+    SDL_GamepadBindingType output_type;
    union
    {
        SDL_GamepadButton button;
diff --git a/include/SDL3/SDL_messagebox.h b/include/SDL3/SDL_messagebox.h
index 17696c649472..b9c4d93f14a2 100644
--- a/include/SDL3/SDL_messagebox.h
+++ b/include/SDL3/SDL_messagebox.h
@@ -58,8 +58,8 @@ typedef enum
typedef struct
{
    Uint32 flags;       /**< ::SDL_MessageBoxButtonFlags */
-    int buttonid;       /**< User defined button id (value returned via SDL_ShowMessageBox) */
-    const char * text;  /**< The UTF-8 button text */
+    int buttonID;       /**< User defined button id (value returned via SDL_ShowMessageBox) */
+    const char *text;   /**< The UTF-8 button text */
} SDL_MessageBoxButtonData;

/**
diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h
index a5aaf1148329..dd743aa705f6 100644
--- a/include/SDL3/SDL_oldnames.h
+++ b/include/SDL3/SDL_oldnames.h
@@ -492,6 +492,9 @@
/* ##SDL_timer.h */
#define SDL_GetTicks64 SDL_GetTicks

+/* ##SDL_version.h */
+#define SDL_version SDL_Version
+
/* ##SDL_video.h */
#define SDL_GetClosestDisplayMode SDL_GetClosestFullscreenDisplayMode
#define SDL_GetDisplayOrientation SDL_GetCurrentDisplayOrientation
@@ -961,6 +964,9 @@
/* ##SDL_timer.h */
#define SDL_GetTicks64 SDL_GetTicks64_renamed_SDL_GetTicks

+/* ##SDL_version.h */
+#define SDL_version SDL_version_renamed_SDL_Version
+
/* ##SDL_video.h */
#define SDL_GetClosestDisplayMode SDL_GetClosestDisplayMode_renamed_SDL_GetClosestFullscreenDisplayMode
#define SDL_GetDisplayOrientation SDL_GetDisplayOrientation_renamed_SDL_GetCurrentDisplayOrientation
diff --git a/include/SDL3/SDL_pixels.h b/include/SDL3/SDL_pixels.h
index d893a49fe7a9..e2f238bb1be1 100644
--- a/include/SDL3/SDL_pixels.h
+++ b/include/SDL3/SDL_pixels.h
@@ -703,8 +703,8 @@ typedef struct SDL_PixelFormat
{
    Uint32 format;
    SDL_Palette *palette;
-    Uint8 BitsPerPixel;
-    Uint8 BytesPerPixel;
+    Uint8 bits_per_pixel;
+    Uint8 bytes_per_pixel;
    Uint8 padding[2];
    Uint32 Rmask;
    Uint32 Gmask;
diff --git a/include/SDL3/SDL_version.h b/include/SDL3/SDL_version.h
index 61ab8548f5e6..5581c2e2bd44 100644
--- a/include/SDL3/SDL_version.h
+++ b/include/SDL3/SDL_version.h
@@ -48,12 +48,12 @@ extern "C" {
 * \sa SDL_VERSION
 * \sa SDL_GetVersion
 */
-typedef struct SDL_version
+typedef struct SDL_Version
{
    Uint8 major;        /**< major version */
    Uint8 minor;        /**< minor version */
    Uint8 patch;        /**< update version */
-} SDL_version;
+} SDL_Version;

/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
*/
@@ -64,16 +64,16 @@ typedef struct SDL_version
/**
 * Macro to determine SDL version program was compiled against.
 *
- * This macro fills in a SDL_version structure with the version of the
+ * This macro fills in an SDL_Version structure with the version of the
 * library you compiled against. This is determined by what header the
 * compiler uses. Note that if you dynamically linked the library, you might
 * have a slightly newer or older version at runtime. That version can be
 * determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
 * is not a macro.
 *
- * \param x A pointer to a SDL_version struct to initialize.
+ * \param x A pointer to an SDL_Version struct to initialize.
 *
- * \sa SDL_version
+ * \sa SDL_Version
 * \sa SDL_GetVersion
 */
#define SDL_VERSION(x)                          \
@@ -114,7 +114,7 @@ typedef struct SDL_version
 *
 * This function may be called safely at any time, even before SDL_Init().
 *
- * \param ver the SDL_version structure that contains the version information
+ * \param ver the SDL_Version structure that contains the version information
 * \returns 0 on success or a negative error code on failure; call
 *          SDL_GetError() for more information.
 *
@@ -122,7 +122,7 @@ typedef struct SDL_version
 *
 * \sa SDL_GetRevision
 */
-extern DECLSPEC int SDLCALL SDL_GetVersion(SDL_version * ver);
+extern DECLSPEC int SDLCALL SDL_GetVersion(SDL_Version * ver);

/**
 * Get the code revision of SDL that is linked against your program.
diff --git a/src/SDL.c b/src/SDL.c
index b6e78cf10df7..e5c43fee134b 100644
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -66,11 +66,11 @@ SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MICRO_VERSION,
#endif

SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_min, SDL_MAJOR_VERSION >= 0);
-/* Limited only by the need to fit in SDL_version */
+/* Limited only by the need to fit in SDL_Version */
SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_max, SDL_MAJOR_VERSION <= 255);

SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_min, SDL_MINOR_VERSION >= 0);
-/* Limited only by the need to fit in SDL_version */
+/* Limited only by the need to fit in SDL_Version */
SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_max, SDL_MINOR_VERSION <= 255);

SDL_COMPILE_TIME_ASSERT(SDL_PATCHLEVEL_min, SDL_PATCHLEVEL >= 0);
@@ -534,7 +534,7 @@ Uint32 SDL_GetNextObjectID(void)
}

/* Get the library version number */
-int SDL_GetVersion(SDL_version *ver)
+int SDL_GetVersion(SDL_Version *ver)
{
    static SDL_bool check_hint = SDL_TRUE;
    static SDL_bool legacy_version = SDL_FALSE;
diff --git a/src/SDL_internal.h b/src/SDL_internal.h
index a7740f13dff6..5db52682294f 100644
--- a/src/SDL_internal.h
+++ b/src/SDL_internal.h
@@ -137,13 +137,13 @@
#endif

/* Optimized functions from 'SDL_blit_0.c'
-   - blit with source BitsPerPixel < 8, palette */
+   - blit with source bits_per_pixel < 8, palette */
#ifndef SDL_HAVE_BLIT_0
#define SDL_HAVE_BLIT_0 !SDL_LEAN_AND_MEAN
#endif

/* Optimized functions from 'SDL_blit_1.c'
-   - blit with source BytesPerPixel == 1, palette */
+   - blit with source bytes_per_pixel == 1, palette */
#ifndef SDL_HAVE_BLIT_1
#define SDL_HAVE_BLIT_1 !SDL_LEAN_AND_MEAN
#endif
diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c
index 1abb8b720f9c..6b39cf619df3 100644
--- a/src/core/android/SDL_android.c
+++ b/src/core/android/SDL_android.c
@@ -2264,7 +2264,7 @@ SDL_bool Android_JNI_IsScreenKeyboardShown(void)
    return is_shown;
}

-int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
+int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
{
    JNIEnv *env;
    jclass clazz;
@@ -2304,7 +2304,7 @@ int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *bu

        temp = sdlButton->flags;
        (*env)->SetIntArrayRegion(env, button_flags, i, 1, &temp);
-        temp = sdlButton->buttonid;
+        temp = sdlButton->buttonID;
        (*env)->SetIntArrayRegion(env, button_ids, i, 1, &temp);
        text = (*env)->NewStringUTF(env, sdlButton->text);
        (*env)->SetObjectArrayElement(env, button_texts, i, text);
@@ -2333,7 +2333,7 @@ int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *bu

    mid = (*env)->GetMethodID(env, clazz,
                              "messageboxShowMessageBox", "(ILjava/lang/String;Ljava/lang/String;[I[I[Ljava/lang/String;[I)I");
-    *buttonid = (*env)->CallIntMethod(env, context, mid,
+    *buttonID = (*env)->CallIntMethod(env, context, mid,
                                      messageboxdata->flags,
                                      title,
                                      message,
diff --git a/src/core/android/SDL_android.h b/src/core/android/SDL_android.h
index af8ed1d47ba2..b611bc52db7b 100644
--- a/src/core/android/SDL_android.h
+++ b/src/core/android/SDL_android.h
@@ -113,7 +113,7 @@ int Android_JNI_SendMessage(int command, int param);
JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv *mEnv, jclass cls);

/* MessageBox */
-int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
+int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID);

/* Cursor support */
int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y);
diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h
index e8a4e188dbfe..d841325c3137 100644
--- a/src/dynapi/SDL_dynapi_procs.h
+++ b/src/dynapi/SDL_dynapi_procs.h
@@ -406,7 +406,7 @@ SDL_DYNAPI_PROC(Uint64,SDL_GetTicks,(void),(),return)
SDL_DYNAPI_PROC(Uint64,SDL_GetTicksNS,(void),(),return)
SDL_DYNAPI_PROC(SDL_TouchDeviceType,SDL_GetTouchDeviceType,(SDL_TouchID a),(a),return)
SDL_DYNAPI_PROC(SDL_Finger*,SDL_GetTouchFinger,(SDL_TouchID a, int b),(a,b),return)
-SDL_DYNAPI_PROC(int,SDL_GetVersion,(SDL_version *a),(a),return)
+SDL_DYNAPI_PROC(int,SDL_GetVersion,(SDL_Version *a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_GetVideoDriver,(int a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(float,SDL_GetWindowDisplayScale,(SDL_Window *a),(a),return)
diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c
index 0196aa1bdd68..02600437c49d 100644
--- a/src/events/SDL_events.c
+++ b/src/events/SDL_events.c
@@ -463,8 +463,8 @@ static void SDL_LogEvent(const SDL_Event *event)

#define PRINT_FINGER_EVENT(event)                                                                                                                      \
    (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u touchid=%" SDL_PRIu64 " fingerid=%" SDL_PRIu64 " x=%f y=%f dx=%f dy=%f pressure=%f)", \
-                       (uint)event->tfinger.timestamp, event->tfinger.touchId,                                                              \
-                       event->tfinger.fingerId, event->tfinger.x, event->tfinger.y,                                                         \
+                       (uint)event->tfinger.timestamp, event->tfinger.touchID,                                                              \
+                       event->tfinger.fingerID, event->tfinger.x, event->tfinger.y,                                                         \
                       event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure)
        SDL_EVENT_CASE(SDL_EVENT_FINGER_DOWN)
        PRINT_FINGER_EVENT(event);
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 88cf267b51d6..a3888371f16c 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -880,8 +880,8 @@ int SDL_SendMouseWheel(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID
        event.wheel.x = x;
        event.wheel.y = y;
        event.wheel.direction = (Uint32)direction;
-        event.wheel.mouseX = mouse->x;
-        event.wheel.mouseY = mouse->y;
+        event.wheel.mouse_x = mouse->x;
+        event.wheel.mouse_y = mouse->y;
        posted = (SDL_PushEvent(&event) > 0);
    }
    return posted;
diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c
index a96a5e7ceb45..dcd855771c13 100644
--- a/src/events/SDL_touch.c
+++ b/src/events/SDL_touch.c
@@ -328,8 +328,8 @@ int SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_W
            SDL_Event event;
            event.type = SDL_EVENT_FINGER_DOWN;
            event.common.timestamp = timestamp;
-            event.tfinger.touchId = id;
-            event.tfinger.fingerId = fingerid;
+            event.tfinger.touchID = id;
+            event.tfinger.fingerID = fingerid;
            event.tfinger.x = x;
            event.tfinger.y = y;
            event.tfinger.dx = 0;
@@ -349,8 +349,8 @@ int SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_W
            SDL_Event event;
            event.type = SDL_EVENT_FINGER_UP;
            event.common.timestamp = timestamp;
-            event.tfinger.touchId = id;
-            event.tfinger.fingerId = fingerid;
+            event.tfinger.touchID = id;
+            event.tfinger.fingerID = fingerid;
            /* I don't trust the coordinates passed on fingerUp */
            event.tfinger.x = finger->x;
            event.tfinger.y = finger->y;
@@ -446,8 +446,8 @@ int SDL_SendTouchMotion(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid,
        SDL_Event event;
        event.type = SDL_EVENT_FINGER_MOTION;
        event.common.timestamp = timestamp;
-        event.tfinger.touchId = id;
-        event.tfinger.fingerId = fingerid;
+        event.tfinger.touchID = id;
+        event.tfinger.fingerID = fingerid;
        event.tfinger.x = x;
        event.tfinger.y = y;
        event.tfinger.dx = xrel;
diff --git a/src/joystick/SDL_gamepad.c b/src/joystick/SDL_gamepad.c
index 89882c9a400e..6574b66554f7 100644
--- a/src/joystick/SDL_gamepad.c
+++ b/src/joystick/SDL_gamepad.c
@@ -160,11 +160,11 @@ static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gam

static SDL_bool HasSameOutput(SDL_GamepadBinding *a, SDL_GamepadBinding *b)
{
-    if (a->outputType != b->outputType) {
+    if (a->output_type != b->output_type) {
        return SDL_FALSE;
    }

-    if (a->outputType == SDL_GAMEPAD_BINDTYPE_AXIS) {
+    if (a->output_type == SDL_GAMEPAD_BINDTYPE_AXIS) {
        return a->output.axis.axis == b->output.axis.axis;
    } else {
        return a->output.button == b->output.button;
@@ -173,7 +173,7 @@ static SDL_bool HasSameOutput(SDL_GamepadBinding *a, SDL_GamepadBinding *b)

static void ResetOutput(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_GamepadBinding *bind)
{
-    if (bind->outputType == SDL_GAMEPAD_BINDTYPE_AXIS) {
+    if (bind->output_type == SDL_GAMEPAD_BINDTYPE_AXIS) {
        SDL_SendGamepadAxis(timestamp, gamepad, bind->output.axis.axis, 0);
    } else {
        SDL_SendGamepadButton(timestamp, gamepad, bind->output.button, SDL_RELEASED);
@@ -191,7 +191,7 @@ static void HandleJoystickAxis(Uint64 timestamp, SDL_Gamepad *gamepad, int axis,
    last_match = gamepad->last_match_axis[axis];
    for (i = 0; i < gamepad->num_bindings; ++i) {
        SDL_GamepadBinding *binding = &gamepad->bindings[i];
-        if (binding->inputType == SDL_GAMEPAD_BINDTYPE_AXIS &&
+        if (binding->input_type == SDL_GAMEPAD_BINDTYPE_AXIS &&
            axis == binding->input.axis.axis) {
            if (binding->input.axis.axis_min < binding->input.axis.axis_max) {
                if (value >= binding->input.axis.axis_min &&
@@ -215,7 +215,7 @@ static void HandleJoystickAxis(Uint64 timestamp, SDL_Gamepad *gamepad, int axis,
    }

    if (match) {
-        if (match->outputType == SDL_GAMEPAD_BINDTYPE_AXIS) {
+        if (match->output_type == SDL_GAMEPAD_BINDTYPE_AXIS) {
            if (match->input.axis.axis_min != match->output.axis.axis_min || match->input.axis.axis_max != match->output.axis.axis_max) {
                float normalized_value = (float)(value - match->input.axis.axis_min) / (match->input.axis.axis_max - match->input.axis.axis_min);
                value = match->output.axis.axis_min + (int)(normalized_value * (match->output.axis.axis_max - match->output.axis.axis_min));
@@ -243,9 +243,9 @@ static void HandleJoystickButton(Uint64 timestamp, SDL_Gamepad *gamepad, int but

    for (i = 0; i < gamepad->num_bindings; ++i) {
        SDL_GamepadBinding *binding = &gamepad->bindings[i];
-        if (binding->inputType == SDL_GAMEPAD_BINDTYPE_BUTTON &&
+        if (binding->input_type == SDL_GAMEPAD_BINDTYPE_BUTTON &&
            button == binding->input.button) {
-            if (binding->outputType == SDL_GAMEPAD_BINDTYPE_AXIS) {
+            if (binding->output_type == SDL_GAMEPAD_BINDTYPE_AXIS) {
                int value = state ? binding->output.axis.axis_max : binding->output.axis.axis_min;
                SDL_SendGamepadAxis(timestamp, gamepad, binding->output.axis.axis, (Sint16)value);
            } else {
@@ -267,10 +267,10 @@ static void HandleJoystickHat(Uint64 timestamp, SDL_Gamepad *gamepad, int hat, U
    changed_mask = (last_mask ^ value);
    for (i = 0; i < gamepad->num_bindings; ++i) {
        SDL_GamepadBinding *binding = &gamepad->bindings[i];
-        if (binding->inputType == SDL_GAMEPAD_BINDTYPE_HAT && hat == binding->input.hat.hat) {
+        if (binding->input_type == SDL_GAMEPAD_BINDTYPE_HAT && hat == binding->input.hat.hat) {
            if ((changed_mask & binding->input.hat.hat_mask) != 0) {
                if (value & binding->input.hat.hat_mask) {
-                    if (binding->outputType == SDL_GAMEPAD_BINDTYPE_AXIS) {
+                    if (binding->output_type == SDL_GAMEPAD_BINDTYPE_AXIS) {
                        SDL_SendGamepadAxis(timestamp, gamepad, binding->output.axis.axis, (Sint16)binding->output.axis.axis_max);
                    } else {
                        SDL_SendGamepadButton(timestamp, gamepad, binding->output.button, SDL_PRESSED);
@@ -1173,7 +1173,7 @@ static SDL_bool SDL_PrivateParseGamepadElement(SDL_Gamepad *gamepad, const char
    axis = SDL_GetGamepadAxisFromString(szGameButton);
    button = SDL_PrivateGetGamepadButtonFromString(szGameButton, baxy_mapping);
    if (axis != SDL_GAMEPAD_AXIS_INVALID) {
-        bind.outputType = SDL_GAMEPAD_BINDTYPE_AXIS;
+        bind.output_type = SDL_GAMEPAD_BINDTYPE_AXIS;
        bind.output.axis.axis = axis;
        if (axis == SDL_GAMEPAD_AXIS_LEFT_TRIGGER || axis == SDL_GAMEPAD_AXIS_RIGHT_TRIGGER) {
            bind.output.axis.axis_min = 0;
@@ -1191,7 +1191,7 @@ static SDL_bool SDL_PrivateParseGamepadElement(SDL_Gamepad *gamepad, const char
            }
        }
    } else if (button != SDL_GAMEPAD_BUTTON_INVALID) {
-        bind.outputType = SDL_GAMEPAD_BINDTYPE_BUTTON;
+        bind.output_type = SDL_GAMEPAD_BINDTYPE_BUTTON;
        bind.output.button = button;
    } else {
        return SDL_FALSE;
@@ -1205,7 +1205,7 @@ static SDL_bool SDL_PrivateParseGamepadElement(SDL_Gamepad *gamepad, const char
    }

    if (szJoystickButton[0] == 'a' && SDL_isdigit((unsigned char)szJoystickButton[1])) {
-        bind.inputType = SDL_GAMEPAD_BINDTYPE_AXIS;
+        bind.input_type = SDL_GAMEPAD_BINDTYPE_AXIS;
        bind.input.axis.axis = SDL_atoi(&szJoystickButton[1]);
        if (half_axis_input == '+') {
            bind.input.axis.axis_min = 0;
@@ -1223,13 +1223,13 @@ static SDL_bool SDL_PrivateParseGamepadElement(SDL_Gamepad *gamepad, const char
            bind.input.axis.axis_max = tmp;
        }
    } else if (szJoystickButton[0] == 'b' && SDL_isdigit((unsigned char)szJoystickButton[1])) {
-        bind.inputType = SDL_GAMEPAD_BINDTYPE_BUTTON;
+        bind.input_type = SDL_GAMEPAD_BINDTYPE_BUTTON;
        bind.input.button = SDL_atoi(&szJoystickButton[1]);
    } else if (szJoystickButton[0] == 'h' && SDL_isdigit((unsigned char)szJoystickButton[1]) &&
               szJoystickButton[2] == '.' && SDL_isdigit((unsigned char)szJoystickButton[3])) {
        int hat = SDL_atoi(&szJoystickButton[1]);
        int mask = SDL_atoi(&szJoystickButton[3]);
-        bind.inputType = SDL_GAMEPAD_BINDTYPE_HAT;
+        bind.input_type = SDL_GAMEPAD_BINDTYPE_HAT;
        bind.input.hat.hat = hat;
        bind.input.hat.hat_mask = mask;
    } else {
@@ -1419,8 +1419,8 @@ static void SDL_PrivateLoadButtonMapping(SDL_Gamepad *gamepad, GamepadMapping_t
    /* Set the zero point for triggers */
    for (i = 0; i < gamepad->num_bindings; ++i) {
        SDL_GamepadBinding *binding = &gamepad->bindings[i];
-        if (binding->inputType == SDL_GAMEPAD_BINDTYPE_AXIS &&
-            binding->outputType == SDL_GAMEPAD_BINDTYPE_AXIS &&
+        if (binding->input_type == SDL_GAMEPAD_BINDTYPE_AXIS &&
+            binding->output_type == SDL_GAMEPAD_BINDTYPE_AXIS &&
            (binding->output.axis.axis == SDL_GAMEPAD_AXIS_LEFT_TRIGGER ||
             binding->output.axis.axis == SDL_GAMEPAD_AXIS_RIGHT_TRIGGER)) {
            if (binding->input.axis.axis < gamepad->joystick->naxes) {
@@ -2671,7 +2671,7 @@ SDL_bool SDL_GamepadHasAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis)

        for (i = 0; i < gamepad->num_bindings; ++i) {
            SDL_GamepadBinding *binding = &gamepad->bindings[i];
-            if (binding->outputType == SDL_GAMEPAD_BINDTYPE_AXIS && binding->output.axis.axis == axis) {
+            if (binding->output_type == SDL_

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