libinput/tools
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
..
libinput-analyze-per-slot-delta.man tools: per-slot-delta: add arguments to set a threshold and ignore-below 2020-04-11 14:35:27 +10:00
libinput-analyze-per-slot-delta.py tools/per-slot-delta: handle KeyboardInterrupts nicely 2021-03-10 00:24:51 +00:00
libinput-analyze-recording.man tools: add a tool to print a libinput recording as a table 2021-02-23 13:46:00 +10:00
libinput-analyze-recording.py tools/analyze-recording: improve the repeated-events line printing 2022-05-06 14:25:50 +10:00
libinput-analyze-touch-down-state.man tools: add a tool to analyze the finger count from a recording 2021-01-29 08:06:53 +10:00
libinput-analyze-touch-down-state.py tools: add a tool to analyze the finger count from a recording 2021-01-29 08:06:53 +10:00
libinput-analyze.c tools: add a libinput analyze command with the per-slot-delta subcommand 2020-03-16 08:35:43 +10:00
libinput-analyze.man tools: add a tool to print a libinput recording as a table 2021-02-23 13:46:00 +10:00
libinput-debug-events.c Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
libinput-debug-events.man touchpad: new option dwtp (disable-while-trackpointing) 2022-03-08 01:33:40 +00:00
libinput-debug-gui.c Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
libinput-debug-gui.man tools/debug-gui: draw a sprite for the unaccelerated pointer as well 2021-03-11 10:40:00 +10:00
libinput-debug-tablet.c util: auto-declare the element variable in ARRAY_FOR_EACH 2022-03-09 10:16:07 +10:00
libinput-debug-tablet.man tools: add a tablet debugging tool 2019-11-19 09:56:14 +10:00
libinput-list-devices.c touchpad: new option dwtp (disable-while-trackpointing) 2022-03-08 01:33:40 +00:00
libinput-list-devices.man libinput-list-devices: make paragraph about different settings terser 2019-10-28 05:40:02 +00:00
libinput-measure-fuzz.man touchpad: add a tool to measure the touchpad fuzz 2018-05-15 13:51:33 +10:00
libinput-measure-fuzz.py Use python black for all pyhon file formatting 2021-01-28 21:02:45 +00:00
libinput-measure-touch-size.man tools: touch-size: update to use the device quirks 2018-06-21 11:48:41 +10:00
libinput-measure-touch-size.py Use python black for all pyhon file formatting 2021-01-28 21:02:45 +00:00
libinput-measure-touchpad-pressure.man tools: make the thumb threshold configurable while measuring pressure 2020-03-30 14:45:19 +10:00
libinput-measure-touchpad-pressure.py Use python black for all pyhon file formatting 2021-01-28 21:02:45 +00:00
libinput-measure-touchpad-size.man Remove trailing whitespaces in the tree 2022-11-25 10:08:20 +10:00
libinput-measure-touchpad-size.py Use python black for all pyhon file formatting 2021-01-28 21:02:45 +00:00
libinput-measure-touchpad-tap.man treewide: fix typos 2020-12-16 22:08:23 +01:00
libinput-measure-touchpad-tap.py Use python black for all pyhon file formatting 2021-01-28 21:02:45 +00:00
libinput-measure.c libinput-measure.c: remove unused includes 2019-09-13 00:07:39 +03:00
libinput-measure.man tools: add a measure touchpad-size tool 2020-03-30 15:14:45 +10:00
libinput-quirks.c Remove a few empty lines with nothing but a lonely tab 2022-11-25 10:08:20 +10:00
libinput-quirks.man tools: rename list-quirks to the more generic "quirks list" 2018-07-03 15:16:59 +10:00
libinput-record-verify-yaml.py Use python black for all pyhon file formatting 2021-01-28 21:02:45 +00:00
libinput-record.c Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
libinput-record.man tools/record: add support for hidraw recording 2021-05-05 03:59:34 +00:00
libinput-replay.man tools/replay: do not replay key repeat events 2021-05-18 23:14:44 +00:00
libinput-replay.py tools/replay: do not replay key repeat events 2021-05-18 23:14:44 +00:00
libinput-test.c tools: add a libinput test tool as entry point for our test suites 2022-05-09 05:03:00 +00:00
libinput-test.man test: install libinput-test-utils as part of install-tests 2022-05-09 05:03:00 +00:00
libinput-tool.c tools: hide debug-gui help when building with -Ddebug-gui=false 2022-10-10 08:27:05 +02:00
libinput.man tools: add a libinput test tool as entry point for our test suites 2022-05-09 05:03:00 +00:00
make-ptraccel-graphs.sh tools: make-ptraccel-graphs: drop an unnecessary outfile 2018-07-11 16:04:59 +10:00
ptraccel-debug.c tools: fix a tab after space whitespace issue 2022-11-25 10:08:20 +10:00
shared.c quirks: allow overriding of AttrEventCode and AttrInputProp 2022-11-28 08:25:41 +10:00
shared.h touchpad: new option dwtp (disable-while-trackpointing) 2022-03-08 01:33:40 +00:00
test_tool_option_parsing.py touchpad: new option dwtp (disable-while-trackpointing) 2022-03-08 01:33:40 +00:00