mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-22 20:25:38 +00:00
Use the exact motion associated with the warp
When Windows DPI scaling is enabled, the warp coordinates will be modified, so make sure we send exactly the coordinates that the warp attempted. Fixes https://github.com/libsdl-org/SDL/issues/8940 (cherry picked from commit 8ce6fb25131912c7e83267bff03a5d1797545d5c)
This commit is contained in:
parent
5a492e8196
commit
5f98fcf00b
|
@ -282,6 +282,8 @@ static void WIN_WarpMouse(SDL_Window *window, int x, int y)
|
||||||
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
|
SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
|
||||||
HWND hwnd = data->hwnd;
|
HWND hwnd = data->hwnd;
|
||||||
POINT pt;
|
POINT pt;
|
||||||
|
int warp_x = x;
|
||||||
|
int warp_y = y;
|
||||||
|
|
||||||
/* Don't warp the mouse while we're doing a modal interaction */
|
/* Don't warp the mouse while we're doing a modal interaction */
|
||||||
if (data->in_title_click || data->focus_click_pending) {
|
if (data->in_title_click || data->focus_click_pending) {
|
||||||
|
@ -295,7 +297,7 @@ static void WIN_WarpMouse(SDL_Window *window, int x, int y)
|
||||||
WIN_SetCursorPos(pt.x, pt.y);
|
WIN_SetCursorPos(pt.x, pt.y);
|
||||||
|
|
||||||
/* Send the exact mouse motion associated with this warp */
|
/* Send the exact mouse motion associated with this warp */
|
||||||
SDL_SendMouseMotion(window, SDL_GetMouse()->mouseID, 0, x, y);
|
SDL_SendMouseMotion(window, SDL_GetMouse()->mouseID, 0, warp_x, warp_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int WIN_WarpMouseGlobal(int x, int y)
|
static int WIN_WarpMouseGlobal(int x, int y)
|
||||||
|
|
Loading…
Reference in a new issue