Index: code/win32/win_gamma.c =================================================================== --- code/win32/win_gamma.c (revision 951) +++ 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 951) +++ code/win32/win_glimp.c (working copy) @@ -76,6 +76,7 @@ // variable declarations // glwstate_t glw_state; +static DEVMODE glw_fs_dm; cvar_t *r_allowSoftwareGL; // don't abort out if the pixelformat claims software cvar_t *r_maskMinidriver; // allow a different dll name to be treated as if it were opengl32.dll @@ -108,6 +109,17 @@ return qtrue; } +qboolean GLW_ResetFullScreenMode( void ) +{ + if( !glw_fs_dm.dmSize ) + return qfalse; + + // restore the last working fullscreen DEVMODE + ChangeDisplaySettings( &glw_fs_dm, CDS_FULLSCREEN ); + GLimp_Init(); + return qtrue; +} + /* ** ChoosePFD ** @@ -580,6 +592,9 @@ int x, y, w, h; int exstyle; + // fullscreen DEVMODE for use with win_allowAltTab + memset( &glw_fs_dm, 0, sizeof( glw_fs_dm ) ); + // // register the window class if necessary // @@ -629,7 +644,7 @@ else { exstyle = 0; - stylebits = WINDOW_STYLE|WS_SYSMENU; + stylebits = WINDOW_STYLE|WS_SYSMENU|WS_MINIMIZEBOX; AdjustWindowRect (&r, stylebits, FALSE); } @@ -922,6 +937,10 @@ } } } + if( glw_state.cdsFullscreen ) + memcpy( &glw_fs_dm, &dm, sizeof( glw_fs_dm ) ); + else + memset( &glw_fs_dm, 0, sizeof( glw_fs_dm ) ); } else { Index: code/win32/win_wndproc.c =================================================================== --- code/win32/win_wndproc.c (revision 951) +++ 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 qboolean GLW_ResetFullScreenMode( 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,24 @@ 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 ) + { + if( !GLW_ResetFullScreenMode () ) + Cbuf_AddText( "vid_restart\n" ); + R_SetColorMappings (); + Com_Printf( "Alt-Tab support can be disabled with " + "\\win_allowAltTab 0\n" ); + } } } @@ -312,6 +343,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", "0", + CVAR_ARCHIVE | CVAR_LATCH); MSH_MOUSEWHEEL = RegisterWindowMessage("MSWHEEL_ROLLMSG"); if ( r_fullscreen->integer )