mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
clutter/actor: Handle getting (un-)mapped during painting differently
We currently support only one case where an actor can get mapped or unmapped during painting, that is using _clutter_actor_enable_paint_unmapped() (although we could arguably do a better job explicitely forbidding it in other cases). This function is called when painting ClutterClone or MetaWindowActors during screensharing. It temporarily (fake) realizes and maps the actor and all its children so it can get painted. Now a problem will appear when we'll start coupling layout and the mapped state of actors more closely with the next commit: Since enable_paint_unmapped() is meant to be enabled and disabled during every clone paint, we also notify the "mapped" property twice on every clone paint. That means with the next commit we would queue a relayout for the source actor on every clone paint. To avoid this unnecessary work, check whether we're being painted while unmapped using the new unmapped_paint_branch_counter. Then avoid queuing relayouts or invalidating paint volumes in that case. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1366
This commit is contained in:
parent
650efb6445
commit
9b50215008
@ -1619,18 +1619,21 @@ clutter_actor_real_map (ClutterActor *self)
|
|||||||
|
|
||||||
CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
|
CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
|
||||||
|
|
||||||
self->priv->needs_paint_volume_update = TRUE;
|
if (self->priv->unmapped_paint_branch_counter == 0)
|
||||||
|
|
||||||
/* We skip unmapped actors when updating the stage-views list, so if
|
|
||||||
* an actors list got invalidated while it was unmapped make sure to
|
|
||||||
* set priv->needs_update_stage_views to TRUE for all actors up the
|
|
||||||
* hierarchy now.
|
|
||||||
*/
|
|
||||||
if (self->priv->needs_update_stage_views)
|
|
||||||
{
|
{
|
||||||
/* Avoid the early return in queue_update_stage_views() */
|
self->priv->needs_paint_volume_update = TRUE;
|
||||||
self->priv->needs_update_stage_views = FALSE;
|
|
||||||
queue_update_stage_views (self);
|
/* We skip unmapped actors when updating the stage-views list, so if
|
||||||
|
* an actors list got invalidated while it was unmapped make sure to
|
||||||
|
* set priv->needs_update_stage_views to TRUE for all actors up the
|
||||||
|
* hierarchy now.
|
||||||
|
*/
|
||||||
|
if (self->priv->needs_update_stage_views)
|
||||||
|
{
|
||||||
|
/* Avoid the early return in queue_update_stage_views() */
|
||||||
|
self->priv->needs_update_stage_views = FALSE;
|
||||||
|
queue_update_stage_views (self);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* notify on parent mapped before potentially mapping
|
/* notify on parent mapped before potentially mapping
|
||||||
@ -1731,11 +1734,14 @@ clutter_actor_real_unmap (ClutterActor *self)
|
|||||||
|
|
||||||
CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
|
CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_MAPPED);
|
||||||
|
|
||||||
/* clear the contents of the last paint volume, so that hiding + moving +
|
if (self->priv->unmapped_paint_branch_counter == 0)
|
||||||
* showing will not result in the wrong area being repainted
|
{
|
||||||
*/
|
/* clear the contents of the last paint volume, so that hiding + moving +
|
||||||
_clutter_paint_volume_init_static (&priv->last_paint_volume, NULL);
|
* showing will not result in the wrong area being repainted
|
||||||
priv->last_paint_volume_valid = TRUE;
|
*/
|
||||||
|
_clutter_paint_volume_init_static (&priv->last_paint_volume, NULL);
|
||||||
|
priv->last_paint_volume_valid = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* notify on parent mapped after potentially unmapping
|
/* notify on parent mapped after potentially unmapping
|
||||||
* children, so apps see a bottom-up notification.
|
* children, so apps see a bottom-up notification.
|
||||||
|
Loading…
Reference in New Issue
Block a user