normalization-of-relative-motion.rst 4.1 KB

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