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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1750>
This commit is contained in:
Jonas Dreßler 2021-03-01 10:14:37 +01:00 committed by Marge Bot
parent 54b974b129
commit c6935ad5b7

View File

@ -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));
}
/**