[mutter] clutter/text: Avoid relayout on PangoAttributes changes when possible



commit c6935ad5b7dc585696f155f1785dccfbd06d3040
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Mon Mar 1 10:14:37 2021 +0100

    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>

 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 159fa330e9..5ecc1807a7 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));
 }
 
 /**


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]