[PATCH] xwm: Update input region on resize

Emmanuel Gil Peyrot linkmauve at linkmauve.fr
Tue Mar 6 19:13:54 UTC 2018


On Mon, Feb 19, 2018 at 12:18:51PM -0700, Scott Moreau wrote:
> Commit 332d1892 introduced a bug because the window was
> shaped only when the frame was created, leaving the input
> region unchanged regardless if the window was resized.
> This patch updates the input region shape on resize,
> fixing the problem.

This fixes the issue I had with Firefox, thanks!

Reviewed-by: Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
Tested-by: Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>

> ---
>  xwayland/window-manager.c | 46 +++++++++++++++++++++++++++-------------------
>  1 file changed, 27 insertions(+), 19 deletions(-)
> 
> diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
> index c307e19..5588166 100644
> --- a/xwayland/window-manager.c
> +++ b/xwayland/window-manager.c
> @@ -659,6 +659,30 @@ weston_wm_window_get_input_rect(struct weston_wm_window *window,
>  }
>  
>  static void
> +weston_wm_window_shape(struct weston_wm_window *window)
> +{
> +	struct weston_wm *wm = window->wm;
> +	xcb_rectangle_t rect;
> +	int x, y, width, height;
> +
> +	weston_wm_window_get_input_rect(window, &x, &y, &width, &height);
> +
> +	rect.x = x;
> +	rect.y = y;
> +	rect.width = width;
> +	rect.height = height;
> +
> +	/* The window frame was created with position and size which include
> +	 * an offset for margins and shadow. Set the input region to ignore
> +	 * shadow. */
> +	xcb_shape_rectangles(wm->conn,
> +			     XCB_SHAPE_SO_SET,
> +			     XCB_SHAPE_SK_INPUT,
> +			     0, window->frame_id,
> +			     0, 0, 1, &rect);
> +}
> +
> +static void
>  weston_wm_window_send_configure_notify(struct weston_wm_window *window)
>  {
>  	xcb_configure_notify_event_t configure_notify;
> @@ -789,6 +813,8 @@ weston_wm_handle_configure_notify(struct weston_wm *wm, xcb_generic_event_t *eve
>  			xwayland_api->set_xwayland(window->shsurf,
>  						   window->x, window->y);
>  	}
> +
> +	weston_wm_window_shape(window);
>  }
>  
>  static void
> @@ -983,7 +1009,6 @@ weston_wm_window_create_frame(struct weston_wm_window *window)
>  {
>  	struct weston_wm *wm = window->wm;
>  	uint32_t values[3];
> -	xcb_rectangle_t rect;
>  	int x, y, width, height;
>  	int buttons = FRAME_BUTTON_CLOSE;
>  
> @@ -1040,24 +1065,7 @@ weston_wm_window_create_frame(struct weston_wm_window *window)
>  							     &wm->format_rgba,
>  							     width, height);
>  
> -	weston_wm_window_get_input_rect(window, &x, &y, &width, &height);
> -	rect.x = x;
> -	rect.y = y;
> -	rect.width = width;
> -	rect.height = height;
> -
> -	/* The window frame was created with position and size which include
> -	 * an offset for margins and shadow. Set the input region to ignore
> -	 * shadow. */
> -	xcb_shape_rectangles(wm->conn,
> -			     XCB_SHAPE_SO_SET,
> -			     XCB_SHAPE_SK_INPUT,
> -			     0,
> -			     window->frame_id,
> -			     0,
> -			     0,
> -			     1,
> -			     &rect);
> +	weston_wm_window_shape(window);
>  
>  	hash_table_insert(wm->window_hash, window->frame_id, window);
>  }
> -- 
> 2.7.4
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel

-- 
Emmanuel Gil Peyrot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180306/f638365f/attachment.sig>


More information about the wayland-devel mailing list