[gtk+/icon-view-refactor: 13/13] Fixed GtkIconView keynav



commit 223b5bd1ea9aac9d776a19b5e470db040e33a1ba
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Wed Jan 5 21:58:32 2011 +0900

    Fixed GtkIconView keynav
    
    Icon View was not initially setting focus on a cell when
    focus initially comes into the view. Focusing into whatever
    is the first cell in the cursor item when set_cursor_item
    is called with a NULL cell fixes this.

 gtk/gtkiconview.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 45c130b..4d5595b 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -3139,7 +3139,14 @@ gtk_icon_view_set_cursor_item (GtkIconView     *icon_view,
     }
   icon_view->priv->cursor_item = item;
 
-  gtk_cell_area_set_focus_cell (icon_view->priv->cell_area, cursor_cell);
+  if (cursor_cell)
+    gtk_cell_area_set_focus_cell (icon_view->priv->cell_area, cursor_cell);
+  else
+    {
+      /* Make sure there is a cell in focus initially */
+      if (!gtk_cell_area_get_focus_cell (icon_view->priv->cell_area))
+	gtk_cell_area_focus (icon_view->priv->cell_area, GTK_DIR_TAB_FORWARD);
+    }
 
   gtk_icon_view_queue_draw_item (icon_view, item);
   
@@ -3773,6 +3780,7 @@ gtk_icon_view_move_cursor_up_down (GtkIconView *icon_view,
                                     direction == GTK_DIR_UP ?
                                     GTK_DIR_TAB_BACKWARD :
                                     GTK_DIR_TAB_FORWARD);
+
         }
 
       gtk_cell_area_set_focus_cell (icon_view->priv->cell_area, cell);
@@ -3917,6 +3925,7 @@ gtk_icon_view_move_cursor_left_right (GtkIconView *icon_view,
                                     direction == GTK_DIR_LEFT ?
                                     GTK_DIR_TAB_BACKWARD :
                                     GTK_DIR_TAB_FORWARD);
+
         }
 
       gtk_cell_area_set_focus_cell (icon_view->priv->cell_area, cell);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]