mirror of https://github.com/OpenTTD/OpenTTD
(svn r19563) -Fix [FS#3733] (r19558): OnResize wasn't called often enough so scrollbars were in some cases not properly updated causing division by zero
parent
b966bdc23c
commit
bd629ad7c0
|
@ -1413,8 +1413,7 @@ static bool HandleMouseOver()
|
||||||
*/
|
*/
|
||||||
void ResizeWindow(Window *w, int delta_x, int delta_y)
|
void ResizeWindow(Window *w, int delta_x, int delta_y)
|
||||||
{
|
{
|
||||||
if (delta_x == 0 && delta_y == 0) return;
|
if (delta_x != 0 || delta_y != 0) {
|
||||||
|
|
||||||
w->SetDirty();
|
w->SetDirty();
|
||||||
|
|
||||||
uint new_xinc = max(0, (w->nested_root->resize_x == 0) ? 0 : (int)(w->nested_root->current_x - w->nested_root->smallest_x) + delta_x);
|
uint new_xinc = max(0, (w->nested_root->resize_x == 0) ? 0 : (int)(w->nested_root->current_x - w->nested_root->smallest_x) + delta_x);
|
||||||
|
@ -1425,6 +1424,9 @@ void ResizeWindow(Window *w, int delta_x, int delta_y)
|
||||||
w->nested_root->AssignSizePosition(ST_RESIZE, 0, 0, w->nested_root->smallest_x + new_xinc, w->nested_root->smallest_y + new_yinc, _dynlang.text_dir == TD_RTL);
|
w->nested_root->AssignSizePosition(ST_RESIZE, 0, 0, w->nested_root->smallest_x + new_xinc, w->nested_root->smallest_y + new_yinc, _dynlang.text_dir == TD_RTL);
|
||||||
w->width = w->nested_root->current_x;
|
w->width = w->nested_root->current_x;
|
||||||
w->height = w->nested_root->current_y;
|
w->height = w->nested_root->current_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Always call OnResize to make sure everything is initialised correctly if it needs to be. */
|
||||||
w->OnResize();
|
w->OnResize();
|
||||||
w->SetDirty();
|
w->SetDirty();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue