window-actor: Fix the input shape region for decorated X11 windows

The code here before was completely wrong. Not only did it mix up
coordinate spaces of "client rect" vs. "frame rect", but it used
meta_frame_get_frame_bounds, which is specifically for the *visible*
bounds of a window!

In the case that we don't have a bounding or input shape region at
all on the client window, the input shape that we should apply is
the surface's natural shape. So, set the region to NULL to get the
natural rect picking semantics.
This commit is contained in:
Jasper St. Pierre 2014-03-30 20:11:47 -04:00
parent 0f9b29b140
commit 82e02e39d3

View File

@ -1738,41 +1738,20 @@ static void
meta_window_actor_update_input_region (MetaWindowActor *self) meta_window_actor_update_input_region (MetaWindowActor *self)
{ {
MetaWindowActorPrivate *priv = self->priv; MetaWindowActorPrivate *priv = self->priv;
cairo_region_t *region = NULL; MetaWindow *window = priv->window;
cairo_rectangle_int_t client_area; cairo_region_t *region;
meta_window_get_client_area_rect (priv->window, &client_area); if (window->shape_region && window->input_region)
if (priv->window->frame != NULL)
{ {
region = meta_frame_get_frame_bounds (priv->window->frame); region = cairo_region_copy (window->shape_region);
cairo_region_intersect (region, window->input_region);
/* input_region is in client window coordinates, so translate the
* input region into that coordinate system and back */
cairo_region_translate (region, -client_area.x, -client_area.y);
cairo_region_union_rectangle (region, &client_area);
cairo_region_translate (region, client_area.x, client_area.y);
}
else if (priv->window->shape_region != NULL ||
priv->window->input_region != NULL)
{
if (priv->window->shape_region != NULL)
{
region = cairo_region_copy (priv->window->shape_region);
if (priv->window->input_region != NULL)
cairo_region_intersect (region, priv->window->input_region);
}
else
region = cairo_region_reference (priv->window->input_region);
} }
else if (window->shape_region)
region = cairo_region_reference (window->shape_region);
else if (window->input_region)
region = cairo_region_reference (window->input_region);
else else
{ region = NULL;
/* If we don't have a shape on the server, that means that
* we have an implicit shape of one rectangle covering the
* entire window. */
region = cairo_region_create_rectangle (&client_area);
}
meta_surface_actor_set_input_region (priv->surface, region); meta_surface_actor_set_input_region (priv->surface, region);
cairo_region_destroy (region); cairo_region_destroy (region);