This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch wl/browser-all
in repository enlightenment.

View the commit online.

commit 157636bf5e1a324d9bf41eab865ee2b80c8413be
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Aug 12 15:15:53 2026 -0600

    wl_desktop_shell - get_xdg_surface has to check what it is handed
    
    E-23, which was filed as one bug and is four.
    
    The filed one was the error object: _e_xdg_shell_surface_buffer_attach_error
    posted XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER on the wl_surface rather than
    the xdg_surface, and wl_surface error 3 is invalid_offset, so a client that
    attached before configure was told its buffer offset was wrong - at
    wl_compositor v4, where a non-zero offset is legal. That one was already
    fixed. get_xdg_surface had its own copy of the same mistake, which was not.
    
    Three more came out of reading the tests around it:
    
     - No role check at all. A wl_surface that was already a subsurface, a
       wl_shell surface, or an xdg_surface asked for twice was accepted. The
       duplicate-xdg_surface case did complain, but as WL_DISPLAY_ERROR_INVALID_
       OBJECT rather than the role error the protocol names for it.
    
     - A buffer attached but not committed is invisible to e_pixmap_usable_get(),
       which only sees the committed case. A client that attached and had not yet
       committed walked straight past the check.
    
     - need_xdg_configure was armed when the role was created, not when the
       xdg_surface was. But the spec puts the debt on the xdg_surface - "attempts
       to attach or manipulate a buffer prior to the first xdg_surface.configure
       must be treated as errors" - so between get_xdg_surface and get_toplevel a
       client could attach and hear nothing back.
    
    Both surviving errors move to the xdg_wm_base, with ROLE and
    INVALID_SURFACE_STATE: what the client got wrong is the request it just made,
    not the wl_surface, and the wl_surface error codes number other things.
    
    wlcs, full suite, relaxed mode: 717 -> 724 passed, no regressions. Five of the
    seven are the XdgSurface tests this is about; the other two are known flakes
    (PointerConstraints reselection) that the base run happened to hit.
    
    Co-Authored-By: Claude Opus 5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_01FtoiXoSKUmZb6Aix6U3GZS
---
 src/modules/wl_desktop_shell/xdg.c  | 41 +++++++++++++++++++++++++------------
 src/modules/wl_desktop_shell/xdg6.c | 31 ++++++++++++++++------------
 src/tests/wlcs/tasks.txt            |  2 +-
 3 files changed, 47 insertions(+), 27 deletions(-)

diff --git a/src/modules/wl_desktop_shell/xdg.c b/src/modules/wl_desktop_shell/xdg.c
index 4df3e6c50..ddf7b4702 100644
--- a/src/modules/wl_desktop_shell/xdg.c
+++ b/src/modules/wl_desktop_shell/xdg.c
@@ -1532,25 +1532,34 @@ _e_xdg_shell_cb_surface_get(struct wl_client *client, struct wl_resource *resour
         return;
      }
    if (e_object_is_del(E_OBJECT(ec))) return;
-   if (e_pixmap_usable_get(ec->pixmap))
+   cdata = ec->comp_data;
+
+   /* get_xdg_surface wants a wl_surface that is still a blank slate, and both
+    * ways it can fail to be one are errors on the xdg_wm_base rather than on
+    * the wl_surface: what the client got wrong is the request it just made,
+    * and the wl_surface error codes number something else entirely.
+    *
+    * A role is a role however it was taken - a subsurface, a wl_shell
+    * surface, an xdg_surface asked for twice. */
+   if (cdata->sub.data || cdata->shell.data || cdata->shell.surface)
      {
-        wl_resource_post_error(surface_resource,
-                               XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER,
-                               "buffer attached/committed before configure");
+        wl_resource_post_error(resource, XDG_WM_BASE_ERROR_ROLE,
+                               "wl_surface already has a role");
+        return;
+     }
+   /* A buffer that was attached but not yet committed lives only in pending,
+    * so e_pixmap_usable_get() on its own sees the committed case and waves
+    * the merely-attached one through. */
+   if (e_pixmap_usable_get(ec->pixmap) || cdata->pending.buffer)
+     {
+        wl_resource_post_error(resource,
+                               XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE,
+                               "wl_surface has a buffer attached or committed");
         return;
      }
 
    ec->netwm.ping = 1;
-   cdata = ec->comp_data;
 
-   /* check for existing shell surface */
-   if (cdata->shell.data)
-     {
-        wl_resource_post_error(surface_resource,
-                               WL_DISPLAY_ERROR_INVALID_OBJECT,
-                               "Client already has XDG shell surface");
-        return;
-     }
    shd = cdata->shell.data = ""
    shd->width = shd->height = -1;
 
@@ -1575,6 +1584,12 @@ _e_xdg_shell_cb_surface_get(struct wl_client *client, struct wl_resource *resour
    cdata->shell.ping = _e_xdg_shell_surface_ping;
    cdata->shell.buffer_attach_error = _e_xdg_shell_surface_buffer_attach_error;
    cdata->is_xdg_surface = EINA_TRUE;
+   /* The debt is the xdg_surface's from the moment it exists - "attempts to
+    * attach or manipulate a buffer prior to the first xdg_surface.configure
+    * must be treated as errors" names the xdg_surface, not the role. Waiting
+    * for get_toplevel to arm this leaves a window in which a client can
+    * attach to a bare xdg_surface and hear nothing back. */
+   cdata->need_xdg_configure = 1;
 
    if (!ec->internal)
      e_client_ping(ec);
diff --git a/src/modules/wl_desktop_shell/xdg6.c b/src/modules/wl_desktop_shell/xdg6.c
index 992264023..43b81a6eb 100644
--- a/src/modules/wl_desktop_shell/xdg6.c
+++ b/src/modules/wl_desktop_shell/xdg6.c
@@ -1354,25 +1354,27 @@ _e_xdg_shell_cb_surface_get(struct wl_client *client, struct wl_resource *resour
         return;
      }
    if (e_object_is_del(E_OBJECT(ec))) return;
-   if (e_pixmap_usable_get(ec->pixmap))
+   cdata = ec->comp_data;
+
+   /* Same as the stable shell: a role already taken, or a buffer already on
+    * the surface, is the client getting this request wrong, so the error
+    * belongs to zxdg_shell_v6. See the note in xdg.c. */
+   if (cdata->sub.data || cdata->shell.data || cdata->shell.surface)
      {
-        wl_resource_post_error(surface_resource,
-                               ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER,
-                               "buffer attached/committed before configure");
+        wl_resource_post_error(resource, ZXDG_SHELL_V6_ERROR_ROLE,
+                               "wl_surface already has a role");
+        return;
+     }
+   if (e_pixmap_usable_get(ec->pixmap) || cdata->pending.buffer)
+     {
+        wl_resource_post_error(resource,
+                               ZXDG_SHELL_V6_ERROR_INVALID_SURFACE_STATE,
+                               "wl_surface has a buffer attached or committed");
         return;
      }
 
    ec->netwm.ping = 1;
-   cdata = ec->comp_data;
 
-   /* check for existing shell surface */
-   if (cdata->shell.data)
-     {
-        wl_resource_post_error(surface_resource,
-                               WL_DISPLAY_ERROR_INVALID_OBJECT,
-                               "Client already has XDG shell surface");
-        return;
-     }
    shd = cdata->shell.data = ""
    shd->width = shd->height = -1;
 
@@ -1397,6 +1399,9 @@ _e_xdg_shell_cb_surface_get(struct wl_client *client, struct wl_resource *resour
    cdata->shell.ping = _e_xdg_shell_surface_ping;
    cdata->shell.buffer_attach_error = _e_xdg_shell_surface_buffer_attach_error;
    cdata->is_xdg_surface = EINA_TRUE;
+   /* Owed from the moment the zxdg_surface_v6 exists, not from the role.
+    * See the note in xdg.c. */
+   cdata->need_xdg_configure = 1;
 
    if (!ec->internal)
      e_client_ping(ec);
diff --git a/src/tests/wlcs/tasks.txt b/src/tests/wlcs/tasks.txt
index 4c9acb413..226275148 100644
--- a/src/tests/wlcs/tasks.txt
+++ b/src/tests/wlcs/tasks.txt
@@ -42,6 +42,7 @@ E-13  TextInputV3WithInputMethodV2Test.*                      # text-input v3
 E-20  PointerConstraints.*:RelativePointer.*                  # pointer lock/confine + relative motion
 E-21  BadBufferTest.*:SecondBadBufferTest.*                   # buffer validation
 E-22  ClientSurfaceEventsTest.*:SurfacePointerMotionTest.*    # enter/leave bookkeeping
+E-23  XdgSurfaceStableTest.*:XdgSurfaceV6Test.*               # get_xdg_surface validation; overlaps E-03 by design
 E-24  XdgToplevelStableTest.*:XdgToplevelV6Test.*:XdgToplevelStableConfigurationTest.*:XdgToplevelV6ConfigurationTest.*  # interactive move/resize, window geometry
 
 # The big input-region and subsurface block. Originally listed as "a mix of
@@ -70,7 +71,6 @@ TRIAGE  *RegionSurfaceInputCombinations.*:*SurfaceInputCombinations.*:*Subsurfac
 #   E-12  keyboard-shortcuts-inhibit - no suite
 #   E-14  dmabuf v4               - no suite
 #   E-15  xdg_toplevel_drag       - no suite
-#   E-23  error object/code       - a reporting fix; visible in any xdg failure
 #
 # Deliberately not planned: zwlr_layer_shell_v1 (LayerSurface*, 284 tests),
 # zwlr_foreign_toplevel_manager_v1 (ForeignToplevel*), zwlr_virtual_pointer_v1.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to