evdev: restore EVDEV_UNHANDLED_DEVICE error code

If we don't have capabilities we can deal with, return a different
error so the backends can handle it separately (they already do).

Signe-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Make it possible to have persistent libinput_seat instances

With this patch, a user can keep a reference to a libinput_seat
instance, which will cause the seat to never be unlinked from the
libinput context nor destroyed.

Previously, a when the last device of a seat was removed, the seat was
unlinked and if a new device was discovered with a previously empty seat
a new seat instance would always be created, meaning two potential seat
instances with identical physical and logical seat name pairs.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
util: add min/max macros

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
evdev-touchpad: replace some numbers with a #define

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
evdev-touchpad: don't post motion events for 0/0 deltas

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Add the shell for a multitouch-compatible touchpad implementation

Doesn't do anything but initialize and destroy. This is not a permanent
separate implementation, it's just easier to start this way and then switch
over than to add to the current one.

Temporary measure: LIBINPUT_NEW_TOUCHPAD_DRIVER environment variable can be
used to enable the new driver

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
touchpad: add a touchpad driver based on per-finger tracking

This patch is a mixture of an experimental project (libtouchpad) and
evdev-touchpad.c. It adds a new touchpad driver for multi-touch touchpads that
tracks each touchpoint separately. This makes it a lot easier to handle
multi-finger tapping, software button areas, etc.

libtouchpad used a slightly different coding style, this is the attempt to get
closer to the one used in libinput.

Currently sends motion events for single-finger motion, button events only for
physical buttons.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
touchpad: add hysteresis smoothing for input coordinates

Same algorithm as in evdev-touchpad.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
touchpad: hook up the pointer acceleration

Same algorithm as in evdev-touchpad.c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
touchpad: add two-finger average scrolling

If two fingers are down and moving, take the average movement of both fingers
and use that for scrolling.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
touchpad: move structs into a header file

The tapping state implementation will be in a separate file, so let's make
sure we can access the structs we need.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
touchpad: mark which events are currently pending processing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
touchpad: add a struct for handling physical button event state changes

On ClickPads (touchpads without phys. middle/right buttons) it is important to
know whether a physical click is queued up. The finger position or number of
fingers decide which button event to send.

This isn't currently used, we still just send the button number at the moment.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
touchpad: Make touchpad_get_delta() available from other files

No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
touchpad: add support for multi-finger tapping

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
touchpad: Filter motion in a certain number of tap states

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
touchpad: require minimum scroll distance and lock scroll direction

This is a fairly rough approach, but can be handled more fine-grained later.
Require a minimum of 1 unit to start scrolling and lock the scrolling in the
initial direction, so further scroll events are limited to that direction
only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
touchpad: mark the first finger as pointer-controlling finger

Unused at the moment, but will be used later to determine if a finger should
trigger motion events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Revert "touchpad: mark the first finger as pointer-controlling finger"

This reverts commit d057e9e240f0bced75863c3a6d4d900cccc215fa.
Only move the pointer when there's a single finger down

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