[egg-list-box] Propagate current state to the child



commit b32d1270655f7c6c83550ae1adc0934105c0cc00
Author: Paolo Borelli <pborelli gnome org>
Date:   Mon Oct 15 10:10:39 2012 +0200

    Propagate current state to the child
    
    This makes sure that the backdrop state reaches the children. At the
    moment I do not explicitely clear the selected, focus and prelight
    flags since I do not think they are ever set for the list widget, but
    maybe we should.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686092

 egg-list-box.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/egg-list-box.c b/egg-list-box.c
index 5108597..79c43a2 100644
--- a/egg-list-box.c
+++ b/egg-list-box.c
@@ -1045,31 +1045,33 @@ egg_list_box_real_draw (GtkWidget* widget, cairo_t* cr)
   EggListBoxPrivate *priv = list_box->priv;
   GtkAllocation allocation = {0};
   GtkStyleContext* context;
+  GtkStateFlags state;
   ChildFlags flags[3], *found;
   gint flags_length;
   int i;
 
   gtk_widget_get_allocation (GTK_WIDGET (list_box), &allocation);
   context = gtk_widget_get_style_context (GTK_WIDGET (list_box));
+  state = gtk_widget_get_state_flags (widget);
   gtk_render_background (context, cr, (gdouble) 0, (gdouble) 0, (gdouble) allocation.width, (gdouble) allocation.height);
   flags_length = 0;
 
   if (priv->selected_child != NULL)
     {
       found = child_flags_find_or_add (flags, &flags_length, priv->selected_child);
-      found->state |= GTK_STATE_FLAG_SELECTED;
+      found->state |= (state | GTK_STATE_FLAG_SELECTED);
     }
 
   if (priv->prelight_child != NULL)
     {
       found = child_flags_find_or_add (flags, &flags_length, priv->prelight_child);
-      found->state |= GTK_STATE_FLAG_PRELIGHT;
+      found->state |= (state | GTK_STATE_FLAG_PRELIGHT);
     }
 
   if (priv->active_child != NULL && priv->active_child_active)
     {
       found = child_flags_find_or_add (flags, &flags_length, priv->active_child);
-      found->state |= GTK_STATE_FLAG_ACTIVE;
+      found->state |= (state | GTK_STATE_FLAG_ACTIVE);
     }
 
   for (i = 0; i < flags_length; i++)



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