[PATCH libevdev 2/6] Add abs setters for changing a single value on an abs axis
Peter Hutterer
peter.hutterer at who-t.net
Wed Jul 31 16:17:40 PDT 2013
On Wed, Jul 31, 2013 at 01:02:27PM +0200, Benjamin Tissoires wrote:
> On Mon, Jul 29, 2013 at 7:34 AM, Peter Hutterer
> <peter.hutterer at who-t.net> wrote:
> > Changing a single value on an abs axis is slightly more common than
> > having to enable that axis outright. Provide a set of accessors for
> > doing so.
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> > libevdev/libevdev.c | 22 ++++++++++++++
> > libevdev/libevdev.h | 54 +++++++++++++++++++++++++++++++++++
> > test/test-libevdev-has-event.c | 65 ++++++++++++++++++++++++++++++++++++++++++
> > 3 files changed, 141 insertions(+)
> >
> > diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
> > index cd33659..c7f5102 100644
> > --- a/libevdev/libevdev.c
> > +++ b/libevdev/libevdev.c
> > @@ -836,6 +836,28 @@ libevdev_get_abs_resolution(const struct libevdev *dev, unsigned int code)
> > return absinfo ? absinfo->resolution : 0;
> > }
> >
> > +#define ABS_SETTER(name, field) \
> > +void libevdev_set_abs_##name(struct libevdev *dev, unsigned int code, int val) \
> > +{ \
> > + if (!libevdev_has_event_code(dev, EV_ABS, code)) \
> > + return; \
> > + dev->abs_info[code].field = val; \
> > +}
> > +
> > +ABS_SETTER(max, maximum)
> > +ABS_SETTER(min, minimum)
>
> I'm a little bit worried of adding the setters now, and deprecating
> them right after. Couldn't we deprecate libevdev_get_abs_min before
> inserting this patch so that we don't deprecate a non used function?
ok, I'll reshuffle the series to avoid this.
In my defence, I had this patchset out before using the accessors and
realising that they're not quite as consistent as they should be :)
Cheers,
Peter
>
> other than that, the code is clean, as usual :)
>
> Reviewed-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>
>
> Cheers,
> Benjamin
More information about the Input-tools
mailing list