From: Etaash Mathamsetty etaash.mathamsetty@gmail.com
--- dlls/winewayland.drv/wayland_pointer.c | 35 ++++++++++++++++++++------ 1 file changed, 28 insertions(+), 7 deletions(-)
diff --git a/dlls/winewayland.drv/wayland_pointer.c b/dlls/winewayland.drv/wayland_pointer.c index 6c852292c1d..e4af78f0396 100644 --- a/dlls/winewayland.drv/wayland_pointer.c +++ b/dlls/winewayland.drv/wayland_pointer.c @@ -257,6 +257,19 @@ static const struct wl_pointer_listener pointer_listener = pointer_handle_axis_discrete };
+/********************************************************************** + * wayland_motion_delta_to_window + * + * Converts the surface-local delta to window (logical) coordinate delta. + */ +static void wayland_motion_delta_to_window(struct wayland_surface *surface, + double surface_x, double surface_y, + double *window_x, double *window_y) +{ + *window_x = surface_x * surface->window.scale; + *window_y = surface_y * surface->window.scale; +} + static void relative_pointer_v1_relative_motion(void *private, struct zwp_relative_pointer_v1 *zwp_relative_pointer_v1, uint32_t utime_hi, uint32_t utime_lo, @@ -265,28 +278,36 @@ static void relative_pointer_v1_relative_motion(void *private, { INPUT input = {0}; HWND hwnd; - POINT screen; + struct { + double x; + double y; + } screen = {0.0}; struct wayland_win_data *data; + static double dx_accum = 0, dy_accum = 0;
if (!(hwnd = wayland_pointer_get_focused_hwnd())) return; if (!(data = wayland_win_data_get(hwnd))) return;
- wayland_surface_coords_to_window(data->wayland_surface, + wayland_motion_delta_to_window(data->wayland_surface, wl_fixed_to_double(dx), wl_fixed_to_double(dy), - (int *)&screen.x, (int *)&screen.y); - + &screen.x, &screen.y); wayland_win_data_release(data);
+ dx_accum += screen.x; + dy_accum += screen.y;
input.type = INPUT_MOUSE; - input.mi.dx = screen.x; - input.mi.dy = screen.y; + input.mi.dx = (int)dx_accum; + input.mi.dy = (int)dy_accum; input.mi.dwFlags = MOUSEEVENTF_MOVE;
TRACE("hwnd=%p wayland_dxdy=%.2f,%.2f screen_dxdy=%d,%d\n", hwnd, wl_fixed_to_double(dx), wl_fixed_to_double(dy), - (int)screen.x, (int)screen.y); + (int)dx_accum, (int)dy_accum); + + dx_accum -= input.mi.dx; + dy_accum -= input.mi.dy;
NtUserSendHardwareInput(hwnd, 0, &input, 0); }