diff options
author | truebrain <truebrain@openttd.org> | 2012-04-30 16:48:47 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2012-04-30 16:48:47 +0000 |
commit | 39912b7bdee684ea838303ec5fb1513977131b74 (patch) | |
tree | db70bb6b7c0b238cb6be440d6bfaed6d2bfa167d /src | |
parent | b1fd2913d239986bc7c76bdab6d6c0bea66e12b2 (diff) | |
download | openttd-39912b7bdee684ea838303ec5fb1513977131b74.tar.xz |
(svn r24188) -Fix-ish [FS#5151] (r1): when changing the basics of a window (fullscreen, 8bpp/32bpp), and a window already exists, it was forced out of maximize mode, and its resolution/position was reset, often causing unwanted side-effects. As a "bonus", a WC_SIZE was triggered, and if the system was going from 8bpp to 32pp, this caused a forced window update in a limbo-state of the blitter (not fully 32bpp just yet, but for sure no longer 8bpp); this could cause random memory access which could lead to ACCESS_VIOLATIONS
Diffstat (limited to 'src')
-rw-r--r-- | src/video/win32_v.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index 270af12e8..d83395795 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -319,15 +319,13 @@ bool VideoDriver_Win32::MakeWindow(bool full_screen) #if !defined(WINCE) AdjustWindowRect(&r, style, FALSE); #endif - w = r.right - r.left; - h = r.bottom - r.top; - x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2; - y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2; - - if (_wnd.main_wnd) { - ShowWindow(_wnd.main_wnd, SW_SHOWNORMAL); // remove maximize-flag - SetWindowPos(_wnd.main_wnd, 0, x, y, w, h, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER); - } else { + + if (_wnd.main_wnd == NULL) { + w = r.right - r.left; + h = r.bottom - r.top; + x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2; + y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2; + TCHAR Windowtitle[50]; _sntprintf(Windowtitle, lengthof(Windowtitle), _T("OpenTTD %s"), MB_TO_WIDE(_openttd_revision)); |