From 6eac0a5f2c552728efca420b1129fae7d4fea773 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Sun, 11 Oct 2026 23:40:57 +0300 Subject: feat: backend selection (Wayland, X11, Cocoa) --- include/yasl/yasl.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/yasl/yasl.h') diff --git a/include/yasl/yasl.h b/include/yasl/yasl.h index 0c2235a..2574457 100644 --- a/include/yasl/yasl.h +++ b/include/yasl/yasl.h @@ -258,14 +258,25 @@ struct yasl_surface_cbs { }; /* Display Lifecycle */ +enum yasl_backend { + YASL_BACKEND_AUTO = 0, + YASL_BACKEND_WAYLAND, + YASL_BACKEND_X11, + YASL_BACKEND_COCOA, +}; + struct yasl_display_spec { const char *app_id; const struct yasl_display_cbs *cbs; void *ud; + /* Zero selects the native backend. An explicit choice never falls back. */ + enum yasl_backend backend; }; +/* Return NULL and set errno if the requested backend cannot open. */ YASL_API struct yasl_display *yasl_display_open(struct yasl_loop *loop, const struct yasl_display_spec *spec); +YASL_API enum yasl_backend yasl_display_backend(const struct yasl_display *d); YASL_API void yasl_display_close(struct yasl_display *d); YASL_API uint32_t yasl_display_caps(const struct yasl_display *d); YASL_API void yasl_display_dispatch(struct yasl_display *d); @@ -285,6 +296,7 @@ struct yasl_surface_spec { struct yasl_vector2i size; bool fullscreen; bool tearing; + /* Optional native graphics device. NULL selects CPU pixel presentation. */ void *graphics_device; }; -- cgit v1.2.3