widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #00450
[Merge] lp:~nomeata/widelands/minimize-crash into lp:widelands
Joachim Breitner has proposed merging lp:~nomeata/widelands/minimize-crash into lp:widelands with lp:~nomeata/widelands/help-button-right as a prerequisite.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #536543 in widelands: "Add "whole game" to the time axis in statistics"
https://bugs.launchpad.net/widelands/+bug/536543
For more details, see:
https://code.launchpad.net/~nomeata/widelands/minimize-crash/+merge/81405
This fixes a crash when minimizing a window with a center pane that has a positive border, as found by hjd.
--
https://code.launchpad.net/~nomeata/widelands/minimize-crash/+merge/81405
Your team Widelands Developers is requested to review the proposed merge of lp:~nomeata/widelands/minimize-crash into lp:widelands.
=== modified file 'src/ui_basic/window.cc'
--- src/ui_basic/window.cc 2011-03-10 10:11:42 +0000
+++ src/ui_basic/window.cc 2011-11-06 14:46:26 +0000
@@ -155,11 +155,12 @@
}
/**
- * Change the center panel's size so that it fills the window entirely.
+ * Change the center panel's size so that it fills the window entirely, but
+ * only if not minimized.
*/
void Window::layout()
{
- if (m_center_panel) {
+ if (m_center_panel && not _is_minimal) {
m_center_panel->set_pos(Point(0, 0));
m_center_panel->set_size(get_inner_w(), get_inner_h());
}
@@ -473,21 +474,21 @@
void Window::restore() {
assert(_is_minimal);
+ _is_minimal = false;
set_border
(get_lborder(), get_rborder(),
get_tborder(), _docked_bottom ? 0 : BT_B_PIXMAP_THICKNESS);
set_inner_size(get_inner_w(), _oldh);
- _is_minimal = false;
move_inside_parent();
}
void Window::minimize() {
assert(not _is_minimal);
if (_docked_bottom) undock_bottom(); // Minimal can not be bottom-docked.
_oldh = get_inner_h();
+ _is_minimal = true;
set_border(get_lborder(), get_rborder(), get_tborder(), 0);
set_size(get_w(), TP_B_PIXMAP_THICKNESS);
set_pos(Point(get_x(), get_y())); // If on border, this feels more natural
- _is_minimal = true;
}
inline void Window::dock_left() {
Follow ups