[Scummvm-cvs-logs] scummvm master -> 468274a83a49ac9deca346761c17dbef97ff759a

bluegr bluegr at gmail.com
Thu Jun 20 22:36:03 CEST 2013


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
468274a83a TINSEL: Clip mouse position to be within the screen (bug #3613765)


Commit: 468274a83a49ac9deca346761c17dbef97ff759a
    https://github.com/scummvm/scummvm/commit/468274a83a49ac9deca346761c17dbef97ff759a
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2013-06-20T13:34:48-07:00

Commit Message:
TINSEL: Clip mouse position to be within the screen (bug #3613765)

The mouse cursor warping code via the keyboard allows the cursor to go
outside the screen. We now limit the cursor's position to always stay
within the screen

Changed paths:
    engines/tinsel/tinsel.h



diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index 56fed30..5eb3b7d 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -226,7 +226,11 @@ public:
 	Graphics::Surface &screen() { return _screenSurface; }
 
 	Common::Point getMousePosition() const { return _mousePos; }
-	void setMousePosition(const Common::Point &pt) {
+	void setMousePosition(Common::Point pt) {
+		// Clip mouse position to be within the screen coordinates
+		pt.x = CLIP<int16>(pt.x, 0, SCREEN_WIDTH - 1);
+		pt.y = CLIP<int16>(pt.y, 0, SCREEN_HEIGHT - 1);
+
 		int yOffset = TinselV2 ? (g_system->getHeight() - _screenSurface.h) / 2 : 0;
 		g_system->warpMouse(pt.x, pt.y + yOffset);
 		_mousePos = pt;






More information about the Scummvm-git-logs mailing list