diff options
author | Benjamin Otte <otte.benjamin@googlemail.com> | 2021-11-09 03:15:00 +0000 |
---|---|---|
committer | Benjamin Otte <otte.benjamin@googlemail.com> | 2021-11-09 03:15:00 +0000 |
commit | 08d48201e998a06c07c5148b37bc374bbdcb9353 (patch) | |
tree | 9b4c9cac24d703c96d384c5ac6f9be33283ab828 /gtk/gtklabel.c | |
parent | 27d286eb7a6fda4da0ecb4e5de3c3307ae02d49b (diff) | |
parent | 76c46739447023368db4c3e6d008b52ff4b249e0 (diff) | |
download | gtk+-08d48201e998a06c07c5148b37bc374bbdcb9353.tar.gz |
Merge branch 'wip/otte/for-master' into 'master'
lots of sizing fixes
See merge request GNOME/gtk!4131
Diffstat (limited to 'gtk/gtklabel.c')
-rw-r--r-- | gtk/gtklabel.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 3c3be85406..a82ec7bb77 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -1077,14 +1077,15 @@ get_static_size (GtkLabel *self, int *minimum_baseline, int *natural_baseline) { + int minimum_default, natural_default; PangoLayout *layout; - layout = gtk_label_get_measuring_layout (self, NULL, -1); + get_default_widths (self, &minimum_default, &natural_default); + + layout = gtk_label_get_measuring_layout (self, NULL, self->ellipsize ? natural_default : -1); if (orientation == GTK_ORIENTATION_HORIZONTAL) { - int minimum_default, natural_default; - pango_layout_get_size (layout, natural, NULL); if (self->ellipsize) { @@ -1096,11 +1097,8 @@ get_static_size (GtkLabel *self, else *minimum = *natural; - get_default_widths (self, &minimum_default, &natural_default); if (minimum_default > *minimum) *minimum = minimum_default; - if (natural_default > -1) - *natural = natural_default; *natural = MAX (*minimum, *natural); } else @@ -1180,7 +1178,6 @@ get_width_for_height (GtkLabel *self, /* Natural width is natural width - or as wide as possible */ layout = gtk_label_get_measuring_layout (self, layout, natural_default); pango_layout_get_size (layout, natural_width, NULL); - *natural_width = MAX (*natural_width, natural_default); *natural_width = MAX (*natural_width, *minimum_width); } else |