diff --git a/cogl/cogl-onscreen.h b/cogl/cogl-onscreen.h index 98b89d224..481664e09 100644 --- a/cogl/cogl-onscreen.h +++ b/cogl/cogl-onscreen.h @@ -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); diff --git a/cogl/winsys/cogl-winsys-egl-mir.c b/cogl/winsys/cogl-winsys-egl-mir.c index e7bbfde58..6c0dbe3cb 100644 --- a/cogl/winsys/cogl-winsys-egl-mir.c +++ b/cogl/winsys/cogl-winsys-egl-mir.c @@ -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;