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