From 9605651251e283d7a37cadbd1e00d465db82626c Mon Sep 17 00:00:00 2001 From: Jody Goldberg Date: Tue, 10 Sep 2002 04:03:44 +0000 Subject: [PATCH] add a warning if xkb is not available. 2002-09-09 Jody Goldberg * gnome-accessibility-keyboard-properties.c (main) : add a warning if xkb is not available. --- capplets/accessibility/keyboard/ChangeLog | 25 +++++++++++ .../keyboard/accessibility-keyboard.c | 44 +++++++++++-------- .../gnome-accessibility-keyboard-properties.c | 34 +++++++++++++- ...me-accessibility-keyboard-properties.glade | 13 ++++-- 4 files changed, 92 insertions(+), 24 deletions(-) diff --git a/capplets/accessibility/keyboard/ChangeLog b/capplets/accessibility/keyboard/ChangeLog index 74a972a6f..fbcd999eb 100644 --- a/capplets/accessibility/keyboard/ChangeLog +++ b/capplets/accessibility/keyboard/ChangeLog @@ -1,3 +1,28 @@ +2002-09-09 Jody Goldberg + + * gnome-accessibility-keyboard-properties.c (main) : add a warning if + xkb is not available. + +2002-09-09 Jody Goldberg + + * accessibility-keyboard.c : on 2nd thought lets disable the 'beep on + feature change' if the master switch is off. + + http://bugzilla.gnome.org/show_bug.cgi?id=92488 + * gnome-accessibility-keyboard-properties.glade : tweak accelerators + +2002-09-09 Jody Goldberg + + http://bugzilla.gnome.org/show_bug.cgi?id=90936 + * gnome-accessibility-keyboard-properties.glade : Add mnemonic_widget + assignments and fix a typo. + +2002-08-28 Jody Goldberg + + http://bugzilla.gnome.org/show_bug.cgi?id=91854 + * accessibility-keyboard.c : the max slow key delay is 500ms. + We clamp that in the settings daemon. Fix the ui to reflect that. + 2002-08-21 Jody Goldberg * Release 2.1.0 diff --git a/capplets/accessibility/keyboard/accessibility-keyboard.c b/capplets/accessibility/keyboard/accessibility-keyboard.c index 286ba7bdb..e7959028b 100644 --- a/capplets/accessibility/keyboard/accessibility-keyboard.c +++ b/capplets/accessibility/keyboard/accessibility-keyboard.c @@ -63,7 +63,10 @@ static struct { { NULL, NULL, NULL } }, { "timeout_enable", NULL, NULL, CONFIG_ROOT "/timeout_enable", - { "timeout_slide", "timeout_spin", "timeout_label" } } + { "timeout_slide", "timeout_spin", "timeout_label" } }, + { "feature_state_change_beep", NULL, NULL, + CONFIG_ROOT "/feature_state_change_beep", + { NULL, NULL, NULL } } }; static struct { @@ -77,7 +80,7 @@ static struct { } const ranges [] = { { "bouncekeys_delay_slide", "bouncekeys_delay_spin", 300, 10, 900, 10, CONFIG_ROOT "/bouncekeys_delay" }, - { "slowkeys_delay_slide", "slowkeys_delay_spin", 300, 10, 900, 10, + { "slowkeys_delay_slide", "slowkeys_delay_spin", 300, 10, 500, 10, CONFIG_ROOT "/slowkeys_delay" }, /* WARNING anything larger than approx 512 seems to loose all keyboard input */ { "mousekeys_max_speed_slide", "mousekeys_max_speed_spin", 300, 10, 500, 20, @@ -148,7 +151,6 @@ setup_simple_toggles (GladeXML *dialog, GConfChangeSet *changeset) char const *gconf_key; char const *checkbox; } const simple_toggles [] = { - { CONFIG_ROOT "/feature_state_change_beep","feature_state_change_beep" }, { CONFIG_ROOT "/bouncekeys_beep_reject", "bouncekeys_beep_reject" }, { CONFIG_ROOT "/slowkeys_beep_press", "slowkeys_beep_press" }, @@ -269,11 +271,11 @@ xrm_get_bool (GConfClient *client, XrmDatabase *db, char const *gconf_key, static void xrm_get_int (GConfClient *client, XrmDatabase *db, char const *gconf_key, - char const *res_str, char const *class_str) + char const *res_str, char const *class_str, float scale) { XrmValue resourceValue; char *res; - int value; + int value, log_scale; char resource [256]; snprintf (resource, sizeof (resource), "%s.value", res_str); @@ -281,17 +283,17 @@ xrm_get_int (GConfClient *client, XrmDatabase *db, char const *gconf_key, return; value = atoi (resourceValue.addr); -#if 0 - { - int decimal; snprintf (resource, sizeof (resource), "%s.decimalPoints", res_str); if (!XrmGetResource (*db, resource, class_str, &res, &resourceValue)) return; - decimal = atoi (resourceValue.addr); - } -#endif + log_scale = atoi (resourceValue.addr); + + while (log_scale-- > 0) + scale /= 10.; gconf_client_set_int (client, gconf_key, value, NULL); + + printf ("%f * %d\n", scale, value); } /* This loads the current users XKB settings from their file */ @@ -316,8 +318,8 @@ load_CDE_file (GtkFileSelection *fsel) } client = gconf_client_get_default (); - xrm_get_bool (client, &db, CONFIG_ROOT "/enable", - "*EnableAccessXToggle.set", "AccessX*ToggleButtonGadget.XmCSet"); + gconf_client_set_bool (client, CONFIG_ROOT "/enable", TRUE, NULL); + xrm_get_bool (client, &db, CONFIG_ROOT "/feature_state_change_beep", "*SoundOnOffToggle.set", "AccessX*ToggleButtonGadget.XmCSet"); xrm_get_bool (client, &db, CONFIG_ROOT "/timeout_enable", @@ -341,17 +343,21 @@ load_CDE_file (GtkFileSelection *fsel) xrm_get_bool (client, &db, CONFIG_ROOT "/slowkeys_beep_accept", "*SlowKeysOnAcceptToggle.set", "AccessX*ToggleButtonGadget.XmCSet"); xrm_get_int (client, &db, CONFIG_ROOT "/timeout", - "*TimeOutScale", "AccessX*XmScale"); + "*TimeOutScale", "AccessX*XmScale", 60); xrm_get_int (client, &db, CONFIG_ROOT "/mousekeys_max_speed", - "*MouseMaxSpeedScale", "AccessX*XmScale"); + "*MouseMaxSpeedScale", "AccessX*XmScale", 1); xrm_get_int (client, &db, CONFIG_ROOT "/mousekeys_accel_time", - "*MouseAccelScale", "AccessX*XmScale"); + "*MouseAccelScale", "AccessX*XmScale", 1); xrm_get_int (client, &db, CONFIG_ROOT "/mousekeys_init_delay", - "*MouseDelayScale", "AccessX*XmScale"); + "*MouseDelayScale", "AccessX*XmScale", 1); xrm_get_int (client, &db, CONFIG_ROOT "/slowkeys_delay", - "*KRGSlowKeysDelayScale", "AccessX*XmScale"); + "*KRGSlowKeysDelayScale", "AccessX*XmScale", 1000); xrm_get_int (client, &db, CONFIG_ROOT "/bouncekeys_delay", - "*KRGDebounceScale", "AccessX*XmScale"); + "*KRGDebounceScale", "AccessX*XmScale", 1000); + + /* Set the master enable flag last */ + xrm_get_bool (client, &db, CONFIG_ROOT "/enable", + "*EnableAccessXToggle.set", "AccessX*ToggleButtonGadget.XmCSet"); return TRUE; } diff --git a/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.c b/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.c index ed37b8212..436bd12b2 100644 --- a/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.c +++ b/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.c @@ -32,6 +32,34 @@ #include #include "accessibility-keyboard.h" +#ifdef HAVE_X11_EXTENSIONS_XKB_H +# include +# include +# include +# include + +static void +xkb_enabled (void) +{ + gboolean have_xkb = FALSE; + int opcode, errorBase, major, minor, xkbEventBase; + + gdk_error_trap_push (); + have_xkb = XkbQueryExtension (GDK_DISPLAY (), + &opcode, &xkbEventBase, &errorBase, &major, &minor) + && XkbUseExtension (GDK_DISPLAY (), &major, &minor); + XSync (GDK_DISPLAY (), FALSE); + gdk_error_trap_pop (); + + if (!have_xkb) { + GtkWidget *warn = gtk_message_dialog_new (NULL, 0, + GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE, + _("This system does not seem to have the XKB extension. The keyboard accessibility features will not operate with it.")); + gtk_dialog_run (GTK_DIALOG (warn)); + } +} +#endif + static void dialog_response (GtkWidget *widget, gint response_id, @@ -67,7 +95,11 @@ main (int argc, char **argv) GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR, NULL); activate_settings_daemon (); - + +#ifdef HAVE_X11_EXTENSIONS_XKB_H + xkb_enabled (); +#endif + changeset = NULL; dialog = setup_accessX_dialog (changeset); g_signal_connect (G_OBJECT (dialog), diff --git a/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.glade b/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.glade index dc393bea7..c0e1f8fe1 100644 --- a/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.glade +++ b/capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.glade @@ -235,7 +235,7 @@ True Beep when an LED is turned on and two beeps when one is turned off. True - Enable _Toggle Keys + E_nable Toggle Keys True GTK_RELIEF_NORMAL True @@ -451,6 +451,7 @@ two keys pressed simultaneously 0.5 9 0 + slowkeys_delay_spin @@ -730,6 +731,7 @@ two keys pressed simultaneously 0.5 10 0 + bouncekeys_delay_spin @@ -857,7 +859,7 @@ two keys pressed simultaneously True Ignore all subsequent presses of the SAME key if they happen within a user selectable period of time. True - Enable _Bounce Keys + Enable Bo_unce Keys True GTK_RELIEF_NORMAL True @@ -908,6 +910,7 @@ two keys pressed simultaneously 0.5 0 0 + mousekeys_max_speed_spin @@ -1066,8 +1069,9 @@ two keys pressed simultaneously 0.5 0 0 + mousekeys_accel_time_spin - + @@ -1193,6 +1197,7 @@ two keys pressed simultaneously 0.5 2 0 + mousekeys_init_delay_spin @@ -1297,7 +1302,7 @@ two keys pressed simultaneously True True - _Beep when enabling/disabling keyboard accessibility features + Beep when enabling/disabling _keyboard accessibility features True GTK_RELIEF_NORMAL False