[Scummvm-cvs-logs] SF.net SVN: scummvm:[52248] scummvm/branches/gsoc2010-opengl/backends/ graphics/openglsdl

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Sat Aug 21 00:56:13 CEST 2010


Revision: 52248
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52248&view=rev
Author:   vgvgf
Date:     2010-08-20 22:56:13 +0000 (Fri, 20 Aug 2010)

Log Message:
-----------
OPENGL: Fix issue with resize events generated after going out of fullscreen mode.

Modified Paths:
--------------
    scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp	2010-08-20 22:23:12 UTC (rev 52247)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp	2010-08-20 22:56:13 UTC (rev 52248)
@@ -36,7 +36,8 @@
 	_lastFullscreenModeWidth(0),
 	_lastFullscreenModeHeight(0),
 	_desktopWidth(0),
-	_desktopHeight(0) {
+	_desktopHeight(0),
+	_ignoreResizeFrames(0) {
 
 	// Initialize SDL video subsystem
 	if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1) {
@@ -222,7 +223,13 @@
 	setMousePos(scaledX, scaledY);
 }
 
+void OpenGLSdlGraphicsManager::updateScreen() {
+	if (_ignoreResizeFrames)
+		_ignoreResizeFrames -= 1;
 
+	OpenGLGraphicsManager::updateScreen();
+}
+
 //
 // Intern
 //
@@ -500,6 +507,10 @@
 			setFullscreenMode(!_videoMode.fullscreen);
 		}
 	endGFXTransaction();
+
+	// Ignore resize events for the next 10 frames
+	_ignoreResizeFrames = 10;
+
 #ifdef USE_OSD
 	char buffer[128];
 	if (_videoMode.fullscreen)
@@ -564,14 +575,17 @@
 		break;*/
 	// HACK: Handle special SDL event
 	case OSystem_SDL::kSdlEventResize:
-		beginGFXTransaction();
-			// Set the new screen size. It is saved on the mouse event as part of HACK,
-			// there is no common resize event
-			_videoMode.hardwareWidth = event.mouse.x;
-			_videoMode.hardwareHeight = event.mouse.y;
-			_screenResized = true;
-			_transactionDetails.sizeChanged = true;
-		endGFXTransaction();
+		// Do not resize if ignoring resize events.
+		if (!_ignoreResizeFrames) {
+			beginGFXTransaction();
+				// Set the new screen size. It is saved on the mouse event as part of HACK,
+				// there is no common resize event
+				_videoMode.hardwareWidth = event.mouse.x;
+				_videoMode.hardwareHeight = event.mouse.y;
+				_screenResized = true;
+				_transactionDetails.sizeChanged = true;
+			endGFXTransaction();
+		}
 		return true;
 
 	default:

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h	2010-08-20 22:23:12 UTC (rev 52247)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.h	2010-08-20 22:56:13 UTC (rev 52248)
@@ -53,6 +53,8 @@
 
 	virtual bool notifyEvent(const Common::Event &event);
 
+	virtual void updateScreen();
+
 protected:
 	virtual void internUpdateScreen();
 
@@ -96,6 +98,12 @@
 
 	// If screen was resized by the user
 	bool _screenResized;
+
+	// Ignore resize events for the number of updateScreen() calls.
+	// Normaly resize events are user generated when resizing the window
+	// from its borders, but in some cases a resize event can be generated
+	// after a fullscreen change.
+	int _ignoreResizeFrames;
 };
 
 #endif


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