summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-07-28 20:59:30 +0000
committerrubidium <rubidium@openttd.org>2007-07-28 20:59:30 +0000
commitb6c3a127af1eb4248ea40c32d4df7e5bd6ce57bb (patch)
tree784707dae2f815c43e571a45bc10394a35607833
parent3a45534e4ec06af8eefd66ba47bc3f4545e6d09b (diff)
downloadopenttd-b6c3a127af1eb4248ea40c32d4df7e5bd6ce57bb.tar.xz
(svn r10716) -Codechange: not all windows' minimum size is actually their minimum size, so take the size of the window after WE_CREATE has been called as bare minimum size.
-rw-r--r--src/window.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 3ba38a03a..9d400dd83 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -656,8 +656,12 @@ static Window *LocalAllocateWindow(
CallWindowEventNP(w, WE_CREATE);
- /* Try to make windows smaller when our window is too small */
- if (min_width != def_width || min_height != def_height) {
+ /* Try to make windows smaller when our window is too small.
+ * w->(width|height) is normally the same as min_(width|height),
+ * but this way the GUIs can be made a little more dynamic;
+ * one can use the same spec for multiple windows and those
+ * can then determine the real minimum size of the window. */
+ if (w->width != def_width || w->height != def_height) {
/* Think about the overlapping toolbars when determining the minimum window size */
int free_height = _screen.height;
const Window *wt = FindWindowById(WC_STATUS_BAR, 0);
@@ -665,8 +669,8 @@ static Window *LocalAllocateWindow(
wt = FindWindowById(WC_MAIN_TOOLBAR, 0);
if (wt != NULL) free_height -= wt->height;
- int enlarge_x = max(min(def_width - min_width, _screen.width - min_width), 0);
- int enlarge_y = max(min(def_height - min_height, free_height - min_height), 0);
+ int enlarge_x = max(min(def_width - w->width, _screen.width - w->width), 0);
+ int enlarge_y = max(min(def_height - w->height, free_height - w->height), 0);
/* X and Y has to go by step.. calculate it.
* The cast to int is necessary else x/y are implicitly casted to