[mutter] wayland: Handle unsetting of input and opaque surface region



commit ac79988939b3f1ed3497c3ddc69809a73d6e2b53
Author: Jonas Ådahl <jadahl gmail com>
Date:   Tue Aug 4 14:58:26 2015 +0800

    wayland: Handle unsetting of input and opaque surface region
    
    When a client sets an input region or a opaque region to NULL, it
    should still be considered a change to the corresponding region on the
    actor. This patch makes sure this state is properly forwarded.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=753222

 src/compositor/meta-surface-actor-wayland.c |    8 ++++++++
 src/wayland/meta-wayland-surface.c          |   18 ++++++++++++++----
 src/wayland/meta-wayland-surface.h          |    2 ++
 3 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/src/compositor/meta-surface-actor-wayland.c b/src/compositor/meta-surface-actor-wayland.c
index 069c511..a9ec558 100644
--- a/src/compositor/meta-surface-actor-wayland.c
+++ b/src/compositor/meta-surface-actor-wayland.c
@@ -197,6 +197,10 @@ meta_surface_actor_wayland_sync_state (MetaSurfaceActorWayland *self)
                                            scaled_input_region);
       cairo_region_destroy (scaled_input_region);
     }
+  else
+    {
+      meta_surface_actor_set_input_region (META_SURFACE_ACTOR (self), NULL);
+    }
 
   /* Opaque region */
   if (surface->opaque_region)
@@ -212,6 +216,10 @@ meta_surface_actor_wayland_sync_state (MetaSurfaceActorWayland *self)
                                             scaled_opaque_region);
       cairo_region_destroy (scaled_opaque_region);
     }
+  else
+    {
+      meta_surface_actor_set_opaque_region (META_SURFACE_ACTOR (self), NULL);
+    }
 
   meta_surface_actor_wayland_sync_subsurface_state (self);
 }
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 3eb0b0e..e4a4e5a 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -332,7 +332,9 @@ pending_state_init (MetaWaylandPendingState *state)
   state->scale = 0;
 
   state->input_region = NULL;
+  state->input_region_set = FALSE;
   state->opaque_region = NULL;
+  state->opaque_region_set = FALSE;
 
   state->damage = cairo_region_create ();
   state->buffer_destroy_listener.notify = surface_handle_pending_buffer_destroy;
@@ -510,18 +512,24 @@ apply_pending_state (MetaWaylandSurface      *surface,
   surface->offset_x += pending->dx;
   surface->offset_y += pending->dy;
 
-  if (pending->opaque_region)
+  if (pending->opaque_region_set)
     {
       if (surface->opaque_region)
         cairo_region_destroy (surface->opaque_region);
-      surface->opaque_region = cairo_region_reference (pending->opaque_region);
+      if (pending->opaque_region)
+        surface->opaque_region = cairo_region_reference (pending->opaque_region);
+      else
+        surface->opaque_region = NULL;
     }
 
-  if (pending->input_region)
+  if (pending->input_region_set)
     {
       if (surface->input_region)
         cairo_region_destroy (surface->input_region);
-      surface->input_region = cairo_region_reference (pending->input_region);
+      if (pending->input_region)
+        surface->input_region = cairo_region_reference (pending->input_region);
+      else
+        surface->input_region = NULL;
     }
 
   /* wl_surface.frame */
@@ -678,6 +686,7 @@ wl_surface_set_opaque_region (struct wl_client *client,
       cairo_region_t *cr_region = meta_wayland_region_peek_cairo_region (region);
       surface->pending.opaque_region = cairo_region_copy (cr_region);
     }
+  surface->pending.opaque_region_set = TRUE;
 }
 
 static void
@@ -698,6 +707,7 @@ wl_surface_set_input_region (struct wl_client *client,
       cairo_region_t *cr_region = meta_wayland_region_peek_cairo_region (region);
       surface->pending.input_region = cairo_region_copy (cr_region);
     }
+  surface->pending.input_region_set = TRUE;
 }
 
 static void
diff --git a/src/wayland/meta-wayland-surface.h b/src/wayland/meta-wayland-surface.h
index e599af6..d752381 100644
--- a/src/wayland/meta-wayland-surface.h
+++ b/src/wayland/meta-wayland-surface.h
@@ -62,7 +62,9 @@ typedef struct
   cairo_region_t *damage;
 
   cairo_region_t *input_region;
+  gboolean input_region_set;
   cairo_region_t *opaque_region;
+  gboolean opaque_region_set;
 
   /* wl_surface.frame */
   struct wl_list frame_callback_list;



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