Skip to content

Commit

Permalink
Honour the minimum size for a container.
Browse files Browse the repository at this point in the history
Some containers require a minimum size when they draw on their own
canvas.

The change is part 1/2 of the fix for bug #22144.
  • Loading branch information
mordante committed Jun 9, 2014
1 parent 7e9d522 commit 0322918
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/gui/widgets/container.cpp
Expand Up @@ -94,16 +94,24 @@ tpoint tcontainer_::calculate_best_size() const

tpoint result(grid_.get_best_size());
const tpoint border_size = border_space();
const tpoint minimum_size = get_config_minimum_size();

// If the best size has a value of 0 it's means no limit so don't
// add the border_size might set a very small best size.
if(result.x) {
result.x += border_size.x;
}
if(minimum_size.x != 0 && result.x < minimum_size.x) {
result.x = minimum_size.x;
}

if(result.y) {
result.y += border_size.y;
}
if(minimum_size.y != 0 && result.y < minimum_size.y) {
result.y = minimum_size.y;
}


DBG_GUI_L << LOG_HEADER << " border size " << border_size << " returning "
<< result << ".\n";
Expand Down

0 comments on commit 0322918

Please sign in to comment.