[Scummvm-cvs-logs] SF.net SVN: scummvm: [22679] scummvm/trunk/backends/sdl/graphics.cpp

wjpalenstijn at users.sourceforge.net wjpalenstijn at users.sourceforge.net
Sat May 27 05:41:01 CEST 2006


Revision: 22679
Author:   wjpalenstijn
Date:     2006-05-27 05:39:55 -0700 (Sat, 27 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22679&view=rev

Log Message:
-----------
fix warpmouse in overlay-mode; fixes cursor jumps when opening menu

Modified Paths:
--------------
    scummvm/trunk/backends/sdl/graphics.cpp
Modified: scummvm/trunk/backends/sdl/graphics.cpp
===================================================================
--- scummvm/trunk/backends/sdl/graphics.cpp	2006-05-27 12:37:00 UTC (rev 22678)
+++ scummvm/trunk/backends/sdl/graphics.cpp	2006-05-27 12:39:55 UTC (rev 22679)
@@ -1088,8 +1088,11 @@
 
 	// Since resolution could change, put mouse to adjusted position
 	// Fixes bug #1349059
-	x = _mouseCurState.x;
-	y = _mouseCurState.y;
+	x = _mouseCurState.x * _scaleFactor;
+	if (_adjustAspectRatio)
+		y = real2Aspect(_mouseCurState.y) * _scaleFactor;
+	else
+		y = _mouseCurState.y * _scaleFactor;
 
 	warpMouse(x, y);
 
@@ -1108,8 +1111,10 @@
 
 	// Since resolution could change, put mouse to adjusted position
 	// Fixes bug #1349059
-	x = _mouseCurState.x;
-	y = _mouseCurState.y;
+	x = _mouseCurState.x / _scaleFactor;
+	y = _mouseCurState.y / _scaleFactor;
+	if (_adjustAspectRatio)
+		y = aspect2Real(y);
 
 	warpMouse(x, y);
 
@@ -1250,11 +1255,14 @@
 void OSystem_SDL::warpMouse(int x, int y) {
 	int y1 = y;
 
-	if (_adjustAspectRatio)
+	if (_adjustAspectRatio && !_overlayVisible)
 		y1 = real2Aspect(y);
 
 	if (_mouseCurState.x != x || _mouseCurState.y != y) {
-		SDL_WarpMouse(x * _scaleFactor, y1 * _scaleFactor);
+		if (!_overlayVisible) 
+			SDL_WarpMouse(x * _scaleFactor, y1 * _scaleFactor);
+		else
+			SDL_WarpMouse(x, y1);
 
 		// SDL_WarpMouse() generates a mouse movement event, so
 		// setMousePos() would be called eventually. However, the
@@ -1482,20 +1490,16 @@
 		height = _screenHeight;
 		dst.x = _mouseCurState.x - _mouseCurState.hotX;
 		dst.y = _mouseCurState.y - _mouseCurState.hotY;
+		dst.w = _mouseCurState.w;
+		dst.h = _mouseCurState.h;
 	} else {
 		scale = 1;
 		width = _overlayWidth;
 		height = _overlayHeight;
 		dst.x = _mouseCurState.x - _mouseCurState.hHotX;
 		dst.y = _mouseCurState.y - _mouseCurState.hHotY;
-	}
-
-	if (_overlayVisible) {
 		dst.w = _mouseCurState.hW;
 		dst.h = _mouseCurState.hH;
-	} else {
-		dst.w = _mouseCurState.w;
-		dst.h = _mouseCurState.h;
 	}
 
 	// Note that addDirtyRect() will perform any necessary clipping


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