[gtk/wip/otte/for-master: 1/5] widget: Add a critical when allocation is too small.
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/for-master: 1/5] widget: Add a critical when allocation is too small.
- Date: Wed, 9 Sep 2020 15:40:35 +0000 (UTC)
commit 8cb03a8cc079c490029b3ef9c99382a584dde298
Author: Benjamin Otte <otte redhat com>
Date: Wed Sep 9 17:07:01 2020 +0200
widget: Add a critical when allocation is too small.
gtk/gtkwidget.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 18038fd1a4..01ea24da59 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3785,6 +3785,28 @@ gtk_widget_allocate (GtkWidget *widget,
"How does the code know the size to allocate?",
gtk_widget_get_name (widget), widget);
}
+ if (!GTK_IS_SCROLLABLE (widget))
+ {
+ int min;
+ gtk_widget_measure (widget, GTK_ORIENTATION_VERTICAL, width, &min, NULL, NULL, NULL);
+ if (min > height)
+ {
+ g_critical ("Allocation height too small. Tried to allocate %dx%d, but %s %p needs "
+ "at least %dx%d.",
+ width, height,
+ gtk_widget_get_name (widget), widget,
+ width, min);
+ }
+ gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL, height, &min, NULL, NULL, NULL);
+ if (min > width)
+ {
+ g_critical ("Allocation width too small. Tried to allocate %dx%d, but %s %p needs "
+ "at least %dx%d.",
+ width, height,
+ gtk_widget_get_name (widget), widget,
+ min, height);
+ }
+ }
#endif /* G_ENABLE_DEBUG */
alloc_needed = priv->alloc_needed;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]