Make focus rectangle painted on all cells if the GtkCellAreaBox is requested to paint focus and none of the cells are activatable.

This commit is contained in:
Tristan Van Berkom 2010-11-29 16:14:46 +09:00
parent 87892261e0
commit 5f427ff476

View File

@ -1129,11 +1129,17 @@ gtk_cell_area_box_render (GtkCellArea *area,
GtkCellRenderer *focus_cell = NULL; GtkCellRenderer *focus_cell = NULL;
GdkRectangle focus_rect = { 0, }; GdkRectangle focus_rect = { 0, };
gboolean first_focus_cell = TRUE; gboolean first_focus_cell = TRUE;
gboolean focus_all = FALSE;
if (flags & GTK_CELL_RENDERER_FOCUSED) if (flags & GTK_CELL_RENDERER_FOCUSED)
{ {
focus_cell = gtk_cell_area_get_focus_cell (area); focus_cell = gtk_cell_area_get_focus_cell (area);
flags &= ~GTK_CELL_RENDERER_FOCUSED; 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; cell_background = *cell_area;
@ -1199,9 +1205,10 @@ gtk_cell_area_box_render (GtkCellArea *area,
render_background.width = background_area->width; render_background.width = background_area->width;
} }
if (focus_cell && if (focus_all ||
(cell->renderer == focus_cell || (focus_cell &&
gtk_cell_area_is_focus_sibling (area, focus_cell, cell->renderer))) (cell->renderer == focus_cell ||
gtk_cell_area_is_focus_sibling (area, focus_cell, cell->renderer))))
{ {
cell_fields |= GTK_CELL_RENDERER_FOCUSED; cell_fields |= GTK_CELL_RENDERER_FOCUSED;