summaryrefslogtreecommitdiff
path: root/src/video
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-08-13 19:09:27 +0000
committerrubidium <rubidium@openttd.org>2008-08-13 19:09:27 +0000
commit75ea55cc65e9d0d7fd504fbda5b7116fbeb10746 (patch)
treeb0e6c920c8058ad64855dd03bd1bd55aebd6844a /src/video
parenta7d3d86f55d7256e05d2a8d554244af7e3949cb3 (diff)
downloadopenttd-75ea55cc65e9d0d7fd504fbda5b7116fbeb10746.tar.xz
(svn r14071) -Fix [FS#2057]: the screen wouldn't be centered on Windows multimonitor systems if the first monitor is right of the second one.
Diffstat (limited to 'src/video')
-rw-r--r--src/video/win32_v.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index 9f5c32045..ba60df200 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -18,6 +18,12 @@
#include <windows.h>
#include <tchar.h>
+/** Only MSVC has this header, MinGW supplies the required constants itself */
+#ifdef _MSC_VER
+# define COMPILE_MULTIMON_STUBS
+# include <multimon.h>
+#endif /* _MSC_VER */
+
static struct {
HWND main_wnd;
HBITMAP dib_sect;
@@ -280,8 +286,8 @@ static bool MakeWindow(bool full_screen)
#endif
w = r.right - r.left;
h = r.bottom - r.top;
- x = (GetSystemMetrics(SM_CXSCREEN) - w) / 2;
- y = (GetSystemMetrics(SM_CYSCREEN) - h) / 2;
+ x = ((GetSystemMetrics(SM_CXVIRTUALSCREEN) - w) / 2) - GetSystemMetrics(SM_XVIRTUALSCREEN);
+ y = ((GetSystemMetrics(SM_CYVIRTUALSCREEN) - h) / 2) - GetSystemMetrics(SM_YVIRTUALSCREEN);
if (_wnd.main_wnd) {
ShowWindow(_wnd.main_wnd, SW_SHOWNORMAL); // remove maximize-flag