mutter-wl: Support setting NULL surface regions.

According to the wayland spec (A.14.1.5. wl_surface::set_opaque_region),
setting a NULL opaque region is possible and should cause the pending
opaque region to be set to empty. This implements the required
behavoir.

Also fixes set_input_region, which suffered from an analogous bug.

Previously the weston-simple-egl demo client caused mutter-wayland to
crash with a segfault in meta_wayland_surface_set_opaque_region, with
this patch it works as intended.

https://bugzilla.gnome.org/show_bug.cgi?id=711518
This commit is contained in:
Andreas Heider 2013-11-06 00:00:48 +01:00 committed by Jasper St. Pierre
parent 78fcfec5c1
commit 237d990dea

View File

@ -199,14 +199,17 @@ meta_wayland_surface_set_opaque_region (struct wl_client *client,
struct wl_resource *region_resource)
{
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
MetaWaylandRegion *region = wl_resource_get_user_data (region_resource);
/* X11 unmanaged window */
if (!surface)
return;
g_clear_pointer (&surface->pending.opaque_region, cairo_region_destroy);
surface->pending.opaque_region = cairo_region_copy (region->region);
if (region_resource)
{
MetaWaylandRegion *region = wl_resource_get_user_data (region_resource);
surface->pending.opaque_region = cairo_region_copy (region->region);
}
}
static void
@ -215,14 +218,17 @@ meta_wayland_surface_set_input_region (struct wl_client *client,
struct wl_resource *region_resource)
{
MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource);
MetaWaylandRegion *region = wl_resource_get_user_data (region_resource);
/* X11 unmanaged window */
if (!surface)
return;
g_clear_pointer (&surface->pending.input_region, cairo_region_destroy);
surface->pending.input_region = cairo_region_copy (region->region);
if (region_resource)
{
MetaWaylandRegion *region = wl_resource_get_user_data (region_resource);
surface->pending.input_region = cairo_region_copy (region->region);
}
}
static void