1
0

tapping.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. .. _tapping:
  2. ==============================================================================
  3. Tap-to-click behaviour
  4. ==============================================================================
  5. "Tapping" or "tap-to-click" is the name given to the behavior where a short
  6. finger touch down/up sequence maps into a button click. This is most
  7. commonly used on touchpads, but may be available on other devices.
  8. libinput implements tapping for one, two, and three fingers, where supported by
  9. the hardware, and maps those taps into a left, right, and middle button click,
  10. respectively. This mapping can be switched to left, middle and right through
  11. configuration. Not all devices support three fingers, libinput will support
  12. tapping up to whatever is supported by the hardware. libinput does not support
  13. four-finger taps or any tapping with more than four fingers, even though some
  14. hardware can distinguish between that many fingers.
  15. .. _tapping_default:
  16. ------------------------------------------------------------------------------
  17. Tap-to-click default setting
  18. ------------------------------------------------------------------------------
  19. Tapping is **disabled** by default on most devices, see
  20. :commit:`2219c12c3` because:
  21. - if you don't know that tapping is a thing (or enabled by default), you get
  22. spurious button events that make the desktop feel buggy.
  23. - if you do know what tapping is and you want it, you usually know where to
  24. enable it, or at least you can search for it.
  25. Tapping is **enabled** by default on devices where tapping is the only
  26. method to trigger button clicks. This includes devices without physical
  27. buttons such as touch-capable graphics tablets.
  28. .. note:: Unfortunately due to the current API design, devices that require
  29. tapping effectively prevent us from changing this default. For details see
  30. `this comment <https://gitlab.freedesktop.org/libinput/libinput/-/issues/926#note_2056476>`_.
  31. Tapping can be enabled/disabled on a per-device basis. See
  32. **libinput_device_config_tap_set_enabled()** for details.
  33. .. _tapndrag:
  34. ------------------------------------------------------------------------------
  35. Tap-and-drag
  36. ------------------------------------------------------------------------------
  37. libinput also supports "tap-and-drag" where a tap immediately followed by a
  38. finger down and that finger being held down emulates a button press. Moving
  39. the finger around can thus drag the selected item on the screen.
  40. Tap-and-drag is optional and can be enabled or disabled with
  41. **libinput_device_config_tap_set_drag_enabled()**. Most devices have
  42. tap-and-drag enabled by default.
  43. .. note:: Dragging is always done with one finger. The number of fingers on
  44. the initial tap decide the type of button click. For example, to
  45. middle-click drag, tap with three fingers followed by a
  46. single-finger drag.
  47. Also optional is a feature called "drag lock". With drag lock **disabled**,
  48. lifting the finger will stop any drag process. When **enabled**, the drag
  49. process continues even after lifting a finger, allowing the user to
  50. reset the finger position and keep moving without releasing the drag.
  51. libinput supports two variations of this drag lock: "sticky" and "timeout".
  52. In sticky mode, the drag lock must be ended with an explicit additional tap.
  53. In timeout mode, the drag lock ends automatically if no finger was put back on
  54. the touchpad within a timeout. Drag lock can be enabled and disabled with
  55. **libinput_device_config_tap_set_drag_lock_enabled()**.
  56. Note that drag lock only applies if tap-and-drag is enabled.
  57. .. figure:: tap-n-drag.svg
  58. :align: center
  59. Tap-and-drag process
  60. The above diagram explains the process, a tap (a) followed by a finger held
  61. down (b) starts the drag process and logically holds the left mouse button
  62. down. A movement of the finger (c) will drag the selected item until the
  63. finger is released (e). If needed and drag lock is enabled, the finger's
  64. position can be reset by lifting and quickly setting it down again on the
  65. touchpad (d). This will be interpreted as continuing move and is especially
  66. useful on small touchpads or with slow pointer acceleration.
  67. If drag lock is enabled, the release of the mouse buttons after the finger
  68. release (e) is triggered by a timeout (if in timeout mode) or by tapping again (f).
  69. libinput also supports an "auto drag-lock" feature: if drag lock is **disabled**
  70. but the dragging finger is released at the very edge of the touchpad,
  71. a drag lock automatically activates for a short timeout. This allows a user to
  72. quickly reset the finger to elsewhere on the touchpad and continue the dragging
  73. motion. If the finger is released elsewhere, no drag lock activates.
  74. If two fingers are supported by the hardware, a second finger can be used to
  75. drag while the first is held in-place.
  76. .. _tap_constraints:
  77. ------------------------------------------------------------------------------
  78. Constraints while tapping
  79. ------------------------------------------------------------------------------
  80. A couple of constraints apply to the contact to be converted into a press, the most common ones are:
  81. - the touch down and touch up must happen within an implementation-defined timeout
  82. - if a finger moves more than an implementation-defined distance while in contact, it's not a tap
  83. - tapping within :ref:`clickpad software buttons <clickpad_softbuttons>` may not trigger an event
  84. - a tap not meeting required pressure thresholds can be ignored as accidental touch
  85. - a tap exceeding certain pressure thresholds can be ignored (see :ref:`palm_detection`)
  86. - a tap on the edges of the touchpad can usually be ignored (see :ref:`palm_detection`)