From 7bbbce9a834f2549168b63d1c5993440ef325f87 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 29 Apr 2010 10:06:24 +1000 Subject: Read the device resolution from the kernel. For earlier kernels, use the previous hardcoded resolution in place. Signed-off-by: Peter Hutterer Reviewed-by: Julien Cristau --- src/evdev.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/evdev.c b/src/evdev.c index 205d6c6..6d16611 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -1187,15 +1188,24 @@ EvdevAddAbsClass(DeviceIntPtr device) for (axis = ABS_X; axis <= ABS_MAX; axis++) { int axnum = pEvdev->axis_map[axis]; + int resolution = 10000; + if (axnum == -1) continue; + +#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 30) + /* Kernel provides units/mm, X wants units/m */ + if (pEvdev->absinfo[axis].resolution) + resolution = pEvdev->absinfo[axis].resolution * 1000; +#endif + xf86InitValuatorAxisStruct(device, axnum, #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 atoms[axnum], #endif pEvdev->absinfo[axis].minimum, pEvdev->absinfo[axis].maximum, - 10000, 0, 10000); + resolution, 0, resolution); xf86InitValuatorDefaults(device, axnum); pEvdev->old_vals[axnum] = -1; } -- cgit v1.2.3