summaryrefslogtreecommitdiff
path: root/src/common/backend.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-13 13:44:13 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-13 13:44:13 +0300
commitc059e3aa7f93da470f052a5cd8ee0d8dc969e679 (patch)
tree63ffa378287ed2c606eda2e940501b9edc3d2b8b /src/common/backend.c
parent87d0bc50d53dc216efb2b04495f090616318bc5c (diff)
rename and simplification
Diffstat (limited to 'src/common/backend.c')
-rw-r--r--src/common/backend.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/common/backend.c b/src/common/backend.c
index e690697..be06136 100644
--- a/src/common/backend.c
+++ b/src/common/backend.c
@@ -152,7 +152,7 @@ void yasl_display_drag_cancel(struct yasl_display *d)
}
struct yasl_surface *yasl_create_toplevel(struct yasl_display *d,
- const struct yasl_surface_spec *spec, void *graphics_device)
+ const struct yasl_window_spec *spec, void *graphics_device)
{
if (!d || !d->ops->surface_create_toplevel || !spec ||
spec->size.x <= 0 || spec->size.y <= 0 ||
@@ -168,14 +168,19 @@ struct yasl_surface *yasl_create_toplevel(struct yasl_display *d,
errno = 0;
struct yasl_surface *s = d->ops->surface_create_toplevel(d, spec, graphics_device);
if (!s && !errno) errno = ENODEV;
- if (s && d->app_runner) {
- app_runner_register_surface(d->app_runner, s);
+ if (s) {
+ /* Native creation may dispatch events. Attach this window's callbacks
+ * only after it finishes, so callers can store the returned surface. */
+ if (d->app_runner)
+ app_runner_register_surface(d->app_runner, s);
+ else
+ yasl_surface_set_callbacks(s, spec->cbs, spec->ud);
}
return s;
}
struct yasl_surface *yasl_surface_create_toplevel(struct yasl_display *d,
- const struct yasl_surface_spec *spec)
+ const struct yasl_window_spec *spec)
{
return yasl_create_toplevel(d, spec, NULL);
}
@@ -246,11 +251,11 @@ struct yasl_display *yasl_surface_display(const struct yasl_surface *s)
return s ? s->display : NULL;
}
-void yasl_surface_set_callbacks(struct yasl_surface *s, const struct yasl_surface_cbs *cbs, void *ud)
+void yasl_surface_set_callbacks(struct yasl_surface *s, const struct yasl_window_cbs *cbs, void *ud)
{
if (!s)
return;
- s->callbacks = cbs ? *cbs : (struct yasl_surface_cbs){0};
+ s->callbacks = cbs ? *cbs : (struct yasl_window_cbs){0};
s->ud = ud;
if (s->display && s->display->ops && s->display->ops->surface_set_callbacks)
s->display->ops->surface_set_callbacks(s, cbs, ud);