gnome-settings-daemon r637 - in trunk: . plugins/a11y-keyboard



Author: halfline
Date: Wed Dec 17 16:09:28 2008
New Revision: 637
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=637&view=rev

Log:
2008-12-07  Ray Strode  <rstrode redhat com>

	Restore AccessX bits to original values on exit

	* plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
	(struct GsdA11yKeyboardManagerPrivate): add new
	field to cache original AccessX bits.
	(start_a11y_keyboard_idle_cb): save bits.
	(restore_server_xkb_config),
	(gsd_a11y_keyboard_manager_stop): restore bits
	when stopping.

Modified:
   trunk/ChangeLog
   trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c

Modified: trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
==============================================================================
--- trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c	(original)
+++ trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c	Wed Dec 17 16:09:28 2008
@@ -63,6 +63,7 @@
         GtkWidget *slowkeys_alert;
         GtkWidget *preferences_dialog;
         GtkStatusIcon *status_icon;
+        XkbDescRec *original_xkb_desc;
 
         guint      gconf_notify;
 
@@ -1012,6 +1013,10 @@
                                   (GConfClientNotifyFunc) keyboard_callback,
                                   &manager->priv->gconf_notify);
 
+        /* Save current xkb state so we can restore it on exit
+         */
+        manager->priv->original_xkb_desc = get_xkb_desc_rec (manager);
+
         event_mask = XkbControlsNotifyMask;
 #ifdef DEBUG_ACCESSIBILITY
         event_mask |= XkbAccessXNotifyMask; /* make default when AXN_AXKWarning works */
@@ -1052,6 +1057,31 @@
         return TRUE;
 }
 
+static void
+restore_server_xkb_config (GsdA11yKeyboardManager *manager)
+{
+        gdk_error_trap_push ();
+        XkbSetControls (GDK_DISPLAY (),
+                        XkbSlowKeysMask         |
+                        XkbBounceKeysMask       |
+                        XkbStickyKeysMask       |
+                        XkbMouseKeysMask        |
+                        XkbMouseKeysAccelMask   |
+                        XkbAccessXKeysMask      |
+                        XkbAccessXTimeoutMask   |
+                        XkbAccessXFeedbackMask  |
+                        XkbControlsEnabledMask,
+                        manager->priv->original_xkb_desc);
+
+        XkbFreeKeyboard (manager->priv->original_xkb_desc,
+                         XkbAllComponentsMask, True);
+
+        XSync (GDK_DISPLAY (), FALSE);
+        gdk_error_trap_pop ();
+
+        manager->priv->original_xkb_desc = NULL;
+}
+
 void
 gsd_a11y_keyboard_manager_stop (GsdA11yKeyboardManager *manager)
 {
@@ -1074,6 +1104,10 @@
                                   (GdkFilterFunc) cb_xkb_event_filter,
                                   manager);
 
+        /* Disable all the AccessX bits
+         */
+        restore_server_xkb_config (manager);
+
         if (p->slowkeys_alert != NULL)
                 gtk_widget_destroy (p->slowkeys_alert);
 



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