[Xfce4-commits] <exo:master> Add keynav-failed to ExoIconView.

Nick Schermer noreply at xfce.org
Tue Jan 24 18:44:02 CET 2012


Updating branch refs/heads/master
         to cbd91e776776501a962696e64acb2e9904d0881c (commit)
       from 7385e5018fe5eb0bdcd05eacdcf79dbd74406d9a (commit)

commit cbd91e776776501a962696e64acb2e9904d0881c
Author: Nick Schermer <nick at xfce.org>
Date:   Tue Jan 24 18:34:47 2012 +0100

    Add keynav-failed to ExoIconView.

 exo/exo-icon-view.c |   60 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 48 insertions(+), 12 deletions(-)

diff --git a/exo/exo-icon-view.c b/exo/exo-icon-view.c
index 8de747d..3fc9980 100644
--- a/exo/exo-icon-view.c
+++ b/exo/exo-icon-view.c
@@ -4249,15 +4249,19 @@ static void
 exo_icon_view_move_cursor_up_down (ExoIconView *icon_view,
                                    gint         count)
 {
-  ExoIconViewItem *item;
-  gboolean         dirty = FALSE;
-  GList           *list;
-  gint             cell = -1;
-  gint             step;
+  ExoIconViewItem  *item;
+  gboolean          dirty = FALSE;
+  GList            *list;
+  gint              cell = -1;
+  gint              step;
+  GtkDirectionType  direction;
+  GtkWidget        *toplevel;
 
   if (!GTK_WIDGET_HAS_FOCUS (icon_view))
     return;
 
+  direction = count < 0 ? GTK_DIR_UP : GTK_DIR_DOWN;
+
   if (!icon_view->priv->cursor_item)
     {
       if (count > 0)
@@ -4314,7 +4318,21 @@ exo_icon_view_move_cursor_up_down (ExoIconView *icon_view,
     }
 
   if (!item)
-    return;
+    {
+      if (!gtk_widget_keynav_failed (GTK_WIDGET (icon_view), direction))
+        {
+          toplevel = gtk_widget_get_toplevel (GTK_WIDGET (icon_view));
+          if (toplevel != NULL)
+            {
+              gtk_widget_child_focus (toplevel,
+                                      direction == GTK_DIR_UP ?
+                                          GTK_DIR_TAB_BACKWARD :
+                                          GTK_DIR_TAB_FORWARD);
+            }
+        }
+
+      return;
+    }
 
   if (icon_view->priv->ctrl_pressed ||
       !icon_view->priv->shift_pressed ||
@@ -4399,15 +4417,19 @@ static void
 exo_icon_view_move_cursor_left_right (ExoIconView *icon_view,
                                       gint         count)
 {
-  ExoIconViewItem *item;
-  gboolean         dirty = FALSE;
-  GList           *list;
-  gint             cell = -1;
-  gint             step;
+  ExoIconViewItem  *item;
+  gboolean          dirty = FALSE;
+  GList            *list;
+  gint              cell = -1;
+  gint              step;
+  GtkDirectionType  direction;
+  GtkWidget        *toplevel;
 
   if (!GTK_WIDGET_HAS_FOCUS (icon_view))
     return;
 
+  direction = count < 0 ? GTK_DIR_LEFT : GTK_DIR_RIGHT;
+
   if (!icon_view->priv->cursor_item)
     {
       if (count > 0)
@@ -4468,7 +4490,21 @@ exo_icon_view_move_cursor_left_right (ExoIconView *icon_view,
     }
 
   if (!item)
-    return;
+    {
+      if (!gtk_widget_keynav_failed (GTK_WIDGET (icon_view), direction))
+        {
+          toplevel = gtk_widget_get_toplevel (GTK_WIDGET (icon_view));
+          if (toplevel != NULL)
+            {
+              gtk_widget_child_focus (toplevel,
+                                      direction == GTK_DIR_LEFT ?
+                                          GTK_DIR_TAB_BACKWARD :
+                                          GTK_DIR_TAB_FORWARD);
+            }
+        }
+
+      return;
+    }
 
   if (icon_view->priv->ctrl_pressed ||
       !icon_view->priv->shift_pressed ||


More information about the Xfce4-commits mailing list