xserver: Branch 'master' - 4 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 13 09:19:25 UTC 2020


 hw/xwayland/xwayland-input.c |   23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

New commits:
commit f486e2fdaa1b252405a3aee90bd495b8b4c851f2
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Tue May 5 10:38:50 2020 +0200

    xwayland: Remove undeeded test
    
    xwl_seat_maybe_lock_on_hidden_cursor() checks that the value of
    cursor_confinement_window is not NULL, yet there is no code path
    that could lead to this.
    
    Remove the test for cursor_confinement_window being set, it's useless.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Carlos Garnacho <carlosg at gnome.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index fed78f70c..ff73c22f9 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -2823,8 +2823,7 @@ xwl_seat_maybe_lock_on_hidden_cursor(struct xwl_seat *xwl_seat)
      * to implement infinite panning (eg. 3D views), lock the
      * pointer for so the relative pointer is used.
      */
-    if (xwl_seat->x_cursor ||
-        !xwl_seat->cursor_confinement_window)
+    if (xwl_seat->x_cursor)
         return FALSE;
 
     if (!xwl_seat->focus_window)
commit baa8d12e464664b5ad3c591be05a0087482790ca
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Thu Apr 30 13:55:42 2020 +0200

    xwayland: Lock on entering surface if needed
    
    When an X11 client issues a ConfinePointer wit ha hidden cursor,
    Xwayland may translate that as a pointer lock.
    
    However, if the pointer is located on another window at the time,
    the request may be ignored, even if the pointer later enters the window.
    
    To avoid that issue, check again if locking the pointer with a hidden
    cursor is needed when pointer enters a surface.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Carlos Garnacho <carlosg at gnome.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 0ee84f6e3..fed78f70c 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -72,6 +72,9 @@ xwl_pointer_warp_emulator_maybe_lock(struct xwl_pointer_warp_emulator *warp_emul
                                      SpritePtr sprite,
                                      int x, int y);
 
+static Bool
+xwl_seat_maybe_lock_on_hidden_cursor(struct xwl_seat *xwl_seat);
+
 static void
 xwl_seat_destroy_confined_pointer(struct xwl_seat *xwl_seat);
 
@@ -447,6 +450,9 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
                                              xwl_seat->focus_window,
                                              NULL, 0, 0);
     }
+    else {
+        xwl_seat_maybe_lock_on_hidden_cursor(xwl_seat);
+    }
 }
 
 static void
commit 1345f804a88efc11c58f8388983d34445d3e5928
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Tue Mar 24 16:33:16 2020 +0100

    xwayland: confine motion events to the confined window
    
    When an X11 client has an active grab on the pointer, all events are
    reported relative to the window with the grab.
    
    For Xwayland, if an X11 client has a grab with a pointer confinement
    active, while pointer focus is on another window, motion events should
    not be reported to the client with the grab, because that sets the X11
    client appart, the events would be reported when the pointer is on any
    X11 window but not on Wayland native surfaces.
    
    Therefore, if the pointer is confined on a window and that window
    differs from the actual pointer focus window, just pretend we lost
    pointer focus to another window.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/962
    Reviewed-by: Carlos Garnacho <carlosg at gnome.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 9b3a24430..0ee84f6e3 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -2544,8 +2544,15 @@ sprite_check_lost_focus(SpritePtr sprite, WindowPtr window)
      * devices so we can find out the xwl_seat, but those don't actually own
      * their sprite, so the match doesn't mean a lot.
      */
-    if (master->lastSlave == xwl_seat->pointer &&
-        xwl_seat->focus_window == NULL &&
+    if (master->lastSlave != xwl_seat->pointer)
+        return FALSE;
+
+    if (xwl_seat->focus_window != NULL &&
+        xwl_seat->cursor_confinement_window != NULL &&
+        xwl_seat->focus_window != xwl_seat->cursor_confinement_window)
+        return TRUE;
+
+    if (xwl_seat->focus_window == NULL &&
         xwl_seat->last_xwindow != NullWindow &&
         IsParent(xwl_seat->last_xwindow, window))
         return TRUE;
commit 5929b789f9c6531ee257504a7be9c9e3a49b30eb
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Tue Mar 24 16:12:38 2020 +0100

    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 at redhat.com>
    Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/962
    Reviewed-by: Carlos Garnacho <carlosg at gnome.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

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


More information about the xorg-commit mailing list