[PATCH libinput 0/5] tablet: change to an axis-specific API

Peter Hutterer peter.hutterer at who-t.net
Sun Dec 13 18:00:09 PST 2015


This patchset changes the Tablet API from an API where we have a few
functions that take an axis type into one where we have an API that is
specific to each axis type.

The one-size-fits-all approach turned out to be too inflexible to be useful
and forced a couple of special API behaviours, e.g. get_value for a relative
wheel must always returns 0, has_axis for x/y is always true, etc.
Changing the API to be per-axis is a lot more expressive in code and allows
us to document and adjust the specific behaviour for each axis accordingly.

Rather than libinput_tablet_tool_has_axis(tool,
LIBINPUT_TABLET_TOOL_AXIS_PRESSURE), the new call is now
libinput_tablet_tool_has_pressure(tool).
and a similar change for the events.

The functionality largely stays the same, but there are a few notiable
differences:
* has_x() and has_y() is not available - it wouldn't be a tablet if it
  doesn't have those
* has_tilt() instead of has_tilt_x() + has_tilt_y(). We don't init devices
  with only one tilt axis as tablet.
* delta support (including delta_discrete) was dropped for all but the rel wheel.
  delta_discrete was already 0 for all but the wheel, the others were simple
  delta = old - current. We can punt that to the caller.

The last change enables us to introduce a get_dx/get_dy in the future for
accelerated motion data - required in relative mode.

Note that this is just the change to the public API. The internals work the
same as before, but will be adjusted once we agree on the public API.

Cheers,
  Peter


More information about the wayland-devel mailing list