summaryrefslogtreecommitdiff
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
commit4b75381d496060b3cf634d24b23f6122c87f1289 (patch)
tree21a4c1961bf42264edbf00a1833e6fb47aab6b37
parent000b582423e26a7be53e6848b33d74306eb5f0a0 (diff)
downloadopenttd-4b75381d496060b3cf634d24b23f6122c87f1289.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.
-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);