Commit graph

1567 commits

Author SHA1 Message Date
Peter Hutterer
dcd48bb3b3 test: run pinch gesture tests for 2-slot touchpads
Some of the 2-slot touchpads don't do gestures though (e.g. semi-mt) so skip
those.

And change the movement granularity for the pinch and spread tests so we stay
under one degree angle for lower-resolution touchpads too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit ff2ee2c681)
2016-02-05 12:36:59 +10:00
Peter Hutterer
7cce284063 test: fix compiler warning
litest-selftest.c: In function ‘litest_ptr_eq_notrigger’:
litest-selftest.c:172:10: warning: initialization makes integer from pointer
without a cast [-Wint-conversion]
  int c = NULL;
          ^
litest-selftest.c:173:10: warning: initialization makes integer from pointer
without a cast [-Wint-conversion]
  int d = NULL;
          ^

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 82335b0ab9)
2016-02-04 14:21:10 +10:00
Peter Hutterer
c18f62da14 configure.ac: libinput 1.1.5
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-25 14:19:36 +10:00
Peter Hutterer
53b021a1da touchpad: disable gestures for single-finger touchpads
No point trying to detect pinch gestures if we only have one set of
coordinates. This makes two-finger scrolling on ST touchpads more reactive.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 28205d6f29)
2016-01-25 13:38:55 +10:00
Peter Hutterer
983a8ec4c2 touchpad: disable MT for all semi-mt devices
Synaptics, Elantech and Alps semi-mt devices all have issues with reporting
correct MT data, even the bounding box which semi-mt devices are supposed to
report is wrong.

Synaptics devices have massive jumps with two fingers down. Elantech devices
may open slots without coordinate data. Alps devices may send 0/0 coordinates
as initial slot position.

All these may be addressable with specific quirks, but the actual benefit is
largely restricted to better palm detection (though even with quirks this is
unlikely to work) and support for pinch gestures (again, lack of coordinates
makes supporting those hard anyway).

Elantech: https://bugs.freedesktop.org/show_bug.cgi?id=93583
Alps: https://bugzilla.redhat.com/show_bug.cgi?id=1295073

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 342bc51016)
2016-01-25 13:38:55 +10:00
Peter Hutterer
ea3f1c2131 test: when moving 2 fingers, move them in the same frame
More accurate representation of what we actually want to do. Plus it avoids
weird test case failures in semi-mt where we always pick the t/l and b/r
touches for the bounding box. That is the proper behavior for semi-mt, but
it's not for the tests where we expect simultaneous finger movement.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit d19307f20d)
2016-01-25 13:38:55 +10:00
Peter Hutterer
fd278a2eda touchpad: disable MT for elantech semi-mt touchpads
When three fingers are set down on the touchpad, one finger tends to get a 0/0
coordinate, triggering palm detection in the upper left corner. Handle this
like the jumping semi-mt touchpads and disable MT handling and instead
just rely on the x/y axis and the BTN_TOOL_* events.

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

This kernel patch is required:
https://lkml.org/lkml/2016/1/11/171

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 556aac04b5)
2016-01-25 13:29:16 +10:00
Peter Hutterer
17f742dcd3 doc: add section names to motion normalization subheaders
Otherwise the first word is used as section header and discarded from the
output.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 41cc9053dd)
2016-01-25 13:29:12 +10:00
Peter Hutterer
65f6cd9c6e evdev: only reject devices with missing MT x/y if they're MT devices
A fake MT device may have ABS_MT_POSITION_X but not Y. In this case we don't
care, because we don't handle those axes anyway.

http://bugs.freedesktop.org/show_bug.cgi?id=93474

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit 988cfda42c)
2016-01-25 13:29:07 +10:00
Caibin Chen
9dab84fe92 touchpad: fix DWT pairing for Macbook Pro 2015
Label internal keyboards through the udev hwdb and only pair the internal
(usb) Apple touchpads with those keyboards labelled as such.

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

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
(cherry picked from commit b3f11180e3)
2016-01-25 13:29:02 +10:00
Peter Hutterer
a340736e9b configure.ac: libinput 1.1.4
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-22 11:18:07 +10:00
Peter Hutterer
7ca6a7b13c doc: add missing @config tag to libinput_config_send_event_modes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-22 11:04:15 +10:00
Peter Hutterer
30df66d0a6 evdev: drain any pending evdev events on a device
open_restricted() doesn't always mean 'open the fd'. When the X server uses
systemd-logind, the fd is opened once before PreInit and then kept open across
devices being disabled and enabled through the protocol.

When the device is re-enabled and libinput_path_add_device is called for the
device, we may have events pending on the fd, leaking information that we
should just ignore.

There's also the potential of inconsistent state. The kernel updates the
device state whenever it processes an event, the evdev ioctls return that
state. If events are pending, the state we see is newer than the events we
process immediately after initialization. That can lead to confusion.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-18 10:10:01 +10:00
Peter Hutterer
6922adba05 configure.ac: libinput 1.1.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-16 07:19:30 +10:00
Peter Hutterer
53c28a7d75 touchpad: add a special quirk for the Lenovo x220 with updated firmware
If an x220 is updated to the touchpad firmware version 8.1, the touchpad
suffers from the same issues as the x230 and needs custom acceleration code.
Unfortunately we cannot detect this otherwise, so it is left to the user as a
custom hwdb setting.

https://bugzilla.redhat.com/show_bug.cgi?id=1264453

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-14 08:25:56 +10:00
Peter Hutterer
874a9153b9 util: drop trailing semicolon from CASE_RETURN_STRING macro
Avoid empty statements and force the caller to terminate the macro.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 08:25:56 +10:00
Peter Hutterer
a4ac2bebb3 test: extend sendfile from 4kB to 40kB
The file is already larger than 4k, so we ended up truncating the file for the
tests. This went unnoticed until recent additions that ended up truncating it
halfway through an assignment.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 08:25:56 +10:00
Peter Hutterer
8d76734fb6 test: change extra axes to take a percentage as well
More flexible than having values that are device-specific.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-10 19:02:45 +10:00
Peter Hutterer
6e614e7bee test: use the double comparison macros
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit d070463a72)
2015-12-10 17:02:02 +10:00
Stephen Chandler Paul
33981394aa test: Add litest_assert_double_*() macros
Converts two doubles to 24.8 fixed-width integers so assertions can be made with
doubles in tests

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 9d96286a44)
2015-12-10 17:00:04 +10:00
Peter Hutterer
f5d0b9b99b configure.ac: libinput 1.1.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-09 09:08:10 +10:00
Peter Hutterer
147162da69 touchpad: don't set the axis for a 0.0 value in a scroll event
Once we trigger diagonal scrolling, the device's scroll direction is set as
horiz+vert. From then on, both axes will be set on every subsequent scroll
event, even when the actual delta for an axis is 0.

This causes continuous scroll stop events in clients that care about these
things.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-07 13:13:16 +10:00
Peter Hutterer
e8f2eb18f0 test: always call libinput_dispatch after moving touches
We dont' want to fill up the event queue and cause SYN_DROPPED events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-07 11:57:20 +10:00
Peter Hutterer
3d39dbc3f2 tools: print which scroll axis we have in event-debug
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-07 11:57:20 +10:00
Peter Hutterer
eb1197899e touchpad: don't try to position fake touches when no fingers are down
If all fingers are released in the same frame, we won't be able to find the
top-most touch.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-03 07:35:09 +10:00
Peter Hutterer
c42dfb9cad test: if we're hovering, don't send BTN_TOUCH
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-03 07:34:55 +10:00
Peter Hutterer
26c305d044 test: abort if we have a test that doesn't run for any devices
If the test is filtered out and we never run it generates a false positive.
Though it isn't listed in the "Checks" summary this is a bit hard to tell when
you're running >700 tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-03 07:33:44 +10:00
Peter Hutterer
61b2ec3159 Ignore BTN_TOOL_* events when posting button events
These aren't real button events and they are handled elsewhere, either through
proper touch events on touchscreen or through custom handling in the touchpad
case.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-03 07:08:34 +10:00
Peter Hutterer
5d191d10e7 Add a missing closing ) in a comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-02 10:49:09 +10:00
Peter Hutterer
09a296708a touchpad: reduced the 2fg scroll threshold to 1mm
At least on the t440, this is enough to trigger correct detection between
pinch and scroll 90% of the time. Since scrolling is significantly more
prevalent than gesturing, erring on the side of scrolling at the cost of
misdetecting some gestures is acceptable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-16 09:17:25 +10:00
Peter Hutterer
12e9a940b3 configure.ac: libinput 1.1.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-16 08:36:23 +10:00
Peter Hutterer
334c3faa7b doc: add a link to the dwt config call to the doc
And link the software buttons sentence to the t440 page.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-16 08:08:50 +10:00
Peter Hutterer
acfff361a7 tools: take the start time before initializing the context
Otherwise events that are already queued before the first libinput_dispatch()
have a negative timestamp.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-09 16:06:30 +10:00
Peter Hutterer
c914956211 test: add a device to check MOUSE_WHEEL_CLICK_ANGLE handling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-09 16:06:26 +10:00
Tomi Leppänen
e68598855a Documentation fixes to arrows in svg files
There were two files (doc/svg/{edge,twofinger}-scrolling.svg) that had both
arrow heads pointing to wrong direction. Those arrow heads used markers but
their ids were defined wrong and therefore they displayed weirdly. On Firefox
the arrow head that should have pointed to left pointed actually to right.

This commit fixes that problem by defining the marker ids correctly.

I tested on Firefox 40.0.3 that the arrow heads are now displayed correctly.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Tested-by: Bryce Harrington <bryce@osg.samsung.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-09 12:47:40 +10:00
Peter Hutterer
9949d4ee08 Fix libinput_device_group_find_group() to return NULL on failure
struct list isn't a null-terminated list, list_for_each() causes 'g' to be set
to the list head at the end of the loop. Returning that as group caused random
memory to be overwritten.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-02 09:42:43 +10:00
Peter Hutterer
38f20850e1 evdev: init pointer acceleration for any device with pointer cap and rel x/y
The Asus RoG Gladius exposes two event nodes, one mouse, one keyboard. The
keyboard node has REL_X/Y and REL_HWHEEL on top of the various key bits and
ABS_VOLUME.

The keyboard node does not have BTN_* set, udev tags this device as a
keyboard only, not as a pointer but we still initialize the pointer caps for
it because of the wheel.

When moving this mouse, some deltas (ca "1 in every 20") are sent through the
keyboard node, causing a crash because we never initialized pointer
acceleration.

https://bugzilla.redhat.com/show_bug.cgi?id=1275407

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-10-30 11:18:18 +10:00
Peter Hutterer
91f11eb961 evdev: don't handle motion events if the device isn't a pointer device
This check is already in place for all other event types.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-10-28 10:04:19 +10:00
Peter Hutterer
8b6cc1cc95 evdev: log a bug for missing pointer accel on relative events
And use the unaccelerated motion events. Better than crashing, and better than
a non-moving mouse.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-10-28 10:04:19 +10:00
Peter Hutterer
f012d78de4 evdev: whitespace fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-28 10:04:19 +10:00
Peter Hutterer
7d2c06ec7e configure.ac: libinput 1.1.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-26 10:44:36 +10:00
Peter Hutterer
d92ae62dad touchpad: fix the number of button clicks in multitap
tap-tap-down-move should emit 1 click + press, not 2 clicks + press

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-09-19 02:03:37 +10:00
Peter Hutterer
1d0a1d57e2 configure.ac: bump to 1.0.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-11 03:25:21 +10:00
Peter Hutterer
8d9e7a1bcf Add an API to change pointer acceleration profiles
The quartett of new config functions is:
	libinput_device_config_accel_get_profiles
	libinput_device_config_accel_get_profile
	libinput_device_config_accel_set_profile
	libinput_device_config_accel_get_default_profile

The profile defines how the pointer acceleration works, from a very high-level
perspective. Two profiles are on offer, "adaptive", the standard one we have
used so far and "flat" which is a simple multiplier of input deltas and
provides 1:1 mapping of device movement vs pointer movement.

The speed setting is on top of the profile, a speed of 0 (default) is the
equivalent to "no pointer acceleration". This is popular among gamers and
users of switchable-dpi mice.

The flat profile unnormalizes the deltas, i.e. you get what the device does
and any device below 800dpi will feel excruciatingly slow. The speed range
[-1, 1] maps into 0-200% of the speed. At 200%, a delta of 1 is translated
into a 2 pixel movement, anything higher makes it rather pointless.

The flat profile is currently available for all pointer devices but touchpads.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-09-11 00:54:01 +10:00
Peter Hutterer
0c7ef582eb Fix leaking device groups
If a caller has a reference to a device group when the context is destroyed,
the memory for the group is never released. Calling
libinput_device_group_unref() will release it and there are no side-effects
since the group has no back-references. It's inconsistent with the rest of
libinput though - all other resources get released on libinput_unref().

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-09-10 01:11:06 +10:00
Peter Hutterer
252869c949 test: re-enable the abort-on-bug log handler
This was accidentally disabled in 6953b51b7e. We want to fail
when a bug is exposed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-07 15:07:54 +10:00
Peter Hutterer
79570fd492 touchpad: don't tap for 2fg down, followed by a single finger up
The following sequence currently generates a right-button event:
	finger 1 down
	finger 2 down
	finger 1 up
	finger 2 held down

This is easily triggered with short scroll events. There are two issues here:
first is that the tapping code elsewhere treats any tap with a second finger
down as a left-button tap, not a right button one. So if anything, we should
generate a left button click here, not a right button click.

Arguably, generating a button click here is wrong though, it's not a very well
defined sequence and relatively difficult to trigger intentionally. So the
best solution here is to simply ignore the release event and move straight
back to state HOLD - unless the second finger is released within the timeout.
If the finger is set down again during the timeout, we move straight to
TOUCH_2_HOLD - this could eventually be interpreted as a tap, but not for now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-09-07 07:55:32 +10:00
Andreas Pokorny
6dcbc99499 fix gcc warning on unused return value
Signed-off-by: Andreas Pokorny <andreas.pokorny@canonical.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-07 07:41:41 +10:00
Peter Hutterer
47aafeb4bc Note that libinput_unref() really destroys everything
This is both a bug and required behavior. A caller may hold refcounted
references to devices, seats, or device groups but when libinput_unref()
cleans up, all these become invalid.

It is required behavior, because the last call to libinput_unref() also calls
libinput_suspend() and thus stops any events.

Any attempt at fixing this will break current behavior:
* keeping structs until all refcounts are 0 may leak memory in current
  callers
* it would require an explicit call to libinput_suspend(), or make
  libinput_unref() inconsistent in its behavior.

So we document it as a bug and tell people not to do it.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-09-04 15:51:12 +10:00
Peter Hutterer
f0fa590394 evdev: ignore accelerometer devices
https://bugs.freedesktop.org/show_bug.cgi?id=91563

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-09-01 08:20:03 +10:00