Commit graph

1259 commits

Author SHA1 Message Date
Peter Hutterer
f13fbc96e8 touchpad: make the hysteresis dependent on physical distance
Some touchpads, e.g. the Cyapa in the Acer c720 have a small axis range
([0, 870], [0, 470]), so the diagonal/magic value yields a hysteresis margin
of 1 device unit. On that device, that's one-tenth of a millimeter, causing
pointer motion just by holding the finger.

For touchpads that provide a physical resolution, set the hysteresis axes to
0.5mm and do away with the magic factor.

https://bugzilla.redhat.com/show_bug.cgi?id=1230441

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-15 10:50:25 +10:00
Peter Hutterer
452df0e8d3 Move Wacom touchpad tagging to the udev rules
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-12 08:53:57 +10:00
Peter Hutterer
59984fc40d Move apple touchpad tagging to the udev rules
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-12 08:53:57 +10:00
Peter Hutterer
96face60c2 test: always install our own udev rule/hwdb files for tests
We can't rely on the system having these files installed, at least not in the
latest version that we'd like.
Copy them over from the source directory into the /run/ and /etc/ directories
for each test and update udev and the hwdb. This ensures the tags we set in
the hwdb file are always set, regardless of the system configuration.

Note that the /run/udev/* files need to have a different filename to the ones
we ship to avoid getting overridden by local configuration.

systemd does not have support for /run/udev/hwdb.d [1]. So our hwdb.d file
is in /etc/udev/hwdb.d instead and marked them with a REMOVEME and a comment
that if that file is left after the tests, it should be removed by the user.

[1] https://github.com/systemd/systemd/issues/127

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-12 08:51:57 +10:00
JoonCheol Park
df78ed8ad6 test: add missing libunwind cflags to test-litest-selftest
Signed-off-by: JoonCheol Park <jooncheol@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-12 08:50:42 +10:00
Peter Hutterer
69449ca854 filter: require minimum acceleration factor of 0.3
For really slow motions, the previous acceleration factor would go down to
effectively zero. So the slower the mouse motion was, the more it would be
slowed down which made the mouse at low speeds almost unusable.

Cap the minimum acceleration at 0.3 which provides a predictable slow motion
for the cursor when high precision is required.

New/old acceleration functions comparison:

  ^
  |               /
  |              /
ty|    _________/
  |   / /
  |  / /
  | / /
  |/ /    <----- new minimum accel factor
  | /
  |/___________________>
      tx

i.e. the general shape is maintained, but it doesn't go to zero anymore. The
functions aren't parallel, the new shape is slightly flatter than the previous
one and they meet at the point where the functions flatten for the threshold
(tx/ty). ascii art has its limits...

https://bugzilla.redhat.com/show_bug.cgi?id=1227039

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-11 07:19:25 +10:00
Peter Hutterer
105e725602 touchpad: restart the motion filter on touch begin
Our motion filter takes the last couple of vectors to calculate speed,
provided the direction stays the same and it is within a certain timeout. It
does not take into account lifting the finger, so the velocity on the first
event is off.

Real-world impact is mainly on scrolling. Before commit 289e4675
	filter: enforce minimum velocity
the first motion on a scroll was accelerated by a factor of 0 and swallowed.
After 289e4675 the motion was calculated based on the timeout and a fraction
of the expected effect. Now the first scroll motion is based on the real
finger motion since setting the finger down and thus feels a bit more
responsive.

It also makes a couple of test cases using litest_assert_scroll() work again
since the miniumum motion is now as expected.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-11 07:19:25 +10:00
Peter Hutterer
d698f1b12f doc: make horizontal scrolling a separate section
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-10 07:56:57 +10:00
Peter Hutterer
91c4770ce6 doc: provide an outline of which scroll method is available where
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-10 07:56:05 +10:00
Peter Hutterer
d29f17190c doc: add a note that middle-button dragging is not possible on sticks
Just to have something to point bug reporters to.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-10 07:45:39 +10:00
Peter Hutterer
36753fae8f test: fix litest_log() when libunwind is missing
Previous expansion had side-effects when litest_log was called in an if
condition without {}

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-05 11:41:59 +10:00
Peter Hutterer
bd4f129a2a test: replace a strncmp call with strneq
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-05 11:31:33 +10:00
Peter Hutterer
a952acf1c2 touchpad: fix whitespace issue
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-05 10:10:56 +10:00
Peter Hutterer
3d2264ef28 configure.ac: libinput 0.17.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-04 10:20:38 +10:00
Peter Hutterer
8af1f4b085 touchpad: on non-resolution touchpads, use 30% as maximum clickfinger spread
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-03 14:43:58 +10:00
Peter Hutterer
df83144457 touchpad: impose maximum distance limits on clickfingers
A common use-case for clickfinger is to use the index finger for moving the
pointer, then triggering the click with a thumb. If the index finger isn't
lifted before the click this counted as two-finger click.

To avoid this, check the distance between touches on the touchpad (on
touchpads reporting resolution values anyway). If the touches are too far
apart, don't count them together (or specifically only count those close
enough together as multi-finger).

The touch area is uneven, it's wider than high. Spreading fingers horizontally
is more common and this also makes it easier to rule out thumbs which tend to
be well below the fingers.

http://bugs.freedesktop.org/show_bug.cgi?id=90526

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-03 14:43:58 +10:00
Peter Hutterer
b2a6ead992 touchpad: move clickfinger finger decision into a helper function
No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-03 14:43:58 +10:00
Peter Hutterer
75762a7c74 touchpad: replace hardcoded resolution > 1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-03 14:43:58 +10:00
Benjamin Tissoires
363ff3a52b evdev: remove direct checks for INPUT_PROP_POINTING_STICK
If we need to temporary override a device with ID_INPUT_POINTINGSTICK,
evdev sets the tag EVDEV_TAG_TRACKPOINT to the device. Rely on the tag
to behave properly for scroll emulation.

The dpi information should be retrieved after the device has been
configured or the tag EVDEV_TAG_TRACKPOINT was not set.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-03 09:30:32 +10:00
Benjamin Tissoires
a83fe757c3 evdev: remove tag_device from evdev_dispatch_interface
Tagging a device should occur only once during configure. We do not
have devices that can be changed after they are configured, so there is no
point in having the tagging part in a deferred struct.
Plus, the note saying that we tag with only one of EVDEV_TAG was wrong.

Now that we are chosing when we call each evdev_tag_*, we can also get
rid of the device->seat_caps tests.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-03 09:30:28 +10:00
Peter Hutterer
5b940e6a3f evdev: always default to the middle button for button-scrolling
The current code only defaulted to the middle button for those devices that
used button scrolling by default, requiring the user to enable button
scrolling _and_ set the button before it is active. This causes some
confusion.

There is no real benefit to leaving the button at 0 when the scroll
method isn't enabled anyway. So always default to the middle button (if
available).

https://bugzilla.redhat.com/show_bug.cgi?id=1227182

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-02 17:22:25 +10:00
Peter Hutterer
9d84dddf91 doc: add a graphic to explain tap-n-drag
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-02 15:47:33 +10:00
Peter Hutterer
b8518f8f7c touchpad: reduce tap-n-drag timeout to 300ms
The current 500ms is too long, reduce it to 300ms instead. This is still long
enough to get multiple movements but not that long that it feels like the
button is stuck.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-02 13:24:36 +10:00
Jon A. Cruz
edb69067ef test: check getcwd() and system() return values in litest
Added code to check for errors in getcwd() and system() that
were previously ignored and silently dropped.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-02 11:19:12 +10:00
Peter Hutterer
cd33b3611b Add a CODING_STYLE document
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-02 09:53:00 +10:00
Peter Hutterer
289e4675c8 filter: enforce minimum velocity
In the current code, a timeout or direction change on the first tracker will
result in a velocity of 0. Really slow movements will thus always be zero, and
the first event after a direction is swallowed.

Enforce a minimum velocity:
In the case of a timeout, assume the current velocity is that of
distance/timeout. In the case of a direction change, the velocity is simply
that since the last tracker.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-02 09:03:07 +10:00
Peter Hutterer
a81051e513 filter: up the motion timeout to 1 second
This timeout defines how far back in the events we search for velocity
calculations. For really slow movements, 300ms is not enough. It causes the
velocity to be 0 -> accel factor of 0 -> no movement.
As a result, really slow movement does not move the cursor.

Up the timeout to 1 second instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-02 09:03:07 +10:00
Peter Hutterer
578c4e81c2 filter: pass last_velocity as argument
Let the caller set the various fields, here we just calculate stuff.
No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-02 09:03:07 +10:00
Peter Hutterer
aaa7622933 evdev: use the button down time for no-scroll middle button press event
When we get the release event within the timeout, we send a press + release
event for the middle button. Rather than using the release event's timestamp
for both, remember and use the button press timestamp.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-02 09:01:18 +10:00
Peter Hutterer
0784218081 configure.ac: libinput 0.16.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-01 16:58:43 +10:00
Peter Hutterer
def69068a8 doc: add a FAQ page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-01 15:43:58 +10:00
Peter Hutterer
9883735c1c README: add two diagrams to outline the stack
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-01 15:43:36 +10:00
Peter Hutterer
fbead87edb COPYING: note that having linux/input.h in the tree does not make libinput GPL
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-01 15:43:33 +10:00
Jon A. Cruz
c388a7e2fe test: address gcc warnings on potentially uninitialized variables.
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-01 09:59:58 +10:00
Jon A. Cruz
96d4fa0364 Add xasprintf to avoid use of undefined pointer values
If asprintf fails for any reason, the contents of the pointer
are undefined. While some platforms set it to NULL, there is no
guarantee that all will.

This change adds a simple wrapper to ensure proper NULL results
on failure.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>

Added LIBINPUT_PRINTF attribute and the required declaration for it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-01 08:47:14 +10:00
Jon A. Cruz
3526940436 Add missing config.h includes
Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-01 08:20:59 +10:00
Peter Hutterer
ec468e8993 evdev: use the udev ID_INPUT_POINTINGSTICK property
Added in systemd 220, but note that for udev backwards compatibility, the
ID_INPUT_POINTINGSTICK tag is set in addition to the ID_INPUT_MOUSE tag.

And use that property to tag a device as trackpoint too, this allows temporary
workarounds for kernel bugs where the input prop isn't set yet.

https://bugzilla.redhat.com/show_bug.cgi?id=1225563

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-29 12:23:05 +10:00
Peter Hutterer
742b5ccbfb test: add another wait loop for udev
Wait after deleting a device so udev can catch up with everything and the
various hooks to make sure it's happy with any newly created devices after
this.

The sleep is in the delete path to also cover the tests where we manually
create uinput devices rather than using the litest hooks.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-29 12:23:05 +10:00
Peter Hutterer
a4313f13e3 touchpad: check touchpad for basic features we expect
If a relative device is tagged by udev as ID_INPUT_TOUCHPAD we need to
catch this before we try to dereference device->abs.absinfo_x.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-29 12:23:05 +10:00
Peter Hutterer
d8208940e0 tools: print symbolic key names too from event-debug
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-29 12:23:05 +10:00
Peter Hutterer
887895c1c1 test: don't abort if the device filter filtered all devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-28 13:33:54 +10:00
Peter Hutterer
767c1691cd README: spice up the readme a bit
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-28 11:57:34 +10:00
Peter Hutterer
e3673cc346 doc: improve the T440 documentation a bit
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-28 11:55:59 +10:00
Peter Hutterer
182290c154 doc: add illustrations for clickfinger and software button behavior
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-28 11:16:29 +10:00
Peter Hutterer
2af226f893 doc: add a blurb about scroll sources to the scrolling docs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-28 10:00:01 +10:00
Peter Hutterer
969d19dd22 Update Red Hat's copyright
Updated to 2015 where appropriate, added where missing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-28 09:58:11 +10:00
Peter Hutterer
9f584fcd5b touchpad: add missing break statement
No effect since it was the last case, but it's more correct.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-28 09:58:08 +10:00
Peter Hutterer
0dc058a0c7 touchpad: touches after the last key press can be released
The current code labels a touch as palm if it started within the typing
timeouts. To move the pointer even after the timeout expires, a user has to
lift the finger which is quite annoying and different to the old synaptics
driver behaviour (which had a simple on/off toggle on whether to let events
through or not).

Be smarter about this: if a touch starts _after_ the last key press event,
release it for pointer motion once the timeout expires. Touches started before
the last key press remain labelled as palms. This makes it possible to rest
the palm on the touchpad while typing without getting interference but also
provides a more responsive UI when moving from typing to using the touchpad
normally.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-05-27 17:38:25 +10:00
Peter Hutterer
f85a46b661 touchpad: don't enable edge palm detection on Wacom touchpads
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-05-27 17:38:25 +10:00
Peter Hutterer
6d0d36fd47 touchpad: reset the touch state when edge scrolling is stopped
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-05-27 17:38:25 +10:00