mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 04:40:25 +01:00
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:
parent
58e0fe270d
commit
79898da377
2 changed files with 6 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue