[clutter/wip/neil/wayland-compositor: 2/4] clutter-backend: Use the Cogl main loop mechanism



commit ea9e96b62eeb5c4e21b7af752cdde7f29523fab3
Author: Neil Roberts <neil linux intel com>
Date:   Wed Dec 21 15:13:53 2011 +0000

    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.

 clutter/clutter-backend-private.h |    1 +
 clutter/clutter-backend.c         |    6 ++++++
 2 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-backend-private.h b/clutter/clutter-backend-private.h
index 6816bac..a0225b2 100644
--- a/clutter/clutter-backend-private.h
+++ b/clutter/clutter-backend-private.h
@@ -44,6 +44,7 @@ struct _ClutterBackend
   CoglRenderer *cogl_renderer;
   CoglDisplay *cogl_display;
   CoglContext *cogl_context;
+  GSource *cogl_source;
 
   ClutterDeviceManager *device_manager;
 
diff --git a/clutter/clutter-backend.c b/clutter/clutter-backend.c
index 115d29b..fa96356 100644
--- a/clutter/clutter-backend.c
+++ b/clutter/clutter-backend.c
@@ -142,6 +142,8 @@ clutter_backend_finalize (GObject *gobject)
 {
   ClutterBackend *backend = CLUTTER_BACKEND (gobject);
 
+  g_source_destroy (backend->cogl_source);
+
   g_free (backend->priv->font_name);
   clutter_backend_set_font_options (backend, NULL);
 
@@ -324,6 +326,10 @@ clutter_backend_real_create_context (ClutterBackend  *backend,
   if (backend->cogl_context == NULL)
     goto error;
 
+  backend->cogl_source = cogl_gsource_new (backend->cogl_context,
+                                           G_PRIORITY_DEFAULT);
+  g_source_attach (backend->cogl_source, NULL);
+
   /* the display owns the renderer and the swap chain */
   cogl_object_unref (backend->cogl_renderer);
   cogl_object_unref (swap_chain);



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