diff options
author | José Expósito <jose.exposito89@gmail.com> | 2021-12-02 12:52:56 +0100 |
---|---|---|
committer | José Expósito <jose.exposito89@gmail.com> | 2021-12-02 12:00:52 +0000 |
commit | fbe5d35dca88ae9a751623cbfa3b6ed2f012ec83 (patch) | |
tree | 7e3e74d4fba70d14a06c8c65d56f7d0982a5e16d /src | |
parent | 0bd1560750f7aa84cde173976e31c452586ec63b (diff) | |
download | libinput-fbe5d35dca88ae9a751623cbfa3b6ed2f012ec83.tar.gz |
touchpad: revert the clickpad detection mechanism
Use the previous heuristics to detect clickpads where a touchpad was
handled as a clickpad when:
- The property INPUT_PROP_BUTTONPAD is set
- The property INPUT_PROP_BUTTONPAD is NOT set but the touchpad only
has BTN_LEFT
Revert a37d6dcc9c2ec7ebd0d3609e01da1cfcec28db6e:
"touchpad: if we have a right button, let's assume it's not a clickpad"
MR: https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/614
BUG: https://gitlab.freedesktop.org/libinput/libinput/-/issues/595
Fix #704
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/evdev-mt-touchpad-buttons.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index 3ebb5f7a..b0b5ae8e 100644 --- a/src/evdev-mt-touchpad-buttons.c +++ b/src/evdev-mt-touchpad-buttons.c @@ -923,6 +923,7 @@ tp_guess_clickpad(const struct tp_dispatch *tp, struct evdev_device *device) { bool is_clickpad; bool has_left = libevdev_has_event_code(device->evdev, EV_KEY, BTN_LEFT), + has_middle = libevdev_has_event_code(device->evdev, EV_KEY, BTN_MIDDLE), has_right = libevdev_has_event_code(device->evdev, EV_KEY, BTN_RIGHT); is_clickpad = libevdev_has_property(device->evdev, INPUT_PROP_BUTTONPAD); @@ -934,19 +935,24 @@ tp_guess_clickpad(const struct tp_dispatch *tp, struct evdev_device *device) * single physical button * - Wacom touch devices have neither left nor right buttons */ - if (is_clickpad) { - if (has_right) { - evdev_log_bug_kernel(device, - "clickpad with right button, assuming it is not a clickpad\n"); - is_clickpad = false; - } - } else if (has_left && !has_right && - (tp->device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD_ONEBUTTON) == 0) { + if (!is_clickpad && has_left && !has_right && + (tp->device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD_ONEBUTTON) == 0) { evdev_log_bug_kernel(device, "missing right button, assuming it is a clickpad.\n"); is_clickpad = true; } + if (has_middle || has_right) { + if (is_clickpad) + evdev_log_bug_kernel(device, + "clickpad advertising right button\n"); + } else if (has_left & + !is_clickpad && + libevdev_get_id_vendor(device->evdev) != VENDOR_ID_APPLE) { + evdev_log_bug_kernel(device, + "non clickpad without right button?\n"); + } + return is_clickpad; } |