From: havoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Mon, 22 Jan 2007 19:31:49 +0000 (+0000)
Subject: two improvements to vid_restart in the SDL client: hardware gamma is now
X-Git-Tag: xonotic-v0.1.0preview~3677
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f9dcdc3e0de79608d613dc34c5bb1d14c32fa8a8;p=xonotic%2Fdarkplaces.git

two improvements to vid_restart in the SDL client: hardware gamma is now
restored after vid_restart, and the brief fullscreen window (used to reset
the SDL GL attributes) is now only used during vid_restart, not the initial
client startup


git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6731 d7cf8633-e32d-0410-b094-e92efae38249
---

diff --git a/vid_sdl.c b/vid_sdl.c
index 8a917822..af30f9cb 100644
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -473,6 +473,7 @@ static void VID_OutputVersion()
 int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate, int stereobuffer)
 {
 	int i;
+	static int notfirstvideomode = false;
 	int flags = SDL_OPENGL;
 	const char *drivername;
 
@@ -483,7 +484,9 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate
 		We cant switch from one OpenGL video mode to another.
 		Thus we first switch to some stupid 2D mode and then back to OpenGL.
 	*/
-	SDL_SetVideoMode( 0, 0, 0, 0 );
+	if (notfirstvideomode)
+		SDL_SetVideoMode( 0, 0, 0, 0 );
+	notfirstvideomode = true;
 
 	// SDL usually knows best
 	drivername = NULL;
@@ -587,6 +590,9 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate
 
 void VID_Shutdown (void)
 {
+	// this is needed to retry gamma after a vid_restart
+	VID_RestoreSystemGamma();
+
 	IN_Activate(false);
 	SDL_QuitSubSystem(SDL_INIT_VIDEO);
 }