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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Peter Hutterer [Fri, 7 Nov 2014 00:02:56 +0000 (10:02 +1000)]
evdev: don't ignore REL_HWHEEL values over 1
Matching patch for REL_WHEEL is
09a3770961aad0973, not sure why I didn't
do both at the same time.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 10 Nov 2014 00:57:27 +0000 (10:57 +1000)]
test: fix coding style
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 7 Nov 2014 01:02:22 +0000 (11:02 +1000)]
Merge branch 'for-peter' of git://people.freedesktop.org/~jwrdegoede/libinput
David Herrmann [Wed, 5 Nov 2014 12:32:17 +0000 (13:32 +0100)]
evdev: ratelimit SYN_DROPPED logging
Use the ratelimit helpers for SYN_DROPPED logging. This guarantees that we
will still receive SYN_DROPPED log-messages after multiple days of
runtime, even though there might have been a SYN_DROPPED flood at one
point in time.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
David Herrmann [Wed, 5 Nov 2014 12:32:16 +0000 (13:32 +0100)]
util: introduce ratelimit helpers
This adds "struct ratelimit" and "ratelimit_test()". It's a very simple
rate-limit helper modeled after Linux' lib/ratelimit.c by Dave Young.
This comes in handy to limit log-messages in possible busy loops etc..
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Sun, 28 Sep 2014 10:51:09 +0000 (12:51 +0200)]
touchpad: Make tap code follow state machine diagram part 3
We should only mark touches dead on a button click if we're dealing with a
clickpad.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Sun, 28 Sep 2014 10:49:06 +0000 (12:49 +0200)]
touchpad: Make tap code follow state machine diagram part 2
Mark touches as idle, rather then dead, on release. This causes no functional
changes since we only evert check for tap-touch-state == touch, and neither
being idle or dead == touch.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Thu, 6 Nov 2014 10:15:27 +0000 (11:15 +0100)]
touchpad: Make tap code follow state machine diagram part 1
According to the diagram, we should only check the tap-touch-state before
sending a button press / release when in state touch_2 or touch_3.
tp_tap_notify always checks the tap-touch-state. This is problematic when in
state tapped, or one of the follow up states, since this could cause the
button 1 release to never happen.
In practice this is never a problem since the touch passed into tp_tap_notify
is NULL when called for timeout or button events, and in the 2 affected paths
where we're dealing with a touch or release tap-touch-state always is
TAP_TOUCH_STATE_TOUCH.
However we should not rely on this and properly follow the diagram, this
commit therefor drops the touch argument to tp_tap_notify, and adds explicit
tap-touch-state checks in the places where they are present in the diagram too.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Thu, 25 Sep 2014 14:50:44 +0000 (16:50 +0200)]
touchpad: Add a test for 2fg tap-n-drag release on a 3th finger down
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Thu, 25 Sep 2014 13:58:04 +0000 (15:58 +0200)]
touchpad: Don't send scroll events during 2 finger tap-n-drag
The touchpad tap code explicitly supports 2 finger tap-n-drag, this commit
adds a test-case for this, which fails due to the 2 finger scrolling code
sending scroll events during a 2 finger tap-n-drag.
And this commit fixes the test-case, by not sending scroll events while a
tap-n-drag is active.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Fri, 26 Sep 2014 09:46:00 +0000 (11:46 +0200)]
touchpad: Make motion during tap-n-drag test take some time
The tap code will move individual touches to a state of TAP_TOUCH_STATE_DEAD
after a timeout. In case of tap-n-drag this should not have any influence,
make the litest_touch_move_to take long enough to trigger the timeout to
verify that this does not has any influence.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Thu, 25 Sep 2014 11:20:47 +0000 (13:20 +0200)]
litest: Add a sleep_ms parameter to litest_touch_move_to
In reality moving a touch from point to another takes time. In some cases
(when a timeout may trigger during the move, e.g. tap-n-drag on a touchpad),
this is important. Add a sleep_ms parameter, which will cause
litest_touch_move_to to sleep the specified amount of ms every step.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 5 Nov 2014 01:20:36 +0000 (11:20 +1000)]
test: add the MS surface touch cover device and fake-mt tests
In the device description, define the interfaces for touch down/move even
though we technically don't have those interfaces. Makes it easier to test.
The fake-mt tests make sure the device shows up correctly and that no touch
events are being sent for touch events.
This device is a pointer device too, the pointer tests will test it for
correct functionality of the REL_X/Y bits, no special test needed.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 5 Nov 2014 01:01:45 +0000 (11:01 +1000)]
evdev: handle fake MT devices
The kernel requires absolute axes to fit into the semantic ABS_ naming
scheme but doesn't provide enough free bits unlabelled axes. Devices with many
axes run into the ABS_MT range and look like MT devices when they're not.
See http://www.freedesktop.org/software/libevdev/doc/1.3/group__mt.html
Affected is e.g. the MS Surface 2 touch cover that has codes [41, 62]
set for min/max [-127, 127].
No special handling needed other than forcing has_mt/has_touch to be 0.
ABS_MT_* events from non-touch devices are discarded by libinput.
The has_mt/has_touch = 0 isn't needed, but looks nicer than an empty if
body.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=85836
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 5 Nov 2014 00:54:14 +0000 (10:54 +1000)]
evdev: move a comment to where it belongs
And s/weston/libinput/ while we're at it
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 5 Nov 2014 00:51:31 +0000 (10:51 +1000)]
evdev: factor out resolution changing code
No functional changes.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 30 Oct 2014 05:36:52 +0000 (15:36 +1000)]
Change sendevents configuration to use bitmasks
In the future, we should allow multiple sendevent modes set simultanously.
Change the API to use a bitmask instead of a single return value.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Wed, 5 Nov 2014 09:48:59 +0000 (10:48 +0100)]
touchpad: Fix log_bug_libinput calls on tap enable with fingers down
Before this commit the tap code deals with enabled being set to false,
by waiting for tap.state to become IDLE, and then ignoring any events from
that point on.
This causes a problem when enabled gets set to true again while fingers are
down, because when in IDLE no release events are expected, so once a release
event for one of the fingers is send, log_bug_libinput gets called.
This commit fixes this by making enabled use the same mechanism for enabled
state transitions as the tap suspend / resume code.
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>
Hans de Goede [Sun, 28 Sep 2014 11:21:08 +0000 (13:21 +0200)]
touchpad: Disable touchpads on trackpoint activity
Some laptops with both a clickpad and a trackpoint have such a large touchpad,
that parts of the users hands will touch the pad when using the trackpoint.
Examples of this are the Lenovo T440s and the Toshiba Tecra Z40-A.
This commit makes libinput automatically disable the touchpad while using
the trackpoint on these devices, except for the buttons, as people may want
to use the touchpad (hardware or soft) buttons while using the trackpoint.
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>
Hans de Goede [Sun, 28 Sep 2014 11:21:07 +0000 (13:21 +0200)]
touchpad: Rename consumed to filter_motion
This is what the return value in tp_tap_handle_state is called, and it better
reflects what the flag does.
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>
Hans de Goede [Sun, 28 Sep 2014 11:21:05 +0000 (13:21 +0200)]
touchpad: Add tap suspend / resume
While e.g. disabling the touchpad while the trackpoint is used, we want to
stop sending tap (or scroll or motion) events. We cannot use tp_clear_state at
this time as that will also release any touchpad buttons pressed, breaking
dragging with the trackpoint using the touchpad or clickpad buttons.
Calling tp_release_all_taps() and then ensuring that we do not call
tp_tap_handle_state as long as the trackpoint is in use, is enough to disable
taps when the trackpoint is in use.
However when the trackpoint stops being used, we cannot simply start calling
tp_tap_handle_state() again, we first need to sync the tap.state to the current
reality, specifically if fingers are down it must be TAP_STATE_DEAD, so that
their releases do not trigger the log_bug_libinput on a release in
tp_tap_idle_handle_event.
Directly messing with tap.state from outside evdev-mt-touchpad-tap.c is not
good, so add tp_tap_suspend and tp_tap_resume functions for this.
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>
Hans de Goede [Sun, 28 Sep 2014 11:21:04 +0000 (13:21 +0200)]
touchpad: Rewrite / fix tp_release_all_taps
Before this commit tp_release_all_taps would call tp_tap_handle_timeout, which
is a nop when in state DRAGGING. tp_clear_state then releases all touches and
calls touchpad_handle_state which moves the state to DRAGGING_WAIT, and the
button 1 release will only be done after the tap-timeout, rather then directly
as it should on tp_clear_state.
This commit fixes this by instead of calling tp_tap_handle_timeout, directly
releasing pressed buttons and switching to state DEAD or IDLE depending on
fingers_down.
Besides fixing this issue, this rewrite also makes it possible to use
tp_release_all_taps outside of tp_clear_state, which will be used to add
tap suspend / resume functionality in a follow up commit.
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>
Hans de Goede [Sun, 28 Sep 2014 11:21:03 +0000 (13:21 +0200)]
core: Move libinput_event definition to libinput-private.h
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>
Hans de Goede [Sun, 28 Sep 2014 11:21:02 +0000 (13:21 +0200)]
core: Add internal event notification mechanism
For features like e.g. disable-touchpad-while-typing, it is necessary for one
device to be able to listen into another device's events.
It is tempting to use the existing device_added / device_removed mechanism
to give e.g. the keyboard a link to the touchpad, and make the keyboard code
disable / re-enable the touchpad but this is wrong. This needs to be a setting
of the touchpad, and the policy for things like which events to count as
activity, and what sort of timeout to use to consider the device idle, belongs
in the touchpad code not in the keyboard code.
Add an event listeners mechanism so that the touchpad can listen for (e.g.)
keyboard events, and respond to these 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>
Hans de Goede [Sun, 28 Sep 2014 11:21:01 +0000 (13:21 +0200)]
core: Add timestamp parameter to post_device_event
This is a preparation patch for adding internal event listeners, so that the
callbacks for these can get the full 64 bit timestamps.
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>
Hans de Goede [Sun, 28 Sep 2014 11:21:00 +0000 (13:21 +0200)]
core: Make time argument to internal foo_notify_bar functions 64 bit
The libinput evdev code uses 64 bit timestamps internally, to avoid having to
deal with timestamp wraps. The internal foo_notify_bar functions time argument
however is only 32 bits, bump this to 64 bits to avoid truncating the timestamps
when calling these functions.
This is a preparation patch for adding internal event listeners, so that the
callbacks for these can get the full 64 bit timestamps.
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>
Peter Hutterer [Thu, 6 Nov 2014 04:30:21 +0000 (14:30 +1000)]
test: pass an enum for the axis instead of uint
Let's pretend that makes it type-safe.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 5 Nov 2014 01:23:10 +0000 (11:23 +1000)]
test: drop superfluous empty line
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 4 Nov 2014 00:28:00 +0000 (10:28 +1000)]
Fix documentation for libinput_log_set_handler
user_data argument was dropped in
97a6bf10f958.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Derek Foreman [Thu, 30 Oct 2014 21:34:15 +0000 (16:34 -0500)]
evdev: add DPI to evdev calculations
Assume "normal" mice are 400DPI, and that all calculations should be
normalized to this before being fed into the filter.
There isn't yet a way to configure a device's DPI.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Derek Foreman [Thu, 30 Oct 2014 21:34:14 +0000 (16:34 -0500)]
filter: perform speed computations with doubles
Converting to integer before the sqrt calculation can cause loss of
motion at low speed.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Derek Foreman [Thu, 30 Oct 2014 21:34:13 +0000 (16:34 -0500)]
filter: Fix typo
accelator -> accelerator
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Derek Foreman [Wed, 29 Oct 2014 14:56:27 +0000 (09:56 -0500)]
evdev: Log evdev event queue overflows
Log a message when the kernel event queue overflows and events are dropped.
After 10 messages logging stops to avoid flooding the logs if the condition
is persistent.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 30 Oct 2014 05:36:16 +0000 (15:36 +1000)]
Fix a documentation typo
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 30 Oct 2014 05:16:40 +0000 (15:16 +1000)]
doc: update for latest doxygen
doxygen -u, no manual interference.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>