mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-09 00:30:15 +01:00
tablet: fix get_x_transformed() and get_y_transformed()
Because the values for each axis were stored in struct tablet_dispatch in millimeters, coordinates were not being translated properly to screen coordinates. This stores the values internally as raw coordinates, and only translates them to millimeters if the client asks for it. Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
4d871c8e45
commit
78b474ee37
2 changed files with 19 additions and 4 deletions
|
|
@ -142,8 +142,7 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
|
|||
switch (a) {
|
||||
case LIBINPUT_TABLET_AXIS_X:
|
||||
case LIBINPUT_TABLET_AXIS_Y:
|
||||
tablet->axes[a] = evdev_convert_to_mm(absinfo,
|
||||
absinfo->value);
|
||||
tablet->axes[a] = absinfo->value;
|
||||
break;
|
||||
case LIBINPUT_TABLET_AXIS_DISTANCE:
|
||||
case LIBINPUT_TABLET_AXIS_PRESSURE:
|
||||
|
|
|
|||
|
|
@ -504,11 +504,27 @@ LIBINPUT_EXPORT double
|
|||
libinput_event_tablet_get_axis_value(struct libinput_event_tablet *event,
|
||||
enum libinput_tablet_axis axis)
|
||||
{
|
||||
struct evdev_device *device =
|
||||
(struct evdev_device *) event->base.device;
|
||||
|
||||
if (event->base.type != LIBINPUT_EVENT_TABLET_AXIS)
|
||||
return 0;
|
||||
|
||||
return (axis >= 0 && axis < LIBINPUT_TABLET_AXIS_CNT) ?
|
||||
event->axes[axis] : 0;
|
||||
switch(axis) {
|
||||
case LIBINPUT_TABLET_AXIS_X:
|
||||
return evdev_convert_to_mm(device->abs.absinfo_x,
|
||||
event->axes[axis]);
|
||||
case LIBINPUT_TABLET_AXIS_Y:
|
||||
return evdev_convert_to_mm(device->abs.absinfo_y,
|
||||
event->axes[axis]);
|
||||
case LIBINPUT_TABLET_AXIS_DISTANCE:
|
||||
case LIBINPUT_TABLET_AXIS_PRESSURE:
|
||||
case LIBINPUT_TABLET_AXIS_TILT_X:
|
||||
case LIBINPUT_TABLET_AXIS_TILT_Y:
|
||||
return event->axes[axis];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
LIBINPUT_EXPORT double
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue