[gnome-shell/eos3.8: 192/255] st/theme-node: Consider scale factor when comparing
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/eos3.8: 192/255] st/theme-node: Consider scale factor when comparing
- Date: Wed, 10 Jun 2020 19:14:08 +0000 (UTC)
commit 8bae030d3d37376625a74022439c46396e3c725a
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Apr 3 17:44:54 2020 -0300
st/theme-node: Consider scale factor when comparing
The CSS engine of St is scale-aware, which means every length
and size it produces is multiplied by the current scale factor.
However, the individual nodes aren't aware of the scale factor
when they compare to each other.
Store and compare the scale factors in the nodes themselves.
Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1635
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1176
src/st/st-theme-node-private.h | 2 ++
src/st/st-theme-node.c | 7 +++++++
2 files changed, 9 insertions(+)
---
diff --git a/src/st/st-theme-node-private.h b/src/st/st-theme-node-private.h
index 1fe154d604..f9de16e0a5 100644
--- a/src/st/st-theme-node-private.h
+++ b/src/st/st-theme-node-private.h
@@ -123,6 +123,8 @@ struct _StThemeNode {
CoglPipeline *color_pipeline;
StThemeNodePaintState cached_state;
+
+ int scale_factor;
};
void _st_theme_node_ensure_background (StThemeNode *node);
diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c
index 7ea9c74a32..3ea48df67f 100644
--- a/src/st/st-theme-node.c
+++ b/src/st/st-theme-node.c
@@ -221,6 +221,8 @@ st_theme_node_new (StThemeContext *context,
if (theme == NULL && parent_node != NULL)
theme = parent_node->theme;
+ g_object_get (context, "scale-factor", &node->scale_factor, NULL);
+
g_set_object (&node->theme, theme);
node->element_type = element_type;
node->element_id = g_strdup (element_id);
@@ -347,6 +349,7 @@ st_theme_node_equal (StThemeNode *node_a, StThemeNode *node_b)
node_a->context != node_b->context ||
node_a->theme != node_b->theme ||
node_a->element_type != node_b->element_type ||
+ node_a->scale_factor != node_b->scale_factor ||
g_strcmp0 (node_a->element_id, node_b->element_id) ||
g_strcmp0 (node_a->inline_style, node_b->inline_style))
return FALSE;
@@ -398,6 +401,7 @@ st_theme_node_hash (StThemeNode *node)
hash = hash * 33 + GPOINTER_TO_UINT (node->context);
hash = hash * 33 + GPOINTER_TO_UINT (node->theme);
hash = hash * 33 + ((guint) node->element_type);
+ hash = hash * 33 + ((guint) node->scale_factor);
if (node->element_id != NULL)
hash = hash * 33 + g_str_hash (node->element_id);
@@ -4008,6 +4012,9 @@ st_theme_node_geometry_equal (StThemeNode *node,
g_return_val_if_fail (ST_IS_THEME_NODE (other), FALSE);
+ if (node->scale_factor != other->scale_factor)
+ return FALSE;
+
_st_theme_node_ensure_geometry (node);
_st_theme_node_ensure_geometry (other);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]