Commit 80513aa2 authored by Matthias Clasen's avatar Matthias Clasen

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.
parent f83af035
......@@ -81,6 +81,13 @@ Release notes for 3.10
setups (not multi-monitor!) are very rare nowadays. If you really
need multiple X screens, open them as separate displays.
* The behavior of GtkBox::expand has been changed to never propagate
up. Previously, this was happening inconsistently. If you want the
expand to propagate, use the GtkWidget h/v expand properties.
If you experience sizing problems with widgets in ported code,
carefully check the expand and fill flags of your boxes.
Release notes for 3.8
=====================
......
......@@ -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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment