SDL: Removed raw mouse events

From f37eef948ce7844e8c6310c8785a16919e28e21f Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 21 Dec 2024 04:58:54 -0800
Subject: [PATCH] Removed raw mouse events
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

It's too close the 3.2.0 release for an API change like this.

If/when we re-add these, some things for consideration:
* What use cases does this enable that aren't currently possible?
* What cross-platform API guarantees do we make about the availability of these events? e.g. do we try to simulate them where raw input isn't actually available?
* How is this different from the existing relative mode, and how do we clearly explain when you want these events vs wanting relative mode?

Notes from @expikr:
First observation: the reason I originally passed denominators instead of multipliers was because some rational values cannot be exactly represented by floats (e.g 1/120) so instead let the end-developer decide how to do the dividing themselves. It was the reason why it was using split values with an integer numerator to begin with, instead of having both as floats or even just normalize it in advance.

On the other hand, passing them as multipliers might have hypothetical uses for dynamically passing end-user controlled scaling in a transparent manner without coupling? (Though in that case why not just do that as additional fields appended to `motion` structs in an API-compatible layout?)

So it’s somewhat of a philosophical judgement of what this API of optional availability do we intend for it to present itself as:
- should it be a bit-perfect escape hatch with the absolute minimally-denominal abstraction over platform details just enough to be able to serve the full information (á la HIDPIAPI),
- or a renewed ergonomic API for splitting relative motion from cursor motion (in light of The Great Warping Purge) so that it is unburdened by legacy RelativeMode state machines, in which case it would be more appropriate to just call it `RELATIVE` instead of `RAW` and should be added alongside another new event purely for cursor events?

This alternate API stream was conceived in the context of preserving compatibility of the existing RelativeMode state machine by adding an escape hatch. So given the same context, my taste leans towards the former designation.

However, as The Great Warping Purge has made it potentially viable to do so, if I were allowed to break ABI by nuking the RelativeMode state machine entirely, I would prefer the latter designation unified as one of three separate components split from the old state machine, each independently controlled by platform-dependent availability without any state switching of a leaky melting pot:
- cursor visibility controls (if platform has cursor)
- cursor motion events (if platform has cursor)
- relative motion events (if the platform reports hardware motion)
---
 include/SDL3/SDL_events.h                | 56 ------------------------
 src/core/linux/SDL_evdev.c               | 11 ++---
 src/core/openbsd/SDL_wscons_mouse.c      |  9 ----
 src/events/SDL_categories.c              |  4 --
 src/events/SDL_events.c                  | 28 ------------
 src/events/SDL_mouse.c                   | 45 -------------------
 src/events/SDL_mouse_c.h                 |  9 ----
 src/render/SDL_render.c                  |  2 -
 src/test/SDL_test_common.c               | 18 --------
 src/video/uikit/SDL_uikitevents.m        |  7 ---
 src/video/wayland/SDL_waylandevents.c    | 24 ----------
 src/video/windows/SDL_windowsevents.c    | 35 ---------------
 src/video/windows/SDL_windowsgameinput.c |  9 ----
 src/video/windows/SDL_windowsrawinput.c  |  5 +--
 src/video/x11/SDL_x11events.c            | 10 -----
 src/video/x11/SDL_x11xinput2.c           |  5 ---
 test/testrelative.c                      | 22 ++--------
 17 files changed, 9 insertions(+), 290 deletions(-)

diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h
index 3e8c052836d94..e3f6bd183cbf2 100644
--- a/include/SDL3/SDL_events.h
+++ b/include/SDL3/SDL_events.h
@@ -182,10 +182,6 @@ typedef enum SDL_EventType
     SDL_EVENT_MOUSE_WHEEL,             /**< Mouse wheel motion */
     SDL_EVENT_MOUSE_ADDED,             /**< A new mouse has been inserted into the system */
     SDL_EVENT_MOUSE_REMOVED,           /**< A mouse has been removed */
-    SDL_EVENT_RAW_MOUSE_MOTION,        /**< Mouse moved (raw motion deltas) */
-    SDL_EVENT_RAW_MOUSE_BUTTON_DOWN,   /**< Mouse button pressed (raw button press) */
-    SDL_EVENT_RAW_MOUSE_BUTTON_UP,     /**< Mouse button released (raw button release) */
-    SDL_EVENT_RAW_MOUSE_WHEEL,         /**< Mouse wheel motion (raw wheel deltas) */
 
     /* Joystick events */
     SDL_EVENT_JOYSTICK_AXIS_MOTION  = 0x600, /**< Joystick axis motion */
@@ -458,23 +454,6 @@ typedef struct SDL_MouseMotionEvent
     float yrel;         /**< The relative motion in the Y direction */
 } SDL_MouseMotionEvent;
 
-/**
- * Raw mouse motion event structure (event.raw_motion.*)
- *
- * \since This struct is available since SDL 3.1.8.
- */
-typedef struct SDL_RawMouseMotionEvent
-{
-    SDL_EventType type; /**< SDL_EVENT_RAW_MOUSE_MOTION */
-    Uint32 reserved;
-    Uint64 timestamp;   /**< In nanoseconds, populated using SDL_GetTicksNS() */
-    SDL_MouseID which;  /**< The mouse instance id */
-    Sint32 dx;          /**< X axis delta */
-    Sint32 dy;          /**< Y axis delta */
-    float scale_x;      /**< X value scale to approximate desktop acceleration */
-    float scale_y;      /**< Y value scale to approximate desktop acceleration */
-} SDL_RawMouseMotionEvent;
-
 /**
  * Mouse button event structure (event.button.*)
  *
@@ -495,21 +474,6 @@ typedef struct SDL_MouseButtonEvent
     float y;            /**< Y coordinate, relative to window */
 } SDL_MouseButtonEvent;
 
-/**
- * Raw mouse button event structure (event.raw_button.*)
- *
- * \since This struct is available since SDL 3.1.8.
- */
-typedef struct SDL_RawMouseButtonEvent
-{
-    SDL_EventType type; /**< SDL_EVENT_RAW_MOUSE_BUTTON_DOWN or SDL_EVENT_RAW_MOUSE_BUTTON_UP */
-    Uint32 reserved;
-    Uint64 timestamp;   /**< In nanoseconds, populated using SDL_GetTicksNS() */
-    SDL_MouseID which;  /**< The mouse instance id */
-    Uint8 button;       /**< The mouse button index */
-    bool down;          /**< true if the button is pressed */
-} SDL_RawMouseButtonEvent;
-
 /**
  * Mouse wheel event structure (event.wheel.*)
  *
@@ -529,23 +493,6 @@ typedef struct SDL_MouseWheelEvent
     float mouse_y;      /**< Y coordinate, relative to window */
 } SDL_MouseWheelEvent;
 
-/**
- * Raw mouse wheel event structure (event.raw_wheel.*)
- *
- * \since This struct is available since SDL 3.1.3.
- */
-typedef struct SDL_RawMouseWheelEvent
-{
-    SDL_EventType type; /**< SDL_EVENT_RAW_MOUSE_WHEEL */
-    Uint32 reserved;
-    Uint64 timestamp;   /**< In nanoseconds, populated using SDL_GetTicksNS() */
-    SDL_MouseID which;  /**< The mouse instance id */
-    Sint32 dx;          /**< X axis delta, positive to the right and negative to the left */
-    Sint32 dy;          /**< Y axis delta, positive away from the user and negative toward the user */
-    float scale_x;      /**< X value scale to convert to logical scroll units */
-    float scale_y;      /**< Y value scale to convert to logical scroll units */
-} SDL_RawMouseWheelEvent;
-
 /**
  * Joystick axis motion event structure (event.jaxis.*)
  *
@@ -1048,11 +995,8 @@ typedef union SDL_Event
     SDL_TextInputEvent text;                /**< Text input event data */
     SDL_MouseDeviceEvent mdevice;           /**< Mouse device change event data */
     SDL_MouseMotionEvent motion;            /**< Mouse motion event data */
-    SDL_RawMouseMotionEvent raw_motion;     /**< Raw mouse motion event data */
     SDL_MouseButtonEvent button;            /**< Mouse button event data */
-    SDL_RawMouseButtonEvent raw_button;     /**< Raw mouse button event data */
     SDL_MouseWheelEvent wheel;              /**< Mouse wheel event data */
-    SDL_RawMouseWheelEvent raw_wheel;       /**< Raw mouse wheel event data */
     SDL_JoyDeviceEvent jdevice;             /**< Joystick device change event data */
     SDL_JoyAxisEvent jaxis;                 /**< Joystick axis event data */
     SDL_JoyBallEvent jball;                 /**< Joystick ball event data */
diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c
index 425300aa87ee9..456a04f18ec22 100644
--- a/src/core/linux/SDL_evdev.c
+++ b/src/core/linux/SDL_evdev.c
@@ -348,7 +348,6 @@ void SDL_EVDEV_Poll(void)
                     if (event->code >= BTN_MOUSE && event->code < BTN_MOUSE + SDL_arraysize(EVDEV_MouseButtons)) {
                         Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event);
                         mouse_button = event->code - BTN_MOUSE;
-                        SDL_SendRawMouseButton(timestamp, (SDL_MouseID)item->fd, EVDEV_MouseButtons[mouse_button], (event->value != 0));
                         SDL_SendMouseButton(timestamp, mouse->focus, (SDL_MouseID)item->fd, EVDEV_MouseButtons[mouse_button], (event->value != 0));
                         break;
                     }
@@ -491,7 +490,6 @@ void SDL_EVDEV_Poll(void)
                         if (item->relative_mouse) {
                             if (item->mouse_x != 0 || item->mouse_y != 0) {
                                 Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event);
-                                SDL_SendRawMouseMotion(timestamp, (SDL_MouseID)item->fd, item->mouse_x, item->mouse_y, 1.0f, 1.0f);
                                 SDL_SendMouseMotion(timestamp, mouse->focus, (SDL_MouseID)item->fd, item->relative_mouse, (float)item->mouse_x, (float)item->mouse_y);
                                 item->mouse_x = item->mouse_y = 0;
                             }
@@ -516,14 +514,11 @@ void SDL_EVDEV_Poll(void)
 
                         if (item->mouse_wheel != 0 || item->mouse_hwheel != 0) {
                             Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event);
-                            const float scale = (item->high_res_hwheel ? 1.0f / 120.0f : 1.0f);
-                            SDL_SendRawMouseWheel(timestamp,
-                                                  (SDL_MouseID)item->fd,
-                                                  item->mouse_hwheel, item->mouse_wheel, scale, scale);
+                            const float denom = (item->high_res_hwheel ? 120.0f : 1.0f);
                             SDL_SendMouseWheel(timestamp,
                                                mouse->focus, (SDL_MouseID)item->fd,
-                                               item->mouse_hwheel * scale,
-                                               item->mouse_wheel * scale,
+                                               item->mouse_hwheel / denom,
+                                               item->mouse_wheel / denom,
                                                SDL_MOUSEWHEEL_NORMAL);
                             item->mouse_wheel = item->mouse_hwheel = 0;
                         }
diff --git a/src/core/openbsd/SDL_wscons_mouse.c b/src/core/openbsd/SDL_wscons_mouse.c
index 57e4f02fa72b0..81f336f6323f4 100644
--- a/src/core/openbsd/SDL_wscons_mouse.c
+++ b/src/core/openbsd/SDL_wscons_mouse.c
@@ -87,35 +87,26 @@ void updateMouse(SDL_WSCONS_mouse_input_data *input)
             {
                 Uint8 button = SDL_BUTTON_LEFT + events[i].value;
                 bool down = (type == WSCONS_EVENT_MOUSE_DOWN);
-                SDL_SendRawMouseButton(timestamp, input->mouseID, button, down);
                 SDL_SendMouseButton(timestamp, mouse->focus, input->mouseID, button, down);
                 break;
             }
             case WSCONS_EVENT_MOUSE_DELTA_X:
             {
-                const float scale = 1.0f;
-                SDL_SendRawMouseMotion(timestamp, input->mouseID, events[i].value, 0, scale, scale);
                 SDL_SendMouseMotion(timestamp, mouse->focus, input->mouseID, true, (float)events[i].value, 0.0f);
                 break;
             }
             case WSCONS_EVENT_MOUSE_DELTA_Y:
             {
-                const float scale = 1.0f;
-                SDL_SendRawMouseMotion(timestamp, input->mouseID, 0, -events[i].value, scale, scale);
                 SDL_SendMouseMotion(timestamp, mouse->focus, input->mouseID, true, 0.0f, -(float)events[i].value);
                 break;
             }
             case WSCONS_EVENT_MOUSE_DELTA_W:
             {
-                const float scale = 1.0f;
-                SDL_SendRawMouseWheel(timestamp, input->mouseID, events[i].value, 0, scale, scale);
                 SDL_SendMouseWheel(timestamp, mouse->focus, input->mouseID, events[i].value, 0, SDL_MOUSEWHEEL_NORMAL);
                 break;
             }
             case WSCONS_EVENT_MOUSE_DELTA_Z:
             {
-                const float scale = 1.0f;
-                SDL_SendRawMouseWheel(timestamp, input->mouseID, 0, -events[i].value, scale, scale);
                 SDL_SendMouseWheel(timestamp, mouse->focus, input->mouseID, 0, -events[i].value, SDL_MOUSEWHEEL_NORMAL);
                 break;
             }
diff --git a/src/events/SDL_categories.c b/src/events/SDL_categories.c
index 11e56d11058f5..5f0853476f3ac 100644
--- a/src/events/SDL_categories.c
+++ b/src/events/SDL_categories.c
@@ -78,17 +78,13 @@ SDL_EventCategory SDL_GetEventCategory(Uint32 type)
         return SDL_EVENTCATEGORY_EDIT_CANDIDATES;
 
     case SDL_EVENT_MOUSE_MOTION:
-    case SDL_EVENT_RAW_MOUSE_MOTION:
         return SDL_EVENTCATEGORY_MOTION;
 
     case SDL_EVENT_MOUSE_BUTTON_DOWN:
     case SDL_EVENT_MOUSE_BUTTON_UP:
-    case SDL_EVENT_RAW_MOUSE_BUTTON_DOWN:
-    case SDL_EVENT_RAW_MOUSE_BUTTON_UP:
         return SDL_EVENTCATEGORY_BUTTON;
 
     case SDL_EVENT_MOUSE_WHEEL:
-    case SDL_EVENT_RAW_MOUSE_WHEEL:
         return SDL_EVENTCATEGORY_WHEEL;
 
     case SDL_EVENT_MOUSE_ADDED:
diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c
index f7e16b1d2231d..bc04ee91a348c 100644
--- a/src/events/SDL_events.c
+++ b/src/events/SDL_events.c
@@ -390,7 +390,6 @@ static void SDL_LogEvent(const SDL_Event *event)
     // sensor/mouse/pen/finger motion are spammy, ignore these if they aren't demanded.
     if ((SDL_EventLoggingVerbosity < 2) &&
         ((event->type == SDL_EVENT_MOUSE_MOTION) ||
-         (event->type == SDL_EVENT_RAW_MOUSE_MOTION) ||
          (event->type == SDL_EVENT_FINGER_MOTION) ||
          (event->type == SDL_EVENT_PEN_AXIS) ||
          (event->type == SDL_EVENT_PEN_MOTION) ||
@@ -568,13 +567,6 @@ static void SDL_LogEvent(const SDL_Event *event)
                            event->motion.xrel, event->motion.yrel);
         break;
 
-        SDL_EVENT_CASE(SDL_EVENT_RAW_MOUSE_MOTION)
-        (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%u dx=%d dy=%d)",
-                           (uint)event->raw_motion.timestamp,
-                           (uint)event->raw_motion.which,
-                           (int)event->raw_motion.dx, (int)event->raw_motion.dy);
-        break;
-
 #define PRINT_MBUTTON_EVENT(event)                                                                                              \
     (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u button=%u state=%s clicks=%u x=%g y=%g)", \
                        (uint)event->button.timestamp, (uint)event->button.windowID,                                             \
@@ -589,19 +581,6 @@ static void SDL_LogEvent(const SDL_Event *event)
         break;
 #undef PRINT_MBUTTON_EVENT
 
-#define PRINT_RAW_MBUTTON_EVENT(event)                                                                                          \
-    (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%u button=%u state=%s)",                                 \
-                       (uint)event->raw_button.timestamp,                                                                       \
-                       (uint)event->raw_button.which, (uint)event->raw_button.button,                                           \
-                       event->raw_button.down ? "pressed" : "released");
-        SDL_EVENT_CASE(SDL_EVENT_RAW_MOUSE_BUTTON_DOWN)
-        PRINT_RAW_MBUTTON_EVENT(event);
-        break;
-        SDL_EVENT_CASE(SDL_EVENT_RAW_MOUSE_BUTTON_UP)
-        PRINT_RAW_MBUTTON_EVENT(event);
-        break;
-#undef PRINT_RAW_MBUTTON_EVENT
-
         SDL_EVENT_CASE(SDL_EVENT_MOUSE_WHEEL)
         (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u x=%g y=%g direction=%s)",
                            (uint)event->wheel.timestamp, (uint)event->wheel.windowID,
@@ -609,13 +588,6 @@ static void SDL_LogEvent(const SDL_Event *event)
                            event->wheel.direction == SDL_MOUSEWHEEL_NORMAL ? "normal" : "flipped");
         break;
 
-        SDL_EVENT_CASE(SDL_EVENT_RAW_MOUSE_WHEEL)
-        (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%u dx=%d dy=%d)",
-                           (uint)event->raw_wheel.timestamp,
-                           (uint)event->raw_wheel.which,
-                           (int)event->raw_wheel.dx, (int)event->raw_wheel.dy);
-        break;
-
         SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_AXIS_MOTION)
         (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d axis=%u value=%d)",
                            (uint)event->jaxis.timestamp, (int)event->jaxis.which,
diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 88d990397fd6e..d13e788f803a9 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -970,51 +970,6 @@ void SDL_SendMouseWheel(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseI
     }
 }
 
-void SDL_SendRawMouseMotion(Uint64 timestamp, SDL_MouseID mouseID, int dx, int dy, float scale_x, float scale_y)
-{
-    if (SDL_EventEnabled(SDL_EVENT_RAW_MOUSE_MOTION)) {
-        SDL_Event event;
-        event.type = SDL_EVENT_RAW_MOUSE_MOTION;
-        event.common.timestamp = timestamp;
-        event.raw_motion.which = mouseID;
-        event.raw_motion.dx = dx;
-        event.raw_motion.dy = dy;
-        event.raw_motion.scale_x = scale_x;
-        event.raw_motion.scale_y = scale_y;
-        SDL_PushEvent(&event);
-    }
-}
-
-void SDL_SendRawMouseButton(Uint64 timestamp, SDL_MouseID mouseID, Uint8 button, bool down)
-{
-    const SDL_EventType type = down ? SDL_EVENT_RAW_MOUSE_BUTTON_DOWN : SDL_EVENT_RAW_MOUSE_BUTTON_UP;
-
-    if (SDL_EventEnabled(type)) {
-        SDL_Event event;
-        event.type = type;
-        event.common.timestamp = timestamp;
-        event.raw_button.which = mouseID;
-        event.raw_button.button = button;
-        event.raw_button.down = down;
-        SDL_PushEvent(&event);
-    }
-}
-
-void SDL_SendRawMouseWheel(Uint64 timestamp, SDL_MouseID mouseID, int dx, int dy, float scale_x, float scale_y)
-{
-    if (SDL_EventEnabled(SDL_EVENT_RAW_MOUSE_WHEEL)) {
-        SDL_Event event;
-        event.type = SDL_EVENT_RAW_MOUSE_WHEEL;
-        event.common.timestamp = timestamp;
-        event.raw_wheel.which = mouseID;
-        event.raw_wheel.dx = dx;
-        event.raw_wheel.dy = dy;
-        event.raw_wheel.scale_x = scale_x;
-        event.raw_wheel.scale_y = scale_y;
-        SDL_PushEvent(&event);
-    }
-}
-
 void SDL_QuitMouse(void)
 {
     SDL_Cursor *cursor, *next;
diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h
index ffd0260134bff..b1040fff495f7 100644
--- a/src/events/SDL_mouse_c.h
+++ b/src/events/SDL_mouse_c.h
@@ -178,15 +178,6 @@ extern void SDL_SendMouseButtonClicks(Uint64 timestamp, SDL_Window *window, SDL_
 // Send a mouse wheel event
 extern void SDL_SendMouseWheel(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction);
 
-// Send raw mouse motion
-extern void SDL_SendRawMouseMotion(Uint64 timestamp, SDL_MouseID mouseID, int dx, int dy, float scale_x, float scale_y);
-
-// Send a raw mouse button event
-extern void SDL_SendRawMouseButton(Uint64 timestamp, SDL_MouseID mouseID, Uint8 button, bool down);
-
-// Send a raw mouse wheel event
-extern void SDL_SendRawMouseWheel(Uint64 timestamp, SDL_MouseID mouseID, int dx, int dy, float scale_x, float scale_y);
-
 // Warp the mouse within the window, potentially overriding relative mode
 extern void SDL_PerformWarpMouseInWindow(SDL_Window *window, float x, float y, bool ignore_relative_mode);
 
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 360f1bcaae73e..6e8c7ad33fa2d 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -2881,8 +2881,6 @@ bool SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *even
             SDL_RenderCoordinatesFromWindow(renderer, event->motion.x, event->motion.y, &event->motion.x, &event->motion.y);
             SDL_RenderVectorFromWindow(renderer, event->motion.xrel, event->motion.yrel, &event->motion.xrel, &event->motion.yrel);
         }
-    } else if (event->type == SDL_EVENT_RAW_MOUSE_MOTION) {
-        SDL_RenderVectorFromWindow(renderer, event->raw_motion.scale_x, event->raw_motion.scale_y, &event->raw_motion.scale_x, &event->raw_motion.scale_y);
     } else if (event->type == SDL_EVENT_MOUSE_BUTTON_DOWN ||
                event->type == SDL_EVENT_MOUSE_BUTTON_UP) {
         SDL_Window *window = SDL_GetWindowFromID(event->button.windowID);
diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c
index 54eec3b75603b..eb28b0563c8c6 100644
--- a/src/test/SDL_test_common.c
+++ b/src/test/SDL_test_common.c
@@ -1784,11 +1784,6 @@ void SDLTest_PrintEvent(const SDL_Event *event)
                 event->motion.xrel, event->motion.yrel,
                 event->motion.windowID);
         break;
-    case SDL_EVENT_RAW_MOUSE_MOTION:
-        SDL_Log("SDL EVENT: Raw Mouse: mouse %" SDL_PRIu32 " moved %" SDL_PRIs32 ",%" SDL_PRIs32,
-                event->raw_motion.which,
-                event->raw_motion.dx, event->raw_motion.dy);
-        break;
     case SDL_EVENT_MOUSE_BUTTON_DOWN:
         SDL_Log("SDL EVENT: Mouse: button %d pressed at %g,%g with click count %d in window %" SDL_PRIu32,
                 event->button.button, event->button.x, event->button.y, event->button.clicks,
@@ -1799,22 +1794,10 @@ void SDLTest_PrintEvent(const SDL_Event *event)
                 event->button.button, event->button.x, event->button.y, event->button.clicks,
                 event->button.windowID);
         break;
-    case SDL_EVENT_RAW_MOUSE_BUTTON_DOWN:
-        SDL_Log("SDL EVENT: Raw Mouse: mouse %" SDL_PRIu32 " button %d pressed",
-                event->raw_button.which, event->raw_button.button);
-        break;
-    case SDL_EVENT_RAW_MOUSE_BUTTON_UP:
-        SDL_Log("SDL EVENT: Raw Mouse: mouse %" SDL_PRIu32 " button %d released",
-                event->raw_button.which, event->raw_button.button);
-        break;
     case SDL_EVENT_MOUSE_WHEEL:
         SDL_Log("SDL EVENT: Mouse: wheel scrolled %g in x and %g in y (reversed: %d) in window %" SDL_PRIu32,
                 event->wheel.x, event->wheel.y, event->wheel.direction, event->wheel.windowID);
         break;
-    case SDL_EVENT_RAW_MOUSE_WHEEL:
-        SDL_Log("SDL EVENT: Raw Mouse: mouse %" SDL_PRIu32 " wheel scrolled %" SDL_PRIs32 " in x and %" SDL_PRIs32 " in y",
-                event->raw_wheel.which, event->raw_wheel.dx, event->raw_wheel.dy);
-        break;
     case SDL_EVENT_JOYSTICK_ADDED:
         SDL_Log("SDL EVENT: Joystick %" SDL_PRIu32 " attached",
                 event->jdevice.which);
@@ -2238,7 +2221,6 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
 
     if (state->verbose & VERBOSE_EVENT) {
         if ((event->type != SDL_EVENT_MOUSE_MOTION &&
-             event->type != SDL_EVENT_RAW_MOUSE_MOTION &&
              event->type != SDL_EVENT_FINGER_MOTION &&
              event->type != SDL_EVENT_PEN_MOTION &&
              event->type != SDL_EVENT_PEN_AXIS &&
diff --git a/src/video/uikit/SDL_uikitevents.m b/src/video/uikit/SDL_uikitevents.m
index 03ead1a1b220c..8e34129bb9742 100644
--- a/src/video/uikit/SDL_uikitevents.m
+++ b/src/video/uikit/SDL_uikitevents.m
@@ -320,7 +320,6 @@ static bool SetGCMouseRelativeMode(bool enabled)
 static void OnGCMouseButtonChanged(SDL_MouseID mouseID, Uint8 button, BOOL pressed)
 {
     Uint64 timestamp = SDL_GetTicksNS();
-    SDL_SendRawMouseButton(timestamp, mouseID, button, pressed);
     SDL_SendMouseButton(timestamp, SDL_GetMouseFocus(), mouseID, button, pressed);
 }
 
@@ -351,9 +350,6 @@ static void OnGCMouseConnected(GCMouse *mouse) API_AVAILABLE(macos(11.0), ios(14
     mouse.mouseInput.mouseMovedHandler = ^(GCMouseInput *mouseInput, float deltaX, float deltaY) {
         Uint64 timestamp = SDL_GetTicksNS();
 
-        // FIXME: Do we get non-integer deltas here?
-        SDL_SendRawMouseMotion(timestamp, mouseID, (int)deltaX, (int)-deltaY, 1.0f, 1.0f);
-
         if (SDL_GCMouseRelativeMode()) {
             SDL_SendMouseMotion(timestamp, SDL_GetMouseFocus(), mouseID, true, deltaX, -deltaY);
         }
@@ -370,9 +366,6 @@ static void OnGCMouseConnected(GCMouse *mouse) API_AVAILABLE(macos(11.0), ios(14
         float vertical = -xValue;
         float horizontal = yValue;
 
-        // FIXME: Do we get non-integer deltas here?
-        SDL_SendRawMouseWheel(timestamp, mouseID, (int)horizontal, (int)vertical, 1.0f, 1.0f);
-
         if (mouse_scroll_direction == SDL_MOUSEWHEEL_FLIPPED) {
             // Since these are raw values, we need to flip them ourselves
             vertical = -vertical;
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c
index a32bdfe919ba5..14cc9f3901eb3 100644
--- a/src/video/wayland/SDL_waylandevents.c
+++ b/src/video/wayland/SDL_waylandevents.c
@@ -719,7 +719,6 @@ static void pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_
     default:
         return;
     }
-    SDL_SendRawMouseButton(timestamp, input->pointer_id, sdl_button, down);
 
     if (window) {
         SDL_VideoData *viddata = window->waylandData;
@@ -785,15 +784,6 @@ static void pointer_handle_axis_common_v1(struct SDL_WaylandInput *input,
     const Uint64 timestamp = Wayland_GetPointerTimestamp(input, time);
     const enum wl_pointer_axis a = axis;
 
-    // wl_fixed_t is a 24.8 signed fixed-point number which needs to be converted by dividing by 256
-    const float scale = 1.0f / WAYLAND_WHEEL_AXIS_UNIT;
-    const int amount = (value * WAYLAND_WHEEL_AXIS_UNIT) >> 8;
-    if (a == WL_POINTER_AXIS_VERTICAL_SCROLL) {
-        SDL_SendRawMouseWheel(timestamp, input->pointer_id, 0, amount, scale, scale);
-    } else {
-        SDL_SendRawMouseWheel(timestamp, input->pointer_id, amount, 0, scale, scale);
-    }
-
     if (input->pointer_focus) {
         float x, y;
 
@@ -822,15 +812,6 @@ static void pointer_handle_axis_common(struct SDL_WaylandInput *input, enum SDL_
 {
     const enum wl_pointer_axis a = axis;
 
-    // wl_fixed_t is a 24.8 signed fixed-point number which needs to be converted by dividing by 256
-    const float scale = (type == AXIS_EVENT_VALUE120) ? (1.0f / 120.0f) : (1.0f / WAYLAND_WHEEL_AXIS_UNIT);
-    const int amount = (type == AXIS_EVENT_VALUE120) ? (value >> 8) : ((value * WAYLAND_WHEEL_AXIS_UNIT) >> 8);
-    if (a == WL_POINTER_AXIS_VERTICAL_SCROLL) {
-        SDL_SendRawMouseWheel(0, input->pointer_id, 0, amount, scale, scale);
-    } else {
-        SDL_SendRawMouseWheel(0, input->pointer_id, amount, 0, scale, scale);
-    }
-
     if (input->pointer_focus) {
         switch (a) {
         case WL_POINTER_AXIS_VERTICAL_SCROLL:
@@ -1033,11 +1014,6 @@ static void relative_pointer_handle_relative_motion(void *data,
     // Relative pointer event times are in microsecond granularity.
     const Uint64 timestamp = Wayland_GetEventTimestamp(SDL_US_TO_NS(((Uint64)time_hi << 32) | (Uint64)time_lo));
 
-    // wl_fixed_t is a 24.8 signed fixed-point number which needs to be converted by dividing by 256
-    const float scale_x = dx_unaccel_w ? (dx_w / (float)dx_unaccel_w) : 1.0f;
-    const float scale_y = dy_unaccel_w ? (dy_w / (float)dy_unaccel_w) : 1.0f;
-    SDL_SendRawMouseMotion(timestamp, input->pointer_id, dx_unaccel_w >> 8, dy_unaccel_w >> 8, scale_x, scale_y);
-
     if (input->pointer_focus && d->relative_mouse_mode) {
         double dx;
         double dy;
diff --git a/src/video/windows/SDL_windowsevents.c b/src/video/windows/SDL_windowsevents.c
index 8004f952a6da5..c47573e083ab0 100644
--- a/src/video/windows/SDL_windowsevents.c
+++ b/src/video/windows/SDL_windowsevents.c
@@ -545,41 +545,6 @@ static void WIN_HandleRawMouseInput(Uint64 timestamp, SDL_VideoData *data, HANDL
     bool isAbsolute = ((rawmouse->usFlags & MOUSE_MOVE_ABSOLUTE) != 0);
     SDL_MouseID mouseID = (SDL_MouseID)(uintptr_t)hDevice;
 
-    if (haveMotion && !isAbsolute) {
-        // FIXME: Apply desktop mouse scale?
-        const float scale = 1.0f;
-        SDL_SendRawMouseMotion(timestamp, mouseID, dx, dy, scale, scale);
-    }
-
-    if (haveButton) {
-        for (int i = 0; i < SDL_arraysize(raw_buttons); ++i) {
-            if (rawmouse->usButtonFlags & raw_buttons[i].usButtonFlags) {
-                Uint8 button = raw_buttons[i].button;
-                bool down = raw_buttons[i].down;
-
-                if (button == SDL_BUTTON_LEFT) {
-                    if (WIN_SwapButtons(hDevice)) {
-                        button = SDL_BUTTON_RIGHT;
-                    }
-                } else if (button == SDL_BUTTON_RIGHT) {
-                    if (WIN_SwapButtons(hDevice)) {
-                        button = SDL_BUTTON_LEFT;
-                    }
-                }
-
-                SDL_SendRawMouseButton(timestamp, mouseID, button, down);
-            }
-        }
-
-        const float scale = 1.0f / 120.0f;
-        SHORT amount = (SHORT)rawmouse->usButtonData;
-        if (rawmouse->usButtonFlags & RI_MOUSE_WHEEL) {
-            SDL_SendRawMouseWheel(timestamp, mouseID, 0, amount, scale, scale);
-        } else if (rawmouse->usButtonFlags & RI_MOUSE_HWHEEL) {
-            SDL_SendRawMouseWheel(timestamp, mouseID, amount, 0, scale, scale);
-        }
-    }
-
     // Check whether relative mode should also receive events from the rawinput stream
     if (!data->raw_mouse_enabled) {
         return;
diff --git a/src/video/windows/SDL_windowsgameinput.c b/src/video/windows/SDL_windowsgameinput.c
index 431951d7396c5..df6829bb71b42 100644
--- a/src/video/windows/SDL_windowsgameinput.c
+++ b/src/video/windows/SDL_windowsgameinput.c
@@ -291,7 +291,6 @@ static void GAMEINPUT_InitialMouseReading(WIN_GameInputData *data, SDL_Window *w
         for (int i = 0; i < MAX_GAMEINPUT_BUTTONS; ++i) {
             const GameInputMouseButtons mask = (1 << i);
             bool down = ((state.buttons & mask) != 0);
-            SDL_SendRawMouseButton(timestamp, mouseID, GAMEINPUT_button_map[i], down);
             SDL_SendMouseButton(timestamp, window, mouseID, GAMEINPUT_button_map[i], down);
         }
     }
@@ -314,10 +313,6 @@ static void GAMEINPUT_HandleMouseDelta(WIN_GameInputData *data, SDL_Window *wind
         delta.wheelY = (state.wheelY - last.wheelY);
 
         if (delta.positionX || delta.positionY) {
-            // FIXME: Apply desktop mouse scale?
-            const float scale = 1.0f;
-            SDL_SendRawMouseMotion(timestamp, mouseID, delta.positionX, delta.positionY, scale, scale);
-
             SDL_SendMouseMotion(timestamp, window, mouseID, true, (float)delta.positionX, (float)delta.positio

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