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
This commit is contained in:
Jonas Ådahl 2020-04-04 01:22:35 +02:00
parent 3944daf3c0
commit 69d0ff4567

View File

@ -1390,6 +1390,21 @@ update_actor_stage_views (ClutterStage *stage)
g_warn_if_fail (!priv->actor_needs_immediate_relayout); 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: * _clutter_stage_do_update:
* @stage: A #ClutterStage * @stage: A #ClutterStage
@ -1402,7 +1417,7 @@ gboolean
_clutter_stage_do_update (ClutterStage *stage) _clutter_stage_do_update (ClutterStage *stage)
{ {
ClutterStagePrivate *priv = stage->priv; ClutterStagePrivate *priv = stage->priv;
GSList *devices = NULL; g_autoptr (GSList) devices = NULL;
priv->needs_update = FALSE; priv->needs_update = FALSE;
@ -1452,15 +1467,7 @@ _clutter_stage_do_update (ClutterStage *stage)
} }
#endif /* CLUTTER_ENABLE_DEBUG */ #endif /* CLUTTER_ENABLE_DEBUG */
COGL_TRACE_BEGIN (ClutterStagePick, "Pick"); clutter_stage_update_devices (stage, devices);
while (devices)
{
clutter_input_device_update (devices->data, NULL, TRUE);
devices = g_slist_delete_link (devices, devices);
}
COGL_TRACE_END (ClutterStagePick);
return TRUE; return TRUE;
} }