diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2018-09-20 16:32:29 +0200 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2018-10-04 17:27:08 +0200 |
commit | c26a47b4f2e170e283ca1683d5b6ca2d04823e80 (patch) | |
tree | b5e97cf76ca92184686f893802e235523d935159 | |
parent | fb01b238c610e1955457dd9878d75b2c34c9a0c6 (diff) |
xwayland: Use `double` for `xwl_tablet_tool`
So we do not lose subpixel precision in Xwayland.
Suggested-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/libinput/libinput/issues/138
(cherry picked from commit 734b2d6907f730571a2805cbc53fe7056190f19e)
-rw-r--r-- | hw/xwayland/xwayland-input.c | 20 | ||||
-rw-r--r-- | hw/xwayland/xwayland.h | 12 |
2 files changed, 16 insertions, 16 deletions
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index c220ca2aa..fbbcb39cc 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -1604,8 +1604,8 @@ tablet_tool_motion(void *data, struct zwp_tablet_tool_v2 *tool, struct xwl_tablet_tool *xwl_tablet_tool = data; struct xwl_seat *xwl_seat = xwl_tablet_tool->seat; int32_t dx, dy; - int sx = wl_fixed_to_int(x); - int sy = wl_fixed_to_int(y); + double sx = wl_fixed_to_double(x); + double sy = wl_fixed_to_double(y); if (!xwl_seat->tablet_focus_window) return; @@ -1613,8 +1613,8 @@ tablet_tool_motion(void *data, struct zwp_tablet_tool_v2 *tool, dx = xwl_seat->tablet_focus_window->window->drawable.x; dy = xwl_seat->tablet_focus_window->window->drawable.y; - xwl_tablet_tool->x = dx + sx; - xwl_tablet_tool->y = dy + sy; + xwl_tablet_tool->x = (double) dx + sx; + xwl_tablet_tool->y = (double) dy + sy; } static void @@ -1772,15 +1772,15 @@ tablet_tool_frame(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t time) int button; valuator_mask_zero(&mask); - valuator_mask_set(&mask, 0, xwl_tablet_tool->x); - valuator_mask_set(&mask, 1, xwl_tablet_tool->y); + valuator_mask_set_double(&mask, 0, xwl_tablet_tool->x); + valuator_mask_set_double(&mask, 1, xwl_tablet_tool->y); valuator_mask_set(&mask, 2, xwl_tablet_tool->pressure); - valuator_mask_set(&mask, 3, xwl_tablet_tool->tilt_x); - valuator_mask_set(&mask, 4, xwl_tablet_tool->tilt_y); - valuator_mask_set(&mask, 5, xwl_tablet_tool->rotation + xwl_tablet_tool->slider); + valuator_mask_set_double(&mask, 3, xwl_tablet_tool->tilt_x); + valuator_mask_set_double(&mask, 4, xwl_tablet_tool->tilt_y); + valuator_mask_set_double(&mask, 5, xwl_tablet_tool->rotation + xwl_tablet_tool->slider); QueuePointerEvents(xwl_tablet_tool->xdevice, MotionNotify, 0, - POINTER_ABSOLUTE | POINTER_SCREEN, &mask); + POINTER_ABSOLUTE | POINTER_DESKTOP, &mask); valuator_mask_zero(&mask); diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h index 1a6e2f380..67819e178 100644 --- a/hw/xwayland/xwayland.h +++ b/hw/xwayland/xwayland.h @@ -311,13 +311,13 @@ struct xwl_tablet_tool { DeviceIntPtr xdevice; uint32_t proximity_in_serial; - uint32_t x; - uint32_t y; + double x; + double y; uint32_t pressure; - float tilt_x; - float tilt_y; - float rotation; - float slider; + double tilt_x; + double tilt_y; + double rotation; + double slider; uint32_t buttons_now, buttons_prev; |