Skip to content

Commit

Permalink
Fix an assertion failure in the GUI2 placement.
Browse files Browse the repository at this point in the history
If a vertical scrollbar is added to a widget its size is recalculated.
Unfortunalty the determination of the minimum width didn't take the
horizontal scrollbar in account. This lead to the container to be too
small for a widget with horizontal and vertical scrollbar causing the
placement to fail.

Fixes bug #22095, possibly #15615 and #21785.

There are still a few issues remaining, but it seems they only cause the
code to behave less efficient. The fix for this issue seems to be more
intrusive and will only be committed to master.
  • Loading branch information
mordante committed Jun 9, 2014
1 parent 56defec commit f594266
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelog
Expand Up @@ -17,6 +17,8 @@ Version 1.11.15+dev:
* Fixed error messages about missing UI elements.
* Language and i18n:
* Updated translations:
* User interface:
* Fixed bug #22095: An assertion failure in the gamestate inspector.
* WML engine:
* Fixed a regression in 1.11.14 causing WML parser/preprocessor errors to
not interrupt the game load sequence or display an error message in-game,
Expand Down
12 changes: 11 additions & 1 deletion src/gui/widgets/scrollbar_container.cpp
Expand Up @@ -263,7 +263,17 @@ void tscrollbar_container::request_reduce_width(const unsigned maximum_width)
horizontal_scrollbar_grid_->set_visible(twidget::tvisible::visible);
size = get_best_size();

const tpoint scrollbar_size = horizontal_scrollbar_grid_->get_best_size();
tpoint scrollbar_size = horizontal_scrollbar_grid_->get_best_size();

/*
* If the vertical bar is not invisible it's size needs to be added to the
* minimum size.
*/
if(vertical_scrollbar_grid_->get_visible()
!= twidget::tvisible::invisible) {

scrollbar_size.x += vertical_scrollbar_grid_->get_best_size().x;
}

// If showing the scrollbar increased the width, hide and abort.
if(horizontal_scrollbar_mode_ == auto_visible_first_run && scrollbar_size.x
Expand Down

0 comments on commit f594266

Please sign in to comment.