test/Makefile.am: Also add LIBUDEV_CFLAGS to AM_CPPFLAGS

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Fix coding style

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
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>
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>
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>
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>
touchpad: log the sysname of the device that looks like a bad clickpad

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tools: draw the circle for abs events in the right position

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
tools: fix touch/abs event coordinate transformation in event-gui

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Fix two doxygen refs pointing to nonexistent functions

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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>
Add -lrt to the libs

Needed for clock_gettime()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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>
configure: print a summary of the build options

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
test: fix compiler warnings for comparison int vs unsigned int

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Add an enum for configuration return codes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
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>
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>
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>
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>