diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 7696c5e15e..9d8b4baf52 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -3042,17 +3042,22 @@ static void relative_pointer_handle_relative_motion(void *data, struct SDL_WaylandInput *input = data; SDL_VideoData *d = input->display; SDL_WindowData *window = input->pointer_focus; - double dx_unaccel; - double dy_unaccel; + double dx; + double dy; // Relative pointer event times are in microsecond granularity. const Uint64 timestamp = SDL_US_TO_NS(((Uint64)time_hi << 32) | (Uint64)time_lo); - dx_unaccel = wl_fixed_to_double(dx_unaccel_w); - dy_unaccel = wl_fixed_to_double(dy_unaccel_w); + if (!SDL_GetMouse()->enable_relative_system_scale) { + dx = wl_fixed_to_double(dx_unaccel_w); + dy = wl_fixed_to_double(dy_unaccel_w); + } else { + dx = wl_fixed_to_double(dx_w); + dy = wl_fixed_to_double(dy_w); + } if (input->pointer_focus && d->relative_mouse_mode) { - SDL_SendMouseMotion(Wayland_GetEventTimestamp(timestamp), window->sdlwindow, input->pointer_id, true, (float)dx_unaccel, (float)dy_unaccel); + SDL_SendMouseMotion(Wayland_GetEventTimestamp(timestamp), window->sdlwindow, input->pointer_id, true, (float)dx, (float)dy); } }