Blame SOURCES/0001-clutter-text-Don-t-query-preferred-size-without-allo.patch

1679d1
From 5cd66485cdd99068dab0f57d7f64d3ef294b0037 Mon Sep 17 00:00:00 2001
1679d1
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
1679d1
Date: Wed, 4 Aug 2021 19:30:10 +0200
1679d1
Subject: [PATCH] clutter/text: Don't query preferred size without allocation
1679d1
1679d1
The size request functions query the resource scale, which hits
1679d1
an assert if headless. The returned sizes are already only used
1679d1
when clutter_actor_has_allocation() is true, so this doesn't
1679d1
change the condition for calling either redraw or relayout.
1679d1
1679d1
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4522
1679d1
1679d1
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1956>
1679d1
---
1679d1
 clutter/clutter/clutter-text.c | 17 +++++++++++------
1679d1
 1 file changed, 11 insertions(+), 6 deletions(-)
1679d1
1679d1
diff --git a/clutter/clutter/clutter-text.c b/clutter/clutter/clutter-text.c
1679d1
index 45c7eac56b..80e53ea32f 100644
1679d1
--- a/clutter/clutter/clutter-text.c
1679d1
+++ b/clutter/clutter/clutter-text.c
1679d1
@@ -4797,16 +4797,21 @@ static void
1679d1
 clutter_text_queue_redraw_or_relayout (ClutterText *self)
1679d1
 {
1679d1
   ClutterActor *actor = CLUTTER_ACTOR (self);
1679d1
-  gfloat preferred_width;
1679d1
-  gfloat preferred_height;
1679d1
+  float preferred_width = -1.;
1679d1
+  float preferred_height = -1.;
1679d1
 
1679d1
   clutter_text_dirty_cache (self);
1679d1
 
1679d1
-  /* we're using our private implementations here to avoid the caching done by ClutterActor */
1679d1
-  clutter_text_get_preferred_width (actor, -1, NULL, &preferred_width);
1679d1
-  clutter_text_get_preferred_height (actor, preferred_width, NULL, &preferred_height);
1679d1
+  if (clutter_actor_has_allocation (actor))
1679d1
+    {
1679d1
+      /* we're using our private implementations here to avoid the caching done by ClutterActor */
1679d1
+      clutter_text_get_preferred_width (actor, -1, NULL, &preferred_width);
1679d1
+      clutter_text_get_preferred_height (actor, preferred_width, NULL,
1679d1
+                                         &preferred_height);
1679d1
+    }
1679d1
 
1679d1
-  if (clutter_actor_has_allocation (actor) &&
1679d1
+  if (preferred_width > 0 &&
1679d1
+      preferred_height > 0 &&
1679d1
       fabsf (preferred_width - clutter_actor_get_width (actor)) <= 0.001 &&
1679d1
       fabsf (preferred_height - clutter_actor_get_height (actor)) <= 0.001)
1679d1
     clutter_text_queue_redraw (actor);
1679d1
-- 
1679d1
2.31.1
1679d1