container: Don't keep our own variable trying to track need for resize
Insteaad, introduce gtk_widget_needs_allocate() and use that.
This commit is contained in:
parent
e07ff714b9
commit
cd20ae8fe1
@ -264,7 +264,6 @@ struct _GtkContainerPrivate
|
|||||||
|
|
||||||
guint has_focus_chain : 1;
|
guint has_focus_chain : 1;
|
||||||
guint reallocate_redraws : 1;
|
guint reallocate_redraws : 1;
|
||||||
guint resize_pending : 1;
|
|
||||||
guint restyle_pending : 1;
|
guint restyle_pending : 1;
|
||||||
guint resize_mode : 2;
|
guint resize_mode : 2;
|
||||||
guint request_mode : 2;
|
guint request_mode : 2;
|
||||||
@ -2008,13 +2007,12 @@ gtk_container_idle_sizer (GdkFrameClock *clock,
|
|||||||
* than trying to explicitly work around them with some extra flags,
|
* than trying to explicitly work around them with some extra flags,
|
||||||
* since it doesn't cause any actual harm.
|
* since it doesn't cause any actual harm.
|
||||||
*/
|
*/
|
||||||
if (container->priv->resize_pending)
|
if (gtk_widget_needs_allocate (GTK_WIDGET (container)))
|
||||||
{
|
{
|
||||||
container->priv->resize_pending = FALSE;
|
|
||||||
gtk_container_check_resize (container);
|
gtk_container_check_resize (container);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!container->priv->restyle_pending && !container->priv->resize_pending)
|
if (!container->priv->restyle_pending && !gtk_widget_needs_allocate (GTK_WIDGET (container)))
|
||||||
{
|
{
|
||||||
_gtk_container_stop_idle_sizer (container);
|
_gtk_container_stop_idle_sizer (container);
|
||||||
}
|
}
|
||||||
@ -2074,11 +2072,8 @@ gtk_container_queue_resize_handler (GtkContainer *container)
|
|||||||
switch (container->priv->resize_mode)
|
switch (container->priv->resize_mode)
|
||||||
{
|
{
|
||||||
case GTK_RESIZE_QUEUE:
|
case GTK_RESIZE_QUEUE:
|
||||||
if (!container->priv->resize_pending)
|
if (gtk_widget_needs_allocate (widget))
|
||||||
{
|
|
||||||
container->priv->resize_pending = TRUE;
|
|
||||||
gtk_container_start_idle_sizer (container);
|
gtk_container_start_idle_sizer (container);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GTK_RESIZE_IMMEDIATE:
|
case GTK_RESIZE_IMMEDIATE:
|
||||||
@ -2112,7 +2107,10 @@ _gtk_container_queue_restyle (GtkContainer *container)
|
|||||||
void
|
void
|
||||||
_gtk_container_maybe_start_idle_sizer (GtkContainer *container)
|
_gtk_container_maybe_start_idle_sizer (GtkContainer *container)
|
||||||
{
|
{
|
||||||
if (container->priv->restyle_pending || container->priv->resize_pending)
|
if (!GTK_IS_RESIZE_CONTAINER (container))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (container->priv->restyle_pending || gtk_widget_needs_allocate (GTK_WIDGET (container)))
|
||||||
gtk_container_start_idle_sizer (container);
|
gtk_container_start_idle_sizer (container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16255,16 +16255,30 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
|
|||||||
while (TRUE);
|
while (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gtk_widget_needs_allocate (GtkWidget *widget)
|
||||||
|
{
|
||||||
|
GtkWidgetPrivate *priv = widget->priv;
|
||||||
|
|
||||||
|
if (!priv->visible || !priv->child_visible)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (priv->resize_needed || priv->alloc_needed || priv->alloc_needed_on_child)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gtk_widget_ensure_allocate (GtkWidget *widget)
|
gtk_widget_ensure_allocate (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GtkWidgetPrivate *priv = widget->priv;
|
GtkWidgetPrivate *priv = widget->priv;
|
||||||
|
|
||||||
gtk_widget_ensure_resize (widget);
|
if (!gtk_widget_needs_allocate (widget))
|
||||||
|
|
||||||
if (!priv->visible || !priv->child_visible)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
gtk_widget_ensure_resize (widget);
|
||||||
|
|
||||||
/* This code assumes that we only reach here if the previous
|
/* This code assumes that we only reach here if the previous
|
||||||
* allocation is still valid (ie no resize was queued).
|
* allocation is still valid (ie no resize was queued).
|
||||||
* If that wasn't true, the parent would have taken care of
|
* If that wasn't true, the parent would have taken care of
|
||||||
|
@ -167,6 +167,7 @@ gboolean _gtk_widget_get_shadowed (GtkWidget *widget);
|
|||||||
void _gtk_widget_set_shadowed (GtkWidget *widget,
|
void _gtk_widget_set_shadowed (GtkWidget *widget,
|
||||||
gboolean shadowed);
|
gboolean shadowed);
|
||||||
gboolean _gtk_widget_get_alloc_needed (GtkWidget *widget);
|
gboolean _gtk_widget_get_alloc_needed (GtkWidget *widget);
|
||||||
|
gboolean gtk_widget_needs_allocate (GtkWidget *widget);
|
||||||
void gtk_widget_queue_resize_on_widget (GtkWidget *widget);
|
void gtk_widget_queue_resize_on_widget (GtkWidget *widget);
|
||||||
void gtk_widget_ensure_resize (GtkWidget *widget);
|
void gtk_widget_ensure_resize (GtkWidget *widget);
|
||||||
void gtk_widget_ensure_allocate (GtkWidget *widget);
|
void gtk_widget_ensure_allocate (GtkWidget *widget);
|
||||||
|
Loading…
Reference in New Issue
Block a user