[Scummvm-cvs-logs] SF.net SVN: scummvm: [29096] residual/trunk/driver_tinygl.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Tue Sep 25 06:59:44 CEST 2007


Revision: 29096
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29096&view=rev
Author:   eriktorbjorn
Date:     2007-09-24 21:59:44 -0700 (Mon, 24 Sep 2007)

Log Message:
-----------
Fix fullscreen toggling in TinyGL renderer. Before, it would create a new
screen surface, but keep drawing to the old one.

The test for when to try SDL_WM_ToggleFullScreen() is from ScummVM, and since
it involves OS X and Maemo (which probably won't run residual anyway), I cannot
verify for myself that it's correct.

Modified Paths:
--------------
    residual/trunk/driver_tinygl.cpp

Modified: residual/trunk/driver_tinygl.cpp
===================================================================
--- residual/trunk/driver_tinygl.cpp	2007-09-24 23:28:23 UTC (rev 29095)
+++ residual/trunk/driver_tinygl.cpp	2007-09-25 04:59:44 UTC (rev 29096)
@@ -124,11 +124,33 @@
 }
 
 void DriverTinyGL::toggleFullscreenMode() {
-	uint32 flags = SDL_HWSURFACE;
+	int result;
 
-	if (!_isFullscreen)
-		flags |= SDL_FULLSCREEN;
-	if (SDL_SetVideoMode(_screenWidth, _screenHeight, _screenBPP, flags) == 0)
+#if (defined(MACOSX) && !SDL_VERSION_ATLEAST(1, 2, 6)) || defined(__MAEMO__)
+	// On OS X, SDL_WM_ToggleFullScreen is currently not implemented. Worse,
+	// before SDL 1.2.6 it always returned -1 (which would indicate a
+	// successful switch). So we simply don't call it at all.
+	result = 0;
+#else
+	result = SDL_WM_ToggleFullScreen(_screen);
+#endif
+
+	if (!result) {
+		if (_screen)
+			SDL_FreeSurface(_screen);
+
+		uint32 flags = SDL_HWSURFACE;
+		if (!_isFullscreen)
+			flags |= SDL_FULLSCREEN;
+
+		_screen = SDL_SetVideoMode(_screenWidth, _screenHeight, _screenBPP, flags);
+		if (_screen == NULL)
+			error("Could not change fullscreen mode");
+		else
+			result = 1;
+	}
+
+	if (!result)
 		warning("Could not change fullscreen mode");
 	else
 		_isFullscreen = !_isFullscreen;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list