From: Holger Schemel Date: Sat, 5 Sep 2020 23:29:23 +0000 (+0200) Subject: changed function logic for changing fullscreen/scaling/vsync to match X-Git-Tag: 4.2.0.2~3 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=95d4b893f159c0b3541b8f0a33d789f44f38646c;p=rocksndiamonds.git changed function logic for changing fullscreen/scaling/vsync to match --- diff --git a/src/tools.c b/src/tools.c index d44e2cb4..6fab5c19 100644 --- a/src/tools.c +++ b/src/tools.c @@ -9245,26 +9245,28 @@ void PlaySoundSelecting(void) void ToggleFullscreenIfNeeded(void) { - if (setup.fullscreen != video.fullscreen_enabled && - video.fullscreen_available) - { - SDLSetWindowFullscreen(setup.fullscreen); + // if setup and video fullscreen state are already matching, nothing do do + if (setup.fullscreen == video.fullscreen_enabled || + !video.fullscreen_available) + return; - // set setup value according to successfully changed fullscreen mode - setup.fullscreen = video.fullscreen_enabled; - } + SDLSetWindowFullscreen(setup.fullscreen); + + // set setup value according to successfully changed fullscreen mode + setup.fullscreen = video.fullscreen_enabled; } void ChangeWindowScalingIfNeeded(void) { - if (setup.window_scaling_percent != video.window_scaling_percent && - !video.fullscreen_enabled) - { - SDLSetWindowScaling(setup.window_scaling_percent); + // if setup and video window scaling are already matching, nothing do do + if (setup.window_scaling_percent == video.window_scaling_percent || + video.fullscreen_enabled) + return; - // set setup value according to successfully changed window scaling - setup.window_scaling_percent = video.window_scaling_percent; - } + SDLSetWindowScaling(setup.window_scaling_percent); + + // set setup value according to successfully changed window scaling + setup.window_scaling_percent = video.window_scaling_percent; } void ChangeVsyncModeIfNeeded(void)