This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch up/10-subsurface-input
in repository enlightenment.
View the commit online.
commit 0b0fcd175062c4bd40a5891e85243b08d7f13a49
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Nov 25 21:04:49 2026 -0600
wl_desktop_shell - keep a configured size until the client has drawn it
Resizing Firefox and minimising it right after brought it back at the
size it had before the resize. A configure E sends without a size, as a
focus change or an iconify does, says 0x0: the client chooses. The
latest configure wins, so one sent after a resize the client has not
drawn yet takes that resize back, and Firefox then chooses the size it
was still at.
A configure without a size now repeats the last size E asked for, until
the client has acked that configure and committed after it. Once drawn,
the client chooses again, as before, so a client that later resizes
itself is not pulled back at the next focus change. Clearing it on the
ack would not be enough: Firefox acks at once and draws later, and a
focus change in between loses the size the same way.
This replaces the rule that did the same only at the end of an
interactive resize, and only until the ack.
Only xdg_wm_base is changed; zxdg_shell_v6 and xdg_shell v5 keep their
own copy of the old rule.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/modules/wl_desktop_shell/e_mod_main.h | 4 +
src/modules/wl_desktop_shell/xdg.c | 15 ++--
src/tests/wayland/meson.build | 1 +
src/tests/wayland/test_configure_size.c | 119 ++++++++++++++++++++++++++++++
4 files changed, 134 insertions(+), 5 deletions(-)
diff --git a/src/modules/wl_desktop_shell/e_mod_main.h b/src/modules/wl_desktop_shell/e_mod_main.h
index 85ec09add..4144a903b 100644
--- a/src/modules/wl_desktop_shell/e_mod_main.h
+++ b/src/modules/wl_desktop_shell/e_mod_main.h
@@ -31,6 +31,10 @@ struct E_Shell_Data
int32_t unmax_w;
int32_t unmax_h;
Eina_List *pending;
+ /* the last configure with a size, until a commit after its ack; and the
+ * last serial acked */
+ uint32_t size_serial;
+ uint32_t acked_serial;
struct wl_resource *surface;
void *shell;
unsigned int version;
diff --git a/src/modules/wl_desktop_shell/xdg.c b/src/modules/wl_desktop_shell/xdg.c
index cb58cf135..d4acec002 100644
--- a/src/modules/wl_desktop_shell/xdg.c
+++ b/src/modules/wl_desktop_shell/xdg.c
@@ -292,6 +292,7 @@ _e_xdg_shell_cb_positioner_create(struct wl_client *client, struct wl_resource *
static void
_e_xdg_shell_surface_configure(struct wl_resource *resource, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
{
+ E_Shell_Data *shd;
E_Client *ec;
/* DBG("XDG_SHELL: Surface Configure: %d \t%d %d %d %d", */
@@ -306,6 +307,9 @@ _e_xdg_shell_surface_configure(struct wl_resource *resource, Evas_Coord x, Evas_
return;
}
if (e_object_is_del(E_OBJECT(ec))) return;
+ shd = ec->comp_data->shell.data;
+ if (shd->size_serial && (shd->acked_serial >= shd->size_serial))
+ shd->size_serial = 0;
if (e_client_util_is_popup(ec))
{
/* A popup's size comes from its positioner, possibly shrunk by
@@ -511,15 +515,14 @@ _xdg_shell_surface_send_configure(struct wl_resource *resource, Eina_Bool fullsc
} while (focused && (!activated));
}
shd = ec->comp_data->shell.data;
+ /* 0x0 lets the client choose its size, and would take back a size it was
+ * given but has not drawn yet: the latest configure wins. */
+ if (shd->size_serial && (!width) && (!height))
+ width = shd->width, height = shd->height;
if ((shd->edges == edges) && (shd->width == width) && (shd->height == height) &&
(shd->fullscreen == fullscreen) &&
(shd->maximized == maximized) &&
(shd->activated == activated)) return;
- if (shd->edges && (shd->edges != edges))
- {
- if (shd->pending && (!width) && (!height))
- width = shd->width, height = shd->height;
- }
//L("CONFIGURE %dx%d | max(%d) | full(%d)", width, height, maximized, fullscreen);
shd->edges = edges;
shd->width = width;
@@ -576,6 +579,7 @@ _xdg_shell_surface_send_configure(struct wl_resource *resource, Eina_Bool fullsc
_e_xdg_toplevel_configure_bounds_send(resource, ec);
serial = wl_display_next_serial(e_comp_wl->wl.disp);
+ if (width || height) shd->size_serial = serial;
xdg_toplevel_send_configure(resource, width, height, &states);
{
Pending_State *ps;
@@ -784,6 +788,7 @@ _e_xdg_surface_cb_ack_configure(struct wl_client *client EINA_UNUSED, struct wl_
}
if (e_object_is_del(E_OBJECT(ec))) return;
shd = ec->comp_data->shell.data;
+ shd->acked_serial = serial;
EINA_LIST_FOREACH_SAFE(shd->pending, l, ll, ps)
{
if (ps->serial > serial) break;
diff --git a/src/tests/wayland/meson.build b/src/tests/wayland/meson.build
index fb14b02b6..110b62c0a 100644
--- a/src/tests/wayland/meson.build
+++ b/src/tests/wayland/meson.build
@@ -76,6 +76,7 @@ wl_protocol_tests = [
['pointer-focus', 'test_pointer_focus.c'],
['subsurface-position', 'test_subsurface_position.c'],
['window-geometry', 'test_window_geometry.c'],
+ ['configure-size', 'test_configure_size.c'],
['touch-moving-surface', 'test_touch_moving_surface.c'],
['pointer-axis120', 'test_pointer_axis120.c'],
['popup-dismiss', 'test_popup_dismiss.c'],
diff --git a/src/tests/wayland/test_configure_size.c b/src/tests/wayland/test_configure_size.c
new file mode 100644
index 000000000..1d7f45565
--- /dev/null
+++ b/src/tests/wayland/test_configure_size.c
@@ -0,0 +1,119 @@
+/* A configure that leaves the size to the client, as a focus change sends,
+ * keeps the size E asked for until the client has acked it and drawn it:
+ * the latest configure wins, so 0x0 would let the client keep its old
+ * size. */
+#include <stdio.h>
+
+#include "e_wl_testkit.h"
+
+#define PROG "test-configure-size"
+#define APP_ID "e.test.configure-size"
+#define W 200
+#define H 150
+#define ICONIC WL_TEST_CLIENT_STATE_ICONIFIED
+#define FOCUS WL_TEST_CLIENT_STATE_FOCUSED
+
+static uint32_t last_serial;
+static int last_w, last_h, configures;
+
+static void
+_xdg_configure(void *data __attribute__((unused)), struct xdg_surface *xs __attribute__((unused)),
+ uint32_t serial)
+{
+ last_serial = serial;
+ configures++;
+}
+
+static const struct xdg_surface_listener _xdg_listener = { _xdg_configure };
+
+static void
+_toplevel_configure(void *data __attribute__((unused)), struct xdg_toplevel *top __attribute__((unused)),
+ int32_t w, int32_t h, struct wl_array *states __attribute__((unused)))
+{
+ last_w = w;
+ last_h = h;
+}
+
+static void
+_toplevel_close(void *data __attribute__((unused)), struct xdg_toplevel *top __attribute__((unused)))
+{
+}
+
+static void
+_toplevel_bounds(void *data __attribute__((unused)), struct xdg_toplevel *top __attribute__((unused)),
+ int32_t w __attribute__((unused)), int32_t h __attribute__((unused)))
+{
+}
+
+static void
+_toplevel_caps(void *data __attribute__((unused)), struct xdg_toplevel *top __attribute__((unused)),
+ struct wl_array *caps __attribute__((unused)))
+{
+}
+
+static const struct xdg_toplevel_listener _toplevel_listener =
+{
+ _toplevel_configure, _toplevel_close, _toplevel_bounds, _toplevel_caps
+};
+
+static void
+_expect(Tk *tk, int count, int w, int h, const char *what)
+{
+ if (configures == count) tk_fail(tk, "%s: no configure", what);
+ if ((last_w != w) || (last_h != h))
+ tk_fail(tk, "%s: configured %dx%d, not %dx%d", what, last_w, last_h, w, h);
+}
+
+int
+main(void)
+{
+ struct xdg_surface *xs;
+ struct xdg_toplevel *top;
+ struct wl_surface *surface;
+ unsigned int id;
+ int count;
+ Tk *tk;
+
+ tk = tk_connect(PROG);
+ surface = tk_surface_new(tk);
+ xs = xdg_wm_base_get_xdg_surface(tk_wm_base(tk), surface);
+ xdg_surface_add_listener(xs, &_xdg_listener, NULL);
+ top = xdg_surface_get_toplevel(xs);
+ xdg_toplevel_add_listener(top, &_toplevel_listener, NULL);
+ xdg_toplevel_set_app_id(top, APP_ID);
+ wl_surface_commit(surface);
+ tk_sync(tk);
+ xdg_surface_ack_configure(xs, last_serial);
+ tk_surface_paint(tk, surface, W, H);
+ tk_wait_states(tk, APP_ID, FOCUS, FOCUS, "a new window has the focus");
+ id = tk_expect(tk, APP_ID)->id;
+ xdg_surface_ack_configure(xs, last_serial);
+ wl_surface_commit(surface);
+ tk_sync(tk);
+
+ count = configures;
+ tk_action(tk, id, "window_resize_by", "120 90");
+ _expect(tk, count, W + 120, H + 90, "resized");
+
+ count = configures;
+ tk_action(tk, id, "window_iconic_toggle", NULL);
+ tk_wait_states(tk, APP_ID, ICONIC, ICONIC, "iconified");
+ _expect(tk, count, W + 120, H + 90, "iconified before the ack");
+
+ xdg_surface_ack_configure(xs, last_serial);
+ count = configures;
+ tk_action(tk, id, "window_iconic_toggle", NULL);
+ tk_wait_states(tk, APP_ID, ICONIC | FOCUS, FOCUS, "restored");
+ _expect(tk, count, W + 120, H + 90, "restored after the ack, before the commit");
+
+ xdg_surface_ack_configure(xs, last_serial);
+ tk_surface_paint(tk, surface, W + 120, H + 90);
+ count = configures;
+ tk_action(tk, id, "window_iconic_toggle", NULL);
+ tk_wait_states(tk, APP_ID, ICONIC, ICONIC, "iconified again");
+ _expect(tk, count, 0, 0, "iconified after the commit");
+
+ printf(PROG ": ok\n");
+ tk_disconnect(tk);
+ return 0;
+}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.