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

git pushed a commit to branch master
in repository enlightenment.

View the commit online.

commit 93c27dcb6ac431f4441a5235ef8f758d27a20b05
Author: Cedric BAIL <[email protected]>
AuthorDate: Fri Nov 27 08:28:32 2026 -0600

    e_comp_object - keep an empty input region when a window is shown
    
    Firefox on Wayland puts its page in a subsurface, gives it an empty
    input region before its first buffer, and reads the pointer from its
    toplevel. Under E every click in Firefox was lost, even on its own
    tab bar: E sent the pointer to the page subsurface, which GTK does not
    expect events on, so Firefox dropped them.
    
    Two things gave the region away. An empty region was taken as no
    region at all, which is the whole surface. And the first show of a
    window sets up its shadow, which made the window's image take events
    whenever the window had input rectangles or no frame, as a subsurface
    never has. The image then took the pointer over the whole surface, on
    top of the input rectangles that were meant to decide where it goes.
    
    An empty region is now kept, and a window with an input region lets
    its input rectangles alone take the pointer, as it did before
    2caecab4d turned this test around along with the one for shaped
    windows. Shaped windows and windows without a frame or an input region
    keep the image taking events.
    
    Only e_comp_wl.c and e_comp_wl_extensions.c set or read the input
    region, for Wayland and Xwayland clients. On X11, E never sets one, so
    its windows go through the same tests as before. Tested with the
    default suite, the x11 suite and wlcs, which fails the same 15 tests
    as without this change. The new wl-subsurface-input test fails
    without it, and passed 20 times in a row with it. Firefox 160 run in
    the test compositor now takes clicks on its tab bar and in a new tab.
    Its first tab still takes no input until another tab was opened, which
    this does not explain.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 src/bin/e_comp_object.c                   |   7 +-
 src/tests/wayland/meson.build             |   1 +
 src/tests/wayland/test_subsurface_input.c | 167 ++++++++++++++++++++++++++++++
 3 files changed, 172 insertions(+), 3 deletions(-)

diff --git a/src/bin/e_comp_object.c b/src/bin/e_comp_object.c
index 0cabfd742..652947042 100644
--- a/src/bin/e_comp_object.c
+++ b/src/bin/e_comp_object.c
@@ -750,8 +750,9 @@ _e_comp_object_shadow_setup(E_Comp_Object *cw)
         else
           edje_object_part_swallow(cw->shobj, "e.swallow.content", cw->obj);
      }
-   if ((cw->input_objs) || ((cw->ec) && (cw->ec->shaped))
-       || !cw->frame_object)
+   if (cw->input_area)
+     evas_object_pass_events_set(cw->obj, 1);
+   else if (((cw->ec) && (cw->ec->shaped)) || !cw->frame_object)
      evas_object_pass_events_set(cw->obj, 0);
    else
      evas_object_pass_events_set(cw->obj, 1);
@@ -3370,7 +3371,7 @@ e_comp_object_input_area_set(Evas_Object *obj, const Eina_Tiler *area)
    if (area && cw->input_area && eina_tiler_equal(area, cw->input_area)) return;
    _e_comp_input_objs_free(cw);
    if (cw->obj) evas_object_pass_events_set(cw->obj, 1);
-   if ((!area) || eina_tiler_empty(area))
+   if (!area)
      {
         E_FREE_FUNC(cw->input_area, eina_tiler_free);
         E_FREE_FUNC(cw->input_objs, eina_array_free);
diff --git a/src/tests/wayland/meson.build b/src/tests/wayland/meson.build
index 05406deac..f066b927a 100644
--- a/src/tests/wayland/meson.build
+++ b/src/tests/wayland/meson.build
@@ -75,6 +75,7 @@ wl_protocol_tests = [
   ['surface-unmap', 'test_surface_unmap.c'],
   ['pointer-focus', 'test_pointer_focus.c'],
   ['subsurface-position', 'test_subsurface_position.c'],
+  ['subsurface-input', 'test_subsurface_input.c'],
   ['window-geometry', 'test_window_geometry.c'],
   ['configure-size', 'test_configure_size.c'],
   ['touch-moving-surface', 'test_touch_moving_surface.c'],
diff --git a/src/tests/wayland/test_subsurface_input.c b/src/tests/wayland/test_subsurface_input.c
new file mode 100644
index 000000000..7fa8f7526
--- /dev/null
+++ b/src/tests/wayland/test_subsurface_input.c
@@ -0,0 +1,167 @@
+/* A subsurface takes the pointer only within its input region: elsewhere
+ * the pointer is over the surface under it. Firefox gives the subsurface of
+ * its page an empty input region before its first buffer, and reads the
+ * pointer from its toplevel. */
+#include <stdio.h>
+
+#include "e_wl_testkit.h"
+
+#define PROG "test-subsurface-input"
+
+static struct wl_surface *entered;
+
+static void
+_enter(void *data __attribute__((unused)), struct wl_pointer *p __attribute__((unused)),
+       uint32_t serial __attribute__((unused)), struct wl_surface *s,
+       wl_fixed_t x __attribute__((unused)), wl_fixed_t y __attribute__((unused)))
+{
+   entered = s;
+}
+
+static void
+_leave(void *data __attribute__((unused)), struct wl_pointer *p __attribute__((unused)),
+       uint32_t serial __attribute__((unused)), struct wl_surface *s __attribute__((unused)))
+{
+   entered = NULL;
+}
+
+static void
+_motion(void *data __attribute__((unused)), struct wl_pointer *p __attribute__((unused)),
+        uint32_t time __attribute__((unused)), wl_fixed_t x __attribute__((unused)),
+        wl_fixed_t y __attribute__((unused)))
+{
+}
+
+static void
+_button(void *data __attribute__((unused)), struct wl_pointer *p __attribute__((unused)),
+        uint32_t serial __attribute__((unused)), uint32_t time __attribute__((unused)),
+        uint32_t button __attribute__((unused)), uint32_t state __attribute__((unused)))
+{
+}
+
+static void
+_axis(void *data __attribute__((unused)), struct wl_pointer *p __attribute__((unused)),
+      uint32_t time __attribute__((unused)), uint32_t axis __attribute__((unused)),
+      wl_fixed_t value __attribute__((unused)))
+{
+}
+
+static const struct wl_pointer_listener _pointer_listener =
+{
+   _enter, _leave, _motion, _button, _axis, NULL, NULL, NULL, NULL, NULL, NULL
+};
+
+static Tk *tk;
+static struct wl_surface *ts, *sub;
+static int sx, sy;
+
+static void
+_frame_done(void *data, struct wl_callback *cb, uint32_t t __attribute__((unused)))
+{
+   int *done = data;
+
+   wl_callback_destroy(cb);
+   *done = 1;
+}
+
+static const struct wl_callback_listener _frame_listener = { _frame_done };
+
+/* E lays out a window it shows during its next render, and only then can
+ * the pointer find it. A frame done can come from a render already under
+ * way at the commit, so wait for two. */
+static void
+_drawn(void)
+{
+   int frames, done;
+
+   for (frames = 0; frames < 2; frames++)
+     {
+        done = 0;
+        wl_surface_damage(sub, 0, 0, 100, 100);
+        wl_callback_add_listener(wl_surface_frame(sub), &_frame_listener, &done);
+        wl_surface_commit(sub);
+        while (!done)
+          if (wl_display_dispatch(tk_display(tk)) < 0)
+            tk_fail(tk, "disconnected waiting for a frame");
+     }
+}
+
+static void
+_expect(int x, int y, struct wl_surface *want, const char *what)
+{
+   tk_pointer_warp(tk, sx + x, sy + y);
+   tk_sync(tk);
+   if (entered != want)
+     tk_fail(tk, "%s: the pointer is on %s, not on the %s", what,
+             (entered == ts) ? "the toplevel" : (entered == sub) ? "the subsurface" : "no surface",
+             (want == ts) ? "toplevel" : "subsurface");
+}
+
+static void
+_region_set(struct wl_compositor *compositor, int w)
+{
+   struct wl_region *region = NULL;
+
+   /* Off the window while the region changes. */
+   tk_pointer_warp(tk, sx + 500, sy + 500);
+   if (w >= 0)
+     {
+        region = wl_compositor_create_region(compositor);
+        if (w) wl_region_add(region, 0, 0, w, 100);
+     }
+   wl_surface_set_input_region(sub, region);
+   if (region) wl_region_destroy(region);
+   wl_surface_commit(sub);
+   wl_surface_commit(ts);
+   tk_settle(tk);
+}
+
+int
+main(void)
+{
+   struct wl_subcompositor *subcompositor;
+   struct wl_compositor *compositor;
+   struct wl_subsurface *subsurface;
+   struct wl_region *region;
+   struct wl_seat *seat;
+   Tk_Toplevel *top;
+
+   tk = tk_connect(PROG);
+   compositor = tk_bind(tk, &wl_compositor_interface, 4);
+   subcompositor = tk_bind(tk, &wl_subcompositor_interface, 1);
+   seat = tk_bind(tk, &wl_seat_interface, 1);
+   if ((!compositor) || (!subcompositor) || (!seat)) tk_fail(tk, "missing global");
+   wl_pointer_add_listener(wl_seat_get_pointer(seat), &_pointer_listener, NULL);
+
+   top = tk_toplevel_new(tk, "e.test.subsurface_input", PROG, 300, 200);
+   ts = tk_toplevel_surface(top);
+   /* As Firefox does: the empty region is committed before the buffer. */
+   sub = tk_surface_new(tk);
+   subsurface = wl_subcompositor_get_subsurface(subcompositor, sub, ts);
+   wl_subsurface_set_desync(subsurface);
+   wl_subsurface_set_position(subsurface, 20, 20);
+   region = wl_compositor_create_region(compositor);
+   wl_surface_set_input_region(sub, region);
+   wl_region_destroy(region);
+   wl_surface_commit(sub);
+   tk_settle(tk);
+   tk_surface_paint(tk, sub, 100, 100);
+   wl_surface_commit(ts);
+   _drawn();
+   tk_surface_geometry(tk, sub, &sx, &sy, NULL, NULL);
+
+   _expect(50, 50, ts, "an empty input region from the start");
+   _region_set(compositor, -1);
+   _expect(50, 50, sub, "no input region");
+   _region_set(compositor, 0);
+   _expect(50, 50, ts, "an empty input region");
+   _region_set(compositor, 40);
+   _expect(20, 50, sub, "inside a region of the left part");
+   _expect(70, 50, ts, "outside a region of the left part");
+   _region_set(compositor, -1);
+   _expect(70, 50, sub, "the input region reset");
+
+   printf(PROG ": ok\n");
+   tk_disconnect(tk);
+   return 0;
+}

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

Reply via email to