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



commit bff2c30670731ba79c9eb7e0d0e90efb780a1bd0
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 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;



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