From 69d0ff4567f8333ed1e6fc28e2713deafdeab93e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Sat, 4 Apr 2020 01:22:35 +0200 Subject: [PATCH] clutter/stage: Move device updating to helper It takes the list previously gathered. Freeing the list is left to the caller using a g_autoptr. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285 --- clutter/clutter/clutter-stage.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index d50fd37f0..8ef2b387a 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -1390,6 +1390,21 @@ update_actor_stage_views (ClutterStage *stage) g_warn_if_fail (!priv->actor_needs_immediate_relayout); } +static void +clutter_stage_update_devices (ClutterStage *stage, + GSList *devices) +{ + GSList *l; + + COGL_TRACE_BEGIN (ClutterStageUpdateDevices, "UpdateDevices"); + + for (l = devices; l; l = l->next) + { + ClutterInputDevice *device = l->data; + clutter_input_device_update (device, NULL, TRUE); + } +} + /** * _clutter_stage_do_update: * @stage: A #ClutterStage @@ -1402,7 +1417,7 @@ gboolean _clutter_stage_do_update (ClutterStage *stage) { ClutterStagePrivate *priv = stage->priv; - GSList *devices = NULL; + g_autoptr (GSList) devices = NULL; priv->needs_update = FALSE; @@ -1452,15 +1467,7 @@ _clutter_stage_do_update (ClutterStage *stage) } #endif /* CLUTTER_ENABLE_DEBUG */ - COGL_TRACE_BEGIN (ClutterStagePick, "Pick"); - - while (devices) - { - clutter_input_device_update (devices->data, NULL, TRUE); - devices = g_slist_delete_link (devices, devices); - } - - COGL_TRACE_END (ClutterStagePick); + clutter_stage_update_devices (stage, devices); return TRUE; }