mir: don't always allocate when getting the mir surface

Add proper documentation on header file
This commit is contained in:
Marco Trevisan (Treviño) 2014-12-09 22:01:32 +01:00
parent 7c71a06936
commit 2872695fa7
2 changed files with 16 additions and 1 deletions

View File

@ -268,6 +268,19 @@ cogl_wayland_onscreen_resize (CoglOnscreen *onscreen,
#endif /* COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT */
#if defined (COGL_HAS_EGL_PLATFORM_MIR_SUPPORT)
/**
* cogl_mir_onscreen_get_surface:
* @onscreen: A #CoglOnscreen framebuffer
*
* Allows you to get the internal #MirSurface linked to the given @onscreen.
* This function might return %NULL if the @onscreen has not been allocated
* (see cogl_framebuffer_allocate() for more details)
*
* Returns: (transfer none): a #MirSurface or %NULL.
*
* Since: 1.18
* Stability: unstable
*/
struct MirSurface *
cogl_mir_onscreen_get_surface (CoglOnscreen *onscreen);

View File

@ -744,7 +744,9 @@ cogl_mir_onscreen_get_surface (CoglOnscreen *onscreen)
CoglOnscreenMir *mir_onscreen;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_onscreen (onscreen), NULL);
cogl_framebuffer_allocate (COGL_FRAMEBUFFER (onscreen), NULL);
if (!COGL_FRAMEBUFFER (onscreen)->allocated)
return NULL;
egl_onscreen = onscreen->winsys;
mir_onscreen = egl_onscreen->platform;