wayland-surface: Allow setting a NULL buffer to effectively unmap
This commit is contained in:
parent
c749f7b6fb
commit
f0280a8868
@ -260,6 +260,28 @@ surface_ensure_window (MetaWaylandSurface *surface)
|
|||||||
surface->window = meta_window_new_for_wayland (display, width, height, surface);
|
surface->window = meta_window_new_for_wayland (display, width, height, surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ensure_buffer_texture (MetaWaylandBuffer *buffer)
|
||||||
|
{
|
||||||
|
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||||
|
CoglError *catch_error = NULL;
|
||||||
|
CoglTexture *texture;
|
||||||
|
|
||||||
|
texture = COGL_TEXTURE (cogl_wayland_texture_2d_new_from_buffer (ctx,
|
||||||
|
buffer->resource,
|
||||||
|
&catch_error));
|
||||||
|
if (!texture)
|
||||||
|
{
|
||||||
|
cogl_error_free (catch_error);
|
||||||
|
meta_warning ("Could not import pending buffer, ignoring commit\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer->texture = texture;
|
||||||
|
buffer->width = cogl_texture_get_width (texture);
|
||||||
|
buffer->height = cogl_texture_get_height (texture);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_wayland_surface_commit (struct wl_client *client,
|
meta_wayland_surface_commit (struct wl_client *client,
|
||||||
struct wl_resource *resource)
|
struct wl_resource *resource)
|
||||||
@ -278,37 +300,15 @@ meta_wayland_surface_commit (struct wl_client *client,
|
|||||||
surface->buffer_ref.buffer != surface->pending.buffer)
|
surface->buffer_ref.buffer != surface->pending.buffer)
|
||||||
{
|
{
|
||||||
MetaWaylandBuffer *buffer = surface->pending.buffer;
|
MetaWaylandBuffer *buffer = surface->pending.buffer;
|
||||||
CoglContext *ctx =
|
|
||||||
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
|
||||||
CoglError *catch_error = NULL;
|
|
||||||
CoglTexture *texture =
|
|
||||||
COGL_TEXTURE (cogl_wayland_texture_2d_new_from_buffer (ctx,
|
|
||||||
buffer->resource,
|
|
||||||
&catch_error));
|
|
||||||
if (!texture)
|
|
||||||
{
|
|
||||||
cogl_error_free (catch_error);
|
|
||||||
meta_warning ("Could not import pending buffer, ignoring commit\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
buffer->texture = texture;
|
|
||||||
buffer->width = cogl_texture_get_width (texture);
|
|
||||||
buffer->height = cogl_texture_get_height (texture);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (buffer)
|
||||||
|
{
|
||||||
/* Note: we set this before informing any window-actor since the
|
/* Note: we set this before informing any window-actor since the
|
||||||
* window actor will expect to find the new buffer within the
|
* window actor will expect to find the new buffer within the
|
||||||
* surface. */
|
* surface. */
|
||||||
meta_wayland_buffer_reference (&surface->buffer_ref,
|
ensure_buffer_texture (buffer);
|
||||||
surface->pending.buffer);
|
meta_wayland_buffer_reference (&surface->buffer_ref, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!surface->buffer_ref.buffer)
|
|
||||||
{
|
|
||||||
meta_warning ("Commit without a buffer? Ignoring\n");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
surface_ensure_window (surface);
|
surface_ensure_window (surface);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user