Commit graph

1815 commits

Author SHA1 Message Date
Peter Hutterer
2f481ba4a2 tablet: handle custom proximity handling
For the puck/lens cursor tool we need to artificially reduce proximity
detection. These tools are usually used in a relative mode (i.e. like a mouse)
and thus require lifting and resetting the tool multiple times to move across
the screen. The tablets' distance detection goes too far, requiring the user
to lift the device several cm on every move. This is uncomfortable.

Introduce an artificial distance threshold for the devices with the default
value taken from the X.Org wacom driver. If a tool is in proximity but outside
of this range, fake proximity events accordingly.

If a button was pressed while we were out of range we discard that event and
send it later when we enter proximity again.

This is the simple implementation that only takes one proximity out value (the
one from the wacom driver) and applies it to all. Those devices that support a
button/lens tool and have a different default threshold are well out of date.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

[rebased, tests updated for new axis percentage behavior (8d76734f)]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-23 09:15:36 +10:00
Peter Hutterer
c124209cad tablet: drop unused argument from tablet_mark_all_axes_changed
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-23 09:15:36 +10:00
Peter Hutterer
cd36b44b9b tablet: invert tilt axes when left-handed is enabled
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-23 08:08:06 +10:00
Peter Hutterer
cbb9e9e809 tablet: add libinput_tablet_tool_is_unique()
For checking if a tablet tool can be uniquely identified by libinput. In
practice this means checking for a nonzero serial number, but let's not
restrict ourselves to allowing just that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-23 07:55:11 +10:00
Peter Hutterer
7309fd0ed3 tablet: simplify marking axes as changed
The only time we need this is on proximity in, so move it to where we handle
that to have better locality. And rather than looping through and checking
each bit, just memcpy the axis capabilities, because by definition they
represent the set of axes that can possibly change.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-23 07:33:39 +10:00
Peter Hutterer
c39a91200e tablet: don't mark all axes changed on init
This will be set when the tool comes into proximity later.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-23 07:33:39 +10:00
Peter Hutterer
53ac112d6c tablet: split out axis handling into helper functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-23 07:33:39 +10:00
Peter Hutterer
fa71278c19 tablet: store the wheel delta in the normal axes
Now that we don't provide an API anymore to access the absolute value of the
wheel and the axes are handled separately, we can safely store the wheel delta
in the normal axis array.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-23 07:33:39 +10:00
Peter Hutterer
67220c643f tablet: simplify check for testing if an axis update is needed
We know when one of the bits is set we need to send an event

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-23 07:33:39 +10:00
Peter Hutterer
c8a99cdf10 tablet: simplify check for testing if an axis update is needed
We know when one of the bits is set we need to send an event

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-23 07:33:39 +10:00
Peter Hutterer
ea07cbcd89 tablet: unroll the tablet axis processing loop
Process the axes explicitly, rather than having a loop that needs special
casing for most axes anyway. And since we do the axes one-by-one, we can use
the evdev axis code directly rather than the axis_to_evcode helper.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-23 07:33:39 +10:00
Peter Hutterer
9fd0fb0df8 tablet: dump deltas, replace it with a single wheel_delta variable
The wheel is the only one axis that has actual deltas, all others have
straightforward deltas that we don't need to care about, the caller can
calculate those where needed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-23 07:33:39 +10:00
Peter Hutterer
d5e18a8e64 tablet: dump deltas_discrete, replace with a single wheel_discrete variable
Only the wheel has a discrete value, no need to keep arrays for a single
value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-23 07:33:39 +10:00
Peter Hutterer
aaac47d442 test: add litest_axis_set_value helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-23 07:33:11 +10:00
Peter Hutterer
beee8403e9 test: move litest_assert_ macros and helpers up to the rest of the defines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-21 10:55:36 +10:00
Peter Hutterer
aaea4a63ec tablet: add tilt tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-21 09:47:31 +10:00
Peter Hutterer
8635ba556b tablet: remove the libinput_tablet_tool_axis enum from the public API
Internally we still use it, at least for now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Lyude <cpaul@redhat.com>
2015-12-21 07:59:00 +10:00
Peter Hutterer
f96ee412df tablet: reduce event deltas to only apply to the wheel
Part of the big revamp to get rid of libinput_tablet_tool_axis and
replace it with a set of axis-specific APIs.

Only the rel wheel has true delta events, everything else is a delta
calculated by libinput based on the previous position. Since we supply that
position to the callers anyway, they can determine that delta themselves
where needed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Lyude <cpaul@redhat.com>
2015-12-21 07:59:00 +10:00
Peter Hutterer
828ca69c77 tablet: rename libinput_tablet_tool_has_axis into an axis-specific API set
Part of the big revamp to get rid of libinput_tablet_tool_axis and
replace it with a set of axis-specific APIs.

Note that this commit drops the ability to check whether a tablet has an x or
y axis. If it doesn't, libinput won't initialize the tablet anyway so this was
superfluous already.

Likewise with the tilt axes - either we have x and y tilt or we have neither,
so separate checks for tilt_x and tilt_y is unnecessary.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Lyude <cpaul@redhat.com>
2015-12-21 07:59:00 +10:00
Peter Hutterer
e5a33086bc tablet: rename axis_get_value into an axis-specific API set
Second part of the big revamp to get rid of libinput_tablet_tool_axis and
replace it with a set of axis-specific APIs.

Note that this commit drops the ability to get the absolute value from a
relative wheel. The previous API always returned 0 for this case, it is not
needed anymore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Lyude <cpaul@redhat.com>
2015-12-21 07:59:00 +10:00
Peter Hutterer
5c9c481047 tablet: rename axis_has_changed into an axis-specific API set
First part of the big revamp to get rid of libinput_tablet_tool_axis and
replace it with a set of axis-specific APIs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Lyude <cpaul@redhat.com>
2015-12-21 07:59:00 +10:00
Peter Hutterer
67b92adee7 test: modernise the tablet tool serial tests a bit
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-16 09:03:18 +10:00
Peter Hutterer
50f4caf1b8 test: use proper proximity events in tablet serial test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-16 09:03:15 +10:00
Peter Hutterer
458734e6eb doc: minor comment clarification
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-16 09:03:05 +10:00
Peter Hutterer
4b9b221847 Merge branch 'master' into tablet-support 2015-12-16 08:46:34 +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
60b05c5696 doc: a couple of tablet documentation fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-15 09:52:08 +10:00
Peter Hutterer
db852ef0db tablet: support tool-specific pressure offsets
If a tool wears out, it may have a pre-loaded pressure offset. In that case,
even when the tool is not physically in contact with the tablet surface it
will send pressure events.

Use automatic pressure offset detection, similar to what the X.Org wacom
driver does. On proximity-in, check the pressure and if the distance is above
50% of the range and the pressure is nonzero but below 20% of the range, use
that value as pressure offset.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Ping Cheng <pingc@wacom.com>
2015-12-15 08:21:39 +10:00
Peter Hutterer
09456ebf23 test: add pressure axes to proximity in for the bamboo and the cintiq
Required for pressure offset testing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-15 08:08:16 +10:00
Peter Hutterer
6861039c29 tablet: drop unused condition
Since bd0f43eeb6 this condition isn't triggered
anymore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-15 08:01:07 +10:00
Peter Hutterer
69dd3e4629 doc: add missing tablet-axes.svg
Missing from 4677c48ab6

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 13:52:35 +10:00
Peter Hutterer
6261e4e61f Merge branch 'master' into tablet-support 2015-12-14 12:44:05 +10:00
Peter Hutterer
f0a57fc97a test: change tablet matrix test to use absolute x/y values
Prep work for dropping delta coordinates.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 10:31:40 +10:00
Peter Hutterer
72249f8a16 test: fix test for tablet rel wheel discrete deltas
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 10:29:42 +10:00
Peter Hutterer
0c6f505ae6 tools: print the wheel axis delta, not the axis value
The axis value for a rel wheel is always 0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 10:29:37 +10:00
Peter Hutterer
c7533b753d test: fix copy/paste error in motion_delta_partial
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 08:49:57 +10:00
Peter Hutterer
7c449cf5f9 tablet: add missing tip event to libinput_event_tablet_tool_get_base_event()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 08:28:04 +10:00
Peter Hutterer
1a34401137 test: set default axis values for all tablet devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 08:27:59 +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
727d184230 test: change extra axes to take a percentage as well
And change them to doubles, we need more granularity when the range is only
0-100.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 07:44:57 +10:00
Peter Hutterer
7ea1c134e6 test: add the HUION PenTablet device
Tablet with pressure and proximity but no distance axis.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-11 10:53:06 +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
eb9b05f407 Merge branch 'master' into tablet-support 2015-12-09 10:19:47 +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
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
20db89f5c9 evdev: make evdev_transform_absolute available within libinput
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-09 08:59:49 +10:00