mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-05-08 19:28:03 +02:00
Merge branch 'wip/t450-jumping-cursor-fixes'
This commit is contained in:
commit
f53d4f1f36
7 changed files with 119 additions and 15 deletions
|
|
@ -500,7 +500,8 @@ tp_gesture_post_events(struct tp_dispatch *tp, uint64_t time)
|
||||||
|
|
||||||
switch (tp->gesture.finger_count) {
|
switch (tp->gesture.finger_count) {
|
||||||
case 1:
|
case 1:
|
||||||
tp_gesture_post_pointer_motion(tp, time);
|
if (tp->queued & TOUCHPAD_EVENT_MOTION)
|
||||||
|
tp_gesture_post_pointer_motion(tp, time);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
|
|
|
||||||
|
|
@ -335,6 +335,7 @@ tp_process_absolute(struct tp_dispatch *tp,
|
||||||
tp_end_sequence(tp, t, time);
|
tp_end_sequence(tp, t, time);
|
||||||
break;
|
break;
|
||||||
case ABS_MT_PRESSURE:
|
case ABS_MT_PRESSURE:
|
||||||
|
t->pressure_delta = e->value - t->pressure;
|
||||||
t->pressure = e->value;
|
t->pressure = e->value;
|
||||||
t->dirty = true;
|
t->dirty = true;
|
||||||
tp->queued |= TOUCHPAD_EVENT_OTHERAXIS;
|
tp->queued |= TOUCHPAD_EVENT_OTHERAXIS;
|
||||||
|
|
@ -904,10 +905,7 @@ tp_need_motion_history_reset(struct tp_dispatch *tp)
|
||||||
if (tp->device->model_flags & EVDEV_MODEL_LENOVO_T450_TOUCHPAD) {
|
if (tp->device->model_flags & EVDEV_MODEL_LENOVO_T450_TOUCHPAD) {
|
||||||
if (tp->queued & TOUCHPAD_EVENT_MOTION) {
|
if (tp->queued & TOUCHPAD_EVENT_MOTION) {
|
||||||
if (tp->quirks.nonmotion_event_count > 10) {
|
if (tp->quirks.nonmotion_event_count > 10) {
|
||||||
struct tp_touch *t;
|
tp->queued &= ~TOUCHPAD_EVENT_MOTION;
|
||||||
|
|
||||||
tp_for_each_touch(tp, t)
|
|
||||||
t->dirty = false;
|
|
||||||
rc = true;
|
rc = true;
|
||||||
}
|
}
|
||||||
tp->quirks.nonmotion_event_count = 0;
|
tp->quirks.nonmotion_event_count = 0;
|
||||||
|
|
@ -949,6 +947,9 @@ tp_process_state(struct tp_dispatch *tp, uint64_t time)
|
||||||
if (!t->dirty)
|
if (!t->dirty)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (t->pressure_delta < -7)
|
||||||
|
tp_motion_history_reset(t);
|
||||||
|
|
||||||
tp_thumb_detect(tp, t, time);
|
tp_thumb_detect(tp, t, time);
|
||||||
tp_palm_detect(tp, t, time);
|
tp_palm_detect(tp, t, time);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,7 @@ struct tp_touch {
|
||||||
uint64_t millis;
|
uint64_t millis;
|
||||||
int distance; /* distance == 0 means touch */
|
int distance; /* distance == 0 means touch */
|
||||||
int pressure;
|
int pressure;
|
||||||
|
int pressure_delta;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
/* A quirk mostly used on Synaptics touchpads. In a
|
/* A quirk mostly used on Synaptics touchpads. In a
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,16 @@ static struct input_absinfo absinfo[] = {
|
||||||
{ .value = -1 }
|
{ .value = -1 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const char udev_rule[] =
|
||||||
|
"ACTION==\"remove\", GOTO=\"touchpad_end\"\n"
|
||||||
|
"KERNEL!=\"event*\", GOTO=\"touchpad_end\"\n"
|
||||||
|
"ENV{ID_INPUT_TOUCHPAD}==\"\", GOTO=\"touchpad_end\"\n"
|
||||||
|
"\n"
|
||||||
|
"ATTRS{name}==\"litest SynPS/2 Synaptics TouchPad X1C3rd\","
|
||||||
|
" ENV{LIBINPUT_MODEL_LENOVO_T450_TOUCHPAD}=\"1\"\n"
|
||||||
|
"\n"
|
||||||
|
"LABEL=\"touchpad_end\"";
|
||||||
|
|
||||||
struct litest_test_device litest_synaptics_carbon3rd_device = {
|
struct litest_test_device litest_synaptics_carbon3rd_device = {
|
||||||
.type = LITEST_SYNAPTICS_TRACKPOINT_BUTTONS,
|
.type = LITEST_SYNAPTICS_TRACKPOINT_BUTTONS,
|
||||||
.features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON,
|
.features = LITEST_TOUCHPAD | LITEST_CLICKPAD | LITEST_BUTTON,
|
||||||
|
|
@ -125,4 +135,5 @@ struct litest_test_device litest_synaptics_carbon3rd_device = {
|
||||||
.id = &input_id,
|
.id = &input_id,
|
||||||
.events = events,
|
.events = events,
|
||||||
.absinfo = absinfo,
|
.absinfo = absinfo,
|
||||||
|
.udev_rule = udev_rule,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1494,23 +1494,39 @@ litest_touch_move_extended(struct litest_device *d,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
litest_touch_move_to(struct litest_device *d,
|
litest_touch_move_to_extended(struct litest_device *d,
|
||||||
unsigned int slot,
|
unsigned int slot,
|
||||||
double x_from, double y_from,
|
double x_from, double y_from,
|
||||||
double x_to, double y_to,
|
double x_to, double y_to,
|
||||||
int steps, int sleep_ms)
|
struct axis_replacement *axes,
|
||||||
|
int steps, int sleep_ms)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < steps - 1; i++) {
|
for (int i = 0; i < steps - 1; i++) {
|
||||||
litest_touch_move(d, slot,
|
litest_touch_move_extended(d, slot,
|
||||||
x_from + (x_to - x_from)/steps * i,
|
x_from + (x_to - x_from)/steps * i,
|
||||||
y_from + (y_to - y_from)/steps * i);
|
y_from + (y_to - y_from)/steps * i,
|
||||||
|
axes);
|
||||||
if (sleep_ms) {
|
if (sleep_ms) {
|
||||||
libinput_dispatch(d->libinput);
|
libinput_dispatch(d->libinput);
|
||||||
msleep(sleep_ms);
|
msleep(sleep_ms);
|
||||||
libinput_dispatch(d->libinput);
|
libinput_dispatch(d->libinput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
litest_touch_move(d, slot, x_to, y_to);
|
litest_touch_move_extended(d, slot, x_to, y_to, axes);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
litest_touch_move_to(struct litest_device *d,
|
||||||
|
unsigned int slot,
|
||||||
|
double x_from, double y_from,
|
||||||
|
double x_to, double y_to,
|
||||||
|
int steps, int sleep_ms)
|
||||||
|
{
|
||||||
|
litest_touch_move_to_extended(d, slot,
|
||||||
|
x_from, y_from,
|
||||||
|
x_to, y_to,
|
||||||
|
NULL,
|
||||||
|
steps, sleep_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
||||||
|
|
@ -403,6 +403,13 @@ litest_touch_move_to(struct litest_device *d,
|
||||||
double x_from, double y_from,
|
double x_from, double y_from,
|
||||||
double x_to, double y_to,
|
double x_to, double y_to,
|
||||||
int steps, int sleep_ms);
|
int steps, int sleep_ms);
|
||||||
|
void
|
||||||
|
litest_touch_move_to_extended(struct litest_device *d,
|
||||||
|
unsigned int slot,
|
||||||
|
double x_from, double y_from,
|
||||||
|
double x_to, double y_to,
|
||||||
|
struct axis_replacement *axes,
|
||||||
|
int steps, int sleep_ms);
|
||||||
|
|
||||||
void
|
void
|
||||||
litest_touch_move_two_touches(struct litest_device *d,
|
litest_touch_move_two_touches(struct litest_device *d,
|
||||||
|
|
|
||||||
|
|
@ -3594,7 +3594,7 @@ START_TEST(touchpad_thumb_edgescroll)
|
||||||
libinput_dispatch(li);
|
libinput_dispatch(li);
|
||||||
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS);
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
|
|
||||||
litest_touch_move_to(dev, 0, 99, 55, 99, 70, 10, 0);
|
litest_touch_move_to_extended(dev, 0, 99, 55, 99, 70, axes, 10, 0);
|
||||||
|
|
||||||
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS);
|
litest_assert_only_typed_events(li, LIBINPUT_EVENT_POINTER_AXIS);
|
||||||
}
|
}
|
||||||
|
|
@ -3924,6 +3924,72 @@ START_TEST(touchpad_tool_tripletap_touch_count)
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST(touchpad_t450_motion_drops)
|
||||||
|
{
|
||||||
|
struct litest_device *dev = litest_current_device();
|
||||||
|
struct libinput *li = dev->libinput;
|
||||||
|
struct libinput_event *event;
|
||||||
|
struct libinput_event_pointer *ptrev;
|
||||||
|
int i;
|
||||||
|
double d;
|
||||||
|
|
||||||
|
/* In some areas on the touchpad we only get pressure events.
|
||||||
|
* https://bugs.freedesktop.org/show_bug.cgi?id=94379
|
||||||
|
*/
|
||||||
|
litest_drain_events(li);
|
||||||
|
|
||||||
|
litest_touch_down(dev, 0, 50, 50);
|
||||||
|
|
||||||
|
for (i = 0; i < 10; i++) {
|
||||||
|
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0);
|
||||||
|
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 3000 - i);
|
||||||
|
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 3000 - i);
|
||||||
|
litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 30);
|
||||||
|
litest_event(dev, EV_ABS, ABS_X, 3000 - i);
|
||||||
|
litest_event(dev, EV_ABS, ABS_Y, 3000 - i);
|
||||||
|
litest_event(dev, EV_ABS, ABS_PRESSURE, 30);
|
||||||
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||||
|
litest_drain_events(li);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* several pressure-only events */
|
||||||
|
|
||||||
|
for (i = 0; i< 20; i++) {
|
||||||
|
litest_event(dev, EV_ABS, ABS_MT_PRESSURE, 30 + i % 2);
|
||||||
|
litest_event(dev, EV_ABS, ABS_PRESSURE, 30 + i % 2);
|
||||||
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||||
|
litest_assert_empty_queue(li);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* a 100 unit jump followed by fine-grained motion, we expect small
|
||||||
|
* motions without the jump */
|
||||||
|
|
||||||
|
for (i = 0; i < 10; i++) {
|
||||||
|
litest_event(dev, EV_ABS, ABS_MT_SLOT, 0);
|
||||||
|
litest_event(dev, EV_ABS, ABS_MT_POSITION_X, 3100 + i);
|
||||||
|
litest_event(dev, EV_ABS, ABS_MT_POSITION_Y, 3100 + i);
|
||||||
|
litest_event(dev, EV_ABS, ABS_X, 3100 + i);
|
||||||
|
litest_event(dev, EV_ABS, ABS_Y, 3100 + i);
|
||||||
|
litest_event(dev, EV_ABS, ABS_PRESSURE, 30);
|
||||||
|
litest_event(dev, EV_SYN, SYN_REPORT, 0);
|
||||||
|
libinput_dispatch(li);
|
||||||
|
}
|
||||||
|
|
||||||
|
event = libinput_get_event(li);
|
||||||
|
ck_assert_notnull(event);
|
||||||
|
while (event) {
|
||||||
|
ptrev = litest_is_motion_event(event);
|
||||||
|
d = libinput_event_pointer_get_dx(ptrev);
|
||||||
|
litest_assert_double_lt(d, 1.0);
|
||||||
|
d = libinput_event_pointer_get_dy(ptrev);
|
||||||
|
litest_assert_double_lt(d, 1.0);
|
||||||
|
libinput_event_destroy(event);
|
||||||
|
|
||||||
|
event = libinput_get_event(li);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
START_TEST(touchpad_time_usec)
|
START_TEST(touchpad_time_usec)
|
||||||
{
|
{
|
||||||
struct litest_device *dev = litest_current_device();
|
struct litest_device *dev = litest_current_device();
|
||||||
|
|
@ -4075,6 +4141,7 @@ litest_setup_tests(void)
|
||||||
litest_add("touchpad:thumb", touchpad_thumb_tap_hold_2ndfg_tap, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH);
|
litest_add("touchpad:thumb", touchpad_thumb_tap_hold_2ndfg_tap, LITEST_CLICKPAD, LITEST_SINGLE_TOUCH);
|
||||||
|
|
||||||
litest_add_for_device("touchpad:bugs", touchpad_tool_tripletap_touch_count, LITEST_SYNAPTICS_TOPBUTTONPAD);
|
litest_add_for_device("touchpad:bugs", touchpad_tool_tripletap_touch_count, LITEST_SYNAPTICS_TOPBUTTONPAD);
|
||||||
|
litest_add_for_device("touchpad:bugs", touchpad_t450_motion_drops, LITEST_SYNAPTICS_TRACKPOINT_BUTTONS);
|
||||||
|
|
||||||
litest_add("touchpad:time", touchpad_time_usec, LITEST_TOUCHPAD, LITEST_ANY);
|
litest_add("touchpad:time", touchpad_time_usec, LITEST_TOUCHPAD, LITEST_ANY);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue