[PATCH weston v3 6/6] libweston: Implement touch timestamps for input_timestamps_unstable_v1

Pekka Paalanen ppaalanen at gmail.com
Tue Feb 20 13:20:06 UTC 2018


On Tue, 20 Feb 2018 14:07:03 +0200
Alexandros Frantzis <alexandros.frantzis at collabora.com> wrote:

> Implement the zwp_input_timestamps_manager_v1.get_touch_timestamps
> request to subscribe to timestamp events for wl_touch resources. Ensure
> that the request handling code can gracefully handle inert touch
> resources.
> 
> Signed-off-by: Alexandros Frantzis <alexandros.frantzis at collabora.com>
> ---
> Changes in v3:
>  - In touch_timestamps_stop_after_client_releases_wl_touch test
>    check for changes to touch->input_timestamp instead of 
>    touch->up_time_timespec.
> 
> Changes in v2:
>  - Remove the head of timestamps_list in weston_touch_destroy.
>  - Gracefully handle inert touch resources in destroy_touch_resource
>    and input_timestamps_manager_get_touch_timestamps.
> 
>  libweston/compositor.h |  2 ++
>  libweston/input.c      | 61 ++++++++++++++++++++++++++++++++++++++++++++------
>  tests/touch-test.c     | 52 ++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 108 insertions(+), 7 deletions(-)

> diff --git a/tests/touch-test.c b/tests/touch-test.c
> index 9635257f..baf5bc58 100644
> --- a/tests/touch-test.c
> +++ b/tests/touch-test.c
> @@ -27,6 +27,7 @@
>  
>  #include <time.h>
>  
> +#include "input-timestamps-helper.h"
>  #include "shared/timespec-util.h"
>  #include "weston-test-client-helper.h"
>  #include "wayland-server-protocol.h"
> @@ -34,6 +35,7 @@
>  static const struct timespec t1 = { .tv_sec = 1, .tv_nsec = 1000001 };
>  static const struct timespec t2 = { .tv_sec = 2, .tv_nsec = 2000001 };
>  static const struct timespec t3 = { .tv_sec = 3, .tv_nsec = 3000001 };
> +static const struct timespec t_other = { .tv_sec = 123, .tv_nsec = 456 };
>  

> +
> +TEST(touch_timestamps_stop_after_client_releases_wl_touch)
> +{
> +	struct client *client = create_touch_test_client();
> +	struct touch *touch = client->input->touch;
> +	struct input_timestamps *input_ts =
> +		input_timestamps_create_for_touch(client);
> +
> +	send_touch(client, &t1, WL_TOUCH_DOWN);
> +	assert(touch->down_time_msec == timespec_to_msec(&t1));
> +	assert(timespec_eq(&touch->down_time_timespec, &t1));
> +
> +	wl_touch_release(client->input->touch->wl_touch);
> +
> +	/* Set input_timestamp to an arbitrary value (different from t1, t2
> +	 * and 0) and check that it is not changed by sending the event.
> +	 * This is preferred over just checking for 0, since 0 is used
> +	 * internally for resetting the timestamp after handling an input
> +	 * event and checking for it here may lead to false negatives. */
> +	touch->input_timestamp = t_other;
> +	send_touch(client, &t2, WL_TOUCH_UP);
> +	assert(timespec_eq(&touch->input_timestamp, &t_other));
> +
> +	input_timestamps_destroy(input_ts);
>  }

Hi Alf,

that works. All pushed:
   2d8331c4..d7157847  master -> master


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180220/9681c815/attachment.sig>


More information about the wayland-devel mailing list