[Scummvm-cvs-logs] CVS: scummvm/backends/sdl sdl-common.cpp,1.100,1.101

Travis Howell kirben at users.sourceforge.net
Tue Dec 16 01:59:02 CET 2003


Update of /cvsroot/scummvm/scummvm/backends/sdl
In directory sc8-pr-cvs1:/tmp/cvs-serv22387/backends/sdl

Modified Files:
	sdl-common.cpp 
Log Message:

Add capture mouse option, patch #860831
Uses Ctrl m to toggle, since that is closest to original games.
Disabled by default.


Index: sdl-common.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.cpp,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -d -r1.100 -r1.101
--- sdl-common.cpp	11 Dec 2003 05:36:07 -0000	1.100
+++ sdl-common.cpp	16 Dec 2003 09:58:21 -0000	1.101
@@ -635,6 +635,12 @@
 				return true;
 			}
 #else
+			// Ctrl-b toggles mouse capture
+			if (b == KBD_CTRL && ev.key.keysym.sym == 'm') {
+				property(PROP_TOGGLE_MOUSE_GRAB, NULL);
+				break;
+			}
+
 			// Ctrl-z and Alt-X quit
 			if ((b == KBD_CTRL && ev.key.keysym.sym == 'z') || (b == KBD_ALT && ev.key.keysym.sym == 'x')) {
 				event->event_code = EVENT_QUIT;
@@ -642,7 +648,7 @@
 			}
 #endif
 
-			// Ctr-Alt-<key> will change the GFX mode
+			// Ctrl-Alt-<key> will change the GFX mode
 			if ((b & (KBD_CTRL|KBD_ALT)) == (KBD_CTRL|KBD_ALT)) {
 				static const int gfxModes[][4] = {
 						{ GFX_NORMAL, GFX_DOUBLESIZE, GFX_TRIPLESIZE, -1 },
@@ -676,7 +682,7 @@
 				Property prop;
 				int factor = _scaleFactor - 1;
 
-				// Ctr-Alt-a toggles aspect ratio correction
+				// Ctrl-Alt-a toggles aspect ratio correction
 				if (ev.key.keysym.sym == 'a') {
 					property(PROP_TOGGLE_ASPECT_RATIO, NULL);
 					break;
@@ -1020,6 +1026,13 @@
 
 	case PROP_GET_SAMPLE_RATE:
 		return SAMPLES_PER_SEC;
+
+	case PROP_TOGGLE_MOUSE_GRAB:
+		if (SDL_WM_GrabInput(SDL_GRAB_QUERY) == SDL_GRAB_OFF)
+			SDL_WM_GrabInput(SDL_GRAB_ON);
+		else
+			SDL_WM_GrabInput(SDL_GRAB_OFF);
+		break;
 	}
 
 	return 0;





More information about the Scummvm-git-logs mailing list