platform/upstream/libinput.git
10 years agodoc: add state machine SVG to EXTRA_DIST
Peter Hutterer [Fri, 28 Mar 2014 05:51:08 +0000 (15:51 +1000)]
doc: add state machine SVG to EXTRA_DIST

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
10 years agotouchpad: move button-related code into a separate file
Peter Hutterer [Thu, 27 Mar 2014 03:09:06 +0000 (13:09 +1000)]
touchpad: move button-related code into a separate file

This is about to become more complicated with the support for software button
areas. Move it to a separate file to have it logically grouped together.
No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
10 years agotouchpad: reset the tap timer_fd to -1 on destroy
Peter Hutterer [Tue, 15 Apr 2014 12:28:00 +0000 (14:28 +0200)]
touchpad: reset the tap timer_fd to -1 on destroy

No real effect, just for safety

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
10 years agotouchpad: after a click, lock the finger to its current position
Peter Hutterer [Tue, 15 Apr 2014 12:27:59 +0000 (14:27 +0200)]
touchpad: after a click, lock the finger to its current position

On clickpads, clicking the pad usually causes some motion events. To avoid
erroneous movements, lock all fingers into position on the click and don't
allow for motion events until a finger moves past a given threshold
(currently 2% of the touchpad diagonal).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotouchpad: set ntouches for single-touch pads depending on key bits
Peter Hutterer [Tue, 15 Apr 2014 12:27:58 +0000 (14:27 +0200)]
touchpad: set ntouches for single-touch pads depending on key bits

A single-touch touchpad that provides BTN_TOOL_TRIPLETAP has 3 touches, etc.
There aren't a lot of these out there, but some touchpads don't have slots but
do provide two- or three-finger detection.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
10 years agoconfigure.ac: libinput 0.2 0.2.0
Jonas Ådahl [Thu, 22 May 2014 06:10:01 +0000 (08:10 +0200)]
configure.ac: libinput 0.2

Bump the libinput version and the libtool version.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoconfigure.ac: Add libtool versioning setting to configure.ac
Jonas Ådahl [Thu, 22 May 2014 06:06:25 +0000 (08:06 +0200)]
configure.ac: Add libtool versioning setting to configure.ac

Add the explanatory description of the version components from libevdev
as well.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agotouchpad: check calloc result
Carlos Olmedo Escobar [Mon, 28 Apr 2014 23:26:28 +0000 (01:26 +0200)]
touchpad: check calloc result

Check the value returned by calloc.

Signed-off-by: Carlos Olmedo Escobar <carlos.olmedo.e@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotest: disable parallel build in test directory
Peter Hutterer [Wed, 23 Apr 2014 21:25:19 +0000 (07:25 +1000)]
test: disable parallel build in test directory

We depend on device creation on the host system, having the tests run in
parallel runs a risk of random failure.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoevdev: Define KEY_LIGHTS_TOGGLE macro if missing
Jonas Ådahl [Wed, 23 Apr 2014 07:54:49 +0000 (09:54 +0200)]
evdev: Define KEY_LIGHTS_TOGGLE macro if missing

When building on a system with an older kernel, some KEY_ macros might
be missing. To be able to build on such system, define them if they are
missing.

It is probably better to keep our own copy of input.h somewhere in our
tree, and include that one instead of the system one, but that can be
added later.

Signed-off-by: Jonas Ådahl <jadahl@opera.com>
10 years agotest: fix a couple of memleaks in the tests
Peter Hutterer [Wed, 23 Apr 2014 01:04:48 +0000 (11:04 +1000)]
test: fix a couple of memleaks in the tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotools: add newline before function name
Peter Hutterer [Wed, 23 Apr 2014 00:47:09 +0000 (10:47 +1000)]
tools: add newline before function name

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoevdev: indentation fix
Carlos Garnacho [Mon, 21 Apr 2014 17:20:44 +0000 (19:20 +0200)]
evdev: indentation fix

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoFix doc typo
Carlos Garnacho [Mon, 21 Apr 2014 17:20:42 +0000 (19:20 +0200)]
Fix doc typo

The infinitive reads a bit odd there.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoFix doc typo in function name
Carlos Garnacho [Mon, 21 Apr 2014 17:20:41 +0000 (19:20 +0200)]
Fix doc typo in function name

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoRemove doc references to non-existing function
Carlos Garnacho [Mon, 21 Apr 2014 17:20:40 +0000 (19:20 +0200)]
Remove doc references to non-existing function

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoFix doc typo
Carlos Garnacho [Mon, 21 Apr 2014 17:20:39 +0000 (19:20 +0200)]
Fix doc typo

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotouchpad: Silence -Wmaybe-uninitialized compiler warning
Jonas Ådahl [Fri, 18 Apr 2014 06:43:14 +0000 (08:43 +0200)]
touchpad: Silence -Wmaybe-uninitialized compiler warning

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agotest: Test seat wide button and key count helpers
Jonas Ådahl [Tue, 1 Apr 2014 20:24:10 +0000 (22:24 +0200)]
test: Test seat wide button and key count helpers

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotest: Add ability to add test devices to existing libinput context
Jonas Ådahl [Sat, 22 Feb 2014 14:06:34 +0000 (15:06 +0100)]
test: Add ability to add test devices to existing libinput context

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoIntroduce seat wide button and key count API
Jonas Ådahl [Tue, 1 Apr 2014 19:57:45 +0000 (21:57 +0200)]
Introduce seat wide button and key count API

Compositors will need to keep provide virtual devices of supported
generic device types (pointer, keyboard, touch etc). Events from each
device capable of a certain device type abstraction should be combined
as if it was only one device.

For key and button events this means counting presses of every key or
button. With this patch, libinput provides two new API for doing just
this; libinput_event_pointer_get_seat_button_count() and
libinput_event_keyboard_get_seat_key_count().

With these functions, a compositor can sort out what key or button events
that should be ignored for a virtual device. This could for example
look like:

event = libinput_get_event(libinput);
switch (libinput_event_get_type(event)) {
...
case LIBINPUT_EVENT_POINTER_BUTTON:
device = libinput_event_get_device(event);
seat = libinput_event_get_seat(device);
pevent = libinput_event_get_pointer_event(event);

if (libinput_event_pointer_get_button_state(pevent) &&
    libinput_event_pointer_get_seat_button_count(pevent) == 1)
notify_pointer_button_press(seat);
else if (libinput_event_pointer_get_button_state(pevent) &&
 libinput_event_pointer_get_seat_button_count(pevent) == 0)
notify_pointer_button_release(seat);
break;
...
}

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotest: Fix test device type validity check
Jonas Ådahl [Tue, 25 Mar 2014 21:56:01 +0000 (22:56 +0100)]
test: Fix test device type validity check

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotest: Check that libinput doesn't send double touch down/up events
Jonas Ådahl [Mon, 24 Mar 2014 22:05:21 +0000 (23:05 +0100)]
test: Check that libinput doesn't send double touch down/up events

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agotest: Test handling of many touch points
Jonas Ådahl [Mon, 24 Mar 2014 21:37:00 +0000 (22:37 +0100)]
test: Test handling of many touch points

libinput currently handles 16 per device touch points. Test that we
behave as expected when a device has an even higher number of active
touch points.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoevdev: Avoid double touch down/up events
Jonas Ådahl [Mon, 24 Mar 2014 22:37:09 +0000 (23:37 +0100)]
evdev: Avoid double touch down/up events

When the kernel sends multiple touch down or touch up for the same slot
in a row, ignore any such subsequent event ensuring libinput always
produces 1 x touch down -> [n x touch motion] -> 1 x touch up event
series.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoevdev: Dynamically allocate slot array
Jonas Ådahl [Tue, 22 Apr 2014 21:02:14 +0000 (23:02 +0200)]
evdev: Dynamically allocate slot array

Don't have a hard coded slot array size; instead allocate the array
needed according to the abs info reported by either libmtdev or libevdev.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoevdev: Use temporary variable when passing libevdev pointer
Jonas Ådahl [Mon, 24 Mar 2014 22:12:36 +0000 (23:12 +0100)]
evdev: Use temporary variable when passing libevdev pointer

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoAdd a log_bug macro
Hans de Goede [Tue, 15 Apr 2014 12:28:09 +0000 (14:28 +0200)]
Add a log_bug macro

For logging when things happen which should not happen. We may want to do
something more fancy in the future but for now this suffices.

Modelled after log_bug in libevdev.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoevdev: log configured device info
U. Artie Eoff [Fri, 11 Apr 2014 23:27:01 +0000 (16:27 -0700)]
evdev: log configured device info

Bring back the device configure logging that was originally part of
Weston's evdev.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
10 years agotest: add tests for event conversion and back
Peter Hutterer [Wed, 26 Mar 2014 05:08:02 +0000 (15:08 +1000)]
test: add tests for event conversion and back

Looks a bit excessive given how simple the base is but hey, we don't want to
ever break that bit. That'd be embarrassing.

And while we're at it make sure that the 'wrong' event getters return NULL for
each event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoAdd functions to convert back to the base event
Peter Hutterer [Tue, 25 Mar 2014 03:55:47 +0000 (13:55 +1000)]
Add functions to convert back to the base event

A few functions only work on the base event but once we've converted to the
target event we can't go back. Casting works for now but that would expose
internal ABI.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
10 years agotest: automatically run the tests against valgrind for leaks
Peter Hutterer [Thu, 27 Mar 2014 01:04:24 +0000 (11:04 +1000)]
test: automatically run the tests against valgrind for leaks

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
10 years agotest: mark the synaptics clickpad as buttonpad
Peter Hutterer [Thu, 27 Mar 2014 02:43:21 +0000 (12:43 +1000)]
test: mark the synaptics clickpad as buttonpad

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
10 years agotools: add --verbose to event-debug
Peter Hutterer [Wed, 26 Mar 2014 05:49:34 +0000 (15:49 +1000)]
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>
10 years agoFix up ARRAY_FOR_EACH macro
Peter Hutterer [Tue, 25 Mar 2014 01:19:52 +0000 (11:19 +1000)]
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>
10 years agoUse log_error instead of fprintf in old touchpad code
Peter Hutterer [Thu, 27 Mar 2014 05:05:36 +0000 (15:05 +1000)]
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>
10 years agotest: fix memleak in touch test
Peter Hutterer [Thu, 10 Apr 2014 01:11:43 +0000 (11:11 +1000)]
test: fix memleak in touch test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoStructure libinput_seat struct
Jonas Ådahl [Wed, 19 Mar 2014 22:38:45 +0000 (23:38 +0100)]
Structure libinput_seat struct

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agotest: Fix name of litest_button_click() definition
Jonas Ådahl [Tue, 25 Mar 2014 21:56:58 +0000 (22:56 +0100)]
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>
10 years agotest: Use generic test device API in touch_abs_transform test
Jonas Ådahl [Thu, 3 Apr 2014 20:35:47 +0000 (22:35 +0200)]
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>
10 years agotest: switch the remaining devices to a description-based device
Peter Hutterer [Mon, 31 Mar 2014 05:23:25 +0000 (15:23 +1000)]
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>
10 years agotest: allow partial overriding the test devices
Peter Hutterer [Mon, 31 Mar 2014 04:54:46 +0000 (14:54 +1000)]
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>
10 years agotest: allow for description-based test devices
Peter Hutterer [Mon, 31 Mar 2014 00:00:16 +0000 (10:00 +1000)]
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>
10 years agotest: if no teardown func is set, use the default
Peter Hutterer [Sun, 30 Mar 2014 23:38:49 +0000 (09:38 +1000)]
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>
10 years agotest: add litest helper functions for creating uinput devices
Peter Hutterer [Wed, 26 Mar 2014 10:09:42 +0000 (20:09 +1000)]
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>
10 years agoconfigure.ac: Always check for C++ compiler
Jonas Ådahl [Sat, 29 Mar 2014 13:39:42 +0000 (14:39 +0100)]
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>
10 years agotest: Add include from C++ build test
Jonas Ådahl [Mon, 24 Mar 2014 22:45:05 +0000 (23:45 +0100)]
test: Add include from C++ build test

10 years agoMake libinput.h safe to be included from C++
Jonas Ådahl [Mon, 24 Mar 2014 22:40:39 +0000 (23:40 +0100)]
Make libinput.h safe to be included from C++

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agotest/Makefile.am: Use $(GCC_CFLAGS) from configure.ac
Jonas Ådahl [Mon, 24 Mar 2014 22:09:09 +0000 (23:09 +0100)]
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>
10 years agotest: plug a couple of memory leaks
Peter Hutterer [Wed, 26 Mar 2014 22:43:04 +0000 (08:43 +1000)]
test: plug a couple of memory leaks

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotouchpad: clean up tap bits on destroy
Peter Hutterer [Tue, 25 Mar 2014 02:14:39 +0000 (12:14 +1000)]
touchpad: clean up tap bits on destroy

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotouchpad: use log_error instead of fprintf
Peter Hutterer [Tue, 25 Mar 2014 01:43:52 +0000 (11:43 +1000)]
touchpad: use log_error instead of fprintf

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotouchpad: add missing flag for ABS_X events
Peter Hutterer [Tue, 25 Mar 2014 01:30:42 +0000 (11:30 +1000)]
touchpad: add missing flag for ABS_X events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotouchpad: fix copy/paste error
Peter Hutterer [Tue, 25 Mar 2014 01:10:23 +0000 (11:10 +1000)]
touchpad: fix copy/paste error

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotest: add framework for a single-touch synaptics device
Peter Hutterer [Mon, 24 Mar 2014 05:25:32 +0000 (15:25 +1000)]
test: add framework for a single-touch synaptics device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoMerge branch 'wip/mt-touchpad'
Peter Hutterer [Tue, 25 Mar 2014 00:47:59 +0000 (10:47 +1000)]
Merge branch 'wip/mt-touchpad'

10 years agotest: add a couple of touchpad tests
Peter Hutterer [Fri, 21 Mar 2014 04:41:32 +0000 (14:41 +1000)]
test: add a couple of touchpad tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotest: make sure BTN_TOOL_FINGER and BTN_TOUCH are down
Peter Hutterer [Fri, 21 Mar 2014 04:37:27 +0000 (14:37 +1000)]
test: make sure BTN_TOOL_FINGER and BTN_TOUCH are down

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotest: fix keyboard capabilities
Peter Hutterer [Mon, 24 Mar 2014 04:37:16 +0000 (14:37 +1000)]
test: fix keyboard capabilities

LITEST_KEYBOARD is the device type, not a feature.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agoevdev: drop hook to init old touchpad driver
Peter Hutterer [Mon, 17 Feb 2014 05:40:09 +0000 (15:40 +1000)]
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>
10 years agotouchpad: Support finger-pinnnig during physical button presses
Peter Hutterer [Mon, 17 Feb 2014 04:24:20 +0000 (14:24 +1000)]
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>
10 years agotouchpad: mark the first finger as pointer-controlling finger
Peter Hutterer [Fri, 14 Feb 2014 03:59:41 +0000 (13:59 +1000)]
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>
10 years agotouchpad: add support for clickfingers
Peter Hutterer [Mon, 17 Feb 2014 01:14:29 +0000 (11:14 +1000)]
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>
10 years agotouchpad: add fake-touch support for BTN_TOOL_DOUBLETAP and friends
Peter Hutterer [Fri, 14 Feb 2014 05:12:22 +0000 (15:12 +1000)]
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>
10 years agotouchpad: support single-touch touchpads
Peter Hutterer [Fri, 14 Feb 2014 04:18:27 +0000 (14:18 +1000)]
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>
10 years agotouchpad: Only move the pointer when there's a single finger down
Peter Hutterer [Fri, 14 Feb 2014 05:48:49 +0000 (15:48 +1000)]
touchpad: Only move the pointer when there's a single finger down

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotouchpad: require minimum scroll distance and lock scroll direction
Peter Hutterer [Fri, 14 Feb 2014 02:31:26 +0000 (12:31 +1000)]
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>
10 years agotouchpad: Filter motion in a certain number of tap states
Peter Hutterer [Sun, 9 Feb 2014 21:44:59 +0000 (07:44 +1000)]
touchpad: Filter motion in a certain number of tap states

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotouchpad: add support for multi-finger tapping
Peter Hutterer [Fri, 7 Feb 2014 05:18:17 +0000 (15:18 +1000)]
touchpad: add support for multi-finger tapping

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotouchpad: Make touchpad_get_delta() available from other files
Peter Hutterer [Fri, 7 Feb 2014 04:39:21 +0000 (14:39 +1000)]
touchpad: Make touchpad_get_delta() available from other files

No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotouchpad: add a struct for handling physical button event state changes
Peter Hutterer [Fri, 7 Feb 2014 03:59:38 +0000 (13:59 +1000)]
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>
10 years agotouchpad: mark which events are currently pending processing
Peter Hutterer [Fri, 7 Feb 2014 03:48:06 +0000 (13:48 +1000)]
touchpad: mark which events are currently pending processing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotouchpad: move structs into a header file
Peter Hutterer [Fri, 7 Feb 2014 03:39:27 +0000 (13:39 +1000)]
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>
10 years agotouchpad: add two-finger average scrolling
Peter Hutterer [Thu, 6 Feb 2014 09:17:22 +0000 (19:17 +1000)]
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>
10 years agotouchpad: hook up the pointer acceleration
Peter Hutterer [Thu, 6 Feb 2014 09:43:48 +0000 (19:43 +1000)]
touchpad: hook up the pointer acceleration

Same algorithm as in evdev-touchpad.c

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotouchpad: add hysteresis smoothing for input coordinates
Peter Hutterer [Thu, 6 Feb 2014 08:57:10 +0000 (18:57 +1000)]
touchpad: add hysteresis smoothing for input coordinates

Same algorithm as in evdev-touchpad.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agotouchpad: add a touchpad driver based on per-finger tracking
Peter Hutterer [Thu, 6 Feb 2014 05:32:32 +0000 (15:32 +1000)]
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>
10 years agoAdd the shell for a multitouch-compatible touchpad implementation
Peter Hutterer [Thu, 6 Feb 2014 05:05:36 +0000 (15:05 +1000)]
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>
10 years agoExpand documentation for libinput_udev_create_for_seat
Peter Hutterer [Thu, 13 Mar 2014 04:28:26 +0000 (14:28 +1000)]
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>
10 years agoudev: factor out device_removed handling
Peter Hutterer [Thu, 13 Mar 2014 04:24:48 +0000 (14:24 +1000)]
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>
10 years agoReturn the length or a neg errno from libinput_device_get_keys()
Peter Hutterer [Thu, 13 Mar 2014 05:54:47 +0000 (15:54 +1000)]
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>
10 years agotools: drop CLOCK_MONOTONIC call, no longer necessary
Peter Hutterer [Thu, 6 Mar 2014 05:27:47 +0000 (15:27 +1000)]
tools: drop CLOCK_MONOTONIC call, no longer necessary

Obsolete as of 84c4f40f25e91ff6ecd35b47398d13ac3996f101.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
10 years agolibinput: Fix the close_restricted interface callback
Jasper St. Pierre [Sat, 1 Mar 2014 19:19:03 +0000 (14:19 -0500)]
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>
10 years agoconfigure.ac: Bump to 0.1.0 0.1.0
Jonas Ådahl [Wed, 26 Feb 2014 18:54:51 +0000 (19:54 +0100)]
configure.ac: Bump to 0.1.0

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoconfigure.ac: Update URLs
Jonas Ådahl [Wed, 26 Feb 2014 18:54:27 +0000 (19:54 +0100)]
configure.ac: Update URLs

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoUpdate README
Jonas Ådahl [Wed, 26 Feb 2014 18:36:38 +0000 (19:36 +0100)]
Update README

Added links and updated the description.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoMakefile.am: Add private header to sources list
Jonas Ådahl [Fri, 21 Feb 2014 21:18:37 +0000 (22:18 +0100)]
Makefile.am: Add private header to sources list

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agopath: Silence -Wmaybe-uninitialized compiler warning
Jonas Ådahl [Fri, 21 Feb 2014 21:17:17 +0000 (22:17 +0100)]
path: Silence -Wmaybe-uninitialized compiler warning

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoSplit up the touch event into the different touch types
Jonas Ådahl [Wed, 19 Feb 2014 20:39:26 +0000 (21:39 +0100)]
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>
10 years agoAdd seat wide slot to touch events
Jonas Ådahl [Thu, 30 Jan 2014 21:44:49 +0000 (22:44 +0100)]
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>
10 years agoMerge branch 'libevdev'
Peter Hutterer [Tue, 25 Feb 2014 04:31:35 +0000 (14:31 +1000)]
Merge branch 'libevdev'

10 years agoevdev: set CLOCK_MONOTONIC as the time source
Peter Hutterer [Tue, 18 Feb 2014 22:45:57 +0000 (08:45 +1000)]
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>
10 years agoHook up event processing to libevdev
Peter Hutterer [Fri, 6 Dec 2013 03:09:18 +0000 (13:09 +1000)]
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>
10 years agoHook up libevdev as backend
Peter Hutterer [Fri, 6 Dec 2013 02:01:47 +0000 (12:01 +1000)]
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>
10 years agoevdev: reset the device fd after closing it
Peter Hutterer [Fri, 21 Feb 2014 06:13:02 +0000 (16:13 +1000)]
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>
10 years agoevdev: fix device_transform_ functions
Benjamin Tissoires [Mon, 17 Feb 2014 18:42:52 +0000 (13:42 -0500)]
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>
10 years agotest: Add scale li_fixed overflow test
Jonas Ådahl [Tue, 18 Feb 2014 19:13:58 +0000 (20:13 +0100)]
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>
10 years agotest: Fix touch_down in wacom touch test device
Jonas Ådahl [Tue, 18 Feb 2014 19:13:57 +0000 (20:13 +0100)]
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>
10 years agoevent-debug: Display touch event seats as signed integer
Jonas Ådahl [Wed, 19 Feb 2014 20:43:35 +0000 (21:43 +0100)]
event-debug: Display touch event seats as signed integer

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
10 years agoAdd a customizable log handler
Peter Hutterer [Wed, 12 Feb 2014 04:20:18 +0000 (14:20 +1000)]
Add a customizable log handler

The previous log handler wasn't actually hooked up to anything. Add a public
API for the log handler with priority filtering, defaulting to priority
'error' and stderr as output stream.

And to keep the diff down and convenience up, provide a few simple wrappers
for logging. The generic is log_msg(), but let's use log_info, log_error, etc.

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