xserver: Branch 'master'

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri May 16 10:07:11 UTC 2025


 hw/xwayland/xwayland-input.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

New commits:
commit b97b459c060b103aed1a0246ee87a46cc7e51f6c
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Wed Apr 16 10:16:17 2025 +0200

    xwayland: Update sprite prior to clearing the focus window
    
    Xwayland has its own XYToWindow() handler to account for the case when
    the pointer leaves an X11 surface to enter another Wayland native window
    (which of course are unknown to Xwayland).
    
    When that occurs, Xwayland will treat it as if the pointer had entered
    the root window so that the X11 clients receive an appropriate leave
    event.
    
    When the pointer leaves the X11 surface, Xwayland will call
    CheckMotion() to update the sprite coordinates and possibly the cursor.
    
    However, CheckMotion() will call back into the XYToWindow() handler,
    which will then pretend the window has entered the root window, and that
    may cause the wrong cursor to be applied.
    
    To avoid the issue, change the order we do things, by calling
    CheckMotion() first prior to clear up the internal focus window so that
    the first call to XYToWindow() will return the correct X11 window so we
    get to update the cursor correctly.
    
    Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1811
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1915>

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 35905829e..f7a8d2165 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -616,21 +616,19 @@ pointer_handle_leave(void *data, struct wl_pointer *pointer,
 {
     struct xwl_seat *xwl_seat = data;
     struct xwl_screen *xwl_screen = xwl_seat->xwl_screen;
-    Bool focus_lost = FALSE;
 
     xwl_screen->serial = serial;
 
+    if (xwl_screen->rootless)
+        xwl_seat_leave_ptr(xwl_seat, !!xwl_seat->focus_window);
+
     /* The pointer has left a known xwindow, save it for a possible match
      * in sprite_check_lost_focus()
      */
     if (xwl_seat->focus_window) {
         xwl_seat->last_focus_window = xwl_seat->focus_window;
         xwl_seat->focus_window = NULL;
-        focus_lost = TRUE;
     }
-
-    if (xwl_screen->rootless)
-        xwl_seat_leave_ptr(xwl_seat, focus_lost);
 }
 
 static void


More information about the xorg-commit mailing list