Beispiel #1
0
/*
==================
IN_Frame

Called every frame, even if not generating commands
==================
*/
void IN_Frame (void)
{
	if (!mouseinitialized)
		return;

	if (!in_mouse || !in_appactive)
	{
		IN_DeactivateMouse ();
		return;
	}

	if ( !cl.refresh_prepped
		|| cls.key_dest == key_console
		|| cls.key_dest == key_menu)
	{
		// temporarily deactivate if in fullscreen
		if (Cvar_VariableValue ("vid_fullscreen") == 0)
		{
			IN_DeactivateMouse ();
			return;
		}
	}

	IN_ActivateMouse ();
}
Beispiel #2
0
void IN_Frame() {
    bool loading;

    if (in_xbox360ControllerAvailable->integer) {
        IN_Xbox360ControllerMove();
    } else {
        IN_JoyMove();
    }

    // If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
    loading = (cls.state != CA_DISCONNECTED && cls.state != CA_ACTIVE);

    if (cls.keyCatchers & KEYCATCH_CONSOLE) {
        // Console is down in windowed mode
        IN_DeactivateMouse(false);
    } else if (loading) {
        // Loading in windowed mode
        IN_DeactivateMouse(true);
    } else if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_INPUT_FOCUS)) {
        // Window doesn't have focus
        IN_DeactivateMouse(false);
    } else if (com_minimized->integer) {
        // Minimized
        IN_DeactivateMouse(true);
    } else {
        IN_ActivateMouse();
    }

    IN_ProcessEvents(dropInput);
}
Beispiel #3
0
/*
===============
IN_Frame
===============
*/
void IN_Frame( void )
{
	qboolean loading;

	IN_JoyMove( );
	IN_ProcessEvents( );

	// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
	loading = ( clc.state != CA_DISCONNECTED && clc.state != CA_ACTIVE );

	if( !Cvar_VariableIntegerValue("r_fullscreen") && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
	{
		// Console is down in windowed mode
		IN_DeactivateMouse( );
	}
	else if( !Cvar_VariableIntegerValue("r_fullscreen") && loading )
	{
		// Loading in windowed mode
		IN_DeactivateMouse( );
	}
	else if( !( SDL_GetAppState() & SDL_APPINPUTFOCUS ) )
	{
		// Window not got focus
		IN_DeactivateMouse( );
	}
	else
		IN_ActivateMouse( );

	/* in case we had to delay actual restart of video system... */
	if ( (vidRestartTime != 0) && (vidRestartTime < Sys_Milliseconds()) )
	{
		vidRestartTime = 0;
		Cbuf_AddText( "vid_restart\n" );
	}
}
Beispiel #4
0
/*
==================
IN_Frame

Called every frame, even if not generating commands
==================
*/
void IN_Frame (void)
{
	if (!mouseinitialized)
		return;

	if (!in_mouse || !in_appactive)
	{
		IN_DeactivateMouse ();
		return;
	}

	if ( !cl.refresh_prepped
#ifdef __WXWINDOWS__
        || cls.window_hidden
#endif /// __WXWINDOWS__
#ifdef IML_Q2_EXTENSIONS
		// 1 February 2004 - IML - emk - Interactive mouse support.
		|| cls.interactivemouse
#endif IML_Q2_EXTENSIONS
		|| cls.key_dest == key_console
		|| cls.key_dest == key_menu)
	{
		// temporarily deactivate if in fullscreen
		if (Cvar_VariableValue ("vid_fullscreen") == 0)
		{
			IN_DeactivateMouse ();
			return;
		}
	}

	IN_ActivateMouse ();
}
Beispiel #5
0
void IN_Frame (void) {
	qboolean loading;

	IN_JoyMove( );

	// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
	loading = (qboolean)( cls.state != CA_DISCONNECTED && cls.state != CA_ACTIVE );

	if( !cls.glconfig.isFullscreen && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
	{
		// Console is down in windowed mode
		IN_DeactivateMouse( );
	}
	else if( !cls.glconfig.isFullscreen && loading )
	{
		// Loading in windowed mode
		IN_DeactivateMouse( );
	}
	else if( !( SDL_GetWindowFlags( SDL_window ) & SDL_WINDOW_INPUT_FOCUS ) )
	{
		// Window not got focus
		IN_DeactivateMouse( );
	}
	else
		IN_ActivateMouse( );

	IN_ProcessEvents( );
}
Beispiel #6
0
/*
==================
IN_Frame

Called every frame, even if not generating commands
==================
*/
void IN_Frame (void)
{
	CheckActive(cl_hwnd);

	if (!mouseinitialized)
		return;

	if (!in_mouse || !in_appactive)
	{
		IN_DeactivateMouse();
		return;
	}

	g_windowed = Cvar_VariableValue("vid_fullscreen") == 0.0f;

	if (!cl.refresh_prepped
		|| cls.key_dest == key_console
		)//|| cls.key_dest == key_menu) // jitmenu
	{
		// temporarily deactivate if in fullscreen
		if (g_windowed && !M_MenuActive()) // jitmenu / jitmouse
		{
			IN_DeactivateMouse();
			return;
		}
	}

	IN_ActivateMouse(!(M_MenuActive() && g_windowed)); // jitmenu - don't clip the cursor when we're on the menu in windowed mode.
}
Beispiel #7
0
/*
===============
IN_Frame
===============
*/
void IN_Frame(void)
{
	qboolean        loading;

	IN_JoyMove();
	IN_ProcessEvents();

	// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
	loading = (cls.state != CA_DISCONNECTED && cls.state != CA_ACTIVE);

	if(!cls.glconfig.isFullscreen && (Key_GetCatcher() & KEYCATCH_CONSOLE))
	{
		// Console is down in windowed mode
		IN_DeactivateMouse();
	}
	else if(!cls.glconfig.isFullscreen && loading)
	{
		// Loading in windowed mode
		IN_DeactivateMouse();
	}
	else if(!( SDL_GetWindowFlags(SDL_window) & SDL_WINDOW_INPUT_FOCUS))
	{
		// Window not got focus
		IN_DeactivateMouse();
	}
	else
		IN_ActivateMouse();

	// In case we had to delay actual restart of video system
	if( ( vidRestartTime != 0 ) && ( vidRestartTime < Sys_Milliseconds( ) ) )
	{
		vidRestartTime = 0;
		Cbuf_AddText( "vid_restart\n" );
	}
}
Beispiel #8
0
/*
==================
IN_Frame

Called every frame, even if not generating commands
==================
*/
void IN_Frame(void)
{
	// post joystick events
	IN_JoyMove();

	if(!s_wmv.mouseInitialized)
	{
		return;
	}

	if(cls.keyCatchers & KEYCATCH_CONSOLE)
	{
		// temporarily deactivate if not in the game and
		// running on the desktop
		// voodoo always counts as full screen
		if(Cvar_VariableValue("r_fullscreen") == 0 && strcmp(Cvar_VariableString("r_glDriver"), _3DFX_DRIVER_NAME))
		{
			IN_DeactivateMouse();
			return;
		}
	}

	if(!in_appactive)
	{
		IN_DeactivateMouse();
		return;
	}

	IN_ActivateMouse();

	// post events to the system que
	IN_MouseMove();

}
/*
===============
IN_Frame
===============
*/
void IN_Frame( void )
{
	qboolean loading;

	IN_JoyMove( );
	IN_ProcessEvents( );

	// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
	loading = !!( cls.state != CA_DISCONNECTED && cls.state != CA_ACTIVE );

	if( !r_fullscreen->integer && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
	{
		// Console is down in windowed mode
		IN_DeactivateMouse( );
	}
	else if( !r_fullscreen->integer && loading )
	{
		// Loading in windowed mode
		IN_DeactivateMouse( );
	}
	else if( !( SDL_GetAppState() & SDL_APPINPUTFOCUS ) )
	{
		// Window not got focus
		IN_DeactivateMouse( );
	}
	else
		IN_ActivateMouse( );
}
Beispiel #10
0
void
IN_Frame(void)
{
	qbool loading;

	IN_JoyMove( );
	IN_ProcessEvents( );

	/* If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading */
	loading = !!(clc.state != CA_DISCONNECTED && clc.state != CA_ACTIVE);

	if(!cvargeti("r_fullscreen") && (Key_GetCatcher( ) & KEYCATCH_CONSOLE)){
		/* Console is down in windowed mode */
		IN_DeactivateMouse( );
	}else if(!cvargeti("r_fullscreen") && loading){
		/* Loading in windowed mode */
		IN_DeactivateMouse( );
	}else if(!(SDL_GetAppState() & SDL_APPINPUTFOCUS)){
		/* Window not got focus */
		IN_DeactivateMouse( );
	}else
		IN_ActivateMouse( );

	/* in case we had to delay actual restart of video system... */
	if((vidRestartTime != 0) && (vidRestartTime < sysmillisecs())){
		vidRestartTime = 0;
		cbufaddstr("vid_restart");
	}
}
Beispiel #11
0
/*
===========
IN_Shutdown
===========
*/
void IN_Shutdown(void)
{
	IN_DeactivateMouse();

	IN_ShutdownMIDI();
	Cmd_RemoveCommand("midiinfo");

	if(directInput)
	{

		// release our mouse
		if(g_pMouse)
		{
			IDirectInputDevice_SetCooperativeLevel(g_pMouse, g_wv.hWnd, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND);
			IDirectInputDevice_Release(g_pMouse);
		}

		if(g_pdi)
		{
			IDirectInput_Release(g_pdi);
		}

		g_pMouse = NULL;
		g_pdi = NULL;

		// reset our values
		directInput_acquired = qfalse;
		directInput = qfalse;
	}
}
Beispiel #12
0
/*
** GLimp_Shutdown
**
** This routine does all OS specific shutdown procedures for the OpenGL
** subsystem.  Under OpenGL this means NULLing out the current DC and
** HGLRC, deleting the rendering context, and releasing the DC acquired
** for the window.  The state structure is also nulled out.
**
*/
void GLimp_Shutdown( void )
{
	if (!ctx || !dpy)
		return;
	IN_DeactivateMouse();
	XAutoRepeatOn(dpy);
	if (dpy) {
		if (ctx)
			qglXDestroyContext(dpy, ctx);
		if (win)
			XDestroyWindow(dpy, win);
		if (vidmode_active)
			XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[0]);
		XCloseDisplay(dpy);
	}
	vidmode_active = qfalse;
	dpy = NULL;
	win = 0;
	ctx = NULL;

	memset( &glConfig, 0, sizeof( glConfig ) );
	memset( &glState, 0, sizeof( glState ) );

	QGL_Shutdown();
}
/*
** GLimp_Shutdown
**
** This routine does all OS specific shutdown procedures for the OpenGL
** subsystem.  Under OpenGL this means NULLing out the current DC and
** HGLRC, deleting the rendering context, and releasing the DC acquired
** for the window.  The state structure is also nulled out.
**
*/
void GLimp_Shutdown( void )
{
	if (!ctx || !dpy)
		return;
	IN_DeactivateMouse();
	// bk001206 - replaced with H2/Fakk2 solution
	// XAutoRepeatOn(dpy);
	// autorepeaton = qfalse; // bk001130 - from cvs1.17 (mkv)
	if (dpy) {
		if (ctx)
			qglXDestroyContext(dpy, ctx);
		if (win)
			XDestroyWindow(dpy, win);
		if (vidmode_active)
			XF86VidModeSwitchToMode(dpy, scrnum, vidmodes[0]);
		XCloseDisplay(dpy);
	}
	vidmode_active = qfalse;
	dpy = NULL;
	win = 0;
	ctx = NULL;

	memset( &glConfig, 0, sizeof( glConfig ) );
	memset( &glState, 0, sizeof( glState ) );

	QGL_Shutdown();
}
void IN_Frame (void) {

  // bk001130 - from cvs 1.17 (mkv)
  IN_JoyMove(); // FIXME: disable if on desktop?
  
  if ( cls.keyCatchers & KEYCATCH_CONSOLE ) {
    // temporarily deactivate if not in the game and
    // running on the desktop
    // voodoo always counts as full screen
    if (Cvar_VariableValue ("r_fullscreen") == 0
	&& strcmp( Cvar_VariableString("r_glDriver"), _3DFX_DRIVER_NAME ) )	{
      IN_DeactivateMouse ();
      return;
    }
    // bk001206 - not used, now done the H2/Fakk2 way
    //if (dpy && !autorepeaton) {
    //  XAutoRepeatOn(dpy);
    //  autorepeaton = qtrue;
    //}
  } 
  //else if (dpy && autorepeaton) {
  //XAutoRepeatOff(dpy);
  //autorepeaton = qfalse;
  //}
 
  IN_ActivateMouse();
}
Beispiel #15
0
static void SetBufferSize(void) 
{
	static DIPROPDWORD dipdw = {
		{ sizeof(dipdw), sizeof(dipdw.diph), 0, DIPH_DEVICE },
		0
	};
	HRESULT hr;
	unsigned int bufsize;

	if (in_di_bufsize.integer)
	{  // we don't wont dynamic buffer change
		Com_Printf_State(PRINT_OK, "DirectInput overflow, increasing skipped because of %s.\n", in_di_bufsize.name);
		return;
	}

	bufsize = max(dipdw.dwData, DI_BufSize()); // well, DI_BufSize() return 16, since in_di_bufsize is zero
	dipdw.dwData = bufsize + max(1, bufsize / 2);

	Com_Printf_State(PRINT_INFO, "DirectInput overflow, increasing buffer size to %u.\n", dipdw.dwData);

	IN_DeactivateMouse();

	hr = IDirectInputDevice_SetProperty(g_pMouse, DIPROP_BUFFERSIZE, &dipdw.diph);

	IN_ActivateMouse();

	if(FAILED(hr)) 
	{
		Com_Printf_State (PRINT_FAIL, "Unable to increase DirectInput buffer size.\n");
	}
}
Beispiel #16
0
/*
===========
IN_Shutdown
===========
*/
void IN_Shutdown (void)
{
	IN_DeactivateMouse ();

#ifdef _WIN32
	if ( s_hMouseQuitEvent )
	{
		SetEvent( s_hMouseQuitEvent );
	}

	if ( s_hMouseThread )
	{
		if(WAIT_OBJECT_0 != WaitForSingleObject( s_hMouseThread, 5000 ))
		{
			TerminateThread( s_hMouseThread, 0 );
		}
		CloseHandle( s_hMouseThread );
		s_hMouseThread = (HANDLE)0;
	}

	if ( s_hMouseQuitEvent )
	{
		CloseHandle( s_hMouseQuitEvent );
		s_hMouseQuitEvent = (HANDLE)0;
	}

	if( s_hMouseThreadActiveLock )
	{
		CloseHandle( s_hMouseThreadActiveLock );
		s_hMouseThreadActiveLock = (HANDLE)0;
	}
#endif
}
/*
===========
IN_Shutdown
===========
*/
void IN_Shutdown (void)
{

	IN_DeactivateMouse ();
	IN_ShowMouse ();
	mouseinitialized = false;
}
Beispiel #18
0
//	This routine does all OS specific shutdown procedures for the OpenGL
// subsystem. This means deleting the rendering context, destroying the
// window and restoring video mode. The state structure is also nulled out.
void GLimp_Shutdown() {
	IN_DeactivateMouse();
	if ( dpy ) {
		GLW_DeleteDefaultLists();

		if ( ctx ) {
			glXDestroyContext( dpy, ctx );
		}
		if ( win ) {
			XDestroyWindow( dpy, win );
		}
		if ( vidmode_active ) {
			XF86VidModeSwitchToMode( dpy, scrnum, vidmodes[ 0 ] );
		}
		if ( glConfig.deviceSupportsGamma ) {
			XF86VidModeSetGamma( dpy, scrnum, &vidmode_InitialGamma );
		}
		// NOTE TTimo opening/closing the display should be necessary only once per run
		//   but it seems QGL_Shutdown gets called in a lot of occasion
		//   in some cases, this XCloseDisplay is known to raise some X errors
		//   ( https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=33 )
		XCloseDisplay( dpy );
	}
	vidmode_active = false;
	dpy = NULL;
	win = 0;
	ctx = NULL;

	Com_Memset( &glConfig, 0, sizeof ( glConfig ) );
	Com_Memset( &glState, 0, sizeof ( glState ) );
}
Beispiel #19
0
/*
==========================
IN_DeactivateMouseIfWindowed
==========================
*/
void IN_DeactivateMouseIfWindowed()
{
	if( !win32.cdsFullscreen )
	{
		IN_DeactivateMouse();
	}
}
void VID_Update (vrect_t *rects)
{
	vrect_t		rect;

	if (palette_changed)
	{
		palette_changed = false;
		rect.x = 0;
		rect.y = 0;
		rect.width = vid.width;
		rect.height = vid.height;
		rect.pnext = NULL;
		rects = &rect;
	}

	// We've drawn the frame; copy it to the screen
	FlipScreen (rects);

	// handle the mouse state when windowed if that's changed
#if 0	// change to 1 if dont want to disable mouse in fullscreen
	if (modestate == MS_WINDOWED)
#endif
		if (_enable_mouse.integer != enable_mouse)
		{
			if (_enable_mouse.integer)
				IN_ActivateMouse ();
			else
				IN_DeactivateMouse ();

			enable_mouse = _enable_mouse.integer;
		}
}
Beispiel #21
0
void IN_Frame(void)
{
	qboolean loading;
	qboolean fullscreen = qtrue;

	IN_JoyMove();
	IN_ProcessEvents();

	// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
	loading = !!(cls.state != CA_DISCONNECTED && cls.state != CA_ACTIVE);

	if (!fullscreen && (  (Key_GetCatcher() & KEYCATCH_CONSOLE) ||
			loading || !SDL_GetWindowGrab(SDLvidscreen)  ))
	{
		if (mouseActive)
			IN_DeactivateMouse();
	}
	else
	{
		if (!mouseActive)
			IN_ActivateMouse();
	}

	/* in case we had to delay actual restart of video system... */
	if ((vidRestartTime != 0) && (vidRestartTime < Sys_Milliseconds()))
	{
		vidRestartTime = 0;
		Cbuf_AddText("vid_restart");
	}
}
Beispiel #22
0
/*
===========
IN_Shutdown
===========
*/
void IN_Shutdown(void)
{
	IN_DeactivateMouse();

#ifdef _WIN32
	if(s_hMouseQuitEvent)
	{
		SetEvent(s_hMouseQuitEvent);
		WaitForSingleObject(s_hMouseDoneQuitEvent, 100);
	}

	if(s_hMouseThread)
	{
		TerminateThread(s_hMouseThread, 0);
		CloseHandle(s_hMouseThread);
		s_hMouseThread = (HANDLE)0;
	}

	if(s_hMouseQuitEvent)
	{
		CloseHandle(s_hMouseQuitEvent);
		s_hMouseQuitEvent = (HANDLE)0;
	}

	if(s_hMouseDoneQuitEvent)
	{
		CloseHandle(s_hMouseDoneQuitEvent);
		s_hMouseDoneQuitEvent = (HANDLE)0;
	}
#endif
}
Beispiel #23
0
void IN_Shutdown (void)
{
	IN_DeactivateClsCt ();
	IN_DeactivateGCPad ();
	IN_DeactivateWmote ();
	IN_DeactivateMouse ();
}
Beispiel #24
0
/*
===============
IN_Init
===============
*/
void IN_Init( void *windowData )
{
    int appState;

    if( !SDL_WasInit( SDL_INIT_VIDEO ) )
    {
        Com_Error( ERR_FATAL, "IN_Init called before SDL_Init( SDL_INIT_VIDEO )" );
        return;
    }

    SDL_window = (SDL_Window *)windowData;

    Com_DPrintf( "\n------- Input Initialization -------\n" );

    in_keyboardDebug = Cvar_Get( "in_keyboardDebug", "0", CVAR_ARCHIVE );

    // mouse variables
    in_mouse = Cvar_Get( "in_mouse", "1", CVAR_ARCHIVE );
    in_nograb = Cvar_Get( "in_nograb", "0", CVAR_ARCHIVE );

    in_joystick = Cvar_Get( "in_joystick", "0", CVAR_ARCHIVE|CVAR_LATCH );
    in_joystickThreshold = Cvar_Get( "joy_threshold", "0.15", CVAR_ARCHIVE );

    SDL_StartTextInput( );

    mouseAvailable = ( in_mouse->value != 0 );
    IN_DeactivateMouse( );

    appState = SDL_GetWindowFlags( SDL_window );
    Cvar_SetValue( "com_unfocused",	!( appState & SDL_WINDOW_INPUT_FOCUS ) );
    Cvar_SetValue( "com_minimized", appState & SDL_WINDOW_MINIMIZED );

    IN_InitJoystick( );
    Com_DPrintf( "------------------------------------\n" );
}
Beispiel #25
0
void IN_Frame (void)
{
	if ( cls.keyCatchers || cls.state != CA_ACTIVE ) {
		// temporarily deactivate if not in the game and
		// running on the desktop
		// voodoo always counts as full screen
		if (Cvar_VariableValue ("r_fullscreen") == 0
			&& strcmp( Cvar_VariableString("r_glDriver"), _3DFX_DRIVER_NAME ) )	{
			IN_DeactivateMouse ();
			return;
		}
		if (dpy && !autorepeaton) {
			XAutoRepeatOn(dpy);
			autorepeaton = qtrue;
		}
	} else if (dpy && autorepeaton) {
		XAutoRepeatOff(dpy);
		autorepeaton = qfalse;
	}

	IN_ActivateMouse();

	// post events to the system que
	IN_MouseMove();
}
Beispiel #26
0
/*
==================
IN_Frame

Called every frame, even if not generating commands
==================
*/
void IN_Frame( void ) {
	bool	shouldGrab = true;

	if ( !win32.in_mouse.GetBool() ) {
		shouldGrab = false;
	}
	// if fullscreen, we always want the mouse
	if ( !win32.cdsFullscreen ) {
		if ( win32.mouseReleased ) {
			shouldGrab = false;
		}
		if ( win32.movingWindow ) {
			shouldGrab = false;
		}
		if ( !win32.activeApp ) {
			shouldGrab = false;
		}
	}

	if ( shouldGrab != win32.mouseGrabbed ) {
		if ( win32.mouseGrabbed ) {
			IN_DeactivateMouse();
		} else {
			IN_ActivateMouse();

#if 0	// if we can't reacquire, try reinitializing
			if ( !IN_InitDIMouse() ) {
				win32.in_mouse.SetBool( false );
				return;
			}
#endif
		}
	}
}
/*
===========
IN_Activate

Called when the main window gains or loses focus.
The window may have been destroyed and recreated
between a deactivate and an activate.
===========
*/
void IN_Activate( qboolean active ) {
	in_appactive = active;

	if ( !active ) {
		IN_DeactivateMouse();
	}
}
Beispiel #28
0
/*
===============
IN_Shutdown
===============
*/
void IN_Shutdown( void )
{
	IN_DeactivateMouse( );
	mouseAvailable = qfalse;

	IN_ShutdownJoystick( );
}
Beispiel #29
0
/*
===============
IN_Frame
===============
*/
void IN_Frame( void )
{
	qboolean loading;

	//FIXME test, checking mouse grab
	if (in_checkForStolenMouseFocus->integer  &&  mouseActive  &&  !(SDL_GetAppState() & SDL_APPMOUSEFOCUS)) {
		Com_Printf("^3external application stole mouse focus\n");
	}

	IN_JoyMove( );

	// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
	loading = ( cls.state != CA_DISCONNECTED && cls.state != CA_ACTIVE );

	if( !r_fullscreen->integer && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
	{
		// Console is down in windowed mode
		IN_DeactivateMouse( );
	}
	else if( !r_fullscreen->integer && loading )
	{
		// Loading in windowed mode
		IN_DeactivateMouse( );
	}
	else if( !( SDL_GetAppState() & SDL_APPINPUTFOCUS ) )
	{
		// Window not got focus
		//Com_Printf("^3window lost focus\n");
		IN_DeactivateMouse( );
	}
	else {
		if (in_nograb->integer) {
			IN_DeactivateMouse();
		} else {
			IN_ActivateMouse( );
		}
	}

	IN_ProcessEvents( );

	// in case we had to delay actual restart of video system...
	if ( (vidRestartTime != 0) && (vidRestartTime < Sys_Milliseconds()) )
	{
		vidRestartTime = 0;
		Cbuf_AddText( "vid_restart\n" );
	}
}
/*
===============
IN_Frame
===============
*/
void IN_Frame( void )
{
	qboolean loading;
	qboolean cursorShowing;

	IN_JoyMove( );
	IN_ProcessEvents( );

	// If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading
	loading = !!( cls.state != CA_DISCONNECTED && cls.state != CA_ACTIVE );
	cursorShowing = Key_GetCatcher( ) & KEYCATCH_UI;

	if( !r_fullscreen->integer && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
	{
		// Console is down in windowed mode
		IN_DeactivateMouse( );
	}
	else if( !r_fullscreen->integer && loading )
	{
		// Loading in windowed mode
		IN_DeactivateMouse( );
	}
/*
	else if( !r_fullscreen->integer && cursorShowing )
	{
		// Use WM cursor when not fullscreen
		IN_DeactivateMouse( );
	}
*/
	else if( !( SDL_GetAppState() & SDL_APPINPUTFOCUS ) )
	{
		// Window not got focus
     	if( ( ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) && !r_fullscreen->integer ) || com_minimized->integer )
		IN_DeactivateMouse( );
	}
	else
		IN_ActivateMouse( );

/*
	if( !mouseActive )
	{
		SDL_GetMouseState( &x, &y );
		IN_SetUIMousePosition( x, y );
	}
*/
}