libinput/doc
Peter Hutterer a7e4cbc212 quirks: allow overriding of AttrEventCode and AttrInputProp
This switches the quirk from AttrEventCodeEnable/Disable to just
AttrEventCode with a +/- prefix for each entry.
This switches the quirk from AttrInputPropEnable/Disable to just
AttrInputProp with a +/- prefix for each entry.

Previously, both event codes and input props would only apply the
last-matching section entry for a device. Furthermore, an earlier Disable entry
would take precedence over a later Enable entry. For example, a set of
sections with these lines *should* enable left, right and middle:

  [first]
  AttrEventCodeEnable=BTN_LEFT;BTN_RIGHT;BTN_MIDDLE

  [second]
  AttrEventCodeDisable=BTN_RIGHT

  [third]
  AttrEventCodeEnable=BTN_LEFT;BTN_RIGHT;

Alas: the first line was effectively ignored (quirks only returned the
last-matching one, i.e. the one from "third"). And due to implementation
details in evdev.c, the Disable attribute was processed after Enable,
i.e. the device was enabled for left + right and then disabled for
right. As a result, the device only had BTN_LEFT enabled.

Fix this by changing the attribute to carry both enable/disable
information and merging the commands together.

Internally, all quirks matching a device are simply ref'd into an array
in the struct quirks. The applied value is simply the last entry in the
array corresponding to our quirk.

For AttrEventCode and AttrInputProp instead do this:
- switch them to a tuple with the code as first entry and a boolean
  enable/disable as second entry
- if the struct quirk already has an entry for either, append the more
  recent one to the existing entry (instead of creating a new entry in
  the array). This way we have all entries that match and in-order of
  precedence - i.e. we can process them left-to-right to end up
  with the right state.

Fixes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/821

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-11-28 08:25:41 +10:00
..
api doc/api: fix the doxygen output handling 2020-09-29 17:48:31 +10:00
user quirks: allow overriding of AttrEventCode and AttrInputProp 2022-11-28 08:25:41 +10:00
button-debouncing-state-machine.svg evdev: restart debouncing timers after every event 2021-05-19 12:24:59 +02:00
button-debouncing-wave-diagram.txt evdev: add new debouncing code 2017-11-20 09:55:05 +10:00
middle-button-emulation.svg evdev: add support for middle button emulation 2015-04-17 12:50:03 +10:00
touchpad-edge-scrolling-state-machine.svg touchpad: Add edge-scrolling support 2014-11-25 17:02:30 +10:00
touchpad-gestures-state-machine.svg doc: document disambiguation between two finger pinch and scroll 2022-01-27 08:35:30 +01:00
touchpad-softbutton-state-machine.svg touchpad: Route top softbuttons through the trackstick if we've one 2014-09-19 08:20:00 +10:00
touchpad-tap-state-machine.svg touchpad: permit only one finger on the touchpad at the start of a tap-drag 2021-02-15 05:46:46 +00:00