From ecea1d5c396f51617ec4c55ae80d30979575e583 Mon Sep 17 00:00:00 2001 From: Le Philousophe Date: Sun, 5 Feb 2023 18:00:24 +0100 Subject: [PATCH] GUI: Fix width and height calculation _defaultW and _defaultH are already scaled and should not be scaled again --- gui/ThemeLayout.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp index 66a3e2a05a8..41f0cbb8b4f 100644 --- a/gui/ThemeLayout.cpp +++ b/gui/ThemeLayout.cpp @@ -229,8 +229,8 @@ void ThemeLayoutMain::reflowLayout(Widget *widgetChain) { } else if (_overlays == "screen_center") { _x = -1; _y = -1; - _w = _defaultW > 0 ? MIN(_defaultW, g_gui.getGUIWidth()) * g_gui.getScaleFactor() : -1; - _h = _defaultH > 0 ? MIN(_defaultH, g_gui.getGUIHeight()) * g_gui.getScaleFactor() : -1; + _w = _defaultW > 0 ? MIN(_defaultW, (int16)(g_gui.getGUIWidth() * g_gui.getScaleFactor())) : -1; + _h = _defaultH > 0 ? MIN(_defaultH, (int16)(g_gui.getGUIHeight() * g_gui.getScaleFactor())) : -1; } else { if (!g_gui.xmlEval()->getWidgetData(_overlays, _x, _y, _w, _h)) { warning("Unable to retrieve overlayed dialog position %s", _overlays.c_str());