[Cogl] [PATCH] cogland: Correctly handle commits without attaching a new buffer
Robert Bragg
robert at sixbynine.org
Mon May 13 09:19:47 PDT 2013
This looks good to land to me:
Reviewed-by: Robert Bragg <robert at linux.intel.com>
thanks,
- Robert
On Thu, May 2, 2013 at 6:05 PM, Neil Roberts <neil at linux.intel.com> wrote:
> Previously if a client sent a commit message without attaching a new
> buffer then it would end up detaching the existing buffer because
> surface->pending.buffer would be NULL. This patch makes it explicitly
> track when an attach is sent for a commit and so that it can avoid
> making any changes otherwise. This fixes cases where GTK apps would
> send a damage event without a new buffer.
> ---
> examples/cogland.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/examples/cogland.c b/examples/cogland.c
> index dc798d7..6bd07f6 100644
> --- a/examples/cogland.c
> +++ b/examples/cogland.c
> @@ -38,6 +38,7 @@ typedef struct
> struct
> {
> /* wl_surface.attach */
> + CoglBool newly_attached;
> struct wl_buffer *buffer;
> struct wl_listener buffer_destroy_listener;
> int32_t sx;
> @@ -455,6 +456,7 @@ cogland_surface_attach (struct wl_client *wayland_client,
> surface->pending.sx = sx;
> surface->pending.sy = sy;
> surface->pending.buffer = buffer;
> + surface->pending.newly_attached = TRUE;
>
> if (buffer)
> wl_signal_add (&buffer->resource.destroy_signal,
> @@ -524,7 +526,8 @@ cogland_surface_commit (struct wl_client *client,
> CoglandCompositor *compositor = surface->compositor;
>
> /* wl_surface.attach */
> - if (surface->buffer != surface->pending.buffer)
> + if (surface->pending.newly_attached &&
> + surface->buffer != surface->pending.buffer)
> {
> CoglError *error = NULL;
>
> @@ -557,6 +560,7 @@ cogland_surface_commit (struct wl_client *client,
> }
> surface->pending.sx = 0;
> surface->pending.sy = 0;
> + surface->pending.newly_attached = FALSE;
>
> /* wl_surface.damage */
> if (surface->buffer &&
> --
> 1.7.11.3.g3c3efa5
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
More information about the Cogl
mailing list