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 9915fe58a33c6eb2e23f3644e727e2496b50657b
Author: Cedric BAIL <[email protected]>
AuthorDate: Mon Aug 17 22:03:42 2026 -0600

    e_comp_wl - restore a maximized toplevel to its window, not to its surface
    
    xdg_toplevel.unset_maximized answered out of ec->saved.w/h. e_client.c fills
    those from ec->client.w/h, and for a Wayland client that is the surface. A
    client that draws its own shadow has a surface larger than its window, so E was
    handing back a configure 2*shadow too big in each axis - and xdg_toplevel
    configure sizes are defined in window-geometry coordinates, so the client
    obeyed and grew by its shadow. Every cycle. Measured against Chromium: a
    972x716 window came back as 1004x748.
    
    Fixed without touching e_client.c. ec->saved is right for the X11 compositor,
    which shares that code: there the client window genuinely is the whole thing,
    shadow included, and _GTK_FRAME_EXTENTS describes a region inside it. Changing
    what is saved would have fixed Wayland by breaking X11.
    
    So the geometry is remembered where the units are already right - in
    E_Shell_Data, recorded from ec->comp_data->shell.window as the maximize
    configure goes out, and used in preference to ec->saved when restoring. Falls
    back to the old value when there is none, which is every client that never
    called set_window_geometry.
    
    Both backends are asserted. wl-maximize-restore now passes both of its halves
    and loses its xfail marker; x11-maximize-restore, which passed before this and
    is here precisely so it keeps passing, still restores 432x332 exactly.
    
    Co-Authored-By: Claude Opus 5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_01FtoiXoSKUmZb6Aix6U3GZS
---
 src/modules/wl_desktop_shell/e_mod_main.h |  9 +++++++++
 src/modules/wl_desktop_shell/xdg.c        | 17 +++++++++++++++++
 src/tests/wayland/meson.build             |  7 +------
 3 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/src/modules/wl_desktop_shell/e_mod_main.h b/src/modules/wl_desktop_shell/e_mod_main.h
index 4bff931ce..6e7ed64f8 100644
--- a/src/modules/wl_desktop_shell/e_mod_main.h
+++ b/src/modules/wl_desktop_shell/e_mod_main.h
@@ -24,6 +24,15 @@ struct E_Shell_Data
    uint32_t edges;
    int32_t width;
    int32_t height;
+   /* The window geometry this toplevel had when it was maximized, so it can be
+    * given back the same one. E_Client's ec->saved is the wrong source for a
+    * Wayland client: it is filled from ec->client.w/h, which is the surface,
+    * and a client that draws its own shadow has a surface larger than the
+    * window. Sending that back as a configure size - which the protocol
+    * defines in window-geometry coordinates - grows the window by the shadow
+    * on every cycle. */
+   int32_t unmax_w;
+   int32_t unmax_h;
    Eina_List *pending;
    struct wl_resource *surface;
    void *shell;
diff --git a/src/modules/wl_desktop_shell/xdg.c b/src/modules/wl_desktop_shell/xdg.c
index 89f87eb40..1152b69ea 100644
--- a/src/modules/wl_desktop_shell/xdg.c
+++ b/src/modules/wl_desktop_shell/xdg.c
@@ -977,6 +977,19 @@ _e_xdg_toplevel_cb_maximized_set(struct wl_client *client EINA_UNUSED, struct wl
                }
           }
      }
+   /* Remember the geometry we are leaving, in the units a configure is
+    * expressed in, while it is still current. */
+   {
+      E_Shell_Data *shd = ec->comp_data->shell.data;
+
+      if (shd && (ec->comp_data->shell.window.w > 0) &&
+          (ec->comp_data->shell.window.h > 0))
+        {
+           shd->unmax_w = ec->comp_data->shell.window.w;
+           shd->unmax_h = ec->comp_data->shell.window.h;
+        }
+   }
+
    _xdg_shell_surface_send_configure(resource, ec->fullscreen, 1, 0, w, h);
 }
 
@@ -1004,8 +1017,12 @@ _e_xdg_toplevel_cb_maximized_unset(struct wl_client *client EINA_UNUSED, struct
      }
    else
      {
+        E_Shell_Data *shd = ec->comp_data->shell.data;
+
         if (e_config->window_maximize_animate && (!ec->maximize_anims_disabled))
           w = ec->w, h = ec->h;
+        else if (shd && shd->unmax_w && shd->unmax_h)
+          w = shd->unmax_w, h = shd->unmax_h;
         else
           w = ec->saved.w, h = ec->saved.h;
      }
diff --git a/src/tests/wayland/meson.build b/src/tests/wayland/meson.build
index 862616ef0..200d1575c 100644
--- a/src/tests/wayland/meson.build
+++ b/src/tests/wayland/meson.build
@@ -80,12 +80,7 @@ wl_protocol_tests = [
   ['client-action', 'test_client_action.c'],
   ['client-state', 'test_client_state.c'],
   ['client-move', 'test_client_move.c'],
-  # xfail until #44: xdg_toplevel.unset_maximized answers out of ec->saved.w/h,
-  # and e_client.c fills those from ec->client.w/h - the surface size, which for
-  # a client with a shadow is 2*inset larger than the window geometry in each
-  # axis. Measured: restores a 400x300 window to 432x332. The fix is in code
-  # shared with X11, so it waits on X11 coverage rather than going in blind.
-  ['maximize-restore', 'test_maximize_restore.c', 'xfail'],
+  ['maximize-restore', 'test_maximize_restore.c'],
 ]
 
 # Shared plumbing: registry binding, toplevel construction, enumeration and a

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

Reply via email to