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

git pushed a commit to reference refs/pull/226/head
in repository enlightenment.

View the commit online.

commit 796e6c4c1063a16e9ad5ca47d45630c2885cd29e
Author: Cedric BAIL <[email protected]>
AuthorDate: Sat Nov 28 16:47:33 2026 -0600

    wl_desktop_shell - configure a toplevel that maps again, however it was
    
    A toplevel unmapped by a null buffer maps again the way a new one
    does: an initial commit, which the compositor answers with a configure,
    and a buffer in answer to that. E sends the configure, and skipped
    it, like any configure, when it was the same as the last one sent. The
    state of a window that lost the focus as it was unmapped changes, so
    it was sent; a window that did not have the focus stayed unmapped,
    its client waiting for a configure that never came. A window detached
    from an xdg_toplevel_drag and mapped again is one of those.
    
    The initial configure of a surface mapping again is now always sent,
    by xdg-shell and xdg-shell v6. xdg-shell v5 has no initial configure.
    
    wl-remap now also remaps the window while another one has the focus,
    and waits for the configure; it fails without this.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/modules/wl_desktop_shell/xdg.c  |  5 ++++-
 src/modules/wl_desktop_shell/xdg6.c |  5 ++++-
 src/tests/wayland/test_remap.c      | 36 ++++++++++++++++++++++++++++++++++--
 3 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/src/modules/wl_desktop_shell/xdg.c b/src/modules/wl_desktop_shell/xdg.c
index 94370d1d3..c4b58a837 100644
--- a/src/modules/wl_desktop_shell/xdg.c
+++ b/src/modules/wl_desktop_shell/xdg.c
@@ -523,7 +523,10 @@ _xdg_shell_surface_send_configure(struct wl_resource *resource, Eina_Bool fullsc
     * given but has not drawn yet: the latest configure wins. */
    if (shd->size_serial && (!width) && (!height))
      width = shd->width, height = shd->height;
-   if ((shd->edges == edges) && (shd->width == width) && (shd->height == height) &&
+   /* A surface mapping again waits for a configure, however like the last
+    * one it would be. */
+   if ((!ec->comp_data->need_xdg_configure) &&
+       (shd->edges == edges) && (shd->width == width) && (shd->height == height) &&
        (shd->fullscreen == fullscreen) &&
        (shd->maximized == maximized) &&
        (shd->activated == activated)) return;
diff --git a/src/modules/wl_desktop_shell/xdg6.c b/src/modules/wl_desktop_shell/xdg6.c
index 17a76f2e4..87b3324eb 100644
--- a/src/modules/wl_desktop_shell/xdg6.c
+++ b/src/modules/wl_desktop_shell/xdg6.c
@@ -336,7 +336,10 @@ _xdg_shell_surface_send_configure(struct wl_resource *resource, Eina_Bool fullsc
           } while (focused && (!activated));
      }
    shd = ec->comp_data->shell.data;
-   if ((shd->edges == edges) && (shd->width == width) && (shd->height == height) &&
+   /* A surface mapping again waits for a configure, however like the last
+    * one it would be. */
+   if ((!ec->comp_data->need_xdg_configure) &&
+       (shd->edges == edges) && (shd->width == width) && (shd->height == height) &&
        (shd->fullscreen == fullscreen) &&
        (shd->maximized == maximized) &&
        (shd->activated == activated)) return;
diff --git a/src/tests/wayland/test_remap.c b/src/tests/wayland/test_remap.c
index 028104aeb..f2c1a221d 100644
--- a/src/tests/wayland/test_remap.c
+++ b/src/tests/wayland/test_remap.c
@@ -1,21 +1,45 @@
-/* A toplevel unmapped by a null buffer may attach a null buffer again: it
- * maps nothing, so it is not a buffer attached before the configure. */
+/* A toplevel unmapped by a null buffer maps again the way xdg-shell
+ * requires of a new one: an initial commit, answered by a configure, then a
+ * buffer. The configure must come even when nothing about the window
+ * changed, here for a window that does not have the focus, and attaching a
+ * null buffer again while unmapped is no error. */
 #include <stdio.h>
+#include <time.h>
 
 #include "e_wl_testkit.h"
 
 #define PROG "test-remap"
 #define APP_ID "e.test.remap"
 
+static void
+_configure_wait(Tk *tk, Tk_Toplevel *top, int configures, const char *what)
+{
+   struct timespec step = { 0, 50000000 };
+   int i, count;
+
+   for (i = 0; i < TK_WAIT_SECONDS * 20; i++)
+     {
+        tk_sync(tk);
+        tk_toplevel_configured(top, NULL, NULL, &count);
+        if (count > configures) return;
+        nanosleep(&step, NULL);
+     }
+   tk_fail(tk, "%s: no configure", what);
+}
+
 int
 main(void)
 {
    Tk_Toplevel *top;
    struct wl_surface *surface;
+   Tk_Client *client;
    Tk *tk;
+   int configures;
 
    tk = tk_connect(PROG);
    top = tk_toplevel_new(tk, APP_ID, PROG, 200, 100);
+   /* Made last, so it has the focus and the first does not. */
+   tk_toplevel_new(tk, APP_ID ".focused", PROG, 200, 100);
    surface = tk_toplevel_surface(top);
 
    wl_surface_attach(surface, NULL, 0, 0);
@@ -29,6 +53,14 @@ main(void)
         return 1;
      }
 
+   tk_toplevel_configured(top, NULL, NULL, &configures);
+   wl_surface_commit(surface);
+   _configure_wait(tk, top, configures, "the initial commit of a remap");
+   tk_settle(tk);
+   client = tk_expect(tk, APP_ID);
+   if (!(client->states & WL_TEST_CLIENT_STATE_VISIBLE))
+     tk_fail(tk, "the window is not shown again");
+
    tk_disconnect(tk);
    printf(PROG ": ok\n");
    return 0;

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

Reply via email to