From: Holger Schemel Date: Sat, 5 Sep 2020 19:38:50 +0000 (+0200) Subject: improved function to toggle fullscreen or change window scaling X-Git-Tag: 4.2.0.2~6 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=610fd714733687a10ec06da4ea70d05739b716b5;p=rocksndiamonds.git improved function to toggle fullscreen or change window scaling --- diff --git a/src/tools.c b/src/tools.c index 8ac74ac7..4affe136 100644 --- a/src/tools.c +++ b/src/tools.c @@ -9245,32 +9245,21 @@ void PlaySoundSelecting(void) void ToggleFullscreenOrChangeWindowScalingIfNeeded(void) { - boolean change_fullscreen = (setup.fullscreen != - video.fullscreen_enabled); - boolean change_window_scaling_percent = (!video.fullscreen_enabled && - setup.window_scaling_percent != - video.window_scaling_percent); - - if (change_window_scaling_percent && video.fullscreen_enabled) - return; - - if (!change_window_scaling_percent && !video.fullscreen_available) - return; - - if (change_window_scaling_percent) - { - SDLSetWindowScaling(setup.window_scaling_percent); - - return; - } - else if (change_fullscreen) + if (setup.fullscreen != video.fullscreen_enabled && + video.fullscreen_available) { SDLSetWindowFullscreen(setup.fullscreen); // set setup value according to successfully changed fullscreen mode setup.fullscreen = video.fullscreen_enabled; + } + else if (setup.window_scaling_percent != video.window_scaling_percent && + !video.fullscreen_enabled) + { + SDLSetWindowScaling(setup.window_scaling_percent); - return; + // set setup value according to successfully changed window scaling + setup.window_scaling_percent = video.window_scaling_percent; } }