From e4cf6ca0baea91f2d983cb8bef5f62f4b86d89c2 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Tue, 17 Jun 2025 17:40:11 +0100 Subject: [PATCH] Fix: Mis-sized widgets due to missing widget fill. (#14370) In most places where we calculate and set widget resize step we neglect to set widget fill step to match. Initial widget sizing uses fill step instead of resize step, which means the initial size may not be a multiple of the resize step as intended. In particular this will cause WWT_MATRIX to be misrendered. Whether or not this matters depends on the widget type being resized and the window layout, however for consistency always set fill step to the same as resize step when calculating. --- src/ai/ai_gui.cpp | 2 +- src/autoreplace_gui.cpp | 2 +- src/bridge_gui.cpp | 2 +- src/build_vehicle_gui.cpp | 2 +- src/company_gui.cpp | 4 ++-- src/fios_gui.cpp | 2 +- src/framerate_gui.cpp | 4 ++-- src/game/game_gui.cpp | 2 +- src/goal_gui.cpp | 2 +- src/graph_gui.cpp | 2 +- src/group_gui.cpp | 5 ++--- src/industry_gui.cpp | 6 +++--- src/network/network_content_gui.cpp | 2 +- src/network/network_gui.cpp | 6 ++---- src/newgrf_debug_gui.cpp | 5 ++--- src/newgrf_gui.cpp | 9 ++++----- src/news_gui.cpp | 2 +- src/order_gui.cpp | 2 +- src/picker_gui.cpp | 2 +- src/script/script_gui.cpp | 6 +++--- src/settings_gui.cpp | 2 +- src/signs_gui.cpp | 2 +- src/station_gui.cpp | 6 +++--- src/subsidy_gui.cpp | 2 +- src/textfile_gui.cpp | 2 +- src/timetable_gui.cpp | 2 +- src/town_gui.cpp | 4 ++-- src/vehicle_gui.cpp | 6 +++--- 28 files changed, 45 insertions(+), 50 deletions(-) diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index d839e58850..c13e313130 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -142,7 +142,7 @@ struct AIConfigWindow : public Window { case WID_AIC_LIST: this->line_height = GetCharacterHeight(FS_NORMAL) + padding.height; - resize.height = this->line_height; + fill.height = resize.height = this->line_height; size.height = 8 * this->line_height; break; } diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 1ef0df65d9..804dd92a9d 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -311,7 +311,7 @@ public: case WID_RV_LEFT_MATRIX: case WID_RV_RIGHT_MATRIX: - resize.height = GetEngineListHeight(this->window_number); + fill.height = resize.height = GetEngineListHeight(this->window_number); size.height = (this->window_number <= VEH_ROAD ? 8 : 4) * resize.height; break; diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index bce1c739be..f77337014e 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -205,7 +205,7 @@ public: sprite_dim = maxdim(sprite_dim, GetScaledSpriteSize(bridge_data.spec->sprite)); text_dim = maxdim(text_dim, GetStringBoundingBox(GetBridgeSelectString(bridge_data))); } - resize.height = std::max(sprite_dim.height, text_dim.height) + padding.height; // Max of both sizes + account for matrix edges. + fill.height = resize.height = std::max(sprite_dim.height, text_dim.height) + padding.height; // Max of both sizes + account for matrix edges. this->icon_width = sprite_dim.width; // Width of bridge icon. size.width = this->icon_width + WidgetDimensions::scaled.hsep_normal + text_dim.width + padding.width; diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 3cba5c4408..e713a7b5ec 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1773,7 +1773,7 @@ struct BuildVehicleWindow : Window { { switch (widget) { case WID_BV_LIST: - resize.height = GetEngineListHeight(this->vehicle_type); + fill.height = resize.height = GetEngineListHeight(this->vehicle_type); size.height = 3 * resize.height; size.width = std::max(size.width, this->badge_classes.GetTotalColumnsWidth() + GetVehicleImageCellSize(this->vehicle_type, EIT_PURCHASE).extend_left + GetVehicleImageCellSize(this->vehicle_type, EIT_PURCHASE).extend_right + 165) + padding.width; break; diff --git a/src/company_gui.cpp b/src/company_gui.cpp index aa0374c7b4..29f48a8957 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -761,7 +761,7 @@ public: size.height = 5 * this->line_height; resize.width = 1; - resize.height = this->line_height; + fill.height = resize.height = this->line_height; break; } @@ -1937,7 +1937,7 @@ struct CompanyInfrastructureWindow : Window size.width = max_label_width + WidgetDimensions::scaled.hsep_wide + this->count_width + WidgetDimensions::scaled.hsep_wide + this->cost_width; size.width = std::max(size.width, max_header_width) + WidgetDimensions::scaled.framerect.Horizontal(); - resize.height = GetCharacterHeight(FS_NORMAL); + fill.height = resize.height = GetCharacterHeight(FS_NORMAL); } void DrawWidget(const Rect &r, WidgetID widget) const override diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index 9ff47b4741..339837dd4b 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -621,7 +621,7 @@ public: break; case WID_SL_DRIVES_DIRECTORIES_LIST: - resize.height = GetCharacterHeight(FS_NORMAL); + fill.height = resize.height = GetCharacterHeight(FS_NORMAL); size.height = resize.height * 10 + padding.height; break; case WID_SL_SORT_BYNAME: diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp index b63e6822ea..2667a473b6 100644 --- a/src/framerate_gui.cpp +++ b/src/framerate_gui.cpp @@ -531,7 +531,7 @@ struct FramerateWindow : Window { size.width = 0; size.height = GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal + MIN_ELEMENTS * GetCharacterHeight(FS_NORMAL); resize.width = 0; - resize.height = GetCharacterHeight(FS_NORMAL); + fill.height = resize.height = GetCharacterHeight(FS_NORMAL); for (PerformanceElement e : DISPLAY_ORDER_PFE) { if (_pf_data[e].num_valid == 0) continue; Dimension line_size; @@ -553,7 +553,7 @@ struct FramerateWindow : Window { size.width = std::max(size.width, item_size.width); size.height += GetCharacterHeight(FS_NORMAL) * MIN_ELEMENTS + WidgetDimensions::scaled.vsep_normal; resize.width = 0; - resize.height = GetCharacterHeight(FS_NORMAL); + fill.height = resize.height = GetCharacterHeight(FS_NORMAL); break; } } diff --git a/src/game/game_gui.cpp b/src/game/game_gui.cpp index 207a4c7daf..ec47cd6eb5 100644 --- a/src/game/game_gui.cpp +++ b/src/game/game_gui.cpp @@ -141,7 +141,7 @@ struct GSConfigWindow : public Window { case WID_GSC_SETTINGS: this->line_height = std::max(SETTING_BUTTON_HEIGHT, GetCharacterHeight(FS_NORMAL)) + padding.height; resize.width = 1; - resize.height = this->line_height; + fill.height = resize.height = this->line_height; size.height = 5 * this->line_height; break; diff --git a/src/goal_gui.cpp b/src/goal_gui.cpp index ed9920219e..d5734184c2 100644 --- a/src/goal_gui.cpp +++ b/src/goal_gui.cpp @@ -172,7 +172,7 @@ struct GoalListWindow : public Window { Dimension d = GetStringBoundingBox(STR_GOALS_NONE); resize.width = 1; - resize.height = d.height; + fill.height = resize.height = d.height; d.height *= 5; d.width += WidgetDimensions::scaled.framerect.Horizontal(); diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 8db6ef7f50..23c24d134a 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -1163,7 +1163,7 @@ struct BaseCargoGraphWindow : BaseGraphWindow { this->line_height = size.height; size.height = this->line_height * 11; /* Default number of cargo types in most climates. */ resize.width = 0; - resize.height = this->line_height; + fill.height = resize.height = this->line_height; } void DrawWidget(const Rect &r, WidgetID widget) const override diff --git a/src/group_gui.cpp b/src/group_gui.cpp index abba12785e..e94844f02f 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -430,8 +430,7 @@ public: switch (widget) { case WID_GL_LIST_GROUP: size.width = this->ComputeGroupInfoSize(); - resize.height = this->tiny_step_height; - fill.height = this->tiny_step_height; + fill.height = resize.height = this->tiny_step_height; break; case WID_GL_ALL_VEHICLES: @@ -450,7 +449,7 @@ public: case WID_GL_LIST_VEHICLE: this->ComputeGroupInfoSize(); - resize.height = GetVehicleListHeight(this->vli.vtype, this->tiny_step_height); + fill.height = resize.height = GetVehicleListHeight(this->vli.vtype, this->tiny_step_height); size.height = 4 * resize.height; break; diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 980bc54611..6119c486dd 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -444,7 +444,7 @@ public: for (const auto &indtype : this->list) { d = maxdim(d, GetStringBoundingBox(GetIndustrySpec(indtype)->name)); } - resize.height = std::max({this->legend.height, d.height, count.height}) + padding.height; + fill.height = resize.height = std::max({this->legend.height, d.height, count.height}) + padding.height; d.width += this->badge_classes.GetTotalColumnsWidth() + this->legend.width + WidgetDimensions::scaled.hsep_wide + WidgetDimensions::scaled.hsep_normal + count.width + padding.width; d.height = 5 * resize.height; size = maxdim(size, d); @@ -1780,7 +1780,7 @@ public: case WID_ID_INDUSTRY_LIST: { Dimension d = GetStringBoundingBox(STR_INDUSTRY_DIRECTORY_NONE); - resize.height = d.height; + fill.height = resize.height = d.height; d.height *= 5; d.width += padding.width; d.height += padding.height; @@ -2644,7 +2644,7 @@ struct IndustryCargoesWindow : public Window { { switch (widget) { case WID_IC_PANEL: - resize.height = CargoesField::normal_height; + fill.height = resize.height = CargoesField::normal_height; size.width = CargoesField::industry_width * 3 + CargoesField::cargo_field_width * 2 + WidgetDimensions::scaled.frametext.Horizontal(); size.height = CargoesField::small_height + 2 * resize.height + WidgetDimensions::scaled.frametext.Vertical(); break; diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index cf4952861e..117a0c1e7b 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -596,7 +596,7 @@ public: } case WID_NCL_MATRIX: - resize.height = std::max(this->checkbox_size.height, (uint)GetCharacterHeight(FS_NORMAL)) + padding.height; + fill.height = resize.height = std::max(this->checkbox_size.height, (uint)GetCharacterHeight(FS_NORMAL)) + padding.height; size.height = 10 * resize.height; break; } diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 19cfc0d71b..d6c77dce1f 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -476,8 +476,7 @@ public: { switch (widget) { case WID_NG_MATRIX: - resize.height = std::max(GetSpriteSize(SPR_BLOT).height, (uint)GetCharacterHeight(FS_NORMAL)) + padding.height; - fill.height = resize.height; + fill.height = resize.height = std::max(GetSpriteSize(SPR_BLOT).height, (uint)GetCharacterHeight(FS_NORMAL)) + padding.height; size.height = 12 * resize.height; break; @@ -1656,8 +1655,7 @@ public: this->line_height = std::max(height, (uint)GetCharacterHeight(FS_NORMAL)) + padding.height; resize.width = 1; - resize.height = this->line_height; - fill.height = this->line_height; + fill.height = resize.height = this->line_height; size.height = std::max(size.height, 5 * this->line_height); break; } diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index a829e7c448..f3780370bf 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -359,7 +359,7 @@ struct NewGRFInspectWindow : Window { } case WID_NGRFI_MAINPANEL: - resize.height = std::max(11, GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal); + fill.height = resize.height = std::max(11, GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal); resize.width = 1; size.height = 5 * resize.height + WidgetDimensions::scaled.frametext.Vertical(); @@ -888,9 +888,8 @@ struct SpriteAlignerWindow : Window { d = maxdim(d, GetStringBoundingBox(GetString(STR_SPRITE_ALIGNER_SPRITE, spritefile->GetSimplifiedFilename(), GetParamMaxDigits(6)))); } size.width = d.width + padding.width; - resize.height = GetCharacterHeight(FS_NORMAL) + padding.height; + fill.height = resize.height = GetCharacterHeight(FS_NORMAL) + padding.height; resize.width = 1; - fill.height = resize.height; break; } diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 93cf0a8a65..da30cac7ee 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -224,7 +224,7 @@ struct NewGRFParametersWindow : public Window { this->line_height = std::max(SETTING_BUTTON_HEIGHT, GetCharacterHeight(FS_NORMAL)) + padding.height; resize.width = 1; - resize.height = this->line_height; + fill.height = resize.height = this->line_height; size.height = 5 * this->line_height; break; @@ -730,7 +730,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { case WID_NS_FILE_LIST: { Dimension d = maxdim(GetScaledSpriteSize(SPR_SQUARE), GetScaledSpriteSize(SPR_WARNING_SIGN)); - resize.height = std::max(d.height + 2U, GetCharacterHeight(FS_NORMAL)); + fill.height = resize.height = std::max(d.height + 2U, GetCharacterHeight(FS_NORMAL)); size.height = std::max(size.height, padding.height + 6 * resize.height); break; } @@ -738,7 +738,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { case WID_NS_AVAIL_LIST: { Dimension d = maxdim(GetScaledSpriteSize(SPR_SQUARE), GetScaledSpriteSize(SPR_WARNING_SIGN)); - resize.height = std::max(d.height + 2U, GetCharacterHeight(FS_NORMAL)); + fill.height = resize.height = std::max(d.height + 2U, GetCharacterHeight(FS_NORMAL)); size.height = std::max(size.height, padding.height + 8 * resize.height); break; } @@ -2041,12 +2041,11 @@ struct SavePresetWindow : public Window { { switch (widget) { case WID_SVP_PRESET_LIST: { - resize.height = GetCharacterHeight(FS_NORMAL); + fill.height = resize.height = GetCharacterHeight(FS_NORMAL); size.height = 0; for (uint i = 0; i < this->presets.size(); i++) { Dimension d = GetStringBoundingBox(this->presets[i]); size.width = std::max(size.width, d.width + padding.width); - resize.height = std::max(resize.height, d.height); } size.height = ClampU((uint)this->presets.size(), 5, 20) * resize.height + padding.height; break; diff --git a/src/news_gui.cpp b/src/news_gui.cpp index cd804fdb44..351f559561 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -1214,7 +1214,7 @@ struct MessageHistoryWindow : Window { { if (widget == WID_MH_BACKGROUND) { this->line_height = GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal; - resize.height = this->line_height; + fill.height = resize.height = this->line_height; /* Months are off-by-one, so it's actually 8. Not using * month 12 because the 1 is usually less wide. */ diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 5b47c97897..b09f97588d 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -822,7 +822,7 @@ public: { switch (widget) { case WID_O_ORDER_LIST: - resize.height = GetCharacterHeight(FS_NORMAL); + fill.height = resize.height = GetCharacterHeight(FS_NORMAL); size.height = 6 * resize.height + padding.height; break; diff --git a/src/picker_gui.cpp b/src/picker_gui.cpp index 3bc14fb3be..ecfc4dbc22 100644 --- a/src/picker_gui.cpp +++ b/src/picker_gui.cpp @@ -268,7 +268,7 @@ void PickerWindow::UpdateWidgetSize(WidgetID widget, Dimension &size, const Dime switch (widget) { /* Class picker */ case WID_PW_CLASS_LIST: - resize.height = GetCharacterHeight(FS_NORMAL) + padding.height; + fill.height = resize.height = GetCharacterHeight(FS_NORMAL) + padding.height; size.height = 5 * resize.height; break; diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index d2ef7819a9..ece3632c6f 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -112,7 +112,7 @@ struct ScriptListWindow : public Window { this->line_height = GetCharacterHeight(FS_NORMAL) + padding.height; resize.width = 1; - resize.height = this->line_height; + fill.height = resize.height = this->line_height; size.height = 5 * this->line_height; } @@ -345,7 +345,7 @@ struct ScriptSettingsWindow : public Window { this->line_height = std::max(SETTING_BUTTON_HEIGHT, GetCharacterHeight(FS_NORMAL)) + padding.height; resize.width = 1; - resize.height = this->line_height; + fill.height = resize.height = this->line_height; size.height = 5 * this->line_height; } @@ -789,7 +789,7 @@ struct ScriptDebugWindow : public Window { void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override { if (widget == WID_SCRD_LOG_PANEL) { - resize.height = GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal; + fill.height = resize.height = GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal; size.height = 14 * resize.height + WidgetDimensions::scaled.framerect.Vertical(); } } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 4fcd47c1ce..d5f8d50e19 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -856,7 +856,7 @@ struct GameOptionsWindow : Window { } case WID_GO_OPTIONSPANEL: - resize.height = SETTING_HEIGHT = std::max({(int)_setting_circle_size.height, SETTING_BUTTON_HEIGHT, GetCharacterHeight(FS_NORMAL)}) + WidgetDimensions::scaled.vsep_normal; + fill.height = resize.height = SETTING_HEIGHT = std::max({(int)_setting_circle_size.height, SETTING_BUTTON_HEIGHT, GetCharacterHeight(FS_NORMAL)}) + WidgetDimensions::scaled.vsep_normal; resize.width = 1; size.height = 8 * resize.height + WidgetDimensions::scaled.framerect.Vertical(); diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index a9c448f946..37b0ccebab 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -258,7 +258,7 @@ struct SignListWindow : Window, SignList { case WID_SIL_LIST: { Dimension spr_dim = GetSpriteSize(SPR_COMPANY_ICON); this->text_offset = WidgetDimensions::scaled.frametext.left + spr_dim.width + 2; // 2 pixels space between icon and the sign text. - resize.height = std::max(GetCharacterHeight(FS_NORMAL), spr_dim.height + 2); + fill.height = resize.height = std::max(GetCharacterHeight(FS_NORMAL), spr_dim.height + 2); Dimension d = {(uint)(this->text_offset + WidgetDimensions::scaled.frametext.right), padding.height + 5 * resize.height}; size = maxdim(size, d); break; diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 6072972c7a..4f0979ec86 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -469,7 +469,7 @@ public: } case WID_STL_LIST: - resize.height = std::max(GetCharacterHeight(FS_NORMAL), GetCharacterHeight(FS_SMALL) + ScaleGUITrad(3)); + fill.height = resize.height = std::max(GetCharacterHeight(FS_NORMAL), GetCharacterHeight(FS_SMALL) + ScaleGUITrad(3)); size.height = padding.height + 5 * resize.height; /* Determine appropriate width for mini station rating graph */ @@ -1416,7 +1416,7 @@ struct StationViewWindow : public Window { { switch (widget) { case WID_SV_WAITING: - resize.height = GetCharacterHeight(FS_NORMAL); + fill.height = resize.height = GetCharacterHeight(FS_NORMAL); size.height = 4 * resize.height + padding.height; this->expand_shrink_width = std::max(GetStringBoundingBox("-").width, GetStringBoundingBox("+").width); break; @@ -2325,7 +2325,7 @@ struct SelectStationWindow : Window { : GetString(STR_STATION_LIST_STATION, st->index, st->facilities))); } - resize.height = d.height; + fill.height = resize.height = d.height; d.height *= 5; d.width += padding.width; d.height += padding.height; diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index 80f1c8ccd2..b57bcbe35c 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -136,7 +136,7 @@ struct SubsidyListWindow : Window { if (widget != WID_SUL_PANEL) return; Dimension d = maxdim(GetStringBoundingBox(STR_SUBSIDIES_OFFERED_TITLE), GetStringBoundingBox(STR_SUBSIDIES_SUBSIDISED_TITLE)); - resize.height = GetCharacterHeight(FS_NORMAL); + fill.height = resize.height = GetCharacterHeight(FS_NORMAL); d.height *= 5; d.width += WidgetDimensions::scaled.framerect.Horizontal(); diff --git a/src/textfile_gui.cpp b/src/textfile_gui.cpp index 8725b55f4d..f474ead9c9 100644 --- a/src/textfile_gui.cpp +++ b/src/textfile_gui.cpp @@ -124,7 +124,7 @@ void TextfileWindow::ReflowContent() switch (widget) { case WID_TF_BACKGROUND: resize.width = GetCharacterHeight(FS_MONO); // Width is not available here as the font may not be loaded yet. - resize.height = GetCharacterHeight(FS_MONO); + fill.height = resize.height = GetCharacterHeight(FS_MONO); size.height = 4 * resize.height + WidgetDimensions::scaled.frametext.Vertical(); // At least 4 lines are visible. size.width = std::max(200u, size.width); // At least 200 pixels wide. diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 4eafeb4fb4..033555b6a1 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -242,7 +242,7 @@ struct TimetableWindow : Window { case WID_VT_ARRIVAL_DEPARTURE_SELECTION: case WID_VT_TIMETABLE_PANEL: - resize.height = GetCharacterHeight(FS_NORMAL); + fill.height = resize.height = GetCharacterHeight(FS_NORMAL); size.height = 8 * resize.height + padding.height; break; diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 95f009e45f..05ffc178de 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -271,7 +271,7 @@ public: break; case WID_TA_RATING_INFO: - resize.height = std::max({this->icon_size.height + WidgetDimensions::scaled.vsep_normal, this->exclusive_size.height + WidgetDimensions::scaled.vsep_normal, (uint)GetCharacterHeight(FS_NORMAL)}); + fill.height = resize.height = std::max({this->icon_size.height + WidgetDimensions::scaled.vsep_normal, this->exclusive_size.height + WidgetDimensions::scaled.vsep_normal, (uint)GetCharacterHeight(FS_NORMAL)}); size.height = 9 * resize.height + padding.height; break; } @@ -902,7 +902,7 @@ public: Dimension icon_size = GetSpriteSize(SPR_TOWN_RATING_GOOD); d.width += icon_size.width + 2; d.height = std::max(d.height, icon_size.height); - resize.height = d.height; + fill.height = resize.height = d.height; d.height *= 5; d.width += padding.width; d.height += padding.height; diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 8c3c03096d..6727ed5796 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -977,7 +977,7 @@ struct RefitWindow : public Window { { switch (widget) { case WID_VR_MATRIX: - resize.height = GetCharacterHeight(FS_NORMAL) + padding.height; + fill.height = resize.height = GetCharacterHeight(FS_NORMAL) + padding.height; size.height = resize.height * 8; break; @@ -1947,7 +1947,7 @@ public: { switch (widget) { case WID_VL_LIST: - resize.height = GetVehicleListHeight(this->vli.vtype, 1); + fill.height = resize.height = GetVehicleListHeight(this->vli.vtype, 1); switch (this->vli.vtype) { case VEH_TRAIN: @@ -2503,7 +2503,7 @@ struct VehicleDetailsWindow : Window { } case WID_VD_MATRIX: - resize.height = std::max(ScaleGUITrad(14), GetCharacterHeight(FS_NORMAL) + padding.height); + fill.height = resize.height = std::max(ScaleGUITrad(14), GetCharacterHeight(FS_NORMAL) + padding.height); size.height = 4 * resize.height; break;