[Scummvm-cvs-logs] SF.net SVN: scummvm:[49475] scummvm/branches/gsoc2010-opengl/backends/ platform/sdl/events.cpp

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Mon Jun 7 05:25:24 CEST 2010


Revision: 49475
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49475&view=rev
Author:   vgvgf
Date:     2010-06-07 03:25:24 +0000 (Mon, 07 Jun 2010)

Log Message:
-----------
Moved toggleMouseGrab from SdlGraphicsManager. Disabled some code, will fix later. Added code for access for moved variables and functions in SdlGraphicsManager.

Modified Paths:
--------------
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/events.cpp

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/events.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/events.cpp	2010-06-07 03:23:05 UTC (rev 49474)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/events.cpp	2010-06-07 03:25:24 UTC (rev 49475)
@@ -76,12 +76,12 @@
 	_km.y = y;
 
 	// Adjust for the screen scaling
-	if (!_overlayVisible) {
+	/*if (!_overlayVisible) { // FIXME
 		event.mouse.x /= _videoMode.scaleFactor;
 		event.mouse.y /= _videoMode.scaleFactor;
 		if (_videoMode.aspectRatioCorrection)
 			event.mouse.y = aspect2Real(event.mouse.y);
-	}
+	}*/
 }
 
 void OSystem_SDL::handleKbdMouse() {
@@ -184,8 +184,8 @@
 	handleKbdMouse();
 
 	// If the screen mode changed, send an Common::EVENT_SCREEN_CHANGED
-	if (_modeChanged) {
-		_modeChanged = false;
+	if (_graphicsManager->_modeChanged) {
+		_graphicsManager->_modeChanged = false;
 		event.type = Common::EVENT_SCREEN_CHANGED;
 		return true;
 	}
@@ -218,7 +218,7 @@
 		return handleJoyAxisMotion(ev, event);
 
 	case SDL_VIDEOEXPOSE:
-		_forceFull = true;
+		_graphicsManager->_forceFull = true;
 		break;
 
 	case SDL_QUIT:
@@ -243,7 +243,8 @@
 		event.kbd.flags |= Common::KBD_SCRL;
 
 	// Alt-Return and Alt-Enter toggle full screen mode
-	if (event.kbd.hasFlags(Common::KBD_ALT) && (ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_KP_ENTER)) {
+	// TODO: make a function in graphics manager for this
+	/*if (event.kbd.hasFlags(Common::KBD_ALT) && (ev.key.keysym.sym == SDLK_RETURN || ev.key.keysym.sym == SDLK_KP_ENTER)) {
 		beginGFXTransaction();
 			setFullscreenMode(!_videoMode.fullscreen);
 		endGFXTransaction();
@@ -255,10 +256,11 @@
 #endif
 
 		return false;
-	}
+	}*/
 
 	// Alt-S: Create a screenshot
-	if (event.kbd.hasFlags(Common::KBD_ALT) && ev.key.keysym.sym == 's') {
+	// TODO: make a function in graphics manager for this
+	/*if (event.kbd.hasFlags(Common::KBD_ALT) && ev.key.keysym.sym == 's') {
 		char filename[20];
 
 		for (int n = 0;; n++) {
@@ -275,7 +277,7 @@
 		else
 			printf("Could not save screenshot!\n");
 		return false;
-	}
+	}*/
 
 	// Ctrl-m toggles mouse capture
 	if (event.kbd.hasFlags(Common::KBD_CTRL) && ev.key.keysym.sym == 'm') {
@@ -310,7 +312,7 @@
 
 	// Ctrl-Alt-<key> will change the GFX mode
 	if ((event.kbd.flags & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) {
-		if (handleScalerHotkeys(ev.key))
+		if (_graphicsManager->handleScalerHotkeys(ev.key))
 			return false;
 	}
 
@@ -339,7 +341,7 @@
 	if (_scrollLock)
 		event.kbd.flags |= Common::KBD_SCRL;
 
-	if (isScalerHotkey(event))
+	if (_graphicsManager->isScalerHotkey(event))
 		// Swallow these key up events
 		return false;
 
@@ -350,7 +352,7 @@
 	event.type = Common::EVENT_MOUSEMOVE;
 	fillMouseEvent(event, ev.motion.x, ev.motion.y);
 
-	setMousePos(event.mouse.x, event.mouse.y);
+	_graphicsManager->setMousePos(event.mouse.x, event.mouse.y);
 	return true;
 }
 
@@ -570,3 +572,10 @@
 #endif
 	return false;
 }
+
+void OSystem_SDL::toggleMouseGrab() {
+	if (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_OFF)
+		SDL_WM_GrabInput(SDL_GRAB_ON);
+	else
+		SDL_WM_GrabInput(SDL_GRAB_OFF);
+}


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