summaryrefslogtreecommitdiff
path: root/src/wayland/surface.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-12 08:41:51 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-12 08:41:51 +0300
commit3b8af02be94a510e385f44d58c35c86bb89424a6 (patch)
tree2573fb5ac41700d458109ee1cea4bfd875ecf1a2 /src/wayland/surface.c
parentf7fa0930cb46046f995fa1ab927aef62466e995e (diff)
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.
Diffstat (limited to 'src/wayland/surface.c')
-rw-r--r--src/wayland/surface.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/src/wayland/surface.c b/src/wayland/surface.c
index 4f064e2..f291190 100644
--- a/src/wayland/surface.c
+++ b/src/wayland/surface.c
@@ -148,13 +148,13 @@ int wayland_display_dispatch_timeout(struct wayland_display *c, int timeout_ms)
return -1;
}
- bool had_pending = display_arm(c);
+ display_arm(c);
if (c->lost) {
display_leave(c);
return -1;
}
- if (had_pending && timeout_ms != 0 && display_has_immediate_work(c)) {
+ if (timeout_ms != 0 && display_has_immediate_work(c)) {
timeout_ms = 0;
}
@@ -177,14 +177,6 @@ int wayland_display_dispatch_timeout(struct wayland_display *c, int timeout_ms)
return n;
}
-void wayland_display_dispatch(struct wayland_display *c)
-{
- if (unlikely(!c || c->lost))
- return;
- int timeout = (display_has_immediate_work(c) || yasl_loop_is_running(c->loop)) ? 0 : -1;
- wayland_display_dispatch_timeout(c, timeout);
-}
-
void wayland_display_flush(struct wayland_display *c)
{
if (!c || c->lost)
@@ -342,8 +334,9 @@ static bool spec_valid(const struct yasl_surface_spec *spec)
}
struct wayland_surface *wayland_surface_create_toplevel(struct wayland_display *c,
- const struct yasl_surface_spec *spec)
+ const struct yasl_surface_spec *spec, void *graphics_device)
{
+ (void)graphics_device;
if (!c || c->lost || !spec_valid(spec))
return NULL;
int width = spec->size.x, height = spec->size.y;
@@ -457,14 +450,12 @@ void wayland_surface_schedule_redraw(struct wayland_surface *w)
yasl_loop_kick(w->conn->loop);
}
-struct yasl_vector2i wayland_surface_size(const struct wayland_surface *w)
+struct yasl_geometry wayland_surface_geometry(const struct wayland_surface *w)
{
- return w ? (struct yasl_vector2i){ .x = w->width, .y = w->height } : (struct yasl_vector2i){0};
-}
-
-uint32_t wayland_surface_scale_120(const struct wayland_surface *w)
-{
- return w ? w->scale_120 : YASL_SCALE_UNIT;
+ return (struct yasl_geometry){
+ .size = w ? (struct yasl_vector2i){w->width, w->height} : (struct yasl_vector2i){0},
+ .scale_120 = w ? w->scale_120 : YASL_SCALE_UNIT,
+ };
}
void wayland_surface_set_background_color(struct wayland_surface *w, uint32_t bg)