[PATCH weston v1 09/17] tests: do attach only with normal surfaces

Pekka Paalanen ppaalanen at gmail.com
Fri Dec 12 07:17:55 PST 2014


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

> When we call move_client on toytoolkit client when intializing, then the
> wl_buffer is NULL and we don't want that. Actually, toytoolkit clients
> don't need attaching and commiting the surface at all, because it has
> been already done.
> 
> Signed-off-by: Marek Chalupa <mchqwerty at gmail.com>
> ---
>  tests/weston-test-client-helper.c | 23 +++++++++++------------
>  1 file changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c
> index ea54c9e..abc41e9 100644
> --- a/tests/weston-test-client-helper.c
> +++ b/tests/weston-test-client-helper.c
> @@ -91,18 +91,17 @@ move_client(struct client *client, int x, int y)
>  	client->surface->y = y;
>  	wl_test_move_surface(client->test->wl_test, surface->wl_surface,
>  			     surface->x, surface->y);
> -	/* The attach here is necessary because commit() will call congfigure
> -	 * only on surfaces newly attached, and the one that sets the surface
> -	 * position is the configure. */
> -	wl_surface_attach(surface->wl_surface, surface->wl_buffer, 0, 0);
> -	wl_surface_damage(surface->wl_surface, 0, 0, surface->width,
> -			  surface->height);
> -
> -	frame_callback_set(surface->wl_surface, &done);
> -
> -	wl_surface_commit(surface->wl_surface);
> -
> -	frame_callback_wait(client, &done);
> +	if (!client->toytoolkit) {
> +		wl_surface_attach(surface->wl_surface, surface->wl_buffer, 0, 0);
> +		wl_surface_damage(surface->wl_surface, 0, 0,
> +				  surface->width, surface->height);
> +
> +		frame_callback_set(surface->wl_surface, &done);
> +		wl_surface_commit(surface->wl_surface);
> +		frame_callback_wait(client, &done);
> +	} else {
> +		client_roundtrip(client);
> +	}
>  }
>  
>  int

This patch doesn't apply. Needs a rebase nowadays?

Yeah, anyway... reiterating my earlier comments, do we even need
move_client() for non-test-shell cases?

Maybe it would be better to have a simple deterministic window placement
algorithm in shell.c, and then just query where the window is.

I'm more and more starting to think, that maybe wl_test should be able
to give a special test role to a surface, and then we can manipulate
only those in special ways, so we don't have to fight with the real
shell.

I think this whole attach & commit thing was to kick the move, and the
wait makes sure the window actually gets mapped, before we e.g. start
to wiggle the pointer to check if we get enter/leave events. (Perhaps
because a compositor repaint is needed to map the window, so protocol
message ordering is not enough?)

Would it make sense to go towards a more separated design: use the test
role for testing low-level features like pointer focus, and then use
toytoolkit to test toytoolkit features and the real shell?


Thanks,
pq


More information about the wayland-devel mailing list