evdev: add DPI to evdev calculations

Assume "normal" mice are 400DPI, and that all calculations should be
normalized to this before being fed into the filter.

There isn't yet a way to configure a device's DPI.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Derek Foreman 2014-10-30 16:34:15 -05:00 committed by Peter Hutterer
parent 58e0fe270d
commit 79898da377
2 changed files with 6 additions and 2 deletions

View file

@ -42,6 +42,8 @@
#define DEFAULT_AXIS_STEP_DISTANCE 10
#define DEFAULT_MIDDLE_BUTTON_SCROLL_TIMEOUT 200
/* The HW DPI rate we normalize to before calculating pointer acceleration */
#define DEFAULT_MOUSE_DPI 400
enum evdev_key_type {
EVDEV_KEY_TYPE_NONE,
@ -205,8 +207,8 @@ evdev_flush_pending_event(struct evdev_device *device, uint64_t time)
case EVDEV_NONE:
return;
case EVDEV_RELATIVE_MOTION:
motion.dx = device->rel.dx;
motion.dy = device->rel.dy;
motion.dx = device->rel.dx / ((double)device->dpi / DEFAULT_MOUSE_DPI);
motion.dy = device->rel.dy / ((double)device->dpi / DEFAULT_MOUSE_DPI);
device->rel.dx = 0;
device->rel.dy = 0;
@ -1293,6 +1295,7 @@ evdev_device_create(struct libinput_seat *seat,
device->devname = libevdev_get_name(device->evdev);
device->scroll.threshold = 5.0; /* Default may be overridden */
device->scroll.direction = 0;
device->dpi = DEFAULT_MOUSE_DPI;
matrix_init_identity(&device->abs.calibration);
matrix_init_identity(&device->abs.usermatrix);

View file

@ -136,6 +136,7 @@ struct evdev_device {
void (*change_to_left_handed)(struct evdev_device *device);
} buttons;
int dpi; /* HW resolution */
/* The number of times libevdev processes a SYN_DROPPED, so we can
* stop logging them to avoid flooding the logs. */
int syn_drops_received;