[egg-list-box] Improve keynav
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [egg-list-box] Improve keynav
- Date: Tue, 22 Jan 2013 11:01:46 +0000 (UTC)
commit 98b0a39efe7b1892570ece53748ab153a91b9cbc
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Jan 22 05:56:02 2013 -0500
Improve keynav
Using gtk_widget_keynav_failed() instead of hardcoding
gtk_widget_error_bell() gives applications a chance to override
keynav handling. We will make use of this in the power panel
to 'link' arrow keynav across multiple list boxes.
https://bugzilla.gnome.org/show_bug.cgi?id=692275
egg-list-box.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/egg-list-box.c b/egg-list-box.c
index 4200565..8480c4d 100644
--- a/egg-list-box.c
+++ b/egg-list-box.c
@@ -1015,8 +1015,8 @@ egg_list_box_real_focus (GtkWidget* widget, GtkDirectionType direction)
{
if (direction == GTK_DIR_UP || direction == GTK_DIR_DOWN)
{
- gtk_widget_error_bell (GTK_WIDGET (list_box));
- return TRUE;
+ if (gtk_widget_keynav_failed (GTK_WIDGET (list_box), direction))
+ return TRUE;
}
return FALSE;
@@ -1970,7 +1970,20 @@ egg_list_box_real_move_cursor (EggListBox *list_box,
if (child == NULL)
{
- gtk_widget_error_bell (GTK_WIDGET (list_box));
+ GtkDirectionType direction = count < 0 ? GTK_DIR_UP : GTK_DIR_DOWN;
+
+ if (!gtk_widget_keynav_failed (GTK_WIDGET (list_box), direction))
+ {
+ GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (list_box));
+
+ if (toplevel)
+ gtk_widget_child_focus (toplevel,
+ direction == GTK_DIR_UP ?
+ GTK_DIR_TAB_BACKWARD :
+ GTK_DIR_TAB_FORWARD);
+
+ }
+
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]