• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. _motion_normalization:
2
3==============================================================================
4Normalization of relative motion
5==============================================================================
6
7Most relative input devices generate input in so-called "mickeys". A
8mickey is in device-specific units that depend on the resolution
9of the sensor. Most optical mice use sensors with 1000dpi resolution, but
10some devices range from 100dpi to well above 8000dpi.
11
12Without a physical reference point, a relative coordinate cannot be
13interpreted correctly. A delta of 10 mickeys may be a millimeter of
14physical movement or 10 millimeters, depending on the sensor. This
15affects pointer acceleration in libinput and interpretation of relative
16coordinates in callers.
17
18libinput does partial normalization of relative input. For devices with a
19resolution of 1000dpi and higher, motion events are normalized to a default
20of 1000dpi before pointer acceleration is applied. As a result, devices with
211000dpi and above feel the same.
22
23Devices below 1000dpi are not normalized (normalization of a 1-device unit
24movement on a 400dpi mouse would cause a 2.5 pixel movement). Instead,
25libinput applies a dpi-dependent acceleration function. At low speeds, a
261-device unit movement usually translates into a 1-pixel movements. As the
27movement speed increases, acceleration is applied - at high speeds a low-dpi
28device will roughly feel the same as a higher-dpi mouse.
29
30This normalization only applies to accelerated coordinates, unaccelerated
31coordinates are left in device-units. It is up to the caller to interpret
32those coordinates correctly.
33
34.. _motion_normalization_touchpad:
35
36------------------------------------------------------------------------------
37Normalization of touchpad coordinates
38------------------------------------------------------------------------------
39
40Touchpads may have a different resolution for the horizontal and vertical
41axis. Interpreting coordinates from the touchpad without taking resolution
42into account results in uneven motion.
43
44libinput scales unaccelerated touchpad motion to the resolution of the
45touchpad's x axis, i.e. the unaccelerated value for the y axis is:
46``y = (x / resolution_x) * resolution_y``.
47
48.. _motion_normalization_tablet:
49
50------------------------------------------------------------------------------
51Normalization of tablet coordinates
52------------------------------------------------------------------------------
53
54See :ref:`tablet-relative-motion`
55
56.. _motion_normalization_customization:
57
58------------------------------------------------------------------------------
59Setting custom DPI settings
60------------------------------------------------------------------------------
61
62Devices usually do not advertise their resolution and libinput relies on
63the udev property **MOUSE_DPI** for this information. This property is usually
64set via the
65`udev hwdb <http://cgit.freedesktop.org/systemd/systemd/tree/hwdb/70-mouse.hwdb>`_.
66The ``mouse-dpi-tool`` utility provided by
67`libevdev <https://freedesktop.org/wiki/Software/libevdev/>`_ should be
68used to measure a device's resolution.
69
70The format of the property for single-resolution mice is: ::
71
72          MOUSE_DPI=resolution@frequency
73
74The resolution is in dots per inch, the frequency in Hz.
75The format of the property for multi-resolution mice may list multiple
76resolutions and frequencies: ::
77
78          MOUSE_DPI=r1@f1 *r2@f2 r3@f3
79
80The default frequency must be pre-fixed with an asterisk.
81
82For example, these two properties are valid: ::
83
84          MOUSE_DPI=800@125
85          MOUSE_DPI=400@125 800@125 *1000@500 5500@500
86
87The behavior for a malformed property is undefined. If the property is
88unset, libinput assumes the resolution is 1000dpi.
89
90Note that HW does not usually provide information about run-time
91resolution changes, libinput will thus not detect when a resolution
92changes to the non-default value.
93