[gtk] label: Compute label baselines correctly
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] label: Compute label baselines correctly
- Date: Mon, 9 Dec 2019 15:45:15 +0000 (UTC)
commit 503d988c1b18fd1f6d4c44597c11316b0bfaf010
Author: Benjamin Otte <otte redhat com>
Date: Sun Dec 8 05:32:35 2019 +0100
label: Compute label baselines correctly
When we were switching smallest and widest, we were not switching the
baselines.
gtk/gtklabel.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index def048a7db..ad79305be6 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3630,14 +3630,24 @@ gtk_label_get_preferred_size (GtkWidget *widget,
}
else /* GTK_ORIENTATION_VERTICAL */
{
- *minimum_size = MIN (smallest_rect.height, widest_rect.height);
- *natural_size = MAX (smallest_rect.height, widest_rect.height);
-
- if (minimum_baseline)
- *minimum_baseline = smallest_baseline;
-
- if (natural_baseline)
- *natural_baseline = widest_baseline;
+ if (smallest_rect.height < widest_rect.height)
+ {
+ *minimum_size = smallest_rect.height;
+ *natural_size = widest_rect.height;
+ if (minimum_baseline)
+ *minimum_baseline = smallest_baseline;
+ if (natural_baseline)
+ *natural_baseline = widest_baseline;
+ }
+ else
+ {
+ *minimum_size = widest_rect.height;
+ *natural_size = smallest_rect.height;
+ if (minimum_baseline)
+ *minimum_baseline = widest_baseline;
+ if (natural_baseline)
+ *natural_baseline = smallest_baseline;
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]