Rename the EGLDisplay accessors
authorEmmanuele Bassi <ebassi@linux.intel.com>
Thu, 9 Dec 2010 15:11:37 +0000 (15:11 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Thu, 9 Dec 2010 15:34:22 +0000 (15:34 +0000)
The accessor for the EGL display should be namespaced for the correct
backend-specific API.

clutter/egl/clutter-backend-egl.c
clutter/egl/clutter-egl.h
clutter/fruity/clutter-backend-fruity.c
clutter/fruity/clutter-fruity.h
clutter/fruity/clutter-stage-fruity.c
clutter/wayland/clutter-backend-wayland.c
clutter/wayland/clutter-stage-wayland.c
clutter/wayland/clutter-wayland.h
doc/reference/clutter/clutter-sections.txt

index 36e26c5..e747046 100644 (file)
@@ -222,7 +222,7 @@ clutter_backend_egl_create_context (ClutterBackend  *backend,
   if (backend_egl->egl_context != EGL_NO_CONTEXT)
     return TRUE;
 
-  edpy = clutter_egl_display ();
+  edpy = clutter_egl_get_egl_display ();
 
 /* XXX: we should get rid of this goto yukkyness, there is a fail:
  * goto at the end and this retry: goto at the top, but we should just
@@ -903,17 +903,26 @@ _clutter_backend_impl_get_type (void)
 }
 #endif
 
-#ifdef COGL_HAS_XLIB_SUPPORT
 EGLDisplay
 clutter_eglx_display (void)
 {
-  return backend_singleton->edpy;
+  return clutter_egl_get_egl_display ();
 }
-#endif /* COGL_HAS_XLIB_SUPPORT */
 
 EGLDisplay
 clutter_egl_display (void)
 {
-  return backend_singleton->edpy;
+  return clutter_egl_get_egl_display ();
 }
 
+EGLDisplay
+clutter_egl_get_egl_display (void)
+{
+  if (backend_singleton == NULL)
+    {
+      g_critical (G_STRFUNC " has been called before clutter_init()");
+      return 0;
+    }
+
+  return backend_singleton->edpy;
+}
index 223e640..53ee7b5 100644 (file)
 
 G_BEGIN_DECLS
 
-#ifdef COGL_HAS_XLIB_SUPPORT
+#ifndef CLUTTER_DISABLE_DEPRECATED
 /**
  * clutter_eglx_display:
  *
- * Retrieves the <structname>EGLDisplay</structname> used by Clutter
+ * Retrieves the <structname>EGLDisplay</structname> used by Clutter,
+ * if Clutter has been compiled with EGL and X11 support.
  *
  * Return value: the EGL display
  *
  * Since: 0.4
+ *
+ * Deprecated: 1.6: Use clutter_egl_get_egl_display() instead
  */
-EGLDisplay
-clutter_eglx_display (void);
-#endif
+EGLDisplay      clutter_eglx_display            (void);
 
 /**
  * clutter_egl_display:
@@ -69,9 +70,22 @@ clutter_eglx_display (void);
  * Retrieves the <structname>EGLDisplay</structname> used by Clutter
  *
  * Return value: the EGL display
+ *
+ * Deprecated: 1.6: Use clutter_egl_get_egl_display() instead
+ */
+EGLDisplay      clutter_egl_display             (void);
+#endif /* CLUTTER_DISABLE_DEPRECATED */
+
+/**
+ * clutter_egl_get_egl_display:
+ *
+ * Retrieves the  <structname>EGLDisplay</structname> used by Clutter.
+ *
+ * Return value: the EGL display
+ *
+ * Since: 1.6
  */
-EGLDisplay
-clutter_egl_display (void);
+EGLDisplay      clutter_egl_get_egl_display     (void);
 
 G_END_DECLS
 
index a6e9142..880ebf2 100644 (file)
@@ -253,12 +253,44 @@ _clutter_backend_impl_get_type (void)
   return clutter_backend_egl_get_type ();
 }
 
+/**
+ * clutter_egl_display:
+ *
+ * Retrieves the <structname>EGLDisplay</structname> used by Clutter.
+ *
+ * Return value: the EGL display
+ *
+ * Deprecated: 1.6: Use clutter_fruity_get_egl_display() instead
+ *
+ * Since: 0.6
+ */
 EGLDisplay
 clutter_egl_display (void)
 {
   return backend_singleton->edpy;
 }
 
+/**
+ * clutter_fruity_egl_display:
+ *
+ * Retrieves the <structname>EGLDisplay</structname> used by Clutter.
+ *
+ * Return value: the EGL display
+ *
+ * Since: 1.6
+ */
+EGLDisplay
+clutter_fruity_get_egl_display (void)
+{
+  if (backend_singleton == NULL)
+    {
+      g_critical (G_STRFUNC " has been called before clutter_init()");
+      return 0;
+    }
+
+  return backend_singleton->edpy;
+}
+
 void *rpl_malloc (size_t allocation)
 {
   return g_malloc (allocation);
index ba24e97..f704188 100644 (file)
 
 G_BEGIN_DECLS
 
-EGLDisplay clutter_egl_display (void);
-void       clutter_uikit_main  (void);
+#ifndef CLUTTER_DISABLE_DEPRECATED
+EGLDisplay      clutter_egl_display             (void);
+#endif
+
+EGLDisplay      clutter_fruity_get_egl_display  (void);
+
+void            clutter_uikit_main              (void);
 
 G_END_DECLS
 
index 650272a..8fb881f 100644 (file)
@@ -50,7 +50,8 @@ clutter_stage_egl_unrealize (ClutterActor *actor)
 
   if (stage_egl->egl_surface)
     {
-      eglDestroySurface (clutter_egl_display (), stage_egl->egl_surface);
+      eglDestroySurface (clutter_fruity_get_egl_display (),
+                         stage_egl->egl_surface);
       stage_egl->egl_surface = EGL_NO_SURFACE;
     }
 }
index 29d83d0..ee8dac3 100644 (file)
@@ -284,11 +284,8 @@ try_create_context (ClutterBackend  *backend,
                     GError **error)
 {
   ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
-  EGLDisplay edpy;
   const char *error_message;
 
-  edpy = clutter_egl_display ();
-
   eglBindAPI (EGL_OPENGL_API);
 
   if (backend_wayland->egl_context == EGL_NO_CONTEXT)
@@ -300,10 +297,11 @@ try_create_context (ClutterBackend  *backend,
       static const EGLint *attribs = NULL;
 #endif
 
-      backend_wayland->egl_context = eglCreateContext (edpy,
-                                                   NULL,
-                                                   EGL_NO_CONTEXT,
-                                                   attribs);
+      backend_wayland->egl_context =
+        eglCreateContext (backend_wayland->edpy,
+                          NULL,
+                          EGL_NO_CONTEXT,
+                          attribs);
       if (backend_wayland->egl_context == EGL_NO_CONTEXT)
         {
           error_message = "Unable to create a suitable EGL context";
@@ -313,7 +311,10 @@ try_create_context (ClutterBackend  *backend,
       CLUTTER_NOTE (GL, "Created EGL Context");
     }
 
-  if (!eglMakeCurrent (edpy, NULL, NULL, backend_wayland->egl_context))
+  if (!eglMakeCurrent (backend_wayland->edpy,
+                       NULL,
+                       NULL,
+                       backend_wayland->egl_context))
     {
       g_set_error (error, CLUTTER_INIT_ERROR,
                    CLUTTER_INIT_ERROR_BACKEND,
@@ -338,7 +339,6 @@ clutter_backend_wayland_create_context (ClutterBackend  *backend,
                                        GError         **error)
 {
   ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
-  EGLDisplay edpy;
   const gchar *egl_extensions = NULL;
   gboolean status;
   int retry_cookie;
@@ -348,9 +348,7 @@ clutter_backend_wayland_create_context (ClutterBackend  *backend,
   if (backend_wayland->egl_context != EGL_NO_CONTEXT)
     return TRUE;
 
-  edpy = clutter_egl_display ();
-
-  egl_extensions = eglQueryString (edpy, EGL_EXTENSIONS);
+  egl_extensions = eglQueryString (backend_wayland->edpy, EGL_EXTENSIONS);
 
   if (!_cogl_check_extension ("EGL_KHR_surfaceless_opengl", egl_extensions))
     {
@@ -555,7 +553,7 @@ _clutter_backend_impl_get_type (void)
 }
 
 EGLDisplay
-clutter_egl_display (void)
+clutter_wayland_get_egl_display (void)
 {
   return backend_singleton->edpy;
 }
index 26eb03a..19c4b53 100644 (file)
@@ -65,7 +65,7 @@ wayland_create_buffer (ClutterStageWayland *stage_wayland,
 {
   ClutterBackend *backend = clutter_get_default_backend ();
   ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
-  EGLDisplay edpy = clutter_egl_display ();
+  EGLDisplay edpy = clutter_wayland_get_egl_display ();
   ClutterStageWaylandWaylandBuffer *buffer;
   EGLint image_attribs[] = {
       EGL_WIDTH, 0,
@@ -122,7 +122,7 @@ wayland_free_buffer (ClutterStageWaylandWaylandBuffer *buffer)
 {
   ClutterBackend *backend = clutter_get_default_backend ();
   ClutterBackendWayland *backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
-  EGLDisplay edpy = clutter_egl_display ();
+  EGLDisplay edpy = clutter_wayland_get_egl_display ();
 
   cogl_handle_unref (buffer->tex);
   wl_buffer_destroy (buffer->wayland_buffer);
index ac2d713..26b1680 100644 (file)
 G_BEGIN_DECLS
 
 /**
- * clutter_egl_display:
+ * clutter_wayland_get_egl_display:
  *
  * Retrieves the <structname>EGLDisplay</structname> used by Clutter
  *
  * Return value: the EGL display
+ *
+ * Since: 1.6
  */
-EGLDisplay
-clutter_egl_display (void);
+EGLDisplay      clutter_wayland_get_egl_display         (void);
 
 G_END_DECLS
 
index c4c232c..1fb80b0 100644 (file)
@@ -1268,7 +1268,7 @@ clutter_win32_handle_event
 <SECTION>
 <FILE>clutter-wayland</FILE>
 <TITLE>Wayland Specific Support</TITLE>
-clutter_egl_display
+clutter_wayland_get_egl_display
 </SECTION>
 
 <SECTION>
@@ -1872,6 +1872,7 @@ ClutterGLXTexturePixmapPrivate
 <FILE>clutter-egl</FILE>
 clutter_egl_display
 clutter_eglx_display
+clutter_egl_get_egl_display
 </SECTION>
 
 <SECTION>