[gnome-shell/wip/carlosg/issue-91] st: Round CSS units to the nearest multiple of the scale factor
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/carlosg/issue-91] st: Round CSS units to the nearest multiple of the scale factor
- Date: Sat, 23 Mar 2019 15:52:58 +0000 (UTC)
commit 526f748749b0112c30befb2411b461a5ce4b9399
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Mar 23 16:33:58 2019 +0100
st: Round CSS units to the nearest multiple of the scale factor
Actors themed through CSS should ideally get sizes and positions that
conform to the "pixel grid". A notorious example is the panel that has a
height of 1.86em. On unchanged font settings and hidpi that translates to
55px, which leaves the workarea with "half pixels" that hidpi wayland
applications don't know how to fully cover.
If the requested height is a multiple of the scale factor, the workarea
and maximized applications can then work on full pixels.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/91
src/st/st-theme-node.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c
index c05ca78fc..8a6ebf03f 100644
--- a/src/st/st-theme-node.c
+++ b/src/st/st-theme-node.c
@@ -1136,10 +1136,14 @@ get_length_from_term_int (StThemeNode *node,
{
double value;
GetFromTermResult result;
+ int scale_factor;
result = get_length_from_term (node, term, use_parent_font, &value);
if (result == VALUE_FOUND)
- *length = (int) (0.5 + value);
+ {
+ g_object_get (node->context, "scale-factor", &scale_factor, NULL);
+ *length = (int) ((value / scale_factor) + 0.5) * scale_factor;
+ }
return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]