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

Alexandros Frantzis alexandros.frantzis at collabora.com
Fri Jan 26 16:56:08 UTC 2018


On Fri, Jan 19, 2018 at 12:18:38PM +0200, Pekka Paalanen wrote:
> On Wed, 20 Dec 2017 16:18:01 +0200
> Alexandros Frantzis <alexandros.frantzis at collabora.com> wrote:
> 
> > Implement the zwp_input_timestamps_v1.get_touch_timestamps request to
> > subscribe to timestamp events for wl_touch resources.
> > 
> > Signed-off-by: Alexandros Frantzis <alexandros.frantzis at collabora.com>
> > ---
> >  libweston/compositor.h |  2 ++
> >  libweston/input.c      | 53 +++++++++++++++++++++++++++++++++++++++++++-------
> >  tests/touch-test.c     | 46 +++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 94 insertions(+), 7 deletions(-)
> 
> > @@ -4643,7 +4665,24 @@ input_timestamps_manager_get_touch_timestamps(struct wl_client *client,
> >  					      uint32_t id,
> >  					      struct wl_resource *touch_resource)
> >  {
> > -	wl_client_post_no_memory(client);
> > +	struct weston_seat *seat = wl_resource_get_user_data(touch_resource);
> > +	struct wl_resource *input_ts;
> > +
> > +	input_ts = wl_resource_create(client,
> > +				      &zwp_input_timestamps_v1_interface,
> > +				      1, id);
> > +	if (!input_ts) {
> > +		wl_client_post_no_memory(client);
> > +		return;
> > +	}
> > +
> > +	wl_resource_set_implementation(input_ts,
> > +				       &input_timestamps_interface,
> > +				       touch_resource,
> > +				       unbind_resource);
> > +
> > +	wl_list_insert(&seat->touch_state->timestamps_list,
> > +		       wl_resource_get_link(input_ts));
> 
> Btw. each of the three patches adds a new list to weston_keyboard,
> weston_pointer, weston_touch, but following the example already set in
> the code, do not handle that struct getting destroyed while client
> resources for it still exist. This would be good to fix, at least for
> the new lists introduced in these patches. I only realized that after
> sending the earlier R-bs.
> 
> You can find the places with:
> 	$ git grep -p 'XXX: What about'
> 
> Otherwise the patch looks good, tests included. Nice work with the
> series.
> 
> Thanks,
> pq

Hi Pekka,

thanks for the review.

While investigating how to best solve this I realized that in order to
safely destroy the timestamp(_manager) objects, I had to first ensure
that the input objects are also properly destroyed. I have posted a
proposal for making the destruction of input objects safe here:

https://lists.freedesktop.org/archives/wayland-devel/2018-January/036701.html

When the input object destruction issues are resolved I will post
an updated version of this proposal.

Thanks,
Alexandros




More information about the wayland-devel mailing list