touchpad: drop motion hysteresis by default

Some older touchpad devices jitter a fair bit when a finger is resting on the
touchpad. That's why the hysteresis was introduced in the synaptics driver
back in 2011. However, the default value of the hysteresis in the synaptics
driver ended up being 0, even though the code looks like it's using a fraction
of the touchpad diagonal. When the hysteresis code was ported to libinput it
was eventually set to 0.5mm.

Turns out this is still too high and tiny finger motions are either
nonreactive or quite jumpy, making it hard to select small targets. Drop the
default hysteresis by reducing its margin to 0, but leave it in place for
those devices where we need them (e.g. the cyapa touchpads).

https://bugs.freedesktop.org/show_bug.cgi?id=93503

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 2016-01-29 16:25:31 +10:00
parent c352a50295
commit f6c2d4b8b5
4 changed files with 23 additions and 5 deletions

View file

@ -1951,13 +1951,29 @@ tp_init_default_resolution(struct tp_dispatch *tp,
return 0;
}
static inline void
tp_init_hysteresis(struct tp_dispatch *tp)
{
int res_x, res_y;
res_x = tp->device->abs.absinfo_x->resolution;
res_y = tp->device->abs.absinfo_y->resolution;
if (tp->device->model_flags & EVDEV_MODEL_CYAPA) {
tp->hysteresis_margin.x = res_x/2;
tp->hysteresis_margin.y = res_y/2;
} else {
tp->hysteresis_margin.x = 0;
tp->hysteresis_margin.y = 0;
}
}
static int
tp_init(struct tp_dispatch *tp,
struct evdev_device *device)
{
int width, height;
double diagonal;
int res_x, res_y;
tp->base.interface = &tp_interface;
tp->device = device;
@ -1971,8 +1987,6 @@ tp_init(struct tp_dispatch *tp,
if (tp_init_slots(tp, device) != 0)
return -1;
res_x = tp->device->abs.absinfo_x->resolution;
res_y = tp->device->abs.absinfo_y->resolution;
width = device->abs.dimensions.x;
height = device->abs.dimensions.y;
diagonal = sqrt(width*width + height*height);
@ -1981,8 +1995,7 @@ tp_init(struct tp_dispatch *tp,
EV_ABS,
ABS_MT_DISTANCE);
tp->hysteresis_margin.x = res_x/2;
tp->hysteresis_margin.y = res_y/2;
tp_init_hysteresis(tp);
if (tp_init_accel(tp, diagonal) != 0)
return -1;

View file

@ -1678,6 +1678,7 @@ evdev_read_model_flags(struct evdev_device *device)
{ "LIBINPUT_MODEL_ELANTECH_TOUCHPAD", EVDEV_MODEL_ELANTECH_TOUCHPAD },
{ "LIBINPUT_MODEL_APPLE_INTERNAL_KEYBOARD", EVDEV_MODEL_APPLE_INTERNAL_KEYBOARD },
{ "LIBINPUT_MODEL_CYBORG_RAT", EVDEV_MODEL_CYBORG_RAT },
{ "LIBINPUT_MODEL_CYAPA", EVDEV_MODEL_CYAPA },
{ NULL, EVDEV_MODEL_DEFAULT },
};
const struct model_map *m = model_map;

View file

@ -111,6 +111,7 @@ enum evdev_device_model {
EVDEV_MODEL_LENOVO_X220_TOUCHPAD_FW81 = (1 << 12),
EVDEV_MODEL_APPLE_INTERNAL_KEYBOARD = (1 << 13),
EVDEV_MODEL_CYBORG_RAT = (1 << 14),
EVDEV_MODEL_CYAPA = (1 << 15),
};
struct mt_slot {

View file

@ -73,6 +73,9 @@ libinput:name:Cypress APA Trackpad (cyapa):dmi:*svn*SAMSUNG*:pn*Lumpy*
libinput:name:Atmel maXTouch Touchpad:dmi:*svn*GOOGLE*:pn*Samus*
LIBINPUT_MODEL_CHROMEBOOK=1
libinput:name:Cypress APA Trackpad (cyapa):dmi:*
LIBINPUT_MODEL_CYAPA=1
##########################################
# LENOVO
##########################################