diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/app.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/common/app.c b/src/common/app.c index 9ec1f6a..9d52e4a 100644 --- a/src/common/app.c +++ b/src/common/app.c @@ -332,7 +332,7 @@ static void app_runner_lost(void *ud) int yasl_run(const struct yasl_app_desc *desc) { - if (!desc || !desc->init) + if (!desc) return -1; struct app_runner runner = {.desc = desc, .running = true}; @@ -358,7 +358,20 @@ int yasl_run(const struct yasl_app_desc *desc) } d->app_runner = &runner; - if (desc->init(desc->userdata, d) == YASL_APP_QUIT) { + if (desc->window) { + struct yasl_surface *s = yasl_surface_create_toplevel(d, desc->window); + if (!s) { + int create_error = errno; + d->app_runner = NULL; + yasl_mutex_destroy(&runner.user_event_mutex); + yasl_display_close(d); + errno = create_error; + return -1; + } + yasl_surface_request_frame(s); + } + + if (desc->init && desc->init(desc->userdata, d) == YASL_APP_QUIT) { runner.running = false; } |
