platform/upstream/libinput.git
9 years agoREADME: Add the libinput component to the bugzilla URL
Peter Hutterer [Thu, 5 Feb 2015 22:58:55 +0000 (08:58 +1000)]
README: Add the libinput component to the bugzilla URL

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: document that we're ignoring position-less clicks
Peter Hutterer [Fri, 6 Feb 2015 04:32:05 +0000 (14:32 +1000)]
doc: document that we're ignoring position-less clicks

This can happen a lot easier on the new Lenovo series, so document that this
is intentional behavior.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoIntroduce device groups to group logical devices together
Peter Hutterer [Thu, 5 Feb 2015 03:39:04 +0000 (13:39 +1000)]
Introduce device groups to group logical devices together

Devices like Wacom tablets have multiple event nodes (touch, pad and stylus).
This requires some logical grouping, e.g. setting an Intuos 5 tablet
left-handed effectively turns it upside down. That then applies to both the
stylus and the touch device.

Merging the devices into one struct libinput_device is not feasable, it
complicates the API for little benefit. A caller would still need access to
all subdevices to get udev handles, etc. Some configuration options apply to
the whole device (left-handed) but some (may) only apply to a single subdevice
(calibration, natural scrolling).

Addressing this would make the libinput API unwieldly and hard to use.

Instead, add a device group concept. Each device is a member of a device
group - a singleton for most devices. Wacom tablets will have a single group
across multiple devices, allowing the caller to associate the devices together
if needed.

The API is intentionally very simple and requires the caller to keep track of
groups and which/how many devices are in it. The caller has more powerful
libraries available to do that than we have.

This patch does not address the actual merging of devices into the same
device group, it simply creates a new group for each new device.

[rebased on top of 0.10]
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>
9 years agoconfigure.ac: libinput 0.10.0 0.10.0
Peter Hutterer [Fri, 6 Feb 2015 00:33:02 +0000 (10:33 +1000)]
configure.ac: libinput 0.10.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoFix an abort if the device speed is NaN
Olivier Fourdan [Thu, 5 Feb 2015 13:33:31 +0000 (14:33 +0100)]
Fix an abort if the device speed is NaN

When using libinput with xf86-input-libinput, the device speed is
represented as a float passed via X properties.

If a buggy client gives a broken value, the conversions that occur
can cause the value of speed to be NaN (not a number), aka infinity.

In C, any comparison with NaN always gives false, whatever the value.

So that test in libinput_device_config_accel_set_speed():

   (speed < 1.0 || speed > 1.0)

will necessarily return FALSE, defeating the test of range.

However, since since any comparison with NaN is false, the
opposite assert() in accelerator_set_speed():

   (speed >= 1.0 && speed <= 1.0)

will be false as well, thus triggering the abort() and the crash of
the entire X server along with it.

The solution is to use the same construct in both routines, so that
it fails gracefully in libinput_device_config_accel_set_speed().

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agocosmetic: fix grammar in doxygen
Peter Hutterer [Thu, 5 Feb 2015 01:46:55 +0000 (11:46 +1000)]
cosmetic: fix grammar in doxygen

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: mark two switch fallthroughs with comments
Peter Hutterer [Tue, 3 Feb 2015 23:11:46 +0000 (09:11 +1000)]
touchpad: mark two switch fallthroughs with comments

Coverity pointed these out, they're false positives but mark them with
comments to make it obvious to the reader.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agopath: make sure udev devices are initialized before usage
Peter Hutterer [Tue, 3 Feb 2015 04:18:15 +0000 (14:18 +1000)]
path: make sure udev devices are initialized before usage

When creating uinput devices, we get the devnode from the kernel directly
rather than through udev. When we add this to the path backend too quickly the
udev_device we get may not be fully initialized and properties may be missing.
This causes false test results.

Avoid this by making sure the handle we have is initialized. This should never
trigger on a real device anyway, even creating a device through litest is slow
enough to avoid this issue. Only affected are the tests in misc.c where we
create the uinput device directly.

Nonetheless, handle this for the generic case so we don't run into heisenbugs
later.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: switch event conversion tests to use litest devices
Peter Hutterer [Tue, 3 Feb 2015 03:42:44 +0000 (13:42 +1000)]
test: switch event conversion tests to use litest devices

Makes the code use more commonly used paths, no real functional changes at
this point. This was using hand-crafted devices as it predates the
litest_add_for_device() helper.

For an upcoming patch to use the udev ID_INPUT_. tags the
event_conversion_key test requires this change: without it the device will be
tagged with ID_INPUT_KEY but not ID_INPUT_KEYBOARD. This could be fixed by
adding all normal keyboard keys to the uinput device but it's easier to just
re-use litest.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agozalloc the libinput_source, don't malloc it
Peter Hutterer [Mon, 2 Feb 2015 23:36:17 +0000 (09:36 +1000)]
zalloc the libinput_source, don't malloc it

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoDon't init pointer acceleration on absolute devices
Peter Hutterer [Mon, 2 Feb 2015 23:37:53 +0000 (09:37 +1000)]
Don't init pointer acceleration on absolute devices

Note: touchpads have a different backend, we never get here in that case. This
only applies to true absolute pointer devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agotest: add pointer acceleration defaults test
Peter Hutterer [Mon, 2 Feb 2015 23:35:19 +0000 (09:35 +1000)]
test: add pointer acceleration defaults test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoevdev: set the default speed after initializing ptraccel
Peter Hutterer [Mon, 2 Feb 2015 23:24:08 +0000 (09:24 +1000)]
evdev: set the default speed after initializing ptraccel

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agofilter: zalloc the struct to make sure the speed is initialized
Peter Hutterer [Mon, 2 Feb 2015 23:20:59 +0000 (09:20 +1000)]
filter: zalloc the struct to make sure the speed is initialized

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agocosmetic: remove double empty-line
Peter Hutterer [Mon, 2 Feb 2015 23:14:20 +0000 (09:14 +1000)]
cosmetic: remove double empty-line

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add per-device udev rule support
Peter Hutterer [Mon, 2 Feb 2015 00:47:52 +0000 (10:47 +1000)]
test: add per-device udev rule support

Don't rely on a magic version tag, instead let a device define a udev rule and
drop that into the udev runtime directory before the device is created.

There are a couple of caveats with this approach: first, since this changes
system-wide state it may cause issues on the device the test suite is run on.
This can be avoided if the udev rules have filter patterns that ensure only
test devices are affected.

Second, the check test suite aborts but it doesn't run the teardown() function
if a test fails. So far this wasn't a problem since uinput devices disappear
whenever we exit. The rules files will hang around though, so an unchecked
fixture was added to delete all litest-foo.rules files before and after a test
case starts. Unchecked fixtures are run regardless of the exit status of the
test but run in the same address space - i.e. no ck_assert() usage.

Also unchecked fixtures are only run once per test-case, not once per test
function. For us, that means they're only run once per device (we use the
devices as test case), i.e. if a test fails and the udev rule isn't tidied up,
the next test may be unpredictable. This shouldn't matter too much though.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoAdd missing doxygen ingroup tag for libinput_device_get_udev_device
Peter Hutterer [Wed, 28 Jan 2015 02:52:22 +0000 (12:52 +1000)]
Add missing doxygen ingroup tag for libinput_device_get_udev_device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoconfigure.ac: libinput 0.9.0 0.9.0
Peter Hutterer [Fri, 30 Jan 2015 04:05:01 +0000 (14:05 +1000)]
configure.ac: libinput 0.9.0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add tests for new lenovo touchpads
Peter Hutterer [Wed, 28 Jan 2015 05:46:31 +0000 (15:46 +1000)]
test: add tests for new lenovo touchpads

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: re-route trackpoint buttons on the *50 Lenovo series
Peter Hutterer [Wed, 28 Jan 2015 05:38:00 +0000 (15:38 +1000)]
touchpad: re-route trackpoint buttons on the *50 Lenovo series

The laptops on this series have the physical trackpoint buttons back but
wired them up to the touchpad instead of the trackpoint device and they appear
as BTN_0, BTN_1 and BTN_2 for left, right, middle.

The udev hwdb marks these for us with the TOUCHPAD_HAS_TRACKPOINT_BUTTONS tag
[1]. Use that tag to identify them and re-route the events through the
trackstick device after mangling the event codes to represent the actual
buttons.

[1] http://cgit.freedesktop.org/systemd/systemd/tree/hwdb/70-touchpad.hwdb

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add a test device for the Lenovo X1 Carbon 3rd
Peter Hutterer [Wed, 28 Jan 2015 05:37:21 +0000 (15:37 +1000)]
test: add a test device for the Lenovo X1 Carbon 3rd

Notable: sends BTN_0/1/2 instead of the trackpoint

This device currently has the INPUT_PROP_TOPBUTTONPAD property set, kernel
patches [1] and [2] are pending to remove this. This test device already lacks
the property.

[1] https://patchwork.kernel.org/patch/5730371/
[2] https://patchwork.kernel.org/patch/5730451/

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: set the input_id->version as well in litest devices
Peter Hutterer [Wed, 28 Jan 2015 05:59:03 +0000 (15:59 +1000)]
test: set the input_id->version as well in litest devices

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotools: Check if axis value is available in debugging GUI
Friedrich Schöller [Fri, 23 Jan 2015 21:31:05 +0000 (22:31 +0100)]
tools: Check if axis value is available in debugging GUI

libinput complained with lots of "client bug" messages because the GUI tool
did not check which axis values were available.

Signed-off-by: Friedrich Schöller <code@schoeller.se>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: Use correct event axis in debugging GUI
Friedrich Schöller [Fri, 23 Jan 2015 21:31:04 +0000 (22:31 +0100)]
tools: Use correct event axis in debugging GUI

Vertical axis values were used for the horizontal axis as well.

Introduced 1baf109b40e5d610cb46d313d7c412419af8c9e0

Signed-off-by: Friedrich Schöller <code@schoeller.se>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: Be more careful about what we consider a joystick
Hans de Goede [Wed, 21 Jan 2015 11:04:48 +0000 (12:04 +0100)]
evdev: Be more careful about what we consider a joystick

After switching my main workstation over to using xf86-input-libinput, I
noticed that the multi-media keys like play/pause on my keyboard no longer
worked.

It turns out that the second hid interface on my keyboard which has the
multimedia-keys, also declares having: BTN_BASE6 and BTN_MODE which both
fell into the range we were using to test for something being a joystick.

The commit makes our joystick test mode strict, restoring functionality
of the multi-media keys on the keyboard in question.

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>
9 years agoRemove libinput_event_pointer_get_axis from symbols
Marek Chalupa [Wed, 21 Jan 2015 11:11:22 +0000 (12:11 +0100)]
Remove libinput_event_pointer_get_axis from symbols

This function was removed in 1baf109b40

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoMove the new click method configuration tools to the right symbol version set
Peter Hutterer [Mon, 19 Jan 2015 10:31:15 +0000 (20:31 +1000)]
Move the new click method configuration tools to the right symbol version set

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: add click method config to the tools
Peter Hutterer [Fri, 16 Jan 2015 00:16:47 +0000 (10:16 +1000)]
tools: add click method config to the tools

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotests: add a few clickfinger tests
Peter Hutterer [Thu, 4 Dec 2014 04:40:53 +0000 (14:40 +1000)]
tests: add a few clickfinger tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: run clickfinger test for all clickpad-capable devices
Peter Hutterer [Thu, 4 Dec 2014 01:47:32 +0000 (11:47 +1000)]
test: run clickfinger test for all clickpad-capable devices

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add tests for clickfinger defaults
Peter Hutterer [Thu, 4 Dec 2014 01:22:41 +0000 (11:22 +1000)]
test: add tests for clickfinger defaults

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: hook up click method configuration
Peter Hutterer [Wed, 14 Jan 2015 13:54:43 +0000 (14:54 +0100)]
touchpad: hook up click method configuration

Allow switching between softbuttons and clickfinger on any mt-capable
clickpad.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
[hdegoede@redhat.com] Keep top softbuttons working when enabling clickfinger
[hdegoede@redhat.com] Simply touchpad click method switching
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
9 years agoAdd a config interface for click methods
Peter Hutterer [Wed, 3 Dec 2014 04:45:26 +0000 (14:45 +1000)]
Add a config interface for click methods

Two methods are provided:
* button area - used on most clickpads, a click with a touch within a given
  area generates left/middle/right clicks
* clickfinger - used on apple touchpads, a click with 1/2/3 fingers on the
  touchpad generates a left, right, middle click

Both methods already exist in the touchpad code, this is just the
configuration interface.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Allow the center of pinned fingers to drift over time
Hans de Goede [Wed, 14 Jan 2015 09:17:06 +0000 (10:17 +0100)]
touchpad: Allow the center of pinned fingers to drift over time

Allow the center of pinned fingers to drift over time, to avoid accidentally
unpinning fingers.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=86807
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>
9 years agotest: add another hover test
Peter Hutterer [Tue, 6 Jan 2015 03:33:38 +0000 (13:33 +1000)]
test: add another hover test

Release one touch point at the same time as a fake touch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add touchpad hover finger test
Peter Hutterer [Fri, 12 Dec 2014 00:02:15 +0000 (10:02 +1000)]
test: add touchpad hover finger test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add a semi-mt + hover synaptics touchpad
Peter Hutterer [Thu, 11 Dec 2014 03:30:33 +0000 (13:30 +1000)]
test: add a semi-mt + hover synaptics touchpad

This device sends touch information before BTN_TOUCH

https://bugs.freedesktop.org/show_bug.cgi?id=87197

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: move semi-mt special tracking into the shared litest.c
Peter Hutterer [Tue, 16 Dec 2014 01:28:26 +0000 (11:28 +1000)]
test: move semi-mt special tracking into the shared litest.c

An upcoming synaptics semi-mt device needs the same code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: add a TOUCH_HOVERING state
Peter Hutterer [Thu, 11 Dec 2014 06:39:04 +0000 (16:39 +1000)]
touchpad: add a TOUCH_HOVERING state

Some touchpads provide touch information while the finger hovers over the
touchpad, i.e. before BTN_TOUCH. Add a touch state for those touchpads so we
can ignore the touches until they actually start.

The approach is now: instead of BEGIN we mark a new touch as HOVERING.
Use the BTN_TOOL_FINGER, BTN_TOOL_DOUBLETAP information during
tp_process_state() to mark any touches that are hovering as down or ended.

i.e. provided BTN_TOUCH is down: if BTN_TOOL_FINGER is down, one hovering
touch gets marked as down, if DOUBLETAP is down, two touches are marked as
down, etc.

When ending touches, switch them back into HOVERING if the BTN_TOOL_FINGER
is still set, otherwise end them properly.

https://bugs.freedesktop.org/show_bug.cgi?id=87197

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: use ffs instead of a manual count
Peter Hutterer [Fri, 12 Dec 2014 02:14:13 +0000 (12:14 +1000)]
touchpad: use ffs instead of a manual count

BTN_TOOL_FINGER, DOUBLETAP, etc. are mutually exclusive in the kernel, so we
can use ffs here instead of manually counting.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: factor out fake finger handling
Peter Hutterer [Fri, 12 Dec 2014 00:31:12 +0000 (10:31 +1000)]
touchpad: factor out fake finger handling

We need this for determining hovering touches on some semi-mt touchpads.

This makes the fake_touches mask use bit 0 for BTN_TOUCH, and the other bits
for BTN_TOOL_FINGER, BTN_TOOL_DOUBLETAP, etc. BTN_TOUCH is independent of the
rest, the others are mutually exclusive in the kernel.

Since the mask isn't a straightforward bitmask anymore, abstract it all
through helper functions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoconfigure.ac: libinput 0.8 0.8.0
Peter Hutterer [Thu, 15 Jan 2015 00:40:44 +0000 (10:40 +1000)]
configure.ac: libinput 0.8

Note: soname bump

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: move DOTFILE_DIRS to libinput.doxygen.in
Peter Hutterer [Thu, 15 Jan 2015 01:43:31 +0000 (11:43 +1000)]
doc: move DOTFILE_DIRS to libinput.doxygen.in

We specify a bunch of other (static) things in the .in file, let's be
consistent.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: specify the IMAGE_PATH relative to the source
Peter Hutterer [Thu, 15 Jan 2015 01:43:04 +0000 (11:43 +1000)]
doc: specify the IMAGE_PATH relative to the source

Fixes doxygen build with custom builddirs

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: add some missing files to EXTRA_DIST
Peter Hutterer [Thu, 15 Jan 2015 00:49:56 +0000 (10:49 +1000)]
doc: add some missing files to EXTRA_DIST

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoRename functions for left handed device configurations
Stephen Chandler Paul [Wed, 7 Jan 2015 02:20:22 +0000 (21:20 -0500)]
Rename functions for left handed device configurations

Some devices require more than just flipping around the buttons, such as
tablets.
When it comes to devices like tablets, because the position of the palm rest is
on the right, the entire tablet has to be flipped around in order to be usable
by lefties. As such, this requires that we reverse the coordinates of the
tablets in addition to flipping the buttons on the tablet. As such, renaming
these functions so that they aren't specific to devices where only the buttons
are flipped seems appropriate.

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoMerge branch 'merged-scroll-events'
Peter Hutterer [Wed, 14 Jan 2015 23:48:29 +0000 (09:48 +1000)]
Merge branch 'merged-scroll-events'

This is merged on top of the wheel normalization patches. Those introduced an
axis source and an extra "discrete" value to the various internal and external
APIs. This branch changed from a single value to passing dx/dy into all scroll
events.

The conflicts are to change everything to take x, y, x_discrete, y_discrete as
values (and the source axis mask of course).

Conflicts:
src/evdev-mt-touchpad-edge-scroll.c
src/evdev.c
src/libinput-private.h
src/libinput.c

9 years agoAdd libinput_event_pointer_get_axis_value_discrete() to count wheel clicks
Peter Hutterer [Tue, 13 Jan 2015 05:15:02 +0000 (15:15 +1000)]
Add libinput_event_pointer_get_axis_value_discrete() to count wheel clicks

The recent normalization of wheel events means we get the angle in degrees but
we don't know how this corresponds to clicks. The M325 has a 20 degree click
angle, most other mice have 15 degrees. So an angle of 60 can be 3 or 4 click
events.

Most clients care more about the click count than the angle on a mouse wheel.
Provide that value when needed.

Adding a discrete value to the axis event leaves the possibility of defining
discrete units for finger/continuous scroll sources in the future. Right now,
these will always reuturn 0.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoChange axis events to carry all directions
Peter Hutterer [Wed, 24 Dec 2014 01:10:04 +0000 (11:10 +1000)]
Change axis events to carry all directions

Sending separate axis events instead of one unified events is limiting,
especially when simultaneously scrolling in both directions and the caller
tries to implement kinetic scrolling.

Take a page from the tablet-support branch and instead implement the axis
event as a generic event that can contain multiple axes simultaneously.

Right now we only have two (scroll) axes and we could easily just check both
for non-zero values. If we want to allow further axes in the future, we need
a check whether an axis is set in an event, that's what
libinput_event_pointer_has_axis to scroll events() is for.

We also need the mask to notify of a scroll stop event, which could otherwise
be confused as a vertical-only or horizontal-only event.

This is an API and ABI break.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoParse the MOUSE_WHEEL_CLICK_ANGLE udev property if present
Peter Hutterer [Sun, 11 Jan 2015 22:39:47 +0000 (08:39 +1000)]
Parse the MOUSE_WHEEL_CLICK_ANGLE udev property if present

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoChange the scroll step distance to 15 and document it as degrees
Peter Hutterer [Fri, 9 Jan 2015 07:03:45 +0000 (17:03 +1000)]
Change the scroll step distance to 15 and document it as degrees

Similar to the mouse resolution, let's make the scroll distance a sensible
predictable value. Most mice use a 15 degree angle per scroll click, so let's
change to that. This will alter behaviour in clients that expect 10.

We return doubles for the axis value, so that leaves the option of
really fine-grained step sizes in the future.

We currently assume all mice have 15 degree angles. Like the DPI settings, it
will require a udev property to be set. Patch for that to follow.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoAdd a comment to clarify what the prop parameter is
Peter Hutterer [Sun, 11 Jan 2015 22:15:12 +0000 (08:15 +1000)]
Add a comment to clarify what the prop parameter is

prop isn't the full property line, just the value.
And document the return value too while we're at it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agolibinput.h: Fix some line wrapping in documentation
Stephen Chandler Paul [Mon, 5 Jan 2015 22:44:37 +0000 (17:44 -0500)]
libinput.h: Fix some line wrapping in documentation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agobuild-pedantic: use main(void)
Marek Chalupa [Fri, 9 Jan 2015 09:34:46 +0000 (10:34 +0100)]
build-pedantic: use main(void)

Main has unused parameters argc and argv. Since they are unused and
C 99 allows to prototype main as 'int main(void)',
remove them and replace by void. It fixes build when unused parameters
are treated as errors.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: switch signal handler in event-debug
Peter Hutterer [Wed, 7 Jan 2015 04:32:16 +0000 (14:32 +1000)]
tools: switch signal handler in event-debug

Under gdb, signalfd will still deliver the signal when gdb itself is
interrupted and quit event-debug. For a debugging tool, that's not optimal.
Switch to a normal signal handler instead, signalfd is overkill here anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agotools: fail if we can't set up signal handlers in event-debug
Peter Hutterer [Wed, 7 Jan 2015 04:09:00 +0000 (14:09 +1000)]
tools: fail if we can't set up signal handlers in event-debug

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoDropped an extra 'the'
Jonas Ådahl [Wed, 7 Jan 2015 04:10:28 +0000 (12:10 +0800)]
Dropped an extra 'the'

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agos/discreet/discrete/
Jonas Ådahl [Wed, 7 Jan 2015 04:03:53 +0000 (12:03 +0800)]
s/discreet/discrete/

Discreet means to not draw attention.

Discrete means non-continuous.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: fix a clang compiler warning
Peter Hutterer [Mon, 5 Jan 2015 23:34:06 +0000 (09:34 +1000)]
touchpad: fix a clang compiler warning

Causes the valgrind tests to fail as tp is considered uninitialized.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fix a clang compiler warning
Peter Hutterer [Mon, 5 Jan 2015 22:49:11 +0000 (08:49 +1000)]
test: fix a clang compiler warning

misc.c:562:10: warning: missing field 'expected_dpi' initializer
[-Wmissing-field-initializers]
                { NULL }

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: drop empty test device interfaces
Peter Hutterer [Mon, 5 Jan 2015 22:52:49 +0000 (08:52 +1000)]
test: drop empty test device interfaces

We can just set the interface component to NULL directly instead. Fixes clang
warnings:

litest-mouse.c:38:1: warning: missing field 'touch_move' initializer
[-Wmissing-field-initializers]

litest-trackpoint.c:38:1: warning: missing field 'touch_move' initializer
[-Wmissing-field-initializers]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoDrop unused function calc_penumbral_gradient
Peter Hutterer [Mon, 5 Jan 2015 22:50:03 +0000 (08:50 +1000)]
Drop unused function calc_penumbral_gradient

Unused since 4913fd7a4806e54ebe4eb7f5f3f1d2fa3b8fdbdb

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoMinor documentation wording improvement
Peter Hutterer [Wed, 24 Dec 2014 01:12:41 +0000 (11:12 +1000)]
Minor documentation wording improvement

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: print device capabilities in event-debug
Peter Hutterer [Sun, 4 Jan 2015 22:36:00 +0000 (08:36 +1000)]
tools: print device capabilities in event-debug

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: change name/seat/logical seat format string
Peter Hutterer [Sun, 4 Jan 2015 22:40:35 +0000 (08:40 +1000)]
tools: change name/seat/logical seat format string

Change the seat field widths to match the usual seat0/default. This compresses
the output a bit, we're printing too much already.

Also, one of my mice has >30 chars, it's annoying to look at. Fix this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd pointer axis sources to the API
Peter Hutterer [Wed, 5 Nov 2014 06:22:07 +0000 (16:22 +1000)]
Add pointer axis sources to the API

For a caller to implement/provide kinetic scrolling ("inertial scrolling",
"fling scrolling"), it needs to know how the scrolling motion was implemented,
and what to expect in the future. Add this information to the pointer axis
event.

The three scroll sources we have are:
* wheels: scrolling is in discreet steps, you don't know when it ends, the
  wheel will just stop sending events
* fingers: scrolling is continuous coordinate space, we know when it stops and
  we can tell the caller
* continuous: scrolling is in continuous coordinate space but we may or may not
  know when it stops. if scroll lock is used, the device may never technically
  get out of scroll mode even if it doesn't send events at any given moment
  Use case: trackpoint/trackball scroll emulation on button press

The stop event is now codified in the API documentation, so callers can use
that for kinetic scrolling. libinput does not implement kinetic scrolling
itself.

Not covered by this patch:
* The wheel event is currently defined as "typical mouse wheel step", this is
  different to Qt where the step value is 1/8 of a degree. Some better
  definition here may help.
* It is unclear how an absolute device would map into relative motion if the
  device itself is not controlling absolute motion.
* For diagonal scrolling, the vertical/horizontal terminator events would come
  in separately. The caller would have to deal with that somehow.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Original patch, before the rebase onto today's master:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add edge-scrolling tests
Peter Hutterer [Wed, 24 Dec 2014 00:16:12 +0000 (10:16 +1000)]
test: add edge-scrolling tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd libinput_set_user_data
Peter Hutterer [Tue, 23 Dec 2014 03:37:28 +0000 (13:37 +1000)]
Add libinput_set_user_data

Previously, the pointer could only be passed into the context on creation
time and was immutable after that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoDeclare libinput.sym as dependency
Peter Hutterer [Thu, 18 Dec 2014 04:18:53 +0000 (14:18 +1000)]
Declare libinput.sym as dependency

We want to rebuild whenever it changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: revert to pointer movement when stopping twofinger scrolling
Peter Hutterer [Thu, 18 Dec 2014 00:37:38 +0000 (10:37 +1000)]
touchpad: revert to pointer movement when stopping twofinger scrolling

Add a boolean state machine for two-finger scrolling so we know when we're
currently scrolling. If we were scrolling and it stops, pick the active
touch as pointer touch so we can go back to pointer movement without having to
lift the finger off the touchpad.

https://bugs.freedesktop.org/show_bug.cgi?id=86807

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: rename scroll.state to scroll.edge_state
Peter Hutterer [Thu, 18 Dec 2014 00:21:48 +0000 (10:21 +1000)]
touchpad: rename scroll.state to scroll.edge_state

In preparation for a twofinger_state field, to avoid confusion.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: switch tests to use the new helper function
Peter Hutterer [Thu, 18 Dec 2014 01:52:31 +0000 (11:52 +1000)]
test: switch tests to use the new helper function

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add helper function for checking for a specific event type
Peter Hutterer [Thu, 18 Dec 2014 01:29:32 +0000 (11:29 +1000)]
test: add helper function for checking for a specific event type

In a few tests we care about that a specific set of events are in the queue
but not about the details of the events (usually checked elsewhere). Instead
of manual loops, provide a helper function that also checks that there is at
least one of those events in the queue.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: switch touch points around for semi-mt tap-n-drag testing
Peter Hutterer [Thu, 18 Dec 2014 03:52:36 +0000 (13:52 +1000)]
test: switch touch points around for semi-mt tap-n-drag testing

The tests ignored it when motion events never happened - but that's mostly
what these tests are about. This only happened for semi-mt devices that use
the bounding box only, not separate touch points. Switching the touch points
around that the bounding box doesn't interfere causes the test to work as
expected.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: pass the userdata to the context
Peter Hutterer [Tue, 23 Dec 2014 01:13:33 +0000 (11:13 +1000)]
tools: pass the userdata to the context

The event-gui needs this but it got dropped in
6ee8c585, causing a crash. Oops.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: use the new shared lib from event-gui
Peter Hutterer [Thu, 18 Dec 2014 04:47:54 +0000 (14:47 +1000)]
tools: use the new shared lib from event-gui

This gives the event gui the ability to use the path backend, and any
configuration toggles given on the commandline.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: add support for enabling/disabling left-handed button mappings
Peter Hutterer [Thu, 18 Dec 2014 05:14:09 +0000 (15:14 +1000)]
tools: add support for enabling/disabling left-handed button mappings

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: add support to enable/disable natural scrolling
Peter Hutterer [Thu, 18 Dec 2014 05:10:59 +0000 (15:10 +1000)]
tools: add support to enable/disable natural scrolling

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: move applying device configuration to shared lib
Peter Hutterer [Thu, 18 Dec 2014 05:10:09 +0000 (15:10 +1000)]
tools: move applying device configuration to shared lib

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: move opening the backend to the shared lib too
Peter Hutterer [Thu, 18 Dec 2014 05:02:45 +0000 (15:02 +1000)]
tools: move opening the backend to the shared lib too

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: move option parsing to a helper library
Peter Hutterer [Thu, 18 Dec 2014 04:42:42 +0000 (14:42 +1000)]
tools: move option parsing to a helper library

event-debug and event-gui can and should share this

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: add --enable-tap to event-debug
Peter Hutterer [Thu, 18 Dec 2014 03:04:50 +0000 (13:04 +1000)]
tools: add --enable-tap to event-debug

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: make event-debug's option parsing more flexible
Peter Hutterer [Thu, 18 Dec 2014 02:56:14 +0000 (12:56 +1000)]
tools: make event-debug's option parsing more flexible

We need to be able to turn config options on/off for testing, so switch to
something that's a bit more flexible than characters that represent the
options.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: move the wiki's palm detection docs to here
Peter Hutterer [Mon, 22 Dec 2014 23:47:39 +0000 (09:47 +1000)]
doc: move the wiki's palm detection docs to here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: move the wiki's tapping documentation to here
Peter Hutterer [Mon, 22 Dec 2014 23:32:37 +0000 (09:32 +1000)]
doc: move the wiki's tapping documentation to here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: move the wiki's scrolling documentation to here
Peter Hutterer [Mon, 22 Dec 2014 23:24:33 +0000 (09:24 +1000)]
doc: move the wiki's scrolling documentation to here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: add link to udev hwdb in rel motion normalization doc
Peter Hutterer [Mon, 22 Dec 2014 22:15:00 +0000 (08:15 +1000)]
doc: add link to udev hwdb in rel motion normalization doc

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: document the calibration as well
Peter Hutterer [Mon, 22 Dec 2014 02:11:46 +0000 (12:11 +1000)]
doc: document the calibration as well

Requires MathJax for client-side, but that's an easy dependency to accept and
better than requiring Latex to build the documentation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: improve seat documentation
Peter Hutterer [Mon, 22 Dec 2014 00:33:55 +0000 (10:33 +1000)]
doc: improve seat documentation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: move "device configuration via udev" page to here
Peter Hutterer [Mon, 22 Dec 2014 00:11:09 +0000 (10:11 +1000)]
doc: move "device configuration via udev" page to here

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: drop touchpad button behavior page - provided in doc/ now
Peter Hutterer [Mon, 22 Dec 2014 00:09:27 +0000 (10:09 +1000)]
doc: drop touchpad button behavior page - provided in doc/ now

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: move relative motion normalization page over to doc/
Peter Hutterer [Mon, 22 Dec 2014 00:08:13 +0000 (10:08 +1000)]
doc: move relative motion normalization page over to doc/

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoImprove the documentation
Peter Hutterer [Mon, 22 Dec 2014 00:04:58 +0000 (10:04 +1000)]
Improve the documentation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdded configure option for documentation build.
Jon A. Cruz [Thu, 18 Dec 2014 18:49:59 +0000 (10:49 -0800)]
Added configure option for documentation build.

Added option with fallback of 'auto' to control building of documentation.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoInitial move of some wiki contents into main documentation.
Jon A. Cruz [Thu, 18 Dec 2014 18:49:58 +0000 (10:49 -0800)]
Initial move of some wiki contents into main documentation.

This moves some information from the wiki into the main generated doxygen
documenation. It is fairly rought but includes examples for inline and
stand-alone diagrams, linking to external HTML pages, etc.

Among other things, it allows for better cross-referencing into the
main doxygen contents and thus for overall shorter documentation.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotools: add --help to event-debug's usage
Peter Hutterer [Thu, 18 Dec 2014 02:57:59 +0000 (12:57 +1000)]
tools: add --help to event-debug's usage

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fix busted indentation
Peter Hutterer [Thu, 18 Dec 2014 01:55:17 +0000 (11:55 +1000)]
test: fix busted indentation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Use TOUCHPAD_MIN_SAMPLES in tp_get_delta
Hans de Goede [Tue, 9 Dec 2014 11:47:11 +0000 (12:47 +0100)]
touchpad: Use TOUCHPAD_MIN_SAMPLES in tp_get_delta

Use TOUCHPAD_MIN_SAMPLES in tp_get_delta rather then hardcoding "4".

Also remove the superfluous TOUCHPAD_MIN_SAMPLES check before calling
tp_get_delta in tp_get_pointer_delta, this is not necessary as tp_get_delta
already checks itself.

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>
9 years agotouchpad: When a clickpad is clicked post combined motion of all touches
Hans de Goede [Tue, 9 Dec 2014 11:47:10 +0000 (12:47 +0100)]
touchpad: When a clickpad is clicked post combined motion of all touches

When clicking a clickpad the user may want to switch fingers to move the
pointer around, without lifting so as to not release the button.

Switch to using combined motion of all touches when a clickpad is clicked to
allow this.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=86807
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>
9 years agotouchpad: Add a tp_post_pointer_motion helper function
Hans de Goede [Tue, 9 Dec 2014 11:47:09 +0000 (12:47 +0100)]
touchpad: Add a tp_post_pointer_motion helper function

Split out the pointer-motion handling into a helper function.

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>