[Git][xorg-team/wayland/xwayland][upstream-unstable] 5 commits: Revert "xwayland: Do not pretend leaving the X11 surface if buttons are down"

"Timo Aaltonen (@tjaalton)" <[email protected]>
Newsgroups gmane.linux.debian.devel.x
Message-ID <[email protected]>

Timo Aaltonen pushed to branch upstream-unstable at X Strike Force / wayland / xwayland


Commits:
03228e00 by Olivier Fourdan at 2026-04-16T17:10:31+02:00
Revert "xwayland: Do not pretend leaving the X11 surface if buttons are down"

Kwin may send button events to Xwayland even when there is no Xwayland
surface with input focus.

With this change applied, that causes spurious input focus changes.

Let's revert it for the stable Xwayland branch for now.

This reverts commit d7745cca00bbd5a10664a1e2dcabbd0ee2fb1934.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/work_items/1883
Signed-off-by: Olivier Fourdan <[email protected]>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2179>

- - - - -
0ca92fb4 by Olivier Fourdan at 2026-04-21T10:06:21+02:00
xwayland: Do not use pointer crossing count for slave devices

Commit 0e08e5083 ("xwayland: prevent X11 get enter event when pointer is
over Wayland client") introduced a pointer crossing count to avoid
sending spurious pointer enter events when the pointer is within a
Wayland native surface.

However, that change breaks tablet devices, as the pointer enter count
is only updated from the wl_pointer enter/leave events, a slave X11
device such as a tablet pointer would report a lost focus and the event
wrongly sent to the root window.

To avoid the issue, revert partially commit 0e08e5083 to return FALSE
as before for the slave devices. The rest of the logic from commit
0e08e5083 remains unchanged, so that we do not send spurious
XCrossingEvents for the pointer device when it's within a native Wayland
surface.

Signed-off-by: Olivier Fourdan <[email protected]>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/work_items/1884
(cherry picked from commit c39b1591b20a2373abf53a3ad178c14c4203f72c)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2179>

- - - - -
e7514641 by Michel Dänzer at 2026-04-21T11:58:00+00:00
xwayland: Handle GetCurrentClient returning NULL in xwl_reparent_window

It's not the WM client in that case.

Fixes crash.

Closes: https://gitlab.freedesktop.org/xorg/xserver/-/work_items/1885
Fixes: 6aacf04f51cf ("xwayland: Add heuristic for WM windows based on reparenting")
(cherry picked from commit 6357c9afce656cdc250a8475eaa86647d0d6e501)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2189>

- - - - -
d346a6de by Olivier Fourdan at 2026-04-24T09:44:33+02:00
xwayland: Avoid NULL pointer dereference in damage_report()

Commit 34934c37d6a restored calling register_damage() in
xwl_realize_window() before ensure_surface_for_window().

However if register_damage() succeeds and ensure_surface_for_window()
returns NULL, it would exit without "unregistering" the damage hook.

The X11 window, however, may still get damages reports, in which case
xwl_window_from_window() would return NULL, causing a NULL pointer
dereference in damage_report().

To avoid the issue, make sure we unregister the damage report if
ensure_surface_for_window() has failed, and add an early exit in
damage_report() if xwl_window is NULL.

v2: unregister_damage() unconditionally if ensure_surface_for_window()
    failed (Michel Dänzer)

Fixes: commit 34934c37d6a ("revert: register damage before ensure_surface_for_window")
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/work_items/1886
Signed-off-by: Olivier Fourdan <[email protected]>
(cherry picked from commit 36f53145e415bbc959cdf2ed8bb0cb4f7c4c1f13)

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2191>

- - - - -
a0241c1d by Olivier Fourdan at 2026-04-27T09:25:48+02:00
Bump version to 24.1.11

Signed-off-by: Olivier Fourdan <[email protected]>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2193>

- - - - -


3 changed files:

- hw/xwayland/xwayland-input.c
- hw/xwayland/xwayland-window.c
- meson.build


Changes:

=====================================
hw/xwayland/xwayland-input.c
=====================================
@@ -3214,22 +3214,13 @@ sprite_check_lost_focus(SpritePtr sprite, WindowPtr window)
     pointer_crossing = (xwl_seat->pointer_enter_count > 0);
     master = GetMaster(device, POINTER_OR_FLOAT);
     if (!master || !master->lastSlave)
-        return !pointer_crossing;
+        return FALSE;
 
     /* We do want the last active slave, we only check on slave xwayland
      * 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 != get_pointer_device(xwl_seat))
-        return !pointer_crossing;
-
-    /* If we left the surface with a button down, it means the wayland compositor
-     * has grabbed the pointer so we will not get button release events from the
-     * compositor, so leave the window processing untouched, so that we do not
-     * end up with the wrong cursor, for example, when processing events once
-     * the pointer enters the X11 surface again.
-     */
-    if (master->button->buttonsDown)
         return FALSE;
 
     if (xwl_seat->focus_window != NULL &&


=====================================
hw/xwayland/xwayland-window.c
=====================================
@@ -301,8 +301,10 @@ damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data)
     struct xwl_screen *xwl_screen = xwl_screen_get(screen);
     PixmapPtr window_pixmap;
 
-    if (xwl_window &&
-        xwl_window->surface_window_damage &&
+    if (!xwl_window)
+        return;
+
+    if (xwl_window->surface_window_damage &&
         RegionNotEmpty(pRegion)) {
         if (!RegionNotEmpty(xwl_window->surface_window_damage))
             need_source_validate_inc(xwl_screen);
@@ -315,7 +317,7 @@ damage_report(DamagePtr pDamage, RegionPtr pRegion, void *data)
     if (xwl_screen->ignore_damage)
         return;
 
-    if (xwl_window && xorg_list_is_empty(&xwl_window->link_damage))
+    if (xorg_list_is_empty(&xwl_window->link_damage))
         xorg_list_add(&xwl_window->link_damage, &xwl_screen->damage_window_list);
 
     window_pixmap = screen->GetWindowPixmap(xwl_window->surface_window);
@@ -1603,8 +1605,10 @@ xwl_realize_window(WindowPtr window)
     }
 
     xwl_window = ensure_surface_for_window(window);
-    if (!xwl_window)
+    if (!xwl_window) {
+        unregister_damage(window);
         return FALSE;
+    }
 
     return TRUE;
 }
@@ -1878,6 +1882,7 @@ xwl_reparent_window(WindowPtr window, WindowPtr prior_parent)
     ScreenPtr screen = window->drawable.pScreen;
     struct xwl_screen *xwl_screen = xwl_screen_get(screen);
     WindowPtr parent = window->parent;
+    ClientPtr current_client;
     Bool *is_wm_window;
 
     if (xwl_screen->ReparentWindow) {
@@ -1887,8 +1892,10 @@ xwl_reparent_window(WindowPtr window, WindowPtr prior_parent)
         screen->ReparentWindow = xwl_reparent_window;
     }
 
+    current_client = GetCurrentClient();
     if (!parent->parent ||
-        GetCurrentClient()->index != xwl_screen->wm_client_id)
+        !current_client ||
+        current_client->index != xwl_screen->wm_client_id)
         return;
 
     /* If the WM client reparents a window, mark the new parent as a WM window */


=====================================
meson.build
=====================================
@@ -3,10 +3,10 @@ project('xwayland', 'c',
             'buildtype=debugoptimized',
             'c_std=gnu99',
         ],
-        version: '24.1.10',
+        version: '24.1.11',
         meson_version: '>= 0.56.0',
 )
-release_date = '2026-04-14'
+release_date = '2026-04-27'
 
 add_project_arguments('-DHAVE_DIX_CONFIG_H', language: ['c', 'objc'])
 cc = meson.get_compiler('c')



View it on GitLab: https://salsa.debian.org/xorg-team/wayland/xwayland/-/compare/5a873951579f1ff894f71489f3651a55d6dde250...a0241c1d38297a800d2aae3d8ca7213b7b873879

-- 
View it on GitLab: https://salsa.debian.org/xorg-team/wayland/xwayland/-/compare/5a873951579f1ff894f71489f3651a55d6dde250...a0241c1d38297a800d2aae3d8ca7213b7b873879
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.