From 5399ce0b1a2bb83852ee37851db75d0573f66099 Mon Sep 17 00:00:00 2001 From: Jody Goldberg Date: Sat, 23 Mar 2002 04:39:24 +0000 Subject: [PATCH] Add AccessX capplet. --- capplets/Makefile.am | 3 +- capplets/accessibility/.cvsignore | 2 + capplets/accessibility/Makefile.am | 1 + capplets/common/gconf-property-editor.c | 3 + capplets/desktop-links/.cvsignore | 4 + .../Accessibility.directory.in.in | 5 + capplets/desktop-links/Makefile.am | 4 +- .../desktop-links/accessibility-directory.png | Bin 0 -> 220 bytes capplets/keyboard/ChangeLog | 10 + capplets/keyboard/Makefile.am | 4 +- capplets/keyboard/gnome-keyboard-properties.c | 24 +- configure.in | 3 + gnome-settings-daemon/.cvsignore | 5 + gnome-settings-daemon/Makefile.am | 4 +- .../gnome-settings-accessibility-keyboard.c | 300 ++++++++++++++++++ .../gnome-settings-accessibility-keyboard.h | 32 ++ gnome-settings-daemon/gnome-settings-daemon.c | 3 + po/ChangeLog | 4 + po/POTFILES.in | 4 + 19 files changed, 403 insertions(+), 12 deletions(-) create mode 100644 capplets/accessibility/.cvsignore create mode 100644 capplets/accessibility/Makefile.am create mode 100644 capplets/desktop-links/Accessibility.directory.in.in create mode 100644 capplets/desktop-links/accessibility-directory.png create mode 100644 gnome-settings-daemon/gnome-settings-accessibility-keyboard.c create mode 100644 gnome-settings-daemon/gnome-settings-accessibility-keyboard.h diff --git a/capplets/Makefile.am b/capplets/Makefile.am index 5b0bd84c1..9ffcdf4e8 100644 --- a/capplets/Makefile.am +++ b/capplets/Makefile.am @@ -1,5 +1,6 @@ always_built_SUBDIRS = \ - common default-applications desktop-links \ + common accessibility \ + default-applications desktop-links \ background keyboard mouse sound \ file-types theme-switcher ui-properties \ screensaver font keybindings diff --git a/capplets/accessibility/.cvsignore b/capplets/accessibility/.cvsignore new file mode 100644 index 000000000..282522db0 --- /dev/null +++ b/capplets/accessibility/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/capplets/accessibility/Makefile.am b/capplets/accessibility/Makefile.am new file mode 100644 index 000000000..d60926e4d --- /dev/null +++ b/capplets/accessibility/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = keyboard diff --git a/capplets/common/gconf-property-editor.c b/capplets/common/gconf-property-editor.c index 99544acd1..03faea420 100644 --- a/capplets/common/gconf-property-editor.c +++ b/capplets/common/gconf-property-editor.c @@ -974,6 +974,9 @@ peditor_numeric_range_value_changed (GConfClient *client, if (value != NULL) { value_wid = peditor->p->conv_to_widget_cb (peditor, value); + + g_return_if_fail (value_wid->type == GCONF_VALUE_FLOAT); + gtk_adjustment_set_value (GTK_ADJUSTMENT (peditor->p->ui_control), gconf_value_get_float (value_wid)); gconf_value_free (value_wid); } diff --git a/capplets/desktop-links/.cvsignore b/capplets/desktop-links/.cvsignore index c55f04419..99b1ccb91 100644 --- a/capplets/desktop-links/.cvsignore +++ b/capplets/desktop-links/.cvsignore @@ -4,5 +4,9 @@ cd.desktop cd.desktop.in legacy-applications.desktop legacy-applications.desktop.in +session.desktop +session.desktop.in Advanced.directory Advanced.directory.in +Accessibility.directory +Accessibility.directory.in diff --git a/capplets/desktop-links/Accessibility.directory.in.in b/capplets/desktop-links/Accessibility.directory.in.in new file mode 100644 index 000000000..c2c525787 --- /dev/null +++ b/capplets/desktop-links/Accessibility.directory.in.in @@ -0,0 +1,5 @@ +[Desktop Entry] +_Name=Accessibility +_Comment=Accessibility Settings +Type=Directory +Icon=accessibility-directory.png diff --git a/capplets/desktop-links/Makefile.am b/capplets/desktop-links/Makefile.am index a7ec92295..b64e6f90f 100644 --- a/capplets/desktop-links/Makefile.am +++ b/capplets/desktop-links/Makefile.am @@ -6,7 +6,7 @@ capplets = ## Pixmaps pixmaps_pre = $(capplets:=-capplet.png) -pixmaps_DATA = $(pixmaps_pre) advanced-directory.png +pixmaps_DATA = $(pixmaps_pre) advanced-directory.png accessibility-directory.png pixmapsdir = $(GNOMECC_ICONS_DIR) ## @@ -40,7 +40,7 @@ all-local: $(desktop_files) $(groups_files) ## foo.directory.in is merged with the translations to create foo.directory ## foo.directory is installed and renamed ## -groups = Advanced +groups = Advanced Accessibility groups_files = $(groups:=.directory) groups_in_files = $(groups_files:.directory=.directory.in) groups_in_in_files = $(groups_files:.directory=.directory.in.in) diff --git a/capplets/desktop-links/accessibility-directory.png b/capplets/desktop-links/accessibility-directory.png new file mode 100644 index 0000000000000000000000000000000000000000..dd62cd00200e16d4f024a1922cf2e5d38c42791d GIT binary patch literal 220 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZA`BpB)|k7xlYrX+877Y4?=UBXL%ys4fpjv*Dd zTF)Eu9Wvlyy|93%=ZuGkW!L$mDLWWs6vJO0yP>^h3iFm%lf1%w|4dfe*f3q)_5Q}U zB2TwyoA4+xcGa&uc`LkrX8i^cA^nCbn|n4HO&9$;V!VskuPIM3_Sls8c5;M<^71nZ za~bw;5}eoe$|3#;f90*kYh9*?ykF1YR(440nT;*SO}*a}d%Lx-|0+7gxZs}qrJs5R S7tBBoWbkzLb6Mw<&;$TugH_T1 literal 0 HcmV?d00001 diff --git a/capplets/keyboard/ChangeLog b/capplets/keyboard/ChangeLog index a4ef1bfac..e5dbbda1d 100644 --- a/capplets/keyboard/ChangeLog +++ b/capplets/keyboard/ChangeLog @@ -1,3 +1,13 @@ +2002-03-19 Jody Goldberg + + * gnome-keyboard-properties.c (_to_widget) : fix signature. + (*_from_widget) : fix signature. + +2002-03-13 Jody Goldberg + + * gnome-keyboard-properties.c (setup_accessibility) : new. + (main) : install the accessibility page. + 2002-03-19 Richard Hestilow * gnome-keyboard-properties.c (bell_enums): Swap around. This diff --git a/capplets/keyboard/Makefile.am b/capplets/keyboard/Makefile.am index 44b09e621..931c5efe2 100644 --- a/capplets/keyboard/Makefile.am +++ b/capplets/keyboard/Makefile.am @@ -1,7 +1,9 @@ bin_PROGRAMS = gnome2-keyboard-properties -gnome2_keyboard_properties_LDADD = $(GNOMECC_CAPPLETS_LIBS) gnome2_keyboard_properties_SOURCES = gnome-keyboard-properties.c +gnome2_keyboard_properties_LDADD = \ + ../accessibility/keyboard/libaccessibility-keyboard.a \ + $(GNOMECC_CAPPLETS_LIBS) @INTLTOOL_DESKTOP_RULE@ diff --git a/capplets/keyboard/gnome-keyboard-properties.c b/capplets/keyboard/gnome-keyboard-properties.c index b1285ef63..36db21ddb 100644 --- a/capplets/keyboard/gnome-keyboard-properties.c +++ b/capplets/keyboard/gnome-keyboard-properties.c @@ -35,6 +35,7 @@ #include "capplet-util.h" #include "gconf-property-editor.h" #include "activate-settings-daemon.h" +#include <../accessibility/keyboard/accessibility-keyboard.h> enum { @@ -53,7 +54,7 @@ create_dialog (void) } static GConfValue * -rate_to_widget (GConfPropertyEditor *peditor, GConfValue *value) +rate_to_widget (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; int rate; @@ -75,7 +76,7 @@ rate_to_widget (GConfPropertyEditor *peditor, GConfValue *value) } static GConfValue * -rate_from_widget (GConfPropertyEditor *peditor, GConfValue *value) +rate_from_widget (GConfPropertyEditor *peditor, const GConfValue *value) { static int rates[] = { 255, 192, 64, 1 @@ -90,7 +91,7 @@ rate_from_widget (GConfPropertyEditor *peditor, GConfValue *value) } static GConfValue * -delay_to_widget (GConfPropertyEditor *peditor, GConfValue *value) +delay_to_widget (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; int delay; @@ -132,7 +133,7 @@ static GConfEnumStringPair bell_enums[] = { }; static GConfValue * -bell_from_widget (GConfPropertyEditor *peditor, GConfValue *value) +bell_from_widget (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; @@ -144,7 +145,7 @@ bell_from_widget (GConfPropertyEditor *peditor, GConfValue *value) } static GConfValue * -bell_to_widget (GConfPropertyEditor *peditor, GConfValue *value) +bell_to_widget (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; gint val = 2; @@ -162,7 +163,7 @@ bell_to_widget (GConfPropertyEditor *peditor, GConfValue *value) static GConfValue * -blink_from_widget (GConfPropertyEditor *peditor, GConfValue *value) +blink_from_widget (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; @@ -173,7 +174,7 @@ blink_from_widget (GConfPropertyEditor *peditor, GConfValue *value) } static GConfValue * -blink_to_widget (GConfPropertyEditor *peditor, GConfValue *value) +blink_to_widget (GConfPropertyEditor *peditor, const GConfValue *value) { GConfValue *new_value; gint current_rate; @@ -303,6 +304,14 @@ get_legacy_settings (void) COPY_FROM_LEGACY (int, "/gnome/desktop/peripherals/keyboard/bell_duration", "/Desktop/Bell/duration=100"); } +static void +setup_accessibility (GladeXML *dialog, GConfChangeSet *changeset) +{ + GtkWidget *notebook = WID ("notebook1"); + GtkWidget *label = gtk_label_new (_("Accessibility")); + GtkWidget *page = setup_accessX_dialog (changeset, FALSE); + gtk_notebook_append_page (GTK_NOTEBOOK (notebook), page, label); +} int main (int argc, char **argv) @@ -344,6 +353,7 @@ main (int argc, char **argv) changeset = NULL; dialog = create_dialog (); setup_dialog (dialog, changeset); + setup_accessibility (dialog, changeset); gtk_widget_show_all (WID ("keyboard_dialog")); gtk_main (); diff --git a/configure.in b/configure.in index 39478fa7f..cedecec66 100644 --- a/configure.in +++ b/configure.in @@ -39,6 +39,7 @@ AC_CHECK_FUNCS(setenv,[AC_DEFINE(HAVE_SETENV)]) dnl keyboard-properties-capplet AC_CHECK_HEADERS(X11/extensions/xf86misc.h, XF86MISC_LIBS="-lXxf86misc") AC_SUBST(XF86MISC_LIBS) +AC_CHECK_HEADERS(X11/extensions/XKB.h) dnl ============================================== dnl Check that we meet the dependencies @@ -205,5 +206,7 @@ capplets/sound/Makefile capplets/theme-switcher/Makefile capplets/theme-switcher/control/Makefile capplets/ui-properties/Makefile +capplets/accessibility/Makefile +capplets/accessibility/keyboard/Makefile schemas/Makefile libsounds/Makefile]) diff --git a/gnome-settings-daemon/.cvsignore b/gnome-settings-daemon/.cvsignore index ede3ed1af..a3c10efe5 100644 --- a/gnome-settings-daemon/.cvsignore +++ b/gnome-settings-daemon/.cvsignore @@ -1,3 +1,8 @@ Makefile Makefile.in gnome2-settings-daemon +GNOME_SettingsDaemon-common.c +GNOME_SettingsDaemon-skels.c +GNOME_SettingsDaemon-stubs.c +GNOME_SettingsDaemon.h +GNOME_SettingsDaemon.server diff --git a/gnome-settings-daemon/Makefile.am b/gnome-settings-daemon/Makefile.am index 898c13f40..5f0f18b30 100644 --- a/gnome-settings-daemon/Makefile.am +++ b/gnome-settings-daemon/Makefile.am @@ -20,6 +20,8 @@ gnome2_settings_daemon_SOURCES = \ gnome-settings-locate-pointer.h \ gnome-settings-sound.c \ gnome-settings-sound.h \ + gnome-settings-accessibility-keyboard.h \ + gnome-settings-accessibility-keyboard.c \ xsettings-common.c \ xsettings-manager.c \ xsettings-common.h \ @@ -62,4 +64,4 @@ CLEANFILES = $(BUILT_SOURCES) EXTRA_DIST = \ $(BUILT_SOURCES) \ $(server_DATA) \ - $(server_in_files) \ \ No newline at end of file + $(server_in_files) \ diff --git a/gnome-settings-daemon/gnome-settings-accessibility-keyboard.c b/gnome-settings-daemon/gnome-settings-accessibility-keyboard.c new file mode 100644 index 000000000..4066c0261 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-accessibility-keyboard.c @@ -0,0 +1,300 @@ +/* gnome-settings-keyboard.c + * + * Copyright © 2001 Ximian, Inc. + * + * Written by Bradford Hovinen + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include "config.h" + +#include +#include +#include + +#include "gnome-settings-accessibility-keyboard.h" +#include "gnome-settings-daemon.h" + +#ifdef HAVE_X11_EXTENSIONS_XKB_H +# include +# include + +#define CONFIG_ROOT "/desktop/gnome/accesibility/keyboard" + +static gboolean we_are_changing_xkb_state = FALSE; + +static int +get_int (GConfClient *client, char const *key) +{ + int res = gconf_client_get_int (client, key, NULL); + if (res <= 0) + res = 1; + return res; +} + +static void +set_int (GConfClient *client, char const *key, int val) +{ + GError *err; + if (!gconf_client_set_int (client, key, val, &err)) { + g_warning (err->message); + g_error_free (err); + } +} + +static void +set_bool (GConfClient *client, char const *key, int val) +{ + GError *err; + if (!gconf_client_set_bool (client, key, val ? TRUE : FALSE, &err)) { + g_warning (err->message); + g_error_free (err); + } +} + +static void +set_server_from_gconf (GConfEntry *ignored) +{ + unsigned long which; + gint32 enabled, enable_mask; + XkbDescRec *desc; + GConfClient *client = gconf_client_get_default (); + + if (!we_are_changing_xkb_state) { + fprintf (stderr, "We changed gconf accessibility state\n"); + return; + } else + fprintf (stderr, "Someone changed gcond accessibility state\n"); + + enable_mask = XkbAccessXKeysMask | + XkbSlowKeysMask | + XkbBounceKeysMask | + XkbStickyKeysMask | + XkbMouseKeysMask | + XkbMouseKeysAccelMask | + XkbAccessXKeysMask | + XkbAccessXTimeoutMask | + XkbAccessXFeedbackMask; + + enabled = XkbAccessXFeedbackMask; + + desc = XkbGetMap(GDK_DISPLAY (), 0, XkbUseCoreKbd); + XkbGetControls (GDK_DISPLAY (), XkbAllControlsMask, desc); + + desc->ctrls->ax_options = XkbAX_LatchToLockMask; + + /* general */ + if (gconf_client_get_bool (client, CONFIG_ROOT "/enable", NULL)) + enabled |= XkbAccessXKeysMask; + if (gconf_client_get_bool (client, CONFIG_ROOT "/feature_state_change_beep", NULL)) + desc->ctrls->ax_options |= XkbAX_FeatureFBMask | XkbAX_SlowWarnFBMask; + if (gconf_client_get_bool (client, CONFIG_ROOT "/timeout_enable", NULL)) + enabled |= XkbAccessXTimeoutMask; + desc->ctrls->ax_timeout = get_int (client, + CONFIG_ROOT "/timeout"); + + /* bounce keys */ + if (gconf_client_get_bool (client, CONFIG_ROOT "/bouncekeys_enable", NULL)) + enabled |= XkbBounceKeysMask; + if (gconf_client_get_bool (client, CONFIG_ROOT "/bouncekeys_beep_reject", NULL)) + enabled |= XkbAX_BKRejectFBMask; + desc->ctrls->debounce_delay = get_int (client, + CONFIG_ROOT "/bouncekeys_delay"); + + /* mouse keys */ + if (gconf_client_get_bool (client, CONFIG_ROOT "/mousekeys_enable", NULL)) + enabled |= XkbMouseKeysMask; + desc->ctrls->mk_interval = 10; + desc->ctrls->mk_curve = 50; + desc->ctrls->mk_max_speed = get_int (client, + CONFIG_ROOT "/mousekeys_max_speed"); + desc->ctrls->mk_time_to_max = get_int (client, + CONFIG_ROOT "/mousekeys_accel_time"); + desc->ctrls->mk_delay = get_int (client, + CONFIG_ROOT "/mousekeys_init_delay"); + + /* slow keys */ + if (gconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_enable", NULL)) + enabled |= XkbSlowKeysMask; + if (gconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_press", NULL)) + desc->ctrls->ax_options |= XkbAX_SKPressFBMask; + if (gconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_accept", NULL)) + desc->ctrls->ax_options |= XkbAX_SKAcceptFBMask; + if (gconf_client_get_bool (client, CONFIG_ROOT "/slowkeys_beep_reject", NULL)) + enabled |= XkbAX_SKRejectFBMask; + desc->ctrls->slow_keys_delay = get_int (client, + CONFIG_ROOT "/slowkeys_delay"); + + /* sticky keys */ + if (gconf_client_get_bool (client, CONFIG_ROOT "/stickykeys_enable", NULL)) + enabled |= XkbStickyKeysMask; + if (gconf_client_get_bool (client, CONFIG_ROOT "/stickykeys_two_key_off", NULL)) + desc->ctrls->ax_options |= XkbAX_TwoKeysMask; + if (gconf_client_get_bool (client, CONFIG_ROOT "/stickykeys_modifier_beep", NULL)) + desc->ctrls->ax_options |= XkbAX_StickyKeysFBMask; + + /* toggle keys */ + if (gconf_client_get_bool (client, CONFIG_ROOT "/togglekeys_enable", NULL)) + desc->ctrls->ax_options |= XkbAX_IndicatorFBMask; + desc->ctrls->enabled_ctrls &= ~enable_mask; + desc->ctrls->enabled_ctrls |= (enable_mask & enabled); + + /* guard against reloading gconf when the X server notices that the XKB + * state has changed and calls us. + */ + g_return_if_fail (!we_are_changing_xkb_state); + + which = XkbAccessXKeysMask | XkbAccessXTimeoutMask | + XkbControlsEnabledMask | + XkbMouseKeysMask | XkbMouseKeysAccelMask | + XkbSlowKeysMask | XkbBounceKeysMask; + + we_are_changing_xkb_state = TRUE; + XkbSetControls (GDK_DISPLAY (), which, desc); + XFlush (GDK_DISPLAY ()); + we_are_changing_xkb_state = FALSE; +} + +static void +set_gconf_from_server (GConfEntry *ignored) +{ + XkbDescRec *desc; + GConfClient *client = gconf_client_get_default (); + + desc = XkbGetMap(GDK_DISPLAY (), 0, XkbUseCoreKbd); + XkbGetControls (GDK_DISPLAY (), XkbAllControlsMask, desc); + + desc->ctrls->ax_options = XkbAX_LatchToLockMask; + + /* guard against reloading the server when gconf notices that the state + * has changed and calls us. + */ + g_return_if_fail (!we_are_changing_xkb_state); + we_are_changing_xkb_state = TRUE; + + set_bool (client, CONFIG_ROOT "/enable", + desc->ctrls->enabled_ctrls & XkbAccessXKeysMask); + set_bool (client, CONFIG_ROOT "/feature_state_change_beep", + desc->ctrls->ax_options & (XkbAX_FeatureFBMask | XkbAX_SlowWarnFBMask)); + set_bool (client, CONFIG_ROOT "/timeout_enable", + desc->ctrls->enabled_ctrls & XkbAccessXTimeoutMask); + set_int (client, CONFIG_ROOT "/timeout", + desc->ctrls->ax_timeout); + + set_bool (client, CONFIG_ROOT "/bouncekeys_enable", + desc->ctrls->enabled_ctrls & XkbBounceKeysMask); + set_int (client, CONFIG_ROOT "/bouncekeys_delay", + desc->ctrls->debounce_delay); + set_bool (client, CONFIG_ROOT "/bouncekeys_beep_reject", + desc->ctrls->enabled_ctrls & XkbAX_BKRejectFBMask); + + set_bool (client, CONFIG_ROOT "/mousekeys_enable", + desc->ctrls->enabled_ctrls & XkbMouseKeysMask); + set_int (client, CONFIG_ROOT "/mousekeys_max_speed", + desc->ctrls->mk_max_speed); + set_int (client, CONFIG_ROOT "/mousekeys_accel_time", + desc->ctrls->mk_time_to_max); + set_int (client, CONFIG_ROOT "/mousekeys_init_delay", + desc->ctrls->mk_delay); + + set_bool (client, CONFIG_ROOT "/slowkeys_enable", + desc->ctrls->enabled_ctrls & XkbSlowKeysMask); + set_bool (client, CONFIG_ROOT "/slowkeys_beep_press", + desc->ctrls->ax_options & XkbAX_SKPressFBMask); + set_bool (client, CONFIG_ROOT "/slowkeys_beep_accept", + desc->ctrls->ax_options & XkbAX_SKAcceptFBMask); + set_bool (client, CONFIG_ROOT "/slowkeys_beep_reject", + desc->ctrls->enabled_ctrls & XkbAX_SKRejectFBMask); + set_int (client, CONFIG_ROOT "/slowkeys_delay", + desc->ctrls->slow_keys_delay); + + set_bool (client, CONFIG_ROOT "/stickykeys_enable", + desc->ctrls->enabled_ctrls & XkbStickyKeysMask); + set_bool (client, CONFIG_ROOT "/stickykeys_two_key_off", + desc->ctrls->ax_options & XkbAX_TwoKeysMask); + set_bool (client, CONFIG_ROOT "/stickykeys_modifier_beep", + desc->ctrls->ax_options & XkbAX_StickyKeysFBMask); + + set_bool (client, CONFIG_ROOT "/togglekeys_enable", + desc->ctrls->ax_options & XkbAX_IndicatorFBMask); + + we_are_changing_xkb_state = FALSE; +} + +static int xkbEventBase; +static GdkFilterReturn +cb_xkb_event_filter (GdkXEvent *xevent, GdkEvent *event, gpointer user) +{ + XEvent *xev = (XEvent *)xevent; + if (xev->xany.type == (xkbEventBase + XkbEventCode)) { + XkbEvent *xkbEv = (XkbEvent *) event; + fprintf (stderr, "xkb event\n"); + if(xkbEv->any.xkb_type == XkbControlsNotify) { + if (!we_are_changing_xkb_state) { + fprintf (stderr, "Someone changed XKB state\n"); + set_gconf_from_server (NULL); + } else + fprintf (stderr, "We changed XKB state\n"); + } + return GDK_FILTER_REMOVE; + } + + return GDK_FILTER_CONTINUE; +} + +/** + * gnome_settings_accessibility_keyboard_init : + * + * If the display supports XKB initialize it. + */ +void +gnome_settings_accessibility_keyboard_init (GConfClient *client) +{ + int opcode, errorBase, major, minor; + + if (!XkbQueryExtension (GDK_DISPLAY (), + &opcode, &xkbEventBase, &errorBase, &major, &minor) || + !XkbUseExtension (GDK_DISPLAY (), &major, &minor)) + return; + + XkbSelectEvents (GDK_DISPLAY (), + XkbUseCoreKbd, XkbAllEventsMask, XkbAllEventsMask); + gdk_window_add_filter (NULL, &cb_xkb_event_filter, NULL); + + gnome_settings_daemon_register_callback (CONFIG_ROOT, &set_server_from_gconf); +} + +void +gnome_settings_accessibility_keyboard_load (GConfClient *client) +{ + set_server_from_gconf (NULL); +} + +#else + +void +gnome_settings_accessibility_keyboard_init (GConfClient *client) +{ + g_warning ("Unsupported in this build"); +} + +void +gnome_settings_accessibility_keyboard_load (GConfClient *client) +{ + g_warning ("Unsupported in this build"); +} +#endif diff --git a/gnome-settings-daemon/gnome-settings-accessibility-keyboard.h b/gnome-settings-daemon/gnome-settings-accessibility-keyboard.h new file mode 100644 index 000000000..e38cb7ba8 --- /dev/null +++ b/gnome-settings-daemon/gnome-settings-accessibility-keyboard.h @@ -0,0 +1,32 @@ +/* gnome-settings-accessibility-keyboard.h + * + * Copyright © 2002 Ximian, Inc. + * + * Written by Jody Goldberg + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef __GNOME_SETTINGS_ACCESSIBILITY_KEYBOARD_H +#define __GNOME_SETTINGS_ACCESSIBILITY_KEYBOARD_H + +#include +#include + +void gnome_settings_accessibility_keyboard_init (GConfClient *client); +void gnome_settings_accessibility_keyboard_load (GConfClient *client); + +#endif /* __GNOME_SETTINGS_ACCESSIBILITY_KEYBOARD_H */ diff --git a/gnome-settings-daemon/gnome-settings-daemon.c b/gnome-settings-daemon/gnome-settings-daemon.c index a29181d9d..6341d9023 100644 --- a/gnome-settings-daemon/gnome-settings-daemon.c +++ b/gnome-settings-daemon/gnome-settings-daemon.c @@ -40,6 +40,7 @@ #include "gnome-settings-background.h" #include "gnome-settings-sound.h" #include "gnome-settings-wm.h" +#include "gnome-settings-accessibility-keyboard.h" #include "GNOME_SettingsDaemon.h" @@ -226,6 +227,7 @@ gnome_settings_daemon_new (void) gnome_settings_background_init (client); gnome_settings_sound_init (client); gnome_settings_wm_init (client); + gnome_settings_accessibility_keyboard_init (client); for (list = directories; list; list = list->next) { @@ -258,6 +260,7 @@ gnome_settings_daemon_new (void) gnome_settings_sound_load (client); gnome_settings_background_load (client); gnome_settings_wm_load (client); + gnome_settings_accessibility_keyboard_load (client); return G_OBJECT (daemon); } diff --git a/po/ChangeLog b/po/ChangeLog index 7d32da7e4..47d6ba1d1 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -19,6 +19,10 @@ * ms.po: Updated Malay Translation. +2002-03-20 Jody Goldberg + + * POTFILES.in : Add accessibility/keyboard + 2002-03-19 Richard Hestilow * POTFILES.in: Add activate-settings-daemon.c. diff --git a/po/POTFILES.in b/po/POTFILES.in index 85cc4cb75..e986c65a8 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,4 +1,7 @@ # Add files with translateable strings here. +capplets/accessibility/keyboard/accessibility-keyboard.c +capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.glade2 +capplets/accessibility/keyboard/gnome-accessibility-keyboard-properties.c capplets/background/background.desktop.in capplets/background/background-properties-capplet.c capplets/background/background-properties.glade @@ -8,6 +11,7 @@ capplets/common/activate-settings-daemon.c capplets/default-applications/default-applications.desktop.in capplets/default-applications/gnome-default-applications-properties.c capplets/default-applications/gnome-default-applications-properties.glade +capplets/desktop-links/Accessibility.directory.in.in capplets/desktop-links/Advanced.directory.in.in capplets/desktop-links/cd.desktop.in.in capplets/desktop-links/legacy-applications.desktop.in.in