# HG changeset patch # User truelight # Date 1187867339 0 # Node ID af0f10d860511bf796c63d9983b691db7494f79a # Parent 95f6b2f351a6f2ce7e86849be5bdbfaa26e9c137 (svn r10967) -Fix: in case of moving the window on create (because it doesn't fit in the screen), make sure to move the viewport too if we are an extra viewport (spotted by Maedhros) diff -r 95f6b2f351a6 -r af0f10d86051 src/window.cpp --- a/src/window.cpp Wed Aug 22 20:57:28 2007 +0000 +++ b/src/window.cpp Thu Aug 23 11:08:59 2007 +0000 @@ -693,11 +693,21 @@ w->wndproc(w, &e); } - if (w->left + w->width > _screen.width) w->left -= (w->left + w->width - _screen.width); + int nx = w->left; + int ny = w->top; + + if (nx + w->width > _screen.width) nx -= (nx + w->width - _screen.width); const Window *wt = FindWindowById(WC_MAIN_TOOLBAR, 0); - w->top = max(w->top, (wt == NULL || w == wt || y == 0) ? 0 : wt->height); - w->left = max(w->left, 0); + ny = max(ny, (wt == NULL || w == wt || y == 0) ? 0 : wt->height); + nx = max(nx, 0); + + if (w->viewport != NULL) { + w->viewport->left += nx - w->left; + w->viewport->top += ny - w->top; + } + w->left = nx; + w->top = ny; SetWindowDirty(w);