src/window.cpp
branchnoai
changeset 9701 d1ac22c62f64
parent 9694 e72987579514
child 9718 f82a4facea8b
--- a/src/window.cpp	Sun Aug 19 14:04:13 2007 +0000
+++ b/src/window.cpp	Sun Sep 02 11:17:33 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);
 
@@ -1867,7 +1877,7 @@
 	FOR_ALL_WINDOWS(wz) {
 		if ((*wz)->viewport != NULL) UpdateViewportPosition(*wz);
 	}
-	DrawTextMessage();
+	DrawChatMessage();
 	/* Redraw mouse cursor in case it was hidden */
 	DrawMouseCursor();
 }