[gnome-settings-daemon] a11y-keyboard: Disable everything on exit if no settings changed



commit ae36405207ba5ef0a0c7ea6b154e80d8be3e675c
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Jan 28 17:59:21 2013 +0100

    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 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
index 33e4665..7882f79 100644
--- a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
+++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
@@ -57,6 +57,8 @@ struct GsdA11yKeyboardManagerPrivate
         gboolean          stickykeys_shortcut_val;
         gboolean          slowkeys_shortcut_val;
 
+        XkbDescRec       *desc;
+
         GSettings        *settings;
 
         NotifyNotification *notification;
@@ -698,6 +700,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 */
 
@@ -741,6 +746,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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]