mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
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>
This commit is contained in:
parent
287c715df6
commit
9252b7c6b4
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user