Commit graph

286 commits

Author SHA1 Message Date
Peter Hutterer
8e17a9ab5c pad: implement wacom pad support
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-04-18 09:12:02 +10:00
Peter Hutterer
b2a3706948 Add the LIBINPUT_DEVICE_CAP_TABLET_PAD capability and matching interface
This interface handles the buttons on the physical tablet itself, including
the touch ring and the strip.

A notable difference to other libinput interfaces here is that we do not use
linux/input.h event codes for buttons. Instead, the buttons are merely
numbered sequentially, starting at button 1. This means:
* the API is different, instead of get_button() we have get_button_number() to
  drive the point home
* there is no seat button count. pads are inherently different devices and
  compositors should treat them as such. The seat button count makes sense
  when you want to know how many devices have BTN_LEFT down, but it makes no
  sense for buttons where all the semantics are handled by the compositor
  anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
Reviewed-by: Carlos Garnacho <carlosg@gnome.org>
2016-04-18 09:12:02 +10:00
Jonas Ådahl
ee6501d12f libinput: Actually return the default accel profile
We just returned the current profile instead of the default one. Fix
that.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-11 07:53:38 +10:00
Peter Hutterer
b4a74bcebc Assert that the interface is actually filled in.
Had this in a private bug report recently. Missing hooks for open/close just
segfault with little information to debug. Add an assert, this is definitely a
bug in the caller and we don't need to recover from that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-03-07 13:05:26 +10:00
Peter Hutterer
e086f9cf92 tablet: change error message to TABLET_TOOL from TABLET
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-04 07:59:07 +10:00
Peter Hutterer
ae41aa146d Merge branch 'master' into tablet-support 2016-01-27 13:54:00 +10:00
Peter Hutterer
cba2278c3a touchpad: add a config option to disable tap-and-drag
There are a number of use-cases where tapping may be desirable, but
tap-and-drag is not, e.g. where tapping is used to select multiple items in a
list. Having tap-and-drag on hinders this, and the nature of the interaction
means it cannot be detected based on timeouts, movement thresholds, etc.

Provide an option instead to turn tap-an-drag off. Tap-and-drag remains
enabled by default (though tapping is disabled by default).

For the touchpad tap state diagram, the new option disables the transition
from state TOUCH to state TAPPED and releases the button immediately instead.
This means that multitap-and-drag is disabled too since we now just loop
around in the single-tap state for multitap.

It also makes tapping more responsive - we don't have to wait for the timeout
before we know whether it's a tap event. The first touch time is noted, we now
send the button press with the time of the first touch and the release with
the time of the release. This ensures a realistic time diff between the two
events.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.netto>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-27 10:03:28 +10:00
Peter Hutterer
de3f1fa6fa Merge branch 'master' into tablet-support 2016-01-25 15:29:11 +10:00
Peter Hutterer
108a191a3e tablet: add support for relative x/y motion deltas
Instead of an explicit tablet mode that device must be changed into, let the
caller decide which coordinates are preferred. The tablet mode may be
application-specific and usually depends on the tool as well.

This patch adds an interface to get a motion delta for the x/y axes in
pixel-like coordinates. libinput provides some magic to convert the tablet
data into something that resembles pixels from a mouse motion.
For unaccelerated relative motion, the caller should use the mm values from
the tablet and calculate deltas manually.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-22 16:16:55 +10:00
Peter Hutterer
585deda799 gestures: pass the finger count into pinch events
Prep work for multifinger pinch gestures

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 15:38:12 +10:00
Peter Hutterer
f5200c5325 tablet: drop delta array, provided by the tablet_axis struct now
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-15 10:07:18 +10:00
Peter Hutterer
d524313d2b tablet: use a struct rather than a double array for axis values
Makes the code less generic, but more expressive. No visible functional
changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-15 10:07:18 +10:00
Peter Hutterer
d5a07eb00b tablet: allow the various get_<axis> on tablet button events
There's no reason to prevent this for button events. Unlike the pointer
which is a relative device a tablet is (usually) a device with a lot of state.
Caller code that handles axes is likely shared between the various events,
treating button events separately here doesn't get us any benefit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-15 10:07:05 +10:00
Peter Hutterer
1a99977ca0 tablet: a tip event can replace an axis event
When we're only dealing with BTN_TOUCH we can make the tip event independent
of the axis event. Now that we handle pressure thresholds to trigger tip state
this does not work, we'd have to send an axis event with the new pressure and
then a tip event. Since the pressure triggers the tip event this seems
disconnected.

Make the tip event officially capable of carrying axes. A caller can then
decide how to forward this to the next layer.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-11 15:17:46 +10:00
Peter Hutterer
0b124a1a5d tablet: insert "STATE" into proximity/tip states
Makes it even longer, but at least it's consistent with button and key state.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-06 11:02:40 +10:00
Peter Hutterer
9114054fa2 tablet: explicitly set the tip state on the proximity event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-23 13:22:56 +10:00
Peter Hutterer
67e0b232a0 Add event debugging to libinput_post_event
Print the type of event when it is queued up internally. This makes it a lot
easier to associate evdev events with the libinput event queued up and does
not depend on the caller calling libinput_dispatch().

Since this should only be used during development, hide it behind an if 0.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-23 09:59:35 +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
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
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
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
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
5074b59241 Merge branch 'master' into tablet-support 2015-11-24 15:18:47 +10:00
Peter Hutterer
abb98d5738 tablet: rename the libinput_tool calls to libinput_tablet_tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:54 +10:00
Peter Hutterer
a10e92849c tablet: rename libinput_event_tablet to libinput_event_tablet_tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:54 +10:00
Peter Hutterer
2cfd52244a tablet: rename LIBINPUT_EVENT_TABLET to LIBINPUT_EVENT_TABLET_TOOL
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:54 +10:00
Peter Hutterer
b1b676e24a tablet: rename the tablet capability to a tablet_tool capability
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:54 +10:00
Peter Hutterer
7123c37f1c tablet: rename tool_tip_state to tablet_tool_tip_state
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:53 +10:00
Peter Hutterer
cc2b45dd50 tablet: rename TOOL_PROXIMITY_ to TABLET_TOOL_PROXIMITY
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:53 +10:00
Peter Hutterer
a22b94a22c tablet: rename tool_proximity_state to tablet_tool_proximity state
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:53 +10:00
Peter Hutterer
b85d57fdf8 tablet: rename libinput_tool_type to libinput_tablet_tool_type
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:53 +10:00
Peter Hutterer
827abfbb56 tablet: rename the tablet axes to "LIBINPUT_TABLET_TOOL_AXIS_..."
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:53 +10:00
Peter Hutterer
cd2cd2f112 tablet: rename libinput_tablet_axis to libinput_tablet_tool_axis
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:53 +10:00
Peter Hutterer
98df9eb63f tablet: rename libinput_tool to libinput_tablet_tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 12:13:53 +10:00
Peter Hutterer
7835e74604 tablet: allow fetching the tip state from any tablet event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-16 09:23:59 +10:00
Peter Hutterer
5f928dfeac tablet: allow checking for proximity state on all tablet events
By definition, the state is always proximity in on other events but let's
allow the call to be made anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-16 09:23:59 +10:00
Peter Hutterer
117161dc72 tablet: add missing event type checks for tablet events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-16 09:23:59 +10:00
Peter Hutterer
1318ffadb5 tablet: split out tip handling into a separate event
The tablet tip works like a button in the kernel but is otherwise not really
a button. Split it into an explicit tip up/down event instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-12 06:52:51 +10:00
Peter Hutterer
368ced1f29 tablet: widen the tool id to 64 bits
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-09 15:38:55 +10:00
Peter Hutterer
4ae64a3436 tablet: allow tablet_get_x/y_transformed for proximity events as well
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2015-11-05 14:35:52 +10:00
Peter Hutterer
548ad08909 tablet: restrict tablet_axis_has_changed to axis/proximity events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2015-11-05 14:35:00 +10:00
Peter Hutterer
19812f599e tablet: use require_event_type instead of direct type check
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2015-11-05 14:33:58 +10:00
Peter Hutterer
4edcd79372 tablet: widen the serial type to uint64_t
Internally we still use uint32_t because that's all we get from evdev. But
eventually we'll have 64 bit serials.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2015-11-05 13:18:33 +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
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