summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-07-29 20:54:37 +0000
committerrubidium <rubidium@openttd.org>2007-07-29 20:54:37 +0000
commit1ff82506a0c605fa27ab64ce1fc65fce7174fe06 (patch)
tree21a4c1961bf42264edbf00a1833e6fb47aab6b37 /src
parentdd0fac984ba413cb3ab3fc77a1630671142f6abf (diff)
downloadopenttd-1ff82506a0c605fa27ab64ce1fc65fce7174fe06.tar.xz
(svn r10727) -Codechange: when a window would fall outside of the screen (on the right) when opening it, move it to the left so it stays inside the screen.
Diffstat (limited to 'src')
-rw-r--r--src/window.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp
index e8a6b8802..a4f215af0 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -689,6 +689,8 @@ static Window *LocalAllocateWindow(
w->wndproc(w, &e);
}
+ if (w->left + w->width > _screen.width) w->left -= (w->left + 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);