[gtk+] label: Fix an invariant leading to required > minimum



commit bf413928611e004ae3b5a9f73ff9c777cb7e8e70
Author: Benjamin Otte <otte redhat com>
Date:   Fri Apr 22 02:51:52 2011 +0200

    label: Fix an invariant leading to required > minimum

 gtk/gtklabel.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 3f83745..45531d8 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3568,6 +3568,11 @@ gtk_label_get_preferred_layout_size (GtkLabel *label,
       layout = gtk_label_get_measuring_layout (label, layout, 0, -1);
 
       pango_layout_get_extents (layout, NULL, required);
+
+      /* can happen when Pango decides to ellipsize text */
+      if (required->width > natural->width)
+        required->width = natural->width;
+
       required->x = required->y = 0;
       required->height = natural->height;
     }



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