mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 11:28:15 +00:00
wayland: Scale accelerated relative pointer coordinates with emulated resolutions
The accelerated relative coordinates are always relative to the desktop resolution, and need to be scaled with emulated fullscreen resolutions for mouse movement to remain stable. Otherwise, pointer speeds will be too fast on emulated resolutions below the desktop resolution, and too slow on those above.
(cherry picked from commit 027df89ed3
)
This commit is contained in:
@@ -1023,8 +1023,8 @@ static void relative_pointer_handle_relative_motion(void *data,
|
|||||||
dx = wl_fixed_to_double(dx_unaccel_w);
|
dx = wl_fixed_to_double(dx_unaccel_w);
|
||||||
dy = wl_fixed_to_double(dy_unaccel_w);
|
dy = wl_fixed_to_double(dy_unaccel_w);
|
||||||
} else {
|
} else {
|
||||||
dx = wl_fixed_to_double(dx_w);
|
dx = wl_fixed_to_double(dx_w) * window->pointer_scale.x;
|
||||||
dy = wl_fixed_to_double(dy_w);
|
dy = wl_fixed_to_double(dy_w) * window->pointer_scale.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SendMouseMotion(timestamp, window->sdlwindow, input->pointer_id, true, (float)dx, (float)dy);
|
SDL_SendMouseMotion(timestamp, window->sdlwindow, input->pointer_id, true, (float)dx, (float)dy);
|
||||||
|
Reference in New Issue
Block a user