[PATCH weston 16/25] libweston: introduce notify_touch_cal() and doc
ppaalanen at gmail.com
Mon Apr 23 10:34:19 UTC 2018
On Mon, 9 Apr 2018 12:12:49 +1000
Peter Hutterer <peter.hutterer at who-t.net> wrote:
> On Fri, Mar 23, 2018 at 02:00:56PM +0200, Pekka Paalanen wrote:
> > From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> > notify_touch_cal() is an extended form of notify_touch(), adding
> > normalized touch coordinates which are necessary for calibrating a
> > touchscreen.
> > It would be possible to invert the transformation and convert from
> > global coordinates to normalized device coordinates in input.c without
> > adding this API, but this way it is more robust against code changes.
> > Recovering normalized device coordinates is necessary because libinput
> > calibration matrix must be given in normalized units, and it would be
> > difficult to compute otherwise. Libinput API does not offer normalized
> > coordinates directly either, but those can be fetched by pretending the
> > output resolution is 1x1.
> > Anticipating touch calibration mode, the old notify_touch() is renamed
> > into a private process_touch_normal(), and the new notify_touch_cal()
> > delegates to it.
> > Co-developed by Louis-Francis and Pekka.
> > Cc: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>
> > Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> > ---
> > libweston/compositor.h | 21 +++++++++++++++-
> > libweston/input.c | 60 ++++++++++++++++++++++++++++++++++++---------
> > libweston/libinput-device.c | 11 ++++++++-
> > 3 files changed, 79 insertions(+), 13 deletions(-)
> > --- a/libweston/input.c
> > +++ b/libweston/input.c
> > @@ -2336,17 +2336,10 @@ weston_touch_set_focus(struct weston_touch *touch, struct weston_view *view)
> > touch->focus = view;
> > }
> > -/**
> > - * notify_touch - emulates button touches and notifies surfaces accordingly.
> > - *
> > - * It assumes always the correct cycle sequence until it gets here: touch_down
> > - * → touch_update → ... → touch_update → touch_end. The driver is responsible
> > - * for sending along such order.
> > - *
> > - */
> > -WL_EXPORT void
> > -notify_touch(struct weston_touch_device *device, const struct timespec *time,
> > - int touch_id, double double_x, double double_y, int touch_type)
> > +static void
> > +process_touch_normal(struct weston_touch_device *device,
> > + const struct timespec *time, int touch_id,
> > + double double_x, double double_y, int touch_type)
> IMO just process_touch() is better, otherwise it's more confusing ("wait?
> why is this normal? and what's not normal? or is this an abbreviation of
Actually, this is really the normal path. The not normal path is the
one for calibrator. You see the non-normal path added in "input:
introduce touch event mode for calibrator".
I didn't want to call it process_touch() originally, because it doesn't
process all touches, just the usual case. I even call it
Would you have other suggestions?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 833 bytes
Desc: OpenPGP digital signature
More information about the wayland-devel