Commit graph

399 commits

Author SHA1 Message Date
Peter Hutterer
fe4a40cdec test: mark the synaptics clickpad as buttonpad
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-04-10 11:11:56 +10:00
Peter Hutterer
28908b5ea2 tools: add --verbose to event-debug
And redirect the log to stdout. libinput logs to stderr by default, but if
we're running with --verbose we want all msgs on the same stream.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-04-10 11:11:56 +10:00
Peter Hutterer
c9ab49ee0c Fix up ARRAY_FOR_EACH macro
Remove compiler warning about signed/unsigned comparison. And while we're at
it, rename i to _i in the macro to avoid name clashes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-04-10 11:11:56 +10:00
Peter Hutterer
40fe4235b9 Use log_error instead of fprintf in old touchpad code
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-04-10 11:11:56 +10:00
Peter Hutterer
4802a792b3 test: fix memleak in touch test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-10 11:11:56 +10:00
Jonas Ådahl
078634deed Structure libinput_seat struct
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-04-09 20:53:14 +02:00
Jonas Ådahl
d9bfaeb59e test: Fix name of litest_button_click() definition
In litest.h it was called litest_button_click() while in litest.c
litest_click(); update the definition to be the same as the declaration.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-04-09 20:51:46 +02:00
Jonas Ådahl
3bee64a845 test: Use generic test device API in touch_abs_transform test
Instead of having a test device which only purpose is to test absolute
coordinate transformation, use the litest_create_device_with_overrides()
API to create a specially crafted wacom touch device with high
resolution.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-04-08 23:07:49 +02:00
Peter Hutterer
c5c503c964 test: switch the remaining devices to a description-based device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-04-08 15:07:02 +10:00
Peter Hutterer
a9a24c33e7 test: allow partial overriding the test devices
For specific tests we need something that e.g. looks like a touchpad, but has
a different name, a different number of slots, etc. In this case, the
following code will do exactly that:

struct input_absinfo overrides[] = {
 { .value = ABS_MT_SLOT, .minimum = 0, .maximum = 100 },
 { .value = -1 },
};

litest_create_device_with_overrides(LITEST_SYNAPTICS_CLICKPAD,
				    NULL, NULL, &overrides, NULL);

For general event codes, overrides can only add to the set of events, they
can't remove.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-04-08 15:07:02 +10:00
Peter Hutterer
a242d68989 test: allow for description-based test devices
Most of the test devices now are static descriptions anyway, make them fully
static now, including for touch events.

Switch the synaptics device now as example, the rest comes later for easier
patch review.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-04-08 15:07:02 +10:00
Peter Hutterer
258ba1c375 test: if no teardown func is set, use the default
Reduces the amount of boilerplate code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-04-08 15:07:02 +10:00
Peter Hutterer
04d52d718f test: add litest helper functions for creating uinput devices
Both functions accept a series of event types/codes tuples, terminated by -1.
For the even type INPUT_PROP_MAX (an invalid type otherwise) the code is used
as a property to enable.

The _abs function als takes an array of absinfo, with absinfo.value
determining the axis to change. If none are given, abs axes are initialized
with default settings.

Both functions abort on failure, so the caller does not need to check the
return value.

Example code for creating a rel device:

struct libevdev_uinput *uinput;
struct input_id id = { ... };
uinput = litest_create_uinput_device("foo", &id,
                                     EV_REL, REL_X,
                                     EV_REL, REL_Y,
                                     EV_KEY, BTN_LEFT,
                                     INPUT_PROP_MAX, INPUT_PROP_BUTTONPAD,
                                     -1);
libevdev_uinput_write_event(uinput, EV_REL, REL_X, -1);
libevdev_uinput_write_event(uinput, EV_SYN, SYN_REPORT, 0);
...
libevdev_uinput_destroy(uinput);

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-04-08 15:07:02 +10:00
Jonas Ådahl
32e513226c configure.ac: Always check for C++ compiler
Even though libinput uses no C++, it should be supported to include
libinput.h from C++. Therefore a build test ensuring this possibility
exist. However, since we can not conditionally invoke AC_PROG_CXX
in configure.ac just do it always.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-03-29 14:39:42 +01:00
Jonas Ådahl
07750ef798 test: Add include from C++ build test 2014-03-29 00:51:44 +01:00
Jonas Ådahl
7b3b5f173b Make libinput.h safe to be included from C++
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-03-28 23:50:48 +01:00
Jonas Ådahl
79827d2422 test/Makefile.am: Use $(GCC_CFLAGS) from configure.ac
This commit also passes AM_CFLAGS instead of AM_CPPFLAGS to the test
cases CFLAGS.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-03-28 23:50:15 +01:00
Peter Hutterer
2001443100 test: plug a couple of memory leaks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-27 08:46:47 +10:00
Peter Hutterer
e49a9888bf touchpad: clean up tap bits on destroy
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-25 16:43:35 +10:00
Peter Hutterer
67d1943ca4 touchpad: use log_error instead of fprintf
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-25 16:37:42 +10:00
Peter Hutterer
ebed4f0de3 touchpad: add missing flag for ABS_X events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-25 16:37:37 +10:00
Peter Hutterer
7c2da22fc1 touchpad: fix copy/paste error
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-25 16:37:31 +10:00
Peter Hutterer
d1ba8a8fcc test: add framework for a single-touch synaptics device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-25 11:06:09 +10:00
Peter Hutterer
a6d4e3f0d1 Merge branch 'wip/mt-touchpad' 2014-03-25 10:47:59 +10:00
Peter Hutterer
5af33e16c9 test: add a couple of touchpad tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 16:39:12 +10:00
Peter Hutterer
0c5b8c7404 test: make sure BTN_TOOL_FINGER and BTN_TOUCH are down
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 16:39:12 +10:00
Peter Hutterer
ec2b4bbaff test: fix keyboard capabilities
LITEST_KEYBOARD is the device type, not a feature.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 16:39:12 +10:00
Peter Hutterer
6a61032625 evdev: drop hook to init old touchpad driver
Still leaving the driver itself in place for removal later, but only
initialize the new driver now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 16:39:12 +10:00
Peter Hutterer
92f5860bfa touchpad: Support finger-pinnnig during physical button presses
On a clickpad, one finger has be on the trackpad to trigger a physical button
press. For drag and drop, we still want motion events though when a second
finger is down.

This patch adds finger-pinning. If the touchpad is pressed, the pressing
finger is "pinned" and ignored for further motion events. A second finger may
then be used to drag.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 16:39:12 +10:00
Peter Hutterer
f3accd3c05 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>
2014-03-24 16:39:12 +10:00
Peter Hutterer
05f82c573f touchpad: add support for clickfingers
On touchpads without physical buttons, the number of fingers on the touchpad
at the time the physical click happens decides the button type. 1/2/3 fingers
is handled left/right/middle.

We also swallow the motion event on the actual click event, this reduces
erroneous motion events by a bit. More processing is needed here though.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 16:39:12 +10:00
Peter Hutterer
4e8f1259cc touchpad: add fake-touch support for BTN_TOOL_DOUBLETAP and friends
This enables two-finger scrolling and two- and three-finger tapping on a
single-touch touchpad if BTN_TOOL_DOUBLETAP and BTN_TOOL_TRIPLETAP is set.

These require a bit of special processing:
BTN_TOUCH is set with the first finger down, but somewhat randomly unset and
re-set when switching between the various BTN_TOOL_*TAP values.
BTN_TOOL_<N>TAP is only set for N fingers down, thus a double->triple move
will see a release for DOUBLETAP and a press for TRIPLETAP. This may happen in
the same event, or across two consecutive events.

This patch adds a fake_touches mask to the touchpad struct. The mask is set
for each matching BTN_* event and used to count the number of expected
fake touchpoints. From that we begin/end the number of actual touchpoints
required. Fake touchpoints take their x/y coordinates from the first
touchpoint, which reads ABS_X/ABS_Y.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 16:39:12 +10:00
Peter Hutterer
efc8d95171 touchpad: support single-touch touchpads
Touchpads without ABS_MT_SLOT create 5 slots by default (for up to QUINTTAP)
and ABS_X/Y is mapped to the 0-slot touchpoint. This commit adds handling for
a single finger, no BTN_TOOL_DOUBLETAP or similar is being processed yet.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 16:39:12 +10:00
Peter Hutterer
8ea5cb75c1 touchpad: Only move the pointer when there's a single finger down
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 14:56:41 +10:00
Peter Hutterer
c1a9b24a0a 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>
2014-03-24 14:56:41 +10:00
Peter Hutterer
0d759edc3f touchpad: Filter motion in a certain number of tap states
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 14:56:41 +10:00
Peter Hutterer
d4bd05184a touchpad: add support for multi-finger tapping
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 14:56:40 +10:00
Peter Hutterer
3df87f4fe3 touchpad: Make touchpad_get_delta() available from other files
No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 14:56:40 +10:00
Peter Hutterer
1f656f12cf 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>
2014-03-24 14:56:40 +10:00
Peter Hutterer
b9dda43c04 touchpad: mark which events are currently pending processing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 14:56:40 +10:00
Peter Hutterer
dc13d3ec96 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>
2014-03-24 14:56:40 +10:00
Peter Hutterer
d22cdf1c47 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>
2014-03-24 14:56:40 +10:00
Peter Hutterer
8d867a2b8a touchpad: hook up the pointer acceleration
Same algorithm as in evdev-touchpad.c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 14:56:40 +10:00
Peter Hutterer
e75a0430be touchpad: add hysteresis smoothing for input coordinates
Same algorithm as in evdev-touchpad.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-24 14:56:40 +10:00
Peter Hutterer
37a04e0b0d 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>
2014-03-24 14:56:40 +10:00
Peter Hutterer
d2e026d8ae 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>
2014-03-24 14:56:40 +10:00
Peter Hutterer
6b6bb8fdf9 Expand documentation for libinput_udev_create_for_seat
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-03-24 09:08:07 +10:00
Peter Hutterer
f6ba613e9e udev: factor out device_removed handling
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-03-24 09:08:06 +10:00
Peter Hutterer
73ce45ad49 Return the length or a neg errno from libinput_device_get_keys()
Previous return value was the straight ioctl, we should try to avoid errno
mangling.

This changes the API, if not the ABI. Callers with code along the lines of
if (libinput_device_get_keys() == -1) will now break.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-03-24 09:07:57 +10:00
Peter Hutterer
e1d25a9539 tools: drop CLOCK_MONOTONIC call, no longer necessary
Obsolete as of 84c4f40f25.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-06 15:27:47 +10:00