platform/upstream/libinput.git
9 years agotouchpad: make tp_estimate_delta return fractions
Hans de Goede [Fri, 18 Jul 2014 09:06:39 +0000 (11:06 +0200)]
touchpad: make tp_estimate_delta return fractions

Force a cast of the input arguments to a double before the divide, rather
than after the divide.

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: Create fake touches for BTN_TOOL_FOO on multi-touch pads too
Hans de Goede [Fri, 18 Jul 2014 09:06:38 +0000 (11:06 +0200)]
touchpad: Create fake touches for BTN_TOOL_FOO on multi-touch pads too

Multi-touch pads may track less touches then they can report fingers being
present through BTN_TOOL_FOO. So create fake touches for fingers reported
by BTN_TOOL_FOO on multi-touch pads too (when necessary).

This fixes e.g. 3 finger tap not working on the T440s.

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: Don't process fake touches if they are not dirty
Hans de Goede [Fri, 18 Jul 2014 09:06:37 +0000 (11:06 +0200)]
touchpad: Don't process fake touches if they are not dirty

Don't process fake touches, e.g. re-adding the same position to the motion
history when they are not dirty. This could trigger for example on a button
press.

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: Protect tp_begin_touch and tp_end_touch against being called twice
Hans de Goede [Fri, 18 Jul 2014 09:06:36 +0000 (11:06 +0200)]
touchpad: Protect tp_begin_touch and tp_end_touch against being called twice

They were already protected against being called twice between SYN_REPORT, but not
for being called twice before a SYN_REPORT arrives.

This allows simplifying tp_process_fake_touch a bit. Note while at it also
also flip the if condition in tp_process_fake_touch so that the if is
true when the finger is down, and remove the bogus t->state = TOUCH_NONE.

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: always enable palm detection on apple touchpads
Peter Hutterer [Mon, 21 Jul 2014 04:20:35 +0000 (14:20 +1000)]
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>
9 years agotest: touchpads are too small for palm if we can't get the dimensions
Peter Hutterer [Mon, 21 Jul 2014 04:35:42 +0000 (14:35 +1000)]
test: touchpads are too small for palm if we can't get the dimensions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: always init the left/right palm edge to INT_MIN/MAX
Peter Hutterer [Mon, 21 Jul 2014 01:27:21 +0000 (11:27 +1000)]
touchpad: always init the left/right palm edge to INT_MIN/MAX

A touchpad without resolution support had the values set to 0, disabling
pointer movement.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoFix two doxygen errors
Peter Hutterer [Mon, 21 Jul 2014 01:15:43 +0000 (11:15 +1000)]
Fix two doxygen errors

Add the config status enum to the config doxygen group, and remove a
superfluous argument for an @ingroup command.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: don't init edge palm detection on touchpads less than 8cm across
Peter Hutterer [Tue, 15 Jul 2014 04:01:00 +0000 (14:01 +1000)]
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>
9 years agotouchpad: require a <45 degree movement for a palm to become a touch
Peter Hutterer [Mon, 14 Jul 2014 06:38:46 +0000 (16:38 +1000)]
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>
9 years agotouchpad: if a palm touch moves out of the edge zone within a timeout, unpalm
Peter Hutterer [Mon, 14 Jul 2014 06:06:51 +0000 (16:06 +1000)]
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>
9 years agotouchpad: implement edge-based basic palm detection
Peter Hutterer [Thu, 10 Jul 2014 07:34:08 +0000 (17:34 +1000)]
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>
9 years agofilter: move get_direction into shared header
Peter Hutterer [Mon, 14 Jul 2014 06:19:33 +0000 (16:19 +1000)]
filter: move get_direction into shared header

Makes it possible to use from the touchpad code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: set the abs resolution after creating the device
Peter Hutterer [Tue, 15 Jul 2014 05:35:20 +0000 (15:35 +1000)]
test: set the abs resolution after creating the device

Until uinput gets that capability (likely not before 3.17) all we can do is a
racy approach of setting it after creating it. That won't work well for
anything test where libinput is already listening to udev when the device is
created, but it does work for those cases where libinput is started after the
device was initialized.

And it's a better alternative than not testing anything dependent on
resolution settings.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: reduce sideways-component in two-finger scroll test
Peter Hutterer [Tue, 15 Jul 2014 06:32:33 +0000 (16:32 +1000)]
test: reduce sideways-component in two-finger scroll test

This breaks when we have a device resolution set on the test devices,
specificially on the T440. The current tests use a delta of 1% of the device
which with the resolution set results in an effective delta of 3 - above the
scroll threshold.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: widen litest to use doubles for scaled variables
Peter Hutterer [Fri, 18 Jul 2014 06:01:10 +0000 (16:01 +1000)]
test: widen litest to use doubles for scaled variables

Using a 0-100% range is useful but in some cases we need events with finer
than 1% granularity.

And fix up the two-finger test that now fails. This was a bug in the test
anyway, the dx/dy supplied here was 1% of the touchpad width. Confined to
integers this meant we only ever had the touch down, then the single move by
1%. That caused two events - not enough to satisfy tp_estimate_delta, so we
always had a delta of 0/0 regardless of the size of the move.

Now with doubles this fails, so drop it to 0.1% instead, which is small enough
on all touchpads we currently have.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: check the pointer touch for history size
Peter Hutterer [Tue, 15 Jul 2014 06:01:49 +0000 (16:01 +1000)]
touchpad: check the pointer touch for history size

The current touch may not be the pointer touch, so it's pointless checking the
history size on that touch. Instead, search for the pointer touch first, check
if it's dirty and then check the history size.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fix x/y resolution for a test device
Peter Hutterer [Wed, 16 Jul 2014 04:10:08 +0000 (14:10 +1000)]
test: fix x/y resolution for a test device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fix resolution on T440s multitouch axes
Peter Hutterer [Tue, 15 Jul 2014 06:26:46 +0000 (16:26 +1000)]
test: fix resolution on T440s multitouch axes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fix a missing finger release
Peter Hutterer [Tue, 15 Jul 2014 06:49:26 +0000 (16:49 +1000)]
test: fix a missing finger release

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoInclude stdint.h from filter.h
Peter Hutterer [Fri, 4 Jul 2014 00:43:52 +0000 (10:43 +1000)]
Include stdint.h from filter.h

Don't rely on the users to include it

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: Assert libevdev_uinput_write_event() call was successful
Jonas Ådahl [Mon, 14 Jul 2014 21:33:51 +0000 (23:33 +0200)]
test: Assert libevdev_uinput_write_event() call was successful

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
9 years agotools/event-gui: Silence a couple of compiler warnings
Jonas Ådahl [Sun, 13 Jul 2014 22:15:07 +0000 (00:15 +0200)]
tools/event-gui: Silence a couple of compiler warnings

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoevent-debug: Silence compiler warnings
Jonas Ådahl [Tue, 15 Jul 2014 19:53:26 +0000 (21:53 +0200)]
event-debug: Silence compiler warnings

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoconfigure.ac: Add subdir-objects to AM_INIT_AUTOMAKE paramaters
Jonas Ådahl [Tue, 15 Jul 2014 21:25:28 +0000 (23:25 +0200)]
configure.ac: Add subdir-objects to AM_INIT_AUTOMAKE paramaters

Silences a warning when running autogen.sh.

This also adds a work-around for a bug in automake
<https://lists.gnu.org/archive/html/bug-automake/2014-01/msg00005.html>
replacing $(top_srcdir) with ../ in test/Makefile.am.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
9 years agotouchpad: fix coding style
Peter Hutterer [Thu, 10 Jul 2014 07:17:53 +0000 (17:17 +1000)]
touchpad: fix coding style

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: normalize the touchpad resolution to 400dpi, not 10 units/mm
Peter Hutterer [Tue, 8 Jul 2014 03:43:45 +0000 (13:43 +1000)]
touchpad: normalize the touchpad resolution to 400dpi, not 10 units/mm

In an attempt to bring method into the madness, normalize the touchpad deltas
to those of a USB mouse with 400 dpi. This way the data we're dealing with in
the acceleration code is of a known quantity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: don't feed 0/0 deltas into the accel filters
Peter Hutterer [Tue, 8 Jul 2014 03:02:31 +0000 (13:02 +1000)]
touchpad: don't feed 0/0 deltas into the accel filters

The resolution-based scaling may result in deltas of 0. The accel code doesn't
handle 0 deltas too well. 0/0 deltas can't happen for EV_REL devices, so the
code just isn't designed for it.

Most notably, events with delta 0/0 have no direction. That messes up the
history-based velocity calculation which stops whenever the current vector's
direction changes from the one in the trackers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agofilter: drop constant acceleration
Peter Hutterer [Tue, 8 Jul 2014 02:09:20 +0000 (12:09 +1000)]
filter: drop constant acceleration

This just moves a decimal point around, at the expense of making the approach
harder to understand. The only time the const acceleration matters is when
applied to the velocity but it only matters in relation to the threshold which
is a fixed number.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agofilter: use a separate variable for the final accel factor
Peter Hutterer [Tue, 8 Jul 2014 02:05:36 +0000 (12:05 +1000)]
filter: use a separate variable for the final accel factor

velocity is in unit/ms, the threshold is in units/ms. Once we divide
velocity/threshold, we're not in units/ms anymore but have a unitless factor.
Use a separate variable to avoid confusion.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agofilter: annotate the various variables we have with units
Peter Hutterer [Tue, 8 Jul 2014 01:45:36 +0000 (11:45 +1000)]
filter: annotate the various variables we have with units

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoaccel_profile_smooth_simple: Make 0.0-1.0 accel range depend on threshold
Hans de Goede [Fri, 4 Jul 2014 14:59:50 +0000 (16:59 +0200)]
accel_profile_smooth_simple: Make 0.0-1.0 accel range depend on threshold

Instead of always going from an accel of 0.0 to 1.0 between a velocity of
0.0 and 1.0, make the lead-in length of the curve depend on the threshold
setting, using half of the threshold for the lead-in.

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 agoaccel_profile_smooth_simple: Fix jump in acceleration curve
Hans de Goede [Fri, 4 Jul 2014 15:17:14 +0000 (17:17 +0200)]
accel_profile_smooth_simple: Fix jump in acceleration curve

There was an error in the value passed to the second calc_penumbral_gradient
call causing a jump in the acceleration curve. 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 agoaccel_profile_smooth_simple: Cleanup
Hans de Goede [Fri, 4 Jul 2014 15:16:25 +0000 (17:16 +0200)]
accel_profile_smooth_simple: Cleanup

Cleanup the code a bit, and make sure accel is at least 1.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 agofilter: drop delta-softening
Peter Hutterer [Fri, 4 Jul 2014 02:52:04 +0000 (12:52 +1000)]
filter: drop delta-softening

I doubt this does what we think it does. It doesn't soften the delta changes,
rather it introduces bumps in the smooth processing of the changes.

abs(delta) below 1.0 is untouched, and abs(delta) beyond 3 or 4 isn't
noticable much. But in the slow range around the 1/-1 mark there is a bump.

For example, if our last_delta is 1.0 and delta is 1.1, the "softened"
delta is set to 0.6. That is stored as last delta, so an input sequence of:
   0.8, 0.9, 1.0, 1.1, 1.2, 1.0, 0.8, 1.1

results in "softened" deltas that don't match the input:
   0.8, 0.9, 1.0, 0.6, 0.7, 1.0, 0.8, 0.6

A better approach at smoothing this out would be to calculate the softened as:
   current = current ± diff(last, current) * 0.5
or even weighted towards the new delta
   current = current ± diff(last, current) * 0.25

In tests, this makes little difference. Dropping this function altogether is
sufficient to make the pointer pointer behave slightly better at low speeds
though the increase is small enough to attribute to confirmation bias.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: fix expected delta from relative motion
Peter Hutterer [Mon, 7 Jul 2014 22:52:40 +0000 (08:52 +1000)]
test: fix expected delta from relative motion

We send two delta events. One may get eaten or softened by the accel code but
our expectation should be that both may get through, so the length of the
expected vector is √((2dx)² + (2dy)²). That is the maximum length we expect
though for deltas ranged [-1, 1].

Deltas above the threshold would fail this test but we can fix that when
needed.

Pointer acceleration is subject to timing changes. When running tests in
valgrind pointer accel timeouts and tracker resets may happen so we can't
guarantee a specific acceleration length.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agofilter: rename motion_filter_destroy to filter_destroy
Peter Hutterer [Thu, 3 Jul 2014 23:39:05 +0000 (09:39 +1000)]
filter: rename motion_filter_destroy to filter_destroy

For better consistency with filter_dispatch(). And move the things around to keep
the consumable API together.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: prefix custom test devices with "litest"
Peter Hutterer [Thu, 3 Jul 2014 21:55:51 +0000 (07:55 +1000)]
test: prefix custom test devices with "litest"

Follow-up from 6c4778f891a77e06c0fccbfad1a1bfd4f64f86f3

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: drop the BOTTOM_TO_AREA/BOTTOM_NEW states
Peter Hutterer [Wed, 2 Jul 2014 05:00:31 +0000 (15:00 +1000)]
touchpad: drop the BOTTOM_TO_AREA/BOTTOM_NEW states

The original intention of this state was to prevent an accidental move out of
the bottom software button to start moving the cursor. That ends up actually
preventing a number of normal moves that start low enough. Simply drop the
state.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: reduce button size, use physical sizes where possible
Peter Hutterer [Wed, 2 Jul 2014 05:41:22 +0000 (15:41 +1000)]
touchpad: reduce button size, use physical sizes where possible

The current 20% is excessive. On the t440s, the button size amounts to ~14mm
from the bottom. On the x220 it amounts to ~9mm, leaving only 31mm as actual
touchpad.

Reduce it to 15% instead, which amounts to 10.5mm on the t440 and 6mm on the
x220. Cap the button height further by making buttons a maximum height of
10mm, anything larger than that is excessive anyway.

Smaller buttons should be acceptable since we can rely on the bottom edge to
be a haptic feedback and thus a good hit-target, somewhat simliar to how
screen edges are good hit-targets.

The top software buttons stay the same size, but prefer a physical size of 6mm
instead (which is 1mm below the button marker line on the T440s). If no y
resolution is available, fall back to the 8% which is 5.6mm on the T440s.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: hook up to the tapping configuration
Peter Hutterer [Tue, 4 Feb 2014 00:38:21 +0000 (10:38 +1000)]
touchpad: hook up to the tapping configuration

Now that we have run-time changes of the tap.enabled state move the check
to the IDLE state only. Otherwise the tap machine may hang if tapping is
disabled while a gesture is in progress.

Two basic tests are added to check for the tap default setting - which is now
"tap disabled by default", for two reasons:
* if you don't know that tapping is a thing (or enabled by default), you get
  spurious button events that make the desktop feel buggy.
* if you do know what tapping is and you want it, you usually know where to
  enable it, or at least you can search for it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd an interface to enable/disable tapping
Peter Hutterer [Tue, 7 Jan 2014 01:42:32 +0000 (11:42 +1000)]
Add an interface to enable/disable tapping

Provide an interface to enable/disable tapping, with a default mapping of
1/2/3 fingers mapping to L/R/M button events, respectively.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoAdd an enum for configuration return codes
Peter Hutterer [Thu, 15 May 2014 23:06:41 +0000 (09:06 +1000)]
Add an enum for configuration return codes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agotest: fix compiler warnings for comparison int vs unsigned int
Peter Hutterer [Thu, 3 Jul 2014 01:00:54 +0000 (11:00 +1000)]
test: fix compiler warnings for comparison int vs unsigned int

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoconfigure: print a summary of the build options
Peter Hutterer [Thu, 3 Jul 2014 00:52:40 +0000 (10:52 +1000)]
configure: print a summary of the build options

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoFix compiler warnings for missing initializers
Peter Hutterer [Wed, 2 Jul 2014 23:32:02 +0000 (09:32 +1000)]
Fix compiler warnings for missing initializers

timer.c: In function ‘libinput_timer_arm_timer_fd’:
timer.c:48: warning: missing initializer
timer.c:48: warning: (near initialization for ‘its.it_value.tv_nsec’)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd -lrt to the libs
Peter Hutterer [Wed, 2 Jul 2014 23:30:40 +0000 (09:30 +1000)]
Add -lrt to the libs

Needed for clock_gettime()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoconfigure: check for -lm through AC_CHECK_LIB
Peter Hutterer [Wed, 2 Jul 2014 23:29:22 +0000 (09:29 +1000)]
configure: check for -lm through AC_CHECK_LIB

Saves us from manually appending it everywhere

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoFix two doxygen refs pointing to nonexistent functions
Peter Hutterer [Wed, 2 Jul 2014 23:59:26 +0000 (09:59 +1000)]
Fix two doxygen refs pointing to nonexistent functions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: fix touch/abs event coordinate transformation in event-gui
Peter Hutterer [Wed, 2 Jul 2014 23:57:12 +0000 (09:57 +1000)]
tools: fix touch/abs event coordinate transformation in event-gui

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: draw the circle for abs events in the right position
Peter Hutterer [Wed, 2 Jul 2014 23:54:29 +0000 (09:54 +1000)]
tools: draw the circle for abs events in the right position

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: log the sysname of the device that looks like a bad clickpad
Peter Hutterer [Wed, 2 Jul 2014 23:53:35 +0000 (09:53 +1000)]
touchpad: log the sysname of the device that looks like a bad clickpad

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Switch to smooth simple acceleration code from filter.c
Hans de Goede [Tue, 1 Jul 2014 12:53:18 +0000 (14:53 +0200)]
touchpad: Switch to smooth simple acceleration code from filter.c

The old touchpad accel code was clamping touchpad acceleration between
0.2 and 0.4, and on the test devices I have the constant_factor ended up
such that in practice the accel was almost always 0.2, so rather than having
a velocity based acceleration curve, in essence it was just always using an
acceleration of 0.2 .

This commit introduces actual velocity based acceleration based on the
recently added smooth simple acceleration code from filter.c .

Before feeding motion events to filter.c, they first get adjusted for touchpad
resolution. For touchpads where the driver does not provide resolution info,
scale based on the diagonal-size in units instead.

While at it rename tp_init_accel's dispatch parameter from touchpad to tp
to be consistent with all other functions.

Since the acceleration is also used for scrolling also adjust the scroll
start threshold for these changes.

Note that switching to the smooth simple accel code, as an added bonus gives
the tp code an accel profile with a threshold and a speed parameter, which
is exactly what is needed for the upcoming configuration interface support.

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 functions to get the device name, PID and VID
Peter Hutterer [Fri, 27 Jun 2014 02:55:29 +0000 (12:55 +1000)]
Add functions to get the device name, PID and VID

Those three are the ones that matter for logging or device identification in
callers, so let's provide them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agotouchpad: disable tapping for fingers exceeding the timeout/motion threshold
Peter Hutterer [Fri, 20 Jun 2014 04:16:13 +0000 (14:16 +1000)]
touchpad: disable tapping for fingers exceeding the timeout/motion threshold

The current code triggers multi-finger tapping even if the finger released was
previously held on the touchpad for a while. For an event sequence of:
1. first finger down
2. first finger move past threshold/wait past timeout
3. second finger down
4. first finger up

The second finger initiates the two-finger tap state, but the button event is
sent when the first finger releases - despite that finger not meeting the
usual tap constraints. This sequence can happen whenever a user swaps fingers.

Add the finger state to the actual touchpoints and update them whenever the
constrains are broken. Then, discard button events if the respective touch
did not meet the conditions.

http://bugs.freedesktop.org/76760

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: Simplify tp_hysteresis
Hans de Goede [Mon, 30 Jun 2014 12:27:18 +0000 (14:27 +0200)]
touchpad: Simplify tp_hysteresis

Once we get beyond the:

if (abs(diff) <= margin)
return center;

test, then diff is either > margin or < -margin, otherwise the test would
have triggered.

So the "return center + diff;" at the end will never be reached, and the
"else if (diff < -margin)" can be turned into a simple "else".

This commit does not just simplify tp_hysteresis, but (arguably more
important) also makes it clearer to the reader what it does.

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 coding style
Jonas Ådahl [Sat, 28 Jun 2014 20:41:29 +0000 (22:41 +0200)]
Fix coding style

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
9 years agotest/Makefile.am: Also add LIBUDEV_CFLAGS to AM_CPPFLAGS
Jonas Ådahl [Sat, 28 Jun 2014 20:40:23 +0000 (22:40 +0200)]
test/Makefile.am: Also add LIBUDEV_CFLAGS to AM_CPPFLAGS

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoconfigure.ac: libinput 0.4 0.4.0
Peter Hutterer [Wed, 25 Jun 2014 02:55:58 +0000 (12:55 +1000)]
configure.ac: libinput 0.4

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoMerge branch 'master' of git+ssh://git.freedesktop.org/git/wayland/libinput
Peter Hutterer [Wed, 25 Jun 2014 03:37:02 +0000 (13:37 +1000)]
Merge branch 'master' of git+ssh://git.freedesktop.org/git/wayland/libinput

9 years agotouchpad: Fix typo in documentation
Stephen Chandler Paul [Tue, 24 Jun 2014 22:55:25 +0000 (18:55 -0400)]
touchpad: Fix typo in documentation

"a a left and…"->"a left and…"

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoDrop the deprecated libinput_udev_create_for_seat()
Peter Hutterer [Wed, 25 Jun 2014 01:41:16 +0000 (11:41 +1000)]
Drop the deprecated libinput_udev_create_for_seat()

We have enough API breakage in this release that it's not worth keeping
this around. Every caller must be fixed for all the other stuff anyway,
so drop this too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoFix a few comments referring to udev_create_for_seat()
Peter Hutterer [Wed, 25 Jun 2014 01:42:35 +0000 (11:42 +1000)]
Fix a few comments referring to udev_create_for_seat()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoDrop the deprecated LIBINPUT_POINTER_*_SCROLL enums
Peter Hutterer [Wed, 25 Jun 2014 01:41:16 +0000 (11:41 +1000)]
Drop the deprecated LIBINPUT_POINTER_*_SCROLL enums

We have enough API breakage in this release that it's not worth keeping
these around. Every caller must be fixed for all the other stuff anyway,
so drop this too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotimer: Complain if a timer is set more than 5 seconds from now
Hans de Goede [Tue, 24 Jun 2014 14:23:13 +0000 (16:23 +0200)]
timer: Complain if a timer is set more than 5 seconds from now

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 agotest: Prefix litest created device names with litest
Hans de Goede [Tue, 24 Jun 2014 14:23:12 +0000 (16:23 +0200)]
test: Prefix litest created device names with litest

And add an example xorg.conf.d .conf file for ignoring these devices under
xorg.

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 agotp_post_twofinger_scroll: Move setting of t->is_pointer = false up a bit
Hans de Goede [Tue, 24 Jun 2014 14:23:11 +0000 (16:23 +0200)]
tp_post_twofinger_scroll: Move setting of t->is_pointer = false up a bit

There is no need to loop over the touch points twice.

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: Avoid spurious motion event for scroll movement below threshold
Hans de Goede [Tue, 24 Jun 2014 14:23:10 +0000 (16:23 +0200)]
touchpad: Avoid spurious motion event for scroll movement below threshold

If the user puts down to fingers to scroll, then changes his mind and
lifts them, without having them moved past the initial scroll threshold in
either direction, then any movement which he has done will cause a spurious
scroll event when the second finger down is lifted first.

The problem is that t->is_pointer was not being set to false in this case,
since that is done in tp_post_twofinger_scroll after checking scroll.state
which never gets set in this scenario.

Instead of changing the order, simply completely remove scroll.state completely
it is a boolean, and everywhere we check for it we also check for the axis bits
in state.direction, so it is not necessary.

Also add a check to ensure there are no spurious motion 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 agotest: Add touchpad 2 finger scroll test
Hans de Goede [Tue, 24 Jun 2014 14:23:09 +0000 (16:23 +0200)]
test: Add touchpad 2 finger scroll test

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 agotest: add one more test for two-finger tapping
Peter Hutterer [Fri, 20 Jun 2014 04:24:57 +0000 (14:24 +1000)]
test: add one more test for two-finger tapping

Inverted order of release from the other test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoAdd msleep() helper function
Peter Hutterer [Fri, 20 Jun 2014 04:06:19 +0000 (14:06 +1000)]
Add msleep() helper function

For those whose eyes struggle to focus on 5 zeros in a row, or those just sick
of forgetting one zero and wondering why things don't work.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoMerge branch 'ref-counting-context'
Peter Hutterer [Wed, 25 Jun 2014 00:32:42 +0000 (10:32 +1000)]
Merge branch 'ref-counting-context'

Conflicts:
src/udev-seat.c
test/log.c

9 years agotest: Add context reference counting test
Jonas Ådahl [Tue, 24 Jun 2014 22:06:59 +0000 (00:06 +0200)]
test: Add context reference counting test

This test relies on valgrind detecting the leak and use-after-free.

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>
9 years agoMake context reference counted
Jonas Ådahl [Tue, 24 Jun 2014 22:06:58 +0000 (00:06 +0200)]
Make context reference counted

Instead of only allowing one owner keeping a libinput context alive,
make context reference counted, replacing libinput_destroy() with
libinput_unref() while adding another function libinput_ref().

Even though there might not be any current use cases, it doesn't mean we
should hard code this usage model in the API. The old behaviour can be
emulated by never calling libinput_ref() while replacing
libinput_destroy() with libinput_unref().

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>
9 years agoMake ref count unref/ref() functions return resulting object pointer
Jonas Ådahl [Tue, 24 Jun 2014 22:06:57 +0000 (00:06 +0200)]
Make ref count unref/ref() functions return resulting object pointer

In order to know if an unref() destroyed an object and to allow more
convenient use of ref(), make both functions return a pointer to the
object it was passed, or NULL if that object was destroyed.

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>
9 years agoevent-gui: Don't drop fraction of pointer motion events
Jonas Ådahl [Mon, 23 Jun 2014 21:32:29 +0000 (23:32 +0200)]
event-gui: Don't drop fraction of pointer motion events

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoChange the logging system to be per-context
Peter Hutterer [Wed, 18 Jun 2014 09:51:19 +0000 (19:51 +1000)]
Change the logging system to be per-context

Rather than a single global logging function, make the logging dependent on
the individual context. This way we won't stomp on each other's feet in the
(admittedly unusual) case of having multiple libinput contexts.

The userdata argument to the log handler was dropped. The caller has a ref to
the libinput context now, any userdata can be attached to that context
instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoudev: split libinput_udev context init into two functions
Peter Hutterer [Thu, 12 Jun 2014 01:44:31 +0000 (11:44 +1000)]
udev: split libinput_udev context init into two functions

This is preparation work for context-specific log handlers.

Callers are now encouraged to first initialize the context with
libinput_udev_create_context() and then set the seat for this context with
libinput_udev_assign_seat().

In the upcoming patch to support context-specific log handlers this enables a
caller to set the log handler for a context before any devices are
initialized. Otherwise, a log message generated by a new device may pass a
libinput context that the caller is not yet aware of.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: move the interface declaration up
Peter Hutterer [Fri, 13 Jun 2014 01:11:05 +0000 (11:11 +1000)]
test: move the interface declaration up

No functional changes, just some prep work.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoRename KEYBOARD_KEY_STATE to KEY_STATE
Peter Hutterer [Mon, 16 Jun 2014 21:55:35 +0000 (07:55 +1000)]
Rename KEYBOARD_KEY_STATE to KEY_STATE

e912d620d0f20f415b4d3dde967648e4b9c317b9 changed from POINTER_BUTTON_STATE to
simply BUTTON_STATE, replicate that for key events too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: add a tool for GUI-based debugging
Peter Hutterer [Tue, 27 May 2014 05:29:55 +0000 (15:29 +1000)]
tools: add a tool for GUI-based debugging

Looking at debugging output is nice but not useful when testing for the feel
of a device. Add a tool that presents a canvas and draws the various events
onto it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoName-space the scroll event types
Peter Hutterer [Sat, 26 Apr 2014 10:01:22 +0000 (20:01 +1000)]
Name-space the scroll event types

To provide a generic naming system of type_direction. That will become more
important once we add new axes as part of the ongoing work to support graphics
tablets.

[edit: and switch to the new defines]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoAdd a function to get the size of a device
Peter Hutterer [Tue, 17 Jun 2014 05:45:07 +0000 (15:45 +1000)]
Add a function to get the size of a device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoChange absolute and touch events to use mm as default unit
Peter Hutterer [Thu, 19 Jun 2014 01:30:21 +0000 (11:30 +1000)]
Change absolute and touch events to use mm as default unit

Instead of device-specific coordinates that the caller can't interpret without
knowing the range anyway, return mm as the default value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: force a resolution of 1 where no resolution is set
Peter Hutterer [Thu, 19 Jun 2014 01:17:10 +0000 (11:17 +1000)]
evdev: force a resolution of 1 where no resolution is set

Avoids nasty surprises later when we divide by 0. This matters particularly
when testing a device through uinput, which can't set the resolution.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: keep the absinfo struct around instead of min/max
Peter Hutterer [Thu, 19 Jun 2014 01:11:36 +0000 (11:11 +1000)]
evdev: keep the absinfo struct around instead of min/max

We'll need that later for conversion to mm.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: tp_current_touch: Fix off by one error
Hans de Goede [Wed, 18 Jun 2014 12:22:24 +0000 (14:22 +0200)]
touchpad: tp_current_touch: Fix off by one error

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 agotools: fix the publish-doc script
Peter Hutterer [Fri, 13 Jun 2014 04:43:28 +0000 (14:43 +1000)]
tools: fix the publish-doc script

Original script was broken, curse those last-minute changes before pushing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoDocument the top software button behavior
Peter Hutterer [Thu, 12 Jun 2014 01:55:21 +0000 (11:55 +1000)]
Document the top software button behavior

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fix a path test
Peter Hutterer [Fri, 13 Jun 2014 01:37:59 +0000 (11:37 +1000)]
test: fix a path test

Test with the right interface, otherwise checking to make sure we didn't call
open on any device is a bit pointless.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agopath: log two errors as application bugs
Peter Hutterer [Thu, 12 Jun 2014 01:48:13 +0000 (11:48 +1000)]
path: log two errors as application bugs

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: ignore LIBINPUT_ATTRIBUTE_PRINTF in doxygen
Peter Hutterer [Thu, 12 Jun 2014 01:42:25 +0000 (11:42 +1000)]
doc: ignore LIBINPUT_ATTRIBUTE_PRINTF in doxygen

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd two doxygen cross-references for the logging functions
Peter Hutterer [Thu, 12 Jun 2014 01:12:50 +0000 (11:12 +1000)]
Add two doxygen cross-references for the logging functions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add a couple of top software button test
Peter Hutterer [Tue, 10 Jun 2014 23:39:12 +0000 (09:39 +1000)]
test: add a couple of top software button test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: Add description for the T440 synaptics touchpad
Peter Hutterer [Tue, 10 Jun 2014 22:59:11 +0000 (08:59 +1000)]
test: Add description for the T440 synaptics touchpad

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add clickpad software button tests
Peter Hutterer [Tue, 10 Jun 2014 23:45:07 +0000 (09:45 +1000)]
test: add clickpad software button tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add a bunch of test for click behavior on touchpads
Peter Hutterer [Thu, 5 Jun 2014 06:25:37 +0000 (16:25 +1000)]
test: add a bunch of test for click behavior on touchpads

Mainly testing the behaviour when clicking during a tap or tap-n-drag. Adds a
new "feature" to the litest system, Apple clickpads don't have software
buttons by default.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add litest_assert_empty_queue helper function
Peter Hutterer [Fri, 6 Jun 2014 00:58:11 +0000 (10:58 +1000)]
test: add litest_assert_empty_queue helper function

Checks if the queue is empty and prints informatino about any events before
failing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: always call into the the tap state machine
Peter Hutterer [Thu, 5 Jun 2014 06:22:52 +0000 (16:22 +1000)]
touchpad: always call into the the tap state machine

A button event consumed by the softbutton or clickpad code does not feed into
the tap state machine, leaving it in its current state. The touch generating
that event however may have triggered state changes.

For some tap/click combinations this gives us either double press/release
events or an inconsistent order of events. Those issues include:
* a really short physical click causes a click + tap-click
* a really short physical click on the right software button causes a right
  click + left tap-click
* tap + click causes double button left press events

To avoid these, notify the tap code that a button event has occured and
process that accordingly. Depending on the state this may either continue to
the DEAD state or release the current tap button and then go to the DEAD
state.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoAdd a log_msg_va function
Hans de Goede [Tue, 10 Jun 2014 13:08:03 +0000 (15:08 +0200)]
Add a log_msg_va function

This is useful for when we use libraries which want us to provide them with
a logging callback.

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>