mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 10:30:28 +00:00
(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
This commit is contained in:
parent
b1fd2913d2
commit
39912b7bde
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user