[PATCH libinput 1/2] tablet: rely on libwacom for the list of axis capabilities

Peter Hutterer peter.hutterer at who-t.net
Wed Mar 11 14:26:22 PDT 2015


On Wed, Mar 11, 2015 at 04:12:58PM -0400, Benjamin Tissoires wrote:
> On Tue, Mar 10, 2015 at 1:03 AM, Peter Hutterer
> <peter.hutterer at who-t.net> wrote:
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> >  configure.ac       |  2 +-
> >  src/evdev-tablet.c | 56 +++++++++++++++++++++++++-----------------------------
> >  2 files changed, 27 insertions(+), 31 deletions(-)
> >
> > diff --git a/configure.ac b/configure.ac
> > index 85db1fd..038022e 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -172,7 +172,7 @@ AC_ARG_ENABLE(libwacom,
> >               [use_libwacom="$enableval"],
> >               [use_libwacom="yes"])
> >  if test "x$use_libwacom" = "xyes"; then
> > -       PKG_CHECK_MODULES(LIBWACOM, [libwacom], [HAVE_LIBWACOM="yes"])
> > +       PKG_CHECK_MODULES(LIBWACOM, [libwacom >= 0.12], [HAVE_LIBWACOM="yes"])
> >         AC_DEFINE(HAVE_LIBWACOM, 1, [Build with libwacom])
> >  fi
> >
> > diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
> > index 3e3924c..c4b4154 100644
> > --- a/src/evdev-tablet.c
> > +++ b/src/evdev-tablet.c
> > @@ -592,6 +592,7 @@ tool_set_bits_from_libwacom(const struct tablet_dispatch *tablet,
> >         const WacomStylus *s = NULL;
> >         int code;
> >         WacomStylusType type;
> > +       WacomAxisTypeFlags axes;
> >
> >         db = libwacom_database_new();
> >         if (!db) {
> > @@ -617,38 +618,33 @@ tool_set_bits_from_libwacom(const struct tablet_dispatch *tablet,
> >                 copy_button_cap(tablet, tool, BTN_TOUCH);
> >         }
> >
> > -       /* Eventually we want libwacom to tell us each axis on each device
> > -          separately. */
> > -       switch(type) {
> > -       case WSTYLUS_AIRBRUSH:
> > +       if (libwacom_stylus_has_wheel(s))
> > +               copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_REL_WHEEL);
> > +
> > +       axes = libwacom_stylus_get_axes(s);
> > +
> > +       if (axes & WACOM_AXIS_TYPE_TILT) {
> > +               /* tilt on the puck is converted to rotation */
> > +               if (type == WSTYLUS_PUCK) {
> > +                       set_bit(tool->axis_caps,
> > +                               LIBINPUT_TABLET_AXIS_ROTATION_Z);
> > +               } else {
> > +                       copy_axis_cap(tablet,
> > +                                     tool,
> > +                                     LIBINPUT_TABLET_AXIS_TILT_X);
> > +                       copy_axis_cap(tablet,
> > +                                     tool,
> > +                                     LIBINPUT_TABLET_AXIS_TILT_Y);
> > +               }
> > +       }
> > +       if (axes & WACOM_AXIS_TYPE_ROTATION_Z)
> > +               copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_ROTATION_Z);
> > +       if (axes & WACOM_AXIS_TYPE_DISTANCE)
> > +               copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_DISTANCE);
> > +       if (axes & WACOM_AXIS_TYPE_SLIDER)
> >                 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_SLIDER);
> > -               /* fall-through */
> > -       case WSTYLUS_MARKER:
> > -               if (type == WSTYLUS_MARKER)
> > -                       copy_axis_cap(tablet, tool,
> > -                                     LIBINPUT_TABLET_AXIS_ROTATION_Z);
> > -               /* fallthrough */
> > -       case WSTYLUS_GENERAL:
> > -       case WSTYLUS_INKING:
> > -       case WSTYLUS_CLASSIC:
> > -       case WSTYLUS_STROKE:
> > +       if (axes & WACOM_AXIS_TYPE_PRESSURE)
> >                 copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_PRESSURE);
> > -               copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_DISTANCE);
> > -               copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_TILT_X);
> > -               copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_TILT_Y);
> > -               break;
> > -       case WSTYLUS_PUCK:
> > -               copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_ROTATION_Z);
> > -               copy_axis_cap(tablet, tool, LIBINPUT_TABLET_AXIS_DISTANCE);
> > -               /* lens cursors don't have a wheel */
> > -               if (!libwacom_stylus_has_lens(s))
> > -                       copy_axis_cap(tablet,
> > -                                     tool,
> > -                                     LIBINPUT_TABLET_AXIS_REL_WHEEL);
> 
> We are missing the REL_WHEEL axis with this change. But this should be
> addressed in libwacom.

isn't that adressed by the has_wheel() call a few lines above? Before the
tilt check?

> For the series,
> Reviewed-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>

thanks.

Cheers,
   Peter


More information about the wayland-devel mailing list