[PATCH weston v1 11/17] add get_geometry & geometry request/event

Pekka Paalanen ppaalanen at gmail.com
Fri Dec 12 08:21:19 PST 2014


On Fri,  5 Dec 2014 14:36:44 +0100
Marek Chalupa <mchqwerty at gmail.com> wrote:

> ---
>  protocol/wayland-test.xml         | 11 +++++++++++
>  tests/weston-test-client-helper.c | 18 ++++++++++++++++++
>  tests/weston-test-client-helper.h |  6 ++++++
>  tests/weston-test.c               | 23 +++++++++++++++++++++++
>  4 files changed, 58 insertions(+)
> 

> diff --git a/tests/weston-test.c b/tests/weston-test.c
> index 17c93f5..d1539e7 100644
> --- a/tests/weston-test.c
> +++ b/tests/weston-test.c
> @@ -221,6 +221,28 @@ get_n_buffers(struct wl_client *client, struct wl_resource *resource)
>  	wl_test_send_n_egl_buffers(resource, n_buffers);
>  }
>  
> +static void
> +get_geometry(struct wl_client *client, struct wl_resource *resource,
> +	     struct wl_resource *surface_resource)
> +{
> +	struct weston_view *view;
> +	struct weston_surface *surface =
> +		wl_resource_get_user_data (surface_resource);
> +
> +	if (surface->configure)
> +		view = wl_container_of(surface->views.next, view, surface_link);

This is kind of hardcoding the assumption that there is a main view,
and it is the first in the list. But I suppose this is not a new
assumption, so nevermind.

> +	else
> +		view = surface->configure_private;
> +
> +	/* not created yet */
> +	if (!view)
> +		return;
> +
> +	wl_test_send_geometry(resource, surface_resource,
> +			      surface->width, surface->height,
> +			      view->geometry.x, view->geometry.y);

This doesn't work for surfaces who are positioned relative to another
surface. You need to use weston_view_to_global_{float,fixed}() to
transform 0,0.

That is, if the goal here is to know where the surface is in global
coordinates. Would be good to start adding some explanations in the
wl_test spec, too.

Another case where the whole protocol fails is wackily transformed
surfaces, but I think we don't want to support those. :-)
Still, would be nice to send e.g. a protocol error if the surface is
wackily transformed.


Thanks,
pq


More information about the wayland-devel mailing list