Commit a4095162 authored by Olivier Fourdan's avatar Olivier Fourdan 🛠
Browse files

xwayland: Use relative device for buttons/axis

We are using the relative pointer for motion events, but buttons and
axis events still go through the absolute pointer device.

That means additional DeviceChanged events that could be avoided if the
buttons and axis events were coming from the same device as motion

Route those events to the relative pointer if available so that motion,
buttons and axis events come from the same device (most of the time).

Suggested-by: Peter Hutterer's avatarPeter Hutterer <>
Signed-off-by: Olivier Fourdan's avatarOlivier Fourdan <>
Reviewed-by: Peter Hutterer's avatarPeter Hutterer <>
Related: xorg/xserver#1130
parent 1abab61d
......@@ -591,6 +591,15 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
static DeviceIntPtr
get_pointer_device(struct xwl_seat *xwl_seat)
if (xwl_seat->relative_pointer)
return xwl_seat->relative_pointer;
return xwl_seat->pointer;
static void
pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial,
uint32_t time, uint32_t button, uint32_t state)
......@@ -619,7 +628,7 @@ pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial,
state ? ButtonPress : ButtonRelease, index, 0, &mask);
......@@ -661,7 +670,9 @@ pointer_handle_axis(void *data, struct wl_pointer *pointer,
} else {
valuator_mask_set_double(&mask, index, wl_fixed_to_double(value) / divisor);
QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0, POINTER_RELATIVE, &mask);
MotionNotify, 0, POINTER_RELATIVE, &mask);
static void
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment