[gnome-shell] st/label: Invalidate text shadow on style changes to ClutterText



commit 8b3e1e01f6c0228cc1fd2c7cd3d144cad8e1dcf8
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Fri Mar 5 12:46:00 2021 +0100

    st/label: Invalidate text shadow on style changes to ClutterText
    
    Just like with the last commit, listen to some ClutterText property
    changes to catch style changes that were trigerred by
    _st_set_text_from_style() and invalidate the shadow spec on changes.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1744>

 src/st/st-label.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
---
diff --git a/src/st/st-label.c b/src/st/st-label.c
index b4dd8cd56c..1cf0859dfb 100644
--- a/src/st/st-label.c
+++ b/src/st/st-label.c
@@ -301,6 +301,16 @@ st_label_class_init (StLabelClass *klass)
   g_object_class_install_properties (gobject_class, N_PROPS, props);
 }
 
+static void
+invalidate_shadow_pipeline (GObject    *object,
+                            GParamSpec *pspec,
+                            StLabel    *label)
+{
+  StLabelPrivate *priv = st_label_get_instance_private (label);
+
+  g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref);
+}
+
 static void
 st_label_init (StLabel *label)
 {
@@ -316,6 +326,19 @@ st_label_init (StLabel *label)
   label->priv->shadow_width = -1.;
   label->priv->shadow_height = -1.;
 
+  /* These properties might get set from CSS using _st_set_text_from_style */
+  g_signal_connect (priv->label, "notify::font-description",
+                    G_CALLBACK (invalidate_shadow_pipeline), label);
+
+  g_signal_connect (priv->label, "notify::attributes",
+                    G_CALLBACK (invalidate_shadow_pipeline), label);
+
+  g_signal_connect (priv->label, "notify::justify",
+                    G_CALLBACK (invalidate_shadow_pipeline), label);
+
+  g_signal_connect (priv->label, "notify::line-alignment",
+                    G_CALLBACK (invalidate_shadow_pipeline), label);
+
   clutter_actor_add_child (actor, priv->label);
 
   clutter_actor_set_offscreen_redirect (actor,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]