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