forked from AuroraMiddleware/gtk
stack: Only map children when necessary
gtk_widget_set_parent() will map the widget if the parent is mapped and the widget is both visible and child-visible. As we currently only set the child visibility after adding the child, we immediately map all children that are added to a mapped stack, even when they are not actually shown. Avoid this by setting the child visibility before adding the child, so widgets are only mapped when shown. https://bugzilla.gnome.org/show_bug.cgi?id=766737
This commit is contained in:
parent
386ead4243
commit
57efcabfd6
@ -1266,6 +1266,7 @@ gtk_stack_add (GtkContainer *container,
|
|||||||
|
|
||||||
priv->children = g_list_append (priv->children, child_info);
|
priv->children = g_list_append (priv->children, child_info);
|
||||||
|
|
||||||
|
gtk_widget_set_child_visible (child, FALSE);
|
||||||
gtk_widget_set_parent_window (child, priv->bin_window);
|
gtk_widget_set_parent_window (child, priv->bin_window);
|
||||||
gtk_widget_set_parent (child, GTK_WIDGET (stack));
|
gtk_widget_set_parent (child, GTK_WIDGET (stack));
|
||||||
|
|
||||||
@ -1282,8 +1283,6 @@ gtk_stack_add (GtkContainer *container,
|
|||||||
if (priv->visible_child == NULL &&
|
if (priv->visible_child == NULL &&
|
||||||
gtk_widget_get_visible (child))
|
gtk_widget_get_visible (child))
|
||||||
set_visible_child (stack, child_info, priv->transition_type, priv->transition_duration);
|
set_visible_child (stack, child_info, priv->transition_type, priv->transition_duration);
|
||||||
else
|
|
||||||
gtk_widget_set_child_visible (child, FALSE);
|
|
||||||
|
|
||||||
if (priv->hhomogeneous || priv->vhomogeneous || priv->visible_child == child_info)
|
if (priv->hhomogeneous || priv->vhomogeneous || priv->visible_child == child_info)
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (stack));
|
gtk_widget_queue_resize (GTK_WIDGET (stack));
|
||||||
|
Loading…
Reference in New Issue
Block a user