Commit graph

382 commits

Author SHA1 Message Date
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
Jasper St. Pierre
385bfdb762 libinput: Fix the close_restricted interface callback
libinput is supposed to take a close callback in its interface
to allow you to call out to a privileged API to close FDs. But
the FD that libinput passes you is bogus, because
libinput_remove_source closes the FD on which it's passed. This
is really bad, as the libinput_source really doesn't own the FD
which it's passed, so it shouldn't be trying to close() it.

Only one out of the four users of libinput_remove_source actually
wants their FD closed, so move the close() call there.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-03-04 15:21:38 +10:00
Jonas Ådahl
6ae636fe18 configure.ac: Bump to 0.1.0
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-02-26 19:54:51 +01:00
Jonas Ådahl
edd792ab6e configure.ac: Update URLs
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-02-26 19:54:27 +01:00
Jonas Ådahl
2b08f19b7e Update README
Added links and updated the description.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-02-26 19:50:37 +01:00
Jonas Ådahl
9e48569ae8 Makefile.am: Add private header to sources list
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-02-26 19:32:33 +01:00
Jonas Ådahl
b98e9b1ccc path: Silence -Wmaybe-uninitialized compiler warning
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-02-26 19:32:33 +01:00
Jonas Ådahl
6f0ca1a386 Split up the touch event into the different touch types
Instead of having one touch events representing different types of touch
events by providing a touch type, have one separate event type per touch
type. This means the LIBINPUT_EVENT_TYPE_TOUCH is replaced with
LIBINPUT_EVENT_TYPE_TOUCH_DOWN, LIBINPUT_EVENT_TYPE_TOUCH_MOTION,
LIBINPUT_EVENT_TYPE_TOUCH_UP and LIBINPUT_EVENT_TYPE_TOUCH_CANCEL.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-02-26 19:32:33 +01:00
Jonas Ådahl
e80cff7b0e Add seat wide slot to touch events
Since a Wayland compositor have to represent all touch devices of a seat
as one virtual device, lets make that easier by also providing seat wide
slots with touch events.

Seat wide slots may be accessed using
libinput_event_touch_get_seat_slot().

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-02-26 19:32:33 +01:00
Peter Hutterer
bc06973c2e Merge branch 'libevdev' 2014-02-25 14:31:35 +10:00
Peter Hutterer
84c4f40f25 evdev: set CLOCK_MONOTONIC as the time source
Avoids erroneous timestamps when the system time is reset. This used to a be a
problem with the X.Org synaptics driver where taps, scrolling and a couple of
other things would potentially lock up.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-25 14:31:22 +10:00
Peter Hutterer
0fea6226f1 Hook up event processing to libevdev
This gives us the ability to handle SYN_DROPPED transparently to the caller.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-02-25 14:31:17 +10:00
Peter Hutterer
f925cee8df Hook up libevdev as backend
libevdev wraps the various peculiarities of the evdev kernel API into a
type-safe API. It also buffers the device so checking for specific features at
a later time is easier than re-issuing the ioctls. Plus, it gives us almost
free support for SYN_DROPPED events (in the following patch).

This patch switches all the bit checks over to libevdev and leaves the event
processing as-is. Makes it easier to review.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2014-02-24 09:29:09 +10:00
Peter Hutterer
d31b1b7b70 evdev: reset the device fd after closing it
A caller may have a reference to the device after closing it, make sure that
ref doesn't have a dangling fd so future attempts of reading from/writing to
the device fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-21 16:13:02 +10:00
Benjamin Tissoires
128f98c43b evdev: fix device_transform_ functions
X and Y are li_fixed_t, which is 24.8 fixed point real number.
li_fixed_t max is thus ~8388607.

On a touchscreen with a range of 32767 values (like a 3M sensor), and
mapped on monitor with a resolution of 1920x1080, we currently have:
(x - li_fixed_from_int(device->abs.min_x)) * width == 62912640

which is 7 times bigger than li_fixed_t max.

Force a cast to uint64_t to keep the precision of the sensor.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-20 11:30:08 +10:00
Jonas Ådahl
ad24bc07f8 test: Add scale li_fixed overflow test
Add a test case and test device that checks if the scale transform can
handle high resolution devices and output monitor resolutions.

The test case is created in a way that it will fail if the coordinate
transform expression will overflow if only 32 bit integer data
containers are used.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-20 11:30:08 +10:00
Jonas Ådahl
295578bc2d test: Fix touch_down in wacom touch test device
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-02-20 11:30:08 +10:00
Jonas Ådahl
63f192c466 event-debug: Display touch event seats as signed integer
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-02-19 22:16:39 +01:00