Merge branch 'wip/dboles/revealer-underallocates-gadgets-3' into 'gtk-3-24'

Revealer: Don't (under)allocate child if not shown (+bonus: actually put enough filler text in testrevealer)

See merge request GNOME/gtk!463
This commit is contained in:
Benjamin Otte 2018-12-18 22:21:37 +00:00
commit 55894c48a5
2 changed files with 6 additions and 4 deletions

View File

@ -449,7 +449,7 @@ gtk_revealer_real_size_allocate (GtkWidget *widget,
GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer);
GtkAllocation child_allocation;
GtkWidget *child;
gboolean window_visible;
gboolean child_visible, window_visible;
int bin_x, bin_y;
GtkRevealerTransitionType transition;
GtkBorder padding;
@ -460,7 +460,9 @@ gtk_revealer_real_size_allocate (GtkWidget *widget,
gtk_revealer_get_child_allocation (revealer, allocation, &child_allocation);
child = gtk_bin_get_child (GTK_BIN (revealer));
if (child != NULL && gtk_widget_get_visible (child))
child_visible = child != NULL && gtk_widget_get_visible (child) &&
gtk_widget_get_child_visible (child);
if (child_visible)
gtk_widget_size_allocate (child, &child_allocation);
if (gtk_widget_get_realized (widget))

View File

@ -14,14 +14,14 @@ main (gint argc,
box = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (window), box);
widget = gtk_label_new ("Some filler text to avoid\nresizing of the window");
widget = gtk_label_new ("Some filler text just to avoid\nresizing of the window");
gtk_widget_set_margin_top (widget, 10);
gtk_widget_set_margin_bottom (widget, 10);
gtk_widget_set_margin_start (widget, 10);
gtk_widget_set_margin_end (widget, 10);
gtk_grid_attach (GTK_GRID (box), widget, 1, 1, 1, 1);
widget = gtk_label_new ("Some filler text to avoid\nresizing of the window");
widget = gtk_label_new ("Some filler text just to avoid\nresizing of the window");
gtk_widget_set_margin_top (widget, 10);
gtk_widget_set_margin_bottom (widget, 10);
gtk_widget_set_margin_start (widget, 10);