From 6fc4bef0e38ef4e2b3fe015283e4705e1600afaa Mon Sep 17 00:00:00 2001 From: Oliver Bechstein-Rumble <58312347+OllieBechstein@users.noreply.github.com> Date: Fri, 24 Oct 2025 20:33:55 +0100 Subject: [PATCH] Fix #14240: Remember previous GUI scale when toggling auto-detect (#14380) --- src/settings_gui.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index af466bf40b..7b0c9e1a15 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -415,6 +415,7 @@ struct GameOptionsWindow : Window { bool reload = false; bool gui_scale_changed = false; int gui_scale = 0; + static inline int previous_gui_scale = 0; ///< Previous GUI scale. static inline WidgetID active_tab = WID_GO_TAB_GENERAL; GameOptionsWindow(WindowDesc &desc) : Window(desc), filter_editbox(50) @@ -1076,9 +1077,12 @@ struct GameOptionsWindow : Window { case WID_GO_GUI_SCALE_AUTO: { if (_gui_scale_cfg == -1) { - _gui_scale_cfg = _gui_scale; + _gui_scale_cfg = this->previous_gui_scale; // Load the previous GUI scale this->SetWidgetLoweredState(WID_GO_GUI_SCALE_AUTO, false); + if (AdjustGUIZoom(false)) ReInitAllWindows(true); + this->gui_scale = _gui_scale; } else { + this->previous_gui_scale = _gui_scale; // Set the previous GUI scale value as the current one _gui_scale_cfg = -1; this->SetWidgetLoweredState(WID_GO_GUI_SCALE_AUTO, true); if (AdjustGUIZoom(false)) ReInitAllWindows(true);