Beispiel #1
0
void AppActivate(BOOL fActive, BOOL minimize)
{
	Minimized = minimize;

	Key_ClearStates();

	// we don't want to act like we're active if we're minimized
	if (fActive && !Minimized)
		ActiveApp = true;
	else
		ActiveApp = false;

	// minimize/restore mouse-capture on demand
	if (!ActiveApp)
	{
		IN_Activate (false);
		CDAudio_Activate (false);
		S_Activate (false);

		if ( win_noalttab->value )
		{
			WIN_EnableAltTab();
		}
	}
	else
	{
		IN_Activate (true);
		CDAudio_Activate (true);
		S_Activate (true);
		if ( win_noalttab->value )
		{
			WIN_DisableAltTab();
		}
	}
}
Beispiel #2
0
/*
============
VID_CheckChanges

This function gets called once just before drawing each frame, and it's sole purpose in life
is to check to see if any of the video mode parameters have changed, and if they have to 
update the rendering DLL and/or video mode to match.
============
*/
void VID_CheckChanges (void)
{
	if ( win_noalttab->modified )
	{
		if ( win_noalttab->value )
		{
			WIN_DisableAltTab();
		}
		else
		{
			WIN_EnableAltTab();
		}
		win_noalttab->modified = false;
	}

	if ( vid_ref_modified /*vid_ref->modified*/ )
	{
		cl.force_refdef = true;		// can't use a paused refdef
		S_StopAllSounds();
	}
	while ( vid_ref_modified /*vid_ref->modified*/ )
	{
		/*
		** refresh has changed
		*/
		vid_ref_modified = false;
		/*vid_ref->modified = false;*/
		vid_fullscreen->modified = true;
		cl.refresh_prepped = false;
		cls.disable_screen = true;

		if ( !VID_LoadRefresh() )
		{
			/*
			** drop the console if we fail to load a refresh
			*/
			if ( cls.key_dest != key_console )
			{
				Con_ToggleConsole_f();
			}
		}
		cls.disable_screen = false;
	}

	/*
	** update our window position
	*/
	if ( vid_xpos->modified || vid_ypos->modified )
	{
		if (!vid_fullscreen->value)
			VID_UpdateWindowPosAndSize( vid_xpos->value, vid_ypos->value );

		vid_xpos->modified = false;
		vid_ypos->modified = false;
	}
}
Beispiel #3
0
void VID_CheckChanges (void)
{
	char name[100];

	if (win_noalttab->modified)
	{
		if (win_noalttab->value)
			WIN_DisableAltTab();
		else
			WIN_EnableAltTab();

		win_noalttab->modified = false;
	}

	if (vid_ref->modified)
	{
		cl.force_refdef = true;		// can't use a paused refdef
		S_StopAllSounds();
	}

	while (vid_ref->modified)
	{
		char driverstring[32]; // jit
		cvar_t *gl_driver; // jit

		gl_driver = Cvar_Get("gl_driver", "opengl32", CVAR_ARCHIVE); // jit
		Com_sprintf(driverstring, sizeof(driverstring), "%s", gl_driver->string);
		Cvar_Get("gl_swapinterval", "0", CVAR_ARCHIVE)->modified = true; // jit

		/*
		** refresh has changed, jitodo, cheatcheck!
		*/
		vid_ref->modified = false;
		vid_fullscreen->modified = true;
		cl.refresh_prepped = false;
		cls.disable_screen = true;

		// jit -- only allow opengl32 or 3dfxgl:
		if (!Q_streq(gl_driver->string, "opengl32") && !Q_streq(gl_driver->string, "3dfxgl"))
			Cvar_Set("gl_driver", "opengl32");

//		Com_sprintf(name, sizeof(name), "ref_%s.dll", vid_ref->string );
		Com_sprintf(name, sizeof(name), "ref_pbgl.dll"); // jit

		if (!VID_LoadRefresh(name))
		{
			// jit3dfx - check if driver string changed:
			if (!Q_streq(gl_driver->string, driverstring)) 
			{
				vid_ref->modified = true;
				Q_strncpyz(driverstring, gl_driver->string, sizeof(driverstring));
			}

			if (!vid_ref->modified) // jit
				Com_Error(ERR_FATAL, "Unable to load OpenGL refresh!"); // jit

			// drop the console if we fail to load a refresh
			if (cls.key_dest != key_console)
				Con_ToggleConsole_f();
		}

		if (!vid_ref->modified) // jit3dfx
		{
			cls.disable_screen = false;
			CL_InitImages();
			M_ReloadMenu(); // jitmenu (need to do a full reload beacuse pic indexes can change)
		}
	}

	/*
	** update our window position
	*/
	if ( vid_xpos->modified || vid_ypos->modified )
	{
		if (!vid_fullscreen->value)
			VID_UpdateWindowPosAndSize( vid_xpos->value, vid_ypos->value );

		vid_xpos->modified = false;
		vid_ypos->modified = false;
	}
}
Beispiel #4
0
/*
============
VID_CheckChanges

This function gets called once just before drawing each frame, and it's sole purpose in life
is to check to see if any of the video mode parameters have changed, and if they have to 
update the rendering DLL and/or video mode to match.
============
*/
void VID_CheckChanges (void)
{
	char name[100];

	if ( win_noalttab->modified )
	{
		if ( win_noalttab->value )
		{
			WIN_DisableAltTab();
		}
		else
		{
			WIN_EnableAltTab();
		}
		win_noalttab->modified = 0;
	}

	if ( vid_ref->modified )
	{
		cl.force_refdef = 1;		// can't use a paused refdef
		S_StopAllSounds();
		Cam_Reset_f ();				// NeVo - reset the camera
	}
	while (vid_ref->modified)
	{
		/*
		** refresh has changed
		*/
		vid_ref->modified = 0;
		vid_fullscreen->modified = 1;
		cl.refresh_prepped = 0;
		cls.disable_screen = 1;

		Com_sprintf( name, sizeof(name), "ref_%s.dll", vid_ref->string );
		if ( !VID_LoadRefresh( name ) )
		{
			if ( strcmp (vid_ref->string, "soft") == 0 )
				Com_Error (ERR_FATAL, "Couldn't fall back to software refresh!");
			Cvar_Set( "vid_ref", "soft" );

			/*
			** drop the console if we fail to load a refresh
			*/
			if ( cls.key_dest != key_console )
			{
				Con_ToggleConsole_f();
			}
		}
		cls.disable_screen = 0;
	}

	/*
	** update our window position
	*/
	if ( vid_xpos->modified || vid_ypos->modified )
	{
		if (!vid_fullscreen->value)
			VID_UpdateWindowPosAndSize( vid_xpos->value, vid_ypos->value );

		vid_xpos->modified = 0;
		vid_ypos->modified = 0;
	}
}
Beispiel #5
0
//	main window procedure
static LRESULT WINAPI MainWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) {
	switch ( uMsg ) {
	case WM_CREATE:
		GMainWindow = hWnd;
		if ( r_fullscreen->integer ) {
			WIN_DisableAltTab();
		} else {
			WIN_EnableAltTab();
		}
		break;

	case WM_DESTROY:
		// let sound and input know about this?
		GMainWindow = NULL;
		if ( r_fullscreen->integer ) {
			WIN_EnableAltTab();
		}
		break;

	case WM_CLOSE:
		Cbuf_ExecuteText( EXEC_APPEND, "quit" );
		break;

	case WM_ACTIVATE:
		AppActivate( LOWORD( wParam ) != WA_INACTIVE, !!HIWORD( wParam ) );
		break;

	case WM_MOVE:
		if ( !r_fullscreen->integer ) {
			int xPos = ( short )LOWORD( lParam );	// horizontal position
			int yPos = ( short )HIWORD( lParam );	// vertical position

			RECT r;
			r.left   = 0;
			r.top    = 0;
			r.right  = 1;
			r.bottom = 1;

			int style = GetWindowLong( hWnd, GWL_STYLE );
			AdjustWindowRect( &r, style, FALSE );

			Cvar_SetValue( "vid_xpos", xPos + r.left );
			Cvar_SetValue( "vid_ypos", yPos + r.top );
			vid_xpos->modified = false;
			vid_ypos->modified = false;
			if ( ActiveApp ) {
				IN_Activate( true );
			}
		}
		break;

	case WM_SYSCOMMAND:
		if ( wParam == SC_SCREENSAVE ) {
			return 0;
		}
		break;

	case WM_SYSKEYDOWN:
		if ( wParam == 13 ) {
			if ( r_fullscreen ) {
				Cvar_SetValue( "r_fullscreen", !r_fullscreen->integer );
				Cbuf_AddText( "vid_restart\n" );
			}
			return 0;
		}
		// fall through
		break;

	case MM_MCINOTIFY:
		if ( CDAudio_MessageHandler( hWnd, uMsg, wParam, lParam ) == 0 ) {
			return 0;
		}
		break;
	}

	if ( IN_HandleInputMessage( uMsg, wParam, lParam ) ) {
		return 0;
	}

	return DefWindowProc( hWnd, uMsg, wParam, lParam );
}