From 28d12a899645be09dae7e4cb8c293bf7fc64d6ad Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Thu, 30 Nov 2023 11:34:15 -0800 Subject: 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. --- src/sdl_fb.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/sdl_fb.c') 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; -- cgit v1.2.1