From 8b3e1e01f6c0228cc1fd2c7cd3d144cad8e1dcf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Fri, 5 Mar 2021 12:46:00 +0100 Subject: [PATCH] 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: --- 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 b4dd8cd56..1cf0859df 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,