[mutter/wayland] mutter-wl: Support setting NULL surface regions.
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] mutter-wl: Support setting NULL surface regions.
- Date: Tue, 5 Nov 2013 23:19:29 +0000 (UTC)
commit 237d990dea5baa8769f541a294f64852332fdcd4
Author: Andreas Heider <andreas heider io>
Date: Wed Nov 6 00:00:48 2013 +0100
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
src/wayland/meta-wayland-surface.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index f77f9cb..5f00ce3 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]