diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2023-11-28 14:26:31 +0100 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2024-03-20 09:05:36 +0100 |
commit | d7f31fe8878676e4840f37627106085fd9397735 (patch) | |
tree | b8d3711f5c8db8339ee0661a7cb53830f8072b8e /hw/xwayland | |
parent | 3ea36e521426aaba37f3d00de3b57805cc71243e (diff) |
xwayland: Apply the viewport's scale_x/y to all input
The viewport's scale_x/y is currently applied to the motion event only.
Apply the same viewport_scale_x/y to all relevant input coordinates.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-By: Kenny Levinsen <kl@kl.wtf>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1197>
Diffstat (limited to 'hw/xwayland')
-rw-r--r-- | hw/xwayland/xwayland-input.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index fcf3ee91e..3c546057d 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -641,6 +641,11 @@ dispatch_relative_motion_with_warp(struct xwl_seat *xwl_seat) dx_unaccel *= xwl_screen->global_surface_scale; dy_unaccel *= xwl_screen->global_surface_scale; + dx *= xwl_seat->focus_window->viewport_scale_x; + dy *= xwl_seat->focus_window->viewport_scale_y; + dx_unaccel *= xwl_seat->focus_window->viewport_scale_x; + dy_unaccel *= xwl_seat->focus_window->viewport_scale_y; + xwl_pointer_warp_emulator_handle_motion(xwl_seat->pointer_warp_emulator, dx, dy, dx_unaccel, dy_unaccel); @@ -699,6 +704,11 @@ dispatch_relative_motion(struct xwl_seat *xwl_seat) event_dx_unaccel *= xwl_screen->global_surface_scale; event_dy_unaccel *= xwl_screen->global_surface_scale; + event_dx *= xwl_seat->focus_window->viewport_scale_x; + event_dy *= xwl_seat->focus_window->viewport_scale_y; + event_dx_unaccel *= xwl_seat->focus_window->viewport_scale_x; + event_dy_unaccel *= xwl_seat->focus_window->viewport_scale_y; + valuator_mask_zero(&mask); valuator_mask_set_unaccelerated(&mask, 0, event_dx, event_dx_unaccel); valuator_mask_set_unaccelerated(&mask, 1, event_dy, event_dy_unaccel); @@ -972,13 +982,9 @@ pointer_gesture_swipe_handle_update(void *data, wl_fixed_t dyf) { struct xwl_seat *xwl_seat = data; - struct xwl_screen *xwl_screen = xwl_seat->xwl_screen; double dx = wl_fixed_to_double(dxf); double dy = wl_fixed_to_double(dyf); - dx *= xwl_screen->global_surface_scale; - dy *= xwl_screen->global_surface_scale; - QueueGestureSwipeEvents(xwl_seat->pointer_gestures, XI_GestureSwipeUpdate, xwl_seat->pointer_gesture_swipe_fingers, @@ -1042,14 +1048,10 @@ pointer_gesture_pinch_handle_update(void *data, wl_fixed_t rotation) { struct xwl_seat *xwl_seat = data; - struct xwl_screen *xwl_screen = xwl_seat->xwl_screen; double dx = wl_fixed_to_double(dxf); double dy = wl_fixed_to_double(dyf); double scale = wl_fixed_to_double(scalef); - dx *= xwl_screen->global_surface_scale; - dy *= xwl_screen->global_surface_scale; - xwl_seat->pointer_gesture_pinch_last_scale = scale; QueueGesturePinchEvents(xwl_seat->pointer_gestures, XI_GesturePinchUpdate, @@ -1452,6 +1454,9 @@ touch_handle_down(void *data, struct wl_touch *wl_touch, xwl_touch->x *= xwl_screen->global_surface_scale; xwl_touch->y *= xwl_screen->global_surface_scale; + xwl_touch->x *= xwl_touch->window->viewport_scale_x; + xwl_touch->y *= xwl_touch->window->viewport_scale_y; + xwl_touch_send_event(xwl_touch, xwl_seat, XI_TouchBegin); } @@ -1492,6 +1497,9 @@ touch_handle_motion(void *data, struct wl_touch *wl_touch, xwl_touch->x *= xwl_screen->global_surface_scale; xwl_touch->y *= xwl_screen->global_surface_scale; + xwl_touch->x *= xwl_touch->window->viewport_scale_x; + xwl_touch->y *= xwl_touch->window->viewport_scale_y; + xwl_touch_send_event(xwl_touch, xwl_seat, XI_TouchUpdate); } @@ -2191,6 +2199,9 @@ tablet_tool_motion(void *data, struct zwp_tablet_tool_v2 *tool, sx *= xwl_screen->global_surface_scale; sy *= xwl_screen->global_surface_scale; + sx *= xwl_seat->tablet_focus_window->viewport_scale_x; + sy *= xwl_seat->tablet_focus_window->viewport_scale_y; + dx = xwl_seat->tablet_focus_window->window->drawable.x; dy = xwl_seat->tablet_focus_window->window->drawable.y; @@ -2234,6 +2245,9 @@ tablet_tool_tilt(void *data, struct zwp_tablet_tool_v2 *tool, xwl_tablet_tool->tilt_x *= xwl_screen->global_surface_scale; xwl_tablet_tool->tilt_y *= xwl_screen->global_surface_scale; + + xwl_tablet_tool->tilt_x *= xwl_seat->tablet_focus_window->viewport_scale_x; + xwl_tablet_tool->tilt_y *= xwl_seat->tablet_focus_window->viewport_scale_y; } static void |