mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-25 02:20:05 +01:00
tablet: normalize the distance to 0..1
The actual data provided by current tablets is not anywhere close to accurate. While it'd be nice to have this in mm, this is unlikely to happen anytime soon. Use the same 0..1 normalized range as pressure has. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
797b4b4e5a
commit
6fd00f74d4
2 changed files with 4 additions and 6 deletions
|
|
@ -104,7 +104,7 @@ tablet_update_tool(struct tablet_dispatch *tablet,
|
|||
}
|
||||
|
||||
static inline double
|
||||
normalize_pressure(const struct input_absinfo * absinfo) {
|
||||
normalize_pressure_or_dist(const struct input_absinfo * absinfo) {
|
||||
double range = absinfo->maximum - absinfo->minimum + 1;
|
||||
double value = (absinfo->value + absinfo->minimum) / range;
|
||||
|
||||
|
|
@ -145,10 +145,8 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
|
|||
absinfo->value);
|
||||
break;
|
||||
case LIBINPUT_TABLET_AXIS_DISTANCE:
|
||||
tablet->axes[a] = absinfo->value;
|
||||
break;
|
||||
case LIBINPUT_TABLET_AXIS_PRESSURE:
|
||||
tablet->axes[a] = normalize_pressure(absinfo);
|
||||
tablet->axes[a] = normalize_pressure_or_dist(absinfo);
|
||||
break;
|
||||
case LIBINPUT_TABLET_AXIS_TILT_VERTICAL:
|
||||
case LIBINPUT_TABLET_AXIS_TILT_HORIZONTAL:
|
||||
|
|
|
|||
|
|
@ -866,8 +866,8 @@ libinput_event_tablet_axis_has_changed(struct libinput_event_tablet *event,
|
|||
* tablet. Use libinput_event_tablet_get_x_transformed() and
|
||||
* libinput_event_tablet_get_y_transformed() for transforming each
|
||||
* respective axis value.
|
||||
* - @ref LIBINPUT_TABLET_AXIS_DISTANCE - Approximately how many millimeters
|
||||
* away from the tablet's sensor the tool is
|
||||
* - @ref LIBINPUT_TABLET_AXIS_DISTANCE - The distance from the tablet's
|
||||
* sensor, normalized from 0 to 1
|
||||
* - @ref LIBINPUT_TABLET_AXIS_PRESSURE - The current pressure being applied on
|
||||
* the tool in use, normalized from 0 to 1
|
||||
* - @ref LIBINPUT_TABLET_AXIS_TILT_VERTICAL and @ref
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue