Index: code/win32/win_gamma.c =================================================================== --- code/win32/win_gamma.c (revision 816) +++ code/win32/win_gamma.c (working copy) @@ -140,6 +140,9 @@ return; } + if (!g_wv.activeApp) + return; + //mapGammaMax(); for ( i = 0; i < 256; i++ ) { Index: code/win32/win_glimp.c =================================================================== --- code/win32/win_glimp.c (revision 816) +++ code/win32/win_glimp.c (working copy) @@ -108,6 +108,15 @@ return qtrue; } +void GLW_ResetFSMode( void ) +{ + // this will call GLW_SetMode() with the current fullscreen settings. + // It does not actually load the driver like the function name implies. + glw_state.cdsFullscreen = qfalse; + GLW_StartDriverAndSetMode( r_glDriver->string, r_mode->integer, + r_colorbits->integer, qtrue ); +} + /* ** ChoosePFD ** @@ -629,7 +638,7 @@ else { exstyle = 0; - stylebits = WINDOW_STYLE|WS_SYSMENU; + stylebits = WINDOW_STYLE|WS_SYSMENU|WS_MINIMIZEBOX; AdjustWindowRect (&r, stylebits, FALSE); } Index: code/win32/win_wndproc.c =================================================================== --- code/win32/win_wndproc.c (revision 816) +++ code/win32/win_wndproc.c (working copy) @@ -35,6 +35,7 @@ cvar_t *vid_xpos; // X coordinate of window position cvar_t *vid_ypos; // Y coordinate of window position cvar_t *r_fullscreen; +cvar_t *win_allowAltTab; #define VID_NUM_MODES ( sizeof( vid_modes ) / sizeof( vid_modes[0] ) ) @@ -47,6 +48,16 @@ if ( s_alttab_disabled ) return; + if ( win_allowAltTab->integer ) + { + Com_Printf("Alt-Tab support enabled (win_allowAltTab = 1)\n" ); + return; + } + else + { + Com_Printf("Alt-Tab support disabled (win_allowAltTab = 0)\n" ); + } + if ( !Q_stricmp( Cvar_VariableString( "arch" ), "winnt" ) ) { RegisterHotKey( 0, 0, MOD_ALT, VK_TAB ); @@ -84,8 +95,14 @@ VID_AppActivate ================== */ +extern void R_SetColorMappings( void ); +extern void WG_RestoreGamma( void ); +extern void GLW_ResetFSMode( void ); + static void VID_AppActivate(BOOL fActive, BOOL minimize) { + BOOL wasMinimized = g_wv.isMinimized; + g_wv.isMinimized = minimize; Com_DPrintf("VID_AppActivate: %i\n", fActive ); @@ -106,10 +123,23 @@ if (!g_wv.activeApp ) { IN_Activate (qfalse); + if ( r_fullscreen->integer ) + { + WG_RestoreGamma (); + ShowWindow ( g_wv.hWnd, SW_MINIMIZE ); + ChangeDisplaySettings ( 0, 0 ); + } } else { IN_Activate (qtrue); + if ( r_fullscreen->integer && wasMinimized ) + { + R_SetColorMappings (); + GLW_ResetFSMode (); + Com_Printf( "Alt-Tab support can be disabled with " + "\\win_allowAltTab 0\n" ); + } } } @@ -312,6 +342,8 @@ vid_xpos = Cvar_Get ("vid_xpos", "3", CVAR_ARCHIVE); vid_ypos = Cvar_Get ("vid_ypos", "22", CVAR_ARCHIVE); r_fullscreen = Cvar_Get ("r_fullscreen", "1", CVAR_ARCHIVE | CVAR_LATCH ); + win_allowAltTab = Cvar_Get ("win_allowAltTab", "1", + CVAR_ARCHIVE | CVAR_LATCH); MSH_MOUSEWHEEL = RegisterWindowMessage("MSWHEEL_ROLLMSG"); if ( r_fullscreen->integer )