mirror of https://github.com/encounter/SDL.git
video: Wayland: Always round scaled pointer coordinates down
Rounding up can cause the pointer coordinates to exceed the window boundaries at the right and bottom edges.
This commit is contained in:
parent
13393a1c4b
commit
edb473cf46
|
@ -391,8 +391,8 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
|
|||
if (input->pointer_focus) {
|
||||
const float sx_f = (float)wl_fixed_to_double(sx_w);
|
||||
const float sy_f = (float)wl_fixed_to_double(sy_w);
|
||||
const int sx = (int)SDL_lroundf(sx_f * window->pointer_scale_x);
|
||||
const int sy = (int)SDL_lroundf(sy_f * window->pointer_scale_y);
|
||||
const int sx = (int)SDL_floorf(sx_f * window->pointer_scale_x);
|
||||
const int sy = (int)SDL_floorf(sy_f * window->pointer_scale_y);
|
||||
SDL_SendMouseMotion(window->sdlwindow, 0, 0, sx, sy);
|
||||
}
|
||||
}
|
||||
|
@ -1826,8 +1826,8 @@ tablet_tool_handle_motion(void* data, struct zwp_tablet_tool_v2* tool, wl_fixed_
|
|||
if (input->tool_focus) {
|
||||
const float sx_f = (float)wl_fixed_to_double(sx_w);
|
||||
const float sy_f = (float)wl_fixed_to_double(sy_w);
|
||||
const int sx = (int)SDL_lroundf(sx_f * window->pointer_scale_x);
|
||||
const int sy = (int)SDL_lroundf(sy_f * window->pointer_scale_y);
|
||||
const int sx = (int)SDL_floorf(sx_f * window->pointer_scale_x);
|
||||
const int sy = (int)SDL_floorf(sy_f * window->pointer_scale_y);
|
||||
SDL_SendMouseMotion(window->sdlwindow, 0, 0, sx, sy);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue