[PATCH 3/7] evdev: move scale_axis to evdev.h header

Andreas Pokorny andreas.pokorny at canonical.com
Wed Jun 10 07:09:13 PDT 2015


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



More information about the wayland-devel mailing list