clutter-backend: Use the Cogl main loop mechanism

Cogl now requires that all applications integrate their main loop with
Cogl so that it can listen for events from winsys. This patch just
adds Cogl's GSource to the main loop.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Neil Roberts 2011-12-21 15:13:53 +00:00 committed by Robert Bragg
parent bace07c0a0
commit fee53a2993
2 changed files with 7 additions and 0 deletions

View File

@ -44,6 +44,7 @@ struct _ClutterBackend
CoglRenderer *cogl_renderer; CoglRenderer *cogl_renderer;
CoglDisplay *cogl_display; CoglDisplay *cogl_display;
CoglContext *cogl_context; CoglContext *cogl_context;
GSource *cogl_source;
ClutterDeviceManager *device_manager; ClutterDeviceManager *device_manager;

View File

@ -142,6 +142,8 @@ clutter_backend_finalize (GObject *gobject)
{ {
ClutterBackend *backend = CLUTTER_BACKEND (gobject); ClutterBackend *backend = CLUTTER_BACKEND (gobject);
g_source_destroy (backend->cogl_source);
g_free (backend->priv->font_name); g_free (backend->priv->font_name);
clutter_backend_set_font_options (backend, NULL); clutter_backend_set_font_options (backend, NULL);
@ -324,6 +326,10 @@ clutter_backend_real_create_context (ClutterBackend *backend,
if (backend->cogl_context == NULL) if (backend->cogl_context == NULL)
goto error; goto error;
backend->cogl_source = cogl_glib_source_new (backend->cogl_context,
G_PRIORITY_DEFAULT);
g_source_attach (backend->cogl_source, NULL);
/* the display owns the renderer and the swap chain */ /* the display owns the renderer and the swap chain */
cogl_object_unref (backend->cogl_renderer); cogl_object_unref (backend->cogl_renderer);
cogl_object_unref (swap_chain); cogl_object_unref (swap_chain);