mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
clutter/actor: Don't store a second stage-views list for the stage
The stage already maintains its own list of stage-views via clutter_stage_peek_stage_views(), it's a bit superfluous to copy that list around all the time into priv->stage_views of ClutterActor. Let's deal with that by returning clutter_stage_peek_stage_views() when clutter_actor_peek_stage_views() gets called for the stage. In order to make sure ClutterActor::stage-views-changed still gets emitted correctly for the stage, always emit that signal on the ClutterStage when the stage views get invalidated. This now depends on the backend only actually invalidating the views and calling clutter_stage_clear_stage_views() when things have actually changed, but that should be the case. This needs a change in one of the stage-views tests, namely the one which tests stage-view-changed emission on the stage: Here we now see an emission of stage-views-changed, but that signal emission actually seems correct. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2679>
This commit is contained in:
parent
2ef4960b4f
commit
26344fb533
@ -5715,11 +5715,10 @@ static float
|
||||
clutter_actor_real_calculate_resource_scale (ClutterActor *self,
|
||||
int phase)
|
||||
{
|
||||
ClutterActorPrivate *priv = self->priv;
|
||||
GList *l;
|
||||
float new_resource_scale = -1.f;
|
||||
|
||||
for (l = priv->stage_views; l; l = l->next)
|
||||
for (l = clutter_actor_peek_stage_views (self); l; l = l->next)
|
||||
{
|
||||
ClutterStageView *view = l->data;
|
||||
|
||||
@ -15290,7 +15289,7 @@ clear_stage_views_cb (ClutterActor *actor,
|
||||
|
||||
old_stage_views = g_steal_pointer (&actor->priv->stage_views);
|
||||
|
||||
if (old_stage_views)
|
||||
if (old_stage_views || CLUTTER_ACTOR_IS_TOPLEVEL (actor))
|
||||
actor->priv->clear_stage_views_needs_stage_views_changed = TRUE;
|
||||
|
||||
return CLUTTER_ACTOR_TRAVERSE_VISIT_CONTINUE;
|
||||
@ -15495,6 +15494,9 @@ update_stage_views (ClutterActor *self)
|
||||
ClutterStage *stage;
|
||||
graphene_rect_t bounding_rect;
|
||||
|
||||
if (CLUTTER_ACTOR_IS_TOPLEVEL (self))
|
||||
return;
|
||||
|
||||
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
|
||||
g_return_if_fail (stage);
|
||||
|
||||
@ -15642,7 +15644,9 @@ clutter_actor_peek_stage_views (ClutterActor *self)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
|
||||
|
||||
return self->priv->stage_views;
|
||||
return CLUTTER_ACTOR_IS_TOPLEVEL (self)
|
||||
? clutter_stage_peek_stage_views (CLUTTER_STAGE (self))
|
||||
: self->priv->stage_views;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -15657,7 +15661,7 @@ clutter_actor_is_effectively_on_stage_view (ClutterActor *self,
|
||||
!clutter_actor_has_mapped_clones (self))
|
||||
return FALSE;
|
||||
|
||||
if (g_list_find (self->priv->stage_views, view))
|
||||
if (g_list_find (clutter_actor_peek_stage_views (self), view))
|
||||
return TRUE;
|
||||
|
||||
for (actor = self; actor; actor = actor->priv->parent)
|
||||
@ -15714,9 +15718,7 @@ clutter_actor_pick_frame_clock (ClutterActor *self,
|
||||
ClutterStageView *best_view = NULL;
|
||||
GList *l;
|
||||
|
||||
stage_views_list = CLUTTER_IS_STAGE (self)
|
||||
? clutter_stage_peek_stage_views (CLUTTER_STAGE (self))
|
||||
: priv->stage_views;
|
||||
stage_views_list = clutter_actor_peek_stage_views (self);
|
||||
|
||||
if (!stage_views_list)
|
||||
{
|
||||
|
@ -1241,6 +1241,9 @@ meta_test_timeline_actor_destroyed (void)
|
||||
G_CALLBACK (on_stage_views_changed),
|
||||
&did_stage_views_changed);
|
||||
|
||||
stage_views = clutter_stage_peek_stage_views (CLUTTER_STAGE (stage));
|
||||
g_assert_cmpint (g_list_length (stage_views), ==, 0);
|
||||
|
||||
clutter_actor_destroy (actor);
|
||||
g_object_unref (timeline);
|
||||
|
||||
@ -1249,7 +1252,7 @@ meta_test_timeline_actor_destroyed (void)
|
||||
stage_views = clutter_stage_peek_stage_views (CLUTTER_STAGE (stage));
|
||||
g_assert_cmpint (g_list_length (stage_views), ==, 1);
|
||||
|
||||
g_assert_false (did_stage_views_changed);
|
||||
g_assert_true (did_stage_views_changed);
|
||||
clutter_actor_queue_redraw (persistent_actor);
|
||||
clutter_stage_schedule_update (CLUTTER_STAGE (stage));
|
||||
wait_for_paint (stage);
|
||||
|
Loading…
Reference in New Issue
Block a user