mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-24 19:20:05 +01:00
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 a37d6dcc9c:
"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>
This commit is contained in:
parent
0bd1560750
commit
fbe5d35dca
2 changed files with 14 additions and 32 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2098,29 +2098,6 @@ START_TEST(touchpad_non_clickpad_detection)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_clickpad_detection)
|
||||
{
|
||||
struct litest_device *dev;
|
||||
uint32_t methods;
|
||||
int codes[] = {
|
||||
INPUT_PROP_MAX, INPUT_PROP_BUTTONPAD,
|
||||
-1, -1,
|
||||
};
|
||||
|
||||
/* Create a device with LR buttons and INPUT_PROP_BUTTONPAD set - we
|
||||
* should ignore the property and assume it's a non-clickpad.
|
||||
* Only way to check that is to verify no click methods are set.
|
||||
*/
|
||||
dev = litest_create_device_with_overrides(LITEST_SYNAPTICS_TOUCHPAD,
|
||||
"litest Fake Clickpad",
|
||||
NULL, NULL, codes);
|
||||
|
||||
methods = libinput_device_config_click_get_methods(dev->libinput_device);
|
||||
ck_assert(methods == 0);
|
||||
litest_delete_device(dev);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
TEST_COLLECTION(touchpad_buttons)
|
||||
{
|
||||
struct range finger_count = {1, 4};
|
||||
|
|
@ -2191,6 +2168,5 @@ TEST_COLLECTION(touchpad_buttons)
|
|||
litest_add(clickpad_middleemulation_click_enable_while_down, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add(clickpad_middleemulation_click_disable_while_down, LITEST_CLICKPAD, LITEST_ANY);
|
||||
|
||||
litest_add_no_device(touchpad_clickpad_detection);
|
||||
litest_add_no_device(touchpad_non_clickpad_detection);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue