xwayland: Use relative device for buttons/axis/enter/leave

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
events.

However, routing just the buttons and axis events is not sufficient. In
Weston, clicking the window decoration of an Xwayland client gives us a
wl_pointer.button event immediately followed by a wl_pointer.leave event.
The leave event does not contain any button state information, so the button
remains logically down in the DIX.

Once the pointer button is released, a wl_pointer.enter event is sent with
the current button state (zero). This needs to trigger a ButtonRelease event
but for that we need to ensure that the device is the same as the one we send
ButtonPress events through.

Route those events along with enter/leave 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 <peter.hutterer@who-t.net>
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
Related: xorg/xserver#1130
(cherry picked from commit a4095162)
(cherry picked from commit 20c78f38)
3 jobs for xwayland-21.1-relative-motion-events in 1 minute and 32 seconds (queued for 2 seconds)
Status Job ID Name Coverage
  Docker Image
passed #7367006
debian-buster

00:00:08

 
  Build And Test
passed #7367007
meson

00:01:23

passed #7367008
meson-noglamor

00:01:10