From 0884747dcec927e29e02ea7a854d98f80d2888a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 1 Jun 2023 23:05:13 +0200 Subject: [PATCH] window-actor/x11: Fix using shape region for input There were two issues with using the shape region to derive an input region. Firstly, the shape region is against the client rectangle, while the surface actor needs it to be against the buffer rectangle. Fix this by offsetting the shape region before passing it along. Secondly, we can't just intersect the shape and input region, since that leaves out the window decorations. Fix this by only intersecting the input region covering the client part, and the shape region, and then union that with the input region covering the rest. Part-of: --- src/compositor/meta-window-actor-x11.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c index edc48885e..82faee899 100644 --- a/src/compositor/meta-window-actor-x11.c +++ b/src/compositor/meta-window-actor-x11.c @@ -943,12 +943,31 @@ update_input_region (MetaWindowActorX11 *actor_x11) if (window->shape_region && window->input_region) { - region = cairo_region_copy (window->shape_region); - cairo_region_intersect (region, window->input_region); + cairo_rectangle_int_t client_area; + cairo_region_t *frames_input; + cairo_region_t *client_input; + + get_client_area_rect (actor_x11, &client_area); + + frames_input = cairo_region_copy (window->input_region); + cairo_region_subtract_rectangle (frames_input, &client_area); + + client_input = cairo_region_copy (actor_x11->shape_region); + cairo_region_intersect (client_input, window->input_region); + + cairo_region_union (frames_input, client_input); + cairo_region_destroy (client_input); + + region = g_steal_pointer (&frames_input); } else if (window->shape_region) { - region = cairo_region_reference (window->shape_region); + cairo_rectangle_int_t client_area; + + meta_window_get_client_area_rect (window, &client_area); + + region = cairo_region_copy (window->shape_region); + cairo_region_translate (region, client_area.x, client_area.y); } else if (window->input_region) {