[mutter] clutter/text: Don't query preferred size without allocation
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/text: Don't query preferred size without allocation
- Date: Thu, 5 Aug 2021 11:36:25 +0000 (UTC)
commit 9252b7c6b4f2a6d00d0c4e0976819d337c15dd5a
Author: Florian Müllner <fmuellner gnome org>
Date: Wed Aug 4 19:30:10 2021 +0200
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]