mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 00:00:28 +01:00
Move DEFAULT_MOUSE_DPI to evdev.h, provide a conversion macro
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@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
3f7efc134e
commit
7a54360ed3
4 changed files with 10 additions and 6 deletions
|
|
@ -994,9 +994,8 @@ tp_init_accel(struct tp_dispatch *tp, double diagonal)
|
|||
fixed in the actual filter code.
|
||||
*/
|
||||
{
|
||||
const double MAGIC = 0.4;
|
||||
tp->accel.x_scale_coeff *= MAGIC;
|
||||
tp->accel.y_scale_coeff *= MAGIC;
|
||||
tp->accel.x_scale_coeff *= TP_MAGIC_SLOWDOWN;
|
||||
tp->accel.y_scale_coeff *= TP_MAGIC_SLOWDOWN;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -34,6 +34,11 @@
|
|||
|
||||
#define VENDOR_ID_APPLE 0x5ac
|
||||
|
||||
/* Touchpad slowdown factor, see the FIXME in tp_init_accel() */
|
||||
#define TP_MAGIC_SLOWDOWN 0.4
|
||||
/* Convert mm to a distance normalized to DEFAULT_MOUSE_DPI */
|
||||
#define TP_MM_TO_DPI_NORMALIZED(mm) (DEFAULT_MOUSE_DPI/25.4 * TP_MAGIC_SLOWDOWN * mm)
|
||||
|
||||
enum touchpad_event {
|
||||
TOUCHPAD_EVENT_NONE = 0,
|
||||
TOUCHPAD_EVENT_MOTION = (1 << 0),
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@
|
|||
#include "libinput-private.h"
|
||||
#include "timer.h"
|
||||
|
||||
/* The HW DPI rate we normalize to before calculating pointer acceleration */
|
||||
#define DEFAULT_MOUSE_DPI 1000
|
||||
|
||||
enum evdev_event_type {
|
||||
EVDEV_NONE,
|
||||
EVDEV_ABSOLUTE_TOUCH_DOWN,
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue