[gnome-shell/wip/carlosg/fully-transparent-text] st: Honor alpha range specified by pango_attr_foreground_alpha_new()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/fully-transparent-text] st: Honor alpha range specified by pango_attr_foreground_alpha_new()
- Date: Sat, 28 Mar 2020 16:01:12 +0000 (UTC)
commit 0e415db1e672d19043b9e6c31c00866254dbdcc8
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Mar 28 16:38:14 2020 +0100
st: Honor alpha range specified by pango_attr_foreground_alpha_new()
This is documented as a value between 1 and 65536. However we were passing
a 0 value for 100% transparent colors, which is interpreted as "system
inherited" in pango_renderer_get_alpha() docs.
Ensure we respect this range by specifying the minimum allowed alpha (1)
if the color is fully transparent. If someone notices this 1/65535th change
I'll ask him how many pleiades can he count.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2504
(yes, again).
src/st/st-private.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/st/st-private.c b/src/st/st-private.c
index e75e10788b..6fa5bf67cc 100644
--- a/src/st/st-private.c
+++ b/src/st/st-private.c
@@ -134,7 +134,9 @@ _st_set_text_from_style (ClutterText *text,
if (color.alpha != 255)
{
- PangoAttribute *alpha = pango_attr_foreground_alpha_new (color.alpha * 255);
+ uint16_t value = MAX (1, (uint16_t) color.alpha * 255);
+ PangoAttribute *alpha = pango_attr_foreground_alpha_new (value);
+
pango_attr_list_insert (attribs, alpha);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]