summaryrefslogtreecommitdiff
path: root/tests/x11/test_state.c
diff options
context:
space:
mode:
authorBerke Güzel <berke.guzel@gdh.digital>2026-10-14 09:38:31 +0300
committerBerke Güzel <berke.guzel@gdh.digital>2026-10-14 09:38:31 +0300
commit5ef6ca21ab9e1cf4f69254234d190a634b777d52 (patch)
tree974d3797a6d9487e54a811e224bf78a3f52dda85 /tests/x11/test_state.c
parent563b23a33726289387193b85d90fb569631ee05f (diff)
Remove deprecated Cocoa OpenGL and private compatibility APIs
Diffstat (limited to 'tests/x11/test_state.c')
-rw-r--r--tests/x11/test_state.c25
1 files changed, 19 insertions, 6 deletions
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;
}