Add stay_fullscreen_on_focus_loss option

Fixes #103
This commit is contained in:
Harry Jeffery 2017-11-28 22:45:28 +00:00
parent d990a01c21
commit d9d1a7c603
2 changed files with 14 additions and 0 deletions

View file

@ -32,6 +32,9 @@
# Font to use for the overlay # Font to use for the overlay
# overlay_font = Monospace:24 # 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 # Disable imv's builtin binds so they don't conflict with the ones in this config
suppress_default_binds = true suppress_default_binds = true

View file

@ -46,6 +46,7 @@ struct imv {
bool fullscreen; bool fullscreen;
bool overlay_enabled; bool overlay_enabled;
bool nearest_neighbour; bool nearest_neighbour;
bool stay_fullscreen_on_focus_loss;
bool need_redraw; bool need_redraw;
bool need_rescale; bool need_rescale;
bool recursive_load; bool recursive_load;
@ -135,6 +136,7 @@ struct imv *imv_create(void)
imv->fullscreen = false; imv->fullscreen = false;
imv->overlay_enabled = false; imv->overlay_enabled = false;
imv->nearest_neighbour = false; imv->nearest_neighbour = false;
imv->stay_fullscreen_on_focus_loss = false;
imv->need_redraw = true; imv->need_redraw = true;
imv->need_rescale = true; imv->need_rescale = true;
imv->recursive_load = false; imv->recursive_load = false;
@ -611,6 +613,10 @@ static bool setup_window(struct imv *imv)
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY,
imv->nearest_neighbour ? "0" : "1"); 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 */ /* construct a chequered background image */
if(imv->background_type == BACKGROUND_CHEQUERED) { if(imv->background_type == BACKGROUND_CHEQUERED) {
imv->background_image = create_chequered(imv->renderer); 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; 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")) { if(!strcmp(name, "recursive")) {
imv->recursive_load = parse_bool(value); imv->recursive_load = parse_bool(value);
return 1; return 1;