touchpad: enable tapping by default on buttonless touchpads

This affects the touch device on graphics tablets.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Peter Hutterer 2015-03-04 10:00:52 +10:00
parent 5a4ada08fd
commit 9b865ba212
2 changed files with 33 additions and 5 deletions

View file

@ -688,8 +688,15 @@ tp_tap_config_is_enabled(struct libinput_device *device)
}
static enum libinput_config_tap_state
tp_tap_config_get_default(struct libinput_device *device)
tp_tap_default(struct evdev_device *evdev)
{
/**
* If we don't have a left button we must have tapping enabled by
* default.
*/
if (!libevdev_has_event_code(evdev->evdev, EV_KEY, BTN_LEFT))
return LIBINPUT_CONFIG_TAP_ENABLED;
/**
* Tapping is disabled by default for two reasons:
* * if you don't know that tapping is a thing (or enabled by
@ -702,6 +709,14 @@ tp_tap_config_get_default(struct libinput_device *device)
return LIBINPUT_CONFIG_TAP_DISABLED;
}
static enum libinput_config_tap_state
tp_tap_config_get_default(struct libinput_device *device)
{
struct evdev_device *evdev = (struct evdev_device *)device;
return tp_tap_default(evdev);
}
int
tp_init_tap(struct tp_dispatch *tp)
{
@ -712,6 +727,7 @@ tp_init_tap(struct tp_dispatch *tp)
tp->device->base.config.tap = &tp->tap.config;
tp->tap.state = TAP_STATE_IDLE;
tp->tap.enabled = tp_tap_default(tp->device);
libinput_timer_init(&tp->tap.timer,
tp->device->base.seat->libinput,

View file

@ -2169,8 +2169,6 @@ START_TEST(touchpad_tap_is_available)
struct litest_device *dev = litest_current_device();
ck_assert_int_ge(libinput_device_config_tap_get_finger_count(dev->libinput_device), 1);
ck_assert_int_eq(libinput_device_config_tap_get_enabled(dev->libinput_device),
LIBINPUT_CONFIG_TAP_DISABLED);
}
END_TEST
@ -2187,15 +2185,28 @@ START_TEST(touchpad_tap_is_not_available)
}
END_TEST
START_TEST(touchpad_tap_default)
START_TEST(touchpad_tap_default_disabled)
{
struct litest_device *dev = litest_current_device();
/* this test is only run on specific devices */
ck_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device),
LIBINPUT_CONFIG_TAP_DISABLED);
}
END_TEST
START_TEST(touchpad_tap_default_enabled)
{
struct litest_device *dev = litest_current_device();
/* this test is only run on specific devices */
ck_assert_int_eq(libinput_device_config_tap_get_default_enabled(dev->libinput_device),
LIBINPUT_CONFIG_TAP_ENABLED);
}
END_TEST
START_TEST(touchpad_tap_invalid)
{
struct litest_device *dev = litest_current_device();
@ -3364,7 +3375,8 @@ int main(int argc, char **argv) {
litest_add("touchpad:tap", touchpad_1fg_double_tap_click, LITEST_CLICKPAD, LITEST_ANY);
litest_add("touchpad:tap", touchpad_1fg_tap_n_drag_click, LITEST_CLICKPAD, LITEST_ANY);
litest_add("touchpad:tap", touchpad_tap_default, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:tap", touchpad_tap_default_disabled, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_ANY);
litest_add("touchpad:tap", touchpad_tap_default_enabled, LITEST_TOUCHPAD, LITEST_BUTTON);
litest_add("touchpad:tap", touchpad_tap_invalid, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:tap", touchpad_tap_is_available, LITEST_TOUCHPAD, LITEST_ANY);
litest_add("touchpad:tap", touchpad_tap_is_not_available, LITEST_ANY, LITEST_TOUCHPAD);