[PATCH xserver] xwayland: Use `double` for `xwl_tablet_tool`
Olivier Fourdan
ofourdan at redhat.com
Fri Sep 21 13:39:56 UTC 2018
So we do not lose subpixel precision in Xwayland.
Suggested-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
Tested-by: Jean-Loup Tastet
Closes: https://gitlab.freedesktop.org/libinput/libinput/issues/138
---
MR: https://gitlab.freedesktop.org/xorg/xserver/merge_requests/21
hw/xwayland/xwayland-input.c | 20 ++++++++++----------
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 6fd3c416b..7f08b36e2 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;
--
2.19.0
More information about the xorg-devel
mailing list