mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
clutter/text: Also queue relayout if the actor has no valid allocation
In clutter_text_queue_redraw_or_relayout() we check whether the size of the layout has changed and queue a relayout if it did, otherwise we only queue a redraw and save some resources. The current check for this also queues a redraw if the actor has no valid allocation. That seems right on the first glance since the actor will be allocated anyway, but we actually want to call clutter_actor_queue_relayout() again here because that also invalidates the size cache of the actor which might have been updated and marked valid in the meantime. So make sure the size cache is always properly invalidated after the size of the layout changed and also call clutter_actor_queue_relayout() in case the actor has no allocation. This fixes a bug where getting the preferred width of a non-allocated ClutterText, then changing the string of the ClutterText, and then getting the preferred width again would return the old cached width (the width before we changed the string). The only place where this bug is currently happening is in the overview, where we call get_preferred_width() on the unallocated ClutterText of the window clone title: When the window title changes while the ClutterText is unallocated the size of the title is going to be wrong and the text might end up ellipsized or too large. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1150
This commit is contained in:
parent
066bc5986d
commit
0b6a3166ed
@ -4786,11 +4786,11 @@ clutter_text_queue_redraw_or_relayout (ClutterText *self)
|
|||||||
clutter_text_get_preferred_height (actor, preferred_width, NULL, &preferred_height);
|
clutter_text_get_preferred_height (actor, preferred_width, NULL, &preferred_height);
|
||||||
|
|
||||||
if (clutter_actor_has_allocation (actor) &&
|
if (clutter_actor_has_allocation (actor) &&
|
||||||
(fabsf (preferred_width - clutter_actor_get_width (actor)) > 0.001 ||
|
fabsf (preferred_width - clutter_actor_get_width (actor)) <= 0.001 &&
|
||||||
fabsf (preferred_height - clutter_actor_get_height (actor)) > 0.001))
|
fabsf (preferred_height - clutter_actor_get_height (actor)) <= 0.001)
|
||||||
clutter_actor_queue_relayout (actor);
|
|
||||||
else
|
|
||||||
clutter_text_queue_redraw (actor);
|
clutter_text_queue_redraw (actor);
|
||||||
|
else
|
||||||
|
clutter_actor_queue_relayout (actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user