]> Pileus Git - ~andy/gtk/commitdiff
Make focus rectangle painted on all cells if the GtkCellAreaBox is requested to paint...
authorTristan Van Berkom <tristan.van.berkom@gmail.com>
Mon, 29 Nov 2010 07:14:46 +0000 (16:14 +0900)
committerTristan Van Berkom <tristan.van.berkom@gmail.com>
Mon, 29 Nov 2010 07:14:46 +0000 (16:14 +0900)
gtk/gtkcellareabox.c

index 00634ad3b41debc01db8414f6c01a4d23d162f19..5e25c8af98f501ae115b17eec2cf1519c00bbd8c 100644 (file)
@@ -1129,11 +1129,17 @@ gtk_cell_area_box_render (GtkCellArea          *area,
   GtkCellRenderer       *focus_cell = NULL;
   GdkRectangle           focus_rect = { 0, };
   gboolean               first_focus_cell = TRUE;
+  gboolean               focus_all = FALSE;
 
   if (flags & GTK_CELL_RENDERER_FOCUSED)
     {
       focus_cell = gtk_cell_area_get_focus_cell (area);
       flags &= ~GTK_CELL_RENDERER_FOCUSED;
+
+      /* If no cell can activate but the caller wants focus painted,
+       * then we paint focus around all cells */
+      if (paint_focus && !gtk_cell_area_can_focus (area))
+       focus_all = TRUE;
     }
 
   cell_background = *cell_area;
@@ -1199,9 +1205,10 @@ gtk_cell_area_box_render (GtkCellArea          *area,
          render_background.width = background_area->width;
        }
 
-      if (focus_cell && 
-         (cell->renderer == focus_cell || 
-          gtk_cell_area_is_focus_sibling (area, focus_cell, cell->renderer)))
+      if (focus_all || 
+         (focus_cell && 
+          (cell->renderer == focus_cell || 
+           gtk_cell_area_is_focus_sibling (area, focus_cell, cell->renderer))))
        {
          cell_fields |= GTK_CELL_RENDERER_FOCUSED;