diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index 3e8c052836..e3f6bd183c 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 425300aa87..456a04f18e 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 57e4f02fa7..81f336f632 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 11e56d1105..5f0853476f 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 f7e16b1d22..bc04ee91a3 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 88d990397f..d13e788f80 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 ffd0260134..b1040fff49 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 360f1bcaae..6e8c7ad33f 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 54eec3b756..eb28b0563c 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 03ead1a1b2..8e34129bb9 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 a32bdfe919..14cc9f3901 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 8004f952a6..c47573e083 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 431951d739..df6829bb71 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.positionY); } if (delta.buttons) { @@ -325,15 +320,11 @@ static void GAMEINPUT_HandleMouseDelta(WIN_GameInputData *data, SDL_Window *wind const GameInputMouseButtons mask = (1 << i); if (delta.buttons & mask) { 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); } } } if (delta.wheelX || delta.wheelY) { - const float scale = 1.0f / WHEEL_DELTA; - SDL_SendRawMouseWheel(timestamp, device->instance_id, delta.wheelX, delta.wheelY, scale, scale); - float fAmountX = (float)delta.wheelX / WHEEL_DELTA; float fAmountY = (float)delta.wheelY / WHEEL_DELTA; SDL_SendMouseWheel(timestamp, SDL_GetMouseFocus(), device->instance_id, fAmountX, fAmountY, SDL_MOUSEWHEEL_NORMAL); diff --git a/src/video/windows/SDL_windowsrawinput.c b/src/video/windows/SDL_windowsrawinput.c index b4937c8044..5a0b13a045 100644 --- a/src/video/windows/SDL_windowsrawinput.c +++ b/src/video/windows/SDL_windowsrawinput.c @@ -193,11 +193,10 @@ static bool WIN_UpdateRawInputEnabled(SDL_VideoDevice *_this) { SDL_VideoData *data = _this->internal; Uint32 flags = 0; - const bool ENABLE_RAW_INPUT_EVENTS = true; - if (data->raw_mouse_enabled || ENABLE_RAW_INPUT_EVENTS) { + if (data->raw_mouse_enabled) { flags |= ENABLE_RAW_MOUSE_INPUT; } - if (data->raw_keyboard_enabled || ENABLE_RAW_INPUT_EVENTS) { + if (data->raw_keyboard_enabled) { flags |= ENABLE_RAW_KEYBOARD_INPUT; } if (flags != data->raw_input_enabled) { diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 5f60d993ab..41a05f04ee 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -920,10 +920,6 @@ void X11_HandleButtonPress(SDL_VideoDevice *_this, SDL_WindowData *windowdata, S } if (X11_IsWheelEvent(display, button, &xticks, &yticks)) { - if (mouseID != SDL_GLOBAL_MOUSE_ID) { - const float scale = 1.0f; - SDL_SendRawMouseWheel(timestamp, mouseID, -xticks, yticks, scale, scale); - } SDL_SendMouseWheel(timestamp, window, mouseID, (float)-xticks, (float)yticks, SDL_MOUSEWHEEL_NORMAL); } else { bool ignore_click = false; @@ -932,9 +928,6 @@ void X11_HandleButtonPress(SDL_VideoDevice *_this, SDL_WindowData *windowdata, S => subtract (8-SDL_BUTTON_X1) to get value SDL expects */ button -= (8 - SDL_BUTTON_X1); } - if (mouseID != SDL_GLOBAL_MOUSE_ID) { - SDL_SendRawMouseButton(timestamp, mouseID, button, true); - } if (button == Button1) { if (X11_TriggerHitTestAction(_this, windowdata, x, y)) { SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_HIT_TEST, 0, 0); @@ -972,9 +965,6 @@ void X11_HandleButtonRelease(SDL_VideoDevice *_this, SDL_WindowData *windowdata, // see explanation at case ButtonPress button -= (8 - SDL_BUTTON_X1); } - if (mouseID != SDL_GLOBAL_MOUSE_ID) { - SDL_SendRawMouseButton(timestamp, mouseID, button, false); - } SDL_SendMouseButton(timestamp, window, mouseID, button, false); } } diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c index 7f35bb4c93..214a5c01b2 100644 --- a/src/video/x11/SDL_x11xinput2.c +++ b/src/video/x11/SDL_x11xinput2.c @@ -342,11 +342,6 @@ void X11_HandleXinput2Event(SDL_VideoDevice *_this, XGenericEventCookie *cookie) } } - // FIXME: Are the processed_coords always integral values? - // FIXME: Apply desktop mouse scale? - const float scale = 1.0f; - SDL_SendRawMouseMotion(timestamp, (SDL_MouseID)rawev->sourceid, (int)processed_coords[0], (int)processed_coords[1], scale, scale); - // Relative mouse motion is delivered to the window with keyboard focus if (mouse->relative_mode && SDL_GetKeyboardFocus()) { SDL_SendMouseMotion(timestamp, mouse->focus, (SDL_MouseID)rawev->sourceid, true, (float)processed_coords[0], (float)processed_coords[1]); diff --git a/test/testrelative.c b/test/testrelative.c index cdc80f24ac..545303dcf9 100644 --- a/test/testrelative.c +++ b/test/testrelative.c @@ -25,7 +25,6 @@ static int i, done; static SDL_FRect rect; static SDL_Event event; static bool warp; -static bool raw; static void DrawRects(SDL_Renderer *renderer) { @@ -94,20 +93,13 @@ static void loop(void) break; case SDL_EVENT_MOUSE_MOTION: { - if (!raw) { - rect.x += event.motion.xrel; - rect.y += event.motion.yrel; + rect.x += event.motion.xrel; + rect.y += event.motion.yrel; - if (warp) { - CenterMouse(); - } + if (warp) { + CenterMouse(); } } break; - case SDL_EVENT_RAW_MOUSE_MOTION: - { - rect.x += event.raw_motion.dx * event.raw_motion.scale_x; - rect.y += event.raw_motion.dy * event.raw_motion.scale_y; - } break; default: break; } @@ -167,16 +159,12 @@ int main(int argc, char *argv[]) if (SDL_strcasecmp(argv[i], "--warp") == 0) { warp = true; consumed = 1; - } else if (SDL_strcasecmp(argv[i], "--raw") == 0) { - raw = true; - consumed = 1; } } if (consumed < 0) { static const char *options[] = { "[--warp]", - "[--raw]", NULL }; SDLTest_CommonLogUsage(state, argv[0], options); @@ -212,8 +200,6 @@ int main(int argc, char *argv[]) } } - SDL_SetEventEnabled(SDL_EVENT_RAW_MOUSE_MOTION, raw); - rect.x = DEFAULT_WINDOW_WIDTH / 2; rect.y = DEFAULT_WINDOW_HEIGHT / 2; rect.w = 10;