[weston, v3, 3/3] libweston-desktop/xwayland: react to geometry changes

Louis-Francis Ratté-Boulianne lfrb at collabora.com
Tue Apr 11 17:53:51 UTC 2017


On Wed, 2017-01-18 at 15:37 +0200, Pekka Paalanen wrote:
> From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> 
> Fix up the window position whenever the geometry info changes.
> 
> If the window geometry changes, we want to keep the input-responding
> content anchored to top-left. It is done by manipulating the dx,dy
> arguments originating from a wl_surface.attach request.
> 
> Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>

> ---
>  libweston-desktop/xwayland.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libweston-desktop/xwayland.c b/libweston-
> desktop/xwayland.c
> index b984385..4f4b453 100644
> --- a/libweston-desktop/xwayland.c
> +++ b/libweston-desktop/xwayland.c
> @@ -131,12 +131,19 @@
> weston_desktop_xwayland_surface_committed(struct
> weston_desktop_surface *dsurfac
>  					  int32_t sx, int32_t sy)
>  {
>  	struct weston_desktop_xwayland_surface *surface = user_data;
> +	struct weston_geometry oldgeom;
> +
> +	assert(dsurface == surface->surface);
>  
>  #ifdef WM_DEBUG
>  	weston_log("%s: xwayland surface %p\n", __func__, surface);
>  #endif
>  
>  	if (surface->has_next_geometry) {
> +		oldgeom =
> weston_desktop_surface_get_geometry(surface->surface);
> +		sx -= surface->next_geometry.x - oldgeom.x;
> +		sy -= surface->next_geometry.y - oldgeom.x;
> +
>  		surface->has_next_geometry = false;
>  		weston_desktop_surface_set_geometry(surface-
> >surface,
>  						    surface-
> >next_geometry);


More information about the wayland-devel mailing list