[gtk+] widget: Don't override state data when recursing to children



commit 58f0bc62a9015911e22784daf4144cd03b021f97
Author: Benjamin Otte <otte redhat com>
Date:   Thu Mar 17 16:45:19 2011 +0100

    widget: Don't override state data when recursing to children
    
    Writing onto the passed-in GtkStateData could cause changes that would
    propagate to siblings, as the data was not reset again.
    By copying the data structure, this is avoided and the proper values are
    passed to sibling widgets.

 gtk/gtkwidget.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 30d901c..10f9eff 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -11267,19 +11267,21 @@ gtk_widget_propagate_state (GtkWidget    *widget,
 
       if (GTK_IS_CONTAINER (widget))
         {
-          data->parent_sensitive = gtk_widget_is_sensitive (widget);
+          GtkStateData child_data = *data;
+
+          child_data.parent_sensitive = gtk_widget_is_sensitive (widget);
 
           /* Do not propagate focused state further */
-          data->flags &= ~GTK_STATE_FLAG_FOCUSED;
+          child_data.flags &= ~GTK_STATE_FLAG_FOCUSED;
 
-          if (data->use_forall)
+          if (child_data.use_forall)
             gtk_container_forall (GTK_CONTAINER (widget),
                                   (GtkCallback) gtk_widget_propagate_state,
-                                  data);
+                                  &child_data);
           else
             gtk_container_foreach (GTK_CONTAINER (widget),
                                    (GtkCallback) gtk_widget_propagate_state,
-                                   data);
+                                   &child_data);
         }
 
       /* Trigger state change transitions for the widget */



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