gnome-settings-daemon-05-sticky-timeout.diff revision 13290
diff -up gnome-settings-daemon-2.23.1.1/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c.orig gnome-settings-daemon-2.23.1.1/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
--- gnome-settings-daemon-2.23.1.1/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c.orig 2008-04-23 11:38:37.000000000 +0100
+++ gnome-settings-daemon-2.23.1.1/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c 2008-05-30 11:34:15.603962564 +0100
@@ -471,29 +471,54 @@ ax_slowkeys_warning_dialog_post (GsdA11y
static void
ax_stickykeys_warning_dialog_post (GsdA11yKeyboardManager *manager,
- gboolean enabled)
+ gboolean enabled,
+ gboolean key_pressed)
{
+ gboolean already_created = FALSE;
+
manager->priv->stickykeys_shortcut_val = enabled;
if (manager->priv->stickykeys_alert != NULL) {
+ already_created = TRUE;
+ g_object_set(manager->priv->stickykeys_alert, "text", enabled ?
+ _("Do you want to activate Sticky Keys?") :
+ _("Do you want to deactivate Sticky Keys?"),
+ NULL);
+ }
+ else {
+ manager->priv->stickykeys_alert = gtk_message_dialog_new (NULL,
+ 0,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_NONE,
+ enabled ?
+ _("Do you want to activate Sticky Keys?") :
+ _("Do you want to deactivate Sticky Keys?"));
+ }
+
+ if ( enabled ) {
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (manager->priv->stickykeys_alert),
+ _("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 ) {
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (manager->priv->stickykeys_alert),
+ _("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 {
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (manager->priv->stickykeys_alert),
+ _("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 dialog was already in existance then do no more and return */
+ if ( already_created ) {
gtk_widget_show (manager->priv->stickykeys_alert);
return;
}
- manager->priv->stickykeys_alert = gtk_message_dialog_new (NULL,
- 0,
- GTK_MESSAGE_WARNING,
- GTK_BUTTONS_NONE,
- enabled ?
- _("Do you want to activate Sticky Keys?") :
- _("Do you want to deactivate Sticky Keys?"));
-
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (manager->priv->stickykeys_alert),
- 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."));
-
gtk_dialog_add_button (GTK_DIALOG (manager->priv->stickykeys_alert),
GTK_STOCK_HELP,
GTK_RESPONSE_HELP);
@@ -522,7 +547,7 @@ ax_stickykeys_warning_dialog_post (GsdA1
}
static void
-set_gconf_from_server (GsdA11yKeyboardManager *manager)
+set_gconf_from_server (GsdA11yKeyboardManager *manager, gboolean key_pressed)
{
GConfClient *client;
GConfChangeSet *cs;
@@ -649,7 +674,8 @@ set_gconf_from_server (GsdA11yKeyboardMa
desc->ctrls->enabled_ctrls & XkbSlowKeysMask);
} else {
ax_stickykeys_warning_dialog_post (manager,
- desc->ctrls->enabled_ctrls & XkbStickyKeysMask);
+ desc->ctrls->enabled_ctrls & XkbStickyKeysMask,
+ key_pressed);
}
}
}
@@ -674,11 +700,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) {
@@ -690,6 +717,10 @@ cb_xkb_event_filter (GdkXEvent
*/
}
}
+ else if (xev->xany.type == (manager->priv->xkbEventBase + XkbEventCode) &&
+ xkbEv->any.xkb_type == XkbStateNotify) {
+ key_pressed = TRUE;
+ }
return GDK_FILTER_CONTINUE;
}
@@ -740,7 +771,7 @@ gsd_a11y_keyboard_manager_start (GsdA11y
(GConfClientNotifyFunc) keyboard_callback,
&manager->priv->gconf_notify);
- event_mask = XkbControlsNotifyMask;
+ event_mask = XkbControlsNotifyMask | XkbStateNotifyMask;
#ifdef DEBUG_ACCESSIBILITY
event_mask |= XkbAccessXNotifyMask; /* make default when AXN_AXKWarning works */
#endif
diff -up gnome-settings-daemon-2.21.5/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c.orig gnome-settings-daemon-2.21.5/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c
--- gnome-settings-daemon-2.21.5/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c.orig 2007-12-24 11:18:49.000000000 +0000
+++ gnome-settings-daemon-2.21.5/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c 2008-01-23 11:30:41.851872000 +0000
@@ -77,8 +77,13 @@ 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.");
+ }
}
}