From 76073fe5fad8799e5850805f2f090af2cb62c741 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 23:41:31 +0300 Subject: Simplify the public event and CPU API Applications now need far less ceremony: hello.c is a 20-line loop that handles REFRESH, CLOSE and QUIT and draws into the surface's own pixels. - Fold GEOMETRY, STATE and FOCUS into one WINDOW event carrying size, scale and state; unchanged values send nothing. - Guarantee REFRESH once a window has a size and after every resize, never at size zero. - Merge DROP_HOVER into DROP with over/leave/data actions and give drag and drop actions enums. - Keep event strings valid until the next wait and drop yasl_event_release; empty or failed waits report NONE. - Replace copy-in presentation with a lent pixel buffer: yasl_cpu_pixels and yasl_cpu_present. - Remove yasl_poll_event, yasl_cpu_read_pixels, unused event fields and comments that restated names. - Wayland: resize floating windows in request_size instead of reporting it unsupported, and stop marking new GPU surfaces as Vulkan so yasl_vulkan_create_surface no longer fails with NATIVE_WINDOW_IN_USE. Also includes the in-progress public API refactor that was uncommitted in the tree (removal of the app/loop layer, new surface, GL and Vulkan entry points). Co-Authored-By: Claude Opus 5.5 --- tests/x11/test_state.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tests/x11/test_state.c') diff --git a/tests/x11/test_state.c b/tests/x11/test_state.c index abc0851..4696e60 100644 --- a/tests/x11/test_state.c +++ b/tests/x11/test_state.c @@ -31,7 +31,7 @@ int state_property(Display *display, Window window, Atom property, static void state_changed(struct yasl_surface *surface, uint32_t state, void *ud) { (void)ud; - assert(yasl_surface_state(surface) == state); + assert(yasl_private_surface_state(surface) == state); reported_state = state; notifications++; } @@ -93,39 +93,39 @@ static void test_xsettings(void) int main(void) { test_xsettings(); - struct x11_display display = {.base.ops = &yasl_x11_backend, + struct x11_display display = {.base.ops = &yasl_private_x11_backend, .net_state = 10, .fullscreen = 20, .maximized_h = 21, .maximized_v = 22}; display.native = (Display *)&display; struct x11_surface surface = {.base = {.display = &display.base, - .state = YASL_STATE_ACTIVATED}, .window = 42}; - set_callbacks(&surface.base, &(struct yasl_window_cbs){.state = state_changed}, NULL); + .state = YASL_PRIVATE_STATE_ACTIVATED}, .window = 42}; + set_callbacks(&surface.base, &(struct yasl_private_window_cbs){.state = state_changed}, NULL); properties[0] = display.fullscreen; property_count = 1; update_state(&surface); assert(notifications == 1); - assert(reported_state == (YASL_STATE_FULLSCREEN | YASL_STATE_ACTIVATED)); + assert(reported_state == (YASL_PRIVATE_STATE_FULLSCREEN | YASL_PRIVATE_STATE_ACTIVATED)); update_state(&surface); assert(notifications == 1); /* Both maximized axes are required; activation survives property changes. */ properties[0] = display.maximized_h; update_state(&surface); - assert(notifications == 2 && reported_state == YASL_STATE_ACTIVATED); + assert(notifications == 2 && reported_state == YASL_PRIVATE_STATE_ACTIVATED); properties[1] = display.maximized_v; property_count = 2; update_state(&surface); assert(notifications == 3); - assert(reported_state == (YASL_STATE_MAXIMIZED | YASL_STATE_ACTIVATED)); + assert(reported_state == (YASL_PRIVATE_STATE_MAXIMIZED | YASL_PRIVATE_STATE_ACTIVATED)); properties[2] = display.fullscreen; property_count = 3; update_state(&surface); assert(notifications == 4); - assert(reported_state == (YASL_STATE_FULLSCREEN | YASL_STATE_MAXIMIZED | YASL_STATE_ACTIVATED)); + assert(reported_state == (YASL_PRIVATE_STATE_FULLSCREEN | YASL_PRIVATE_STATE_MAXIMIZED | YASL_PRIVATE_STATE_ACTIVATED)); property_count = 0; update_state(&surface); - assert(notifications == 5 && reported_state == YASL_STATE_ACTIVATED); + assert(notifications == 5 && reported_state == YASL_PRIVATE_STATE_ACTIVATED); update_state(&surface); assert(notifications == 5); return 0; -- cgit v1.2.3