diff options
author | Harry Jeffery <harry@exec64.co.uk> | 2017-11-28 22:45:28 +0000 |
---|---|---|
committer | Harry Jeffery <harry@exec64.co.uk> | 2017-11-28 22:45:28 +0000 |
commit | d9d1a7c603386716638e6a62a7cc97d02e3d1e53 (patch) | |
tree | 3c08bf9e242b4edf1e5019c3498d4772bbc8415e | |
parent | d990a01c2176d939fbbf40b4afdd7a78520f7575 (diff) | |
download | imv-d9d1a7c603386716638e6a62a7cc97d02e3d1e53.tar.gz |
Add stay_fullscreen_on_focus_loss option
Fixes #103
-rw-r--r-- | files/imv_config | 3 | ||||
-rw-r--r-- | src/imv.c | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/files/imv_config b/files/imv_config index 08afc48..fc0f4b2 100644 --- a/files/imv_config +++ b/files/imv_config @@ -32,6 +32,9 @@ # Font to use for the overlay # overlay_font = Monospace:24 +# Stay fullscreen when we lose focus +# stay_fullscreen_on_focus_loss = true + # Disable imv's builtin binds so they don't conflict with the ones in this config suppress_default_binds = true @@ -46,6 +46,7 @@ struct imv { bool fullscreen; bool overlay_enabled; bool nearest_neighbour; + bool stay_fullscreen_on_focus_loss; bool need_redraw; bool need_rescale; bool recursive_load; @@ -135,6 +136,7 @@ struct imv *imv_create(void) imv->fullscreen = false; imv->overlay_enabled = false; imv->nearest_neighbour = false; + imv->stay_fullscreen_on_focus_loss = false; imv->need_redraw = true; imv->need_rescale = true; imv->recursive_load = false; @@ -611,6 +613,10 @@ static bool setup_window(struct imv *imv) SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, imv->nearest_neighbour ? "0" : "1"); + /* allow fullscreen to be maintained even when focus is lost */ + SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS, + imv->stay_fullscreen_on_focus_loss ? "0" : "1"); + /* construct a chequered background image */ if(imv->background_type == BACKGROUND_CHEQUERED) { imv->background_image = create_chequered(imv->renderer); @@ -897,6 +903,11 @@ static int handle_ini_value(void *user, const char *section, const char *name, return 1; } + if(!strcmp(name, "stay_fullscreen_on_focus_loss")) { + imv->stay_fullscreen_on_focus_loss = parse_bool(value); + return 1; + } + if(!strcmp(name, "recursive")) { imv->recursive_load = parse_bool(value); return 1; |