patches/gnome-settings-daemon-05-sticky-timeout.diff
author yippi
Mon, 27 Sep 2010 21:07:51 +0000
changeset 20108 51df67ca9307
parent 14905 66e17d341823
permissions -rw-r--r--
I had these modules listed as being owned by me, but they are really owned by wangke, correcting.

/jds/bin/diff -uprN gnome-settings-daemon-2.25.3.old/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c gnome-settings-daemon-2.25.3/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c
--- gnome-settings-daemon-2.25.3.old/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c	2009-01-13 15:26:10.510762000 +0000
+++ gnome-settings-daemon-2.25.3/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c	2009-01-13 15:27:08.195002000 +0000
@@ -77,8 +77,12 @@ impl_activate (GnomeSettingsPlugin *plug
         error = NULL;
         res = gsd_a11y_keyboard_manager_start (GSD_A11Y_KEYBOARD_PLUGIN (plugin)->priv->manager, &error);
         if (! res) {
+            if (error != NULL) {
                 g_warning ("Unable to start a11y_keyboard manager: %s", error->message);
                 g_error_free (error);
+            } else {
+                g_warning ("Unable to start a11y_keyboard manager.");
+            }
         }
 }
 
/jds/bin/diff -uprN gnome-settings-daemon-2.25.3.old/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c gnome-settings-daemon-2.25.3/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
--- gnome-settings-daemon-2.25.3.old/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c	2009-01-13 15:26:10.509436000 +0000
+++ gnome-settings-daemon-2.25.3/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c	2009-01-13 15:33:22.384687000 +0000
@@ -655,7 +655,8 @@ ax_slowkeys_warning_post (GsdA11yKeyboar
 
 static gboolean
 ax_stickykeys_warning_post_bubble (GsdA11yKeyboardManager *manager,
-                                   gboolean                enabled)
+                                   gboolean                enabled,
+                                   gboolean                key_pressed)
 {
 #ifdef HAVE_LIBNOTIFY
         gboolean    res;
@@ -666,11 +667,17 @@ ax_stickykeys_warning_post_bubble (GsdA1
         title = enabled ?
                 _("Do you want to activate Sticky Keys?") :
                 _("Do you want to deactivate Sticky Keys?");
-        message = enabled ?
-                _("You just pressed the Shift key 5 times in a row.  This is the shortcut "
-                  "for the Sticky Keys feature, which affects the way your keyboard works.") :
-                _("You just pressed two keys at once, or pressed the Shift key 5 times in a row.  "
-                  "This turns off the Sticky Keys feature, which affects the way your keyboard works.");
+
+        if (enabled) {
+                message = _("You just pressed the Shift key 5 times in a row.  This is the shortcut "
+                            "for the Sticky Keys feature, which affects the way your keyboard works.");
+        } else if (key_pressed) {
+                message = _("You just pressed two keys at once, or pressed the Shift key 5 times in a row.  "
+                            "This turns off the Sticky Keys feature, which affects the way your keyboard works.");
+        } else {
+                message = _("Sticky Keys have not been used for a while. This inactivity turns off "
+                            "the Sticky Keys feature, which affects the way your keyboard works.");
+        }
 
         if (manager->priv->status_icon == NULL || ! gtk_status_icon_is_embedded (manager->priv->status_icon)) {
                 return FALSE;
@@ -731,7 +738,8 @@ ax_stickykeys_warning_post_bubble (GsdA1
 
 static void
 ax_stickykeys_warning_post_dialog (GsdA11yKeyboardManager *manager,
-                                   gboolean                enabled)
+                                   gboolean                enabled,
+                                   gboolean                key_pressed)
 {
         const char *title;
         const char *message;
@@ -739,11 +747,17 @@ ax_stickykeys_warning_post_dialog (GsdA1
         title = enabled ?
                 _("Do you want to activate Sticky Keys?") :
                 _("Do you want to deactivate Sticky Keys?");
-        message = enabled ?
-                _("You just pressed the Shift key 5 times in a row.  This is the shortcut "
-                  "for the Sticky Keys feature, which affects the way your keyboard works.") :
-                _("You just pressed two keys at once, or pressed the Shift key 5 times in a row.  "
-                  "This turns off the Sticky Keys feature, which affects the way your keyboard works.");
+
+        if (enabled) {
+                message = _("You just pressed the Shift key 5 times in a row.  This is the shortcut "
+                            "for the Sticky Keys feature, which affects the way your keyboard works.");
+        } else if (key_pressed) {
+                message = _("You just pressed two keys at once, or pressed the Shift key 5 times in a row.  "
+                            "This turns off the Sticky Keys feature, which affects the way your keyboard works.");
+        } else {
+                message = _("Sticky Keys have not been used for a while. This inactivity turns off "
+                            "the Sticky Keys feature, which affects the way your keyboard works.");
+        }
 
         if (manager->priv->stickykeys_alert != NULL) {
                 gtk_widget_show (manager->priv->stickykeys_alert);
@@ -788,19 +802,21 @@ ax_stickykeys_warning_post_dialog (GsdA1
 
 static void
 ax_stickykeys_warning_post (GsdA11yKeyboardManager *manager,
-                            gboolean                enabled)
+                            gboolean                enabled,
+                            gboolean                key_pressed)
 {
 
         manager->priv->stickykeys_shortcut_val = enabled;
 
         /* alway try to show something */
-        if (! ax_stickykeys_warning_post_bubble (manager, enabled)) {
-                ax_stickykeys_warning_post_dialog (manager, enabled);
+        if (! ax_stickykeys_warning_post_bubble (manager, enabled, key_pressed)) {
+                ax_stickykeys_warning_post_dialog (manager, enabled, key_pressed);
         }
 }
 
 static void
-set_gconf_from_server (GsdA11yKeyboardManager *manager)
+set_gconf_from_server (GsdA11yKeyboardManager *manager,
+                       gboolean            key_pressed)
 {
         GConfClient    *client;
         GConfChangeSet *cs;
@@ -927,7 +943,7 @@ set_gconf_from_server (GsdA11yKeyboardMa
                                                           desc->ctrls->enabled_ctrls & XkbSlowKeysMask);
                         } else {
                                 ax_stickykeys_warning_post (manager,
-                                                            desc->ctrls->enabled_ctrls & XkbStickyKeysMask);
+                                                            desc->ctrls->enabled_ctrls & XkbStickyKeysMask, key_pressed);
                         }
                 }
         }
@@ -952,11 +968,12 @@ cb_xkb_event_filter (GdkXEvent          
 {
         XEvent   *xev   = (XEvent *) xevent;
         XkbEvent *xkbEv = (XkbEvent *) xevent;
+        static gboolean key_pressed = FALSE;
 
         if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) &&
             xkbEv->any.xkb_type == XkbControlsNotify) {
                 d ("XKB state changed");
-                set_gconf_from_server (manager);
+                set_gconf_from_server (manager, key_pressed);
         } else if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) &&
                    xkbEv->any.xkb_type == XkbAccessXNotify) {
                 if (xkbEv->accessx.detail == XkbAXN_AXKWarning) {
@@ -967,6 +984,9 @@ cb_xkb_event_filter (GdkXEvent          
                          * set_gconf_from_server().
                          */
                 }
+        } else if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) &&
+                   xkbEv->any.xkb_type == XkbStateNotify) {
+                key_pressed = TRUE;
         }
 
         return GDK_FILTER_CONTINUE;
@@ -1017,7 +1037,7 @@ start_a11y_keyboard_idle_cb (GsdA11yKeyb
          */
         manager->priv->original_xkb_desc = get_xkb_desc_rec (manager);
 
-        event_mask = XkbControlsNotifyMask;
+        event_mask = XkbControlsNotifyMask | XkbStateNotifyMask;
 #ifdef DEBUG_ACCESSIBILITY
         event_mask |= XkbAccessXNotifyMask; /* make default when AXN_AXKWarning works */
 #endif