From a05b2fbeee2f4742e7ac731bf428d5de0943df0d Mon Sep 17 00:00:00 2001
From: "Yevhen Babiichuk (DustDFG)" <[EMAIL REDACTED]>
Date: Sat, 20 Aug 2022 18:31:57 +0300
Subject: [PATCH] Use alias types for `which` members of event structs instead
of plain types
Signed-off-by: Yevhen Babiichuk (DustDFG) <dfgdust@gmail.com>
---
include/SDL_events.h | 10 +++++-----
include/SDL_mouse.h | 2 ++
src/events/SDL_mouse_c.h | 2 --
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/SDL_events.h b/include/SDL_events.h
index 3d02beedc4ec..599ec9069708 100644
--- a/include/SDL_events.h
+++ b/include/SDL_events.h
@@ -295,7 +295,7 @@ typedef struct SDL_MouseButtonEvent
Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with mouse focus, if any */
- Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
+ SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
Uint8 button; /**< The mouse button index */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
@@ -312,7 +312,7 @@ typedef struct SDL_MouseWheelEvent
Uint32 type; /**< ::SDL_MOUSEWHEEL */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with mouse focus, if any */
- Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
+ SDL_MouseID which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
Sint32 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 */
@@ -395,7 +395,7 @@ typedef struct SDL_JoyDeviceEvent
{
Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
+ SDL_JoystickID which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
} SDL_JoyDeviceEvent;
/**
@@ -448,7 +448,7 @@ typedef struct SDL_ControllerDeviceEvent
{
Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
+ SDL_JoystickID which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
} SDL_ControllerDeviceEvent;
/**
@@ -566,7 +566,7 @@ typedef struct SDL_SensorEvent
{
Uint32 type; /**< ::SDL_SENSORUPDATE */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
- Sint32 which; /**< The instance ID of the sensor */
+ SDL_SensorID which; /**< The instance ID of the sensor */
float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */
Uint64 timestamp_us; /**< The timestamp of the sensor reading in microseconds, if the hardware provides this information. */
} SDL_SensorEvent;
diff --git a/include/SDL_mouse.h b/include/SDL_mouse.h
index f9d81dc6074f..c5f9a9613848 100644
--- a/include/SDL_mouse.h
+++ b/include/SDL_mouse.h
@@ -38,6 +38,8 @@
extern "C" {
#endif
+typedef Uint32 SDL_MouseID;
+
typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */
/**
diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h
index 6dd023041297..ebe4c4044747 100644
--- a/src/events/SDL_mouse_c.h
+++ b/src/events/SDL_mouse_c.h
@@ -25,8 +25,6 @@
#include "SDL_mouse.h"
-typedef Uint32 SDL_MouseID;
-
struct SDL_Cursor
{
struct SDL_Cursor *next;