Example #1
0
void IN_Restart_f(void)
{
	qbool old_mouse_active = mouse_active;

	IN_Shutdown();
	IN_Init();

	// if mouse was active before restart, try to re-activate it
	if (old_mouse_active) {
		IN_ActivateMouse();
	}
}
/*
========================
IN_InitDIMouse
========================
*/
bool IN_InitDIMouse( void ) {
	HRESULT		hr;
	if( win32.g_pdi == NULL ) {
		return false;
	}
	// obtain an interface to the system mouse device.
	hr = win32.g_pdi->CreateDevice( GUID_SysMouse, &win32.g_pMouse, NULL );
	if( FAILED( hr ) ) {
		common->Printf( "mouse: Couldn't open DI mouse device\n" );
		return false;
	}
	// Set the data format to "mouse format" - a predefined data format
	//
	// A data format specifies which controls on a device we
	// are interested in, and how they should be reported.
	//
	// This tells DirectInput that we will be passing a
	// DIMOUSESTATE2 structure to IDirectInputDevice::GetDeviceState.
	if( FAILED( hr = win32.g_pMouse->SetDataFormat( &c_dfDIMouse2 ) ) ) {
		common->Printf( "mouse: Couldn't set DI mouse format\n" );
		return false;
	}
	// set the cooperativity level.
	hr = win32.g_pMouse->SetCooperativeLevel( win32.hWnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND );
	if( FAILED( hr ) ) {
		common->Printf( "mouse: Couldn't set DI coop level\n" );
		return false;
	}
	// IMPORTANT STEP TO USE BUFFERED DEVICE DATA!
	//
	// DirectInput uses unbuffered I/O (buffer size = 0) by default.
	// If you want to read buffered data, you need to set a nonzero
	// buffer size.
	//
	// Set the buffer size to SAMPLE_BUFFER_SIZE (defined above) elements.
	//
	// The buffer size is a DWORD property associated with the device.
	DIPROPDWORD dipdw;
	dipdw.diph.dwSize       = sizeof( DIPROPDWORD );
	dipdw.diph.dwHeaderSize = sizeof( DIPROPHEADER );
	dipdw.diph.dwObj        = 0;
	dipdw.diph.dwHow        = DIPH_DEVICE;
	dipdw.dwData            = DINPUT_BUFFERSIZE; // Arbitary buffer size
	if( FAILED( hr = win32.g_pMouse->SetProperty( DIPROP_BUFFERSIZE, &dipdw.diph ) ) ) {
		common->Printf( "mouse: Couldn't set DI buffersize\n" );
		return false;
	}
	IN_ActivateMouse();
	// clear any pending samples
	Sys_PollMouseInputEvents();
	common->Printf( "mouse: DirectInput initialized.\n" );
	return true;
}
Example #3
0
/*
===========
IN_StartupMouse
===========
*/
void IN_StartupMouse (void)
{
	if ( COM_CheckParm ("-nomouse") ) 
		return; 

	mouseinitialized = true;

	if (COM_CheckParm ("-dinput"))
	{
		dinput = IN_InitDInput ();

		if (dinput)
		{
			Con_SafePrintf ("DirectInput initialized\n");
		}
		else
		{
			Con_SafePrintf ("DirectInput not initialized\n");
		}
	}

	if (!dinput)
	{
		mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0);

		if (mouseparmsvalid)
		{
			if ( COM_CheckParm ("-noforcemspd") ) 
				newmouseparms[2] = originalmouseparms[2];

			if ( COM_CheckParm ("-noforcemaccel") ) 
			{
				newmouseparms[0] = originalmouseparms[0];
				newmouseparms[1] = originalmouseparms[1];
			}

			if ( COM_CheckParm ("-noforcemparms") ) 
			{
				newmouseparms[0] = originalmouseparms[0];
				newmouseparms[1] = originalmouseparms[1];
				newmouseparms[2] = originalmouseparms[2];
			}
		}
	}

	mouse_buttons = 3;

// if a fullscreen video mode was set before the mouse was initialized,
// set the mouse state appropriately
	if (mouseactivatetoggle)
		IN_ActivateMouse ();
}
Example #4
0
/*
===============
IN_Init
===============
*/
void IN_Init( void )
{
	int appState;

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

	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_joystickDebug = Cvar_Get( "in_joystickDebug", "0", CVAR_TEMP );
	in_joystickThreshold = Cvar_Get( "in_joystickThreshold", "0.15", CVAR_ARCHIVE );

#ifdef MACOS_X_ACCELERATION_HACK
	in_disablemacosxmouseaccel = Cvar_Get( "in_disablemacosxmouseaccel", "1", CVAR_ARCHIVE );
#endif

	in_xbox360Controller = Cvar_Get( "in_xbox360Controller", "1", CVAR_TEMP );
	in_xbox360ControllerAvailable = Cvar_Get( "in_xbox360ControllerAvailable", "0", CVAR_ROM );
	in_xbox360ControllerDebug = Cvar_Get( "in_xbox360ControllerDebug", "0", CVAR_TEMP );

	SDL_EnableUNICODE( 1 );
	SDL_EnableKeyRepeat( SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL );
	keyRepeatEnabled = qtrue;

	if ( in_mouse->value )
	{
		mouseAvailable = qtrue;
		IN_ActivateMouse();
	}
	else
	{
		IN_DeactivateMouse();
		mouseAvailable = qfalse;
	}

	appState = SDL_GetAppState();
	Cvar_SetValue( "com_unfocused", !( appState & SDL_APPINPUTFOCUS ) );
	Cvar_SetValue( "com_minimized", !( appState & SDL_APPACTIVE ) );

	IN_InitJoystick();
	Com_DPrintf( "------------------------------------\n" );
}
Example #5
0
/*
===============
IN_Frame
===============
*/
void IN_Frame( void )
{
	qboolean loading;

	if ( in_xbox360ControllerAvailable->integer )
	{
		IN_Xbox360ControllerMove();
	}
	else
	{
		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 ( !Cvar_VariableIntegerValue( "r_fullscreen" ) && ( cls.keyCatchers & 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 if ( com_minimized->integer )
	{
		// Minimized
		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" );
	}
}
Example #6
0
/*
==================
IN_Frame

Called every frame, even if not generating commands
==================
*/
void IN_Frame()
{
	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( usercmdGen != NULL )
		{
			usercmdGen->Clear();
		}
		
		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
		}
	}
}
Example #7
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 );
	}
*/
}
Example #9
0
void IN_Frame( void )
{
	qboolean loading;

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

	IN_ProcessEvents( dropInput );
	dropInput = qfalse;

	// 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 || SDL_VERSION_ATLEAST( 2, 0, 0 ) ) &&
	     ( cls.keyCatchers & KEYCATCH_CONSOLE || ( CL_UIOwnsMouse() && !in_uigrab->integer ) ) )
	{
		// Console is down, or UI is up, in windowed mode
		IN_DeactivateMouse( qfalse );
	}
	else if ( ( !cls.glconfig.isFullscreen || SDL_VERSION_ATLEAST( 2, 0, 0 ) ) && loading )
	{
		// Loading in windowed mode
		IN_DeactivateMouse( qtrue );
	}
	else if ( !( SDL_GetWindowFlags( window ) & SDL_WINDOW_INPUT_FOCUS ) )
	{
		// Window not got focus
		IN_DeactivateMouse( qfalse );
	}
	else if ( com_minimized->integer )
	{
		// Minimized
		IN_DeactivateMouse( qtrue );
	}
	else
	{
		IN_ActivateMouse();
	}
}
Example #10
0
void IN_Init(void)
{
	int flags;

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

	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_joystickDebug     = Cvar_Get("in_joystickDebug", "0", CVAR_TEMP);
	in_joystickThreshold = Cvar_Get("joy_threshold", "0.15", CVAR_ARCHIVE);

/* Depreciated calls:
	SDL_EnableUNICODE(1);
	SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
	keyRepeatEnabled = qtrue;
*/

	if (in_mouse->value)
	{
		mouseAvailable = qtrue;
		IN_ActivateMouse();
	}
	else
	{
		IN_DeactivateMouse();
		mouseAvailable = qfalse;
	}

	flags = SDL_GetWindowFlags( SDLvidscreen );
	Cvar_SetValue("com_unfocused", !(flags & SDL_WINDOW_INPUT_FOCUS) );
	Cvar_SetValue("com_minimized", !(flags & SDL_WINDOW_MINIMIZED) );

	IN_InitJoystick();
}
Example #11
0
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;
		}
	}

	IN_ActivateMouse();
}
void IN_Frame(void)
{
	qboolean loading;

	HandleEvents();

	// 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
		IN_ActivateMouse();
}
Example #13
0
void IN_Frame (void) {

	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( ri.Cvar_Set )
		IN_ActivateMouse();
}
void IN_Init(void)
{
	Com_DPrintf("\n------- Input Initialization -------\n");

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

	if (in_mouse->value) {
		mouse_avail = qtrue;
		IN_ActivateMouse();
	} else {
		IN_DeactivateMouse();
		mouse_avail = qfalse;
	}

	Com_DPrintf("------------------------------------\n");
}
Example #15
0
void IN_Frame(void)
{
	qboolean loading;

	//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.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 (com_minimized->integer || com_unfocused->integer)
	{
		// Window not got focus
		IN_DeactivateMouse();
	}
	else
	{
		if (loading)
		{
			// Just eat up all the mouse events that are not used anyway
			IN_GobbleMotionEvents();
		}

		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");
	}

	IN_ProcessEvents();
}
Example #16
0
void IN_Frame(void)
{
	if (!sdl_window)
		return;

	HandleEvents();

	if (!ActiveApp || Minimized || (!r_fullscreen.integer && (key_dest != key_game || cls.state != ca_active))) {
		IN_DeactivateMouse();
		return;
	} else {
		IN_ActivateMouse();
	}

	if (mouse_active && SDL_GetRelativeMouseMode()) {
		SDL_GetRelativeMouseState(&mx, &my);
	}
	
}
Example #17
0
/*
===========
IN_StartupMouse
===========
*/
static void IN_StartupMouse (void)
{
	//IN_HideMouse ();
	if (safemode || COM_CheckParm ("-nomouse"))
	{
		SDL_WM_GrabInput (SDL_GRAB_OFF);
		return;
	}

	mouseinitialized = true;

	//if (mouseactivatetoggle)
#if 0	// change to 1 if dont want to disable mouse in fullscreen
	if ((modestate != MS_WINDOWED) || _enable_mouse.integer)
#else
	if (_enable_mouse.integer)
#endif
		IN_ActivateMouse ();
}
Example #18
0
/*
* IN_Frame
*
* Called every frame, even if not generating commands
*/
void IN_Frame( void ) {
	extern cvar_t *vid_fullscreen;

	if( !mouseinitialized ) {
		return;
	}

	if( vid_fullscreen ) {
		if( !vid_fullscreen->integer || cl_parent_hwnd ) {
			extern cvar_t *in_grabinconsole;

			// if we have a parent window (say, a browser plugin window) and
			// the window is not focused, deactivate the input
			if( cl_parent_hwnd && !AppFocused ) {
				if( in_appactive ) {
					IN_Activate( false );
				}
			} else if( in_grabinconsole->integer || cls.key_dest != key_console ) {
				if( !in_appactive && ActiveApp ) {
					IN_Activate( true );
				}
			} else {
				if( in_appactive ) {
					IN_Activate( false );
				}
			}
		} else {
			if( !ActiveApp && in_appactive ) {
				IN_Activate( false );
			} else if( ActiveApp && !in_appactive ) {
				IN_Activate( true );
			}
		}
	}

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

	IN_ActivateMouse();
}
/*
===============
IN_Init
===============
*/
void IN_Init( void )
{
	if( !SDL_WasInit( SDL_INIT_VIDEO ) )
	{
		Com_Error( ERR_FATAL, "IN_Init called before SDL_Init( SDL_INIT_VIDEO )\n" );
		return;
	}

	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_joystickDebug = Cvar_Get( "in_joystickDebug", "0", CVAR_TEMP );
	in_joystickThreshold = Cvar_Get( "in_joystickThreshold", "0.15", CVAR_ARCHIVE );

#ifdef MACOS_X_ACCELERATION_HACK
	in_disablemacosxmouseaccel = Cvar_Get( "in_disablemacosxmouseaccel", "1", CVAR_ARCHIVE );
#endif

	SDL_EnableUNICODE( 1 );
	SDL_EnableKeyRepeat( SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL );
	keyRepeatEnabled = qtrue;

	if( in_mouse->value )
	{
		mouseAvailable = qtrue;
		IN_ActivateMouse( );
	}
	else
	{
		IN_DeactivateMouse( );
		mouseAvailable = qfalse;
	}

	IN_InitJoystick( );
	Com_DPrintf( "------------------------------------\n" );
}
Example #20
0
/*
===========
IN_StartupMouse
===========
*/
static void IN_StartupMouse (void)
{
	mx = my = old_mouse_x = old_mouse_y = 0;

/*	IN_HideMouse ();*/
	if (safemode || COM_CheckParm ("-nomouse"))
	{
		IN_DeactivateMouse();
		return;
	}

	mouseinitialized = true;

// if a fullscreen video mode was set before the mouse was initialized,
// set the mouse state appropriately
	if (mouseactivatetoggle)
		IN_ActivateMouse ();
	else
		IN_DeactivateMouse ();
}
Example #21
0
/*
================
VID_HandlePause
================
*/
void VID_HandlePause (qboolean paused)
{
#if 0	// change to 1 if dont want to disable mouse in fullscreen
	if ((modestate == MS_WINDOWED) && _enable_mouse.integer)
#else
	if (_enable_mouse.integer)
#endif
	{
		// for consistency , don't show pointer S.A
		if (paused)
		{
			IN_DeactivateMouse ();
			// IN_ShowMouse ();
		}
		else
		{
			IN_ActivateMouse ();
			// IN_HideMouse ();
		}
	}
}
Example #22
0
void VID_ToggleFullscreen (void)
{
	int	is_fullscreen;

	if (!fs_toggle_works)
		return;
	if (!num_fmodes)
		return;
	if (!screen)
		return;

	S_ClearBuffer ();

	if ( SDL_WM_ToggleFullScreen(screen) > 0 )
	{
		is_fullscreen = (screen->flags & SDL_FULLSCREEN) ? 1 : 0;
		Cvar_SetValue("vid_config_fscr", is_fullscreen);
		modestate = (is_fullscreen) ? MS_FULLDIB : MS_WINDOWED;
		if (is_fullscreen)
		{
			// activate mouse in fullscreen mode
			// in_sdl.c handles other non-moused cases
			if (menu_disabled_mouse)
				IN_ActivateMouse();
		}
		else
		{	// windowed mode:
			// deactivate mouse if we are in menus
			if (menu_disabled_mouse)
				IN_DeactivateMouse();
		}
		// update the video menu option
		vid_menu_fs = (modestate != MS_WINDOWED);
	}
	else
	{
		fs_toggle_works = false;
		Con_Printf ("SDL_WM_ToggleFullScreen failed\n");
	}
}
Example #23
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( !cls.glconfig.isFullscreen && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
	{
		// Console is down in windowed mode
		IN_DeactivateMouse( );
	}
	else if( !cls.glconfig.isFullscreen && ( Key_GetCatcher( ) & KEYCATCH_CHATCONSOLE ) )
	{
		// 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" );
	}
}
Example #24
0
void AppActivate(BOOL fActive, BOOL minimize)
/****************************************************************************
*
* Function:     AppActivate
* Parameters:   fActive - True if app is activating
*
* Description:  If the application is activating, then swap the system
*               into SYSPAL_NOSTATIC mode so that our palettes will display
*               correctly.
*
****************************************************************************/
{
	static BOOL	sound_active;

	ActiveApp = fActive;
	Minimized = minimize;

// enable/disable sound on focus gain/loss
	if (!ActiveApp && sound_active)
	{
		S_BlockSound ();
		sound_active = false;
	}
	else if (ActiveApp && !sound_active)
	{
		S_UnblockSound ();
		sound_active = true;
	}

	if (fActive) {
		IN_ActivateMouse ();
		IN_HideMouse ();
	}
	else
	{
		IN_DeactivateMouse ();
		IN_ShowMouse ();
	}
}
Example #25
0
/*
===========
IN_StartupMouse
===========
*/
void IN_StartupMouse (void)
{
	HDC			hdc;

	if ( COM_CheckParm ("-nomouse") ) 
		return; 

	mouseinitialized = true;
	mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0);

	if (mouseparmsvalid)
	{
		if ( COM_CheckParm ("-noforcemspd") ) 
			newmouseparms[2] = originalmouseparms[2];

		if ( COM_CheckParm ("-noforcemaccel") ) 
		{
			newmouseparms[0] = originalmouseparms[0];
			newmouseparms[1] = originalmouseparms[1];
		}

		if ( COM_CheckParm ("-noforcemparms") ) 
		{
			newmouseparms[0] = originalmouseparms[0];
			newmouseparms[1] = originalmouseparms[1];
			newmouseparms[2] = originalmouseparms[2];
		}
	}

	mouse_buttons = 3;

	if (mouse_buttons > 3)
		mouse_buttons = 3;

// if a fullscreen video mode was set before the mouse was initialized,
// set the mouse state appropriately
	if (mouseactivatetoggle)
		IN_ActivateMouse ();
}
Example #26
0
/*
===============
IN_Frame
===============
*/
void IN_Frame( void )
{
	qboolean loading;

	IN_JoyMove( );
	IN_ProcessEvents( );
	IN_ShowHideScreenButtons( );
	IN_OpenCloseGyroscope( );

	// 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" );
	}
}
Example #27
0
/******************************************************************************
*
* Function:     AppActivate
* Parameters:   fActive - True if app is activating
*
* Description:  If the application is activating, then swap the system
*               into SYSPAL_NOSTATIC mode so that our palettes will display
*               correctly.
*
******************************************************************************/
void AppActivate(BOOL fActive, BOOL minimize) {
	static BOOL	sound_active;
	extern cvar_t sys_inactivesound;

	ActiveApp = fActive;
	Minimized = minimize;

	// enable/disable sound on focus gain/loss
	if (!ActiveApp && sound_active && !sys_inactivesound.value) {
		S_BlockSound ();
		sound_active = false;
	} else if (ActiveApp && !sound_active) {
		S_UnblockSound ();
		sound_active = true;
	}

	if ( fActive )
	{
//		if ( glConfig.isFullscreen /* || ( !glConfig.isFullscreen && _windowed_mouse.value && key_dest == key_game ) */ )
		{
			IN_ActivateMouse ();
			IN_HideMouse ();
		}
	}
	else
	{
//		if ( glConfig.isFullscreen /* || ( !glConfig.isFullscreen && _windowed_mouse.value ) */ )
		{
			IN_DeactivateMouse ();
			IN_ShowMouse ();
		}
	}

	// FIXME: where we must put this, before mouse activeate/deactivate or after?
	WG_AppActivate(fActive, minimize);
}
Example #28
0
void IN_Frame (void) {
	IN_JoyMove( );
	IN_ProcessEvents( );

	if( !cls.glconfig.isFullscreen && ( Key_GetCatcher( ) & KEYCATCH_CONSOLE ) )
	{
		// Console is down 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" );
	}
}
Example #29
0
void IN_SetQuakeMouseState (void)
{
	if (mouseactivatetoggle)
		IN_ActivateMouse ();
}
Example #30
0
File: in_win.c Project: jite/jquake
void IN_StartupMouse (void) 
{
	if (in_mouse.integer == mt_none)
		return;

	mouseinitialized = true;

	in_mwheeltype = MWHEEL_UNKNOWN;

#if DIRECTINPUT_VERSION	>= 0x0700
	if (in_mouse.integer == mt_dinput) 
	{
		dinput = IN_InitDInput();

		if (dinput) 
		{
			Com_Printf_State (PRINT_OK, "DirectInput initialized\n");
			mouse_buttons = 8;
			if (use_m_smooth)				
				Com_Printf_State (PRINT_OK, "Mouse smoothing initialized\n");
		} 
		else 
		{
			Com_Printf_State (PRINT_FAIL, "DirectInput not initialized\n");
		}
	}
#endif // DIRECTINPUT_VERSION	>= 0x0700

	if (!dinput) 
	{
		mouseparmsvalid = SystemParametersInfo (SPI_GETMOUSE, 0, originalmouseparms, 0);

		if (mouseparmsvalid) 
		{
			if (in_m_os_parameters.integer == 1)    
			{
				// Keeps the OS acceleration settings.
				newmouseparms[2] = originalmouseparms[2];
			}

			if (in_m_os_parameters.integer == 2) 
			{ 
				// Keeps the OS speed settings.
				newmouseparms[0] = originalmouseparms[0];
				newmouseparms[1] = originalmouseparms[1];
			}

            if (in_m_os_parameters.integer > 2) 
			{
				// Keeps both OS acceleration and speed settings.
				newmouseparms[0] = originalmouseparms[0];
				newmouseparms[1] = originalmouseparms[1];
				newmouseparms[2] = originalmouseparms[2];
			}
		}
		mouse_buttons = 8;

		#ifdef USINGRAWINPUT
		if (in_mouse.integer == mt_raw)
		{
			IN_RawInput_Init();
		}
		#endif // USINGRAWINPUT
	}

	// If a fullscreen video mode was set before the mouse was initialized, set the mouse state appropriately.
	if (mouseactivatetoggle)
		IN_ActivateMouse ();
}