[gtk+/wip/baedert/box: 269/269] widget: Warn on queue_resize/allocate during size-allocate
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/box: 269/269] widget: Warn on queue_resize/allocate during size-allocate
- Date: Wed, 19 Oct 2016 18:42:43 +0000 (UTC)
commit 3c98eb675b6f9f7eaba5cfc9028fd455fba287df
Author: Timm Bäder <mail baedert org>
Date: Wed Oct 19 20:32:30 2016 +0200
widget: Warn on queue_resize/allocate during size-allocate
gtk/gtkwidget.c | 10 ++++++++++
gtk/gtkwidgetprivate.h | 1 +
2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 4a27e36..4829aba 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3901,6 +3901,7 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
priv->alloc_needed = TRUE;
priv->alloc_needed_on_child = TRUE;
priv->focus_on_click = TRUE;
+ priv->in_size_allocate = FALSE;
#ifdef G_ENABLE_DEBUG
priv->highlight_resize = FALSE;
#endif
@@ -5182,6 +5183,10 @@ gtk_widget_queue_allocate (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ if (widget->priv->in_size_allocate)
+ g_warning ("Widget %s(%p) called queue_allocate during size-allocate", gtk_widget_get_name (widget),
widget);
+
if (_gtk_widget_get_realized (widget))
gtk_widget_queue_draw (widget);
@@ -5246,6 +5251,9 @@ gtk_widget_queue_resize (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
+ if (widget->priv->in_size_allocate)
+ g_warning ("Widget %s(%p) called queue_resize during size-allocate", gtk_widget_get_name (widget),
widget);
+
if (_gtk_widget_get_realized (widget))
gtk_widget_queue_draw (widget);
@@ -5409,6 +5417,7 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
return;
gtk_widget_push_verify_invariants (widget);
+ priv->in_size_allocate = TRUE;
#ifdef G_ENABLE_DEBUG
if (GTK_DISPLAY_DEBUG_CHECK (gtk_widget_get_display (widget), RESIZE))
@@ -5611,6 +5620,7 @@ out:
if (priv->alloc_needed_on_child)
gtk_widget_ensure_allocate (widget);
+ priv->in_size_allocate = FALSE;
gtk_widget_pop_verify_invariants (widget);
}
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 4403ae3..d305c63 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -71,6 +71,7 @@ struct _GtkWidgetPrivate
guint child_visible : 1;
guint multidevice : 1;
guint has_shape_mask : 1;
+ guint in_size_allocate : 1;
/* Queue-resize related flags */
guint resize_needed : 1; /* queue_resize() has been called but no get_preferred_size() yet */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]