summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2012-07-10 17:47:03 +0000
committerglx <glx@openttd.org>2012-07-10 17:47:03 +0000
commitad48f766f76ef0cdd7fd7eee8648bbfa3acc2461 (patch)
tree5428b7fdd2f971f6097a39d3939f91aa34a6154d /src
parent503c436cb2939a11ed8193aaf55086ecf71b7b77 (diff)
downloadopenttd-ad48f766f76ef0cdd7fd7eee8648bbfa3acc2461.tar.xz
(svn r24394) -Fix (r24188): changing resolution didn't resize the window
Diffstat (limited to 'src')
-rw-r--r--src/video/win32_v.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index df7510084..beeef29fe 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -305,7 +305,7 @@ bool VideoDriver_Win32::MakeWindow(bool full_screen)
{
RECT r;
DWORD style, showstyle;
- int x, y, w, h;
+ int w, h;
showstyle = SW_SHOWNORMAL;
_wnd.fullscreen = full_screen;
@@ -322,14 +322,15 @@ 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;
- 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;
-
+ if (_wnd.main_wnd != NULL) {
+ if (!_window_maximize) SetWindowPos(_wnd.main_wnd, 0, 0, 0, w, h, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOMOVE);
+ } else {
TCHAR Windowtitle[50];
+ int x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2;
+ int y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2;
_sntprintf(Windowtitle, lengthof(Windowtitle), _T("OpenTTD %s"), MB_TO_WIDE(_openttd_revision));
@@ -1055,6 +1056,8 @@ void VideoDriver_Win32::MainLoop()
bool VideoDriver_Win32::ChangeResolution(int w, int h)
{
+ if (_window_maximize) ShowWindow(_wnd.main_wnd, SW_SHOWNORMAL);
+
_wnd.width = _wnd.width_org = w;
_wnd.height = _wnd.height_org = h;