From 482f799d356a8fbb8f585c4de7cc0992b8dc6fd3 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Tue, 13 Oct 2026 15:41:39 +0300 Subject: Migrate tests to the unified event API Port backend, input, tablet and app tests from yasl_input_event and YASL_INPUT_* to struct yasl_event and YASL_EVENT_*. The input allocation test links input.c on its own, so it stubs yasl_loop_now_ns() for the new event timestamps. Co-Authored-By: Claude Opus 5.5 --- tests/x11/test_tablet_native.c | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 'tests/x11/test_tablet_native.c') diff --git a/tests/x11/test_tablet_native.c b/tests/x11/test_tablet_native.c index 078606a..b0d1366 100644 --- a/tests/x11/test_tablet_native.c +++ b/tests/x11/test_tablet_native.c @@ -70,32 +70,12 @@ static void native_draw(struct yasl_surface *surface, struct yasl_frame *frame, static void native_configure(struct yasl_surface *surface, struct yasl_geometry geometry, void *ud) { input(ud, &(struct yasl_event){.surface = surface, .type = YASL_EVENT_WINDOW_RESIZE, - .resize = {.size = geometry.size, .scale_120 = geometry.scale_120}}); + .resize = {.geometry = geometry}}); } -static void native_input(struct app *app, const struct yasl_input_event *raw) +static void native_input(struct app *app, const struct yasl_event *event) { - struct yasl_event event = {.surface = raw->surface}; - if (raw->kind == YASL_INPUT_RESET) event.type = YASL_EVENT_INPUT_RESET; - else if (raw->kind == YASL_INPUT_FOCUS) { - event.type = YASL_EVENT_WINDOW_FOCUS; - event.focus.focused = raw->focus.focused; - } else if (raw->kind == YASL_INPUT_MOUSE) { - if (raw->mouse.kind == YASL_PTR_MOTION) { - event.type = YASL_EVENT_MOUSE_MOTION; - event.mouse_motion.pos = raw->mouse.pos; - event.mouse_motion.device = raw->mouse.device; - event.mouse_motion.pen = raw->mouse.pen; - } else if (raw->mouse.kind == YASL_PTR_PRESS || raw->mouse.kind == YASL_PTR_RELEASE) { - event.type = YASL_EVENT_MOUSE_BUTTON; - event.mouse_button.pos = raw->mouse.pos; - event.mouse_button.device = raw->mouse.device; - event.mouse_button.button = raw->mouse.button; - event.mouse_button.pressed = raw->mouse.kind == YASL_PTR_PRESS; - event.mouse_button.pen = raw->mouse.pen; - } else if (raw->mouse.kind == YASL_PTR_LEAVE) event.type = YASL_EVENT_MOUSE_LEAVE; - } - input(app, &event); + input(app, event); } static void pump(int fd, struct yasl_display *display, struct yasl_surface *surface, struct app *app) @@ -109,8 +89,8 @@ static void pump(int fd, struct yasl_display *display, struct yasl_surface *surf * Round-trip on YASL's X connection before draining its event queue. */ XSync(yasl_display_get_native_handle(display), False); assert(yasl_display_dispatch(display, 0) == 0); - struct yasl_input_event event; - while (yasl_surface_input_poll(surface, &event)) { + struct yasl_event event; + while (yasl_surface_poll_event(surface, &event)) { native_input(app, &event); yasl_surface_schedule_redraw(surface); } -- cgit v1.2.3