GNOME Bugzilla – Bug 318827
Enable Gtk+ to support keyboard navigation using Phone keypad
Last modified: 2011-02-04 16:11:01 UTC
We want to use Gtk+ in phone devices. Usually phone keypad only has limited key buttons and among them, only four arrow keys(Up/Down/Left/Right, and no Tab key) can be used for focus navigation. Therefore, we want to made the following modifications to Gtk+: 1. KEY_UP/KEY_DOWN will move focus up or down(GTK_DIR_UP/GTK_DIR_DOWN) as stock Gtk+ does 2. KEY_LEFT/KEY_RIGHT will move focus forward or backward (GTK_DIR_TAB_FORWARD/GTK_DIR_TAB_BACKWARD) as Tab key or Shift+Tab key does. If the text direction is GTK_TEXT_DIR_RTL, then KEY_LEFT will move focus as GTK_DIR_TAB_FORWARD and KEY_RIGHT will move focus as GTK_DIR_TAB_BACKWARD; if the text direction is NOT GTK_TEXT_DIR_RTL, then KEY_LEFT will move focus as GTK_DIR_TAB_BACKWARD and KEY_RIGHT will move focus as GTK_DIR_TAB_FORWARD 3. Some widgets could trap arrow keys and do not allow focus moved out of the widgets by pressing these arrow keys. Therefore, 3.1 for GtkEntry, KEY_UP/KEY_DOWN will move focus up or down as stock Gtk+ does; KEY_LEFT/KEY_RIGHT will move focus forward or backward when the cursor now is already in the leftmost position or rightmost position; 3.2 for GtkSpinButton and GtkComboBox, KEY_UP/KEY_DOWN behaviors are unchaged; KEY_LEFT/KEY_RIGHT will move focus forward or backward; 3.3 for GtkTextView KEY_UP/KEY_DOWN/KEY_LEFT/KEY_RIGHT will move focus out of the widget if the cursor now is already in the first line/last line/top left cornor/right bottom corner. comments?
Created attachment 53443 [details] [review] patch for enable phone keypad navigation
Created attachment 54260 [details] [review] new patch for enable phone keypad navigation
See bug #322640 for a more general solution.
Fixed in CVS. Bug reporters, please check your use cases and file new bugs against the new features if anything doesn't work. It doesn't make sense to keep 6 bugs open. 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.