[PATCH libinput 03/10] touchpad: hook up to the tapping configuration

Peter Hutterer peter.hutterer at who-t.net
Wed Jun 4 18:56:31 PDT 2014


On Wed, Jun 04, 2014 at 10:57:36PM +0200, Jonas Ådahl wrote:
> On Wed, Jun 04, 2014 at 11:10:35AM +0200, Hans de Goede wrote:
> > On 06/03/2014 07:34 AM, Peter Hutterer wrote:

[...]

> > > @@ -583,9 +580,56 @@ tp_tap_handle_timeout(struct tp_dispatch *tp, uint64_t time)
> > >  	return tp->tap.timeout;
> > >  }
> > >  
> > > +static int
> > > +tp_tap_config_count(struct libinput_device *device)
> > > +{
> > > +	struct evdev_dispatch *dispatch = ((struct evdev_device *)device)->dispatch;
> > > +	struct tp_dispatch *tp = container_of(dispatch, tp, base);
> > > +
> > > +	return min(tp->ntouches, 3); /* we only do up to 3 finger tap */
> > > +}
> > > +
> > > +static enum libinput_config_status
> > > +tp_tap_config_enable(struct libinput_device *device, int enabled)
> > > +{
> > > +	struct evdev_dispatch *dispatch = ((struct evdev_device *)device)->dispatch;
> > 
> > Please user container_of here for proper type checking rather then
> > just a blatant cast of $random_type_foo to $random_type_bar. Same for all
> > the other occurrences of the same pattern below.
> 
> Would just like to point out that there are several places this cast is
> already in place, and starting to use container_of would introduce
> inconsistencies. I think this kind of casting isn't necessarily bad for
> single (or primary) inheritance types of objects.

I don't mind switching this to container_of, but I won't do this for this
patch. I'll switch the whole of libinput over in one go instead.

Cheers,
   Peter


More information about the wayland-devel mailing list