From 5bc457a755a2cd99ac689da3205cce06b3e40e68 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 17 Jan 2014 21:52:05 +0100 Subject: [PATCH] rnd-20140117-2-src * changed fullscreen and window scaling changes in setup menu to have immediate effect (instead of being effective after leaving setup menu) --- ChangeLog | 2 ++ src/conftime.h | 2 +- src/events.c | 14 +++++++------- src/screens.c | 10 +++++++++- src/tools.c | 2 +- src/tools.h | 2 +- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index c1e55e26..7d65e26f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-01-17 * improved speed of displaying progress when loading levels and artwork + * changed fullscreen and window scaling changes in setup menu to have + immediate effect (instead of being effective after leaving setup menu) 2014-01-15 * fixed toons stopping on continuous touch events on Mac OS X diff --git a/src/conftime.h b/src/conftime.h index a7724675..a5b14b0c 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2014-01-17 16:49" +#define COMPILE_DATE_STRING "2014-01-17 21:42" diff --git a/src/events.c b/src/events.c index 2593dd2f..2aa963e3 100644 --- a/src/events.c +++ b/src/events.c @@ -458,10 +458,6 @@ void HandleWindowEvent(WindowEvent *event) int new_window_width = event->data1; int new_window_height = event->data2; - printf("::: RESIZED from %d, %d to %d, %d\n", - video.window_width, video.window_height, - new_window_width, new_window_height); - // if window size has changed after resizing, calculate new scaling factor if (new_window_width != video.window_width || new_window_height != video.window_height) @@ -469,6 +465,10 @@ void HandleWindowEvent(WindowEvent *event) int new_xpercent = (100 * new_window_width / video.width); int new_ypercent = (100 * new_window_height / video.height); + printf("::: RESIZED from %d, %d to %d, %d\n", + video.window_width, video.window_height, + new_window_width, new_window_height); + setup.window_scaling_percent = video.window_scaling_percent = MIN(MAX(MIN_WINDOW_SCALING_PERCENT, MIN(new_xpercent, new_ypercent)), MAX_WINDOW_SCALING_PERCENT); @@ -1112,7 +1112,7 @@ void HandleKey(Key key, int key_status) printf("::: %d\n", setup.window_scaling_percent); #endif - ToggleFullscreenIfNeeded(); + ToggleFullscreenOrChangeWindowScalingIfNeeded(); if (game_status == GAME_MODE_SETUP) RedrawSetupScreenAfterFullscreenToggle(); @@ -1121,7 +1121,7 @@ void HandleKey(Key key, int key_status) } if ((key == KSYM_minus || key == KSYM_plus || key == KSYM_0) && - (GetKeyModState() & KMOD_Control) && video.window_scaling_available && + (GetKeyModState() & KMOD_Alt) && video.window_scaling_available && !video.fullscreen_enabled) { if (key == KSYM_0) @@ -1135,7 +1135,7 @@ void HandleKey(Key key, int key_status) else if (setup.window_scaling_percent > MAX_WINDOW_SCALING_PERCENT) setup.window_scaling_percent = MAX_WINDOW_SCALING_PERCENT; - ToggleFullscreenIfNeeded(); + ToggleFullscreenOrChangeWindowScalingIfNeeded(); if (game_status == GAME_MODE_SETUP) RedrawSetupScreenAfterFullscreenToggle(); diff --git a/src/screens.c b/src/screens.c index 6951099f..23950185 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1346,7 +1346,8 @@ void DrawMainMenuExt(int fade_mask, boolean do_fading) } /* needed if last screen was the setup screen and fullscreen state changed */ - ToggleFullscreenIfNeeded(); + // (moved to "execSetupGraphics()" to change fullscreen state directly) + // ToggleFullscreenOrChangeWindowScalingIfNeeded(); /* leveldir_current may be invalid (level group, parent link) */ if (!validLevelSeries(leveldir_current)) @@ -4384,6 +4385,9 @@ static void execSetupGraphics() setup_mode = SETUP_MODE_GRAPHICS; DrawSetupScreen(); + + // window scaling may have changed at this point + ToggleFullscreenOrChangeWindowScalingIfNeeded(); } #if !defined(PLATFORM_ANDROID) @@ -5166,6 +5170,10 @@ static void changeSetupValue(int pos, int dx) } drawSetupValue(pos); + + // fullscreen state may have changed at this point + if (setup_info[pos].value == &setup.fullscreen) + ToggleFullscreenOrChangeWindowScalingIfNeeded(); } static void DrawCursorAndText_Setup(int pos, boolean active) diff --git a/src/tools.c b/src/tools.c index 5766b7af..34006e7d 100644 --- a/src/tools.c +++ b/src/tools.c @@ -9099,7 +9099,7 @@ void PlaySoundSelecting() #endif } -void ToggleFullscreenIfNeeded() +void ToggleFullscreenOrChangeWindowScalingIfNeeded() { boolean change_fullscreen = (setup.fullscreen != video.fullscreen_enabled); diff --git a/src/tools.h b/src/tools.h index b7eed06f..a09eee5a 100644 --- a/src/tools.h +++ b/src/tools.h @@ -252,7 +252,7 @@ void PlayMenuMusic(); void PlaySoundActivating(); void PlaySoundSelecting(); -void ToggleFullscreenIfNeeded(); +void ToggleFullscreenOrChangeWindowScalingIfNeeded(); void ChangeViewportPropertiesIfNeeded(); #endif /* TOOLS_H */ -- 2.34.1