send keycode/event type down the wire when SlowKeys enable, otherwise

GNOME won't warn about it (#816764)
This commit is contained in:
Peter Hutterer 2012-06-26 14:11:20 +10:00
parent beaa2767e8
commit 04385c3d68
3 changed files with 120 additions and 1 deletions

View File

@ -48,7 +48,7 @@
Summary: X.Org X11 X server
Name: xorg-x11-server
Version: 1.12.2
Release: 3%{?gitdate:.%{gitdate}}%{dist}
Release: 4%{?gitdate:.%{gitdate}}%{dist}
URL: http://www.x.org
License: MIT
Group: User Interface/X
@ -109,6 +109,10 @@ Patch7017: xserver-1.12.2-xorg-touch-test.patch
# print newline on -displayfd (824594)
Patch7018: xserver-1.12-os-print-newline-after-printing-display-name.patch
# send keycode/event type for slow keys enable (#816764)
Patch7019: xserver-1.12-xkb-warn-if-XKB-SlowKeys-have-been-automatically-ena.patch
Patch7020: xserver-1.12-xkb-fill-in-keycode-and-event-type-for-slow-keys-ena.patch
%define moduledir %{_libdir}/xorg/modules
%define drimoduledir %{_libdir}/dri
%define sdkdir %{_includedir}/xorg
@ -578,6 +582,10 @@ rm -rf $RPM_BUILD_ROOT
%{xserver_source_dir}
%changelog
* Tue Jun 26 2012 Peter Hutterer <peter.hutterer@redhat.com> 1.12.2-4
- send keycode/event type down the wire when SlowKeys enable, otherwise
GNOME won't warn about it (#816764)
* Thu Jun 21 2012 Peter Hutterer <peter.hutterer@redhat.com> 1.12.2-3
- print newline after printing $DISPLAY to -displayfd (#824594)

View File

@ -0,0 +1,68 @@
From 5b5941862cc88193fedd2e381f8bec4dcf411ec9 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 26 Jun 2012 10:30:35 +1000
Subject: [PATCH] xkb: fill in keycode and event type for slow keys enablement
eventType is set for the type that triggered a XkbControlsNotify event.
Technically, SlowKeys is triggered by a timer which doesn't have a matching
core event type. So we used to use 0 here.
Practically, the timer is triggered by a key press + hold and cancelled when
the key is released before the timeout expires. So we might as well set
KeyPress (keycode) in the ControlsNotify to give clients a chance to differ
between timer-triggered SlowKeys and client-triggered ones.
This is a chance in behaviour, though I suspect with little impact.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
include/xkbsrv.h | 1 +
xkb/xkbAccessX.c | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index a19c8fb..f839edb 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -171,6 +171,7 @@ typedef struct _XkbSrvInfo {
KeyCode mouseKey;
KeyCode inactiveKey;
KeyCode slowKey;
+ KeyCode slowKeyEnableKey;
KeyCode repeatKey;
CARD8 krgTimerActive;
CARD8 beepType;
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index fe28e12..e7e0b73 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -291,8 +291,8 @@ AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg)
return 4000;
}
xkbi->krgTimerActive = _OFF_TIMER;
- cn.keycode = 0;
- cn.eventType = 0;
+ cn.keycode = xkbi->slowKeyEnableKey;
+ cn.eventType = KeyPress;
cn.requestMajor = 0;
cn.requestMinor = 0;
if (xkbi->desc->ctrls->enabled_ctrls & XkbSlowKeysMask) {
@@ -304,6 +304,7 @@ AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg)
LogMessage(X_INFO, "XKB SlowKeys are now enabled. Hold shift to disable.\n");
}
+ xkbi->slowKeyEnableKey = 0;
return 0;
}
@@ -462,6 +463,7 @@ AccessXFilterPressEvent(DeviceEvent *event, DeviceIntPtr keybd)
if (ctrls->enabled_ctrls & XkbAccessXKeysMask) {
/* check for magic sequences */
if ((sym[0] == XK_Shift_R) || (sym[0] == XK_Shift_L)) {
+ xkbi->slowKeyEnableKey = key;
if (XkbAX_NeedFeedback(ctrls, XkbAX_SlowWarnFBMask)) {
xkbi->krgTimerActive = _KRG_WARN_TIMER;
xkbi->krgTimer = TimerSet(xkbi->krgTimer, 0, 4000,
--
1.7.10.2

View File

@ -0,0 +1,43 @@
From 2503936e2be820220ba0c4d80e45e268d433c063 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Wed, 6 Jun 2012 14:38:49 +1000
Subject: [PATCH] xkb: warn if XKB SlowKeys have been automatically enabled
Slow keys are enabled when the XKB AccessX features are generally enabled
(ctrls->enabled_ctrls & XkbAccessXKeysMask) and either shift key is held for
8 seconds. For the unsuspecting user this appears as if the keyboard
suddenly stops working.
Print a warning to the log, so we can later tell them "told you so".
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
---
xkb/xkbAccessX.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 111bf9f..765772b 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -295,10 +295,15 @@ AccessXKRGExpire(OsTimerPtr timer, CARD32 now, pointer arg)
cn.eventType = 0;
cn.requestMajor = 0;
cn.requestMinor = 0;
- if (xkbi->desc->ctrls->enabled_ctrls & XkbSlowKeysMask)
+ if (xkbi->desc->ctrls->enabled_ctrls & XkbSlowKeysMask) {
AccessXKRGTurnOff((DeviceIntPtr) arg, &cn);
- else
+ LogMessage(X_INFO, "XKB SlowKeys are disabled.\n");
+ }
+ else {
AccessXKRGTurnOn((DeviceIntPtr) arg, XkbSlowKeysMask, &cn);
+ LogMessage(X_INFO, "XKB SlowKeys are now enabled. Hold shift to disable.\n");
+ }
+
return 0;
}
--
1.7.10.2