removed the unused alt-tab blocking code for Windows

This commit is contained in:
myT 2019-02-19 19:43:22 +01:00
parent 51809f8276
commit e42c05dfc8

View file

@ -30,59 +30,15 @@ cvar_t *vid_xpos; // X coordinate of window position
cvar_t *vid_ypos; // Y coordinate of window position cvar_t *vid_ypos; // Y coordinate of window position
cvar_t *r_fullscreen; cvar_t *r_fullscreen;
static qbool s_alttab_disabled;
#pragma warning(disable : 4702) // unreachable code
static void WIN_DisableAltTab()
{
//if ( s_alttab_disabled )
return;
if ( !Q_stricmp( Cvar_VariableString( "arch" ), "winnt" ) )
{
RegisterHotKey( 0, 0, MOD_ALT, VK_TAB );
}
else
{
BOOL old;
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 1, &old, 0 );
}
s_alttab_disabled = qtrue;
}
static void WIN_EnableAltTab()
{
if ( !s_alttab_disabled )
return;
if ( !Q_stricmp( Cvar_VariableString( "arch" ), "winnt" ) )
{
UnregisterHotKey( 0, 0 );
}
else
{
BOOL old;
SystemParametersInfo( SPI_SCREENSAVERRUNNING, 0, &old, 0 );
}
s_alttab_disabled = qfalse;
}
static void WIN_AppActivate( BOOL fActive, BOOL fMinimized ) static void WIN_AppActivate( BOOL fActive, BOOL fMinimized )
{ {
const qbool active = fActive && !fMinimized; const qbool active = fActive && !fMinimized;
if (r_fullscreen->integer) if ( r_fullscreen->integer )
SetWindowPos( g_wv.hWnd, active ? HWND_TOPMOST : HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE ); SetWindowPos( g_wv.hWnd, active ? HWND_TOPMOST : HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
Com_DPrintf("VID_AppActivate: %i\n", fActive ); Key_ClearStates();
Key_ClearStates(); // FIXME!!!
// we don't want to act like we're active if we're minimized // we don't want to act like we're active if we're minimized
g_wv.activeApp = active; g_wv.activeApp = active;
@ -223,11 +179,6 @@ LRESULT CALLBACK MainWndProc (
r_fullscreen = Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE | CVAR_LATCH ); r_fullscreen = Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE | CVAR_LATCH );
Cvar_Get( "r_monitor", "0", CVAR_ARCHIVE | CVAR_LATCH ); // 1-based monitor index, 0 means primary Cvar_Get( "r_monitor", "0", CVAR_ARCHIVE | CVAR_LATCH ); // 1-based monitor index, 0 means primary
if ( r_fullscreen->integer )
WIN_DisableAltTab();
else
WIN_EnableAltTab();
WIN_RegisterLastValidHotKey(); WIN_RegisterLastValidHotKey();
break; break;
@ -235,8 +186,6 @@ LRESULT CALLBACK MainWndProc (
case WM_DESTROY: case WM_DESTROY:
WIN_UnregisterHotKey(); WIN_UnregisterHotKey();
g_wv.hWnd = NULL; g_wv.hWnd = NULL;
if ( r_fullscreen->integer )
WIN_EnableAltTab();
break; break;
case WM_CLOSE: case WM_CLOSE:
@ -283,7 +232,7 @@ LRESULT CALLBACK MainWndProc (
break; break;
case WM_SYSKEYDOWN: case WM_SYSKEYDOWN:
if ( wParam == 13 ) if ( wParam == VK_RETURN )
{ {
if ( r_fullscreen ) if ( r_fullscreen )
{ {