summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2017-03-05 14:59:19 +0100
committerTimm Bäder <mail@baedert.org>2017-03-05 15:01:57 +0100
commitf1f39e89248334ddd462df2fab81c27f3b94e727 (patch)
treef7105ff5afac2495f775ace581e92fbc51c9bd48
parentb6790b112f7947deb8e178f0ca863fdb2d250b1d (diff)
downloadgtk+-f1f39e89248334ddd462df2fab81c27f3b94e727.tar.gz
sizerequest: Fix min_size > nat_size error message
Instead of mentioning the old _get_preferred_xxx functions, mention measure() and print the for_size value as well. The orientation is given by printing either "width" for GTK_ORIENTATION_HORIZONTAL or "height" for GTK_ORIENTATION_VERTICAL.
-rw-r--r--gtk/gtksizerequest.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index 3c58d34d14..907a454b25 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -81,16 +81,6 @@ pop_recursion_check (GtkWidget *widget,
#define pop_recursion_check(widget, orientation)
#endif /* G_ENABLE_CONSISTENCY_CHECKS */
-static const char *
-get_vfunc_name (GtkOrientation orientation,
- gint for_size)
-{
- if (orientation == GTK_ORIENTATION_HORIZONTAL)
- return for_size < 0 ? "get_preferred_width" : "get_preferred_width_for_height";
- else
- return for_size < 0 ? "get_preferred_height" : "get_preferred_height_for_width";
-}
-
static void
gtk_widget_query_size_for_orientation (GtkWidget *widget,
GtkOrientation orientation,
@@ -208,10 +198,19 @@ gtk_widget_query_size_for_orientation (GtkWidget *widget,
}
}
- if (min_size > nat_size)
+ if (G_UNLIKELY (min_size > nat_size))
{
- g_warning ("%s %p reported min size %d and natural size %d in %s(); natural size must be >= min size",
- G_OBJECT_TYPE_NAME (widget), widget, min_size, nat_size, get_vfunc_name (orientation, for_size));
+ if (orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ g_warning ("%s %p reported min width %d and natural width %d in measure() with for_size=%d; natural size must be >= min size",
+ G_OBJECT_TYPE_NAME (widget), widget, min_size, nat_size, for_size);
+ }
+ else
+ {
+ g_warning ("%s %p reported min height %d and natural height %d in measure() with for_size=%d; natural size must be >= min size",
+ G_OBJECT_TYPE_NAME (widget), widget, min_size, nat_size, for_size);
+
+ }
}
adjusted_min = min_size;