Implicitly allocate on cogl_wayland_onscreen_get_(shell_)?surface
The idea with the framebuffer allocation is that it will lazily allocate so that if you don't want to handle errors then you don't have to be aware that there is an allocation step. In order for this to work any accessors that get data that is only available after allocation should implicitly allocate the framebuffer. This patch makes that change for cogl_wayland_onscreen_get_surface and cogl_wayland_onscreen_get_shell_surface. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 0c4ba78787323fedd162d7b71b86b460908b9b98)
This commit is contained in:
parent
3060d44365
commit
8911da794e
@ -634,33 +634,29 @@ cogl_wayland_renderer_get_shell (CoglRenderer *renderer)
|
|||||||
struct wl_surface *
|
struct wl_surface *
|
||||||
cogl_wayland_onscreen_get_surface (CoglOnscreen *onscreen)
|
cogl_wayland_onscreen_get_surface (CoglOnscreen *onscreen)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *fb;
|
CoglOnscreenEGL *egl_onscreen;
|
||||||
|
CoglOnscreenWayland *wayland_onscreen;
|
||||||
|
|
||||||
fb = COGL_FRAMEBUFFER (onscreen);
|
cogl_framebuffer_allocate (COGL_FRAMEBUFFER (onscreen), NULL);
|
||||||
if (fb->allocated)
|
|
||||||
{
|
egl_onscreen = onscreen->winsys;
|
||||||
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
|
wayland_onscreen = egl_onscreen->platform;
|
||||||
CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform;
|
|
||||||
return wayland_onscreen->wayland_surface;
|
return wayland_onscreen->wayland_surface;
|
||||||
}
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wl_shell_surface *
|
struct wl_shell_surface *
|
||||||
cogl_wayland_onscreen_get_shell_surface (CoglOnscreen *onscreen)
|
cogl_wayland_onscreen_get_shell_surface (CoglOnscreen *onscreen)
|
||||||
{
|
{
|
||||||
CoglFramebuffer *fb;
|
CoglOnscreenEGL *egl_onscreen;
|
||||||
|
CoglOnscreenWayland *wayland_onscreen;
|
||||||
|
|
||||||
fb = COGL_FRAMEBUFFER (onscreen);
|
cogl_framebuffer_allocate (COGL_FRAMEBUFFER (onscreen), NULL);
|
||||||
if (fb->allocated)
|
|
||||||
{
|
egl_onscreen = onscreen->winsys;
|
||||||
CoglOnscreenEGL *egl_onscreen = onscreen->winsys;
|
wayland_onscreen = egl_onscreen->platform;
|
||||||
CoglOnscreenWayland *wayland_onscreen = egl_onscreen->platform;
|
|
||||||
return wayland_onscreen->wayland_shell_surface;
|
return wayland_onscreen->wayland_shell_surface;
|
||||||
}
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user