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>
This commit is contained in:
Jonas Dreßler 2021-03-05 12:46:00 +01:00 committed by Marge Bot
parent 898334f31d
commit 8b3e1e01f6

View File

@ -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,