platform/upstream/libinput.git
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>
9 years agotouchpad: print event type on state machine error
Peter Hutterer [Fri, 12 Dec 2014 01:21:05 +0000 (11:21 +1000)]
touchpad: print event type on state machine error

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: fix typos in error message
Peter Hutterer [Fri, 12 Dec 2014 01:13:21 +0000 (11:13 +1000)]
touchpad: fix typos in error message

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: fix two compiler warnings
Peter Hutterer [Thu, 11 Dec 2014 06:30:03 +0000 (16:30 +1000)]
test: fix two compiler warnings

device.c:596:2: warning: incompatible pointer to integer conversion
initializing 'intmax_t' (aka 'long') with an expression of type 'struct
libinput_device *' [-Wint-conversion]
        ck_assert_int_eq(libinput_event_get_device(event),

use ck_assert_ptr_eq() instead

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: print axis event information for debugging too
Peter Hutterer [Thu, 11 Dec 2014 04:11:27 +0000 (14:11 +1000)]
test: print axis event information for debugging too

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: print the string of the event type
Peter Hutterer [Thu, 11 Dec 2014 04:02:37 +0000 (14:02 +1000)]
test: print the string of the event type

Bit quicker to parse than the number

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: put some extra warning in for libinput_event_destroy()
Peter Hutterer [Tue, 9 Dec 2014 03:52:45 +0000 (13:52 +1000)]
doc: put some extra warning in for libinput_event_destroy()

Unlike all other structs, events aren't refcounted and will get destroyed
immediately.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agodoc: document the base structures so they show up in doxygen
Peter Hutterer [Tue, 9 Dec 2014 03:37:04 +0000 (13:37 +1000)]
doc: document the base structures so they show up in doxygen

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agodoc: add the various events to the doxygen groups
Peter Hutterer [Tue, 9 Dec 2014 03:31:09 +0000 (13:31 +1000)]
doc: add the various events to the doxygen groups

Makes them show up on the respective page and in the data structures list
doxygen generates.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agodoc: include README as mainpage
Peter Hutterer [Tue, 9 Dec 2014 03:19:54 +0000 (13:19 +1000)]
doc: include README as mainpage

doxygen supports markdown so we can expand the README with general interesting
information in markdown format and have it be the front page of the
documentation at the same time.

This requires renaming README to README.txt, but that's a relatively small
price to pay.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoUse symbol versioning
Peter Hutterer [Tue, 9 Dec 2014 02:52:45 +0000 (12:52 +1000)]
Use symbol versioning

This isn't the final 0.8.0 API yet, but we might as well get started.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoDrop deprecated symbols
Peter Hutterer [Tue, 9 Dec 2014 02:55:17 +0000 (12:55 +1000)]
Drop deprecated symbols

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agotest: create a new device during the disable test to change fds
Peter Hutterer [Wed, 10 Dec 2014 01:01:08 +0000 (11:01 +1000)]
test: create a new device during the disable test to change fds

In the current test, disable followed by enable would result in the same fd
number for the new device, not exposing a bug fixed by
"evdev: Ensure the libevdev object receives the new fd on resume"

Create a keyboard device after suspending the first device, then re-enable the
device. This changes the fd to a different number, so we pick up on internal
bugs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: Ensure the libevdev object receives the new fd on resume
Carlos Garnacho [Tue, 9 Dec 2014 14:55:32 +0000 (15:55 +0100)]
evdev: Ensure the libevdev object receives the new fd on resume

Otherwise, input_events will be attempted to read from the wrong place,
which also leaves the right/current fd with pending data to be read,
making the epoll fd wake up constantly.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Use remove callback to unlink event listener and stop timers
Hans de Goede [Fri, 5 Dec 2014 11:50:39 +0000 (12:50 +0100)]
touchpad: Use remove callback to unlink event listener and stop timers

We use 2 mechanisms to unregister the trackpoint event listener depending on
device removal order.

1) We have a device_removed callback, if the trackpoint gets removed before
the touchpad, this gets called, sees the device being removed is the trackpoint
and unregisters the listener

2) If the touchpad gets removed first, then in tp_destroy we unregister the
listener

2) May be delayed beyond the destruction of the trackpoint itself if the
libinput user has a reference to the libinput_device for the touchpad.
When this happens the trackpoint still has an eventlistener at destroy time
and an assert triggers.

To fix this we must do 2) at the same time as we do 1), so at remove time.

While working on this I noticed that the touchpad code was also cancelling
timers at destroy time rather then remove time, which means that they may
expire between remove and destroy time, and cause events to be emitted from
a removed device, so this commit moves the cancelling of the timers to the
remove callback as well.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: Add a remove callback to the evdev_dispatch_interface
Hans de Goede [Fri, 5 Dec 2014 11:39:16 +0000 (12:39 +0100)]
evdev: Add a remove callback to the evdev_dispatch_interface

Some dispatchers may want to do some cleanup at remove time, rather then at
destroy time.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoREADME: link to bugzilla and API docs
Peter Hutterer [Tue, 9 Dec 2014 02:58:04 +0000 (12:58 +1000)]
README: link to bugzilla and API docs

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: fix wording on the dpi normalization paragraph
Peter Hutterer [Tue, 9 Dec 2014 03:42:45 +0000 (13:42 +1000)]
doc: fix wording on the dpi normalization paragraph

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: delete double-empty lines
Peter Hutterer [Tue, 9 Dec 2014 03:56:02 +0000 (13:56 +1000)]
doc: delete double-empty lines

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: Remove double-semicolon
Carlos Garnacho [Mon, 8 Dec 2014 09:46:54 +0000 (10:46 +0100)]
evdev: Remove double-semicolon

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoconfigure.ac: libinput 0.7 0.7.0
Peter Hutterer [Fri, 5 Dec 2014 02:08:22 +0000 (12:08 +1000)]
configure.ac: libinput 0.7

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoudev: only apply default calibration on absolute devices
Peter Hutterer [Fri, 5 Dec 2014 03:41:04 +0000 (13:41 +1000)]
udev: only apply default calibration on absolute devices

Fixes a crash if the LIBINPUT_CALIBRATION_MATRIX is set for a relative device.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agoSplit libinput-util into a noinst helper library
Peter Hutterer [Fri, 5 Dec 2014 02:52:22 +0000 (12:52 +1000)]
Split libinput-util into a noinst helper library

Fixes distcheck (automake 1.14.1)

make[2]: Entering directory '....../libinput-0.7.0/_build/test'
Makefile:926: ../src/.deps/libinput-util.Plo: No such file or directory
make[2]: *** No rule to make target '../src/.deps/libinput-util.Plo'.  Stop.
make[2]: Leaving directory '....../libinput/libinput-0.7.0/_build/test'
Makefile:412: recipe for target 'distclean-recursive' failed

That was the only place we used subdir objects, so we can drop it from
configure now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
9 years agotest: Don't send two motion events when button scrolling
Jonas Ådahl [Thu, 4 Dec 2014 03:44:10 +0000 (11:44 +0800)]
test: Don't send two motion events when button scrolling

Button scrolling motion events don't pass through the acceleration
filter so no need to assume the initial event will be absorbed.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoIntroduce unaccelerated motion event vectors
Jonas Ådahl [Thu, 4 Dec 2014 03:44:09 +0000 (11:44 +0800)]
Introduce unaccelerated motion event vectors

For certain applications (such as FPS games) it is necessary to use
unaccelerated motion events (the motion vector that is passed to the
acceleration filter) to get a more natural feeling. Supply this
information by passing both accelerated and unaccelerated motion
vectors to the existing motion event.

Note that the unaccelerated motion event is not equivalent to 'raw'
events as read from devices.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAlways check for INVALID configs first
Peter Hutterer [Thu, 4 Dec 2014 06:50:32 +0000 (16:50 +1000)]
Always check for INVALID configs first

Always check for invalid input first, then check if the input is supported by
the actual device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: drop unused device arg from tp_clear_state
Peter Hutterer [Thu, 4 Dec 2014 01:08:01 +0000 (11:08 +1000)]
touchpad: drop unused device arg from tp_clear_state

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd missing @ingroup tag
Peter Hutterer [Wed, 3 Dec 2014 04:28:12 +0000 (14:28 +1000)]
Add missing @ingroup tag

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoDocument relative motion normalization
Peter Hutterer [Wed, 3 Dec 2014 01:57:35 +0000 (11:57 +1000)]
Document relative motion normalization

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoAdd libinput_device_get_context/libinput_seat_get_context
Peter Hutterer [Mon, 1 Dec 2014 06:00:13 +0000 (16:00 +1000)]
Add libinput_device_get_context/libinput_seat_get_context

Allow retrieval of the libinput context from the seat and the device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoAdd a function to retrieve the udev_device handle from a libinput device
Peter Hutterer [Fri, 31 Oct 2014 00:53:53 +0000 (10:53 +1000)]
Add a function to retrieve the udev_device handle from a libinput device

The libinput device abstracts a number of things but sometimes the underlying
device is important. The udev device provides the necessary handle to access
that underlying device and various sysfs properties that may be necessary.

A function returning the device node would've done the same thing but is more
prone to race conditions than the udev_device.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoChange default DPI to 1000
Peter Hutterer [Fri, 28 Nov 2014 00:09:21 +0000 (10:09 +1000)]
Change default DPI to 1000

400 used to be the default DPI for many mice but it it's not anymore. A survey
of mice shows that 400 is still common as one of the pre-configured settings
in switchable multi-resolution gaming mice, but devices with a single
resolution mostly favor 1000 dpi.

Let's make that switch now so that any future changes to the pointer
acceleration code assumes that resolution as a default.

For the touchpad, this has a bad side-effect, caused by our expectation of
mouse vs touchpad behaviours: our acceleration code ignores device type and
provides the same acceleration for the same physical movement. Unfortunately,
we expect touchpads to be significantly slower than mice.

The previous 400 DPI worked because it caused an acceptable slowdown on input.
e.g. on the T440 with a res of 42 units/mm, the scale coefficient was 0.37.
For 1000 DPI as default, this now results in 0.94, i.e. speeding up the
touchpad by a factor of 2.5. That is way too fast.

Adding touchpad-specific filter code is a bigger project, so let's just add a
fixme for now and scale the coefficient back to what it was before the
DPI default change. Effect: touchpad behaves as before.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoMove DEFAULT_MOUSE_DPI to filter.h
Peter Hutterer [Fri, 28 Nov 2014 00:08:02 +0000 (10:08 +1000)]
Move DEFAULT_MOUSE_DPI to filter.h

The filter code is what relies on some default dpi configuration to apply
pointer acceleration and expects the input coordinates to be pre-scaled to
that resolution.

Let's move the define here so we can use it from the touchpad code too.

No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agofilter: fix a comment, 400 isn't hard-coded anymore
Peter Hutterer [Fri, 28 Nov 2014 00:00:30 +0000 (10:00 +1000)]
filter: fix a comment, 400 isn't hard-coded anymore

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: Query mouse DPI from udev
Derek Foreman [Tue, 25 Nov 2014 17:46:42 +0000 (11:46 -0600)]
evdev: Query mouse DPI from udev

Instead of using a hard coded mouse DPI value, we query it from udev.
If it's not present or the property is obviously broken we fall back
to default.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: move device ID test to test/device.c
Peter Hutterer [Mon, 1 Dec 2014 03:21:26 +0000 (13:21 +1000)]
test: move device ID test to test/device.c

More appropriate here, they were in misc because this file didn't exist yet
when they were added.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: Fix uninitialized variable warning
Derek Foreman [Tue, 25 Nov 2014 17:53:23 +0000 (11:53 -0600)]
evdev: Fix uninitialized variable warning

The early exit path in evdev_device_compare_syspath() expects
udev_device_new to be initialized to NULL, but it wasn't.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoIgnore devices that have joystick buttons
Krzysztof A. Sobiecki [Tue, 25 Nov 2014 01:33:53 +0000 (02:33 +0100)]
Ignore devices that have joystick buttons

This patch allows libinput to ignore devices that have joystick buttons.

Signed-off-by: Krzysztof Sobiecki <sobkas@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: Add edge-scrolling support
Hans de Goede [Mon, 24 Nov 2014 11:16:06 +0000 (12:16 +0100)]
touchpad: Add edge-scrolling support

Add edge-scrolling support for non multi-touch touchpads as well as for
users who prefer edge-scrolling (as long as they don't have a clickpad).

Note the percentage to use of the width / height as scroll-edge differs from
one manufacturer to the next, the various per model percentages were taken
from xf86-input-synaptics.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=85635
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 code to get the touchpad model / manufacturer
Hans de Goede [Mon, 24 Nov 2014 11:16:05 +0000 (12:16 +0100)]
touchpad: Add code to get the touchpad model / manufacturer

This is useful to know in some cases, it is e.g. necessary to figure out
which percentage of a touchpads range to use as edge for edge-scrolling.

Note this is a slightly cleaned up copy of the same code in
xf86-input-synaptics.

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: Move 2 finger scrolling functions to above tp_process_state()
Hans de Goede [Mon, 24 Nov 2014 11:16:04 +0000 (12:16 +0100)]
touchpad: Move 2 finger scrolling functions to above tp_process_state()

This is purely a code move, this is a preparation patch for adding edge
scrolling support.

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 seat changing tests
Peter Hutterer [Wed, 19 Nov 2014 05:42:54 +0000 (15:42 +1000)]
test: add seat changing tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoAdd libinput_device_set_seat_logical_name() to change seats at runtime
Peter Hutterer [Wed, 19 Nov 2014 03:43:59 +0000 (13:43 +1000)]
Add libinput_device_set_seat_logical_name() to change seats at runtime

The seat of a device is currently immutable, but a device may (in a
multi-pointer case) move between different logical seats. Moving it between
seats is akin to removing it and re-plugging it, so let's do exactly that.

The physical seat name stays immutable.

Pro:
- device handling after changing a seat remains identical as handling any
  other device.
Con:
- tracking a device across seat changes is difficult
- this is not an atomic operation, if re-adding the device fails it stays
  removed from the original seat and is now dead

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agopath: optionally pass the seat name into path_device_enable()
Peter Hutterer [Wed, 19 Nov 2014 04:16:48 +0000 (14:16 +1000)]
path: optionally pass the seat name into path_device_enable()

Prep work for changing seat names on devices. No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoudev: optionally pass the seat name into device_added()
Peter Hutterer [Wed, 19 Nov 2014 04:12:16 +0000 (14:12 +1000)]
udev: optionally pass the seat name into device_added()

Prep work for changing seat names on devices. No functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: remove a race condition opening the wrong device
Peter Hutterer [Fri, 21 Nov 2014 06:18:57 +0000 (16:18 +1000)]
evdev: remove a race condition opening the wrong device

Potential race condition:
- udev notifies us that a udev_device became available
- we go for a coffee and chat to the neighbours on the way
- the device is unplugged
- a new device is plugged in, gets the same devnode
- we finish our coffee and come back
- open(udev_device_get_devnode())
- new device is now opened as the old device

To avoid the above race, we compare the syspath of the device at the open fd
with the syspath of the device we originally wanted. If they differ, we fail.

evdev_compare_syspath was simply moved up.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: use a udev_device instead of separate sysname/syspath/devnode
Peter Hutterer [Thu, 20 Nov 2014 03:55:48 +0000 (13:55 +1000)]
evdev: use a udev_device instead of separate sysname/syspath/devnode

Using a udev_device instead of the various bits separately safes us
re-initializing udev contexts whenever we need to compare the device. And
having the actual udev device makes it a bit easier to ensure that we're not
re-initializing a different device as a current one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agopath: store the udev device instead of just the devnode
Peter Hutterer [Thu, 20 Nov 2014 03:50:57 +0000 (13:50 +1000)]
path: store the udev device instead of just the devnode

Long-term plan to use more of udev_device here is to better protect us against
re-opening a different device that happens to have the same devnode.

This now also prints an error message for invalid devices, the log tests are
adjusted.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agopath: split out creating a device into a helper function
Peter Hutterer [Wed, 19 Nov 2014 05:26:40 +0000 (15:26 +1000)]
path: split out creating a device into a helper function

No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agopath: keep the udev context around
Peter Hutterer [Thu, 20 Nov 2014 03:36:32 +0000 (13:36 +1000)]
path: keep the udev context around

We need it for each device anyway, keep the ref around. Makes error handling a
bit easier, we don't need to handle failing udev_new() and reduce the danger
of mis-refcounting it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoRename scroll_mode to scroll_method
Peter Hutterer [Wed, 19 Nov 2014 02:16:28 +0000 (12:16 +1000)]
Rename scroll_mode to scroll_method

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: fix leaking file descriptor
Peter Hutterer [Fri, 21 Nov 2014 06:20:42 +0000 (16:20 +1000)]
evdev: fix leaking file descriptor

If zalloc fails, we need to close the fd.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoDrop unused libinput_device->terminated field
Peter Hutterer [Thu, 20 Nov 2014 02:08:22 +0000 (12:08 +1000)]
Drop unused libinput_device->terminated field

Unused since commit 56f7dde "Port udev-seat to be used in libinput"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotouchpad: print the device name on error
Peter Hutterer [Thu, 20 Nov 2014 04:26:10 +0000 (14:26 +1000)]
touchpad: print the device name on error

A little bit easier to recognize.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agodoc: add a few missing @ref tags
Peter Hutterer [Thu, 20 Nov 2014 01:44:02 +0000 (11:44 +1000)]
doc: add a few missing @ref tags

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: add natural scrolling tests for pointers
Peter Hutterer [Tue, 18 Nov 2014 02:03:48 +0000 (12:03 +1000)]
test: add natural scrolling tests for pointers

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: enable natural scrolling for all pointer devices
Peter Hutterer [Tue, 18 Nov 2014 01:38:38 +0000 (11:38 +1000)]
evdev: enable natural scrolling for all pointer devices

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: move natural scrolling configuration into evdev
Peter Hutterer [Tue, 18 Nov 2014 01:01:10 +0000 (11:01 +1000)]
evdev: move natural scrolling configuration into evdev

We're about to add natural scroll support to other devices as well, let's
share the code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: move calibration/sendevents config init into helpers
Peter Hutterer [Tue, 18 Nov 2014 00:49:47 +0000 (10:49 +1000)]
evdev: move calibration/sendevents config init into helpers

no functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotools: print the device name on DEVICE_ADDED
Peter Hutterer [Tue, 18 Nov 2014 01:33:51 +0000 (11:33 +1000)]
tools: print the device name on DEVICE_ADDED

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotools: print config options for each device on DEVICE_ADDED
Peter Hutterer [Tue, 18 Nov 2014 01:16:24 +0000 (11:16 +1000)]
tools: print config options for each device on DEVICE_ADDED

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoAllow for a 0 button on button scrolling
Peter Hutterer [Wed, 19 Nov 2014 01:22:17 +0000 (11:22 +1000)]
Allow for a 0 button on button scrolling

This effectively disables the button scrolling, but since 0 is the default
button for most devices, we should allow setting the default button.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: Hookup scroll-mode configuration
Hans de Goede [Tue, 4 Nov 2014 09:43:39 +0000 (10:43 +0100)]
touchpad: Hookup scroll-mode configuration

Default to 2fg scrolling for now, once we have edge-scrolling we can default
to edge-scrolling on touchpads which cannot detect more than 1 touch.

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 agoevdev: fix indentation on an if condition
Peter Hutterer [Tue, 18 Nov 2014 03:26:21 +0000 (13:26 +1000)]
evdev: fix indentation on an if condition

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agoevdev: add missing break
Peter Hutterer [Tue, 18 Nov 2014 01:55:42 +0000 (11:55 +1000)]
evdev: add missing break

No effect, was the last case statement in the switch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9 years agotest: Add button scroll test to pointer tests
Hans de Goede [Thu, 6 Nov 2014 15:35:13 +0000 (16:35 +0100)]
test: Add button scroll test to pointer tests

Non trackpoint button scrolling is mainly intended for use with trackballs,
but we can test it just as well with any relative pointer device.

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 litest_button_scroll helper function
Hans de Goede [Thu, 6 Nov 2014 15:32:53 +0000 (16:32 +0100)]
test: Add litest_button_scroll helper function

Turn test_trackpoint_scroll into a generic helper function for testing
"button scrolling".

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 trackpoint middle button scrolling disable test
Hans de Goede [Thu, 6 Nov 2014 13:23:12 +0000 (14:23 +0100)]
test: Add trackpoint middle button scrolling disable test

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: s/test_2fg_scroll/test_trackpoint_scroll/
Hans de Goede [Thu, 6 Nov 2014 10:35:26 +0000 (11:35 +0100)]
test: s/test_2fg_scroll/test_trackpoint_scroll/

Fix copy and paste error, causing the function to test trackpoint scrolling
to be named test_2fg_scroll.

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: s/config/config_natural/
Hans de Goede [Tue, 4 Nov 2014 08:54:07 +0000 (09:54 +0100)]
touchpad: s/config/config_natural/

To avoid confusion with scroll mode configuration.

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 agoevdev: Hookup scroll mode configuration
Hans de Goede [Thu, 6 Nov 2014 12:39:51 +0000 (13:39 +0100)]
evdev: Hookup scroll mode configuration

Keep the default behavior of middle button scrolling on trackpoints, this
allows turning off middle button scrolling on trackpoints, as well as turning
on button scrolling on trackballs.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=85535
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 agoevdev: Add evdev_any_button_down helper function
Hans de Goede [Thu, 6 Nov 2014 11:47:51 +0000 (12:47 +0100)]
evdev: Add evdev_any_button_down 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>
9 years agoAdd configuration option to select scroll mode
Hans de Goede [Mon, 3 Nov 2014 13:52:59 +0000 (14:52 +0100)]
Add configuration option to select scroll mode

Add a configuration option to allow selecting between 2-finger / edge / none
scrolling (for touchpads).

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 agoAdd libinput_device_has_button function
Hans de Goede [Thu, 6 Nov 2014 11:27:35 +0000 (12:27 +0100)]
Add libinput_device_has_button function

In some cases the compositor will want to know which buttons a device has.

E.g. for scrolling we want the compositor to be able to set a button to change
a relative device (e.g. a trackball) into scroll mode, so that it sends
scroll-axis events instead of pointer motion events.

In order for the compositor to be able to present a sane UI for this, it needs
to know which buttons a device has.

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 agoFix libinput_device_config_send_events_get_default_mode docs
Hans de Goede [Mon, 10 Nov 2014 10:59:12 +0000 (11:59 +0100)]
Fix libinput_device_config_send_events_get_default_mode docs

Fix libinput_device_config_send_events_get_default_mode docs referring to
itself, instead make it refer to libinput_device_config_send_events_get_mode.

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 agoevdev: use distance triggers to start scrolling
Peter Hutterer [Fri, 7 Nov 2014 06:08:34 +0000 (16:08 +1000)]
evdev: use distance triggers to start scrolling

The previous code used delta/event as scroll trigger which roughly translates
to speed, but depends on the sampling rate of the device.

For slow two-finger motion, a user may move the height of the touchpad without
ever triggering scrolling. Change the _initial_ trigger to a cumulative
trigger, i.e. once the user moved past the threshold distance, scrolling
starts regardless of the speed.

Once scrolling is engaged, the original trigger of threshold/event is
required to engange the second scroll direction.

Note that except for really slow movements, it's very easy to engage both
scroll directions on a touchpad. This is intentional, libinput does not have
enough semantic knowledge to know if horizontal scrolling is needed. So we
provide some direction locking but not much, it's up to the
client/toolkit/widget to decide if both scroll directions should be handled.
Add a comment to clarify that in the public doc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotouchpad: explicitly init scroll settings
Peter Hutterer [Sun, 9 Nov 2014 23:24:37 +0000 (09:24 +1000)]
touchpad: explicitly init scroll settings

No effect, we're just initializing with the same value we did before. What is
important here is the comment, the touchpad scroll threshold is in mm
for touchpads providing a resolution.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: use fabs(x) instead of (x <= -a || x >= a)
Peter Hutterer [Sun, 9 Nov 2014 22:44:11 +0000 (08:44 +1000)]
evdev: use fabs(x) instead of (x <= -a || x >= a)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agoevdev: move scroll flag setting/check into a helper function
Peter Hutterer [Sun, 9 Nov 2014 22:39:58 +0000 (08:39 +1000)]
evdev: move scroll flag setting/check into a helper function

Much more readable, especially with the upcoming patches.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: rename a parameter to litest_assert_scroll()
Peter Hutterer [Mon, 10 Nov 2014 01:03:46 +0000 (11:03 +1000)]
test: rename a parameter to litest_assert_scroll()

This doesn't test for direction only, it tests for the minimum distance we
expect in the scroll event. Rename accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add VMWare Virtual USB Mouse device
Peter Hutterer [Thu, 6 Nov 2014 06:10:15 +0000 (16:10 +1000)]
test: add VMWare Virtual USB Mouse device

Yes, the name has VMware twice, not a typo.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add Xen Virtual Pointer device
Peter Hutterer [Wed, 29 Oct 2014 02:08:20 +0000 (12:08 +1000)]
test: add Xen Virtual Pointer device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add test for absolute pointer motion
Peter Hutterer [Wed, 29 Oct 2014 01:58:09 +0000 (11:58 +1000)]
test: add test for absolute pointer motion

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: add QEMU tablet as test device
Peter Hutterer [Wed, 29 Oct 2014 00:59:58 +0000 (10:59 +1000)]
test: add QEMU tablet as test device

Re-uses the touch_down interface for now, but requires the slot is always 0.
That's easier for now than adding a new interface for abs event, at least
until we have more than one device that needs it.

This device, along with a couple of similar ones have a tendency to break in
the X.Org stack without people noticing. They're special in that they have
absolute x/y axes but relative wheels. For libinput that's not as much of a
problem as it is in X but let's add them anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
9 years agotest: rename LITEST_POINTER to LITEST_RELATIVE
Peter Hutterer [Wed, 29 Oct 2014 01:05:20 +0000 (11:05 +1000)]
test: rename LITEST_POINTER to LITEST_RELATIVE

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>