File zap_warning_xserver.diff of Package xorg-x11-server

diff -ur xorg-server-1.4.0.90-orig//hw/xfree86/common/xf86Config.c xorg-server-1.4.0.90/hw/xfree86/common/xf86Config.c
--- xorg-server-1.4.0.90-orig//hw/xfree86/common/xf86Config.c	2008-03-09 12:36:39.000000000 +0100
+++ xorg-server-1.4.0.90/hw/xfree86/common/xf86Config.c	2008-03-09 13:33:17.000000000 +0100
@@ -743,6 +743,7 @@
     FLAG_NOTRAPSIGNALS,
     FLAG_DONTVTSWITCH,
     FLAG_DONTZAP,
+    FLAG_ZAPWARNING,
     FLAG_DONTZOOM,
     FLAG_DISABLEVIDMODE,
     FLAG_ALLOWNONLOCAL,
@@ -788,6 +789,8 @@
 	{0}, FALSE },
   { FLAG_DONTZAP,		"DontZap",			OPTV_BOOLEAN,
 	{0}, FALSE },
+  { FLAG_ZAPWARNING,            "ZapWarning",                   OPTV_BOOLEAN,
+        {0}, FALSE },
   { FLAG_DONTZOOM,		"DontZoom",			OPTV_BOOLEAN,
 	{0}, FALSE },
   { FLAG_DISABLEVIDMODE,	"DisableVidModeExtension",	OPTV_BOOLEAN,
@@ -912,6 +915,7 @@
     xf86GetOptValBool(FlagOptions, FLAG_NOTRAPSIGNALS, &xf86Info.notrapSignals);
     xf86GetOptValBool(FlagOptions, FLAG_DONTVTSWITCH, &xf86Info.dontVTSwitch);
     xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap);
+    xf86GetOptValBool(FlagOptions, FLAG_ZAPWARNING, &xf86Info.ZapWarning);
     xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom);
 
     xf86GetOptValBool(FlagOptions, FLAG_ALLOW_DEACTIVATE_GRABS,
diff -ur xorg-server-1.4.0.90-orig//hw/xfree86/common/xf86Events.c xorg-server-1.4.0.90/hw/xfree86/common/xf86Events.c
--- xorg-server-1.4.0.90-orig//hw/xfree86/common/xf86Events.c	2008-03-09 13:27:24.000000000 +0100
+++ xorg-server-1.4.0.90/hw/xfree86/common/xf86Events.c	2008-03-09 13:30:18.000000000 +0100
@@ -267,12 +267,26 @@
 #endif
     switch (action) {
     case ACTION_TERMINATE:
-	if (!xf86Info.dontZap) {
+	if (xf86Info.dontZap)
+	    break;
+
+ 	if (xf86Info.ZapWarning) {
+	    static struct timeval LastZap = { 0, 0};
+	    struct timeval NewZap;
+
+	    gettimeofday(&NewZap, NULL);
+
+	    if ((NewZap.tv_sec - LastZap.tv_sec) >= 2) {
+		xf86OSRingBell(100, 1000, 500);
+		LastZap = NewZap;
+		break;
+	    }
+	}
+
 #ifdef XFreeXDGA
-	    DGAShutdown();
+	DGAShutdown();
 #endif
-	    GiveUp(0);
-	}
+	GiveUp(0);
 	break;
     case ACTION_NEXT_MODE:
 	if (!xf86Info.dontZoom)
diff -ur xorg-server-1.4.0.90-orig//hw/xfree86/common/xf86Globals.c xorg-server-1.4.0.90/hw/xfree86/common/xf86Globals.c
--- xorg-server-1.4.0.90-orig//hw/xfree86/common/xf86Globals.c	2008-03-09 12:36:39.000000000 +0100
+++ xorg-server-1.4.0.90/hw/xfree86/common/xf86Globals.c	2008-03-09 13:31:40.000000000 +0100
@@ -107,6 +107,7 @@
 	FALSE,		/* inputPending */
 	FALSE,		/* dontVTSwitch */
 	FALSE,		/* dontZap */
+	FALSE,		/* ZapWarning */
 	FALSE,		/* dontZoom */
 	FALSE,		/* notrapSignals */
 	FALSE,		/* caughtSignal */
diff -ur xorg-server-1.4.0.90-orig//hw/xfree86/common/xf86Privstr.h xorg-server-1.4.0.90/hw/xfree86/common/xf86Privstr.h
--- xorg-server-1.4.0.90-orig//hw/xfree86/common/xf86Privstr.h	2007-12-07 03:38:42.000000000 +0100
+++ xorg-server-1.4.0.90/hw/xfree86/common/xf86Privstr.h	2008-03-09 13:29:43.000000000 +0100
@@ -85,6 +85,7 @@
     Bool		inputPending;
     Bool		dontVTSwitch;
     Bool		dontZap;
+    Bool                ZapWarning;
     Bool		dontZoom;
     Bool		notrapSignals;	/* don't exit cleanly - die at fault */
     Bool		caughtSignal;
diff -ur xorg-server-1.4.0.90-orig//hw/xfree86/doc/man/xorg.conf.man.pre xorg-server-1.4.0.90/hw/xfree86/doc/man/xorg.conf.man.pre
--- xorg-server-1.4.0.90-orig//hw/xfree86/doc/man/xorg.conf.man.pre	2008-03-09 12:36:39.000000000 +0100
+++ xorg-server-1.4.0.90/hw/xfree86/doc/man/xorg.conf.man.pre	2008-03-09 13:42:36.000000000 +0100
@@ -446,6 +446,13 @@
 is passed to clients.
 Default: off.
 .TP 7
+.BI "Option \*qZapWarning\*q  \*q" boolean \*q
+This warns the user loudly when the
+.B Ctrl+Alt+Backspace
+sequence is pressed for the first time but still terminates the __xservername__
+server when this key-sequence is pressed again shortly after.
+Default: off.
+.TP 7
 .BI "Option \*qDontZoom\*q  \*q" boolean \*q
 This disallows the use of the
 .B Ctrl+Alt+Keypad\-Plus
--- xorg-server-1.4.0.90-orig/hw/xfree86/doc/man/Xorg.man.pre.orig	2008-05-16 16:46:39.000000000 +0200
+++ xorg-server-1.4.0.90/hw/xfree86/doc/man/Xorg.man.pre	2008-05-16 16:48:50.000000000 +0200
@@ -461,10 +461,10 @@
 are:
 .TP 8
 .B Ctrl+Alt+Backspace
-Immediately kills the server -- no questions asked.  This can be disabled
-with the
-.B DontZap
-__xconfigfile__(__filemansuffix__) file option.
+Immediately kills the server -- no questions asked. This behaviour can
+be changed with the
+.B DontZap/ZapWarning
+__xconfigfile__(__filemansuffix__) file options.
 .TP 8
 .B Ctrl+Alt+Keypad-Plus
 Change video mode to next one specified in the configuration file.
openSUSE Build Service is sponsored by