Clip the shaped region to the bounding region

According to the XShape specification, the shaped region should always be
a subset of the bounding region. Certain programs such as wine depended
on this behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=627880
This commit is contained in:
Jasper St. Pierre 2011-05-15 00:10:47 -04:00
parent 66a830fd46
commit 2b93c19328

View File

@ -1683,13 +1683,22 @@ meta_window_actor_update_bounding_region (MetaWindowActor *self,
priv->bounding_region = cairo_region_create_rectangle (&bounding_rectangle); priv->bounding_region = cairo_region_create_rectangle (&bounding_rectangle);
/* When we're shaped, we use the shape region to generate the shadow; the shape if (priv->shaped)
* region only changes when we get ShapeNotify event; but for unshaped windows {
* we generate the shadow from the bounding region, so we need to recompute /* If we're shaped, the implicit shape region clipping we need to do needs
* the shadow when the size changes. * to be updated.
*/ */
if (!priv->shaped) meta_window_actor_update_shape (self, TRUE);
meta_window_actor_invalidate_shadow (self); }
else
{
/* When we're shaped, we use the shape region to generate the shadow; the shape
* region only changes when we get ShapeNotify event; but for unshaped windows
* we generate the shadow from the bounding region, so we need to recompute
* the shadow when the size changes.
*/
meta_window_actor_invalidate_shadow (self);
}
g_signal_emit (self, signals[SIZE_CHANGED], 0); g_signal_emit (self, signals[SIZE_CHANGED], 0);
} }
@ -1710,6 +1719,20 @@ meta_window_actor_update_shape_region (MetaWindowActor *self,
cairo_rectangle_int_t rect = { rects[i].x, rects[i].y, rects[i].width, rects[i].height }; cairo_rectangle_int_t rect = { rects[i].x, rects[i].y, rects[i].width, rects[i].height };
cairo_region_union_rectangle (priv->shape_region, &rect); cairo_region_union_rectangle (priv->shape_region, &rect);
} }
/* Our "shape_region" is called the "bounding region" in the X Shape
* Extension Documentation.
*
* Our "bounding_region" is called the "bounding rectangle", which defines
* the shape of the window as if it the window was unshaped.
*
* The X Shape extension requires that the "bounding region" can never
* extend outside the "bounding rectangle", and says it must be implicitly
* clipped before rendering. The region we get back hasn't been clipped.
* We explicitly clip the region here.
*/
if (priv->bounding_region != NULL)
cairo_region_intersect (priv->shape_region, priv->bounding_region);
} }
/** /**