Rename the EGLDisplay accessors

The accessor for the EGL display should be namespaced for the correct
backend-specific API.
This commit is contained in:
Emmanuele Bassi 2010-12-09 15:11:37 +00:00
parent f5b51a2428
commit 24133ddadc
9 changed files with 95 additions and 34 deletions

View 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;
}

View File

@ -49,19 +49,20 @@
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);
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_get_egl_display (void);
G_END_DECLS

View 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);

View File

@ -40,8 +40,13 @@
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

View 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;
}
}

View 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;
}

View 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);

View File

@ -46,14 +46,15 @@
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

View 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>