[gtk+/wip/baedert/widget-templates: 2/6] widget: Explicitly warn when resizing during size-allocate
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/baedert/widget-templates: 2/6] widget: Explicitly warn when resizing during size-allocate
- Date: Wed, 29 Mar 2017 16:57:47 +0000 (UTC)
commit e7d9dd451a53a546a1f63d343a7be678d3ce591b
Author: Timm Bäder <mail baedert org>
Date: Sun Mar 26 15:50:26 2017 +0200
widget: Explicitly warn when resizing during size-allocate
gtk/gtkwidget.c | 14 ++++++++++++++
gtk/gtkwidgetprivate.h | 1 +
2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index c24606a..15c4639 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3812,6 +3812,7 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
priv->focus_on_click = TRUE;
#ifdef G_ENABLE_DEBUG
priv->highlight_resize = FALSE;
+ priv->in_size_allocate = FALSE;
#endif
switch (_gtk_widget_get_direction (widget))
@@ -5112,6 +5113,9 @@ gtk_widget_queue_allocate (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
+ if (widget->priv->in_size_allocate)
+ g_warning ("%s on %s %p while in size_allocate", __FUNCTION__, G_OBJECT_TYPE_NAME (widget), widget);
+
if (_gtk_widget_get_realized (widget))
gtk_widget_queue_draw (widget);
@@ -5176,6 +5180,9 @@ gtk_widget_queue_resize (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
+ if (widget->priv->in_size_allocate)
+ g_warning ("%s on %s %p while in size_allocate", __FUNCTION__, G_OBJECT_TYPE_NAME (widget), widget);
+
if (_gtk_widget_get_realized (widget))
gtk_widget_queue_draw (widget);
@@ -5196,6 +5203,9 @@ gtk_widget_queue_resize_no_redraw (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
+ if (widget->priv->in_size_allocate)
+ g_warning ("%s on %s %p while in size_allocate", __FUNCTION__, G_OBJECT_TYPE_NAME (widget), widget);
+
gtk_widget_queue_resize_internal (widget);
}
@@ -5338,6 +5348,8 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
if (!priv->visible && !_gtk_widget_is_toplevel (widget))
return;
+ priv->in_size_allocate = TRUE;
+
gtk_widget_push_verify_invariants (widget);
#ifdef G_ENABLE_DEBUG
@@ -5536,6 +5548,8 @@ out:
gtk_widget_ensure_allocate (widget);
gtk_widget_pop_verify_invariants (widget);
+
+ priv->in_size_allocate = FALSE;
}
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index ba46211..b1df748 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -47,6 +47,7 @@ struct _GtkWidgetPrivate
#ifdef G_ENABLE_DEBUG
guint highlight_resize : 1;
+ guint in_size_allocate : 1;
#endif
guint in_destruction : 1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]