From ed963bba0b234d52fda14b2a8237dbf02ef4d655 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 16:24:56 +0300 Subject: Quit on window close when the app has no event callback Without yasl_app_desc.event, a close request had nowhere to go and the window stayed open. The runner now stops instead, so hello drops its event callback. Co-Authored-By: Claude Opus 5.5 --- tests/wayland/test_app_input.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/wayland') diff --git a/tests/wayland/test_app_input.c b/tests/wayland/test_app_input.c index 843f38d..88f9ead 100644 --- a/tests/wayland/test_app_input.c +++ b/tests/wayland/test_app_input.c @@ -26,6 +26,15 @@ static void push_key(struct yasl_surface *s) static enum yasl_app_result on_init(void *ud, struct yasl_display *d) { struct test_state *state = ud; + if (state->end == 3) { + /* With no event callback, a close request alone stops the runner. */ + struct yasl_surface *s = yasl_surface_create_toplevel(d, + &(struct yasl_window_spec){ .title = "App Close Test", .size = {64, 64} }); + assert(s); + struct wayland_surface *w = (struct wayland_surface *)s; + w->cbs->close(s, w->ud); + return YASL_APP_CONTINUE; + } if (state->end) { struct wayland_display *display = (struct wayland_display *)d; if (state->end == 1) @@ -107,5 +116,10 @@ int main(void) }); assert(end == 1 ? res == 0 : res < 0); } + state = (struct test_state){.end = 3}; + res = yasl_run(&(struct yasl_app_desc){ + .backend = YASL_BACKEND_WAYLAND, .userdata = &state, .init = on_init, + }); + assert(res == 0); return 0; } -- cgit v1.2.3