Commit graph

30 commits

Author SHA1 Message Date
José Expósito
fbe5d35dca 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>
2021-12-02 12:00:52 +00:00
Peter Hutterer
234eeabe2f Replace fallthrough comments with __attribute__((fallthrough))
This has recently been endorsed by the linux kernel, it should be good
enough for us.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-07-22 23:14:43 +00:00
José Expósito
1f548864bc gestures: improve one finger hold detection
When one finger is used to hold, tiny pointer movement deltas can easily
end the gesture.

Add a movement threshold to avoid small movement, before or after the hold
timeout, ending the gesture and make the hold-to-interact user
interaction more reliable.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-06-10 01:07:19 +00:00
Peter Hutterer
a37d6dcc9c touchpad: if we have a right button, let's assume it's not a clickpad
This assumption dates back roughly a decade when INPUT_PROP_BUTTONPAD was
introduced into the kernel. To my knowledge, devices right now erroneously
advertise INPUT_PROP_BUTTONPAD when they are not a clickpad (but then they
have BTN_RIGHT) or they lack INPUT_PROP_BUTTONPAD (and only have BTN_LEFT).

So let's change our assumption here - if a clickpad has a right button log the
kernel bug and continue with the assumption the device is a touchpad with
physical buttons.

To disable that warning, fix the kernel or add an AttrInputPropDisable quirk
for the device.

Fixes #595

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-21 00:15:42 +00:00
Peter Hutterer
467266bbb4 touchpad: a touchpad with only one button is a clickpad
There is only one touchpad with a physical left button but no right button and
that is the old Apple touchpad, discontinued in 2008. Not a huge number of
those left, I assume.

So let's change our assumptions because these days the vast majority of
touchpads are clickpads - any touchpad that only has a left button is treated
as clickpad, even where the kernel doesn't set the INPUT_PROP_BUTTONPAD.

We do need to check for BTN_LEFT as well though, because Wacom touchpads (i.e.
the touch part of non-integrated Wacom tablets) don't have a left button
either.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-04-21 00:15:42 +00:00
JoseExposito
c71a1f4347 touchpad/clickfinger: limit middle click to 3 fingers
Don't middle click on clickpads with click method clickfinger when more than
3 fingers are used.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2021-04-06 05:10:32 +00:00
Peter Hutterer
d3115f4875 test: drop the custom group names
The group names are forced by check (they are called suite names there) but
for our test suite they provide very little benefit. Much easier to just
use the filename a test is in as group name.

This removes the pure substring match for --filter-group, it's now fnmatch
only. group names are short enough that the typing isn't an issue and we don't
want to run tests twice (e.g. 'pad' is also in 'touchpad').

This patch caused #574 until it got fixed in d838e3a3a4

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-02-12 15:24:15 +10:00
Peter Hutterer
8fdeba9ea2 test: wrap slot counting into a helper function
This is prep work for future devices that announce a wrong slot count. For the
tests this can be a problem if we rely on the correct slot count to decided
whether to run a test or not.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-29 15:58:49 +10:00
Peter Hutterer
b4fa301d1f test: simplify a slot count check
Smaller than 3 and greater or equal to 4 means - well, anything that's not 3.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-09 05:58:53 +00:00
Peter Hutterer
2f22580deb test: remove a useless assignment
copy/paste error that makes coverity unhappy. This is the code to correctly
release all touches and the buttons have already been processed above - no
need to reassign here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-30 10:43:18 +10:00
Matt Mayfield
73d55cc6c5 touchpad: don't allow gestures with a clickpad button down by a finger
Allowing gestures when holding a physical click enables tasks like
switching workspaces while dragging an icon, but this should only be
possible with a *thumb* holding down the clickpad, not fingers. This
commit restores the ability to hold down the clickpad with two or three
fingers to right- or middle-drag.

Fixes #339, #340

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-16 14:48:52 +10:00
Matt Mayfield
4536b5b38f touchpad: revamp thumb detection
Instead of a simple yes/no/maybe for thumbs, have a more extensive state
machine that keeps track of the thumb. Since we only support one thumb anyway,
the tracking moves to the tp_dispatch struct.

Test case changes:
touchpad_clickfinger_3fg_tool_position:
  with better thumb detection we can now handle this properly and expect a
  right button (2fg) press for the test case
touchpad_thumb_no_doublethumb_with_timeout:
  two thumbs are now always two fingers, so let's switch to axis events here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-17 09:33:14 +10:00
Peter Hutterer
865100310c test: don't form a pinch gesture for the clickfinger distance test
If the fingers are in the position in the current code, that's not a 3fg
click, that's a pinch. Let's use something more realistic.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-19 11:08:40 +10:00
Peter Hutterer
3c84d5c750 test: don't go into the thumb area for the 3fg clickfinger distance check
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-19 11:08:40 +10:00
Peter Hutterer
def787fe81 test: remove two spurious SYN_REPORTs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-19 11:08:40 +10:00
Peter Hutterer
9b18adc407 test: replace != NULL checks with ck_assert_notnull
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-15 08:42:15 +10:00
Peter Hutterer
e8625ef8d3 test: add a test for normal touchpad button presses
Probably covered elsewhere in a more generic test anyway but let's have one we
know is executed for all touchpads.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 15:09:44 +10:00
Peter Hutterer
7768d7d981 test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.

Cocinelle spatch files were variants of:
	@@
	expression A, B, C, D, E, F, G, H, I, J, K;
	@@

	- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
	+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)

The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 11:26:12 +10:00
Peter Hutterer
bdc7ef8bb2 test: change a few tests to use 10ms intervals
Change a number of tests to use 10ms intervals between finger events and fix
the coordinates up accordingly to avoid pointer jumps. This is in preparation
for a test-suite wide use of 10ms intervals.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 11:26:08 +10:00
Peter Hutterer
13bda5adcb touchpad: if a finger in the button area moves by more than 5mm, release it
The software button area is currently a partially-dead area. If the finger
moves into or out of the area pointer motion works. Finger motion within the
area however does not generate motion.

The main motivation for this was to avoid accidental pointer motion when a
button is pressed. This is required for stationary fingers but once you move a
significant distance, those bets are off.

So if the finger moves by more than 5mm from where it was put down, release it
and let it move the pointer.

The full impact is largely limited to horizontal movements within the button
area because:
- leaving the finger at the bottom area for 300ms without movement triggers
  the thumb identification, so it won't move anyway.
- moving the finger north is likely to go off the button area before we
  trigger this threshold.

https://gitlab.freedesktop.org/libinput/libinput/issues/86

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-13 13:36:40 +10:00
Peter Hutterer
cfa921250d touchpad: ignore palm touches when handling clickfingers
https://bugs.freedesktop.org/show_bug.cgi?id=104188

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-20 09:04:13 +10:00
Peter Hutterer
ce80e40006 test: move all the _setup() functions into a special section
This way we can loop through them instead of having to add them manually.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-23 10:17:52 +10:00
Peter Hutterer
3fea53c3a9 test: restore the non-debounced litest_button_click()
8cf6893 removed it to make search/replace easier, restore it for the tests
where we don't want debouncing to automatically be handled.

Still left in place are the various top software button cases. Because of the
button re-routing through the fallback interface we need those to be
debounced.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-20 11:31:56 +10:00
Peter Hutterer
8cf6893f6d test: replace litest_button_click with a debounced version
This is via a simple search & replace. Later auditing is needed to switch
clicks that should not be debounced (e.g. touchpads) back to a non-debounced
version.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-20 09:55:05 +10:00
Peter Hutterer
d698de6e68 touchpad: send a left button event when we move out of topbuttons and click
We used to completely ignore a finger that was within the top software button
area and then moved to the main area and remained there for a timeout. This
avoids erroneous pointer movements when the user moves the finger while using
the trackpoint.

But we also ignored physical clicks, something we should not be doing. This
patch fixes that behavior: we still ignore the finger for movement, but a
physical click now triggers a left click once we've been in the area for the
timeout.

This new behavior doesn't apply within the timeout, i.e. if a finger is in the
right top button area, moves out and immediately clicks, we still trigger a
right click. This avoids erroneous switches to left-clicks when the finger is
at the edge of the button area and moves out during the press.

Related to: https://bugs.freedesktop.org/show_bug.cgi?id=99212

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-04 13:43:35 +10:00
Peter Hutterer
c0dbd6eb38 touchpad: ignore hovering touches for the software button state
If a touch started hovering in the main area, the button state would start
with AREA and never move to the real button state, despite the finger
triggering the pressure thresholds correctly in one of the areas.

This could even happen across touch sequences if a touch went below pressure
in the software button area, it changed to hovering and the button state
changed to NONE. On the next event, the touch is still hovering and the
current position of the touch is taken for the button state machine.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-03-02 08:34:17 +10:00
Peter Hutterer
be30b28a12 Merge branch 'gcov-tests'
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-02-09 12:27:39 +10:00
Peter Hutterer
f2f616a1fc touchpad: mark the Apple onebutton touchpad as clickfinger-default
We don't initialize click methods on devices with physical buttons. This model
is a special case, it's not a clickpad but it only has one button (because one
button is all you ever need and whatnot).

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-02-09 09:26:07 +10:00
Peter Hutterer
6fded79d4b test: test click method setting on non-touchpads
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-02-06 11:03:43 +10:00
Peter Hutterer
5d66edc9f4 test: prefix all test source files with "test-"
They weren't originally prefixed but the various tests were, but now that we
only have one test runner binary anyway, the prefix helps sorting the files
easily within e.g. gcov results.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-16 08:59:00 +10:00
Renamed from test/touchpad-buttons.c (Browse further)