Disable AccessX on exit if no settings changed (#816764)

This commit is contained in:
Bastien Nocera 2013-01-28 18:35:28 +01:00
parent 06e87f8bac
commit c676b5d6aa
2 changed files with 137 additions and 1 deletions

View File

@ -0,0 +1,130 @@
From a53f1c87be48eae461b4e634470a508def9e1f88 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Mon, 28 Jan 2013 17:58:50 +0100
Subject: [PATCH 1/2] a11y-keyboard: Use macro for everything mask
Less to copy/paste
---
plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
index a227dd4..afcc0c4 100644
--- a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
+++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
@@ -68,6 +68,17 @@ struct GsdA11yKeyboardManagerPrivate
NotifyNotification *notification;
};
+#define DEFAULT_XKB_SET_CONTROLS_MASK XkbSlowKeysMask | \
+ XkbBounceKeysMask | \
+ XkbStickyKeysMask | \
+ XkbMouseKeysMask | \
+ XkbMouseKeysAccelMask | \
+ XkbAccessXKeysMask | \
+ XkbAccessXTimeoutMask | \
+ XkbAccessXFeedbackMask | \
+ XkbControlsEnabledMask
+
+
static void gsd_a11y_keyboard_manager_class_init (GsdA11yKeyboardManagerClass *klass);
static void gsd_a11y_keyboard_manager_init (GsdA11yKeyboardManager *a11y_keyboard_manager);
static void gsd_a11y_keyboard_manager_finalize (GObject *object);
@@ -313,15 +324,7 @@ set_server_from_gsettings (GsdA11yKeyboardManager *manager)
gdk_error_trap_push ();
XkbSetControls (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
- XkbSlowKeysMask |
- XkbBounceKeysMask |
- XkbStickyKeysMask |
- XkbMouseKeysMask |
- XkbMouseKeysAccelMask |
- XkbAccessXKeysMask |
- XkbAccessXTimeoutMask |
- XkbAccessXFeedbackMask |
- XkbControlsEnabledMask,
+ DEFAULT_XKB_SET_CONTROLS_MASK,
desc);
XkbFreeKeyboard (desc, XkbAllComponentsMask, True);
--
1.8.0.1
From bff2c30670731ba79c9eb7e0d0e90efb780a1bd0 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Mon, 28 Jan 2013 17:59:21 +0100
Subject: [PATCH 2/2] a11y-keyboard: Disable everything on exit if no settings
changed
The default setting in GDM is to have the keys enablable
through keyboard shortcuts, and this gets inherited by the
user sessions.
The problem is that non-GNOME users won't have anything
changing those defaults back to their expected values
(so that Slow Keys don't triggered for example), and this
causes problems:
https://bugzilla.redhat.com/show_bug.cgi?id=816764
If the user doesn't change anything to the defaults in the GDM
session, we revert to the pre-"GNOME session" values.
https://bugzilla.gnome.org/show_bug.cgi?id=685063
---
plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c | 25 +++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
index afcc0c4..7dbf2e2 100644
--- a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
+++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
@@ -63,6 +63,8 @@ struct GsdA11yKeyboardManagerPrivate
GtkWidget *preferences_dialog;
GtkStatusIcon *status_icon;
+ XkbDescRec *desc;
+
GSettings *settings;
NotifyNotification *notification;
@@ -948,6 +950,9 @@ start_a11y_keyboard_idle_cb (GsdA11yKeyboardManager *manager)
set_devicepresence_handler (manager);
+ /* Get the original configuration from the server */
+ manager->priv->desc = get_xkb_desc_rec (manager);
+
event_mask = XkbControlsNotifyMask;
event_mask |= XkbAccessXNotifyMask; /* make default when AXN_AXKWarning works */
@@ -993,6 +998,26 @@ gsd_a11y_keyboard_manager_stop (GsdA11yKeyboardManager *manager)
g_debug ("Stopping a11y_keyboard manager");
+ if (p->desc != NULL) {
+ XkbDescRec *desc;
+
+ desc = get_xkb_desc_rec (manager);
+ if (desc != NULL) {
+ if (p->desc->ctrls->enabled_ctrls != desc->ctrls->enabled_ctrls) {
+ gdk_error_trap_push ();
+ XkbSetControls (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
+ DEFAULT_XKB_SET_CONTROLS_MASK,
+ p->desc);
+
+ XSync (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), FALSE);
+ gdk_error_trap_pop_ignored ();
+ }
+ XkbFreeKeyboard (desc, XkbAllComponentsMask, True);
+ }
+ XkbFreeKeyboard (p->desc, XkbAllComponentsMask, True);
+ p->desc = NULL;
+ }
+
if (p->start_idle_id != 0) {
g_source_remove (p->start_idle_id);
p->start_idle_id = 0;
--
1.8.0.1

View File

@ -1,6 +1,6 @@
Name: gnome-settings-daemon
Version: 3.6.4
Release: 2%{?dist}
Release: 3%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
Group: System Environment/Daemons
@ -10,6 +10,8 @@ URL: http://download.gnome.org/sources/%{name}
Source: http://download.gnome.org/sources/%{name}/3.6/%{name}-%{version}.tar.xz
# disable wacom for ppc/ppc64 (used on RHEL)
Patch0: %{name}-3.5.4-ppc-no-wacom.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=816764
Patch1: g-s-d-3.6.4-reset-a11y-keyboard.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=680689
Patch2: 0001-power-and-media-keys-Use-logind-for-suspending-and-r.patch
# Wacom OSD window
@ -83,6 +85,7 @@ The %{name}-updates package contains the updates plugin for %{name}
%patch0 -p1 -b .ppc-no-wacom
%endif
%patch1 -p1
%patch2 -p1
%patch3 -p1 -b .wacom-osd-window
%patch4 -p1
@ -266,6 +269,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_datadir}/dbus-1/interfaces/org.gnome.SettingsDaemonUpdates.xml
%changelog
* Mon Jan 28 2013 Bastien Nocera <bnocera@redhat.com> 3.6.4-3
- Disable AccessX on exit if no settings changed (#816764)
* Mon Jan 14 2013 Dan Horák <dan[at]danny.cz> - 3.6.4-2
- fix filelist for s390(x) (and ppc/ppc64 in RHEL)