forked from AuroraMiddleware/gtk
Revert "label: Never measure more than max-width-chars"
This reverts commit ba44e7a228
.
The change was meant to revert to old GTK3 behavior but it actually
broke new GTK4 behavior that is in use where max-width-chars is used to
determine an ideal size, but where we don't want to limit the width to
that size.
So what happens is the reintroduction of GTK3-style lots of whitepsace
bugs, and we really don't want those.
We also don't want to break backwards compat if we can avoid it.
So let's revert this.
The reftest that was made for this purpose has been adapted.
Fixes #4399
This commit is contained in:
parent
8c63244855
commit
53acff167b
@ -1045,20 +1045,7 @@ get_height_for_width (GtkLabel *self,
|
||||
PangoLayout *layout;
|
||||
int text_height, baseline;
|
||||
|
||||
width *= PANGO_SCALE;
|
||||
if (self->max_width_chars > -1)
|
||||
{
|
||||
int char_pixels, width_chars;
|
||||
|
||||
layout = gtk_label_get_measuring_layout (self, NULL, -1);
|
||||
char_pixels = get_char_pixels (GTK_WIDGET (self), layout);
|
||||
if (self->width_chars > self->max_width_chars)
|
||||
width_chars = self->width_chars;
|
||||
else
|
||||
width_chars = self->max_width_chars;
|
||||
width = MIN (char_pixels * width_chars, width);
|
||||
}
|
||||
layout = gtk_label_get_measuring_layout (self, NULL, width);
|
||||
layout = gtk_label_get_measuring_layout (self, NULL, width * PANGO_SCALE);
|
||||
|
||||
pango_layout_get_pixel_size (layout, NULL, &text_height);
|
||||
|
||||
|
@ -8,9 +8,7 @@
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">ABCDE
|
||||
ABCD</property>
|
||||
<property name="max_width_chars">4</property>
|
||||
<property name="label" translatable="yes">ABCDE ABCD</property>
|
||||
<attributes>
|
||||
<attribute name="font-desc" value="Monospace"></attribute>
|
||||
</attributes>
|
||||
|
Loading…
Reference in New Issue
Block a user