Peter Hutterer [Tue, 10 Jun 2014 22:35:56 +0000 (08:35 +1000)]
test: use check's strcmp API instead of strcmp
Prints out the strings on failure - easier for debugging
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 10 Jun 2014 23:00:46 +0000 (09:00 +1000)]
test: drop unused includes for libinput-util.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Fri, 6 Jun 2014 15:01:07 +0000 (17:01 +0200)]
evdev-mt-touchpad-tap: Switch over to new timer subsystem
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 [Fri, 6 Jun 2014 15:01:06 +0000 (17:01 +0200)]
evdev-mt-touchpad-buttons: Switch over to new timer subsystem
Besides being a nice cleanup, this gives us proper per touch timeouts.
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 [Fri, 6 Jun 2014 15:01:05 +0000 (17:01 +0200)]
Add a timer subsystem
Currently we are using DIY timers in the touchpad softbutton and tap handling
code, and at least the softbutton code gets its wrong. It uses one timer-fd
per touchpad to set a timeout per touch, which means that if a timeout is
set for 100ms from now for touch 1, and then 50 ms later touch 2 sets a timeout
for 200 ms from now, then the timeout for touch 1 will come 150 ms too late.
This commits adds a proper timer subsystem so that we've one place to deal
with timer handling, and so that we can only get it wrong (well hopefully
we get it right) in one place.
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, 6 Jun 2014 05:56:50 +0000 (15:56 +1000)]
Mark the log function as attribute printf
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 6 Jun 2014 05:55:15 +0000 (15:55 +1000)]
test: add --verbose flag to litests
Sometimes it's handy to see what libinput prints out while running a test.
This breaks test-log if run with --verbose. Checking that the default log
priority hasn't changed obviously doesn't work if we change it on demand.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 6 Jun 2014 04:58:14 +0000 (14:58 +1000)]
test: drop TEST_CFLAGS
We're using the same flags for everything anyway, drop the custom flags
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 5 Jun 2014 23:38:35 +0000 (09:38 +1000)]
test: silence compiler warning for C++ build test
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for
C/ObjC but not for C++ [enabled by default]
Since gcc also complains about adding -Wno-strict-prototypes we have to handle
the two separately. A side-effect here: now that we promote the GCC_CFLAGS to
AM_CFLAGS, litest.la is built with the correct CFLAGS too.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 5 Jun 2014 23:48:00 +0000 (09:48 +1000)]
test: fix compiler warnings for missing field initializers
litest-trackpoint.c:38:1: warning: missing initializer for field 'touch_down'
of 'struct litest_device_interface' [-Wmissing-field-initializers]
and similar
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 5 Jun 2014 23:47:05 +0000 (09:47 +1000)]
test: fix compiler warnings for missing prototypes
litest-wacom-touch.c:31:6: warning: no previous prototype for
'litest_wacom_touch_setup' [-Wmissing-prototypes]
and similar
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 5 Jun 2014 23:44:43 +0000 (09:44 +1000)]
test: fix compiler warning for is_debugger_attached
litest.c:207:1: warning: function declaration isn't a prototype
[-Wstrict-prototypes]
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 6 Jun 2014 04:53:40 +0000 (14:53 +1000)]
Drop empty FFI_CFLAGS
Leftover from weston
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 5 Jun 2014 05:42:49 +0000 (15:42 +1000)]
tools: add a script to push the doxygen output to freedesktop.org
Intentionally not added to EXTRA_DIST, if you're not running libinput from git
you're not supposed to push documentation.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Mon, 9 Jun 2014 21:39:06 +0000 (23:39 +0200)]
doc: Fix spelling
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Thu, 5 Jun 2014 07:34:19 +0000 (09:34 +0200)]
configure.ac: libinput 0.3
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Mon, 9 Jun 2014 20:26:22 +0000 (22:26 +0200)]
evdev: Migrate rest of 32 bit time variables to uint64_t
Makes tests pass again with long uptime.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Stephen Chandler Paul [Wed, 4 Jun 2014 00:08:02 +0000 (20:08 -0400)]
s/libinput_pointer_button_state/libinput_button_state/
Button states are applicable to more then just the pointer, so having a
non-generic name name for a generic enumerator value like
libinput_pointer_button_state doesn't make sense. Changing it to something
generic like libinput_button_state allows it to be reused by other devices that
may potentially be added to libinput in the future.
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Mon, 2 Jun 2014 21:09:27 +0000 (23:09 +0200)]
Use floating point numbers instead of fixed point numbers
Fixed point numbers can easily overflow, and double to fixed point
conversion is lossy. Use floating point (double) where fixed point
numbers where previously used and remove the li_fixed_t type.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 4 Jun 2014 21:56:39 +0000 (07:56 +1000)]
touchpad: whitespace fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Fri, 23 May 2014 14:06:26 +0000 (16:06 +0200)]
touchpad: Drop the scroll direction lock, increase threshold instead
The direction lock was intended to avoid erroneous horizontal scroll events
when scrolling vertically (and vice versa). Some testing on my touchpad here
shows that it is too easy to accidentally lock the direction when no lock is
intended (e.g. moving around an image). And quite hard to figure out what a
pure vertical gesture is.
I get movements from 90 degrees to 70 degrees for something my brain would
consider vertical scrolling. Depending on the hand position, the fingers
actually perform a slight curve, not a straight line.
Hence - drop the direction lock, but increase the threshold a little. It
doesn't totally avoid horizontal scroll events but keeps them minimal.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Wed, 4 Jun 2014 01:27:08 +0000 (11:27 +1000)]
touchpad: break up a long line
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 2 Jun 2014 21:51:37 +0000 (07:51 +1000)]
Add our own version of linux/input.h
Avoids having to #define any values we're trying to use.
Header file is from Linux 3.15-rc8.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Mon, 2 Jun 2014 22:25:37 +0000 (08:25 +1000)]
test: fix resolution on all devices
struct input_absinfo has the resolution as the 6th field, not as the 4th.
This doesn't have any visible effect because uinput doesn't allow us to set
the resolution yet.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 2 Jun 2014 22:23:48 +0000 (08:23 +1000)]
test: fix resolution on Wacom ISDv4 E6 Finger device
Resolution for x is 10, 9 for y. And while we're at it set the actual
resolution, not the fuzz.
No actual effect since resolution can't be set through uinput where we use
these devices.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 2 Jun 2014 22:00:00 +0000 (08:00 +1000)]
tools: fix a compiler warning
event-debug.c: At top level:
event-debug.c:129:1: warning: ‘static’ is not at beginning of declaration
[-Wold-style-declaration]
const static struct libinput_interface interface = {
^
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 2 Jun 2014 06:43:42 +0000 (16:43 +1000)]
test: fix a bunch of "unused variable" warnings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 2 Jun 2014 06:18:30 +0000 (16:18 +1000)]
test: use the TEST_CFLAGS for all tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Mon, 2 Jun 2014 06:18:10 +0000 (16:18 +1000)]
test: compiler warning fixes
misc.c: In function ‘create_simple_test_device’:
misc.c:71:54: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while ((type = va_arg(args, unsigned int)) != -1 &&
^
misc.c:72:54: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
(code = va_arg(args, unsigned int)) != -1) {
Peter Korsgaard [Mon, 2 Jun 2014 21:11:31 +0000 (23:11 +0200)]
evdev: Provide fallback definition for KEY_MICMUTE
KEY_MICMUTE was added relatively recently (3.1 with
33009557bd: Add
KEY_MICMUTE and enable it on Lenovo X220), so provide a fallback definition
similar to how we do it for KEY_LIGHTS_TOGGLE to fix compilation with older
toolchains.
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Peter Korsgaard [Mon, 2 Jun 2014 21:11:30 +0000 (23:11 +0200)]
evdev: Use correct fallback value for KEY_LIGHTS_TOGGLE
The kernel defines KEY_LIGHTS_TOGGLE as 0x21e, not 0x160 (which is KEY_OK).
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Peter Hutterer [Mon, 2 Jun 2014 03:44:59 +0000 (13:44 +1000)]
touchpad: fix two indentation issues in the header
7 whitespace -> tab
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Tue, 27 May 2014 13:08:35 +0000 (15:08 +0200)]
touchpad: Add support for top softbutton area
Add support for the top softbutton area found on some laptops.
For details of how this works, see the updated
doc/touchpad-softbutton-state-machine.svg diagram.
Basically this mirrors the state-machine for the bottom softbutton area, with
one exception, if a finger stays at least inner timeout milliseconds in the
top button area and then moves out of it, it will be ignored rather then
become the pointer. This is done so that people using the top buttons together
with a trackstick and accidentally move their finger out of the upper area
don't get spurious pointer movements from the finger on the trackpad.
This behavior is indentical to xf86-input-synaptics, which also ignores
movements from touches which start in the top button area.
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, 27 May 2014 13:17:26 +0000 (15:17 +0200)]
touchpad: Rename some variables and functions
Rename some clickpad softbutton area variables to have bottom in their
name, this is a preperation patch for adding top softbutton area 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 [Fri, 30 May 2014 04:41:23 +0000 (14:41 +1000)]
tools: add explicit libudev dependency to event-debug
The header is pulled in by libinput.h, the libs by libinput but make this
explicit.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 27 May 2014 03:47:58 +0000 (13:47 +1000)]
configure: simplify a condition
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 21 May 2014 04:36:01 +0000 (14:36 +1000)]
Replace log_bug with per-component bug macros
When we knowingly hit a bug, we should know what the bug is caused by. Log
that in a standardized fashion.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 23 May 2014 04:10:57 +0000 (14:10 +1000)]
test: disable CK_FORK for the valgrind runs
I'm not sure what exactly is happening here, but while valgrind seems to run
fine in normal mode, the build from make distcheck fails with rather random
errors. Disabling CK_FORK seems to help, but more investigation is needed.
Meanwhile, this makes distcheck succeed again.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 23 May 2014 04:13:39 +0000 (14:13 +1000)]
test: restore log priority after each test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 22 May 2014 06:13:12 +0000 (16:13 +1000)]
Remove old touchpad code
With the addition of software buttons for clickpads, the new touchpad code has
overtaken this driver in terms of features. The older driver was disabled in
6a6103262530d8fca66ee3847d5664824158c12b.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 29 May 2014 05:43:38 +0000 (15:43 +1000)]
evdev: INPUT_PROP_DIRECT devices can't be touchpads
Devices that are direct input devices are marked by the kernel with the
INPUT_PROP_DIRECT property. Touchpads are always indirect input devices, so
let's do the easiest check first before we try device-specific capabilities.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Sat, 24 May 2014 19:49:13 +0000 (21:49 +0200)]
filter: Ignore non-suitable trackers when calculating initial velocity
calculate_velocity() didn't skip pointer trackers far away in time when
calculating the initial velocity. This check was done later when
iterating the rest, so while at it, simplify the function by doing both
iterations in one single loop.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Jonas Ådahl [Sat, 24 May 2014 19:38:08 +0000 (21:38 +0200)]
filter: Fix get_direction for short vectors
Short vectors alongside the x axis produced inverted directions.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Jonas Ådahl [Sat, 24 May 2014 14:53:45 +0000 (16:53 +0200)]
touchpad: Make anisotropic motion deltas isotropic
The x and y absolute axis may have different resolutions, meaning 1 unit
long motion delta on one axis is not physically as long as 1 unit motion
delta on the other axis.
In order to make these anisotropic input motion deltas output as isotropic
motion deltas, apply scaling to one of the axis making it have the same
dimension as the other, before passing it through the motion filter
which assumes all deltas are isotropic.
https://bugs.freedesktop.org/show_bug.cgi?id=79056
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Jonas Ådahl [Sun, 18 May 2014 17:20:39 +0000 (19:20 +0200)]
Add basic mouse pointer acceleration
This patch reimplements the simple smooth pointer acceleration profile
from X.org xserver. The algorithm is identical to the classic profile
with a non-zero pointer acceleration threshold.
When support for changable parameters is in place, to get a pointer
acceleration the same as the default classic profile of X.org a
polynomial acceleration profile should be used for when the threshold
parameter is zero.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Jonas Ådahl [Mon, 26 May 2014 21:18:28 +0000 (23:18 +0200)]
test: Queue two motion events in pointer event conversion test
Pointer acceleration filters may absorb the first event, so queue two,
just in case.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Jonas Ådahl [Mon, 26 May 2014 20:12:25 +0000 (22:12 +0200)]
test: Make relative pointer event test more accepting
A test cannot exactly predict the resulting motion event from a given
evdev event series without having to reimplement the acceleration
algorithm. To still be able to test that sane relative motion events are
produced, check that the length and direction of the resulting motion
event vectors are close to the same as the expected vectors.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Jonas Ådahl [Mon, 26 May 2014 21:20:42 +0000 (23:20 +0200)]
filter: Add motion filter destruction helper
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Fri, 23 May 2014 14:06:25 +0000 (16:06 +0200)]
touchpad: Stop scrolling on a button click / tap
On a button click / tap the scrolling event handler no longer gets called,
ensure that any in progress scrolling is stopped.
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 [Fri, 23 May 2014 14:06:24 +0000 (16:06 +0200)]
touchpad: Refactor tp_post_scroll_events()
Put the actual scroll event posting in the straight path.
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 [Fri, 23 May 2014 14:06:23 +0000 (16:06 +0200)]
touchpad: Fix sending of scroll stop events
Setting tp->scroll.direction = 0 before checking tp->scroll.direction
to see if we need to send stop scroll events for vert / horz scrolling does
not really work well.
Also we need to check direction with an axis mask, not the axis number.
While at it also add a tp_stop_scroll_events() helper function 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 [Fri, 23 May 2014 14:06:22 +0000 (16:06 +0200)]
touchpad: Clear touches being the pointer when doing 2 finger scrolling
When doing 2 finger scrolling we don't want any spurious movement events after
scrolling. touchpad_2fg_no_motion tests for this, but it lifts touch 0
(which is the pointer as it came down first) first, so it only catches the
case where touch 1 suddenly gets promoted to being the pointer.
However if touch 1 is lifted first, then touch 0 is still the pointer and
will cause spurious movement events. Swap the 2 litest_touch_up calls to
catch this (and make the test fail), and add code to clear the is_pointer
flag on all touched when doing 2 finger scrolling to fix it again.
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, 27 May 2014 06:14:41 +0000 (16:14 +1000)]
tools: plug leak in event-debug
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Sat, 24 May 2014 20:00:46 +0000 (22:00 +0200)]
filter: Fix coding style
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Thu, 22 May 2014 22:51:29 +0000 (08:51 +1000)]
Merge branch 'clickpad-improvements-v2' of git://people.freedesktop.org/~jwrdegoede/libinput
Jonas Ådahl [Tue, 20 May 2014 21:12:28 +0000 (23:12 +0200)]
touchpad: Make pointer movements a bit faster by default
Alter the so far hard coded parameters a bit to make the pointer
acceleration profile accelerate the pointer movement a bit more than
before.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Tue, 8 Apr 2014 10:29:45 +0000 (12:29 +0200)]
Change internal timestamps to uint64_t to properly deal with wrapping
We store timestamps in ms since system boot (CLOCK_MONOTONIC). This will wrap
after circa 50 days.
I've considered making our code wrapping safe, but that won't work. We also
use our internal timestamps to program timer-fds for timeouts. And we store
ms in a single integer but the kernel uses 2 integers, one for seconds and
one for usec/nanosec. So at 32 bits our ms containing integer will wrap
in 50 days, while the kernels seconds storing integer lasts a lot longer.
So when we wrap our ms timestamps, we will be programming the timer-fds
with a seconds value in the past.
So change all our internal timestamps to uint64_t to avoid the wrapping
when programming the timer-fds. Note that we move from 64-bit timestamps to
32-bit timestamps when calling the foo_notify_bar functions from
libinput-private.h. Having 64 bit timestamps has no use past this point,
since the wayland input protocol uses 32 bit timestamps (and clients will
have to deal with wrapping).
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Tue, 8 Apr 2014 10:39:24 +0000 (12:39 +0200)]
touchpad: handle_timeouts: Remove unused return value
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Tue, 8 Apr 2014 06:39:11 +0000 (08:39 +0200)]
touchpad: Remove clickpad clicked test from 2 finger scrolling handling
This is no longer needed now that we take the button area and pinned fingers
into account.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Tue, 8 Apr 2014 06:34:20 +0000 (08:34 +0200)]
touchpad: Ignore fingers in button area for 2 finger scroll
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Mon, 7 Apr 2014 14:49:36 +0000 (16:49 +0200)]
touchpad: softbuttons: Deal with a click arriving before any touches
It is possible for a click to get reported before any related touch events
get reported, here is the relevant part of an evemu-record session on a T440s:
E: 3.985585 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
E: 3.997419 0003 0039 -001 # EV_ABS / ABS_MT_TRACKING_ID -1
E: 3.997419 0001 014a 0000 # EV_KEY / BTN_TOUCH 0
E: 3.997419 0003 0018 0000 # EV_ABS / ABS_PRESSURE 0
E: 3.997419 0001 0145 0000 # EV_KEY / BTN_TOOL_FINGER 0
E: 3.997419 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
E: 5.117881 0001 0110 0001 # EV_KEY / BTN_LEFT 1
E: 5.117881 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
E: 5.133422 0003 0039 0187 # EV_ABS / ABS_MT_TRACKING_ID 187
E: 5.133422 0003 0035 3098 # EV_ABS / ABS_MT_POSITION_X 3098
E: 5.133422 0003 0036 3282 # EV_ABS / ABS_MT_POSITION_Y 3282
E: 5.133422 0003 003a 0046 # EV_ABS / ABS_MT_PRESSURE 46
E: 5.133422 0001 014a 0001 # EV_KEY / BTN_TOUCH 1
E: 5.133422 0003 0000 3102 # EV_ABS / ABS_X 3102
E: 5.133422 0003 0001 3282 # EV_ABS / ABS_Y 3282
E: 5.133422 0003 0018 0046 # EV_ABS / ABS_PRESSURE 46
E: 5.133422 0001 0145 0001 # EV_KEY / BTN_TOOL_FINGER 1
E: 5.133422 0000 0000 0000 # ------------ SYN_REPORT (0) ----------
Notice the BTN_LEFT event all by itself!
To deal with this if a physical click registers before we get any touches,
wait for the first touch to resolve the click.
Also see the new activity diagram for the tp_post_softbutton_buttons
method which has been added to doc/touchpad-softbutton-state-machine.svg
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Mon, 7 Apr 2014 14:09:03 +0000 (16:09 +0200)]
touchpad: post_button_events: Remove TOUCHPAD_EVENT_BUTTON_PRESS/RELEASE test
We already check for old != current everywhere, so this is not needed;
And in tp_post_softbutton_buttons we want to do delay button down reporting if
we don't have touch info yet in which case this check actually gets in the way.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Mon, 7 Apr 2014 11:50:11 +0000 (13:50 +0200)]
touchpad: Ignore non left clicks on clickpads
We should never get any non left button events on clickpads, but if we
do these might confuse our state, so complain about it and ignore these.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Mon, 7 Apr 2014 11:44:07 +0000 (13:44 +0200)]
touchpad: Use INPUT_PROP_BUTTONPAD instead of checking for buttons
And warn if INPUT_PROP_BUTTONPAD mismatches right/middle buttons presence.
Also fix the bcm5974 to properly advertise INPUT_PROP_BUTTONPAD.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Hans de Goede [Fri, 4 Apr 2014 15:22:02 +0000 (17:22 +0200)]
touchpad: Rework is_pointer handling
We don't want touches in the button area to cause the pointer to move. So
instead of making a touch the pointer when it moves to TOUCH_BEGIN, wait
with making it the pointer until its buttons state moves to BUTTON_STATE_AREA.
Note that a touch in the main area of the touchpad will move to
BUTTON_STATE_AREA immediately. If software-buttons are not enabled, any finger
is in the BUTTON_STATE_AREA.
While at it also refactor the is_pointer setting in general, removing
code duplicition wrt checking that another touch is not already
the pointer on unpinning a finger, and add safeguards that unpinning
does not make a finger which is not in button state BUTTON_STATE_AREA the
pointer, nor that the button code makes a pinned finger the pointer.
All these sanity checks are combined into a new tp_button_active function,
since they should be taken into account for 2 finger scrolling, etc. too.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 27 Mar 2014 23:44:11 +0000 (09:44 +1000)]
touchpad: Add clickpad-style software buttons
Almost all non Apple touchpads have visible markings for software button areas,
so limit clickfinger behavior to Apple clickpads, and implement software button
areas for others.
This is a slightly fancier implementation than the simplest model and ported
over from libtouchpad. It implements a state machine for the software buttons
with left and right buttons currently implemented. Buttons are oriented
left-to-right, in a horizontal bar. No random button placement allowed.
In general, the procedure is:
- if a finger sets down in the left button area, a click is a left click
- if a finger sets down in the right button area, a click is a right click
- if a finger leaves the button area, a click is a left click
- if a finger starts outside the button area, a click is a left click
Two timeouts are used to handle buttons more smoothly:
- if a finger sets down in a button area but "immediately" moves over
to a different area, that area takes effect on a click.
- if a finger leaves a button area and "immediately" clicks or moves back into
the area, the button still takes effect on a click.
- if a finger changes between areas and stays there for a timeout, that area
takes effect on a click.
Note the button area states are named BOTTOM_foo to make it easier to later
add support for a top button area such as can be found on the Thinkpad [2-5]40
series.
Co-authored-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Thu, 27 Mar 2014 05:51:12 +0000 (15:51 +1000)]
touchpad: save the active clickfinger button
To avoid having a button left press and a button right release if the number
of fingers changes.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Fri, 28 Mar 2014 05:51:08 +0000 (15:51 +1000)]
doc: add state machine SVG to EXTRA_DIST
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Thu, 27 Mar 2014 03:09:06 +0000 (13:09 +1000)]
touchpad: move button-related code into a separate file
This is about to become more complicated with the support for software button
areas. Move it to a separate file to have it logically grouped together.
No functional changes.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 15 Apr 2014 12:28:00 +0000 (14:28 +0200)]
touchpad: reset the tap timer_fd to -1 on destroy
No real effect, just for safety
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Peter Hutterer [Tue, 15 Apr 2014 12:27:59 +0000 (14:27 +0200)]
touchpad: after a click, lock the finger to its current position
On clickpads, clicking the pad usually causes some motion events. To avoid
erroneous movements, lock all fingers into position on the click and don't
allow for motion events until a finger moves past a given threshold
(currently 2% of the touchpad diagonal).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Tue, 15 Apr 2014 12:27:58 +0000 (14:27 +0200)]
touchpad: set ntouches for single-touch pads depending on key bits
A single-touch touchpad that provides BTN_TOOL_TRIPLETAP has 3 touches, etc.
There aren't a lot of these out there, but some touchpads don't have slots but
do provide two- or three-finger detection.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Jonas Ådahl [Thu, 22 May 2014 06:10:01 +0000 (08:10 +0200)]
configure.ac: libinput 0.2
Bump the libinput version and the libtool version.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Thu, 22 May 2014 06:06:25 +0000 (08:06 +0200)]
configure.ac: Add libtool versioning setting to configure.ac
Add the explanatory description of the version components from libevdev
as well.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Carlos Olmedo Escobar [Mon, 28 Apr 2014 23:26:28 +0000 (01:26 +0200)]
touchpad: check calloc result
Check the value returned by calloc.
Signed-off-by: Carlos Olmedo Escobar <carlos.olmedo.e@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 23 Apr 2014 21:25:19 +0000 (07:25 +1000)]
test: disable parallel build in test directory
We depend on device creation on the host system, having the tests run in
parallel runs a risk of random failure.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Wed, 23 Apr 2014 07:54:49 +0000 (09:54 +0200)]
evdev: Define KEY_LIGHTS_TOGGLE macro if missing
When building on a system with an older kernel, some KEY_ macros might
be missing. To be able to build on such system, define them if they are
missing.
It is probably better to keep our own copy of input.h somewhere in our
tree, and include that one instead of the system one, but that can be
added later.
Signed-off-by: Jonas Ådahl <jadahl@opera.com>
Peter Hutterer [Wed, 23 Apr 2014 01:04:48 +0000 (11:04 +1000)]
test: fix a couple of memleaks in the tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Peter Hutterer [Wed, 23 Apr 2014 00:47:09 +0000 (10:47 +1000)]
tools: add newline before function name
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Carlos Garnacho [Mon, 21 Apr 2014 17:20:44 +0000 (19:20 +0200)]
evdev: indentation fix
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Carlos Garnacho [Mon, 21 Apr 2014 17:20:42 +0000 (19:20 +0200)]
Fix doc typo
The infinitive reads a bit odd there.
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Carlos Garnacho [Mon, 21 Apr 2014 17:20:41 +0000 (19:20 +0200)]
Fix doc typo in function name
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Carlos Garnacho [Mon, 21 Apr 2014 17:20:40 +0000 (19:20 +0200)]
Remove doc references to non-existing function
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Carlos Garnacho [Mon, 21 Apr 2014 17:20:39 +0000 (19:20 +0200)]
Fix doc typo
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Fri, 18 Apr 2014 06:43:14 +0000 (08:43 +0200)]
touchpad: Silence -Wmaybe-uninitialized compiler warning
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Tue, 1 Apr 2014 20:24:10 +0000 (22:24 +0200)]
test: Test seat wide button and key count helpers
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Sat, 22 Feb 2014 14:06:34 +0000 (15:06 +0100)]
test: Add ability to add test devices to existing libinput context
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Tue, 1 Apr 2014 19:57:45 +0000 (21:57 +0200)]
Introduce seat wide button and key count API
Compositors will need to keep provide virtual devices of supported
generic device types (pointer, keyboard, touch etc). Events from each
device capable of a certain device type abstraction should be combined
as if it was only one device.
For key and button events this means counting presses of every key or
button. With this patch, libinput provides two new API for doing just
this; libinput_event_pointer_get_seat_button_count() and
libinput_event_keyboard_get_seat_key_count().
With these functions, a compositor can sort out what key or button events
that should be ignored for a virtual device. This could for example
look like:
event = libinput_get_event(libinput);
switch (libinput_event_get_type(event)) {
...
case LIBINPUT_EVENT_POINTER_BUTTON:
device = libinput_event_get_device(event);
seat = libinput_event_get_seat(device);
pevent = libinput_event_get_pointer_event(event);
if (libinput_event_pointer_get_button_state(pevent) &&
libinput_event_pointer_get_seat_button_count(pevent) == 1)
notify_pointer_button_press(seat);
else if (libinput_event_pointer_get_button_state(pevent) &&
libinput_event_pointer_get_seat_button_count(pevent) == 0)
notify_pointer_button_release(seat);
break;
...
}
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Tue, 25 Mar 2014 21:56:01 +0000 (22:56 +0100)]
test: Fix test device type validity check
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Mon, 24 Mar 2014 22:05:21 +0000 (23:05 +0100)]
test: Check that libinput doesn't send double touch down/up events
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Mon, 24 Mar 2014 21:37:00 +0000 (22:37 +0100)]
test: Test handling of many touch points
libinput currently handles 16 per device touch points. Test that we
behave as expected when a device has an even higher number of active
touch points.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Mon, 24 Mar 2014 22:37:09 +0000 (23:37 +0100)]
evdev: Avoid double touch down/up events
When the kernel sends multiple touch down or touch up for the same slot
in a row, ignore any such subsequent event ensuring libinput always
produces 1 x touch down -> [n x touch motion] -> 1 x touch up event
series.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Jonas Ådahl [Tue, 22 Apr 2014 21:02:14 +0000 (23:02 +0200)]
evdev: Dynamically allocate slot array
Don't have a hard coded slot array size; instead allocate the array
needed according to the abs info reported by either libmtdev or libevdev.
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Jonas Ådahl [Mon, 24 Mar 2014 22:12:36 +0000 (23:12 +0100)]
evdev: Use temporary variable when passing libevdev pointer
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Hans de Goede [Tue, 15 Apr 2014 12:28:09 +0000 (14:28 +0200)]
Add a log_bug macro
For logging when things happen which should not happen. We may want to do
something more fancy in the future but for now this suffices.
Modelled after log_bug in libevdev.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
U. Artie Eoff [Fri, 11 Apr 2014 23:27:01 +0000 (16:27 -0700)]
evdev: log configured device info
Bring back the device configure logging that was originally part of
Weston's evdev.
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Peter Hutterer [Wed, 26 Mar 2014 05:08:02 +0000 (15:08 +1000)]
test: add tests for event conversion and back
Looks a bit excessive given how simple the base is but hey, we don't want to
ever break that bit. That'd be embarrassing.
And while we're at it make sure that the 'wrong' event getters return NULL for
each event.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Tue, 25 Mar 2014 03:55:47 +0000 (13:55 +1000)]
Add functions to convert back to the base event
A few functions only work on the base event but once we've converted to the
target event we can't go back. Casting works for now but that would expose
internal ABI.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Thu, 27 Mar 2014 01:04:24 +0000 (11:04 +1000)]
test: automatically run the tests against valgrind for leaks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Peter Hutterer [Thu, 27 Mar 2014 02:43:21 +0000 (12:43 +1000)]
test: mark the synaptics clickpad as buttonpad
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>