--- xc.orig/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c 2004-04-23 21:54:08.000000000 +0200 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c 2004-11-12 10:08:40.232022144 +0100 @@ -45,6 +45,7 @@ #endif static Bool KeepTty = FALSE; +static Bool VTSwitch = TRUE; static int VTnum = -1; static int activeVT = -1; @@ -202,11 +203,15 @@ /* * now get the VT */ - SYSCALL(result = ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno)); - if (result != 0) + if (VTSwitch) { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); + SYSCALL(result = ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno)); + if (result != 0) + { + xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); + } } + SYSCALL(result = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno)); if (result != 0) @@ -246,16 +251,21 @@ #endif } else - { - /* serverGeneration != 1 */ - /* - * now get the VT - */ - SYSCALL(result = ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno)); - if (result != 0) + { + /* serverGeneration != 1 */ + + if (VTSwitch) { - xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); + /* + * now get the VT + */ + SYSCALL(result = ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno)); + if (result != 0) + { + xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n"); + } } + SYSCALL(result = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno)); if (result != 0) @@ -281,14 +291,19 @@ VT.mode = VT_AUTO; ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */ } - /* - * Perform a switch back to the active VT when we were started - */ - if (activeVT >= 0) + + if (VTSwitch) { - ioctl(xf86Info.consoleFd, VT_ACTIVATE, activeVT); - activeVT = -1; + /* + * Perform a switch back to the active VT when we were started + */ + if (activeVT >= 0) + { + ioctl(xf86Info.consoleFd, VT_ACTIVATE, activeVT); + activeVT = -1; + } } + close(xf86Info.consoleFd); /* make the vt-manager happy */ restoreVtPerms(); /* restore the permissions */ @@ -308,6 +323,11 @@ KeepTty = TRUE; return(1); } + if (!strcmp(argv[i], "-novtswitch")) + { + VTSwitch = FALSE; + return(1); + } if ((argv[i][0] == 'v') && (argv[i][1] == 't')) { if (sscanf(argv[i], "vt%2d", &VTnum) == 0) @@ -327,5 +347,6 @@ ErrorF("vtXX use the specified VT number\n"); ErrorF("-keeptty "); ErrorF("don't detach controlling tty (for debugging only)\n"); + ErrorF("-novtswitch don't immediately switch to new VT\n"); return; }