[mutter] clutter/stage: Move device updating to helper



commit 69d0ff4567f8333ed1e6fc28e2713deafdeab93e
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Sat Apr 4 01:22:35 2020 +0200

    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 d50fd37f07..8ef2b387a4 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;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]