libinput/src
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
..
builddir.h Fix a few coverity complaints 2020-11-10 14:27:22 +10:00
evdev-debounce.c evdev: restart debouncing timers after every event 2021-05-19 12:24:59 +02:00
evdev-fallback.c evdev: use filter_dispatch_constant() for the lenovo trackpoint "wheel" 2022-09-08 09:03:15 +10:00
evdev-fallback.h evdev: use filter_dispatch_constant() for the lenovo trackpoint "wheel" 2022-09-08 09:03:15 +10:00
evdev-middle-button.c Use bit(foo) instead of (1 << foo) 2021-11-18 10:11:43 +10:00
evdev-mt-touchpad-buttons.c doc/user: add a page to troubleshoot right-click Clickpads 2022-03-28 23:25:26 +00:00
evdev-mt-touchpad-edge-scroll.c High-resolution scroll wheel support 2021-08-31 08:45:01 +02:00
evdev-mt-touchpad-gestures.c gestures: fix disambiguation between two finger pinch and scroll 2022-01-27 08:35:30 +01:00
evdev-mt-touchpad-tap.c Use bit(foo) instead of (1 << foo) 2021-11-18 10:11:43 +10:00
evdev-mt-touchpad-thumb.c Allow reviving a thumb that moves sufficiently 2021-05-19 05:12:58 +00:00
evdev-mt-touchpad.c Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
evdev-mt-touchpad.h touchpad: new option dwtp (disable-while-trackpointing) 2022-03-08 01:33:40 +00:00
evdev-tablet-pad-leds.c tablet-pad-leds: fix compiler warning when -Dlibwacom=false 2022-11-23 18:32:11 +01:00
evdev-tablet-pad.c util: auto-declare the element variable in ARRAY_FOR_EACH 2022-03-09 10:16:07 +10:00
evdev-tablet-pad.h [clang-tidy] fix inconsistent declarations 2020-08-27 01:00:31 -07:00
evdev-tablet.c tablet: increase touch arbitration rectangle height 2022-11-23 22:39:02 +00:00
evdev-tablet.h tablet: disable smoothing for AES devices 2020-11-25 03:54:47 +00:00
evdev-totem.c totem: separate X/Y resolution from touch size in discriminator 2021-02-09 13:52:20 +01:00
evdev-wheel.c evdev: use filter_dispatch_constant() for the lenovo trackpoint "wheel" 2022-09-08 09:03:15 +10:00
evdev.c quirks: allow overriding of AttrEventCode and AttrInputProp 2022-11-28 08:25:41 +10:00
evdev.h Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
filter-flat.c filter: apply the same factor for constant motion as for normal motion 2022-09-08 09:03:15 +10:00
filter-low-dpi.c filter: don't normalize the const filter approach 2022-09-08 09:03:15 +10:00
filter-mouse.c filter: don't normalize the speed again in the default mouse filter 2022-09-08 09:03:15 +10:00
filter-private.h filter: constify the interfaces and make them static 2022-09-08 09:03:15 +10:00
filter-tablet.c filter: constify the interfaces and make them static 2022-09-08 09:03:15 +10:00
filter-touchpad-flat.c Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
filter-touchpad-x230.c filter: constify the interfaces and make them static 2022-09-08 09:03:15 +10:00
filter-touchpad.c filter: constify the interfaces and make them static 2022-09-08 09:03:15 +10:00
filter-trackpoint-flat.c Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
filter-trackpoint.c Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
filter.c filter: localize a few variables 2022-09-08 09:03:15 +10:00
filter.h filter: add a flat trackpoint accel 2022-09-08 09:03:15 +10:00
libinput-git-version.h.in tools: add the git version in the libinput-record output 2018-03-06 14:22:30 +10:00
libinput-private-config.c gesutures: allow to configure hold gestures 2021-06-09 01:18:58 +00:00
libinput-private-config.h gesutures: allow to configure hold gestures 2021-06-09 01:18:58 +00:00
libinput-private.h Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
libinput-restore-selinux-context.sh meson: Fix absolute libdir case in install script 2018-02-16 16:57:30 +10:00
libinput-uninstalled.pc.in buildsystem: add missing uninstalled pkg-config infra 2016-08-30 17:18:39 +10:00
libinput-util.h Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
libinput-version.h.in COPYING: Update boilerplate from MIT X11 to MIT Expat license 2015-06-16 14:36:04 +10:00
libinput-versionsort.h Define the versionsort overrides as inlines 2021-07-28 12:50:11 +10:00
libinput.c touchpad: new option dwtp (disable-while-trackpointing) 2022-03-08 01:33:40 +00:00
libinput.h touchpad: new option dwtp (disable-while-trackpointing) 2022-03-08 01:33:40 +00:00
libinput.pc.in Add -lrt to the libs 2014-07-03 09:59:43 +10:00
libinput.sym touchpad: new option dwtp (disable-while-trackpointing) 2022-03-08 01:33:40 +00:00
path-seat.c Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
quirks.c quirks: allow overriding of AttrEventCode and AttrInputProp 2022-11-28 08:25:41 +10:00
quirks.h quirks: allow overriding of AttrEventCode and AttrInputProp 2022-11-28 08:25:41 +10:00
timer.c timer: only warn about timer expiry issues when we're more than 20ms behind 2021-12-07 11:54:08 +10:00
timer.h Use bit(foo) instead of (1 << foo) 2021-11-18 10:11:43 +10:00
udev-seat.c Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
udev-seat.h COPYING: Update boilerplate from MIT X11 to MIT Expat license 2015-06-16 14:36:04 +10:00
util-bits.h Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
util-input-event.h Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
util-list.c Split utility functions into separate source files 2019-09-11 12:23:04 +10:00
util-list.h Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
util-macros.h Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
util-matrix.h Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
util-prop-parsers.c quirks: allow overriding of AttrEventCode and AttrInputProp 2022-11-28 08:25:41 +10:00
util-prop-parsers.h quirks: allow overriding of AttrEventCode and AttrInputProp 2022-11-28 08:25:41 +10:00
util-ratelimit.c [clang-tidy] do not use else after return 2020-08-27 01:17:24 -07:00
util-ratelimit.h [clang-tidy] fix inconsistent declarations 2020-08-27 01:00:31 -07:00
util-strings.c Remove duplicate empty lines in our source 2022-11-25 10:08:20 +10:00
util-strings.h util: return the number of elements from strv_from_string 2022-11-07 22:32:24 +02:00
util-time.h util: auto-declare the element variable in ARRAY_FOR_EACH 2022-03-09 10:16:07 +10:00