[gtk+] Make size request warnings more useful



commit 0fe6d76ab6a5e0da97bc08922f05814a25d4315e
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jan 9 17:48:51 2018 -0500

    Make size request warnings more useful
    
    Print the css name of the widget in question, so we have
    a chance of knowing that this is caused by the marks, not
    by the slider.

 gtk/gtksizerequest.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index 507d0ec..278d72d 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -229,13 +229,17 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
         {
           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);
+              g_warning ("%s %p (%s) 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,
+                         gtk_css_node_get_name (gtk_widget_get_css_node (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);
+              g_warning ("%s %p (%s) 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,
+                         gtk_css_node_get_name (gtk_widget_get_css_node (widget)),
+                         min_size, nat_size, for_size);
 
             }
 
@@ -243,8 +247,9 @@ gtk_widget_query_size_for_orientation (GtkWidget        *widget,
         }
       else if (G_UNLIKELY (min_size < 0))
         {
-          g_warning ("%s %p reported min %s %d, but sizes must be >= 0",
+          g_warning ("%s %p (%s) reported min %s %d, but sizes must be >= 0",
                      G_OBJECT_TYPE_NAME (widget), widget,
+                     gtk_css_node_get_name (gtk_widget_get_css_node (widget)),
                      orientation == GTK_ORIENTATION_HORIZONTAL ? "width" : "height",
                      min_size);
           min_size = 0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]