mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-04 16:40:13 +01:00
touchpad: move the tapping exclusion zone to the top edge of the button
We previously used the half-way mark of the touchpad's y axis to decide where
to ignore tapping. Move this down to the top edge of the software buttons
instead. Users may tap with a finger in the software button areas, on the rest
of the touchpad it's unlikely that they tap within 5% of the edge.
On touchpads with physical buttons or if clickfinger is enabled, the
no-tapping zone extends to the bottom of the touchpad. This required splitting
the tests into clickfinger, softbuttons and hardbuttons.
https://bugs.freedesktop.org/show_bug.cgi?id=93947
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 79139ebcd1)
This commit is contained in:
parent
fb0f8c6221
commit
86bd9bad66
3 changed files with 72 additions and 12 deletions
|
|
@ -530,9 +530,9 @@ tp_palm_tap_is_palm(struct tp_dispatch *tp, struct tp_touch *t)
|
|||
t->point.x < tp->palm.right_edge)
|
||||
return false;
|
||||
|
||||
/* We're inside the left/right palm edge and in the northern half of
|
||||
* the touchpad - this tap is a palm */
|
||||
if (t->point.y < tp->palm.vert_center) {
|
||||
/* We're inside the left/right palm edge and not in one of the
|
||||
* software button areas */
|
||||
if (t->point.y < tp->buttons.bottom_area.top_edge) {
|
||||
log_debug(tp_libinput_context(tp),
|
||||
"palm: palm-tap detected\n");
|
||||
return true;
|
||||
|
|
@ -1812,14 +1812,12 @@ static int
|
|||
tp_init_palmdetect(struct tp_dispatch *tp,
|
||||
struct evdev_device *device)
|
||||
{
|
||||
int width, height;
|
||||
int width;
|
||||
|
||||
tp->palm.right_edge = INT_MAX;
|
||||
tp->palm.left_edge = INT_MIN;
|
||||
tp->palm.vert_center = INT_MIN;
|
||||
|
||||
width = device->abs.dimensions.x;
|
||||
height = device->abs.dimensions.y;
|
||||
|
||||
/* Wacom doesn't have internal touchpads,
|
||||
* Apple touchpads are always big enough to warrant palm detection */
|
||||
|
|
@ -1834,7 +1832,6 @@ tp_init_palmdetect(struct tp_dispatch *tp,
|
|||
/* palm edges are 5% of the width on each side */
|
||||
tp->palm.right_edge = device->abs.absinfo_x->maximum - width * 0.05;
|
||||
tp->palm.left_edge = device->abs.absinfo_x->minimum + width * 0.05;
|
||||
tp->palm.vert_center = device->abs.absinfo_y->minimum + height/2;
|
||||
|
||||
tp->palm.monitor_trackpoint = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -320,7 +320,6 @@ struct tp_dispatch {
|
|||
struct {
|
||||
int32_t right_edge; /* in device coordinates */
|
||||
int32_t left_edge; /* in device coordinates */
|
||||
int32_t vert_center; /* in device coordinates */
|
||||
|
||||
bool trackpoint_active;
|
||||
struct libinput_event_listener trackpoint_listener;
|
||||
|
|
|
|||
|
|
@ -1031,7 +1031,7 @@ START_TEST(touchpad_palm_detect_no_palm_moving_into_edges)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_palm_detect_tap)
|
||||
START_TEST(touchpad_palm_detect_tap_hardbuttons)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
|
@ -1051,7 +1051,38 @@ START_TEST(touchpad_palm_detect_tap)
|
|||
litest_touch_up(dev, 0);
|
||||
litest_assert_empty_queue(li);
|
||||
|
||||
litest_touch_down(dev, 0, 5, 90);
|
||||
litest_touch_down(dev, 0, 5, 99);
|
||||
litest_touch_up(dev, 0);
|
||||
litest_assert_empty_queue(li);
|
||||
|
||||
litest_touch_down(dev, 0, 95, 99);
|
||||
litest_touch_up(dev, 0);
|
||||
litest_assert_empty_queue(li);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_palm_detect_tap_softbuttons)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
if (!touchpad_has_palm_detect_size(dev))
|
||||
return;
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
litest_enable_buttonareas(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
litest_touch_down(dev, 0, 95, 5);
|
||||
litest_touch_up(dev, 0);
|
||||
litest_assert_empty_queue(li);
|
||||
|
||||
litest_touch_down(dev, 0, 5, 5);
|
||||
litest_touch_up(dev, 0);
|
||||
litest_assert_empty_queue(li);
|
||||
|
||||
litest_touch_down(dev, 0, 5, 99);
|
||||
litest_touch_up(dev, 0);
|
||||
litest_assert_button_event(li,
|
||||
BTN_LEFT,
|
||||
|
|
@ -1061,7 +1092,7 @@ START_TEST(touchpad_palm_detect_tap)
|
|||
LIBINPUT_BUTTON_STATE_RELEASED);
|
||||
litest_assert_empty_queue(li);
|
||||
|
||||
litest_touch_down(dev, 0, 95, 90);
|
||||
litest_touch_down(dev, 0, 95, 99);
|
||||
litest_touch_up(dev, 0);
|
||||
litest_assert_button_event(li,
|
||||
BTN_LEFT,
|
||||
|
|
@ -1073,6 +1104,37 @@ START_TEST(touchpad_palm_detect_tap)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_palm_detect_tap_clickfinger)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
struct libinput *li = dev->libinput;
|
||||
|
||||
if (!touchpad_has_palm_detect_size(dev))
|
||||
return;
|
||||
|
||||
litest_enable_tap(dev->libinput_device);
|
||||
litest_enable_clickfinger(dev);
|
||||
|
||||
litest_drain_events(li);
|
||||
|
||||
litest_touch_down(dev, 0, 95, 5);
|
||||
litest_touch_up(dev, 0);
|
||||
litest_assert_empty_queue(li);
|
||||
|
||||
litest_touch_down(dev, 0, 5, 5);
|
||||
litest_touch_up(dev, 0);
|
||||
litest_assert_empty_queue(li);
|
||||
|
||||
litest_touch_down(dev, 0, 5, 99);
|
||||
litest_touch_up(dev, 0);
|
||||
litest_assert_empty_queue(li);
|
||||
|
||||
litest_touch_down(dev, 0, 95, 99);
|
||||
litest_touch_up(dev, 0);
|
||||
litest_assert_empty_queue(li);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(touchpad_left_handed)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
|
|
@ -3933,7 +3995,9 @@ litest_setup_tests(void)
|
|||
litest_add("touchpad:palm", touchpad_palm_detect_palm_becomes_pointer, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("touchpad:palm", touchpad_palm_detect_palm_stays_palm, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("touchpad:palm", touchpad_palm_detect_no_palm_moving_into_edges, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("touchpad:palm", touchpad_palm_detect_tap, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("touchpad:palm", touchpad_palm_detect_tap_hardbuttons, LITEST_TOUCHPAD, LITEST_CLICKPAD);
|
||||
litest_add("touchpad:palm", touchpad_palm_detect_tap_softbuttons, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add("touchpad:palm", touchpad_palm_detect_tap_clickfinger, LITEST_CLICKPAD, LITEST_ANY);
|
||||
litest_add("touchpad:palm", touchpad_no_palm_detect_at_edge_for_edge_scrolling, LITEST_TOUCHPAD, LITEST_CLICKPAD);
|
||||
|
||||
litest_add("touchpad:left-handed", touchpad_left_handed, LITEST_TOUCHPAD|LITEST_BUTTON, LITEST_CLICKPAD);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue