add a warning if xkb is not available.

2002-09-09  Jody Goldberg <jody@gnome.org>

	* gnome-accessibility-keyboard-properties.c (main) : add a warning if
	  xkb is not available.
This commit is contained in:
Jody Goldberg 2002-09-10 04:03:44 +00:00 committed by Jody Goldberg
parent 4101aaa966
commit 9605651251
4 changed files with 92 additions and 24 deletions

View file

@ -1,3 +1,28 @@
2002-09-09 Jody Goldberg <jody@gnome.org>
* gnome-accessibility-keyboard-properties.c (main) : add a warning if
xkb is not available.
2002-09-09 Jody Goldberg <jody@gnome.org>
* 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 <jody@gnome.org>
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 <jody@gnome.org>
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 <jody@gnome.org> 2002-08-21 Jody Goldberg <jody@gnome.org>
* Release 2.1.0 * Release 2.1.0

View file

@ -63,7 +63,10 @@ static struct {
{ NULL, NULL, NULL } }, { NULL, NULL, NULL } },
{ "timeout_enable", NULL, NULL, { "timeout_enable", NULL, NULL,
CONFIG_ROOT "/timeout_enable", 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 { static struct {
@ -77,7 +80,7 @@ static struct {
} const ranges [] = { } const ranges [] = {
{ "bouncekeys_delay_slide", "bouncekeys_delay_spin", 300, 10, 900, 10, { "bouncekeys_delay_slide", "bouncekeys_delay_spin", 300, 10, 900, 10,
CONFIG_ROOT "/bouncekeys_delay" }, 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" }, CONFIG_ROOT "/slowkeys_delay" },
/* WARNING anything larger than approx 512 seems to loose all keyboard input */ /* WARNING anything larger than approx 512 seems to loose all keyboard input */
{ "mousekeys_max_speed_slide", "mousekeys_max_speed_spin", 300, 10, 500, 20, { "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 *gconf_key;
char const *checkbox; char const *checkbox;
} const simple_toggles [] = { } const simple_toggles [] = {
{ CONFIG_ROOT "/feature_state_change_beep","feature_state_change_beep" },
{ CONFIG_ROOT "/bouncekeys_beep_reject", "bouncekeys_beep_reject" }, { CONFIG_ROOT "/bouncekeys_beep_reject", "bouncekeys_beep_reject" },
{ CONFIG_ROOT "/slowkeys_beep_press", "slowkeys_beep_press" }, { 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 static void
xrm_get_int (GConfClient *client, XrmDatabase *db, char const *gconf_key, 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; XrmValue resourceValue;
char *res; char *res;
int value; int value, log_scale;
char resource [256]; char resource [256];
snprintf (resource, sizeof (resource), "%s.value", res_str); snprintf (resource, sizeof (resource), "%s.value", res_str);
@ -281,17 +283,17 @@ xrm_get_int (GConfClient *client, XrmDatabase *db, char const *gconf_key,
return; return;
value = atoi (resourceValue.addr); value = atoi (resourceValue.addr);
#if 0
{
int decimal;
snprintf (resource, sizeof (resource), "%s.decimalPoints", res_str); snprintf (resource, sizeof (resource), "%s.decimalPoints", res_str);
if (!XrmGetResource (*db, resource, class_str, &res, &resourceValue)) if (!XrmGetResource (*db, resource, class_str, &res, &resourceValue))
return; return;
decimal = atoi (resourceValue.addr); log_scale = atoi (resourceValue.addr);
}
#endif while (log_scale-- > 0)
scale /= 10.;
gconf_client_set_int (client, gconf_key, value, NULL); 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 */ /* This loads the current users XKB settings from their file */
@ -316,8 +318,8 @@ load_CDE_file (GtkFileSelection *fsel)
} }
client = gconf_client_get_default (); client = gconf_client_get_default ();
xrm_get_bool (client, &db, CONFIG_ROOT "/enable", gconf_client_set_bool (client, CONFIG_ROOT "/enable", TRUE, NULL);
"*EnableAccessXToggle.set", "AccessX*ToggleButtonGadget.XmCSet");
xrm_get_bool (client, &db, CONFIG_ROOT "/feature_state_change_beep", xrm_get_bool (client, &db, CONFIG_ROOT "/feature_state_change_beep",
"*SoundOnOffToggle.set", "AccessX*ToggleButtonGadget.XmCSet"); "*SoundOnOffToggle.set", "AccessX*ToggleButtonGadget.XmCSet");
xrm_get_bool (client, &db, CONFIG_ROOT "/timeout_enable", 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", xrm_get_bool (client, &db, CONFIG_ROOT "/slowkeys_beep_accept",
"*SlowKeysOnAcceptToggle.set", "AccessX*ToggleButtonGadget.XmCSet"); "*SlowKeysOnAcceptToggle.set", "AccessX*ToggleButtonGadget.XmCSet");
xrm_get_int (client, &db, CONFIG_ROOT "/timeout", 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", 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", 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", 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", 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", 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; return TRUE;
} }

View file

@ -32,6 +32,34 @@
#include <activate-settings-daemon.h> #include <activate-settings-daemon.h>
#include "accessibility-keyboard.h" #include "accessibility-keyboard.h"
#ifdef HAVE_X11_EXTENSIONS_XKB_H
# include <X11/XKBlib.h>
# include <X11/extensions/XKBstr.h>
# include <gdk/gdk.h>
# include <gdk/gdkx.h>
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 static void
dialog_response (GtkWidget *widget, dialog_response (GtkWidget *widget,
gint response_id, gint response_id,
@ -67,7 +95,11 @@ main (int argc, char **argv)
GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR, GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR,
NULL); NULL);
activate_settings_daemon (); activate_settings_daemon ();
#ifdef HAVE_X11_EXTENSIONS_XKB_H
xkb_enabled ();
#endif
changeset = NULL; changeset = NULL;
dialog = setup_accessX_dialog (changeset); dialog = setup_accessX_dialog (changeset);
g_signal_connect (G_OBJECT (dialog), g_signal_connect (G_OBJECT (dialog),

View file

@ -235,7 +235,7 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">Beep when an LED is turned on and two beeps when one is turned off.</property> <property name="tooltip" translatable="yes">Beep when an LED is turned on and two beeps when one is turned off.</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Enable _Toggle Keys</property> <property name="label" translatable="yes">E_nable Toggle Keys</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">True</property> <property name="active">True</property>
@ -451,6 +451,7 @@ two keys pressed simultaneously</property>
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xpad">9</property> <property name="xpad">9</property>
<property name="ypad">0</property> <property name="ypad">0</property>
<property name="mnemonic_widget">slowkeys_delay_spin</property>
<accessibility> <accessibility>
<atkrelation target="slowkeys_delay_spin" type="label-for"/> <atkrelation target="slowkeys_delay_spin" type="label-for"/>
</accessibility> </accessibility>
@ -730,6 +731,7 @@ two keys pressed simultaneously</property>
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xpad">10</property> <property name="xpad">10</property>
<property name="ypad">0</property> <property name="ypad">0</property>
<property name="mnemonic_widget">bouncekeys_delay_spin</property>
<accessibility> <accessibility>
<atkrelation target="bouncekeys_delay_spin" type="label-for"/> <atkrelation target="bouncekeys_delay_spin" type="label-for"/>
</accessibility> </accessibility>
@ -857,7 +859,7 @@ two keys pressed simultaneously</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="tooltip" translatable="yes">Ignore all subsequent presses of the SAME key if they happen within a user selectable period of time.</property> <property name="tooltip" translatable="yes">Ignore all subsequent presses of the SAME key if they happen within a user selectable period of time.</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">Enable _Bounce Keys</property> <property name="label" translatable="yes">Enable Bo_unce Keys</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">True</property> <property name="active">True</property>
@ -908,6 +910,7 @@ two keys pressed simultaneously</property>
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xpad">0</property> <property name="xpad">0</property>
<property name="ypad">0</property> <property name="ypad">0</property>
<property name="mnemonic_widget">mousekeys_max_speed_spin</property>
<accessibility> <accessibility>
<atkrelation target="mousekeys_max_speed_spin" type="label-for"/> <atkrelation target="mousekeys_max_speed_spin" type="label-for"/>
</accessibility> </accessibility>
@ -1066,8 +1069,9 @@ two keys pressed simultaneously</property>
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xpad">0</property> <property name="xpad">0</property>
<property name="ypad">0</property> <property name="ypad">0</property>
<property name="mnemonic_widget">mousekeys_accel_time_spin</property>
<accessibility> <accessibility>
<atkrelation target="mousekeys_accel_time_title" type="label-for"/> <atkrelation target="mousekeys_accel_time_spin" type="label-for"/>
</accessibility> </accessibility>
</widget> </widget>
<packing> <packing>
@ -1193,6 +1197,7 @@ two keys pressed simultaneously</property>
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xpad">2</property> <property name="xpad">2</property>
<property name="ypad">0</property> <property name="ypad">0</property>
<property name="mnemonic_widget">mousekeys_init_delay_spin</property>
<accessibility> <accessibility>
<atkrelation target="mousekeys_init_delay_spin" type="label-for"/> <atkrelation target="mousekeys_init_delay_spin" type="label-for"/>
</accessibility> </accessibility>
@ -1297,7 +1302,7 @@ two keys pressed simultaneously</property>
<widget class="GtkCheckButton" id="feature_state_change_beep"> <widget class="GtkCheckButton" id="feature_state_change_beep">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="label" translatable="yes">_Beep when enabling/disabling keyboard accessibility features</property> <property name="label" translatable="yes">Beep when enabling/disabling _keyboard accessibility features</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property> <property name="active">False</property>