platform/upstream/libinput.git
9 years agoAdd a normalized_is_zero helper function
Hans de Goede [Tue, 24 Mar 2015 15:33:29 +0000 (16:33 +0100)]
Add a normalized_is_zero helper function

Add a normalized_is_zero helper function, and use it where applicable.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd a normalized_length helper function and use this where applicable
Hans de Goede [Tue, 24 Mar 2015 12:14:19 +0000 (13:14 +0100)]
Add a normalized_length helper function and use this where applicable

Add a normalized_length helper function and use this where applicable,
just a minor cleanup.

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>
9 years agoAdd a delta_coords type and use it were applicable
Hans de Goede [Tue, 24 Mar 2015 12:14:18 +0000 (13:14 +0100)]
Add a delta_coords type and use it were applicable

tp_normalize_coords is one of the last functions taking separate x, y
values rather a coordinate pair, this commit cleans this up.

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>
9 years agoFix scroll-threshold check for edge-scrolling to use normalized coordinates
Hans de Goede [Tue, 24 Mar 2015 12:14:17 +0000 (13:14 +0100)]
Fix scroll-threshold check for edge-scrolling to use normalized coordinates

The DEFAULT_SCROLL_THRESHOLD value is a TP_MM_TO_DPI_NORMALIZED value and as
such should be compared to a normalized value. But since commit 8101e43774
("touchpad: switch delta handling to typesafe coordinates"), the
initial_dx / initial_dy values initial_delta points to are no longer in
normalized coordinates, as the result of tp_normalize_delta is now stored
into the normalized value.

This commit changes the check to use the delta pointer which does point to
the normalized x/y values. While at it also use the zero variable to
set normalized to zero rather then manually setting x and y to 0.

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>
9 years agoconfigure.ac: libinput 0.13.0 0.13.0
Peter Hutterer [Tue, 24 Mar 2015 05:49:41 +0000 (15:49 +1000)]
configure.ac: libinput 0.13.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: reject devices with a min == max axis range
Peter Hutterer [Mon, 23 Mar 2015 02:08:14 +0000 (12:08 +1000)]
evdev: reject devices with a min == max axis range

Except for a few axes where this may be correct, a min == max axis range
indicates a broken kernel driver. To avoid potential divisions by zero when
scaling this axis later, reject such a device outright.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoRevert "touchpad: parse the TOUCHPAD_RESOLUTION property"
Peter Hutterer [Fri, 20 Mar 2015 01:09:05 +0000 (11:09 +1000)]
Revert "touchpad: parse the TOUCHPAD_RESOLUTION property"

This reverts commit 0e64837f30c310da878f28961a6db7c4bcd4f282.

Rather than a customized touchpad property, let udev handle this and set the
absinfo struct during the normal setup procedures. No need for libinput to
have a custom workaround here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotools: don't use deprecated gdk_cursor_new()
Peter Hutterer [Tue, 17 Mar 2015 23:44:09 +0000 (09:44 +1000)]
tools: don't use deprecated gdk_cursor_new()

Replaced by gdk_cursor_new_from_display() which means we need to tickle the
event until it spits out a GdkDisplay.

Deprecated in gdk 3.16

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add accel test for direction change
Peter Hutterer [Thu, 19 Mar 2015 01:43:49 +0000 (11:43 +1000)]
test: add accel test for direction change

Make sure that if we go in one direction, then change flip over to the other
direction we actually stop going into that direction, and the delta is lower
than whatever the previous delta was (i.e. acceleration resets).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agofilter: calculate the time delta correctly
Peter Hutterer [Thu, 19 Mar 2015 01:33:55 +0000 (11:33 +1000)]
filter: calculate the time delta correctly

If the delta is 0, the distance is the number of units (within this ms). Delta
1 means velocity across 2 ms, etc.

Bonus: this doesn't return infinite speed anymore if we get more than one
event per ms. This can happen on any device approaching 1000Hz poll rate, but
definitely got triggered by the test suite.

Actual effect was limited, since we cap out acceleration at max_accel we just
hit this earlier and it stayed there.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoSwitch vector_get_direction to use doubles
Peter Hutterer [Thu, 19 Mar 2015 01:10:37 +0000 (11:10 +1000)]
Switch vector_get_direction to use doubles

Delta movements on most slower movements are less than 1.0 per event, so we'd
end up with an undefined direction for all of them. This led to the velocity
being calculated across opposite movements rather than (as intended) across
movements within a shared octant.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agofilter: switch to normalized_coords
Peter Hutterer [Thu, 19 Mar 2015 01:02:51 +0000 (11:02 +1000)]
filter: switch to normalized_coords

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoRevert "touchpad: force a resolution onto the apple touchpads"
Peter Hutterer [Wed, 18 Mar 2015 00:01:03 +0000 (10:01 +1000)]
Revert "touchpad: force a resolution onto the apple touchpads"

This reverts commit d101d43dd0f7516167ec5d9964268f838a03cff1.

This commit was accidentally merged, it was sitting on top of the wip branch.
With the 0e64837f30c310da878f28961a6db7c4bcd4f282 commit this isn't necessary
anymore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: print available click methods on device notify
Peter Hutterer [Wed, 18 Mar 2015 00:01:03 +0000 (10:01 +1000)]
tools: print available click methods on device notify

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: force a resolution onto the apple touchpads
Peter Hutterer [Mon, 16 Mar 2015 04:13:43 +0000 (14:13 +1000)]
touchpad: force a resolution onto the apple touchpads

A large range of the Apple touchpads seem to have the same dimensions. Use
that fact to force-set a resolution.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: factor out setting up the MT slots/mtdev
Peter Hutterer [Tue, 17 Mar 2015 02:15:22 +0000 (12:15 +1000)]
evdev: factor out setting up the MT slots/mtdev

No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: parse the TOUCHPAD_RESOLUTION property
Peter Hutterer [Tue, 17 Mar 2015 00:16:13 +0000 (10:16 +1000)]
touchpad: parse the TOUCHPAD_RESOLUTION property

Not all touchpad kernel drivers supply the x/y resolution. Let the udev hwdb
fix this up where possible and read the value from it.

This is intentionally only used on touchpads, touchscreen devices without
resolution should be considered buggy and fixed in the kernel.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: refactor fake resolution setting
Peter Hutterer [Tue, 17 Mar 2015 00:07:00 +0000 (10:07 +1000)]
evdev: refactor fake resolution setting

Make the helper function accessible from other places (will be needed in an
upcoming patchset). This also now takes a custom resolution as argument
instead of always setting it to 1, and allows overriding a fake resolution
after the fact.

And instead of a hardcoded 1 everywhere, use a define for the resolution.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoPush the touchpad magic slowdown to the touchpad accel code
Peter Hutterer [Fri, 13 Mar 2015 03:56:14 +0000 (13:56 +1000)]
Push the touchpad magic slowdown to the touchpad accel code

This way the unaccelerated deltas returned by libinput are correct.

To maintain the current behavior we slow down the input speed by the magic
factor and likewise the accelerated output speed. This produces virtually the
same accelerated deltas as the previous code.

The magic factor is applied to the default denominator for guessing a
resolution based on the touchpad diagonal. We can't really get around this
without having a resolution from the touchpad; meanwhile this produces
virtually the same coordinates before/after.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: don't try to fix abs devices without x/y
Peter Hutterer [Tue, 17 Mar 2015 04:25:01 +0000 (14:25 +1000)]
evdev: don't try to fix abs devices without x/y

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: add evdev_reject_device to reject a couple of oddball devices
Peter Hutterer [Tue, 17 Mar 2015 02:41:13 +0000 (12:41 +1000)]
evdev: add evdev_reject_device to reject a couple of oddball devices

We really don't need to deal with devices that have x but not y or vice versa.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: fix android MT devices
Peter Hutterer [Tue, 17 Mar 2015 02:31:37 +0000 (12:31 +1000)]
evdev: fix android MT devices

These devices don't provide ABS_X/Y, but do have proper multitouch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: check for the fake_resolution boolean instead of a res value
Peter Hutterer [Tue, 17 Mar 2015 00:35:31 +0000 (10:35 +1000)]
touchpad: check for the fake_resolution boolean instead of a res value

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: simplify resolution check
Peter Hutterer [Mon, 16 Mar 2015 03:49:52 +0000 (13:49 +1000)]
touchpad: simplify resolution check

The struct evdev_device's absinfo_x/y point to the right axis

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: add missing break in default: switch case
Peter Hutterer [Mon, 16 Mar 2015 03:40:03 +0000 (13:40 +1000)]
touchpad: add missing break in default: switch case

Unneeded, but better for symmetry.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoStore unaccelerated delta as normalized_coords
Peter Hutterer [Wed, 11 Mar 2015 01:31:13 +0000 (11:31 +1000)]
Store unaccelerated delta as normalized_coords

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoAdd another data type for discrete coordinates
Peter Hutterer [Wed, 11 Mar 2015 01:30:02 +0000 (11:30 +1000)]
Add another data type for discrete coordinates

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoSplit deltas/absolute coords in pointer events to separate fields
Peter Hutterer [Wed, 11 Mar 2015 01:19:24 +0000 (11:19 +1000)]
Split deltas/absolute coords in pointer events to separate fields

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoUse typesafe coordinates in touch events
Peter Hutterer [Wed, 11 Mar 2015 00:48:54 +0000 (10:48 +1000)]
Use typesafe coordinates in touch events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoUse typesafe coords in motion events
Peter Hutterer [Wed, 11 Mar 2015 00:43:18 +0000 (10:43 +1000)]
Use typesafe coords in motion events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoUse typesafe coordinates for scrolling events
Peter Hutterer [Wed, 11 Mar 2015 00:36:44 +0000 (10:36 +1000)]
Use typesafe coordinates for scrolling events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: switch delta handling to typesafe coordinates
Peter Hutterer [Tue, 10 Mar 2015 23:58:11 +0000 (09:58 +1000)]
touchpad: switch delta handling to typesafe coordinates

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: switch touch point, hysteresis, initial coords to typesafe coords
Peter Hutterer [Tue, 10 Mar 2015 23:24:52 +0000 (09:24 +1000)]
touchpad: switch touch point, hysteresis, initial coords to typesafe coords

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: change motion history to typesafe coords
Peter Hutterer [Tue, 10 Mar 2015 23:10:13 +0000 (09:10 +1000)]
touchpad: change motion history to typesafe coords

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: start introducing some type-safety for device/normalized coordinates
Peter Hutterer [Tue, 10 Mar 2015 22:35:38 +0000 (08:35 +1000)]
evdev: start introducing some type-safety for device/normalized coordinates

Make it clear where we're dealing with device coordinates and where we're
dealing with DPI-normalized coordinates.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: add helper function to normalize delta coordinates
Peter Hutterer [Mon, 9 Mar 2015 05:51:12 +0000 (15:51 +1000)]
evdev: add helper function to normalize delta coordinates

No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agocosmetic: rename touch to t for consistency
Peter Hutterer [Tue, 10 Mar 2015 23:22:59 +0000 (09:22 +1000)]
cosmetic: rename touch to t for consistency

Everywhere else in the touchpad code we use "t" for the struct tp_touch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoAdd event type checking to the various libinput_event_ functions
Peter Hutterer [Fri, 13 Mar 2015 00:07:53 +0000 (10:07 +1000)]
Add event type checking to the various libinput_event_ functions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoReplace event type check switch statements with a helper macro/function
Peter Hutterer [Thu, 12 Mar 2015 23:32:37 +0000 (09:32 +1000)]
Replace event type check switch statements with a helper macro/function

The helper function now prints an error message if the event type passed is
not allowed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: abort() for invalid logging priorities
Peter Hutterer [Fri, 13 Mar 2015 00:11:41 +0000 (10:11 +1000)]
test: abort() for invalid logging priorities

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoExpand documentation on touch events, listing what is permitted when
Peter Hutterer [Thu, 12 Mar 2015 23:56:36 +0000 (09:56 +1000)]
Expand documentation on touch events, listing what is permitted when

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoCorrect documentation on get_slot and get_seat_slot()
Peter Hutterer [Thu, 12 Mar 2015 23:50:07 +0000 (09:50 +1000)]
Correct documentation on get_slot and get_seat_slot()

We don't actually use TOUCH_CANCEL in libinput, but either way calling the
slot on a cancel should be valid. Calling it on a FRAME event is not.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoCalling has_axis on a non-axis pointer event is a bug, note this
Peter Hutterer [Thu, 12 Mar 2015 23:38:48 +0000 (09:38 +1000)]
Calling has_axis on a non-axis pointer event is a bug, note this

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agolitest: Put fingers down closer together for 2fg scroll tests
Hans de Goede [Thu, 12 Mar 2015 19:05:26 +0000 (20:05 +0100)]
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>
9 years agolitest: Add a litest_touch_move_two_touches helper function
Hans de Goede [Thu, 12 Mar 2015 19:05:25 +0000 (20:05 +0100)]
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>
9 years agolitest: Make touchpad_2fg_scroll_slow_distance take resolution into account
Hans de Goede [Thu, 12 Mar 2015 19:05:24 +0000 (20:05 +0100)]
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>
9 years agotouchpad: Remove unnecessary edge scroll threshold variable
Hans de Goede [Mon, 9 Mar 2015 13:22:56 +0000 (14:22 +0100)]
touchpad: Remove unnecessary edge scroll threshold variable

Now that we've separate handling of the EDGE_NEW vs EDGE states in
tp_edge_scroll_post_events() we can drop the threshold variable, in EDGE_NEW
we always want to check against DEFAULT_SCROLL_THRESHOLD and in the EDGE
state we only want to make sure that the delta != 0.0 which is already
checked later on in tp_edge_scroll_post_events().

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>
9 years agotouchpad: accumulate the initial scroll edge delta
Peter Hutterer [Fri, 6 Mar 2015 04:36:31 +0000 (14:36 +1000)]
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>
9 years agotouchpad: annotate all coordinates that are in device coordinates
Peter Hutterer [Fri, 6 Mar 2015 02:35:56 +0000 (12:35 +1000)]
touchpad: annotate all coordinates that are in device coordinates

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: change tap motion threshold to 3 mm
Peter Hutterer [Tue, 3 Mar 2015 22:24:36 +0000 (08:24 +1000)]
touchpad: change tap motion threshold to 3 mm

Previous code used a device coordinate threshold of 300 which won't work on
Elantech touchpads (1280 vs the ~4000 that synaptics has).
Convert to normalized DPI and reduce the threshold to 3mm.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoMove DEFAULT_MOUSE_DPI to evdev.h, provide a conversion macro
Peter Hutterer [Fri, 6 Mar 2015 04:18:59 +0000 (14:18 +1000)]
Move DEFAULT_MOUSE_DPI to evdev.h, provide a conversion macro

Ideally we want to specify various thresholds in mm, but not all touchpads
set the hardware resolutions. Rather than conditions to check for resolutions
everywhere, use a macro to give us a normalized value that we use for motion
as well.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: return normalized deltas from tp_get_delta
Peter Hutterer [Thu, 5 Mar 2015 06:48:47 +0000 (16:48 +1000)]
touchpad: return normalized deltas from tp_get_delta

All callers except the tap motion threshold call
tp_get_delta() followed by tp_filter_motion() - the latter normalized it
before calling into the accleration code.

Move the normalization into tp_get_delta() so we don't deal with
device-specific coordinates but normalized deltas instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: fix/disable two tap test for semi-mt devices
Peter Hutterer [Thu, 5 Mar 2015 08:39:15 +0000 (18:39 +1000)]
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>
9 years agoconfigure.ac: libinput 0.12.0 0.12.0
Peter Hutterer [Tue, 3 Mar 2015 23:27:37 +0000 (09:27 +1000)]
configure.ac: libinput 0.12.0

And update the LT version instructions to not bump the soname in the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoSort exported symbols alphabetically
Peter Hutterer [Fri, 6 Mar 2015 05:51:49 +0000 (15:51 +1000)]
Sort exported symbols alphabetically

Alphabeting is hard...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoDrop libinput_device_has_button
Peter Hutterer [Wed, 4 Mar 2015 05:36:35 +0000 (15:36 +1000)]
Drop libinput_device_has_button

And merge all current API versions into the same block. This isn't technically
necessary since removing libinput_has_button from the code will remove it from
the exported list. That trips up test/symbols-leak-test though.

Since we break the API and bump the soname in this release anyway, move
to a single block so the initial stable API is all nicely grouped together.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: enable tapping by default on buttonless touchpads
Peter Hutterer [Wed, 4 Mar 2015 00:00:52 +0000 (10:00 +1000)]
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>
9 years agotouchpad: don't warn about clickpads without left buttons
Peter Hutterer [Tue, 3 Mar 2015 23:51:54 +0000 (09:51 +1000)]
touchpad: don't warn about clickpads without left buttons

Clickpads have BTN_LEFT but no BTN_RIGHT, non-clickpads must have both.
Tablet touch devices don't have any buttons, so skip the warning for those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add a Wacom Intuos 5 Finger test device
Peter Hutterer [Wed, 4 Mar 2015 00:27:22 +0000 (10:27 +1000)]
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>
9 years agotest: enable tapping before verifying correct tap events
Peter Hutterer [Wed, 4 Mar 2015 01:20:34 +0000 (11:20 +1000)]
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>
9 years agotest: add a button requirement to a couple of touchpad tests
Peter Hutterer [Wed, 4 Mar 2015 02:25:55 +0000 (12:25 +1000)]
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>
9 years agotest: split 3-finger tap-and-drag test
Peter Hutterer [Wed, 4 Mar 2015 02:24:09 +0000 (12:24 +1000)]
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>
9 years agotest: disable tapping for pure motion tests
Peter Hutterer [Wed, 4 Mar 2015 02:21:52 +0000 (12:21 +1000)]
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>
9 years agotest: disable tapping for palm detection tests
Peter Hutterer [Thu, 5 Mar 2015 02:17:14 +0000 (12:17 +1000)]
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>
9 years agocosmetic: more duplicate empty line removal
Peter Hutterer [Mon, 2 Mar 2015 06:48:51 +0000 (16:48 +1000)]
cosmetic: more duplicate empty line removal

This should be it now, finally...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agocosmetic: doxygen @return [a-z] -> @return [A-Z]
Peter Hutterer [Mon, 2 Mar 2015 01:47:02 +0000 (11:47 +1000)]
cosmetic: doxygen @return [a-z] -> @return [A-Z]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoA whole bunch of documentation updates/improvements
Peter Hutterer [Thu, 26 Feb 2015 08:43:01 +0000 (18:43 +1000)]
A whole bunch of documentation updates/improvements

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: ignore tablet pad devices explicitly
Peter Hutterer [Thu, 26 Feb 2015 05:52:41 +0000 (15:52 +1000)]
evdev: ignore tablet pad devices explicitly

We don't have real support for them yet but they have the ID_INPUT_TABLET tag
set. Ignore them explicitly before someone thinks they're already working.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-and-tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
9 years agotest: add protocol A touch screen tests
Peter Hutterer [Wed, 25 Feb 2015 06:30:06 +0000 (16:30 +1000)]
test: add protocol A touch screen tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: force-assign 10 slots to mtdev devices
Peter Hutterer [Wed, 25 Feb 2015 06:04:04 +0000 (16:04 +1000)]
evdev: force-assign 10 slots to mtdev devices

If the device doesn't have any slots, mtdev->caps.slot.maximum is 0. Since we
only use mtdev if we don't have slots, this caused protocol A devices to
always fail.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoClarify a comment, it's wheel clicks, not mouse clicks
Peter Hutterer [Fri, 20 Feb 2015 04:16:04 +0000 (14:16 +1000)]
Clarify a comment, it's wheel clicks, not mouse clicks

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Refactor tp_get_*_touches_delta
Hans de Goede [Tue, 17 Feb 2015 10:44:06 +0000 (11:44 +0100)]
touchpad: Refactor tp_get_*_touches_delta

The two tp_get_*_touches_delta functions are almost identical, refactor
them into one function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Do not use fake touches when getting the average touches delta
Hans de Goede [Tue, 17 Feb 2015 10:40:57 +0000 (11:40 +0100)]
touchpad: Do not use fake touches when getting the average touches delta

Only look at real touches when getting the average touches delta, otherwise
the touch used to populate the fake touches gets an unfair weighing factor.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Move gesture handling code to evdev-mt-touchpad-gestures.c
Hans de Goede [Tue, 17 Feb 2015 10:40:17 +0000 (11:40 +0100)]
touchpad: Move gesture handling code to evdev-mt-touchpad-gestures.c

Just moving some code around, no functional changes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Gesture support preparation
Hans de Goede [Mon, 16 Feb 2015 12:30:24 +0000 (13:30 +0100)]
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>
9 years agotouchpad: Add tp_get_average_touches_delta helper function
Hans de Goede [Mon, 16 Feb 2015 13:49:40 +0000 (14:49 +0100)]
touchpad: Add tp_get_average_touches_delta helper function

Add a tp_get_average_touches_delta helper function, and rename
tp_get_active_touches_delta to tp_get_combined_touches_delta to better
differentiate the two.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Also stop edge scrolling when the trackpoint becomes active
Hans de Goede [Mon, 16 Feb 2015 09:24:28 +0000 (10:24 +0100)]
touchpad: Also stop edge scrolling when the trackpoint becomes active

Not only stop 2fg scrolling, but also edge scrolling when the trackpoint
becomes active.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Change how we deal with scroll methods
Hans de Goede [Mon, 16 Feb 2015 09:16:30 +0000 (10:16 +0100)]
touchpad: Change how we deal with scroll methods

With the upcoming gesture support 2fg scrolling will be handled as part of
the main gesture state machine, whereas edge scrolling has its own state
machine, our current way of dispatching scroll "actions" does not play well
with this.

Change the scroll method handling to treat edge and 2fg scrolling as 2
separate state machines. The double scroll calls this introduces will mostly
be removed when the gesture handling code lands.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agocosmetic: drop more double empty lines
Peter Hutterer [Mon, 23 Feb 2015 03:49:10 +0000 (13:49 +1000)]
cosmetic: drop more double empty lines

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoconfigure.ac: libinput 0.11.0 0.11.0
Peter Hutterer [Sun, 22 Feb 2015 23:59:36 +0000 (09:59 +1000)]
configure.ac: libinput 0.11.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: document udev device tagging
Peter Hutterer [Mon, 23 Feb 2015 00:28:02 +0000 (10:28 +1000)]
doc: document udev device tagging

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: add missing space
Peter Hutterer [Mon, 23 Feb 2015 00:26:56 +0000 (10:26 +1000)]
doc: add missing space

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agocosmetic: fix a whitespace issue
Peter Hutterer [Sun, 22 Feb 2015 23:01:08 +0000 (09:01 +1000)]
cosmetic: fix a whitespace issue

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fix Coverity complaints
Peter Hutterer [Wed, 18 Feb 2015 21:22:59 +0000 (07:22 +1000)]
test: fix Coverity complaints

seat_button_count
seat_key_count ... uninitialized variable

t = zalloc
s = zalloc ... dereferencing potential NULL-pointer

d->ntouches_down... side-effect in assertion

Coverity run against the 0.10.0 tag, see
https://scan.coverity.com/projects/4298

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Christian Hartmann <cornogle@googlemail.com>
9 years agocosmetic: drop double empty lines
Peter Hutterer [Thu, 19 Feb 2015 01:38:04 +0000 (11:38 +1000)]
cosmetic: drop double empty lines

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoudev: fix a race condition if a device disappears before we get a handle
Peter Hutterer [Wed, 18 Feb 2015 03:36:44 +0000 (13:36 +1000)]
udev: fix a race condition if a device disappears before we get a handle

If the device disappears too quickly, the device is NULL, the sysname is NULL
and that causes a segfault in strcmp.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoRename noaccel to unaccel for consistency
Peter Hutterer [Tue, 17 Feb 2015 21:43:03 +0000 (07:43 +1000)]
Rename noaccel to unaccel for consistency

No functional changes, this affects the declaration only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: check the first parent of the event node for ID_INPUT tags
Peter Hutterer [Fri, 13 Feb 2015 01:40:19 +0000 (11:40 +1000)]
evdev: check the first parent of the event node for ID_INPUT tags

Bluetooth tablet devices' rules can't tag the event node directly, they can
only tag the first parent (the /sys/class/input/input1234 node). Check that
parent for tags too, lest we miss something important.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
9 years agoUse LIBINPUT_DEVICE_GROUP from udev as group identifier
Benjamin Tissoires [Mon, 9 Feb 2015 23:45:45 +0000 (18:45 -0500)]
Use LIBINPUT_DEVICE_GROUP from udev as group identifier

Store it as identifier in the device group, any two devices that have a
the same non-NULL identifier share the group.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd udev bits to assign LIBINPUT_DEVICE_GROUP
Peter Hutterer [Tue, 10 Feb 2015 04:23:32 +0000 (14:23 +1000)]
Add udev bits to assign LIBINPUT_DEVICE_GROUP

The easiest way to get a device group is by looking at the phys path of the
input device (which looks like usb-0000:00:14.0-1/input1) and dropping the
/inputX bit. The rest is the same for devices that belong together (except on
the Cintiq 22HD Touch).

Ideally we could just take ATTRS{phys} but we can't select substrings to drop
into ENV so we need to do it ourselves. This patch adds a callout that takes a
syspath and prints the mangled path, to be used in LIBINPUT_DEVICE_GROUP.

The rule triggers on any device that has a non-zero phys attribute, this
groups devices like tablets together but also devices like mice with multiple
interfaces.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
9 years agotools: print the device group in event-debug
Peter Hutterer [Tue, 10 Feb 2015 04:59:05 +0000 (14:59 +1000)]
tools: print the device group in event-debug

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
9 years agoAdd libinput_device_pointer_has_button over the plain has_button
Peter Hutterer [Fri, 13 Feb 2015 04:36:56 +0000 (14:36 +1000)]
Add libinput_device_pointer_has_button over the plain has_button

If a device has multiple capabilities, has_button is imprecise. A device with
tablet and pointer capability for example may have BTN_LEFT on the pointer
interface but not on the tablet interface.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoadd simple symbols leak checker
Marek Chalupa [Thu, 12 Feb 2015 14:25:36 +0000 (09:25 -0500)]
add simple symbols leak checker

This patch adds simple script that compares libinput.sym file to the
functions that are marked by LIBINPUT_EXPORT. This script is added
to make check target.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd two missing @ref tags
Peter Hutterer [Wed, 11 Feb 2015 03:48:34 +0000 (13:48 +1000)]
Add two missing @ref tags

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: add missing %s for accelerometer tagging
Peter Hutterer [Tue, 10 Feb 2015 06:05:04 +0000 (16:05 +1000)]
evdev: add missing %s for accelerometer tagging

Oh gcc warning, where are thou?

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: add a dot graph for device groups and two missing @refs
Peter Hutterer [Sun, 8 Feb 2015 23:45:33 +0000 (09:45 +1000)]
doc: add a dot graph for device groups and two missing @refs

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: switch to using udev's device tagging system
Peter Hutterer [Tue, 3 Feb 2015 02:21:19 +0000 (12:21 +1000)]
evdev: switch to using udev's device tagging system

Use ID_INPUT_FOO to assume a device is a FOO, don't decide ourselves based on
whatever bits are available. This moves the categorization out to udev's
input_id builtin by default and other bits that tag the device. libwacom tags
all known devices as ID_INPUT_TABLET and (for touch-enabled ones)
ID_INPUT_TOUCH - we can re-use that knowledge then.

Ignore anything that doesn't have ID_INPUT set, this provides for an easy way
of making devices "invisible" to libinput.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
9 years agoevdev: retrieve udev tags
Benjamin Tissoires [Mon, 2 Feb 2015 18:37:14 +0000 (13:37 -0500)]
evdev: retrieve udev tags

udev already tags the devices by opening each of them and analyzing their
features. We are basically re-doing this in libinput.

The advantage of udev tags over the plain heuristic from libinput is that
users (or driver writers) can force some tags that are not detected by
common rules. For instance, the pad part of the Wacom tablets is difficult
to discriminate from a joystick or a pointer.

For now we tread INPUT_ID_KEY and INPUT_ID_KEYBOARD as equivalent. It may
become necessary to separate them later.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
9 years agoREADME: Add the libinput component to the bugzilla URL
Peter Hutterer [Thu, 5 Feb 2015 22:58:55 +0000 (08:58 +1000)]
README: Add the libinput component to the bugzilla URL

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: document that we're ignoring position-less clicks
Peter Hutterer [Fri, 6 Feb 2015 04:32:05 +0000 (14:32 +1000)]
doc: document that we're ignoring position-less clicks

This can happen a lot easier on the new Lenovo series, so document that this
is intentional behavior.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>