clutter/stage: Expose stage update helpers

This is so something outside of clutter-stage.c (i.e.
clutter-stage-view.c) can eventually do various things
_clutter_stage_do_update() does now while not redrawing the whole stage.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
This commit is contained in:
Jonas Ådahl 2020-04-17 08:43:10 +02:00
parent fc0b8f9d9c
commit ff5f77f273
3 changed files with 27 additions and 22 deletions

View File

@ -3027,7 +3027,7 @@ clutter_actor_get_abs_allocation_vertices (ClutterActor *self,
if (!stage)
return;
_clutter_stage_maybe_relayout (stage);
clutter_stage_maybe_relayout (stage);
}
/* NB: _clutter_actor_transform_and_project_box expects a box in the actor's
@ -9277,7 +9277,7 @@ clutter_actor_get_allocation_box (ClutterActor *self,
/* do not queue a relayout on an unparented actor */
if (stage)
_clutter_stage_maybe_relayout (stage);
clutter_stage_maybe_relayout (stage);
}
/* commenting out the code above and just keeping this assigment

View File

@ -58,7 +58,12 @@ void _clutter_stage_get_viewport (ClutterStage
void _clutter_stage_dirty_viewport (ClutterStage *stage);
void _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
ClutterStageView *view);
void _clutter_stage_maybe_relayout (ClutterActor *stage);
void clutter_stage_maybe_relayout (ClutterActor *stage);
void clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage);
GSList * clutter_stage_find_updated_devices (ClutterStage *stage);
void clutter_stage_update_devices (ClutterStage *stage,
GSList *devices);
void clutter_stage_update_actor_stage_views (ClutterStage *stage);
gboolean _clutter_stage_needs_update (ClutterStage *stage);
gboolean _clutter_stage_do_update (ClutterStage *stage);

View File

@ -140,13 +140,13 @@ struct _ClutterStagePrivate
int update_freeze_count;
gboolean needs_update;
gboolean needs_update_devices;
gboolean pending_finish_queue_redraws;
guint redraw_pending : 1;
guint throttle_motion_events : 1;
guint min_size_changed : 1;
guint motion_events_enabled : 1;
guint stage_was_relayout : 1;
guint actor_needs_immediate_relayout : 1;
};
@ -178,7 +178,6 @@ static guint stage_signals[LAST_SIGNAL] = { 0, };
static const ClutterColor default_stage_color = { 255, 255, 255, 255 };
static void clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage);
static void free_queue_redraw_entry (ClutterStageQueueRedrawEntry *entry);
static void capture_view_into (ClutterStage *stage,
gboolean paint,
@ -939,7 +938,7 @@ clutter_stage_show (ClutterActor *self)
/* Possibly do an allocation run so that the stage will have the
right size before we map it */
_clutter_stage_maybe_relayout (self);
clutter_stage_maybe_relayout (self);
g_assert (priv->impl != NULL);
_clutter_stage_window_show (priv->impl, TRUE);
@ -1206,7 +1205,7 @@ clutter_stage_queue_actor_relayout (ClutterStage *stage,
}
void
_clutter_stage_maybe_relayout (ClutterActor *actor)
clutter_stage_maybe_relayout (ClutterActor *actor)
{
ClutterStage *stage = CLUTTER_STAGE (actor);
ClutterStagePrivate *priv = stage->priv;
@ -1253,7 +1252,7 @@ _clutter_stage_maybe_relayout (ClutterActor *actor)
CLUTTER_NOTE (ACTOR, "<<< Completed recomputing layout of %d subtrees", count);
if (count)
priv->stage_was_relayout = TRUE;
priv->needs_update_devices = TRUE;
}
static void
@ -1302,15 +1301,21 @@ clutter_stage_do_redraw (ClutterStage *stage)
stage);
}
static GSList *
GSList *
clutter_stage_find_updated_devices (ClutterStage *stage)
{
ClutterStagePrivate *priv = stage->priv;
ClutterBackend *backend;
ClutterSeat *seat;
GSList *updating = NULL;
const GList *l, *devices;
graphene_point_t point;
if (!priv->needs_update_devices)
return NULL;
priv->needs_update_devices = FALSE;
backend = clutter_get_default_backend ();
seat = clutter_backend_get_default_seat (backend);
devices = clutter_seat_peek_devices (seat);
@ -1356,8 +1361,8 @@ clutter_stage_find_updated_devices (ClutterStage *stage)
return updating;
}
static void
update_actor_stage_views (ClutterStage *stage)
void
clutter_stage_update_actor_stage_views (ClutterStage *stage)
{
ClutterActor *actor = CLUTTER_ACTOR (stage);
ClutterStagePrivate *priv = stage->priv;
@ -1384,13 +1389,13 @@ update_actor_stage_views (ClutterStage *stage)
break;
priv->actor_needs_immediate_relayout = FALSE;
_clutter_stage_maybe_relayout (actor);
clutter_stage_maybe_relayout (actor);
}
g_warn_if_fail (!priv->actor_needs_immediate_relayout);
}
static void
void
clutter_stage_update_devices (ClutterStage *stage,
GSList *devices)
{
@ -1437,20 +1442,15 @@ _clutter_stage_do_update (ClutterStage *stage)
* check or clear the pending redraws flag since a relayout may
* queue a redraw.
*/
_clutter_stage_maybe_relayout (CLUTTER_ACTOR (stage));
clutter_stage_maybe_relayout (CLUTTER_ACTOR (stage));
if (!priv->redraw_pending)
return FALSE;
update_actor_stage_views (stage);
clutter_stage_update_actor_stage_views (stage);
clutter_stage_maybe_finish_queue_redraws (stage);
if (priv->stage_was_relayout)
{
priv->stage_was_relayout = FALSE;
devices = clutter_stage_find_updated_devices (stage);
}
clutter_stage_do_redraw (stage);
@ -3361,7 +3361,7 @@ _clutter_stage_queue_redraw_entry_invalidate (ClutterStageQueueRedrawEntry *entr
}
}
static void
void
clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage)
{
ClutterStagePrivate *priv = stage->priv;