clutter/stage: Make clutter_stage_schedule_update() public API

It's effectively used by mutter by abusing a ClutterTimeline to scedule
updates.  Timelines are not really suited in places that is done, as it
is really just about getting a single new update scheduled whenever
suitable, so expose the API so we can use it directly.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1218
This commit is contained in:
Jonas Ådahl 2020-04-16 19:11:37 +02:00
parent b8003807b0
commit 99c9a14bc8
4 changed files with 13 additions and 11 deletions

View File

@ -199,7 +199,7 @@ master_clock_schedule_stage_updates (ClutterMasterClockDefault *master_clock)
stages = clutter_stage_manager_peek_stages (stage_manager); stages = clutter_stage_manager_peek_stages (stage_manager);
for (l = stages; l != NULL; l = l->next) for (l = stages; l != NULL; l = l->next)
_clutter_stage_schedule_update (l->data); clutter_stage_schedule_update (l->data);
} }
static GSList * static GSList *
@ -252,7 +252,7 @@ master_clock_reschedule_stage_updates (ClutterMasterClockDefault *master_clock,
if (master_clock->timelines || if (master_clock->timelines ||
_clutter_stage_has_queued_events (l->data) || _clutter_stage_has_queued_events (l->data) ||
_clutter_stage_needs_update (l->data)) _clutter_stage_needs_update (l->data))
_clutter_stage_schedule_update (l->data); clutter_stage_schedule_update (l->data);
} }
} }

View File

@ -74,7 +74,6 @@ void _clutter_stage_queue_event (ClutterStage *stage,
gboolean _clutter_stage_has_queued_events (ClutterStage *stage); gboolean _clutter_stage_has_queued_events (ClutterStage *stage);
void _clutter_stage_process_queued_events (ClutterStage *stage); void _clutter_stage_process_queued_events (ClutterStage *stage);
void _clutter_stage_update_input_devices (ClutterStage *stage); void _clutter_stage_update_input_devices (ClutterStage *stage);
void _clutter_stage_schedule_update (ClutterStage *stage);
gint64 _clutter_stage_get_update_time (ClutterStage *stage); gint64 _clutter_stage_get_update_time (ClutterStage *stage);
void _clutter_stage_clear_update_time (ClutterStage *stage); void _clutter_stage_clear_update_time (ClutterStage *stage);
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage); gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);

View File

@ -1178,7 +1178,7 @@ _clutter_stage_queue_event (ClutterStage *stage,
{ {
ClutterMasterClock *master_clock = _clutter_master_clock_get_default (); ClutterMasterClock *master_clock = _clutter_master_clock_get_default ();
_clutter_master_clock_start_running (master_clock); _clutter_master_clock_start_running (master_clock);
_clutter_stage_schedule_update (stage); clutter_stage_schedule_update (stage);
} }
} }
@ -1322,7 +1322,7 @@ clutter_stage_queue_actor_relayout (ClutterStage *stage,
ClutterStagePrivate *priv = stage->priv; ClutterStagePrivate *priv = stage->priv;
if (g_hash_table_size (priv->pending_relayouts) == 0) if (g_hash_table_size (priv->pending_relayouts) == 0)
_clutter_stage_schedule_update (stage); clutter_stage_schedule_update (stage);
g_hash_table_add (priv->pending_relayouts, g_object_ref (actor)); g_hash_table_add (priv->pending_relayouts, g_object_ref (actor));
priv->pending_relayouts_version++; priv->pending_relayouts_version++;
@ -3214,7 +3214,7 @@ clutter_stage_ensure_redraw (ClutterStage *stage)
priv = stage->priv; priv = stage->priv;
if (!_clutter_stage_needs_update (stage)) if (!_clutter_stage_needs_update (stage))
_clutter_stage_schedule_update (stage); clutter_stage_schedule_update (stage);
priv->redraw_pending = TRUE; priv->redraw_pending = TRUE;
@ -3442,13 +3442,13 @@ clutter_stage_get_minimum_size (ClutterStage *stage,
} }
/** /**
* _clutter_stage_schedule_update: * clutter_stage_schedule_update:
* @window: a #ClutterStage actor * @stage: a #ClutterStage actor
* *
* Schedules a redraw of the #ClutterStage at the next optimal timestamp. * Schedules a redraw of the #ClutterStage at the next optimal timestamp.
*/ */
void void
_clutter_stage_schedule_update (ClutterStage *stage) clutter_stage_schedule_update (ClutterStage *stage)
{ {
ClutterStageWindow *stage_window; ClutterStageWindow *stage_window;
@ -3470,7 +3470,7 @@ _clutter_stage_schedule_update (ClutterStage *stage)
* @stage: a #ClutterStage actor * @stage: a #ClutterStage actor
* *
* Returns the earliest time in which the stage is ready to update. The update * Returns the earliest time in which the stage is ready to update. The update
* time is set when _clutter_stage_schedule_update() is called. This can then * time is set when clutter_stage_schedule_update() is called. This can then
* be used by e.g. the #ClutterMasterClock to know when the stage needs to be * be used by e.g. the #ClutterMasterClock to know when the stage needs to be
* redrawn. * redrawn.
* *
@ -3580,7 +3580,7 @@ _clutter_stage_queue_actor_redraw (ClutterStage *stage,
CLUTTER_NOTE (PAINT, "First redraw request"); CLUTTER_NOTE (PAINT, "First redraw request");
_clutter_stage_schedule_update (stage); clutter_stage_schedule_update (stage);
priv->redraw_pending = TRUE; priv->redraw_pending = TRUE;
master_clock = _clutter_master_clock_get_default (); master_clock = _clutter_master_clock_get_default ();

View File

@ -209,6 +209,9 @@ CLUTTER_EXPORT
void clutter_stage_skip_sync_delay (ClutterStage *stage); void clutter_stage_skip_sync_delay (ClutterStage *stage);
#endif #endif
CLUTTER_EXPORT
void clutter_stage_schedule_update (ClutterStage *stage);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_stage_get_capture_final_size (ClutterStage *stage, gboolean clutter_stage_get_capture_final_size (ClutterStage *stage,
cairo_rectangle_int_t *rect, cairo_rectangle_int_t *rect,