1 --- control-center-2.16.1/gnome-settings-daemon/gnome-settings-accessibility-keyboard.c 2006-01-28 19:19:02.000000000 +0000 2 +++ control-center-2.16.1-NEW/gnome-settings-daemon/gnome-settings-accessibility-keyboard.c 2006-11-10 16:16:41.894906350 +0000 3 @@ -413,24 +413,42 @@ 4 } 5 6 static void 7 -ax_stickykeys_warning_dialog_post (gboolean enabled) 8 +ax_stickykeys_warning_dialog_post (gboolean enabled, gboolean key_pressed) 9 { 10 stickykeys_shortcut_val = enabled; 11 - warning_dialog_post (&stickykeys_alert, (GCallback) ax_stickykeys_response, 12 - &stickykeys_shortcut_val, 13 - _("Sticky Keys Alert"), 14 - enabled ? _("You just pressed the Shift key 5 times in a row. This is the shortcut " 15 - "for the Sticky Keys feature, which affects the way your keyboard works.") : 16 - _("You just pressed two keys at once, or pressed the Shift key 5 times in a row. " 17 - "This turns off the Sticky Keys feature, which affects the way your keyboard works."), 18 - enabled ? _("Do you want to activate Sticky Keys?") : 19 - _("Do you want to deactivate Sticky Keys?"), 20 - enabled ? _("_Activate") : _("_Deactivate"), 21 - enabled ? _("Do_n't activate") : _("Do_n't deactivate")); 22 + 23 + if (enabled) { 24 + warning_dialog_post (&stickykeys_alert, 25 + (GCallback) ax_stickykeys_response, 26 + &stickykeys_shortcut_val, _("Sticky Keys Alert"), 27 + _("You just pressed the Shift key 5 times in a row. This is the shortcut " 28 + "for the Sticky Keys feature, which affects the way your keyboard works."), 29 + _("Do you want to activate Sticky Keys?"), 30 + _("_Activate"), 31 + _("Do_n't activate")); 32 + } else if (key_pressed) { 33 + warning_dialog_post (&stickykeys_alert, 34 + (GCallback) ax_stickykeys_response, 35 + &stickykeys_shortcut_val, _("Sticky Keys Alert"), 36 + _("You just pressed two keys at once, or pressed the Shift key 5 times in a row. " 37 + "This turns off the Sticky Keys feature, which affects the way your keyboard works."), 38 + _("Do you want to deactivate Sticky Keys?"), 39 + _("_Deactivate"), 40 + _("Do_n't deactivate")); 41 + } else { 42 + warning_dialog_post (&stickykeys_alert, 43 + (GCallback) ax_stickykeys_response, 44 + &stickykeys_shortcut_val, _("Sticky Keys Alert"), 45 + _("Sticky Keys have not been used for a while. This inactivity turns off " 46 + "the Sticky Keys feature, which affects the way your keyboard works."), 47 + _("Do you want to deactivate Sticky Keys?"), 48 + _("_Deactivate"), 49 + _("Do_n't deactivate")); 50 + } 51 } 52 53 static void 54 -set_gconf_from_server (GConfEntry *ignored) 55 +set_gconf_from_server (GConfEntry *ignored, gboolean key_pressed) 56 { 57 gboolean in_gconf; 58 GConfClient *client = gnome_settings_daemon_get_conf_client (); 59 @@ -520,7 +538,7 @@ 60 if (slowkeys_changed) 61 ax_slowkeys_warning_dialog_post (desc->ctrls->enabled_ctrls & XkbSlowKeysMask); 62 else 63 - ax_stickykeys_warning_dialog_post (desc->ctrls->enabled_ctrls & XkbStickyKeysMask); 64 + ax_stickykeys_warning_dialog_post (desc->ctrls->enabled_ctrls & XkbStickyKeysMask, key_pressed); 65 } 66 } 67 68 @@ -540,11 +558,12 @@ 69 { 70 XEvent *xev = (XEvent *) xevent; 71 XkbEvent *xkbEv = (XkbEvent *) xevent; 72 + static gboolean key_pressed = FALSE; 73 74 if (xev->xany.type == (xkbEventBase + XkbEventCode) && 75 - xkbEv->any.xkb_type == XkbControlsNotify) { 76 + xkbEv->any.xkb_type == XkbControlsNotify) { 77 d ("Someone changed XKB state\n"); 78 - set_gconf_from_server (NULL); 79 + set_gconf_from_server (NULL, key_pressed); 80 } 81 else if (xev->xany.type == (xkbEventBase + XkbEventCode) && 82 xkbEv->any.xkb_type == XkbAccessXNotify) { 83 @@ -557,6 +576,10 @@ 84 */ 85 } 86 } 87 + else if (xev->xany.type == (xkbEventBase + XkbEventCode) && 88 + xkbEv->any.xkb_type == XkbStateNotify) { 89 + key_pressed = TRUE; 90 + } 91 92 return GDK_FILTER_CONTINUE; 93 } 94 @@ -565,7 +588,7 @@ 95 gnome_settings_accessibility_keyboard_load (GConfClient *client) 96 { 97 static gboolean has_filter = FALSE; 98 - guint event_mask = XkbControlsNotifyMask; 99 + guint event_mask = XkbControlsNotifyMask | XkbStateNotifyMask; 100 #ifdef DEBUG_ACCESSIBILITY 101 event_mask = XkbControlsNotifyMask | XkbAccessXNotifyMask); /* make default when AXN_AXKWarning works */ 102 #endif 103