[nautilus/ux-review-3.29.90: 10/12] container-max-width: Warn in case minimum with > max width



commit a0dca8a80afd2599c2eb0a4d582d5918acd29da5
Author: Carlos Soriano <csoriano redhat com>
Date:   Wed Jul 25 16:27:06 2018 +0200

    container-max-width: Warn in case minimum with > max width
    
    Since the container is intended to have a max width, it's a requirement
    that the child of the container request a lower minimum size than the
    set maximum width, otherwise underallocation happen and there are visual
    glitches.
    
    To catch errors in this code, make sure to warn in case the invariant
    fails.

 src/nautilus-container-max-width.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/nautilus-container-max-width.c b/src/nautilus-container-max-width.c
index 70a6542dc..5adf8b455 100644
--- a/src/nautilus-container-max-width.c
+++ b/src/nautilus-container-max-width.c
@@ -108,6 +108,11 @@ get_preferred_width (GtkWidget *widget,
     *minimum_size = 0;
     gtk_widget_get_preferred_width (child, minimum_size, natural_size);
 
+    if (self->max_width != -1 && *minimum_size > self->max_width)
+    {
+        g_critical ("Max width container child requested %d while set maximum width is %d",
+                    *minimum_size, self->max_width);
+    }
     *natural_size = self->max_width == -1 ? *natural_size :
                     MAX (*minimum_size, MIN (self->max_width, *natural_size));
 


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