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 734b2d6907
)
This commit is contained in:
parent
fb01b238c6
commit
c26a47b4f2
@ -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_tablet_tool *xwl_tablet_tool = data;
|
||||||
struct xwl_seat *xwl_seat = xwl_tablet_tool->seat;
|
struct xwl_seat *xwl_seat = xwl_tablet_tool->seat;
|
||||||
int32_t dx, dy;
|
int32_t dx, dy;
|
||||||
int sx = wl_fixed_to_int(x);
|
double sx = wl_fixed_to_double(x);
|
||||||
int sy = wl_fixed_to_int(y);
|
double sy = wl_fixed_to_double(y);
|
||||||
|
|
||||||
if (!xwl_seat->tablet_focus_window)
|
if (!xwl_seat->tablet_focus_window)
|
||||||
return;
|
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;
|
dx = xwl_seat->tablet_focus_window->window->drawable.x;
|
||||||
dy = xwl_seat->tablet_focus_window->window->drawable.y;
|
dy = xwl_seat->tablet_focus_window->window->drawable.y;
|
||||||
|
|
||||||
xwl_tablet_tool->x = dx + sx;
|
xwl_tablet_tool->x = (double) dx + sx;
|
||||||
xwl_tablet_tool->y = dy + sy;
|
xwl_tablet_tool->y = (double) dy + sy;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1772,15 +1772,15 @@ tablet_tool_frame(void *data, struct zwp_tablet_tool_v2 *tool, uint32_t time)
|
|||||||
int button;
|
int button;
|
||||||
|
|
||||||
valuator_mask_zero(&mask);
|
valuator_mask_zero(&mask);
|
||||||
valuator_mask_set(&mask, 0, xwl_tablet_tool->x);
|
valuator_mask_set_double(&mask, 0, xwl_tablet_tool->x);
|
||||||
valuator_mask_set(&mask, 1, xwl_tablet_tool->y);
|
valuator_mask_set_double(&mask, 1, xwl_tablet_tool->y);
|
||||||
valuator_mask_set(&mask, 2, xwl_tablet_tool->pressure);
|
valuator_mask_set(&mask, 2, xwl_tablet_tool->pressure);
|
||||||
valuator_mask_set(&mask, 3, xwl_tablet_tool->tilt_x);
|
valuator_mask_set_double(&mask, 3, xwl_tablet_tool->tilt_x);
|
||||||
valuator_mask_set(&mask, 4, xwl_tablet_tool->tilt_y);
|
valuator_mask_set_double(&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, 5, xwl_tablet_tool->rotation + xwl_tablet_tool->slider);
|
||||||
|
|
||||||
QueuePointerEvents(xwl_tablet_tool->xdevice, MotionNotify, 0,
|
QueuePointerEvents(xwl_tablet_tool->xdevice, MotionNotify, 0,
|
||||||
POINTER_ABSOLUTE | POINTER_SCREEN, &mask);
|
POINTER_ABSOLUTE | POINTER_DESKTOP, &mask);
|
||||||
|
|
||||||
valuator_mask_zero(&mask);
|
valuator_mask_zero(&mask);
|
||||||
|
|
||||||
|
@ -311,13 +311,13 @@ struct xwl_tablet_tool {
|
|||||||
|
|
||||||
DeviceIntPtr xdevice;
|
DeviceIntPtr xdevice;
|
||||||
uint32_t proximity_in_serial;
|
uint32_t proximity_in_serial;
|
||||||
uint32_t x;
|
double x;
|
||||||
uint32_t y;
|
double y;
|
||||||
uint32_t pressure;
|
uint32_t pressure;
|
||||||
float tilt_x;
|
double tilt_x;
|
||||||
float tilt_y;
|
double tilt_y;
|
||||||
float rotation;
|
double rotation;
|
||||||
float slider;
|
double slider;
|
||||||
|
|
||||||
uint32_t buttons_now,
|
uint32_t buttons_now,
|
||||||
buttons_prev;
|
buttons_prev;
|
||||||
|
Loading…
Reference in New Issue
Block a user