diff options
author | Darkvater <darkvater@openttd.org> | 2006-11-05 01:09:57 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2006-11-05 01:09:57 +0000 |
commit | 20da2356a90babcba73d507b6229a1f0cbbc4316 (patch) | |
tree | e1f3904f6f5475153422f7c68e74ace215976b85 | |
parent | 605e6d75af28869821819b4dd1194347ff1135ea (diff) | |
download | openttd-20da2356a90babcba73d507b6229a1f0cbbc4316.tar.xz |
(svn r7060) -Fix (r5874): Restore of window maximized state not always working (Mart3p) . Remember
maximize state even between switching fullscreen/windowed mode.
-rw-r--r-- | video/win32_v.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/video/win32_v.c b/video/win32_v.c index 279fc4709..9d0cc5247 100644 --- a/video/win32_v.c +++ b/video/win32_v.c @@ -255,7 +255,6 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP case WM_CLOSE: HandleExitGameRequest(); - _window_maximize = IsZoomed(_wnd.main_wnd); return 0; case WM_LBUTTONDOWN: @@ -390,6 +389,9 @@ static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP case WM_SIZE: if (wParam != SIZE_MINIMIZED) { + /* Set maximized flag when we maximize (obviously), but also when we + * switched to fullscreen from a maximized state */ + _window_maximize = (wParam == SIZE_MAXIMIZED || (_window_maximize && _fullscreen)); ClientSizeChanged(LOWORD(lParam), HIWORD(lParam)); } return 0; @@ -557,6 +559,8 @@ static void MakeWindow(bool full_screen) SetRect(&r, 0, 0, _wnd.width_org, _wnd.height_org); } else { style = WS_OVERLAPPEDWINDOW | WS_VISIBLE; + /* On window creation, check if we were in maximize mode before */ + if (_window_maximize) style |= WS_MAXIMIZE; SetRect(&r, 0, 0, _wnd.width, _wnd.height); } @@ -577,12 +581,6 @@ static void MakeWindow(bool full_screen) _wnd.main_wnd = CreateWindow("OTTD", Windowtitle, style, x, y, w, h, 0, 0, GetModuleHandle(NULL), 0); if (_wnd.main_wnd == NULL) error("CreateWindow failed"); - - /* On startup let's see if we quit maximized the last time, restore that */ - if (_window_maximize) { - ShowWindow(_wnd.main_wnd, SW_MAXIMIZE); - _window_maximize = false; - } } } GameSizeChanged(); // invalidate all windows, force redraw |