From 5929b789f9c6531ee257504a7be9c9e3a49b30eb Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Tue, 24 Mar 2020 16:12:38 +0100 Subject: [PATCH] xwayland: Do not lock the pointer on the wrong window If a client issues a grab on the pointer while the cursor is on another X11 window, and then hides the cursor, we may end up locking the pointer onto that other window. Then a button click might end up moving the focus away from the window which issued the grab, leaving the whole setup in a mixed up state. Typically, if the pointer is on another X11 window, we should not try to lock the pointer, so that it can be moved back to the window which actually issues the grab (and hence the pointer confinement). Typically, this is the same as an X11 client issuing a pointer grab while the cursor is on another Wayland native window. Signed-off-by: Olivier Fourdan Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/962 Reviewed-by: Carlos Garnacho Reviewed-by: Peter Hutterer --- hw/xwayland/xwayland-input.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index ba7c6631f..9b3a24430 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -2817,6 +2817,9 @@ xwl_seat_maybe_lock_on_hidden_cursor(struct xwl_seat *xwl_seat) if (!xwl_seat->focus_window) return FALSE; + if (xwl_seat->cursor_confinement_window != xwl_seat->focus_window) + return FALSE; + if (xwl_seat->confined_pointer) xwl_seat_destroy_confined_pointer(xwl_seat);