[xorg-x11-server] Fix VT switch key handling

Adam Jackson ajax at fedoraproject.org
Wed Nov 28 18:25:15 UTC 2012


commit df013611258f4686aed152683b424223cd04e10b
Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Nov 28 13:25:14 2012 -0500

    Fix VT switch key handling

 ...r-ioctl-KDSKBMUTE-1-over-ioctl-KDSKBMODE-.patch |   86 ++++++++++++++++++++
 xorg-x11-server.spec                               |    8 ++-
 2 files changed, 93 insertions(+), 1 deletions(-)
---
diff --git a/0001-linux-Prefer-ioctl-KDSKBMUTE-1-over-ioctl-KDSKBMODE-.patch b/0001-linux-Prefer-ioctl-KDSKBMUTE-1-over-ioctl-KDSKBMODE-.patch
new file mode 100644
index 0000000..5f09053
--- /dev/null
+++ b/0001-linux-Prefer-ioctl-KDSKBMUTE-1-over-ioctl-KDSKBMODE-.patch
@@ -0,0 +1,86 @@
+From a15fd634d937aeac3845f269ec5a293a87b7d830 Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax at redhat.com>
+Date: Wed, 14 Nov 2012 13:19:01 -0500
+Subject: [PATCH] linux: Prefer ioctl(KDSKBMUTE, 1) over ioctl(KDSKBMODE,
+ K_OFF)
+
+K_OFF is a slightly broken interface, since if some other process
+(cough, systemd) sets the console state to K_UNICODE then it undoes
+K_OFF, and now Alt-F2 will switch terminals instead of summoning the
+Gnome "run command" dialog.
+
+KDSKBMUTE separates the "don't enqueue events" logic from the keymap, so
+doesn't have this problem.  Try it first, then continue falling back to
+older methods.
+
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=859485
+Tested-by: Josh Boyer <jwboyer at redhat.com>
+Signed-off-by: Adam Jackson <ajax at redhat.com>
+---
+ hw/xfree86/os-support/linux/lnx_init.c | 33 +++++++++++++++++++++++----------
+ 1 file changed, 23 insertions(+), 10 deletions(-)
+
+diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c
+index 68c296b..bcb039f 100644
+--- a/hw/xfree86/os-support/linux/lnx_init.c
++++ b/hw/xfree86/os-support/linux/lnx_init.c
+@@ -38,6 +38,14 @@
+ 
+ #include <sys/stat.h>
+ 
++#ifndef K_OFF
++#define K_OFF 0x4
++#endif
++
++#ifndef KDSKBMUTE
++#define KDSKBMUTE 0x4B51
++#endif
++
+ static Bool KeepTty = FALSE;
+ static int activeVT = -1;
+ 
+@@ -213,19 +221,23 @@ xf86OpenConsole(void)
+             tcgetattr(xf86Info.consoleFd, &tty_attr);
+             SYSCALL(ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode));
+ 
+-#ifdef K_OFF
+-            /* disable kernel special keys and buffering */
+-            SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_OFF));
++            /* disable kernel special keys and buffering, new style */
++            SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMUTE, 1));
+             if (ret < 0)
+-#endif
+             {
+-                SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW));
++                /* disable kernel special keys and buffering, old style */
++                SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_OFF));
+                 if (ret < 0)
+-                    FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
+-                               strerror(errno));
+-
+-                /* need to keep the buffer clean, else the kernel gets angry */
+-                xf86SetConsoleHandler(drain_console, NULL);
++                {
++                    /* fine, just disable special keys */
++                    SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW));
++                    if (ret < 0)
++                        FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n",
++                                   strerror(errno));
++
++                    /* ... and drain events, else the kernel gets angry */
++                    xf86SetConsoleHandler(drain_console, NULL);
++                }
+             }
+ 
+             nTty = tty_attr;
+@@ -271,6 +283,7 @@ xf86CloseConsole(void)
+         xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
+                 strerror(errno));
+ 
++    SYSCALL(ioctl(xf86Info.consoleFd, KDSKBMUTE, 0));
+     SYSCALL(ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode));
+     tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);
+ 
+-- 
+1.7.11.7
+
diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec
index 98d07e9..32156a7 100644
--- a/xorg-x11-server.spec
+++ b/xorg-x11-server.spec
@@ -43,7 +43,7 @@
 Summary:   X.Org X11 X server
 Name:      xorg-x11-server
 Version:   1.13.0
-Release:   9%{?gitdate:.%{gitdate}}%{dist}
+Release:   10%{?gitdate:.%{gitdate}}%{dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X
@@ -134,6 +134,9 @@ Patch7061:  v2-xf86-Fix-non-PCI-configuration-less-setups.patch
 # fdo Bug 54934 - Crash on XGrabDevice() of deactivated synaptics device -
 Patch7062: 0001-dix-fix-crash-on-XI-1.x-grabs-on-disabled-devices.-5.patch
 
+# Bug 878956 - After installation is complete, Alt+F4 is broken
+Patch7063: 0001-linux-Prefer-ioctl-KDSKBMUTE-1-over-ioctl-KDSKBMODE-.patch
+
 %global moduledir	%{_libdir}/xorg/modules
 %global drimoduledir	%{_libdir}/dri
 %global sdkdir		%{_includedir}/xorg
@@ -606,6 +609,9 @@ rm -rf $RPM_BUILD_ROOT
 %{xserver_source_dir}
 
 %changelog
+* Wed Nov 28 2012 Adam Jackson <ajax at redhat.com> 1.13.0-10
+- Fix VT switch key handling
+
 * Wed Nov 28 2012 Peter Hutterer <peter.hutterer at redhat.com> 1.13.0-9
 - Fix server crash when a XI 1.x device grab is activated on a disabled
   synaptics touchpad is disabled


More information about the scm-commits mailing list