summaryrefslogtreecommitdiff
path: root/gtk/gtksettings.c
diff options
context:
space:
mode:
authorMichael Natterer <mitch@imendio.com>2006-11-16 12:56:30 +0000
committerMichael Natterer <mitch@src.gnome.org>2006-11-16 12:56:30 +0000
commit7f374a74bae63c9c1011c2a5a9c99de4012e7c61 (patch)
tree172bd0c74b8bdc35ff1d8dc5058861f9dd500d41 /gtk/gtksettings.c
parentaf6b361d6b481a21f69a3a1f7305c11425a500e2 (diff)
downloadgtk+-7f374a74bae63c9c1011c2a5a9c99de4012e7c61.tar.gz
Add new infrastructure for notifications of failed keyboard navigation and
2006-11-16 Michael Natterer <mitch@imendio.com> Add new infrastructure for notifications of failed keyboard navigation and navigation with restricted set of keys. The patch handles configurable beeping, navigating the GUI with cursor keys only (as in phone environments), and configurable wrap-around. Fixes bugs #322640, #70986, #318827, #334726, #334742 and #309291. * gtk/gtksettings.c: added properties gtk-keynav-cursor-only, gtk-keynav-wrap-around and gtk-error-bell. * gtk/gtkwidget.[ch]: added new signal "keynav-failed" and public API to emit it. Added New function gtk_widget_error_bell() which looks at the gtk-error-bell setting and calls gdk_window_beep() accordingly. * gtk/gtk.symbols: add the new widget symbols. * gtk/gtkcellrendereraccel.c * gtk/gtkimcontextsimple.c * gtk/gtkmenu.c * gtk/gtknotebook.c: use gtk_widget_error_bell() or look at the gtk-error-bell setting instead of calling gdk_display_beep() unconditionally. * gtk/gtkcombobox.c * gtk/gtkentry.c * gtk/gtkiconview.c * gtk/gtklabel.c * gtk/gtkmenushell.c * gtk/gtkspinbutton.c * gtk/gtktextview.c * gtk/gtktreeview.c: call gtk_widget_error_bell() on failed keynav. * gtk/gtkentry.c * gtk/gtklabel.c * gtk/gtkrange.c * gtk/gtktextview.c: consult gtk_widget_keynav_failed() on failed cursor navigation and leave the widget if it returns FALSE. * gtk/gtkmenushell.c * gtk/gtknotebook.c: only wrap around if gtk-keynav-wrap-around is TRUE. * gtk/gtkradiobutton.c: ask gtk_widget_keynav_failed() to decide whether to to wrap-around, and don't select active items on cursor navigation if gtk-keynav-cursor-only is TRUE. Should look at gtk-keynav-wrap-around too, will look into that.
Diffstat (limited to 'gtk/gtksettings.c')
-rw-r--r--gtk/gtksettings.c63
1 files changed, 62 insertions, 1 deletions
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 0054a2fcb4..cd3eda5900 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -93,6 +93,9 @@ enum {
PROP_COLOR_SCHEME,
PROP_ENABLE_ANIMATIONS,
PROP_TOUCHSCREEN_MODE,
+ PROP_KEYNAV_CURSOR_ONLY,
+ PROP_KEYNAV_WRAP_AROUND,
+ PROP_ERROR_BELL,
PROP_COLOR_HASH
};
@@ -507,7 +510,7 @@ gtk_settings_class_init (GtkSettingsClass *class)
/**
* GtkSettings:gtk-touchscreen-mode:
*
- * When TRUE, there are no motion notify events delivered on this screen,
+ * When %TRUE, there are no motion notify events delivered on this screen,
* and widgets can't use the pointer hovering them for any essential
* functionality.
*
@@ -524,6 +527,64 @@ gtk_settings_class_init (GtkSettingsClass *class)
g_assert (result == PROP_TOUCHSCREEN_MODE);
/**
+ * GtkSettings:gtk-keynav-cursor-only:
+ *
+ * When %TRUE, keyboard navigation should be able to reach all widgets
+ * by using the cursor keys only. Tab, Shift etc. keys can't be expected
+ * to be present on the used input device.
+ *
+ * Since: 2.12
+ */
+ result = settings_install_property_parser (class,
+ g_param_spec_boolean ("gtk-keynav-cursor-only",
+ P_("Keynav Cursor Only"),
+ P_("When TRUE, there are only cursor keys available to navigate widgets"),
+ FALSE,
+ GTK_PARAM_READWRITE),
+ NULL);
+
+ g_assert (result == PROP_KEYNAV_CURSOR_ONLY);
+
+ /**
+ * GtkSettings:gtk-keynav-wrap-around:
+ *
+ * When %TRUE, some widgets will wrap around when doing keyboard
+ * navigation, such as menus, menubars and notebooks.
+ *
+ * Since: 2.12
+ */
+ result = settings_install_property_parser (class,
+ g_param_spec_boolean ("gtk-keynav-wrap-around",
+ P_("Keynav Wrap Around"),
+ P_("Whether to wrap around when keyboard-navigating widgets"),
+ TRUE,
+ GTK_PARAM_READWRITE),
+ NULL);
+
+ g_assert (result == PROP_KEYNAV_WRAP_AROUND);
+
+ /**
+ * GtkSettings:gtk-error-bell:
+ *
+ * When %TRUE, keyboard navigation and other input-related errors
+ * will cause a beep. Since the error bell is implemented using
+ * gdk_window_beep(), the windowing system may offer ways to
+ * configure the error bell in many ways, such as flashing the
+ * window or similar visual effects.
+ *
+ * Since: 2.12
+ */
+ result = settings_install_property_parser (class,
+ g_param_spec_boolean ("gtk-error-bell",
+ P_("Error Bell"),
+ P_("When TRUE, keyboard navigation and other errors will cause a beep"),
+ TRUE,
+ GTK_PARAM_READWRITE),
+ NULL);
+
+ g_assert (result == PROP_ERROR_BELL);
+
+ /**
* GtkSettings:color-hash:
*
* Holds a hash table representation of the gtk-color-scheme setting,