From c6935ad5b7dc585696f155f1785dccfbd06d3040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Mon, 1 Mar 2021 10:14:37 +0100 Subject: [PATCH] clutter/text: Avoid relayout on PangoAttributes changes when possible ClutterText allows setting a custom PangoAttrList, and St uses that to set the text style it's reading from CSS. One style St enforces using this mechanism is the text color and setting the text color should obviously not affect the size of the layout. ClutterText does queue a relayout in that case though because it unconditionally queues a relayout when updating the PangoAttrList. We can avoid this relayout by reusing an optimization ClutterText has: clutter_text_queue_redraw_or_relayout() will only queue a relayout if the requested size of the layout changed. Part-of: --- clutter/clutter/clutter-text.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c index 159fa330e..5ecc1807a 100644 --- a/clutter/clutter/clutter-text.c +++ b/clutter/clutter/clutter-text.c @@ -6020,11 +6020,9 @@ clutter_text_set_attributes (ClutterText *self, priv->effective_attrs = NULL; } - clutter_text_dirty_cache (self); + clutter_text_queue_redraw_or_relayout (self); g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_ATTRIBUTES]); - - clutter_actor_queue_relayout (CLUTTER_ACTOR (self)); } /**