diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-11-30 11:34:15 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-11-30 11:44:14 -0800 |
commit | 28d12a899645be09dae7e4cb8c293bf7fc64d6ad (patch) | |
tree | ad195d50f3d488521add9f81f7fd291fc7d92743 /src/sdl_fb.c | |
parent | 97b3dd17c1499c7ffd6d429a01d64ceaed233df2 (diff) |
til: wire up til_video_setup_t throughout *_fb
Preparatory commit for aspect ratio settings at the fb layer.
This slightly reworks how main::setup_video() integrates the
selected fb backend's setup_func to better resemble how the
module setup_funcs work now, with more clearly separated
settings-building and setup-baking/finalizing phases. Which
makes inserting the ratio setting in the middle of the front-end
and back-end setup_funcs fairly trivial.
Not a fan of all the casts, but there will probably be more
helpers introduced to take care of that and make
til_video_setup_t more of a first-class thing facilitating the fb
stuff.
Diffstat (limited to 'src/sdl_fb.c')
-rw-r--r-- | src/sdl_fb.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/sdl_fb.c b/src/sdl_fb.c index 64ea593..d2d4d70 100644 --- a/src/sdl_fb.c +++ b/src/sdl_fb.c @@ -6,15 +6,16 @@ #include "til_fb.h" #include "til_settings.h" +#include "til_video_setup.h" /* sdl fb backend, everything sdl-specific in rototiller resides here. */ typedef struct sdl_fb_setup_t { - til_setup_t til_setup; - int fullscreen:1; - int vsync:1; - unsigned width, height; + til_video_setup_t til_video_setup; + int fullscreen:1; + int vsync:1; + unsigned width, height; } sdl_fb_setup_t; typedef struct sdl_fb_page_t sdl_fb_page_t; @@ -54,7 +55,7 @@ static int sdl_err_to_errno(int err) } } -static int sdl_fb_init(const char *title, const til_setup_t *setup, void **res_context) +static int sdl_fb_init(const char *title, const til_video_setup_t *setup, void **res_context) { sdl_fb_setup_t *s = (sdl_fb_setup_t *)setup; sdl_fb_t *c; @@ -374,9 +375,9 @@ static int sdl_fb_setup(const til_settings_t *settings, til_setting_t **res_sett setup->vsync = 1; if (size && sscanf(size->value, "%u%*[xX]%u", &setup->width, &setup->height) != 2) - return til_setup_free_with_failed_setting_ret_err(&setup->til_setup, size, res_setting, -EINVAL); + return til_setup_free_with_failed_setting_ret_err(&setup->til_video_setup.til_setup, size, res_setting, -EINVAL); - *res_setup = &setup->til_setup; + *res_setup = &setup->til_video_setup.til_setup; } return 0; |