summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-07-27 19:09:31 +0000
committerrubidium <rubidium@openttd.org>2007-07-27 19:09:31 +0000
commiteb52479c0aa15678c4ae558c78bf657889928ac1 (patch)
treecaff54b4cf3c73b3fdedb5ceaa6c29c0e4ee86a4
parent13ab17bca8f57c7bf3b832963e2cc45576811fbb (diff)
downloadopenttd-eb52479c0aa15678c4ae558c78bf657889928ac1.tar.xz
(svn r10705) -Fix (r10704): some windows were not correctly initialized as they resized the window themselves and that should be interfered by making sure the window is resized in the right "step" size.
-Fix (r10704): call the WE_RESIZE when resizing during initialization of the windows.
-rw-r--r--src/window.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/window.cpp b/src/window.cpp
index 6fa049e0c..7fdf5f516 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -668,6 +668,15 @@ static Window *LocalAllocateWindow(
if (w->resize.step_height > 1) enlarge_y -= enlarge_y % (int)w->resize.step_height;
ResizeWindow(w, enlarge_x, enlarge_y);
+
+ WindowEvent e;
+ e.event = WE_RESIZE;
+ e.we.sizing.size.x = w->width;
+ e.we.sizing.size.y = w->height;
+ e.we.sizing.diff.x = enlarge_x;
+ e.we.sizing.diff.y = enlarge_y;
+ w->wndproc(w, &e);
+
if (w->left < 0) w->left = 0;
if (w->top < 0) w->top = 0;
}
@@ -1093,12 +1102,6 @@ void ResizeWindow(Window *w, int x, int y)
bool resize_height = false;
bool resize_width = false;
- /* X and Y has to go by step.. calculate it.
- * The cast to int is necessary else x/y are implicitly casted to
- * unsigned int, which won't work. */
- if (w->resize.step_width > 1) x -= x % (int)w->resize.step_width;
- if (w->resize.step_height > 1) y -= y % (int)w->resize.step_height;
-
if (x == 0 && y == 0) return;
SetWindowDirty(w);