widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #04738
[Merge] lp:~widelands-dev/widelands/bug-1502965 into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1502965 into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1502965 in widelands: "Building statistics window does not "courtain up" correctly"
https://bugs.launchpad.net/widelands/+bug/1502965
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1502965/+merge/278885
Fixed minimizing/restoring of Building Statistics window.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1502965 into lp:widelands.
=== modified file 'src/wui/building_statistics_menu.cc'
--- src/wui/building_statistics_menu.cc 2015-11-20 18:16:22 +0000
+++ src/wui/building_statistics_menu.cc 2015-11-28 12:35:36 +0000
@@ -559,20 +559,25 @@
*/
void BuildingStatisticsMenu::think() {
// Adjust height to current tab
- int tab_height =
- 35 + row_counters_[tab_panel_.active()] * (kBuildGridCellHeight + kLabelHeight + kLabelHeight);
- tab_panel_.set_size(kWindowWidth, tab_height);
- set_size(get_w(), tab_height + kMargin + 4 * kButtonRowHeight + get_tborder() + get_bborder());
- navigation_panel_.set_pos(Point(0, tab_height + kMargin));
+ if (is_minimal()) {
+ tab_panel_.set_size(0, 0);
+ } else {
+ int tab_height =
+ 35 + row_counters_[tab_panel_.active()] * (kBuildGridCellHeight + kLabelHeight + kLabelHeight);
+ tab_panel_.set_size(kWindowWidth, tab_height);
+ set_size(get_w(), tab_height + kMargin + 4 * kButtonRowHeight + get_tborder() + get_bborder());
+ navigation_panel_.set_pos(Point(0, tab_height + kMargin));
+ }
// Update statistics
- const Game& game = iplayer().game();
- const int32_t gametime = game.get_gametime();
+ const int32_t gametime = iplayer().game().get_gametime();
- if ((gametime - lastupdate_) > kUpdateTimeInGametimeMs) {
+ if (was_minimized_ || (gametime - lastupdate_) > kUpdateTimeInGametimeMs) {
update();
lastupdate_ = gametime;
}
+ // Make sure we don't have a delay with displaying labels when we restore the window.
+ was_minimized_ = is_minimal();
}
/*
=== modified file 'src/wui/building_statistics_menu.h'
--- src/wui/building_statistics_menu.h 2015-11-11 09:53:54 +0000
+++ src/wui/building_statistics_menu.h 2015-11-28 12:35:36 +0000
@@ -126,6 +126,8 @@
Widelands::DescriptionIndex last_building_type_;
/// The last time the information in this Panel got updated
uint32_t lastupdate_;
+ /// Whether the window was minimized the last time that think() was executed
+ uint32_t was_minimized_;
/// At which percent to deem buildings as unproductive
int low_production_;
Follow ups