Commit graph

171 commits

Author SHA1 Message Date
Hans de Goede
db6f1b556a litest: Put fingers down closer together for 2fg scroll tests
The current default start location for the 2fg scroll tests: 47%, 50% and
53%, 50% are further than 3cm apart on the wacom-intuos-finger test device,
causing test failures when pinch gesture support gets added.

This fixes this, and also switches the fingers in the
touchpad_2fg_scroll_slow_distance and touchpad_trackpoint_buttons_2fg_scroll
tests to the default locations rather than putting them pretty far apart.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-13 11:29:48 +10:00
Hans de Goede
a8eb6c84a2 litest: Add a litest_touch_move_two_touches helper function
Currently all the touchpad 2fg tests move the 2 fingers 1 at a time,
causing a finger motion which looks more like a pinch zoom in followed by
a zoom out than an actual 2fg scroll gesture. Add a helper function which
can move 2 fingers at the same time (more or less), and use this where
relevant.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-13 11:28:36 +10:00
Hans de Goede
2ab0db9ee9 litest: Make touchpad_2fg_scroll_slow_distance take resolution into account
Currently touchpad_2fg_scroll_slow_distance always moves the touches 10% of
the touchpad height during the test.

On the wacom-intuos-finger test device this is a much larger distance then on
the synaptics test device, triggering ck_assert(axisval < 5.0) errors with
further patches in this set, this commit fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-13 11:28:11 +10:00
Peter Hutterer
1cebdc7a2b touchpad: accumulate the initial scroll edge delta
The previous setting of 10 wasn't 10 mm, it was used against the deltas
normalized to a 1000DPI mouse, i.e. closer to 4mm. It was also also per-event,
so a slow movement or a high-frequency touchpad can struggle to meet the
threshold.

Change the trigger to be ~5 mm from the initial touch down, accumulated until
we either meet the threshold or the timeout expires. The first scroll event
includes the delta since the touch down rather than the most recent delta.
This removes the delay otherwise seen in scrolling and makes the scroll motion
match the finger motion. This accumulated delta only applies when exceeding
the motion threshold, when the timeout triggers the switch to scrolling the
first delta posted is the current delta.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-10 07:09:23 +10:00
Peter Hutterer
37af67c666 test: fix/disable two tap test for semi-mt devices
On a semi-mt device lifting slot 0 before slot 1 makes slots 1 become slot 0
(with the matching coordinate jump), potentially triggering the tap movement
threshold.

On one test we can just swap the release order, the other test we need to
disable (the _inverted version of this test tests the other order anyway).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-10 07:09:23 +10:00
Peter Hutterer
9b865ba212 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>
2015-03-05 13:30:49 +10:00
Peter Hutterer
aa3d09932f test: add a Wacom Intuos 5 Finger test device
Works as a touchpad but has no buttons.

Minor change to one of the touchpad tests: because the touch area is so big
the slow-scrolling trigger needs to be adjusted.

And because the device is an external device, the "disable on external mouse"
test needs to be adjusted.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-05 13:30:49 +10:00
Peter Hutterer
f8fae70d0c test: enable tapping before verifying correct tap events
These tests make sure we don't get tapping events in certain situations
(finger movement, timeouts, ...). Tapping must be enabled for that to be a
valid test.

The tests can't work on semi-mt devices because we can't end slots
independently. Disable the tests there.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-05 13:30:49 +10:00
Peter Hutterer
8b633f9de3 test: add a button requirement to a couple of touchpad tests
If we send BTN_LEFT or similar, we need the LITEST_BUTTON capability on the
device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-05 13:30:49 +10:00
Peter Hutterer
5b9b662b2e test: split 3-finger tap-and-drag test
Split out into a btntool test and a true three-finger test. For consistency,
check the number of slots on all those tests rather than having
litest-device-specific exclusions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-05 13:30:49 +10:00
Peter Hutterer
19120ef96c test: disable tapping for pure motion tests
No effect, all devices currently have tapping disabled.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-05 13:30:48 +10:00
Peter Hutterer
13afa8e5c7 test: disable tapping for palm detection tests
The event sequences we use for plam detection trigger tap events if enabled by
default. Always disable tapping, a set of tests for tapping in the palm
exclusion zones. Arguably, tapping in the zones should be handled in a
separate set of tests though.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-05 13:30:48 +10:00
Hans de Goede
18887f90ee touchpad: Gesture support preparation
Handle everything which is not handled by the tap, (soft)button or edge-scroll
code/statemachines in a unified way. Everything is treated as a X-finger
gesture now, and the action to take on finger movement is decided by
the gesture.finger_count setting. Pointer control now simply is seen as a
1 finger gesture, and 2fg scrolling as a 2fg gesture.

This removed the need for special-casing things like switching back to
pointer mode when lifting a finger in 2fg scrolling mode, and also lays the
groundwork for adding 3+ fg gesture support.

Note that 1 test-case needs to be updated to wait for the finger mode
switching when switching mode while a gesture has already been started.
This is actually an improvement as this stops sending spurious pointer
motion events at the end of 2fg scrolling when not lifting both fingers at
exactly the same time.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-23 10:01:02 +01:00
Peter Hutterer
2840733978 cosmetic: drop more double empty lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-23 13:49:10 +10:00
Peter Hutterer
149f711fcc test: add tests for new lenovo touchpads
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-29 14:44:35 +10:00
Peter Hutterer
5c7f2a1949 tests: add a few clickfinger tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-16 10:34:24 +10:00
Peter Hutterer
5adf0aa2ad test: run clickfinger test for all clickpad-capable devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-16 10:34:24 +10:00
Peter Hutterer
fb451d4816 test: add tests for clickfinger defaults
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-16 10:34:24 +10:00
Peter Hutterer
09d07d5634 test: add another hover test
Release one touch point at the same time as a fake touch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-16 07:42:50 +10:00
Peter Hutterer
80fc33d66c test: add touchpad hover finger test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-16 07:42:50 +10:00
Stephen Chandler Paul
2af608cf02 Rename functions for left handed device configurations
Some devices require more than just flipping around the buttons, such as
tablets.
When it comes to devices like tablets, because the position of the palm rest is
on the right, the entire tablet has to be flipped around in order to be usable
by lefties. As such, this requires that we reverse the coordinates of the
tablets in addition to flipping the buttons on the tablet. As such, renaming
these functions so that they aren't specific to devices where only the buttons
are flipped seems appropriate.

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-15 10:17:57 +10:00
Peter Hutterer
1baf109b40 Change axis events to carry all directions
Sending separate axis events instead of one unified events is limiting,
especially when simultaneously scrolling in both directions and the caller
tries to implement kinetic scrolling.

Take a page from the tablet-support branch and instead implement the axis
event as a generic event that can contain multiple axes simultaneously.

Right now we only have two (scroll) axes and we could easily just check both
for non-zero values. If we want to allow further axes in the future, we need
a check whether an axis is set in an event, that's what
libinput_event_pointer_has_axis to scroll events() is for.

We also need the mask to notify of a scroll stop event, which could otherwise
be confused as a vertical-only or horizontal-only event.

This is an API and ABI break.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-13 13:54:21 +10:00
Peter Hutterer
20ac4b3abd Add pointer axis sources to the API
For a caller to implement/provide kinetic scrolling ("inertial scrolling",
"fling scrolling"), it needs to know how the scrolling motion was implemented,
and what to expect in the future. Add this information to the pointer axis
event.

The three scroll sources we have are:
* wheels: scrolling is in discreet steps, you don't know when it ends, the
  wheel will just stop sending events
* fingers: scrolling is continuous coordinate space, we know when it stops and
  we can tell the caller
* continuous: scrolling is in continuous coordinate space but we may or may not
  know when it stops. if scroll lock is used, the device may never technically
  get out of scroll mode even if it doesn't send events at any given moment
  Use case: trackpoint/trackball scroll emulation on button press

The stop event is now codified in the API documentation, so callers can use
that for kinetic scrolling. libinput does not implement kinetic scrolling
itself.

Not covered by this patch:
* The wheel event is currently defined as "typical mouse wheel step", this is
  different to Qt where the step value is 1/8 of a degree. Some better
  definition here may help.
* It is unclear how an absolute device would map into relative motion if the
  device itself is not controlling absolute motion.
* For diagonal scrolling, the vertical/horizontal terminator events would come
  in separately. The caller would have to deal with that somehow.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Original patch, before the rebase onto today's master:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-12-24 10:47:00 +10:00
Peter Hutterer
7779b25f80 test: add edge-scrolling tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-24 10:32:21 +10:00
Peter Hutterer
6028e126fe touchpad: revert to pointer movement when stopping twofinger scrolling
Add a boolean state machine for two-finger scrolling so we know when we're
currently scrolling. If we were scrolling and it stops, pick the active
touch as pointer touch so we can go back to pointer movement without having to
lift the finger off the touchpad.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-23 11:14:39 +10:00
Peter Hutterer
b74330255b test: switch tests to use the new helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-23 11:14:39 +10:00
Peter Hutterer
6138babc12 test: switch touch points around for semi-mt tap-n-drag testing
The tests ignored it when motion events never happened - but that's mostly
what these tests are about. This only happened for semi-mt devices that use
the bounding box only, not separate touch points. Switching the touch points
around that the bounding box doesn't interfere causes the test to work as
expected.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-23 11:14:39 +10:00
Peter Hutterer
8ae137789c test: fix busted indentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-18 14:21:28 +10:00
Jonas Ådahl
93eca929ae Introduce unaccelerated motion event vectors
For certain applications (such as FPS games) it is necessary to use
unaccelerated motion events (the motion vector that is passed to the
acceleration filter) to get a more natural feeling. Supply this
information by passing both accelerated and unaccelerated motion
vectors to the existing motion event.

Note that the unaccelerated motion event is not equivalent to 'raw'
events as read from devices.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-05 11:54:02 +10:00
Peter Hutterer
2bbf4a0117 evdev: use distance triggers to start scrolling
The previous code used delta/event as scroll trigger which roughly translates
to speed, but depends on the sampling rate of the device.

For slow two-finger motion, a user may move the height of the touchpad without
ever triggering scrolling. Change the _initial_ trigger to a cumulative
trigger, i.e. once the user moved past the threshold distance, scrolling
starts regardless of the speed.

Once scrolling is engaged, the original trigger of threshold/event is
required to engange the second scroll direction.

Note that except for really slow movements, it's very easy to engage both
scroll directions on a touchpad. This is intentional, libinput does not have
enough semantic knowledge to know if horizontal scrolling is needed. So we
provide some direction locking but not much, it's up to the
client/toolkit/widget to decide if both scroll directions should be handled.
Add a comment to clarify that in the public doc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-11-11 10:00:56 +10:00
Hans de Goede
6699d1b637 touchpad: Add a test for 2fg tap-n-drag release on a 3th finger down
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-11-06 11:04:17 +01:00
Hans de Goede
23031c8fd7 touchpad: Don't send scroll events during 2 finger tap-n-drag
The touchpad tap code explicitly supports 2 finger tap-n-drag, this commit
adds a test-case for this, which fails due to the 2 finger scrolling code
sending scroll events during a 2 finger tap-n-drag.

And this commit fixes the test-case, by not sending scroll events while a
tap-n-drag is active.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-11-06 11:04:17 +01:00
Hans de Goede
83fb3a89be touchpad: Make motion during tap-n-drag test take some time
The tap code will move individual touches to a state of TAP_TOUCH_STATE_DEAD
after a timeout. In case of tap-n-drag this should not have any influence,
make the litest_touch_move_to take long enough to trigger the timeout to
verify that this does not has any influence.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-11-06 11:04:17 +01:00
Hans de Goede
00f74270e5 litest: Add a sleep_ms parameter to litest_touch_move_to
In reality moving a touch from point to another takes time. In some cases
(when a timeout may trigger during the move, e.g. tap-n-drag on a touchpad),
this is important. Add a sleep_ms parameter, which will cause
litest_touch_move_to to sleep the specified amount of ms every step.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-11-06 11:04:17 +01:00
Peter Hutterer
9b9a6a75fa test: add some left-handed tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-26 10:17:41 +10:00
Peter Hutterer
e4adbff919 test: add helper functions for the two timers we care about
Rather than a random msleep() with a comment, use a helper function that
describes what we're waiting for. Also makes changing the timeouts easier in
the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-23 14:38:37 +10:00
Peter Hutterer
f73c28bf70 test: add tests for natural scrolling
2-finger scrolling only, we don't have anything else yet

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-23 10:54:23 +10:00
Hans de Goede
faa8764921 litest: Add litest_assert_scroll() helper function
Make check_2fg_scroll functionality available outside of touchpad.c ,
no functional changes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-19 15:49:06 +10:00
Peter Hutterer
504c7667e9 touchpad: fix tap-and-drag handling for timeouts
Doing a tap-and-drag gesture but just holding the finger instead of moving
should trigger a timeout and still switchin into tap-and-drag.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-18 11:30:15 +10:00
Peter Hutterer
84007034aa test: move assert_button_event to litest proper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-18 11:30:15 +10:00
Peter Hutterer
b9093ca2b1 test: fix a jumping touch movement
touch_move_to() should usually continue from the touch_down() location

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-17 13:31:42 +10:00
Jonas Ådahl
94c59ef201 touchpad: Only break out of tap FSM for clickpad button presses
It should be possible to initiate a drag by tapping-drag, but continue
it by pressing a physical button continuing to drag by subsequent finger
motions.

As the generic evdev layer helps us ignore multiple button presses we
can have the tap machine run completely separate from and uneffected by
regular physical button presses, making the tap FSM much simpler than
adding new states for handling button presse life times from outside
of the tap state machine.

A touchpad test is updated to test click while tapping instead of tap
FSM break out. The updated test is re-added but only for clickpads only.

The tap FSM svg is updated to say "clickpad button press" instead of
"phys button press".

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-02 10:14:11 +10:00
Peter Hutterer
d9cf649199 Use an enum to enable/disable tapping configuration
More expressive in the caller and less ambiguous about return values (is it 1?
is it non-zero? can it be negative?)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-22 08:19:29 +10:00
Peter Hutterer
cc36be302d test: add test for 3-finger tapping
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-21 20:20:49 +10:00
Peter Hutterer
0915c2c51a touchpad: always enable palm detection on apple touchpads
They don't set resolution so we can't calculate the size but we know they're
big enough to need palm detection.

And fix the descriptor for the bcm5974. For some reason this was advertising
synaptics coordinates. Fix it to represent (one of) the apple touchpads.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-21 20:20:45 +10:00
Peter Hutterer
f179c70bb5 test: touchpads are too small for palm if we can't get the dimensions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-07-21 16:27:05 +10:00
Peter Hutterer
858f009565 touchpad: don't init edge palm detection on touchpads less than 8cm across
On small touchpads, a touch that intends to go across the width of the
touchpad is likely to start in the edge zone. Likewise, on those touchpads the
chances of a palm event happening on the edge is small.

A minimum width of 8cm determined by an elaborate process of completely
unscientific guesswork: the x220 is roughly 7.5cm across and doesn't suffer
much from edge events, the T440s is 10cm across and definitely suffers from
it. So the trigger width likely somewhere in between which makes 8cm about as
valid as any other guess.

Note that this disables palm detection for resolution-less touchpads too - if
we don't know how big the touchpad is we can't know if palm detection on the
edges is necessary.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-21 08:56:12 +10:00
Peter Hutterer
b3c578521e touchpad: require a <45 degree movement for a palm to become a touch
Any legitimate finger movement that starts in the palm area is expected to
move out of the palm area at an angle roughly orthogonal to the edge of the
touchpad. Check for the direction of the movement vector, and if it is within
the accepted cardinal/ordinal directions then proceed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-21 08:56:12 +10:00
Peter Hutterer
9ecce8e2f7 touchpad: if a palm touch moves out of the edge zone within a timeout, unpalm
On small touchpads a touch that is intended to traverse much of the screen
width may start at the very edge, i.e. in the palm zone.
In that case, and if the touch moves out of the palm zone quickly enough, drop
the palm label and make it a normal touchpoint.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-21 08:56:12 +10:00
Peter Hutterer
ec7fc30ae2 touchpad: implement edge-based basic palm detection
A large part of palm events are situated on the far edges of the touchpad. In
a test run on a T440s while typing a long email all but 2 touch points were
located in the outer ~5% of the touchpad. Define a 5% exclusion zone on the
left and right edges in which new touchpoint is automatically assigned to be a
palm.

A finger may move into that exclusion zone without being marked as palm, it
just can't start in one.

On clickpads, the exclusion zone does not extend into the software buttons.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-21 08:56:12 +10:00