[PATCH libinput 2.5/3] Move DEFAULT_MOUSE_DPI to evdev.h, provide a conversion macro

Peter Hutterer peter.hutterer at who-t.net
Thu Mar 5 21:41:38 PST 2015


Ideally we want to specify various thresholds in mm, but not all touchpads
set the hardware resolutions. Rather than conditions to check for resolutions
everywhere, use a macro to give us a normalized value that we use for motion
as well.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev.h  | 6 ++++++
 src/filter.h | 3 ---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/evdev.h b/src/evdev.h
index 72082e5..cd530e4 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -33,6 +33,12 @@
 #include "libinput-private.h"
 #include "timer.h"
 
+/* The HW DPI rate we normalize to before calculating pointer acceleration */
+#define DEFAULT_MOUSE_DPI 1000
+
+/* Convert MM to a distance normalized to DEFAULT_MOUSE_DPI */
+#define MM_TO_DPI_NORMALIZED(mm) (DEFAULT_MOUSE_DPI/25.4 * mm)
+
 enum evdev_event_type {
 	EVDEV_NONE,
 	EVDEV_ABSOLUTE_TOUCH_DOWN,
diff --git a/src/filter.h b/src/filter.h
index 9f6223d..9e90330 100644
--- a/src/filter.h
+++ b/src/filter.h
@@ -28,9 +28,6 @@
 #include <stdbool.h>
 #include <stdint.h>
 
-/* The HW DPI rate we normalize to before calculating pointer acceleration */
-#define DEFAULT_MOUSE_DPI 1000
-
 struct motion_params {
 	double dx, dy; /* in units/ms @ DEFAULT_MOUSE_DPI resolution */
 };
-- 
2.1.0



More information about the wayland-devel mailing list