r1441 - in trunk/code: null sdl sys

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Aug 9 09:20:00 EDT 2008


Author: tma
Date: 2008-08-09 09:20:00 -0400 (Sat, 09 Aug 2008)
New Revision: 1441

Modified:
   trunk/code/null/null_input.c
   trunk/code/sdl/sdl_glimp.c
   trunk/code/sdl/sdl_input.c
   trunk/code/sys/sys_local.h
   trunk/code/sys/sys_main.c
Log:
* Always show the mouse cursor when the mouse is disabled
* Rename IN_StartupJoystick to IN_InitJoystick, add IN_ShutdownJoystick
* Add IN_Restart, which avoids calling IN_DeactivateMouse at the wrong time
* Call IN_Restart when changing r_fullscreen
* Add CVAR_ROM r_sdlDriver for easy checking of the SDL driver in use
* Random README tweaks


Modified: trunk/code/null/null_input.c
===================================================================
--- trunk/code/null/null_input.c	2008-08-08 21:35:33 UTC (rev 1440)
+++ trunk/code/null/null_input.c	2008-08-09 13:20:00 UTC (rev 1441)
@@ -30,6 +30,9 @@
 void IN_Shutdown( void ) {
 }
 
+void IN_Restart( void ) {
+}
+
 void Sys_SendKeyEvents (void) {
 }
 

Modified: trunk/code/sdl/sdl_glimp.c
===================================================================
--- trunk/code/sdl/sdl_glimp.c	2008-08-08 21:35:33 UTC (rev 1440)
+++ trunk/code/sdl/sdl_glimp.c	2008-08-09 13:20:00 UTC (rev 1441)
@@ -78,6 +78,7 @@
 static SDL_Surface *screen = NULL;
 
 cvar_t *r_allowSoftwareGL; // Don't abort out if a hardware visual can't be obtained
+cvar_t *r_sdlDriver;
 
 void (APIENTRYP qglActiveTextureARB) (GLenum texture);
 void (APIENTRYP qglClientActiveTextureARB) (GLenum texture);
@@ -423,6 +424,7 @@
 
 		SDL_VideoDriverName( driverName, sizeof( driverName ) - 1 );
 		ri.Printf( PRINT_ALL, "SDL using driver \"%s\"\n", driverName );
+		Cvar_Set( "r_sdlDriver", driverName );
 	}
 
 	if (fullscreen && Cvar_VariableIntegerValue( "in_nograb" ) )
@@ -642,6 +644,7 @@
 	qboolean success = qtrue;
 
 	r_allowSoftwareGL = ri.Cvar_Get( "r_allowSoftwareGL", "0", CVAR_LATCH );
+	r_sdlDriver = ri.Cvar_Get( "r_sdlDriver", "", CVAR_ROM );
 
 	Sys_GLimpInit( );
 
@@ -732,6 +735,8 @@
 		if( !sdlToggled )
 			Cbuf_AddText( "vid_restart" );
 
+		IN_Restart( );
+
 		r_fullscreen->modified = qfalse;
 	}
 }

Modified: trunk/code/sdl/sdl_input.c
===================================================================
--- trunk/code/sdl/sdl_input.c	2008-08-08 21:35:33 UTC (rev 1440)
+++ trunk/code/sdl/sdl_input.c	2008-08-09 13:20:00 UTC (rev 1441)
@@ -323,9 +323,17 @@
 */
 static void IN_DeactivateMouse( void )
 {
-	if (!mouseAvailable || !SDL_WasInit( SDL_INIT_VIDEO ) )
+	if( !SDL_WasInit( SDL_INIT_VIDEO ) )
 		return;
 
+	// Always show the cursor when the mouse is disabled,
+	// but not when fullscreen
+	if( !r_fullscreen->integer )
+		SDL_ShowCursor( 1 );
+
+	if( !mouseAvailable )
+		return;
+
 #ifdef MACOS_X_ACCELERATION_HACK
 	if (mouseActive) // mac os x mouse accel hack
 	{
@@ -349,7 +357,6 @@
 	{
 		SDL_WM_GrabInput( SDL_GRAB_OFF );
 		SDL_WarpMouse( glConfig.vidWidth / 2, glConfig.vidHeight / 2 );
-		SDL_ShowCursor( 1 );
 
 		mouseActive = qfalse;
 	}
@@ -398,10 +405,10 @@
 
 /*
 ===============
-IN_StartupJoystick
+IN_InitJoystick
 ===============
 */
-static void IN_StartupJoystick( void )
+static void IN_InitJoystick( void )
 {
 	int i = 0;
 	int total = 0;
@@ -452,8 +459,22 @@
 	Com_DPrintf( "Balls: %d\n", SDL_JoystickNumBalls(stick) );
 
 	SDL_JoystickEventState(SDL_QUERY);
+}
 
-	return;
+/*
+===============
+IN_ShutdownJoystick
+===============
+*/
+static void IN_ShutdownJoystick( void )
+{
+	if (stick)
+	{
+		SDL_JoystickClose(stick);
+		stick = NULL;
+	}
+
+	SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
 }
 
 /*
@@ -773,18 +794,22 @@
 	in_disablemacosxmouseaccel = Cvar_Get ("in_disablemacosxmouseaccel", "1", CVAR_ARCHIVE);
 #endif
 
-	Cvar_Set( "cl_platformSensitivity", "1.0" );
-
 	SDL_EnableUNICODE(1);
 	SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
 	keyRepeatEnabled = qtrue;
 
-	if (in_mouse->value)
+	if( in_mouse->value )
+	{
 		mouseAvailable = qtrue;
+		IN_ActivateMouse( );
+	}
 	else
+	{
+		IN_DeactivateMouse( );
 		mouseAvailable = qfalse;
+	}
 
-	IN_StartupJoystick( );
+	IN_InitJoystick( );
 	Com_DPrintf ("------------------------------------\n");
 }
 
@@ -793,17 +818,21 @@
 IN_Shutdown
 ===============
 */
-void IN_Shutdown(void)
+void IN_Shutdown( void )
 {
-	IN_DeactivateMouse();
-
+	IN_DeactivateMouse( );
 	mouseAvailable = qfalse;
 
-	if (stick)
-	{
-		SDL_JoystickClose(stick);
-		stick = NULL;
-	}
+	IN_ShutdownJoystick( );
+}
 
-	SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
+/*
+===============
+IN_Restart
+===============
+*/
+void IN_Restart( void )
+{
+	IN_ShutdownJoystick( );
+	IN_Init( );
 }

Modified: trunk/code/sys/sys_local.h
===================================================================
--- trunk/code/sys/sys_local.h	2008-08-08 21:35:33 UTC (rev 1440)
+++ trunk/code/sys/sys_local.h	2008-08-09 13:20:00 UTC (rev 1441)
@@ -32,6 +32,7 @@
 void IN_Init( void );
 void IN_Frame( void );
 void IN_Shutdown( void );
+void IN_Restart( void );
 
 // Console
 void CON_Shutdown( void );

Modified: trunk/code/sys/sys_main.c
===================================================================
--- trunk/code/sys/sys_main.c	2008-08-08 21:35:33 UTC (rev 1440)
+++ trunk/code/sys/sys_main.c	2008-08-09 13:20:00 UTC (rev 1441)
@@ -112,8 +112,7 @@
 */
 void Sys_In_Restart_f( void )
 {
-	IN_Shutdown();
-	IN_Init();
+	IN_Restart( );
 }
 
 /*




More information about the quake3-commits mailing list