[cogl/cogl-1.14] cogland: Correctly handle commits without attaching a new buffer



commit a05643d3257f98c4e247652f5cf1d34a686dbec1
Author: Neil Roberts <neil linux intel com>
Date:   Thu May 2 17:56:38 2013 +0100

    cogland: Correctly handle commits without attaching a new buffer
    
    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.
    
    Reviewed-by: Robert Bragg <robert linux intel com>
    
    (cherry picked from commit aa412b9c709120bd8d88a014010c448f3b9fcfb7)

 examples/cogland.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/examples/cogland.c b/examples/cogland.c
index 7a02719..79a3197 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 &&


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]