summaryrefslogtreecommitdiff
path: root/gtk/gtkbox.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-05-25 14:04:36 -0400
committerMatthias Clasen <mclasen@redhat.com>2013-05-25 14:46:09 -0400
commit80513aa2c7ed4aecc235723ea6c6f044cf98ba1d (patch)
treee80e43430386eb68a6cd024015ba7e069e1b79bf /gtk/gtkbox.c
parentf83af03579cbdb4b85e86c6cedee7578566fe802 (diff)
downloadgtk+-80513aa2c7ed4aecc235723ea6c6f044cf98ba1d.tar.gz
GtkBox: don't propagate the expand child property
The intention of the expand widget flags was to in fact propagate legacy expand child properties as well. Due to implementation errors, this was only happening in some cases, but not in others. To avoid breaking old code assuming traditional expand flag behavior, this commit removes all attempts to propagate GtkBox::expand. This was discussed in https://bugzilla.gnome.org/show_bug.cgi?id=698656 and https://bugzilla.gnome.org/show_bug.cgi?id=628902 This patch was written by Tristan Van Berkom.
Diffstat (limited to 'gtk/gtkbox.c')
-rw-r--r--gtk/gtkbox.c54
1 files changed, 3 insertions, 51 deletions
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index e60fb4fa90..94e89073cc 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -150,9 +150,6 @@ struct _GtkBoxChild
static void gtk_box_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
-static void gtk_box_compute_expand (GtkWidget *widget,
- gboolean *hexpand,
- gboolean *vexpand);
static void gtk_box_direction_changed (GtkWidget *widget,
GtkTextDirection previous_direction);
@@ -230,7 +227,6 @@ gtk_box_class_init (GtkBoxClass *class)
widget_class->get_preferred_height_for_width = gtk_box_get_preferred_height_for_width;
widget_class->get_preferred_height_and_baseline_for_width = gtk_box_get_preferred_height_and_baseline_for_width;
widget_class->get_preferred_width_for_height = gtk_box_get_preferred_width_for_height;
- widget_class->compute_expand = gtk_box_compute_expand;
widget_class->direction_changed = gtk_box_direction_changed;
container_class->add = gtk_box_add;
@@ -285,6 +281,9 @@ gtk_box_class_init (GtkBoxClass *class)
* Note that the #GtkWidget:halign, #GtkWidget:valign, #GtkWidget:hexpand
* and #GtkWidget:vexpand properties are the preferred way to influence
* child size allocation in containers.
+ *
+ * In contrast to #GtkWidget::hexpand, the expand child property does
+ * not cause the box to expand itself.
*/
gtk_container_class_install_child_property (container_class,
CHILD_PROP_EXPAND,
@@ -779,53 +778,6 @@ gtk_box_size_allocate (GtkWidget *widget,
}
}
-static void
-gtk_box_compute_expand (GtkWidget *widget,
- gboolean *hexpand_p,
- gboolean *vexpand_p)
-{
- GtkBoxPrivate *private = GTK_BOX (widget)->priv;
- GList *children;
- GtkBoxChild *child;
- gboolean our_expand;
- gboolean opposite_expand;
- GtkOrientation opposite_orientation;
-
- opposite_orientation = OPPOSITE_ORIENTATION (private->orientation);
-
- our_expand = FALSE;
- opposite_expand = FALSE;
-
- for (children = private->children; children; children = children->next)
- {
- child = children->data;
-
- /* we don't recurse into children anymore as soon as we know
- * expand=TRUE in an orientation
- */
-
- if (child->expand || (!our_expand && gtk_widget_compute_expand (child->widget, private->orientation)))
- our_expand = TRUE;
-
- if (!opposite_expand && gtk_widget_compute_expand (child->widget, opposite_orientation))
- opposite_expand = TRUE;
-
- if (our_expand && opposite_expand)
- break;
- }
-
- if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
- {
- *hexpand_p = our_expand;
- *vexpand_p = opposite_expand;
- }
- else
- {
- *hexpand_p = opposite_expand;
- *vexpand_p = our_expand;
- }
-}
-
static GType
gtk_box_child_type (GtkContainer *container)
{