To be used inside pressure and orientation access functions of libinput.c --- src/evdev.c | 11 ++--------- src/evdev.h | 7 +++++++ 2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/evdev.c b/src/evdev.c index af507d6..6f68554 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -224,19 +224,12 @@ transform_absolute(struct evdev_device *device, matrix_mult_vec(&device->abs.calibration, &point->x, &point->y); } -static inline double -scale_axis(const struct input_absinfo *absinfo, double val, double to_range) -{ - return (val - absinfo->minimum) * to_range / - (absinfo->maximum - absinfo->minimum + 1); -} - double evdev_device_transform_x(struct evdev_device *device, double x, uint32_t width) { - return scale_axis(device->abs.absinfo_x, x, width); + return evdev_scale_axis(device->abs.absinfo_x, x, width); } double @@ -244,7 +237,7 @@ evdev_device_transform_y(struct evdev_device *device, double y, uint32_t height) { - return scale_axis(device->abs.absinfo_y, y, height); + return evdev_scale_axis(device->abs.absinfo_y, y, height); } static inline void diff --git a/src/evdev.h b/src/evdev.h index b8ef599..8e67e5d 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -419,6 +419,13 @@ evdev_convert_to_mm(const struct input_absinfo *absinfo, double v) return value/absinfo->resolution; } +static inline double +evdev_scale_axis(const struct input_absinfo *absinfo, double val, double to_range) +{ + return (val - absinfo->minimum) * to_range / + (absinfo->maximum - absinfo->minimum + 1); +} + int evdev_init_left_handed(struct evdev_device *device, void (*change_to_left_handed)(struct evdev_device *)); -- 2.1.4 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel