summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2006-12-26 13:30:48 +0000
committerDarkvater <darkvater@openttd.org>2006-12-26 13:30:48 +0000
commitb58c90a07539a15f3f05c5b11ca3bb5ebdda5fe8 (patch)
treea84c0d3c5b19a07662bdcc7bf58a577ab6577cc9
parent9560a1d9ec28080ab2fd49f760591da5fe85a08d (diff)
downloadopenttd-b58c90a07539a15f3f05c5b11ca3bb5ebdda5fe8.tar.xz
(svn r7562) -Fix (r7060, 5874): It seems windows doesn't have the same functionality for CreateWindow when starting a program from the console or from the GUI. Because of this starting OpenTTD from the desktop wouldn't maximize the window, even if the config file said so. So work around this...
-rw-r--r--video/win32_v.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/video/win32_v.c b/video/win32_v.c
index be105c480..e9fb1ca78 100644
--- a/video/win32_v.c
+++ b/video/win32_v.c
@@ -564,17 +564,18 @@ static void MakeWindow(bool full_screen)
{
RECT r;
- uint style;
+ DWORD style, showstyle;
int x, y, w, h;
+ showstyle = SW_SHOWNORMAL;
_wnd.fullscreen = full_screen;
if (_wnd.fullscreen) {
- style = WS_POPUP | WS_VISIBLE;
+ style = WS_POPUP;
SetRect(&r, 0, 0, _wnd.width_org, _wnd.height_org);
} else {
- style = WS_OVERLAPPEDWINDOW | WS_VISIBLE;
+ style = WS_OVERLAPPEDWINDOW;
/* On window creation, check if we were in maximize mode before */
- if (_window_maximize) style |= WS_MAXIMIZE;
+ if (_window_maximize) showstyle = SW_SHOWMAXIMIZED;
SetRect(&r, 0, 0, _wnd.width, _wnd.height);
}
@@ -595,6 +596,7 @@ static void MakeWindow(bool full_screen)
_wnd.main_wnd = CreateWindow(_T("OTTD"), Windowtitle, style, x, y, w, h, 0, 0, GetModuleHandle(NULL), 0);
if (_wnd.main_wnd == NULL) error("CreateWindow failed");
+ ShowWindow(_wnd.main_wnd, showstyle);
}
}
GameSizeChanged(); // invalidate all windows, force redraw