diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2022-07-15 15:09:01 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2022-07-15 15:09:01 -0700 |
commit | 8bd50ffd4ba81cb9c5197bcae926e177cc7a8987 (patch) | |
tree | 0a2c50fed2c7b800fade874fd33ce99806d90fb7 /src/main.c | |
parent | f1e59ffe5607ae8b84f03f153cacb27bc3024bac (diff) |
til_fb: switch til_fb_ops_t.init() to use til_setup_t
Until now the fb init has been receiving a til_settings_t to
access its setup. Now that there's a til_setup_t for
representing the fully baked setup, let's bring the fb stuff
up to speed so their init() behaves more like
til_module_t.create_context() WRT settings/setup.
This involves some reworking of how settings are handled in
{drm,sdl}_fb.c but nothing majorly different.
The only real funcitonal change that happened in the course of
this work is I made it possible now to actually instruct SDL to
do a more legacy SDL_WINDOW_FULLSCREEN vs.
SDL_WINDOW_FULLSCREEN_DESKTOP where SDL will attempt to switch
the video mode.
This is triggered by specifying both a size=WxH and fullscreen=on
for video=sdl. Be careful though, I've observed some broken
display states when specifying goofy sizes, which look like Xorg
bugs.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -50,9 +50,9 @@ static rototiller_t rototiller; typedef struct setup_t { - til_settings_t *module; + til_settings_t *module_settings; til_setup_t *module_setup; - til_settings_t *video; + til_settings_t *video_settings; til_setup_t *video_setup; } setup_t; @@ -126,21 +126,21 @@ static int setup_from_args(til_args_t *args, setup_t *res_setup, const til_setti int r = -ENOMEM, changes = 0; setup_t setup = {}; - setup.module = til_settings_new(args->module); - if (!setup.module) + setup.module_settings = til_settings_new(args->module); + if (!setup.module_settings) goto _err; - setup.video = til_settings_new(args->video); - if (!setup.video) + setup.video_settings = til_settings_new(args->video); + if (!setup.video_settings) goto _err; - r = setup_interactively(setup.module, til_module_setup, args->use_defaults, &setup.module_setup, res_failed_desc); + r = setup_interactively(setup.module_settings, til_module_setup, args->use_defaults, &setup.module_setup, res_failed_desc); if (r < 0) goto _err; if (r) changes = 1; - r = setup_interactively(setup.video, setup_video, args->use_defaults, &setup.video_setup, res_failed_desc); + r = setup_interactively(setup.video_settings, setup_video, args->use_defaults, &setup.video_setup, res_failed_desc); if (r < 0) goto _err; if (r) @@ -151,8 +151,8 @@ static int setup_from_args(til_args_t *args, setup_t *res_setup, const til_setti return changes; _err: - til_settings_free(setup.module); - til_settings_free(setup.video); + til_settings_free(setup.module_settings); + til_settings_free(setup.video_settings); return r; } @@ -164,14 +164,14 @@ static int print_setup_as_args(setup_t *setup) char buf[64]; int r; - module_args = til_settings_as_arg(setup->module); + module_args = til_settings_as_arg(setup->module_settings); if (!module_args) { r = -ENOMEM; goto _out; } - video_args = til_settings_as_arg(setup->video); + video_args = til_settings_as_arg(setup->video_settings); if (!video_args) { r = -ENOMEM; @@ -267,10 +267,10 @@ int main(int argc, const char *argv[]) exit_if(!args.gogogo && r && print_setup_as_args(&setup) < 0, "unable to print setup"); - exit_if(!(rototiller.module = til_lookup_module(til_settings_get_key(setup.module, 0, NULL))), - "unable to lookup module from settings \"%s\"", til_settings_get_key(setup.module, 0, NULL)); + exit_if(!(rototiller.module = til_lookup_module(til_settings_get_key(setup.module_settings, 0, NULL))), + "unable to lookup module from settings \"%s\"", til_settings_get_key(setup.module_settings, 0, NULL)); - exit_if((r = til_fb_new(fb_ops, setup.video, NUM_FB_PAGES, &rototiller.fb)) < 0, + exit_if((r = til_fb_new(fb_ops, setup.video_setup, NUM_FB_PAGES, &rototiller.fb)) < 0, "unable to create fb: %s", strerror(-r)); exit_if(!fps_setup(), |