Commit graph

1342 commits

Author SHA1 Message Date
Peter Hutterer
c19e72f4af tools: don't call is_cancelled on a gesture begin event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-06 17:15:46 +10:00
Peter Hutterer
57702509dc touchpad: correct a comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-06 14:31:48 +10:00
Peter Hutterer
72ee17f622 Merge branch 'touchpad-gestures' 2015-07-06 14:11:38 +10:00
Peter Hutterer
31df68c1e4 libinput.sym: make the touchpad gestures part of the 0.20 API
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-06 14:10:48 +10:00
Peter Hutterer
89d3b7bc58 doc: add documentation for touchpad gestures
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-06 14:09:33 +10:00
Peter Hutterer
bca183ec8e tools: handle pinch event in event-gui
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-06 14:09:33 +10:00
Peter Hutterer
f3f2b312ea tools: add swipe support to the event-gui
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-06 14:09:33 +10:00
Peter Hutterer
a29155c9cb gestures: allow any gesture event type for gesture_get_dx/dy and get_angle
For start/end, dx/dy is always 0.0, and there is no need to make calling this
function for start/end a caller bug. It just unnecessarily complicates the
caller's codepath.

Same for get_angle

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-06 14:09:33 +10:00
Peter Hutterer
9b938d6591 gestures: check for valid types on the gesture event API
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-06 14:09:33 +10:00
Peter Hutterer
7f6fe7351d touchpad: split tp_gesture_stop into stop and cancel
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-06 14:09:33 +10:00
Hans de Goede
9fae0f8c3e touchpad: Allow querying whether a gesture ended normally or was cancelled
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2015-07-06 14:09:33 +10:00
Hans de Goede
ad26785f6a touchpad: Implement pinch gesture support
Implement touchpad pinch (and rotate) gesture support.

Note that two two-finger scrolling tests are slightly tweaked to assure that
there is enough touch movement to allow the scroll-or-pinch detect code to do
its work.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2015-07-06 14:09:33 +10:00
Hans de Goede
98b1e212ac touchpad: Extend the touchpad gesture API with pinch gestures
Extend the touchpad gesture API with pinch gestures. Note that this
new API offers a single event stream for both pinch and rotate data, this
is deliberate as some applications may be interested in getting both at
the same time. Applications which are only interested in one or the other
can simply ignore the other.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2015-07-06 14:09:27 +10:00
Hans de Goede
37c000ad5e touchpad: Add support for swipe gestures
Add support for swipe gestures.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2015-07-06 14:09:03 +10:00
Hans de Goede
b8a2e5bc5f touchpad: Add an API for touchpad gesture events
For touchscreens we always send raw touch events to the compositor, and the
compositor or application toolkits do gesture recognition. This makes sense
because on a touchscreen which window / widget the touches are over is
important context to know to interpret gestures.

On touchpads however we never send raw events since a touchpad is an absolute
device which primary function is to send pointer motion delta-s, so we always
need to do processing (and a lot of it) on the raw events.

Moreover there is nothing underneath the finger which influences how to
interpret gestures, and there is a lot of touchpad and libinput configuration
specific context necessary for gesture recognition. E.g. is this a clickpad,
and if so are softbuttons or clickfinger used? What is the size of the
softbuttons? Is this a true multi-touch touchpad or a semi multi-touch touchpad
which only gives us a bounding box enclosing the fingers? Etc.

So for touchpads it is better to do gesture processing in libinput, this commit
adds an initial implementation of a Gesture event API which only supports swipe
gestures, other gestures will be added later following the same model wrt,
having clear start and stop events and the number of fingers involved being
fixed once a gesture sequence starts.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2015-07-06 14:08:54 +10:00
Peter Hutterer
610e17a705 configure.ac: libinput 0.19.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-06 11:38:39 +10:00
Peter Hutterer
cd6326aa22 test: initialize syspath
When the condition with continue was hit, syspath was still compared in the
loop condition, leading to crashes when strcmp()-ing a random string.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-06 11:38:39 +10:00
Peter Hutterer
16b4dbac79 Add missing "global" tag to the 0.19 symbol block
Not required, but for consistency.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-06 11:23:04 +10:00
Peter Hutterer
2e339095b3 test: add a test for 0/0 relative motion events
This test doesn't really test for that because the kernel shouldn't forward
these events to us in the first place. It's merely a canary to warn us if this
ever changes and we end up not ignoring the events.

The test is only run for one device (the default mouse), no need to waste more
time on this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-03 09:44:04 +10:00
Peter Hutterer
08fba7bd96 test: add a test for minimum motion movement
The first motion on a device must have the mimimum movement factor (0.3)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-03 09:44:04 +10:00
Peter Hutterer
a1feb44836 test: send a single motion event for relative tests only
Since 69449ca854, the minimum deceleration is 0.3 and we don't get a 0 motion
event anymore. We can drop the helper function now too.

What we do in that test instead is pump one relative motion event through
before we start comparing the events, this way our second, third, .. events
will have some acceleration applied and the tests compare more accurate
values.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-03 09:44:04 +10:00
Peter Hutterer
261c779f1c test: add some tests for udev tagging
We can't easily test for DMI matches, but anything that hooks onto pid/vid is
easy to verify for correctness.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-03 09:44:04 +10:00
Peter Hutterer
676be4b944 test: use poll instead of a busy wait
Drop the busy loop we had waiting for an event to appear and just call poll on
the libinput fd.

This actually makes the tests more correct, if we now time out where we didn't
before it means we're not setting the timers correctly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-02 16:10:41 +10:00
Peter Hutterer
97f447d670 test: up the default test timeout to 10s
3s is too easy to hit on congested systems. 10s is overkill, but it's still
better to pass a test late than having to restart the whole test-suite again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-02 16:09:13 +10:00
Peter Hutterer
79b7707d76 test: wait for the uinput_monitor on test devices
Set up a udev_monitor before each device creation and wait for the monitor to
notify us of the newly created device. This should take the place of the
various sleep loops  we currently have sprinkled around the code and provide a
reliability when testing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-02 16:08:56 +10:00
Peter Hutterer
67ebcc3b8a Merge branch 'drop-pointer-normalization' 2015-07-02 13:06:18 +10:00
Peter Hutterer
3928f32281 filter: add a custom low-dpi acceleration
Motion normalization does not work well for devices below the default 1000dpi
rate. A 400dpi mouse's minimum movement generates a 2.5 normalized motion,
causing it to skip pixels at low speeds even when unaccelerated.

Likewise, we don't want 1000dpi mice to be normalized to a 400dpi mouse, it
feels sluggish even at higher acceleration speeds.
Instead, add a custom acceleration method for lower-dpi mice. At low-speeds,
one device unit results in a one-pixel movement. Depending on the DPI factor,
the acceleration kicks in earlier and goes to higher acceleration so faster
movements with a low-dpi mouse feel approximately the same as the same
movement on a higher-dpi mouse.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-02 13:03:43 +10:00
Peter Hutterer
4df1a9b66e tools: add --dpi= arg to ptraccel-debug
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-02 13:03:43 +10:00
Peter Hutterer
40dab334ab filter: pass the DPI to the acceleration filter
Currently unused, but store the ratio of DPI:default DPI for later use.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-02 13:03:43 +10:00
Peter Hutterer
92e415eadd test: add a low-dpi mouse test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-02 13:03:43 +10:00
Peter Hutterer
c06d825c53 Drop motion normalization of unaccelerated deltas
This simply doesn't work for low-dpi mice. Normalizing a 400dpi mouse to a
1000dpi mouse forces a minimum movement of 2.5 units and the resulting pixel
jumps. It is impossible for the caller to detect whether the jump was caused
by a single motion or multiple motion events.

This is technically an API break, but not really.

The accelerated data was already relatively meaningless, even if normalized as
the data did not correspond predictably to any input motion (unless you know
the implementation acceleration function in the caller). So we can drop the
mention from there without expecting any ill effects in the caller.

The unaccelerated data was useless for low-dpi mice and could only be used to
measure the physical distance of the mouse movement - something not used in
any caller we're aware of (if needed, we can add that functionality as a
separate call). Dropping motion normalization for unaccelerated deltas also
restores true dpi capabilities to users of that API, mostly games that want to
make use of high-dpi mice.

This is a simplified patch, the normalization is still in place for most of
libinput, it merely carries the original coordinates in the event itself.

In the case of touchpads, the coordinates are unnormalized into the x-axis
coordinate space as per the documentation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-02 13:03:43 +10:00
Peter Hutterer
6ea69c2b3d filter: reduce deceleration to minimal speeds only
Deceleration at low speeds is intended to enhance precision when moving the
pointer slowly. However, the adaptive deceleration we used was badly
calibrated, at slow-but-normal speeds the pointer became too slow to manouver.

We don't want to drop deceleration completely, the subpixel precision it
provides is useful. And it also helps those that can't move a 1000dpi mouse by
exactly one unit.

Make the adaptive deceleration steeper so it only kicks in at extremely slow
motions and defaults to 1 at anything resembling normal movement (i.e. pointer
moves like the physical device does).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-02 13:03:43 +10:00
Peter Hutterer
2285217ae1 udev: make a note that hwdb matches are exclusive
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-01 11:13:46 +10:00
Peter Hutterer
a851415c61 test: add the warning to the rules file too
The rules file in /run may be left over after an unclean exit and mess with
things.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-01 11:13:46 +10:00
Peter Hutterer
f0c8286ae8 touchpad: disable trackpoint palm detection on small touchpads
Tested on three laptops here, Lenovo T61, X220 and an HP EliteBook (?), all
with small touchpads. It's hard to have a hand position where the palm touches
the touchpad while using the trackpoint. So we might as well save us the
effort of monitoring events and enabling/disabling it on demand.

As a side-effect this fixes 1233844, but that's more a coincidence.
https://bugzilla.redhat.com/show_bug.cgi?id=1233844

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-01 08:57:18 +10:00
Peter Hutterer
eb4bd799de touchpad: improve trackpoint palm detection responsiveness
The touchpad is disabled for 500ms after a trackpoint event to avoid
erroneous palm touches. This is currently refreshed on every trackpoint event
and thus forces a delay of 500ms when switching between the two.

Instead, reduce the timeout to 300ms but ignore any touches started while the
trackpoint was active (i.e. before the last trackpoint event). A touch started
after the last event is released once the timeout expires.

This is the same logic used for disable-while-typing.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-01 08:57:18 +10:00
Peter Hutterer
081b6b3dff touchpad: always set touch->palm.time on touch begin
We will use this outside of DWT, so set it unconditionally on touch begin.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-01 08:57:18 +10:00
Peter Hutterer
c82ec173bb touchpad: move trackpoint timer stuff into the palm struct
No functional changes, just rearranging where it fits better.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-01 08:57:18 +10:00
Peter Hutterer
c0ef2a172a test: increase the udev init timeout
Hitting this limit too often on congested VMs, so let's increase the sleep
sleep (so the system can get done what needs to be done) and get the whole
timeout from 600ms to 2000ms.

Note: if we really hit 2000ms we may still fail on some tests with the check's
default 3 second timeout.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-01 08:56:54 +10:00
Peter Hutterer
44a1f07a57 evdev: evdev_fix_abs_resolution can be static
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-30 13:32:21 +10:00
Peter Hutterer
438ba0fec3 test: group the parser tests together
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-30 13:32:17 +10:00
Peter Hutterer
7cd6f9780d Add missing copyright header to the udev callout
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-30 13:32:14 +10:00
Peter Hutterer
b344e3e566 touchpad: disable tap drag lock by default
Similar to tapping, it's a feature that is useful but confusing if a user
doesn't know it exists. It makes the touchpad appear laggy and slow to react
in the best case, or appear like a stuck button in the worst case.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-29 07:52:41 +10:00
Peter Hutterer
0f623c75b3 Add missing @ingroup tag to the logging priority enum
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-26 14:51:16 +10:00
Peter Hutterer
68f94c6ba4 filter: use a tmp variable for the accel factor
No real effect, just makes the diff for debugging printfs smaller.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-26 11:10:29 +10:00
Peter Hutterer
c902b37a8d tools: don't drop the accelerated deltas in ptraccel-debug
Leftover from the initial (out-of-tree) implementation where we updated motion
in place. That hasn't been true since libinput switched to type-safe
coordinates.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-26 11:10:29 +10:00
Peter Hutterer
7ebb718ee9 evdev: move posting a trackpoint scroll event into a helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-26 11:10:28 +10:00
Peter Hutterer
ffaf1f3b72 evdev: log device's DPI setting if any
Makes debugging things easier.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-26 08:18:58 +10:00
Peter Hutterer
8302860451 evdev: read dpi before evdev_configure_device
So we can use to set up accel during evdev_configure_device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-26 08:15:28 +10:00
Peter Hutterer
0d2c25e123 evdev: store the device dimensions
We use width/height often enough that storing it once is better than
calculating it on each event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-26 06:46:32 +10:00