diff options
-rw-r--r-- | doc/imv.5.txt | 6 | ||||
-rw-r--r-- | src/imv.c | 20 |
2 files changed, 20 insertions, 6 deletions
diff --git a/doc/imv.5.txt b/doc/imv.5.txt index 14a31b9..cb12eb3 100644 --- a/doc/imv.5.txt +++ b/doc/imv.5.txt @@ -31,6 +31,12 @@ The *[options]* section accepts the following settings: *fullscreen* = <true|false>:: Start imv fullscreen. Defaults to 'false'. +*width* = <width>:: + Initial width of the imv window. Defaults to 1280. + +*height* = <height>:: + Initial height of the imv window. Defaults to 720. + *list_files_at_exit* = <true|false>:: Print open files to stdout at exit, each on a separate line. Defaults to 'false'. @@ -51,6 +51,8 @@ struct imv { bool quit; bool loading; bool fullscreen; + int initial_width; + int initial_height; bool overlay_enabled; enum upscaling_method upscaling_method; bool stay_fullscreen_on_focus_loss; @@ -147,6 +149,8 @@ struct imv *imv_create(void) imv->quit = false; imv->loading = false; imv->fullscreen = false; + imv->initial_width = 1280; + imv->initial_height = 720; imv->overlay_enabled = false; imv->upscaling_method = UPSCALING_LINEAR; imv->stay_fullscreen_on_focus_loss = false; @@ -651,16 +655,11 @@ static bool setup_window(struct imv *imv) imv->sdl_init = true; - /* width and height arbitrarily chosen. Perhaps there's a smarter way to - * set this */ - const int width = 1280; - const int height = 720; - imv->window = SDL_CreateWindow( "imv", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, - width, height, + imv->initial_width, imv->initial_height, SDL_WINDOW_RESIZABLE); if(!imv->window) { @@ -955,6 +954,15 @@ static int handle_ini_value(void *user, const char *section, const char *name, return 1; } + if(!strcmp(name, "width")) { + imv->initial_width = strtol(value, NULL, 10); + return 1; + } + if(!strcmp(name, "height")) { + imv->initial_height = strtol(value, NULL, 10); + return 1; + } + if(!strcmp(name, "overlay")) { imv->overlay_enabled = parse_bool(value); return 1; |