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 ea57f6c42c9cd00cfdee12f2dd1f785fe974f3ed
Author: Cedric BAIL <[email protected]>
AuthorDate: Mon Aug 10 08:42:36 2026 -0600

    wl_desktop_shell - a grabbing popup takes the keyboard
    
    xdg_popup.grab is an explicit grab: the popup owns the keyboard until it
    is dismissed, which is most of what makes a menu a menu. Keyboard focus
    never reached one.
    
    Two things were in the way. _e_comp_wl_keyboard_enter() walks up from any
    xdg surface to its toplevel - correct for an ordinary popup, which must
    not take focus off the window it belongs to, and wlcs checks that too -
    but a grab is exactly the case where the popup should keep it. And the
    popup was never E-focused in the first place, so that walk was never
    even reached: measured, _e_comp_wl_keyboard_enter() was called once for
    the toplevel and never again.
    
    The grab request arrives before the first commit, while there is still
    nothing to focus, so the focus has to wait until the popup maps.
    
    XdgPopupTest: 10 passed / 7 failed -> 12 / 6.
    non_grabbed_popup_does_not_get_keyboard_focus still passes.
    
    Co-Authored-By: Claude Opus 5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_01FtoiXoSKUmZb6Aix6U3GZS
---
 src/bin/e_comp_wl.c                 | 5 ++++-
 src/modules/wl_desktop_shell/xdg.c  | 9 +++++++++
 src/modules/wl_desktop_shell/xdg6.c | 4 ++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/bin/e_comp_wl.c b/src/bin/e_comp_wl.c
index 50d0ccc18..98f42cf60 100644
--- a/src/bin/e_comp_wl.c
+++ b/src/bin/e_comp_wl.c
@@ -689,7 +689,10 @@ _e_comp_wl_evas_cb_focus_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj
    _e_comp_wl_client_priority_raise(ec);
 
    wc = wl_resource_get_client(ec->comp_data->surface);
-   if (ec->comp_data->is_xdg_surface)
+   /* A popup holding an xdg_popup.grab is the exception to the rule below:
+    * the grab is what gives a menu the keyboard, so focus stays on the popup
+    * itself rather than walking up to the toplevel it hangs off. */
+   if (ec->comp_data->is_xdg_surface && (!ec->comp_data->grab))
      {
         /* We only send kbd focus to xdg top levels */
         while (ec->parent)
diff --git a/src/modules/wl_desktop_shell/xdg.c b/src/modules/wl_desktop_shell/xdg.c
index b84f10605..56d13a612 100644
--- a/src/modules/wl_desktop_shell/xdg.c
+++ b/src/modules/wl_desktop_shell/xdg.c
@@ -363,6 +363,15 @@ _e_xdg_shell_surface_map(struct wl_resource *resource)
          * respective parents... */
         /* if (e_client_util_is_popup(ec)) */
         /*   e_client_raise_latest_set(ec); */
+
+        /* xdg_popup.grab is an explicit grab: the popup owns the keyboard
+         * until it is dismissed, which is what makes a menu a menu. The grab
+         * request arrives before the first commit, when there is nothing to
+         * focus yet, so the focus has to wait until the popup is mapped. A
+         * popup without a grab is left alone: it must not take focus off the
+         * toplevel it belongs to. */
+        if (ec->comp_data->grab)
+          evas_object_focus_set(ec->frame, 1);
      }
 }
 
diff --git a/src/modules/wl_desktop_shell/xdg6.c b/src/modules/wl_desktop_shell/xdg6.c
index da99143e8..0e7ed68e7 100644
--- a/src/modules/wl_desktop_shell/xdg6.c
+++ b/src/modules/wl_desktop_shell/xdg6.c
@@ -255,6 +255,10 @@ _e_xdg_shell_surface_map(struct wl_resource *resource)
          * respective parents... */
         /* if (e_client_util_is_popup(ec)) */
         /*   e_client_raise_latest_set(ec); */
+
+        /* A grabbing popup owns the keyboard; see the same block in xdg.c. */
+        if (ec->comp_data->grab)
+          evas_object_focus_set(ec->frame, 1);
      }
 }
 

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

Reply via email to