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>
Derek Foreman [Fri, 3 Oct 2014 20:01:35 +0000 (15:01 -0500)]
cosmetic: convert evdev_need_touch_frame from int to bool
We use stdbool elsewhere, so use it here too for consistency.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 23 Sep 2014 02:46:02 +0000 (12:46 +1000)]
test: add some left-handed tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 23 Sep 2014 04:35:42 +0000 (14:35 +1000)]
touchpad: hook up left-handed configuration
Tapping and clickfinger is unaffected, physical and software buttons are
swapped. The main area of a clickpad remains as left button though.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 23 Sep 2014 03:48:06 +0000 (13:48 +1000)]
evdev: hook up left-handed configuration option
Two separate flags needed, want_left_handed and left_handed to avoid switching
to left_handed while a button is still down. Since each backend has a
different way of determining whether buttons are down, let them set a function
to do exactly that. Then call that function whenever a button release event is
posted to switch the device to right/left-handed if applicable.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 22 Sep 2014 06:48:41 +0000 (16:48 +1000)]
Add configuration option for left-handed behavior
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 17 Sep 2014 00:07:38 +0000 (10:07 +1000)]
test: add litest_push/pop_event_frame() helpers
For some tests we need to string multiple event sequences together into one
event frame. Use a push/pop frame approach that stops litest from sending any
EV_SYN/SYN_REPORT events, so we can merge two touches together by e.g.
litest_push_event_frame(d);
litest_touch_down(d, 0, 10, 10);
litest_touch_down(d, 1, 20, 50);
litest_pop_event_frame(d);
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 16 Sep 2014 06:08:29 +0000 (16:08 +1000)]
test: add helper functions for the two timers we care about
Rather than a random msleep() with a comment, use a helper function that
describes what we're waiting for. Also makes changing the timeouts easier in
the future.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Mon, 22 Sep 2014 06:37:36 +0000 (16:37 +1000)]
Add missing doxygen @ingroup commands
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 18 Sep 2014 06:14:35 +0000 (16:14 +1000)]
test: add tests for natural scrolling
2-finger scrolling only, we don't have anything else yet
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 18 Sep 2014 05:51:53 +0000 (15:51 +1000)]
touchpad: hook up natural scrolling configuration
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 18 Sep 2014 05:10:19 +0000 (15:10 +1000)]
Add a configuration option for natural scrolling
Natural scrolling is simply inverted scrolling, but I decided to
use the Apple terminology simply because it's easier to google for.
Add the usual quartett of config options for has/set/get/get_default/, as a
boolean option rather than an enum for scroll mode to avoid name collusion
with the (currently in the works) edge scrolling.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 3 Jul 2014 23:04:10 +0000 (09:04 +1000)]
tools: map KEY_UP/DOWN to pointer acceleration
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 3 Jul 2014 22:56:44 +0000 (08:56 +1000)]
tools: keep a list of devices around for run-time changes
Hard-coded to 50 devices, because for a debugging tool that's plenty.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 3 Jul 2014 23:44:43 +0000 (09:44 +1000)]
touchpad: hook up pointer acceleration configuration
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 19 Sep 2014 05:09:31 +0000 (15:09 +1000)]
evdev: hook into pointer acceleration config interface
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 15 May 2014 05:46:19 +0000 (15:46 +1000)]
Add a pointer acceleration API
Only exposes one knob - speed, normalized to a [-1, 1] range with 0 being the
neutral "this is what we think is normal" speed. -1 and 1 reflect the
slowest/fastest reasonable speed on this device.
Note: with this API we commit to having any pointer accelerating as a true
gliding scale. We cannot map the [-1,1] range into a discrete set of steps
as we do not communicate to the caller whether a specific value has changed
the acceleration. Without that, a caller may assume that acceleration has
changed even when it is not visible to the user.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Sun, 21 Sep 2014 23:35:53 +0000 (09:35 +1000)]
touchpad: use the evdev device's filter struct
We don't need a separate filter struct, we can use the parent evdev device.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 19 Sep 2014 04:25:22 +0000 (14:25 +1000)]
filter: adjust acceleration curve depending on speed
The acceleration curve consists of four parts, in ascii-art like this:
_____________
/
____/
/
/
where the x axis is the speed, y is the acceleration factor.
The first plateau is at the acceleration factor 1 (i.e. unaccelerated
movement), the second plateau is at the max acceleration factor. The threshold
in the code defines where and how long the plateau is.
This patch adjusts the curve based on a [-1, 1] range. For anything below 0,
the plateau is longer (i.e. accel kicks in at a higher speed), the second
incline is flatter (i.e. accel kicks in slower) and the max accel factor is
lower (i.e. maximum speed is slower). For anything above 0, the inverse is
true, acceleration kicks in earlier, harder and is faster in general. So the
default/min/max curves overlaid look something like this:
________ max
| _______ default
| / _____ min
_|_/_/
/
/
Note that there's a limit to what ascii art can do...
Note that there are additional tweaks we can introduce later, such as
decreaseing the unaccelerated speed of the device (i.e. lowering the first
plateau).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 3 Jul 2014 05:53:56 +0000 (15:53 +1000)]
filter: add a configurable speed interface
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 3 Jul 2014 05:32:40 +0000 (15:32 +1000)]
filter: move the threshold/accel into the filter struct
No functional changes, prep work for the config interface.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 3 Jul 2014 23:29:11 +0000 (09:29 +1000)]
filter: add a filter-private.h header file
To keep the implementation of a filter separate from the users of a filter.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 19 Sep 2014 01:10:17 +0000 (11:10 +1000)]
Replace pointer acceleration with a much simpler linear one
We ran a userstudy, evaluating three different accel methods. Detailed results are
available at:
http://www.who-t.net/publications/hutterer2014_libinput_ptraccel_study.pdf
We found that there was little difference between the method we had in
libinput 0.6 and this three-line function. Users didn't really notice a
difference, but measured data suggests that it has slight advantages in some
use-cases.
The method proposed here is the one labeled "linear" in the paper, its profile
looks roughly like this:
_____________
/
____/
/
/
where the x axis is the speed, y is the acceleration factor.
The first plateau is at the acceleration factor 1 (i.e. unaccelerated
movement), the second plateau is at the max acceleration factor. The threshold
in the code defines where and how long the plateau is.
Differences to the previous accel function:
- both inclines are linear rather than curved
- the second incline is less steep than the current method
From a maintainer's point-of-view, this function is significantly easier to
understand and manipulate than the previous one.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 17 Sep 2014 05:11:41 +0000 (15:11 +1000)]
Drop two semicolons after a macro definition
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Sun, 21 Sep 2014 23:30:38 +0000 (09:30 +1000)]
evdev: drop unused declaration evdev_proces_event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Thu, 18 Sep 2014 09:15:27 +0000 (11:15 +0200)]
test: Add trackpoint middlebutton scrolling tests
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 [Wed, 17 Sep 2014 13:35:31 +0000 (15:35 +0200)]
litest: Add litest_assert_scroll() helper function
Make check_2fg_scroll functionality available outside of touchpad.c ,
no functional changes.
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 [Wed, 17 Sep 2014 13:35:30 +0000 (15:35 +0200)]
touchpad: Enlarge topbutton area a bit while the touchpad is disabled
Make it easier to hit the topbutton area when the touchpad is disabled,
normally we don't want to make the topbutton area too big, so as to not
interfere with normal touchpad operation, but when disabled we have no such
worries.
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>
Derek Foreman [Thu, 18 Sep 2014 22:02:39 +0000 (17:02 -0500)]
cosmetic: Remove prototype for nonexistent create_linear_acceleration_filter()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 16 Sep 2014 14:22:42 +0000 (16:22 +0200)]
test: Test the topbuttons of a disabled touchpad still send events through the trackpoint
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Tue, 16 Sep 2014 14:22:41 +0000 (16:22 +0200)]
touchpad: When disabling a TOPBUTTONPAD, leave the top buttons enabled
On a TOPBUTTONPAD, we can't disable the touchpad altogether - the trackstick
relies on the touchpad's top software buttons.
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, 16 Sep 2014 14:22:40 +0000 (16:22 +0200)]
touchpad: Put state unrolling code in a tp_clear_state() helper function
For touchpads with top softbuttons we don't want to fully disable the touchpad
on suspend, as we want to keep the top softbuttons working for the trackpoint.
So in the suspended state some of the touchpad sub-statemachines will keep
running (e.g. buttons) where others (e.g. tap) will not. This means that
we will need to clear the touchpad state on resume too, to avoid things
being in an inconsistent state after resume.
This commit factors out the state clearing code into a helper functions, so
that the same code can be used on resume.
No functional changes.
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, 16 Sep 2014 14:22:39 +0000 (16:22 +0200)]
touchpad: Route top softbuttons through the trackstick if we've one
The touchpad top softbuttons such as found on the Lenove T440 are intended for
use with the trackstick. Route their events through the trackstick, so that
they can be used for e.g. middle button scrolling with the trackstick.
Note that sending top button events to a disabled trackpoint makes no sense
(and will mess up internal state). Likely a user with a disabled trackpoint
will still expect the top buttons to work, so rather than not sending events
in that case, simply treat a suspendeded trackpoint as not being there, and
send the events directly from the touchpad 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>
Peter Hutterer [Tue, 16 Sep 2014 14:22:38 +0000 (16:22 +0200)]
touchpad: Keep track of associated trackpoint device
The top soft buttons are intended for use with a trackpoint, and to e.g.
make middle button scrolling work correctly, we must post the events for
these "buttons" through the trackpoint device.
This commit is a preparation patch for this, it adds a link to the
trackpoint to the touchpad, but does not yet do anything with it.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Tue, 16 Sep 2014 14:22:37 +0000 (16:22 +0200)]
evdev: Add an internal device suspend / resume notification system
We have the ability for a device to form a link to another device through the
device_added / device_removed callbacks. A device having such a link to
another device may also want to know when that other device is disabled /
enabled (suspended / resumed). So add a notification mechanism for this too.
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, 16 Sep 2014 14:22:36 +0000 (16:22 +0200)]
evdev: Add middle button scrolling for trackpoints
Most trackpoint users want to be able to scroll using the trackpoint with
the middle button pressed, add support 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 [Tue, 16 Sep 2014 14:22:35 +0000 (16:22 +0200)]
evdev: Move generic scroll code from evdev-mt-touchpad.c to evdev.c
So that it can be used for middle button trackpoint scrolling too.
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>