[clutter] Adds experimental clutter_backend_get_cogl_context API



commit 2f1885565949dbd2c90e386ce557ee45ef1cba8b
Author: Robert Bragg <robert linux intel com>
Date:   Fri Aug 12 16:25:53 2011 +0100

    Adds experimental clutter_backend_get_cogl_context API
    
    This adds experimental API to be able to get the CoglContext associated
    with the ClutterBackend. The CoglContext is required to use some of the
    experimental 2.0 Cogl API.
    
    Note: Since CoglContext is itself experimental API this API should
    considered experimental too. This patch introduces a
    CLUTTER_ENABLE_EXPERIMENTAL_API #ifdef guard which anyone wanting to use
    this API must define so it's explicitly clear to developers that they
    are playing with experimental API.
    
    Note: This API is not yet supported on OSX because OSX still uses the
    stub Cogl winsys and the Clutter backend doesn't explicitly create a
    CoglContext.
    
    Note: even though this is experimental API we still promise that it
    wont be changed during a stable release cycle. This means for example
    that you can depend on this for the lifetime of the clutter-1.8 stable
    release cycle.

 clutter/clutter-backend.c |   26 ++++++++++++++++++++++++++
 clutter/clutter-backend.h |    7 +++++++
 2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-backend.c b/clutter/clutter-backend.c
index 73eddcb..80e4853 100644
--- a/clutter/clutter-backend.c
+++ b/clutter/clutter-backend.c
@@ -969,3 +969,29 @@ _clutter_backend_remove_event_translator (ClutterBackend         *backend,
   priv->event_translators =
     g_list_remove (priv->event_translators, translator);
 }
+
+/**
+ * clutter_backend_get_cogl_context:
+ * @backend: a #ClutterBackend
+ *
+ * Retrieves the #CoglContext associated with the given clutter
+ * @backend. A #CoglContext is required when using some of the
+ * experimental 2.0 Cogl API.
+ *
+ * <note>Since CoglContext is itself experimental API this API should
+ * be considered experimental too.</note>
+ *
+ * <note>This API is not yet supported on OSX because OSX still
+ * uses the stub Cogl winsys and the Clutter backend doesn't
+ * explicitly create a CoglContext.</note>
+ *
+ * Return value: The #CoglContext associated with @backend.
+ *
+ * Since: 1.8
+ * Stability: unstable
+ */
+CoglContext *
+clutter_backend_get_cogl_context (ClutterBackend *backend)
+{
+  return backend->cogl_context;
+}
diff --git a/clutter/clutter-backend.h b/clutter/clutter-backend.h
index df8f2cc..6bb11ea 100644
--- a/clutter/clutter-backend.h
+++ b/clutter/clutter-backend.h
@@ -31,6 +31,9 @@
 #include <cairo.h>
 #include <glib-object.h>
 #include <pango/pango.h>
+#ifdef COGL_ENABLE_EXPERIMENTAL_2_0_API
+#include <cogl/cogl.h>
+#endif
 
 #include <clutter/clutter-actor.h>
 #include <clutter/clutter-device-manager.h>
@@ -80,6 +83,10 @@ void                        clutter_backend_set_font_options          (ClutterBa
                                                                        const cairo_font_options_t *options);
 const cairo_font_options_t *clutter_backend_get_font_options          (ClutterBackend             *backend);
 
+#if defined (COGL_ENABLE_EXPERIMENTAL_2_0_API) && defined (CLUTTER_ENABLE_EXPERIMENTAL_API)
+CoglContext                *clutter_backend_get_cogl_context          (ClutterBackend             *backend);
+#endif
+
 G_END_DECLS
 
 #endif /* __CLUTTER_BACKEND_H__ */



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