Exemplo n.º 1
0
void GLimp_Shutdown()
{
    if ( dpy )
    {

        Sys_XUninstallGrabs();

        GLimp_RestoreGamma();

        qglXDestroyContext( dpy, ctx );

#if !defined( ID_GL_HARDLINK )
        GLimp_dlclose();
#endif

        XDestroyWindow( dpy, win );
        if ( vidmode_active )
        {
            XF86VidModeSwitchToMode( dpy, scrnum, vidmodes[0] );
        }

        XFlush( dpy );

        // FIXME: that's going to crash
        //XCloseDisplay( dpy );

        vidmode_active = false;
        dpy = NULL;
        win = 0;
        ctx = NULL;
    }
}
Exemplo n.º 2
0
void Sys_GrabMouseCursor( bool grabIt ) {

#if defined( ID_DEDICATED )
	return;
#endif

	if ( !dpy ) {
		#ifdef XEVT_DBG
			common->DPrintf("Sys_GrabMouseCursor: !dpy\n");
		#endif
		return;
	}

	if ( glConfig.isFullscreen ) {
		if ( !grabIt ) {
			return; // never ungrab while fullscreen
		}
		if ( in_nograb.GetBool() ) {
			common->DPrintf("forcing in_nograb 0 while running fullscreen\n");
			in_nograb.SetBool( false );
		}
	}

	if ( in_nograb.GetBool() ) {
		if ( in_dgamouse.GetBool() ) {
			common->DPrintf("in_nograb 1, forcing forcing DGA mouse off\n");
			in_dgamouse.SetBool( false );
		}
		if (grabIt) {
			mouse_active = true;
		} else {
			mouse_active = false;
		}
		return;
	}

	if ( grabIt && !mouse_active ) {
		Sys_XInstallGrabs();
	} else if ( !grabIt && mouse_active ) {
		Sys_XUninstallGrabs();
	}
}