r526 - in trunk/code: client renderer unix

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Wed Jan 25 12:57:53 EST 2006


Author: tma
Date: 2006-01-25 12:57:53 -0500 (Wed, 25 Jan 2006)
New Revision: 526

Modified:
   trunk/code/client/cl_keys.c
   trunk/code/renderer/tr_init.c
   trunk/code/unix/sdl_glimp.c
Log:
* SDL build no longer requires a vid_restart when changing r_fullscreen


Modified: trunk/code/client/cl_keys.c
===================================================================
--- trunk/code/client/cl_keys.c	2006-01-25 01:13:06 UTC (rev 525)
+++ trunk/code/client/cl_keys.c	2006-01-25 17:57:53 UTC (rev 526)
@@ -1043,29 +1043,23 @@
 	}
 
 #ifndef _WIN32
-  if (key == K_ENTER)
-  {
-    if (down)
-    {
-      if (keys[K_ALT].down)
-      {
-        Key_ClearStates();
-        if (Cvar_VariableValue("r_fullscreen") == 0)
-        {
-          Com_Printf("Switching to fullscreen rendering\n");
-          Cvar_Set("r_fullscreen", "1");
-        }
-        else
-        {
-          Com_Printf("Switching to windowed rendering\n");
-          Cvar_Set("r_fullscreen", "0");
-        }
-        Cbuf_ExecuteText( EXEC_APPEND, "vid_restart\n");
-        return;
-      }
-    }
-  }
+	if (key == K_ENTER)
+	{
+		if (down)
+		{
+			if (keys[K_ALT].down)
+			{
+				Key_ClearStates();
+				Cvar_SetValue( "r_fullscreen",
+						!Cvar_VariableIntegerValue( "r_fullscreen" ) );
+#if !USE_SDL_VIDEO // This is handled in sdl_glimp.c/GLimp_EndFrame
+				Cbuf_ExecuteText( EXEC_APPEND, "vid_restart\n");
 #endif
+				return;
+			}
+		}
+	}
+#endif
 
 	// console key is hardcoded, so the user can never unbind it
 	if (key == '`' || key == '~') {

Modified: trunk/code/renderer/tr_init.c
===================================================================
--- trunk/code/renderer/tr_init.c	2006-01-25 01:13:06 UTC (rev 525)
+++ trunk/code/renderer/tr_init.c	2006-01-25 17:57:53 UTC (rev 526)
@@ -926,7 +926,11 @@
 	r_overBrightBits = ri.Cvar_Get ("r_overBrightBits", "1", CVAR_ARCHIVE | CVAR_LATCH );
 	r_ignorehwgamma = ri.Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE | CVAR_LATCH);
 	r_mode = ri.Cvar_Get( "r_mode", "3", CVAR_ARCHIVE | CVAR_LATCH );
+#if USE_SDL_VIDEO
+	r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE );
+#else
 	r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE | CVAR_LATCH );
+#endif
 	r_customwidth = ri.Cvar_Get( "r_customwidth", "1600", CVAR_ARCHIVE | CVAR_LATCH );
 	r_customheight = ri.Cvar_Get( "r_customheight", "1024", CVAR_ARCHIVE | CVAR_LATCH );
 	r_customaspect = ri.Cvar_Get( "r_customaspect", "1", CVAR_ARCHIVE | CVAR_LATCH );

Modified: trunk/code/unix/sdl_glimp.c
===================================================================
--- trunk/code/unix/sdl_glimp.c	2006-01-25 01:13:06 UTC (rev 525)
+++ trunk/code/unix/sdl_glimp.c	2006-01-25 17:57:53 UTC (rev 526)
@@ -1040,6 +1040,34 @@
     SDL_GL_SwapBuffers();
   }
 
+  if( r_fullscreen->modified )
+  {
+    qboolean    fullscreen;
+    qboolean    sdlToggled = qfalse;
+    SDL_Surface *s = SDL_GetVideoSurface( );
+
+    if( s )
+    {
+      // Find out the current state
+      if( s->flags & SDL_FULLSCREEN )
+        fullscreen = qtrue;
+      else
+        fullscreen = qfalse;
+
+      // Is the state we want different from the current state?
+      if( !!r_fullscreen->integer != fullscreen )
+        sdlToggled = SDL_WM_ToggleFullScreen( s );
+      else
+        sdlToggled = qtrue;
+    }
+
+    // SDL_WM_ToggleFullScreen didn't work, so do it the slow way
+    if( !sdlToggled )
+      Cbuf_AddText( "vid_restart" );
+
+    r_fullscreen->modified = qfalse;
+  }
+
   // check logging
   QGL_EnableLogging( (qboolean)r_logFile->integer ); // bk001205 - was ->value
 }




More information about the quake3-commits mailing list