[gtk+] treeview: propagate the selected state from the row



commit 96d6c2d108a3f69759a5a23f76e6b4d309da0b15
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Mar 7 00:17:08 2011 -0500

    treeview: propagate the selected state from the row
    
    An expander in a row can't be selected on its own otherwise. This way
    themes can override the expander colors when the row is selected.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=644089

 gtk/gtktreeview.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index be37219..aefe6f6 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -10026,6 +10026,7 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
   gint x2;
   gint vertical_separator;
   gint expander_size;
+  GtkCellRendererState flags;
 
   widget = GTK_WIDGET (tree_view);
   context = gtk_widget_get_style_context (widget);
@@ -10051,10 +10052,17 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
     state |= GTK_STATE_FLAG_INSENSITIVE;
   else
     {
+      flags = 0;
+
+      if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED))
+        flags |= GTK_CELL_RENDERER_SELECTED;
+
+      state = gtk_cell_renderer_get_state (NULL, widget, flags);
+
       if (node == tree_view->priv->button_pressed_node &&
           x >= area.x && x <= (area.x + area.width) &&
           y >= area.y && y <= (area.y + area.height))
-        state |= GTK_STATE_FLAG_SELECTED;
+        state |= GTK_STATE_FLAG_FOCUSED;
 
       if (node == tree_view->priv->prelight_node &&
           tree_view->priv->arrow_prelit)



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