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
This commit is contained in:
Jonas Ådahl 2015-08-04 14:58:26 +08:00
parent a43a2af18b
commit ac79988939
3 changed files with 24 additions and 4 deletions

View File

@ -197,6 +197,10 @@ meta_surface_actor_wayland_sync_state (MetaSurfaceActorWayland *self)
scaled_input_region); scaled_input_region);
cairo_region_destroy (scaled_input_region); cairo_region_destroy (scaled_input_region);
} }
else
{
meta_surface_actor_set_input_region (META_SURFACE_ACTOR (self), NULL);
}
/* Opaque region */ /* Opaque region */
if (surface->opaque_region) if (surface->opaque_region)
@ -212,6 +216,10 @@ meta_surface_actor_wayland_sync_state (MetaSurfaceActorWayland *self)
scaled_opaque_region); scaled_opaque_region);
cairo_region_destroy (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); meta_surface_actor_wayland_sync_subsurface_state (self);
} }

View File

@ -332,7 +332,9 @@ pending_state_init (MetaWaylandPendingState *state)
state->scale = 0; state->scale = 0;
state->input_region = NULL; state->input_region = NULL;
state->input_region_set = FALSE;
state->opaque_region = NULL; state->opaque_region = NULL;
state->opaque_region_set = FALSE;
state->damage = cairo_region_create (); state->damage = cairo_region_create ();
state->buffer_destroy_listener.notify = surface_handle_pending_buffer_destroy; 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_x += pending->dx;
surface->offset_y += pending->dy; surface->offset_y += pending->dy;
if (pending->opaque_region) if (pending->opaque_region_set)
{ {
if (surface->opaque_region) if (surface->opaque_region)
cairo_region_destroy (surface->opaque_region); cairo_region_destroy (surface->opaque_region);
if (pending->opaque_region)
surface->opaque_region = cairo_region_reference (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) if (surface->input_region)
cairo_region_destroy (surface->input_region); cairo_region_destroy (surface->input_region);
if (pending->input_region)
surface->input_region = cairo_region_reference (pending->input_region); surface->input_region = cairo_region_reference (pending->input_region);
else
surface->input_region = NULL;
} }
/* wl_surface.frame */ /* 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); 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 = cairo_region_copy (cr_region);
} }
surface->pending.opaque_region_set = TRUE;
} }
static void 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); 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 = cairo_region_copy (cr_region);
} }
surface->pending.input_region_set = TRUE;
} }
static void static void

View File

@ -62,7 +62,9 @@ typedef struct
cairo_region_t *damage; cairo_region_t *damage;
cairo_region_t *input_region; cairo_region_t *input_region;
gboolean input_region_set;
cairo_region_t *opaque_region; cairo_region_t *opaque_region;
gboolean opaque_region_set;
/* wl_surface.frame */ /* wl_surface.frame */
struct wl_list frame_callback_list; struct wl_list frame_callback_list;