Commit graph

33 commits

Author SHA1 Message Date
Peter Hutterer
451c6913e5 tools: add "--quiet" option to only log libinput messages
Supresses any printf statements from the tool itself, i.e. it skips printing
any of the events.

Makes it easier to debug the internal state since it's not intermixed with a
whole lot of messages about the events that are generated. Best combined with
--verbose (yes, hilarious, isn't it...)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
2017-02-24 16:11:46 +10:00
Peter Hutterer
92196ce555 tools: print errors as red, info as highlighted
makes it easier to filter out debugging messages

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-02-15 09:29:39 +10:00
Peter Hutterer
8c1aa1de00 tools: hide key codes by default
libinput-debug-events prints keycodes as they come in. This makes it dangerous
to be run by users (especially in the background) because it will leak
sensitive information as it is typed. Obfuscate the base set of keycodes
by default, require a --show-keycodes switch to show it.

The few times we actually need the keycodes, we can run the switch in the
debugging tool.

This does not affect keys outside of the main block on the keyboard (F-keys,
multimedia keys).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-02-14 07:53:22 +10:00
Peter Hutterer
16bf0deb23 tools: add allowed range to --set-speed help output
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-03 09:35:40 +10:00
Peter Hutterer
952b562d0c tools: fix signed/unsigned comparison warnings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-12-06 11:02:13 +10:00
Peter Hutterer
6e1db369ee tools: fix prototype for tools_usage
../tools/shared.h:66:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
void tools_usage();

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-12-06 08:06:27 +10:00
Peter Hutterer
ea7026b7c1 tools: don't define GNU_SOURCE if were including config.h anyway
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
2016-12-01 11:06:52 +10:00
Peter Hutterer
364621c001 tools: change --speed to --set-speed for consistency
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-11-29 12:13:23 +10:00
Peter Hutterer
ef2f95dfee Mark some internal log functions as printf-style function
Fixes the respective clang warnings

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2016-10-25 10:00:58 +10:00
Peter Hutterer
59fac8e902 Add configurable button map to tappings
The previously hardcoded button map for tapping is 1/2/3 to LRM. But the
middle button is a common feature on the desktop (used for paste, most
prominently) and three-finger tapping is almost impossible to do reliably on
some touchpads (e.g. the T440 has a recognition rate of ~1 in 5).

Left and right buttons have a prominent physical position (either softbuttons
or physical buttons) so make the tap order configurable. Those that require
middle buttons reliably can use the [software] buttons for left/right and
2-finger tap for a middle button.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-08-15 09:05:57 +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
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
42f482b43d tools: fix switch statement indentation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-08-20 07:57:03 +10:00
Peter Hutterer
55974dcac5 Add a configuration interface for enabling/disabling disable-while-typing
DWT can interfere with some applications where keyboard and touchpad use at
the same time is common, e.g. games but also anything that requires a
combination of frequent pointer motion and use of keyboard shortcuts.

Expose a toggle to disable DWT where needed.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-07-24 08:49:23 +10:00
Peter Hutterer
f74769e77e tools: add --grab option
Issues an EVIOCGRAB on the openend devices, providing exclusive access. Makes
it easier for debugging, so moving the pointer doesn't accidentally trigger
other stuff.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-24 15:19:33 +10:00
Peter Hutterer
b7c414558d tools: pass a context around as userdata
We need the options during open_restricted(), so instead of the caller just
passing in a custom userdata, let them wrap it into a tools_context.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-24 15:15:15 +10:00
Peter Hutterer
41ad79f8d8 tools: move the interface into the shared code
No need to duplicate this atm

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-24 15:15:07 +10:00
Peter Hutterer
6b2afee368 tools: remove obsolete comments
With the OPT_foo enums, these comments aren't necessary anymore

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-06-24 15:15:05 +10:00
Peter Hutterer
16107e1862 tools: hook up drag lock config
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-06-23 14:24:29 +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
0ca29c6ddc Add streq() helper to use instead of strcmp() == 0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-26 08:46:05 +10:00
Peter Hutterer
fb53e08f96 tools: add --set-scroll-button as option
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-04-22 07:22:42 +10:00
Peter Hutterer
476d8b9eca tools: add --set-scroll-method commandline flag
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-04-21 17:58:08 +10:00
Peter Hutterer
a6c4115692 Add middle mouse button emulation config options
Adds the following quartett of functions to enable/disable middle mouse button
emulation on a device:
	libinput_device_config_middle_emulation_is_available()
	libinput_device_config_middle_emulation_set_enabled()
	libinput_device_config_middle_emulation_get_enabled()
	libinput_device_config_middle_emulation_get_default_enabled()

This patch only adds the config framework, it is not hooked up to anything
yet.

Note: like other features this is merely the config option, some devices will
provide middle button emulation without exposing it as configuration. i.e. the
return value of libinput_device_config_middle_emulation_is_available() only
tells you whether you can _configure_ middle button emulation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-04-17 12:49:43 +10:00
Peter Hutterer
2a1a28dd1d tools: add commandline flag to control the pointer accel speed
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-04-10 15:53:31 +10:00
Peter Hutterer
7ce25592d9 tools: add click method config to the tools
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-16 10:35:00 +10:00
Stephen Chandler Paul
2af608cf02 Rename functions for left handed device configurations
Some devices require more than just flipping around the buttons, such as
tablets.
When it comes to devices like tablets, because the position of the palm rest is
on the right, the entire tablet has to be flipped around in order to be usable
by lefties. As such, this requires that we reverse the coordinates of the
tablets in addition to flipping the buttons on the tablet. As such, renaming
these functions so that they aren't specific to devices where only the buttons
are flipped seems appropriate.

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-01-15 10:17:57 +10:00
Peter Hutterer
df47231719 tools: pass the userdata to the context
The event-gui needs this but it got dropped in
6ee8c585, causing a crash. Oops.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-23 11:14:39 +10:00
Peter Hutterer
363a7f783f tools: add support for enabling/disabling left-handed button mappings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-23 10:50:31 +10:00
Peter Hutterer
333f4e0347 tools: add support to enable/disable natural scrolling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-23 10:50:31 +10:00
Peter Hutterer
b8e63b54d3 tools: move applying device configuration to shared lib
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-23 10:50:31 +10:00
Peter Hutterer
3628f7016e tools: move opening the backend to the shared lib too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-23 10:50:31 +10:00
Peter Hutterer
e205615c98 tools: move option parsing to a helper library
event-debug and event-gui can and should share this

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-23 10:50:31 +10:00