Revealer: Don’t (under)allocate child if not shown

If the child is not (partly) revealed, don’t allocate it, or we spam the
console with warnings about giving negative width to children’s gadgets.
We can check :child-visible, which is FALSE if (current&target)_pos == 0

Close https://gitlab.gnome.org/GNOME/gtk/issues/1057
This commit is contained in:
Daniel Boles 2018-12-18 20:53:06 +00:00
parent ee5873be19
commit d179b0667d

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))