From 82e02e39d322b8c0c8a79944b6918e62ea901e4d Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Sun, 30 Mar 2014 20:11:47 -0400 Subject: [PATCH] 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. --- src/compositor/meta-window-actor.c | 41 ++++++++---------------------- 1 file changed, 10 insertions(+), 31 deletions(-) diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index 2054771eb..39fa7db8b 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -1738,41 +1738,20 @@ static void meta_window_actor_update_input_region (MetaWindowActor *self) { MetaWindowActorPrivate *priv = self->priv; - cairo_region_t *region = NULL; - cairo_rectangle_int_t client_area; + MetaWindow *window = priv->window; + cairo_region_t *region; - meta_window_get_client_area_rect (priv->window, &client_area); - - if (priv->window->frame != NULL) + if (window->shape_region && window->input_region) { - region = meta_frame_get_frame_bounds (priv->window->frame); - - /* 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); + region = cairo_region_copy (window->shape_region); + cairo_region_intersect (region, 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 - { - /* 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); - } + region = NULL; meta_surface_actor_set_input_region (priv->surface, region); cairo_region_destroy (region);