summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2011-02-14 20:16:36 +0000
committerglx <glx@openttd.org>2011-02-14 20:16:36 +0000
commit1b2ef664162a4b9e684c8847e80db4269e97beec (patch)
treef1dbd9de1aaedf2d22cc92883fb55c1a430f9bc2
parent914f8e9f1d22e1195b06d8d4723a310ea9413b16 (diff)
downloadopenttd-1b2ef664162a4b9e684c8847e80db4269e97beec.tar.xz
(svn r22081) -Fix [FS#4489]: if fullscreen fails with current resolution, use desktop resolution
-rw-r--r--src/video/win32_v.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index 1230eeea2..dc230456d 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -255,6 +255,13 @@ static bool MakeWindow(bool full_screen)
settings.dmPelsHeight = _wnd.height_org;
settings.dmDisplayFrequency = _display_hz;
+ /* Test fullscreen with current resolution, if it fails use desktop resolution. */
+ if (ChangeDisplaySettings(&settings, CDS_FULLSCREEN | CDS_TEST) != DISP_CHANGE_SUCCESSFUL) {
+ RECT r;
+ GetWindowRect(GetDesktopWindow(), &r);
+ return _video_driver->ChangeResolution(r.right - r.left, r.bottom - r.top);
+ }
+
if (ChangeDisplaySettings(&settings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) {
MakeWindow(false); // don't care about the result
return false; // the request failed