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 <ofourdan@redhat.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/962
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Olivier Fourdan 2020-03-24 16:12:38 +01:00
parent a5151f58cf
commit 5929b789f9
1 changed files with 3 additions and 0 deletions

View File

@ -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);