(svn r20697) -Fix [FS#4084]: call the new function after resizing a window so it's not possible a window becomes unmoveable

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
yexo 14 years ago
parent 47494b2744
commit 6eb3ef7bc3

@ -1549,7 +1549,7 @@ static void EnsureVisibleCaption(Window *w, int nx, int ny)
/* Search for the title bar rectangle. */ /* Search for the title bar rectangle. */
Rect caption_rect; Rect caption_rect;
const NWidgetBase *caption = w->nested_root->GetWidgetOfType(WWT_CAPTION); const NWidgetBase *caption = w->nested_root->GetWidgetOfType(WWT_CAPTION);
assert(caption != NULL); if (caption != NULL) {
caption_rect.left = caption->pos_x; caption_rect.left = caption->pos_x;
caption_rect.right = caption->pos_x + caption->current_x; caption_rect.right = caption->pos_x + caption->current_x;
caption_rect.top = caption->pos_y; caption_rect.top = caption->pos_y;
@ -1567,6 +1567,7 @@ static void EnsureVisibleCaption(Window *w, int nx, int ny)
w->viewport->left += nx - w->left; w->viewport->left += nx - w->left;
w->viewport->top += ny - w->top; w->viewport->top += ny - w->top;
} }
}
w->left = nx; w->left = nx;
w->top = ny; w->top = ny;
} }
@ -1595,6 +1596,8 @@ void ResizeWindow(Window *w, int delta_x, int delta_y)
w->height = w->nested_root->current_y; w->height = w->nested_root->current_y;
} }
EnsureVisibleCaption(w, w->left, w->top);
/* Always call OnResize to make sure everything is initialised correctly if it needs to be. */ /* Always call OnResize to make sure everything is initialised correctly if it needs to be. */
w->OnResize(); w->OnResize();
w->SetDirty(); w->SetDirty();

Loading…
Cancel
Save