This is an automated email from the git hooks/post-receive script.
git pushed a commit to reference refs/pull/235/head
in repository enlightenment.
View the commit online.
commit 90ea6194dd47b0e3bbcdb15d5f9f3f01af023f53
Author: Cedric BAIL <[email protected]>
AuthorDate: Tue Dec 1 16:42:27 2026 -0600
wl_buffer - take the canvas size from E_COMP_SIZE
e_comp_canvas_init() already honours E_COMP_SIZE for e_comp->w and
e_comp->h, but the wl_buffer backend sized its ecore_evas buffer and
its wl_output from a hardcoded 1024x768. With the variable set, the
canvas and the zone were one size while the output a client sees was
another, so a maximized window and the advertised mode disagreed.
Anyone starting a headless session at another size hits it.
The module now parses the variable the same way e_comp_canvas_init()
does and passes the result on, so the buffer, the canvas and the
output agree. An unset variable keeps 1024x768. A value that is not
WxH with both sides above 0 is refused with an error naming it and
the module does not load: before, a malformed value fell back to
1024x768 without a word and a non-positive one gave an empty canvas.
wl_buffer is Wayland only and has no X11 counterpart, so the default
suite is the one that covers it. The new test starts E with
E_COMP_SIZE=800x600 and checks the wl_output mode, the xdg_output
logical size and the room a maximized window gets.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
---
src/modules/wl_buffer/e_mod_main.c | 23 ++++-
src/tests/wayland/meson.build | 2 +
src/tests/wayland/test_output_size.c | 161 +++++++++++++++++++++++++++++++++++
3 files changed, 185 insertions(+), 1 deletion(-)
diff --git a/src/modules/wl_buffer/e_mod_main.c b/src/modules/wl_buffer/e_mod_main.c
index 02542de91..50424a8be 100644
--- a/src/modules/wl_buffer/e_mod_main.c
+++ b/src/modules/wl_buffer/e_mod_main.c
@@ -2,10 +2,31 @@
E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Buffer" };
+/* The canvas size: E_COMP_SIZE=WxH as e_comp_canvas_init() reads it, so
+ * that the canvas, the zone and the output agree, or 1024x768. */
+static Eina_Bool
+_e_wl_buffer_size_get(int *w, int *h)
+{
+ const char *size = getenv("E_COMP_SIZE");
+
+ *w = 1024;
+ *h = 768;
+ if (!size) return EINA_TRUE;
+
+ if ((sscanf(size, "%dx%d", w, h) != 2) || (*w <= 0) || (*h <= 0))
+ {
+ ERR("E_COMP_SIZE is \"%s\", expected WxH with both above 0", size);
+ return EINA_FALSE;
+ }
+ return EINA_TRUE;
+}
+
E_API void *
e_modapi_init(E_Module *m)
{
- int w = 1024, h = 768;
+ int w, h;
+
+ if (!_e_wl_buffer_size_get(&w, &h)) return NULL;
L("LOAD Wl_Buffer MODULE");
diff --git a/src/tests/wayland/meson.build b/src/tests/wayland/meson.build
index d21613cf0..ced6ad90d 100644
--- a/src/tests/wayland/meson.build
+++ b/src/tests/wayland/meson.build
@@ -100,6 +100,8 @@ wl_protocol_tests = [
['output-remove', 'test_output_remove.c'],
['buffer-scale', 'test_buffer_scale.c'],
['output-scale', 'test_output_scale.c'],
+ ['output-size', 'test_output_size.c',
+ {'E_COMP_SIZE': '800x600'}],
['buffer-transform', 'test_buffer_transform.c'],
['viewporter', 'test_viewporter.c'],
['fractional-scale', 'test_fractional_scale.c'],
diff --git a/src/tests/wayland/test_output_size.c b/src/tests/wayland/test_output_size.c
new file mode 100644
index 000000000..d4f549953
--- /dev/null
+++ b/src/tests/wayland/test_output_size.c
@@ -0,0 +1,161 @@
+/* The headless backend's output is the size it was started with: the mode
+ * a client reads from wl_output, the logical size of zxdg_output_v1 and the
+ * room a maximized window gets all follow E_COMP_SIZE (800x600 here, set by
+ * meson.build), not the backend's built-in default. */
+#include <stdio.h>
+#include <string.h>
+#include "e_wl_testkit.h"
+#include "xdg-output-unstable-v1-client-protocol.h"
+
+#define PROG "test-output-size"
+#define APP_ID "e.test.output_size"
+
+#define WANT_W 800
+#define WANT_H 600
+
+typedef struct
+{
+ int mode_w, mode_h;
+ int logical_w, logical_h;
+ int dones;
+} Size;
+
+static Size size;
+
+static void
+_geometry(void *data __attribute__((unused)), struct wl_output *o __attribute__((unused)),
+ int32_t x __attribute__((unused)), int32_t y __attribute__((unused)),
+ int32_t pw __attribute__((unused)), int32_t ph __attribute__((unused)),
+ int32_t subpixel __attribute__((unused)), const char *make __attribute__((unused)),
+ const char *model __attribute__((unused)), int32_t transform __attribute__((unused)))
+{
+}
+
+static void
+_mode(void *data __attribute__((unused)), struct wl_output *o __attribute__((unused)),
+ uint32_t flags __attribute__((unused)), int32_t w, int32_t h,
+ int32_t refresh __attribute__((unused)))
+{
+ size.mode_w = w;
+ size.mode_h = h;
+}
+
+static void
+_done(void *data __attribute__((unused)), struct wl_output *o __attribute__((unused)))
+{
+ size.dones++;
+}
+
+static void
+_scale(void *data __attribute__((unused)), struct wl_output *o __attribute__((unused)),
+ int32_t factor __attribute__((unused)))
+{
+}
+
+static void
+_name(void *data __attribute__((unused)), struct wl_output *o __attribute__((unused)),
+ const char *name __attribute__((unused)))
+{
+}
+
+static void
+_description(void *data __attribute__((unused)), struct wl_output *o __attribute__((unused)),
+ const char *description __attribute__((unused)))
+{
+}
+
+static const struct wl_output_listener _output_listener =
+{
+ _geometry, _mode, _done, _scale, _name, _description
+};
+
+static void
+_xdg_position(void *data __attribute__((unused)),
+ struct zxdg_output_v1 *o __attribute__((unused)),
+ int32_t x __attribute__((unused)), int32_t y __attribute__((unused)))
+{
+}
+
+static void
+_xdg_size(void *data __attribute__((unused)),
+ struct zxdg_output_v1 *o __attribute__((unused)), int32_t w, int32_t h)
+{
+ size.logical_w = w;
+ size.logical_h = h;
+}
+
+static void
+_xdg_done(void *data __attribute__((unused)),
+ struct zxdg_output_v1 *o __attribute__((unused)))
+{
+}
+
+static void
+_xdg_name(void *data __attribute__((unused)),
+ struct zxdg_output_v1 *o __attribute__((unused)),
+ const char *name __attribute__((unused)))
+{
+}
+
+static void
+_xdg_description(void *data __attribute__((unused)),
+ struct zxdg_output_v1 *o __attribute__((unused)),
+ const char *description __attribute__((unused)))
+{
+}
+
+static const struct zxdg_output_v1_listener _xdg_output_listener =
+{
+ _xdg_position, _xdg_size, _xdg_done, _xdg_name, _xdg_description
+};
+
+int
+main(void)
+{
+ Tk *tk;
+ Tk_Toplevel *top;
+ struct wl_output *output;
+ struct zxdg_output_manager_v1 *manager;
+ struct zxdg_output_v1 *xdg;
+ int w, h;
+
+ tk = tk_connect(PROG);
+
+ output = tk_bind(tk, &wl_output_interface, 4);
+ if (!output) tk_fail(tk, "no wl_output");
+ wl_output_add_listener(output, &_output_listener, NULL);
+ tk_sync(tk);
+ if (!size.dones) tk_fail(tk, "wl_output sent no done");
+ if ((size.mode_w != WANT_W) || (size.mode_h != WANT_H))
+ tk_fail(tk, "the output mode is %dx%d, not %dx%d", size.mode_w,
+ size.mode_h, WANT_W, WANT_H);
+
+ manager = tk_bind(tk, &zxdg_output_manager_v1_interface, 3);
+ if (!manager) tk_fail(tk, "no zxdg_output_manager_v1");
+ xdg = zxdg_output_manager_v1_get_xdg_output(manager, output);
+ zxdg_output_v1_add_listener(xdg, &_xdg_output_listener, NULL);
+ tk_sync(tk);
+ /* Since version 3 an xdg_output is completed by wl_output.done. */
+ if (size.dones != 2) tk_fail(tk, "%d wl_output done events with the xdg_output", size.dones);
+ if ((size.logical_w != WANT_W) || (size.logical_h != WANT_H))
+ tk_fail(tk, "the logical size is %dx%d, not %dx%d", size.logical_w,
+ size.logical_h, WANT_W, WANT_H);
+
+ top = tk_toplevel_new(tk, APP_ID, PROG, 200, 150);
+ tk_toplevel_paint(top, 200, 150);
+ tk_toplevel_maximize(top, 1);
+ tk_settle(tk);
+ tk_toplevel_configured(top, &w, &h, NULL);
+ if ((w <= 200) || (w > WANT_W) || (h <= 150) || (h > WANT_H))
+ tk_fail(tk, "maximized configure is %dx%d, expected above 200x150 and within %dx%d",
+ w, h, WANT_W, WANT_H);
+
+ tk_toplevel_del(top);
+ zxdg_output_v1_destroy(xdg);
+ zxdg_output_manager_v1_destroy(manager);
+ wl_output_release(output);
+ tk_sync(tk);
+ tk_disconnect(tk);
+ printf(PROG ": ok\n");
+ return 0;
+}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.