Commit graph

82 commits

Author SHA1 Message Date
Peter Hutterer
b02acd346b Read the horizontal wheel click angle property if available
The Logitech MX master has different click angles for the two wheels.

https://github.com/systemd/systemd/issues/3947

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-22 11:29:35 +10:00
Peter Hutterer
35b28b1af3 test: merge all tests into a single binary
Call it a libinput-test-suite-runner, in subsequent patches we'll handle doing
parallel tests ourselves instead of relying on automake features.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-08-02 10:19:38 +10:00
Peter Hutterer
0526044f6d touchpad: remove software middle button when emulation is enabled
Expose the middle button emulation on software buttons as proper config
option. When enabled, remove the middle button software button area.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-07-04 09:41:33 +10:00
Peter Hutterer
115c512241 test: add test to ensure MB emulation doesn't start while the MB is down
We already handle the case where we have MB emulation active and a middle
button is pressed because we often don't know if we have a middle button on
the device.

But the other way round makes little sense, when a physical middle button is
down emulation should not engage. Test for this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-04-14 10:48:26 +10:00
Peter Hutterer
c61dfc80bd evdev: enable middle-button scrolling on middle-button emulation
https://bugs.freedesktop.org/show_bug.cgi?id=94856

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-04-14 10:48:26 +10:00
Peter Hutterer
4f74f8e685 test: add test for no scroll events before the scroll button timeout
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-04-14 10:47:58 +10:00
Jonas Ådahl
c830f51b2e test-pointer: Test that the default accel profile doesn't change
Make sure that changing the accel profile doesn't affect the default
accel profile.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-11 07:53:45 +10:00
Jonas Ådahl
240d669bba test: Handle 32 bit msec time overflows
The libinput_*_get_time() returns a 32 bit unsigned integer, but in the
tests we compared them to a 64 bit unsigned integer. This means that
when the 32 bit integer overflowed, we'd still compare to a
non-overflowed 64 bit integer, causing the tests to fail.

This commit fixes this by always casting the millisecond 64 bit unsigned
integer to a 32 unsigned integer, triggering the same overflow.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-11 07:53:25 +10:00
Peter Hutterer
bd0f43eeb6 tablet: enable the calibration matrix for internal tablets
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-09 09:01:03 +10:00
Peter Hutterer
5074b59241 Merge branch 'master' into tablet-support 2015-11-24 15:18:47 +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
Peter Hutterer
ab6a409cdc Merge branch 'master' into tablet-support 2015-10-21 19:19:01 +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
6bfc36f9cf Merge branch 'master' into tablet-support 2015-08-04 12:32:00 +10:00
Jonas Ådahl
aa5f55149b Change to micro seconds for measuring time internally
In order to provide higher precision event time stamps, change the
internal time measuring from milliseconds to microseconds.
Microseconds are chosen because it is the most fine grained time stamp
we can get from evdev.

The API is extended with high precision getters whenever the given
information is available.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-28 17:42:32 +08:00
Jonas Ådahl
6e26493272 test/pointer: Don't rely on velocities in direction change test
We currently rely on an extra millisecond being added by the filter
code to get a velocity that are small enough to not hit the max
acceleration limit. If this arbitrary millisecond is changed (for
example by changing the internal time measurment to microseconds and
adding just a microsecond instead), the velocity may change so that the
maximum or minimum acceleration is always hit.

Adding a delay to the test won't work either since it would not only rely
on ending up within the acceleration limits but there would also be an
non-deterministic actual delay causing the velocity of the movement
after the direction change to be potentially larger than the movement
in the original direction due to the actual time delta in libinput will
not always be 1ms.

To fix the test to not rely on any artificial delays in the filter code
nor any non-deterministic delays in the test, lets just test that the
direction change of the hardware events resulted in a direction change
of the libinput motion events.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-28 16:15:46 +08:00
Jonas Ådahl
4bd1d5c6d1 test: Use ck_assert_double_ for checking doubles in some places
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-28 16:15:05 +08:00
Peter Hutterer
a7bd84a7ee Merge branch 'master' into tablet-support 2015-07-24 10:56:05 +10:00
Thomas Hindoe Paaboel Andersen
c1dbd67f3b Code cleanup
Removes some dead assignments, an unused function, and
uses %d format specifier for int.

Signed-off-by: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-20 11:30:06 +10:00
Peter Hutterer
ae32e0a17b Drop vector_length(), replace with hypot(3)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-20 11:18:53 +10:00
Peter Hutterer
772d69751b Merge branch 'master' into tablet-support 2015-07-06 13:52:57 +10:00
Peter Hutterer
2e339095b3 test: add a test for 0/0 relative motion events
This test doesn't really test for that because the kernel shouldn't forward
these events to us in the first place. It's merely a canary to warn us if this
ever changes and we end up not ignoring the events.

The test is only run for one device (the default mouse), no need to waste more
time on this.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-03 09:44:04 +10:00
Peter Hutterer
08fba7bd96 test: add a test for minimum motion movement
The first motion on a device must have the mimimum movement factor (0.3)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-03 09:44:04 +10:00
Peter Hutterer
a1feb44836 test: send a single motion event for relative tests only
Since 69449ca854, the minimum deceleration is 0.3 and we don't get a 0 motion
event anymore. We can drop the helper function now too.

What we do in that test instead is pump one relative motion event through
before we start comparing the events, this way our second, third, .. events
will have some acceleration applied and the tests compare more accurate
values.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-07-03 09:44:04 +10:00
Peter Hutterer
0e23bc45d9 test: disable pointer wheel tests on tablets
Not implemented yet, not even for tablets with true wheels.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-29 16:03:24 +10:00
Peter Hutterer
aa46338e8a touchpad: mark ALPS touchpads for middle button emulation
Alps devices don't know if there is a physical middle button on the touchpad,
so they always report one.
Since a large number of touchpads only have two buttons, enable middle button
emulation by default. Those that really don't want it can play with
configuration options, everyone else has it working by default.

The hwdb entry uses "*Alps ..*" as name to also trigger the "litest Alps..."
devices.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-22 08:12:04 +10:00
Peter Hutterer
bc9f16b40e COPYING: Update boilerplate from MIT X11 to MIT Expat license
To quote Bryce Harrington from [1]:
"MIT has released software under several slightly different licenses,
including the old 'X11 License' or 'MIT License'.  Some code under this
license was in fact included in X.org's Xserver in the past.  However,
X.org now prefers the MIT Expat License as the standard (which,
confusingly, is also referred to as the 'MIT License').  See
http://cgit.freedesktop.org/xorg/xserver/tree/COPYING

When Wayland started, it was Kristian Høgsberg's intent to license it
compatibly with X.org.  "I wanted Wayland to be usable (license-wise)
whereever X was usable."  But, the text of the older X11 License was
taken for Wayland, rather than X11's current standard.  This patch
corrects this by swapping in the intended text."

libinput is a fork of weston and thus inherited the original license intent
and the license boilerplate itself.

See this thread on wayland-devel here for a discussion:
http://lists.freedesktop.org/archives/wayland-devel/2015-May/022301.html

[1] http://lists.freedesktop.org/archives/wayland-devel/2015-June/022552.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Acked-by: Jonas Ådahl <jadahl@gmail.com>
2015-06-16 14:36:04 +10:00
Peter Hutterer
a6be43990c Merge branch 'litest-filter-tests'
The litest-selftest has its own main method and compiles litest.c with special
flags. Use that to ifdef out the litest.c main function, and inline the
litest_run/litest_parse_args functions so gcc doesn't complain about unused
functions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 09:15:15 +10:00
Peter Hutterer
9dbeb9d0f7 test: move main() into litest
This allows us to filter things based on argv before setting up tests, etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 08:45:33 +10:00
Peter Hutterer
180564c780 evdev: sync the initial state for absolute pointer devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-21 21:41:47 +10:00
Peter Hutterer
ed5d43da36 Merge branch 'litest-backtrace' 2015-05-21 11:05:45 +10:00
Peter Hutterer
f70db17d21 Allow disabling of middle button emulation where it doesn't exist
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-19 16:57:49 +10:00
Peter Hutterer
13c7b47d87 test: convert all helper functions to use the litest macros
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 20:55:48 +10:00
Peter Hutterer
c9ea9836f3 test: cast to int before integer comparison
No effect with the current macros since they'll cast to int for us, but this
will change with the litest_assert macros.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 20:55:48 +10:00
Peter Hutterer
d81a677f6d test: don't use enum values in ck_assert macros directly
Unfortunately, typeof(enum something) != typeof(ENUM_VALUE) and produces a
-Wsign-compare warning

Preemptively fix this, it'll show up in the upcoming litest_asssert macros
otherwise.

This fix only applies to helper functions, tests themselves wont (yet) be
switched to the new macros and don't need fixing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 20:55:48 +10:00
Peter Hutterer
77eb2d5445 test: add litest_is_motion_event() helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-07 14:40:59 +10:00
Peter Hutterer
2e38547c79 test: add litest_is_axis_event() helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-07 14:40:59 +10:00
Peter Hutterer
8ead828e6f Fix a couple of coding style issues
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-01 12:09:57 +10:00
Peter Hutterer
a7b2d04e90 evdev: enable button scrolling by default on mice without wheels
If we have a middle button but no wheels, enable on-button scrolling for the
middle button by default. This applies e.g. to the Logitech trackball added as
new test device here.

This makes the separate check for POINTINGSTICK obsolete but I'd rather leave
this in to be more explicit about it.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-04-28 17:12:31 +10:00
Peter Hutterer
512a00505a test: expand the middle button emulation tests
Instead of excluding the pointing stick devices, disable middle button
scrolling on those and run them anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-04-28 16:56:09 +10:00
Peter Hutterer
106e78cf8a test: change the suite name for two of the pointer button tests
No need for a separate test suite group here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-04-28 16:56:01 +10:00
Peter Hutterer
5e85957ad2 evdev: init pointer accel filters when we have rel x/y axes
Some devices provide abs x/y and rel x/y. We can't know which event the device
will send. The Microsoft Surface Type Cover sends relative events, which
then crashes libinput when we don't have an accel filter set up.

So instead of checking that the device doesn't have ABS_X/Y, check for the
device to have REL_X/Y instead.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
2015-04-28 07:45:32 +10:00
Peter Hutterer
da439476b5 test: check for event as not null before dereferencing it
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
2015-04-27 13:24:40 +10:00
Peter Hutterer
9ccd6c0cd2 test: mix mixing of middle buttons state vs config status enum types
Coverity complaint: mixed_enums: Mixing enum types enum
libinput_config_middle_emulation_state and enum libinput_config_status

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-04-21 18:05:41 +10:00
Peter Hutterer
a09476cdac test: middle button emulation tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-04-17 12:50:08 +10:00
Peter Hutterer
55823f2350 test: adjust scroll wheel test for HWHEEL-only devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-04-08 11:42:44 +02:00
Peter Hutterer
b69905deef test: add accel test for direction change
Make sure that if we go in one direction, then change flip over to the other
direction we actually stop going into that direction, and the delta is lower
than whatever the previous delta was (i.e. acceleration resets).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-19 13:01:30 +10:00
Peter Hutterer
72cc601007 test: add protocol A touch screen tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-02 12:45:47 +10:00
Peter Hutterer
ed0f0bf494 test: fix Coverity complaints
seat_button_count
seat_key_count ... uninitialized variable

t = zalloc
s = zalloc ... dereferencing potential NULL-pointer

d->ntouches_down... side-effect in assertion

Coverity run against the 0.10.0 tag, see
https://scan.coverity.com/projects/4298

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Christian Hartmann <cornogle@googlemail.com>
2015-02-20 10:03:09 +10:00
Olivier Fourdan
f420c54a99 Fix an abort if the device speed is NaN
When using libinput with xf86-input-libinput, the device speed is
represented as a float passed via X properties.

If a buggy client gives a broken value, the conversions that occur
can cause the value of speed to be NaN (not a number), aka infinity.

In C, any comparison with NaN always gives false, whatever the value.

So that test in libinput_device_config_accel_set_speed():

   (speed < 1.0 || speed > 1.0)

will necessarily return FALSE, defeating the test of range.

However, since since any comparison with NaN is false, the
opposite assert() in accelerator_set_speed():

   (speed >= 1.0 && speed <= 1.0)

will be false as well, thus triggering the abort() and the crash of
the entire X server along with it.

The solution is to use the same construct in both routines, so that
it fails gracefully in libinput_device_config_accel_set_speed().

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-06 10:26:04 +10:00