[mutter] Revert "window-actor: Remove conditional checks for the shape region"
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] Revert "window-actor: Remove conditional checks for the shape region"
- Date: Wed, 6 Feb 2013 05:02:29 +0000 (UTC)
commit e48c3dac878ec475ef99e89d9a54ae87d14ea057
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Wed Feb 6 00:02:02 2013 -0500
Revert "window-actor: Remove conditional checks for the shape region"
This reverts commit 84930f1d781e1432a3319ecea095d8da602498f8.
src/compositor/meta-window-actor.c | 48 ++++++++++++++++++++++++++---------
1 files changed, 35 insertions(+), 13 deletions(-)
---
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index 681321a..137a47b 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -68,7 +68,7 @@ struct _MetaWindowActorPrivate
gchar * desc;
- /* A region that matches the shape of the window, including frame bounds */
+ /* If the window is shaped, a region that matches the shape */
cairo_region_t *shape_region;
/* A rectangular region with the visible extents of the window */
cairo_region_t *bounding_region;
@@ -560,7 +560,16 @@ meta_window_actor_get_shape_bounds (MetaWindowActor *self,
{
MetaWindowActorPrivate *priv = self->priv;
- cairo_region_get_extents (priv->shape_region, bounds);
+ /* We need to be defensive here because there are corner cases
+ * where getting the shape fails on a window being destroyed
+ * and similar.
+ */
+ if (priv->shape_region)
+ cairo_region_get_extents (priv->shape_region, bounds);
+ else if (priv->bounding_region)
+ cairo_region_get_extents (priv->bounding_region, bounds);
+ else
+ bounds->x = bounds->y = bounds->width = bounds->height = 0;
}
static void
@@ -1604,7 +1613,12 @@ meta_window_actor_get_obscured_region (MetaWindowActor *self)
MetaWindowActorPrivate *priv = self->priv;
if (!priv->argb32 && priv->opacity == 0xff && priv->back_pixmap)
- return priv->shape_region;
+ {
+ if (priv->shape_region)
+ return priv->shape_region;
+ else
+ return priv->bounding_region;
+ }
else
return NULL;
}
@@ -1853,17 +1867,25 @@ check_needs_shadow (MetaWindowActor *self)
if (*shadow_location == NULL && should_have_shadow)
{
if (priv->shadow_shape == NULL)
- priv->shadow_shape = meta_window_shape_new (priv->shape_region);
-
- MetaShadowFactory *factory = meta_shadow_factory_get_default ();
- const char *shadow_class = meta_window_actor_get_shadow_class (self);
- cairo_rectangle_int_t shape_bounds;
+ {
+ if (priv->shape_region)
+ priv->shadow_shape = meta_window_shape_new (priv->shape_region);
+ else if (priv->bounding_region)
+ priv->shadow_shape = meta_window_shape_new (priv->bounding_region);
+ }
- meta_window_actor_get_shape_bounds (self, &shape_bounds);
- *shadow_location = meta_shadow_factory_get_shadow (factory,
- priv->shadow_shape,
- shape_bounds.width, shape_bounds.height,
- shadow_class, appears_focused);
+ if (priv->shadow_shape != NULL)
+ {
+ MetaShadowFactory *factory = meta_shadow_factory_get_default ();
+ const char *shadow_class = meta_window_actor_get_shadow_class (self);
+ cairo_rectangle_int_t shape_bounds;
+
+ meta_window_actor_get_shape_bounds (self, &shape_bounds);
+ *shadow_location = meta_shadow_factory_get_shadow (factory,
+ priv->shadow_shape,
+ shape_bounds.width, shape_bounds.height,
+ shadow_class, appears_focused);
+ }
}
if (old_shadow != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]