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 0e2a6d348ed2dfcfc36d89f335a09e121cc43d03
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Aug 9 22:49:29 2026 -0600

    wl_desktop_shell - v6 positioner corners are bitmasks, not values
    
    zxdg_positioner_v6 anchor and gravity really are bitfields - top|left is
    a legal corner - but _apply_positioner_x() and _apply_positioner_y()
    switch on the whole value. A corner anchor of top|left is 5, which
    matches neither LEFT (4) nor RIGHT (8), so every corner fell through to
    the centred default. The inversion path a few lines above already tests
    the bits, which is what makes the switch look right at a glance.
    
    This is the exact mirror of the bug just fixed in xdg.c, where stable
    xdg-shell's sequential enum was being read as a bitmask.
    
    The blast radius is wider than the four corner cases, because the
    constraint-adjustment suites all anchor their popup at a corner: with
    the anchor point silently moved to the centre of the anchor rect, flip,
    slide and resize each start from the wrong place.
    
    Also drop two "x = x;" no-ops in xdg.c that clang flags as self-assign.
    
    *XdgPopup*: 64 passed / 41 failed -> 89 passed / 16 failed.
    Anchor, Flip, ConstraintAdjustmentNone, Slide and Gravity are now clean.
    
    Co-Authored-By: Claude Opus 5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_01FtoiXoSKUmZb6Aix6U3GZS
---
 src/modules/wl_desktop_shell/xdg.c  |  4 +-
 src/modules/wl_desktop_shell/xdg6.c | 76 ++++++++++++++-----------------------
 2 files changed, 31 insertions(+), 49 deletions(-)

diff --git a/src/modules/wl_desktop_shell/xdg.c b/src/modules/wl_desktop_shell/xdg.c
index 35cdb5905..a5fafdf49 100644
--- a/src/modules/wl_desktop_shell/xdg.c
+++ b/src/modules/wl_desktop_shell/xdg.c
@@ -821,7 +821,7 @@ _apply_positioner_x(int x, Positioner *p, Eina_Bool invert)
       case XDG_POSITIONER_GRAVITY_RIGHT:
       case XDG_POSITIONER_GRAVITY_TOP_RIGHT:
       case XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT:
-        x = x;
+        /* the popup grows to the right of x; nothing to subtract */
         break;
       default:
         x -= p->size.w / 2;
@@ -876,7 +876,7 @@ _apply_positioner_y(int y, Positioner *p, Eina_Bool invert)
       case XDG_POSITIONER_GRAVITY_BOTTOM:
       case XDG_POSITIONER_GRAVITY_BOTTOM_LEFT:
       case XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT:
-        y = y;
+        /* the popup grows below y; nothing to subtract */
         break;
       default:
         y -= (p->size.h / 2);
diff --git a/src/modules/wl_desktop_shell/xdg6.c b/src/modules/wl_desktop_shell/xdg6.c
index 798593342..2ae0a16d5 100644
--- a/src/modules/wl_desktop_shell/xdg6.c
+++ b/src/modules/wl_desktop_shell/xdg6.c
@@ -675,31 +675,23 @@ _apply_positioner_x(int x, Positioner *p, Eina_Bool invert)
         grav = p->gravity;
      }
 
-   switch (an)
-     {
-      case ZXDG_POSITIONER_V6_ANCHOR_LEFT:
-        x += p->anchor_rect.x;
-        break;
-      case ZXDG_POSITIONER_V6_ANCHOR_RIGHT:
-        x += p->anchor_rect.x + p->anchor_rect.w;
-        break;
-      default:
-        x += p->anchor_rect.x + (p->anchor_rect.w / 2);
-        break;
-     }
+   /* Test the bit, do not switch on the value: in zxdg_positioner_v6 anchor
+    * and gravity are bitmasks, so a corner such as top|left is 5 and matches
+    * neither LEFT (4) nor RIGHT (8). Switching on it sent every corner to the
+    * centred default. */
+   if (an & ZXDG_POSITIONER_V6_ANCHOR_LEFT)
+     x += p->anchor_rect.x;
+   else if (an & ZXDG_POSITIONER_V6_ANCHOR_RIGHT)
+     x += p->anchor_rect.x + p->anchor_rect.w;
+   else
+     x += p->anchor_rect.x + (p->anchor_rect.w / 2);
 
-   switch (grav)
-     {
-      case ZXDG_POSITIONER_V6_GRAVITY_LEFT:
-        x -= p->size.w;
-        break;
-      case ZXDG_POSITIONER_V6_GRAVITY_RIGHT:
-        x = x;
-        break;
-      default:
-        x -= p->size.w / 2;
-        break;
-     }
+   if (grav & ZXDG_POSITIONER_V6_GRAVITY_LEFT)
+     x -= p->size.w;
+   else if (grav & ZXDG_POSITIONER_V6_GRAVITY_RIGHT)
+     ; /* the popup grows to the right of x; nothing to subtract */
+   else
+     x -= p->size.w / 2;
 
    return x;
 }
@@ -727,30 +719,20 @@ _apply_positioner_y(int y, Positioner *p, Eina_Bool invert)
         grav = p->gravity;
      }
 
-   switch (an)
-     {
-      case ZXDG_POSITIONER_V6_ANCHOR_TOP:
-        y += p->anchor_rect.y;
-        break;
-      case ZXDG_POSITIONER_V6_ANCHOR_BOTTOM:
-        y += p->anchor_rect.y + p->anchor_rect.h;
-        break;
-      default:
-        y += p->anchor_rect.y + (p->anchor_rect.h / 2);
-        break;
-     }
+   /* Bitmask, not a value; see _apply_positioner_x. */
+   if (an & ZXDG_POSITIONER_V6_ANCHOR_TOP)
+     y += p->anchor_rect.y;
+   else if (an & ZXDG_POSITIONER_V6_ANCHOR_BOTTOM)
+     y += p->anchor_rect.y + p->anchor_rect.h;
+   else
+     y += p->anchor_rect.y + (p->anchor_rect.h / 2);
 
-   switch (grav)
-     {
-      case ZXDG_POSITIONER_V6_GRAVITY_TOP:
-        y -= p->size.h;
-        break;
-      case ZXDG_POSITIONER_V6_GRAVITY_BOTTOM:
-        y = y;
-        break;
-      default:
-        y -= (p->size.h / 2);
-     }
+   if (grav & ZXDG_POSITIONER_V6_GRAVITY_TOP)
+     y -= p->size.h;
+   else if (grav & ZXDG_POSITIONER_V6_GRAVITY_BOTTOM)
+     ; /* the popup grows below y; nothing to subtract */
+   else
+     y -= p->size.h / 2;
 
    return y;
 }

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

Reply via email to