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



commit 91d3a5ac7e191b7deccd437adb96f6f295a37e94
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 8f50575..25c2e8c 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -11254,19 +11254,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]