This patch by Branden Robinson adds the option "DontVTSwitch" to
the X server serverflags section, which disables VT switching via
CTRL-ALT-Fx at runtime.
Tested in CVS for a few weeks, and comes from Debian prior to
that. Patch has had a fair bit of testing from Debian folk it
seems as it's been around for a while. I'm applying it to our
builds as well.
This is not a bug fix, so I don't expect it to get into 4.3.0,
however I thought I would submit it anyway and leave the decision
of wether or not to include it up to a CVS commiter, as a lot of
people ask about how to disable VTswitching.
If it doesn't go in, any comments about it would be appreciated,
which I'll communicate back down the line as well.
TIA
--
Mike A. Harris ftp://people.redhat.com/mharris
OS Systems Engineer - XFree86 maintainer - Red Hat
This patch by Branden Robinson.
diff -urN xc/programs/Xserver/hw/xfree86~/Registry
xc/programs/Xserver/hw/xfree86/Registry
--- xc/programs/Xserver/hw/xfree86~/Registry 2001-04-05 14:29:41.000000000 -0500
+++ xc/programs/Xserver/hw/xfree86/Registry 2002-09-06 21:32:43.000000000 -0500
@@ -214,6 +214,7 @@
BlankTime I F Screen saver timeout (min)
DisableModInDev B F disallow changing input devs
DisableVidModeExtension B F disable VidMode extension
+DontVTSwitch B F disable Ctrl-Alt-Fn
DontZap B F disable Ctrl-Alt-BS sequence
DontZoom B F disable Ctrl-Alt-+/-
NoTrapSignals B F don't trap signals
diff -urN xc/programs/Xserver/hw/xfree86~/XF86Conf.cpp
xc/programs/Xserver/hw/xfree86/XF86Conf.cpp
--- xc/programs/Xserver/hw/xfree86~/XF86Conf.cpp 2001-12-17 15:52:29.000000000
-0500
+++ xc/programs/Xserver/hw/xfree86/XF86Conf.cpp 2002-09-06 21:42:37.000000000 -0500
@@ -107,6 +107,12 @@
XCOMM Option "NoTrapSignals"
+XCOMM Uncomment this to disable the <Crtl><Alt><Fn> VT switch sequence
+XCOMM (where n is 1 through 12). This allows clients to receive these key
+XCOMM events.
+
+XCOMM Option "DontVTSwitch"
+
XCOMM Uncomment this to disable the <Crtl><Alt><BS> server abort sequence
XCOMM This allows clients to receive this key event.
diff -urN xc/programs/Xserver/hw/xfree86~/XF86Config.man
xc/programs/Xserver/hw/xfree86/XF86Config.man
--- xc/programs/Xserver/hw/xfree86~/XF86Config.man 2002-09-04 14:01:50.000000000
-0500
+++ xc/programs/Xserver/hw/xfree86/XF86Config.man 2002-09-06 21:38:26.000000000
+-0500
@@ -398,6 +398,16 @@
general you never want to use this option unless you are debugging
an X server problem and know how to deal with the consequences.
.TP 7
+.BI "Option \*qDontVTSwitch\*q \*q" boolean \*q
+This disallows the use of the
+.BI Ctrl+Alt+F n
+sequence (where
+.RI F n
+refers to one of the numbered function keys). That sequence is normally
+used to switch to another \(oqvirtual terminal\)cq on operating systems
+that have this feature. When this option is enabled, that key sequence has
+no special meaning and is passed to clients. Default: off.
+.TP 7
.BI "Option \*qDontZap\*q \*q" boolean \*q
This disallows the use of the
.B Ctrl+Alt+Backspace
diff -urN xc/programs/Xserver/hw/xfree86~/XFree86.man
xc/programs/Xserver/hw/xfree86/XFree86.man
--- xc/programs/Xserver/hw/xfree86~/XFree86.man 2002-09-04 14:01:50.000000000 -0500
+++ xc/programs/Xserver/hw/xfree86/XFree86.man 2002-09-06 21:40:20.000000000 -0500
@@ -384,7 +384,10 @@
.TP 8
.B Ctrl+Alt+F1...F12
For BSD and Linux systems with virtual terminal support, these keystroke
-combinations are used to switch to Virtual Console 1 through 12.
+combinations are used to switch to virtual terminals 1 through 12,
+respectively. This can be disabled with the
+.B DontVTSwitch
+XF86Config(__filemansuffix__) file option.
.SH SETUP
.I XFree86
uses a configuration file called \fBXF86Config\fP for its initial setup.
diff -urN xc/programs/Xserver/hw/xfree86~/common/xf86Config.c
xc/programs/Xserver/hw/xfree86/common/xf86Config.c
--- xc/programs/Xserver/hw/xfree86~/common/xf86Config.c 2002-01-14 20:56:55.000000000
-0500
+++ xc/programs/Xserver/hw/xfree86/common/xf86Config.c 2002-09-06 21:48:45.000000000
+-0500
@@ -679,6 +679,7 @@
typedef enum {
FLAG_NOTRAPSIGNALS,
+ FLAG_DONTVTSWITCH,
FLAG_DONTZAP,
FLAG_DONTZOOM,
FLAG_DISABLEVIDMODE,
@@ -714,6 +715,8 @@
static OptionInfoRec FlagOptions[] = {
{ FLAG_NOTRAPSIGNALS, "NoTrapSignals", OPTV_BOOLEAN,
{0}, FALSE },
+ { FLAG_DONTVTSWITCH, "DontVTSwitch", OPTV_BOOLEAN,
+ {0}, FALSE },
{ FLAG_DONTZAP, "DontZap", OPTV_BOOLEAN,
{0}, FALSE },
{ FLAG_DONTZOOM, "DontZoom", OPTV_BOOLEAN,
@@ -824,6 +827,7 @@
xf86ProcessOptions(-1, optp, FlagOptions);
xf86GetOptValBool(FlagOptions, FLAG_NOTRAPSIGNALS, &xf86Info.notrapSignals);
+ xf86GetOptValBool(FlagOptions, FLAG_DONTVTSWITCH, &xf86Info.dontVTSwitch);
xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap);
xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom);
diff -urN xc/programs/Xserver/hw/xfree86~/common/xf86Events.c
xc/programs/Xserver/hw/xfree86/common/xf86Events.c
--- xc/programs/Xserver/hw/xfree86~/common/xf86Events.c 2001-11-30 07:11:54.000000000
-0500
+++ xc/programs/Xserver/hw/xfree86/common/xf86Events.c 2002-09-06 21:54:13.000000000
+-0500
@@ -104,13 +104,13 @@
#endif
/*
- * The first of many hack's to get VT switching to work under
+ * The first of many hacks to get VT switching to work under
* Solaris 2.1 for x86. The basic problem is that Solaris is supposed
* to be SVR4. It is for the most part, except where the video interface
* is concerned. These hacks work around those problems.
- * See the comments for Linux, and SCO.
+ * See the comments for Linux, and SCO.
*
- * This is a toggleling variable:
+ * This is a toggling variable:
* FALSE = No VT switching keys have been pressed last time around
* TRUE = Possible VT switch Pending
* (DWH - 12/2/93)
@@ -689,7 +689,7 @@
#endif
if (down)
xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
- if (VTSwitchEnabled && !xf86Info.vtSysreq) return;
+ if (VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch)
+return;
}
break;
#endif /* linux || BSD with VTs */
@@ -710,7 +710,7 @@
*/
#ifdef USE_VT_SYSREQ
- if (VTSwitchEnabled && xf86Info.vtSysreq)
+ if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch)
{
switch (specialkey)
{
diff -urN xc/programs/Xserver/hw/xfree86~/common/xf86Globals.c
xc/programs/Xserver/hw/xfree86/common/xf86Globals.c
--- xc/programs/Xserver/hw/xfree86~/common/xf86Globals.c 2001-11-30
07:11:55.000000000 -0500
+++ xc/programs/Xserver/hw/xfree86/common/xf86Globals.c 2002-09-06 21:55:05.000000000
+-0500
@@ -104,6 +104,7 @@
-1, /* lastEventTime */
FALSE, /* vtRequestsPending */
FALSE, /* inputPending */
+ FALSE, /* dontVTSwitch */
FALSE, /* dontZap */
FALSE, /* dontZoom */
FALSE, /* notrapSignals */
diff -urN xc/programs/Xserver/hw/xfree86~/common/xf86Privstr.h
xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h
--- xc/programs/Xserver/hw/xfree86~/common/xf86Privstr.h 2001-11-30
07:11:55.000000000 -0500
+++ xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h 2002-09-06 21:56:43.000000000
+-0500
@@ -88,6 +88,7 @@
int lastEventTime;
Bool vtRequestsPending;
Bool inputPending;
+ Bool dontVTSwitch;
Bool dontZap;
Bool dontZoom;
Bool notrapSignals; /* don't exit cleanly - die at fault */
diff -urN xc/programs/Xserver/hw/xfree86~/drivers/newport/XF86Config.indy
xc/programs/Xserver/hw/xfree86/drivers/newport/XF86Config.indy
--- xc/programs/Xserver/hw/xfree86~/drivers/newport/XF86Config.indy 2000-12-14
15:59:12.000000000 -0500
+++ xc/programs/Xserver/hw/xfree86/drivers/newport/XF86Config.indy 2002-09-06
+21:43:11.000000000 -0500
@@ -107,6 +107,12 @@
# Option "NoTrapSignals"
+# Uncomment this to disable the <Crtl><Alt><Fn> VT switch sequence
+# (where n is 1 through 12). This allows clients to receive these key
+# events.
+
+# Option "DontVTSwitch"
+
# Uncomment this to disable the <Crtl><Alt><BS> server abort sequence
# This allows clients to receive this key event.
diff -urN xc/programs/Xserver/hw/xfree86~/xf86config/xf86config.c
xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c
--- xc/programs/Xserver/hw/xfree86~/xf86config/xf86config.c 2001-10-27
22:34:09.000000000 -0500
+++ xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c 2002-09-06
+21:46:34.000000000 -0500
@@ -53,6 +53,7 @@
* of /usr/X11R6/lib/X11.
* Add RAMDAC and Clockchip menu.
* 27Mar99 Modified for XFree86 4.0 config file format
+ * 06Sep02 Write comment block about 'DontVTSwitch'.
*
* Possible enhancements:
* - Add more standard mode timings (also applies to README.Config). Missing
@@ -1938,6 +1938,12 @@
"\n"
"# Option \"NoTrapSignals\"\n"
"\n"
+"# Uncomment this to disable the <Crtl><Alt><Fn> VT switch sequence\n"
+"# (where n is 1 through 12). This allows clients to receive these key\n"
+"# events.\n"
+"\n"
+"# Option \"DontVTSwitch\"\n"
+"\n"
"# Uncomment this to disable the <Crtl><Alt><BS> server abort sequence\n"
"# This allows clients to receive this key event.\n"
"\n"