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 b66774364f675a08630f3a6b611b17b0c20f2593
Author: Cedric BAIL <[email protected]>
AuthorDate: Mon Aug 10 08:20:14 2026 -0600

    wl_desktop_shell - constrained popups keep the size we gave them
    
    Two bugs, both in the RESIZE half of constraint_adjustment, and either
    one alone hides the other.
    
    Resize means "shrink to the part that fits" - intersect the popup with
    the zone. _apply_positioner() clamped the near edge and then ran the far
    one out to the edge of the zone, which grows the popup instead: a 60x40
    popup hanging five pixels over the top of the screen came back 5x768.
    
    Then, on the first buffer attach, _e_xdg_shell_surface_configure() took
    the size from that buffer. A client is entitled to attach a buffer of
    the size it originally asked for - wlcs does exactly that, deliberately
    - and adopting it handed the popup back the geometry the positioner had
    just rejected, and echoed it out as a third configure. A popup's size is
    the compositor's to decide; it can only change through the positioner.
    So take the position from the commit and keep the size.
    
    Neither is visible from the other's failure: with only the second fixed
    the popup ends up 5x768, and with only the first the client's buffer
    size wins anyway.
    
    Every XdgPopupPositionerTest now passes, stable and v6.
    ConstraintAdjustmentResize: 2 passed / 8 failed -> 10 / 0.
    *XdgPopup*: 89 passed / 16 failed -> 97 / 8, and all eight left are the
    popup-grab group, which is a feature rather than a bug.
    
    Co-Authored-By: Claude Opus 5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_01FtoiXoSKUmZb6Aix6U3GZS
---
 src/modules/wl_desktop_shell/xdg.c  | 26 ++++++++++++++++++++++++--
 src/modules/wl_desktop_shell/xdg6.c | 16 ++++++++++++++--
 2 files changed, 38 insertions(+), 4 deletions(-)

diff --git a/src/modules/wl_desktop_shell/xdg.c b/src/modules/wl_desktop_shell/xdg.c
index a5fafdf49..b84f10605 100644
--- a/src/modules/wl_desktop_shell/xdg.c
+++ b/src/modules/wl_desktop_shell/xdg.c
@@ -289,6 +289,19 @@ _e_xdg_shell_surface_configure(struct wl_resource *resource, Evas_Coord x, Evas_
         return;
      }
    if (e_object_is_del(E_OBJECT(ec))) return;
+   if (e_client_util_is_popup(ec))
+     {
+        /* A popup's size is ours to decide, not the client's: it comes out of
+         * the positioner, and constraint_adjustment may already have shrunk
+         * it to the part that fits on screen. The client is free to attach a
+         * buffer of the size it originally asked for - wlcs does exactly that
+         * - and taking the size from that buffer would hand the popup back
+         * the geometry we just rejected, then echo it out as a fresh
+         * configure. Take the position, keep the size. */
+        e_comp_object_frame_wh_unadjust(ec->frame, ec->w, ec->h, &w, &h);
+        e_client_util_move_resize_without_frame(ec, x, y, w, h);
+        return;
+     }
    if (ec->placed)
      e_client_util_move_resize_without_frame(ec, x, y, w, h);
    else
@@ -996,11 +1009,18 @@ _apply_positioner(E_Client *ec, Positioner *p)
 
    if (!CONSTRAINED(ec, ec->x, ec->y)) return;
 
+   /* Resize means "shrink to the part that fits", i.e. intersect the popup
+    * with the zone. Clamping the near edge and then running the far one out
+    * to the edge of the zone grows the popup instead: a 60x40 popup hanging
+    * five pixels over the top of the screen came back the full height of the
+    * zone. */
    if ((p->constrain & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X) &&
        (!E_CONTAINS(zx, zy, zw, zh, ec->x, zy, ec->w, 1)))
      {
+        int r = ec->x + ec->w;
+
         if (ec->x < zx) ec->x = zx;
-        ec->w = zx + zw - ec->x;
+        ec->w = MIN(r, zx + zw) - ec->x;
         e_client_resize_limit(ec, &ec->w, &ec->h);
         ec->changes.size = 1;
         if (!CONSTRAINED(ec, ec->x, ec->y)) return;
@@ -1008,8 +1028,10 @@ _apply_positioner(E_Client *ec, Positioner *p)
    if ((p->constrain & XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y) &&
        (!E_CONTAINS(zx, zy, zw, zh, zx, ec->y, 1, ec->h)))
      {
+        int b = ec->y + ec->h;
+
         if (ec->y < zy) ec->y = zy;
-        ec->h = zy + zh - ec->y;
+        ec->h = MIN(b, zy + zh) - ec->y;
         e_client_resize_limit(ec, &ec->w, &ec->h);
         ec->changes.size = 1;
      }
diff --git a/src/modules/wl_desktop_shell/xdg6.c b/src/modules/wl_desktop_shell/xdg6.c
index 2ae0a16d5..da99143e8 100644
--- a/src/modules/wl_desktop_shell/xdg6.c
+++ b/src/modules/wl_desktop_shell/xdg6.c
@@ -187,6 +187,13 @@ _e_xdg_shell_surface_configure(struct wl_resource *resource, Evas_Coord x, Evas_
         return;
      }
    if (e_object_is_del(E_OBJECT(ec))) return;
+   if (e_client_util_is_popup(ec))
+     {
+        /* Take the position, keep the size; see the same block in xdg.c. */
+        e_comp_object_frame_wh_unadjust(ec->frame, ec->w, ec->h, &w, &h);
+        e_client_util_move_resize_without_frame(ec, x, y, w, h);
+        return;
+     }
    if (ec->placed)
      e_client_util_move_resize_without_frame(ec, x, y, w, h);
    else
@@ -848,11 +855,14 @@ _apply_positioner(E_Client *ec, Positioner *p)
 
    if (!CONSTRAINED(ec, ec->x, ec->y)) return;
 
+   /* Intersect with the zone; see the same block in xdg.c. */
    if ((p->constrain & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_X) &&
        (!E_CONTAINS(zx, zy, zw, zh, ec->x, zy, ec->w, 1)))
      {
+        int r = ec->x + ec->w;
+
         if (ec->x < zx) ec->x = zx;
-        ec->w = zx + zw - ec->x;
+        ec->w = MIN(r, zx + zw) - ec->x;
         e_client_resize_limit(ec, &ec->w, &ec->h);
         ec->changes.size = 1;
         if (!CONSTRAINED(ec, ec->x, ec->y)) return;
@@ -860,8 +870,10 @@ _apply_positioner(E_Client *ec, Positioner *p)
    if ((p->constrain & ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_Y) &&
        (!E_CONTAINS(zx, zy, zw, zh, zx, ec->y, 1, ec->h)))
      {
+        int b = ec->y + ec->h;
+
         if (ec->y < zy) ec->y = zy;
-        ec->h = zy + zh - ec->y;
+        ec->h = MIN(b, zy + zh) - ec->y;
         e_client_resize_limit(ec, &ec->w, &ec->h);
         ec->changes.size = 1;
      }

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

Reply via email to