diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2021-02-16 14:48:13 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2021-02-17 14:18:02 +1000 |
commit | 20c78f38a0b33b88bc82a2bcd54d2e6c74a4c132 (patch) | |
tree | 18b38e24141c6a38dd87686023dc303de9b63e06 | |
parent | dee2bb033e78e2f4aae7f5708c3d4fc74a9957de (diff) |
xwayland: use get_pointer_device() for enter/leave handling too
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.
Fixes a regression introduced in a4095162ca923992a8cfae6d0f09ff9f8144762a.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
-rw-r--r-- | hw/xwayland/xwayland-input.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index 9529720a6..9b7421059 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -92,6 +92,15 @@ xwl_pointer_control(DeviceIntPtr device, PtrCtrl *ctrl) /* Nothing to do, dix handles all settings */ } +static DeviceIntPtr +get_pointer_device(struct xwl_seat *xwl_seat) +{ + if (xwl_seat->relative_pointer) + return xwl_seat->relative_pointer; + else + return xwl_seat->pointer; +} + static Bool init_pointer_buttons(DeviceIntPtr device) { @@ -400,7 +409,7 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer, wl_fixed_t sx_w, wl_fixed_t sy_w) { struct xwl_seat *xwl_seat = data; - DeviceIntPtr dev = xwl_seat->pointer; + DeviceIntPtr dev = get_pointer_device(xwl_seat); DeviceIntPtr master; int i; int sx = wl_fixed_to_int(sx_w); @@ -475,7 +484,7 @@ pointer_handle_leave(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface) { struct xwl_seat *xwl_seat = data; - DeviceIntPtr dev = xwl_seat->pointer; + DeviceIntPtr dev = get_pointer_device(xwl_seat); xwl_seat->xwl_screen->serial = serial; @@ -595,15 +604,6 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer, dispatch_pointer_motion_event(xwl_seat); } -static DeviceIntPtr -get_pointer_device(struct xwl_seat *xwl_seat) -{ - if (xwl_seat->relative_pointer) - return xwl_seat->relative_pointer; - else - 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) |