st/entry: Invalidate text shadow on style changes to ClutterText

We update a few properties of ClutterText when the CSS changes via
_st_set_text_from_style() (which we call when receiving the
style-changed signal).

Right now we simply invalidate the text shadow every time we receive the
style-changed signal, but we're going to change that with the next
commits. To ensure the shadow still gets invalidated on CSS changed that
might affect the shadow, listen to a bunch of property changes that will
get notified when any property that affects the shadow 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:17:07 +01:00 committed by Marge Bot
parent 2bb36db9e8
commit 898334f31d

View File

@ -562,6 +562,16 @@ clutter_text_changed_cb (GObject *object,
g_object_notify_by_pspec (G_OBJECT (entry), props[PROP_TEXT]);
}
static void
invalidate_shadow_pipeline (GObject *object,
GParamSpec *pspec,
StEntry *entry)
{
StEntryPrivate *priv = ST_ENTRY_PRIV (entry);
g_clear_pointer (&priv->text_shadow_material, cogl_object_unref);
}
static void
st_entry_clipboard_callback (StClipboard *clipboard,
const gchar *text,
@ -1058,6 +1068,20 @@ st_entry_init (StEntry *entry)
g_signal_connect (priv->entry, "notify::text",
G_CALLBACK (clutter_text_changed_cb), entry);
/* These properties might get set from CSS using _st_set_text_from_style */
g_signal_connect (priv->entry, "notify::font-description",
G_CALLBACK (invalidate_shadow_pipeline), entry);
g_signal_connect (priv->entry, "notify::attributes",
G_CALLBACK (invalidate_shadow_pipeline), entry);
g_signal_connect (priv->entry, "notify::justify",
G_CALLBACK (invalidate_shadow_pipeline), entry);
g_signal_connect (priv->entry, "notify::line-alignment",
G_CALLBACK (invalidate_shadow_pipeline), entry);
priv->spacing = 6.0f;
priv->text_shadow_material = NULL;