/*
 * Init VT switch catching code
 * 	return 0 on success, -1 on error
 */
int
MwInitVt(void)
{
	ttyfd = open("/dev/tty0", O_RDONLY);
	if(ttyfd == -1)
		return EPRINTF("Error can't open tty0: %m\n");
	
	/* setup new tty mode*/
	if(ioctl (ttyfd, VT_GETMODE, &mode) == -1)
		return EPRINTF("Error can't get VT mode: %m\n");

	mode.mode = VT_PROCESS;
	mode.relsig = SIGVTSWITCH;
	mode.acqsig = SIGVTSWITCH;
	signal (SIGVTSWITCH, vt_switch);
	if(ioctl (ttyfd, VT_SETMODE, &mode) == -1)
		return EPRINTF("Error can't set VT mode: %m\n");

	mwcvt = mwocvt = mwvterm = MwCurrentVt();
	/*
	 * Note: this hack is required to get Linux
	 * to orient virtual 0,0 with physical 0,0
	 * I have no idea why this kluge is required...
	 */
	MwRedrawVt(mwvterm);

	return 0;
}
Exemple #2
0
/*
 * Here to close down the server.
 */
void
MwTerminate(void)
{
	GdCloseScreen(&scrdev);
	GdCloseMouse();
	GdCloseKeyboard();
#if VTSWITCH
	MwRedrawVt(mwvterm);
	MwExitVt();
#endif
	exit(0);
}
Exemple #3
0
/*
 * Here to close down the server.
 */
void
GsTerminate(void)
{
#if !NONETWORK
	GsCloseSocket();
#endif
	GdCloseScreen(rootwp->psd);
	GdCloseMouse();
	GdCloseKeyboard();
#if VTSWITCH
	MwRedrawVt(mwvterm);
#endif
	exit(0);
}