[Cogl] [PATCH 7/9] basic-video-player: Add the Cogl GSource to the GMainContext

Neil Roberts neil at linux.intel.com
Fri Mar 1 05:31:58 PST 2013


Cogl needs to have an opportunity to hook into the main loop otherwise
it won't handle X events properly and it won't dispatch the frame
callbacks.
---
 examples/cogl-basic-video-player.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/examples/cogl-basic-video-player.c b/examples/cogl-basic-video-player.c
index 85897e1..156c4eb 100644
--- a/examples/cogl-basic-video-player.c
+++ b/examples/cogl-basic-video-player.c
@@ -145,6 +145,7 @@ main (int argc,
   float fovy, aspect, z_near, z_2d, z_far;
   GstElement *pipeline;
   GstElement *bin;
+  GSource *cogl_source;
   GstBus *bus;
   char *uri;
 
@@ -203,6 +204,9 @@ main (int argc,
 
   data.main_loop = g_main_loop_new (NULL, FALSE);
 
+  cogl_source = cogl_glib_source_new (ctx, G_PRIORITY_DEFAULT);
+  g_source_attach (cogl_source, NULL);
+
   /*
     The cogl-pipeline-ready signal tells you when the cogl pipeline is
     initialized i.e. when cogl-gst has figured out the video format and
@@ -216,6 +220,9 @@ main (int argc,
 
   g_main_loop_run (data.main_loop);
 
+  g_source_destroy (cogl_source);
+  g_source_unref (cogl_source);
+
   g_main_loop_unref (data.main_loop);
 
   return 0;
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list