From 3b8af02be94a510e385f44d58c35c86bb89424a6 Mon Sep 17 00:00:00 2001 From: Berke Güzel Date: Mon, 12 Oct 2026 08:41:51 +0300 Subject: refactor: simplify public API and isolate native extensions Separate loop/timer and native interoperability APIs from the portable surface header. Unify dispatch, geometry queries, and timer callbacks; keep framebuffer bookkeeping and frame clocks private, and hide implementation symbols. Update backends, documentation, examples, and API/integration coverage. Verify exports, strict C/C++ installed consumers, and normal plus ASan/UBSan suites. --- src/common/backend.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/common/backend.h') diff --git a/src/common/backend.h b/src/common/backend.h index b52a147..6ab7248 100644 --- a/src/common/backend.h +++ b/src/common/backend.h @@ -2,6 +2,8 @@ #define YASL_BACKEND_H #include "yasl/yasl.h" +#include "yasl/loop.h" +#include "yasl/native.h" struct yasl_backend_ops; @@ -21,6 +23,8 @@ struct yasl_surface { }; void yasl_surface_clear_timers(struct yasl_surface *s); +struct yasl_surface *yasl_create_toplevel(struct yasl_display *d, + const struct yasl_surface_spec *spec, void *graphics_device); static inline uint64_t yasl_frame_begin(struct yasl_surface *s) { @@ -33,7 +37,6 @@ struct yasl_backend_ops { struct yasl_display *(*display_open)(struct yasl_loop *loop, const struct yasl_display_spec *spec); void (*display_close)(struct yasl_display *d); uint32_t (*display_caps)(const struct yasl_display *d); - void (*display_dispatch)(struct yasl_display *d); int (*display_dispatch_timeout)(struct yasl_display *d, int timeout_ms); void (*display_flush)(struct yasl_display *d); int (*display_modifiers)(const struct yasl_display *d); @@ -41,7 +44,8 @@ struct yasl_backend_ops { void (*display_paste)(struct yasl_display *d, enum yasl_selection sel, struct yasl_surface *target); bool (*display_drag_start)(struct yasl_display *d, struct yasl_surface *origin, const struct yasl_drag_image *image, const struct yasl_drag_listener *l, void *ud); void (*display_drag_cancel)(struct yasl_display *d); - struct yasl_surface *(*surface_create_toplevel)(struct yasl_display *d, const struct yasl_surface_spec *spec); + struct yasl_surface *(*surface_create_toplevel)(struct yasl_display *d, + const struct yasl_surface_spec *spec, void *graphics_device); struct yasl_surface *(*surface_create_popup)(struct yasl_surface *parent, const struct yasl_popup_spec *spec); bool (*surface_popup_reposition)(struct yasl_surface *popup, const struct yasl_popup_spec *spec); void (*surface_destroy)(struct yasl_surface *s); @@ -51,8 +55,7 @@ struct yasl_backend_ops { void (*surface_schedule_redraw)(struct yasl_surface *s); bool (*surface_present)(struct yasl_surface *s, const struct yasl_framebuffer *fb, const struct yasl_damage_list *damage); bool (*surface_input_poll)(struct yasl_surface *s, struct yasl_input_event *ev); - struct yasl_vector2i (*surface_size)(const struct yasl_surface *s); - uint32_t (*surface_scale_120)(const struct yasl_surface *s); + struct yasl_geometry (*surface_geometry)(const struct yasl_surface *s); uint32_t (*surface_state)(const struct yasl_surface *s); struct yasl_timing (*surface_timing)(const struct yasl_surface *s); uint64_t (*surface_frame_time_ns)(struct yasl_surface *s, uint64_t now); @@ -68,6 +71,8 @@ struct yasl_backend_ops { bool (*surface_place_under_pointer)(struct yasl_surface *s, struct yasl_vector2i at); void *(*display_get_native_handle)(struct yasl_display *d); void *(*surface_get_native_handle)(struct yasl_surface *s); + bool (*surface_get_native_frame)(struct yasl_surface *s, + const struct yasl_framebuffer *target, struct yasl_native_frame *out); }; #if YASL_HAS_WAYLAND -- cgit v1.2.3