From 5ef6ca21ab9e1cf4f69254234d190a634b777d52 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Wed, 14 Oct 2026 09:38:31 +0300 Subject: Remove deprecated Cocoa OpenGL and private compatibility APIs --- tests/x11/test_state.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'tests/x11/test_state.c') diff --git a/tests/x11/test_state.c b/tests/x11/test_state.c index 4696e60..0c36638 100644 --- a/tests/x11/test_state.c +++ b/tests/x11/test_state.c @@ -28,12 +28,15 @@ int state_property(Display *display, Window window, Atom property, return Success; } -static void state_changed(struct yasl_surface *surface, uint32_t state, void *ud) +static void collect(struct yasl_private_display *display) { - (void)ud; - assert(yasl_private_surface_state(surface) == state); - reported_state = state; - notifications++; + struct yasl_private_event event; + while (yasl_private_display_poll_event(display, &event)) { + assert(event.type == YASL_PRIVATE_EVENT_WINDOW_STATE); + assert(yasl_private_surface_state(event.surface) == event.state.flags); + reported_state = event.state.flags; + notifications++; + } } /* Build an XSETTINGS blob in either byte order. */ @@ -98,35 +101,45 @@ int main(void) display.native = (Display *)&display; struct x11_surface surface = {.base = {.display = &display.base, .state = YASL_PRIVATE_STATE_ACTIVATED}, .window = 42}; - set_callbacks(&surface.base, &(struct yasl_private_window_cbs){.state = state_changed}, NULL); + assert(yasl_private_events_open(&display.base)); + assert(yasl_private_events_register(&surface.base)); properties[0] = display.fullscreen; property_count = 1; update_state(&surface); + collect(&display.base); assert(notifications == 1); assert(reported_state == (YASL_PRIVATE_STATE_FULLSCREEN | YASL_PRIVATE_STATE_ACTIVATED)); update_state(&surface); + collect(&display.base); assert(notifications == 1); /* Both maximized axes are required; activation survives property changes. */ properties[0] = display.maximized_h; update_state(&surface); + collect(&display.base); assert(notifications == 2 && reported_state == YASL_PRIVATE_STATE_ACTIVATED); properties[1] = display.maximized_v; property_count = 2; update_state(&surface); + collect(&display.base); assert(notifications == 3); assert(reported_state == (YASL_PRIVATE_STATE_MAXIMIZED | YASL_PRIVATE_STATE_ACTIVATED)); properties[2] = display.fullscreen; property_count = 3; update_state(&surface); + collect(&display.base); assert(notifications == 4); assert(reported_state == (YASL_PRIVATE_STATE_FULLSCREEN | YASL_PRIVATE_STATE_MAXIMIZED | YASL_PRIVATE_STATE_ACTIVATED)); property_count = 0; update_state(&surface); + collect(&display.base); assert(notifications == 5 && reported_state == YASL_PRIVATE_STATE_ACTIVATED); update_state(&surface); + collect(&display.base); assert(notifications == 5); + yasl_private_events_unregister(&surface.base); + yasl_private_events_close(&display.base); return 0; } -- cgit v1.2.3