Compare commits

...

26 Commits

Author SHA1 Message Date
Peter Hutterer
8136113139 xf86-input-libinput 0.17.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-02-26 15:57:48 +10:00
Peter Hutterer
202eb68dc0 Fix compiler warnings about missing tablet event cases
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-28 15:02:54 +10:00
Peter Hutterer
e8f5394b07 Add property/option for enabling/disabling tap-n-drag
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-28 15:01:39 +10:00
Peter Hutterer
20f5269a29 Fix default tapping drack lock property value
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-27 11:13:07 +10:00
Peter Hutterer
3dacb28b20 Allow hotplugging a device immediately
This splits the hotplugging code up so we can use it through a callback but
also as an immediate call that gives us back the device just hotplugged. Also
added is the ability to add extra options to the device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-05 11:16:19 +10:00
Peter Hutterer
db8e73141c Change creating subdevices to something more generic
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-05 11:16:19 +10:00
Peter Hutterer
0d1851a000 xf86-input-libinput 0.16.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-23 13:53:38 +10:00
Peter Hutterer
ad8483b913 Drain the fd after opening
Make sure we don't send any events that may have been enqueued before we
initialized ourselves. Specifically, if we're using systemd-logind the fd
remains open when we disable/enable the device, allowing events to queue up on
the fd. These events are then replayed once the device is re-opened.

This is not the case when VT-switching, in that case logind closes the fd for
us.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-12-17 11:23:28 +10:00
Peter Hutterer
1f43f3921f Split mixed pointer/keyboard devices into two separate X devices
The server struggles with devices that are both, the protocol (especially XI2)
requires a fairly strict separation of pointer vs keyboard devices. Though the
server has a couple of hacks to route events correctly, mixed
devices still experience bugs like [1].

Instead of advertising the device as a single mixed device, split the device
into two X devices, one with only a pointer/touch component, one with only a
keyboard component. This ensures that the device is effectively attached to
both the VCP and the VCK, something the XI2 protocol doesn't really allow.

This patch drops the keyboard capability on a mixed device, duplicates the
input options and attributes and queues a NewInputDeviceRequest call. The new
device only has the keyboard capability but is otherwise unchanged. The
wacom driver has used this approach for years.

The WorkProc is necessary to avoid inconsistent state, the server doesn't
handle a NewInputDeviceRequest during PreInit well.

The approach:
During pre-init we create a struct xf86libinput_device with the
libinput_device and a unique ID. The child device has that ID added to the
options and will look for the other device during its pre-init. The two
devices then share the xf86libinput_device struct.

We only have a single epollfd for all devices  and the server calls read_input
on the first device in the list with the epollfd as pInfo->fd. That shared
struct is used as the userdata on the libinput_device we get back from the
event, and each device is in the xorg_list device_list of that shared struct.
We loop through those to find the ones with the right capabilities and
post the event through that device.

Since devices can be enabled and disabled independently, the rest of the code
makes sure that we only ever add the device to libinput when the first shared
device is enabled, and remove it accordingly.

The server uses pInfo->major/minor to detect if another device is using the
same path for a logind-controlled fd. If so, it reuses that device's
pInfo->fd and sets the "fd" option to that value. That pInfo->fd is the
libinput epollfd though, not the actual device fd.

This doesn't matter for us, since we manage the fds largely ourselves and the
pInfo->fd we use is the epollfd anyway. On unplug however, the udev code
triggers a device removal for all devices, including the duplicated ones. When
we disable device, we restore the pInfo->fd from the "fd" option so that the
server can request logind to close the fd.

That only works if the "fd" option is correct, otherwise the server asks
logind to close the epollfd and everyone is unhappy.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=49950

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-23 07:26:46 +10:00
Peter Hutterer
83dfd31ec8 Revert "Split mixed pointer/keyboard devices into two separate X devices"
When using logind, this causes the server to hang when a split device is
unplugged. The reason is mostly in the server, when open the device by
requesting the logind fd, the server loops through the device list to check if
any other device has the same major/minor (see systemd_logind_take_fd()) and
returns the pInfo->fd for that device instead of requesting the fd again from
logind.

For libinput devices, the pInfo->fd is the epollfd, not the actual device, so
our second device gets the epollfd assigned. When the devices are removed, we
keep the device fd open and release the epollfd through logind.

This reverts commit c943739a2b.
2015-11-20 10:51:38 +10:00
Peter Hutterer
c943739a2b Split mixed pointer/keyboard devices into two separate X devices
The server struggles with devices that are both, the protocol (especially XI2)
requires a fairly strict separation of pointer vs keyboard devices. Though the
server has a couple of hacks to route events correctly, mixed
devices still experience bugs like [1].

Instead of advertising the device as a single mixed device, split the device
into two X devices, one with only a pointer/touch component, one with only a
keyboard component. This ensures that the device is effectively attached to
both the VCP and the VCK, something the XI2 protocol doesn't really allow.

This patch drops the keyboard capability on a mixed device, duplicates the
input options and attributes and queues a NewInputDeviceRequest call. The new
device only has the keyboard capability but is otherwise unchanged. The
wacom driver has used this approach for years.

The WorkProc is necessary to avoid inconsistent state, the server doesn't
handle a NewInputDeviceRequest during PreInit well.

The approach:
During pre-init we create a struct xf86libinput_device with the
libinput_device and a unique ID. The child device has that ID added to the
options and will look for the other device during its pre-init. The two
devices then share the xf86libinput_device struct.

We only have a single epollfd for all devices  and the server calls read_input
on the first device in the list with the epollfd as pInfo->fd. That shared
struct is used as the userdata on the libinput_device we get back from the
event, and each device is in the xorg_list device_list of that shared struct.
We loop through those to find the ones with the right capabilities and
post the event through that device.

Since devices can be enabled and disabled independently, the rest of the code
makes sure that we only ever add the device to libinput when the first shared
device is enabled, and remove it accordingly.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=49950

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-20 08:45:40 +10:00
Peter Hutterer
a72e96538a Add a helper function for the driver context initialization
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 07:00:29 +10:00
Peter Hutterer
b1a9bea607 Copy the device capabilities to the X driver struct
And use those copied caps instead of the direct device capability calls.

No functional changes at this point, this is preparation work for selectively
disabling capabilities on a device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 07:00:29 +10:00
Peter Hutterer
a6aad69a97 Split type_name detection out into a helper function
No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 07:00:29 +10:00
Peter Hutterer
6fa5f30129 Unref the libinput context on pre_init failure
A device that fails pre_init has a ref to the libinput context but may not
have a pInfo->private. For those devices we never call libinput_unref() and
the libinput struct never gets freed.

Thus if at least one device didn't pass pre_init, we never cleaned up after
ourselves.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-11-18 07:00:01 +10:00
Peter Hutterer
c53dde1a50 Don't fail DEVICE_CLOSE
We're not doing anything here, so no reason to fail.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-13 14:33:02 +10:00
Peter Hutterer
d7331f6e34 Remove unused server_fds list
Obsolete as of 353c52f2be

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-13 14:32:31 +10:00
Peter Hutterer
fb56f6d7a5 Set the device to NULL after unref
No real effect in the current code, but it adds a bit of safety.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-13 10:02:16 +10:00
Peter Hutterer
c8861d2a2f Plug two memory leaks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-11-12 10:17:39 +10:00
Peter Hutterer
44f4b2ed70 xf86-input-libinput 0.15.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-27 17:08:59 +10:00
Peter Hutterer
0163482e22 Add property support for the accel profiles
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-10-26 10:00:57 +10:00
Peter Hutterer
80c356f58f conf: install the libinput xorg.conf.d snippet
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-18 00:29:20 +10:00
Peter Hutterer
1645a79c34 conf: don't hook onto tablets and joysticks
If we install the config file by default, we shouldn't use libinput for
devices we know we can't handle.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-18 00:29:17 +10:00
Peter Hutterer
b7f8db12a3 conf: rename 99-libinput.conf to 90-libinput.conf
This way it still sorts after the usual subjects, but it's easier to stack
extra config in afterwards.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-18 00:27:43 +10:00
Peter Hutterer
6abd341279 Fix invalid pointer passed to the properties
Takes a void*, not a void**

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-03 17:42:20 +10:00
Peter Hutterer
19b42f242d Move the read-only properties into the same condition
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-09-03 17:33:40 +10:00
7 changed files with 839 additions and 104 deletions

View File

@@ -27,6 +27,8 @@ MAINTAINERCLEANFILES = ChangeLog INSTALL
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = xorg-libinput.pc
dist_xorgconf_DATA = conf/90-libinput.conf
.PHONY: ChangeLog INSTALL
INSTALL:
@@ -37,4 +39,4 @@ ChangeLog:
dist-hook: ChangeLog INSTALL
EXTRA_DIST = conf/99-libinput.conf README.md
EXTRA_DIST = README.md

28
conf/90-libinput.conf Normal file
View File

@@ -0,0 +1,28 @@
# Match on all types of devices but tablet devices and joysticks
Section "InputClass"
Identifier "libinput pointer catchall"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
Section "InputClass"
Identifier "libinput keyboard catchall"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
Section "InputClass"
Identifier "libinput touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
Section "InputClass"
Identifier "libinput touchscreen catchall"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection

View File

@@ -1,6 +0,0 @@
# Use the libinput driver for all event devices
Section "InputClass"
Identifier "libinput"
Driver "libinput"
MatchDevicePath "/dev/input/event*"
EndSection

View File

@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-input-libinput],
[0.14.0],
[0.17.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[xf86-input-libinput])
AC_CONFIG_SRCDIR([Makefile.am])
@@ -45,7 +45,7 @@ XORG_DEFAULT_OPTIONS
# Obtain compiler/linker options from server and required extensions
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto [inputproto >= 2.2])
PKG_CHECK_MODULES(LIBINPUT, [libinput >= 0.21.0])
PKG_CHECK_MODULES(LIBINPUT, [libinput >= 1.1.901])
# Define a configure option for an alternate input module directory
AC_ARG_WITH(xorg-module-dir,
@@ -56,6 +56,13 @@ AC_ARG_WITH(xorg-module-dir,
inputdir=${moduledir}/input
AC_SUBST(inputdir)
AC_ARG_WITH(xorg-conf-dir,
AC_HELP_STRING([--with-xorg-conf-dir=DIR],
[Default xorg.conf.d directory [[default=$prefix/share/X11/xorg.conf.d/]]]),
[xorgconfdir="$withval"],
[xorgconfdir="$prefix/share/X11/xorg.conf.d"])
AC_SUBST(xorgconfdir)
# X Server SDK location is required to install header files
sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`

View File

@@ -30,6 +30,12 @@
/* Tapping default enabled/disabled: BOOL, 1 value, read-only */
#define LIBINPUT_PROP_TAP_DEFAULT "libinput Tapping Enabled Default"
/* Tap drag enabled/disabled: BOOL, 1 value */
#define LIBINPUT_PROP_TAP_DRAG "libinput Tapping Drag Enabled"
/* Tap drag default enabled/disabled: BOOL, 1 value */
#define LIBINPUT_PROP_TAP_DRAG_DEFAULT "libinput Tapping Drag Enabled Default"
/* Tap drag lock enabled/disabled: BOOL, 1 value */
#define LIBINPUT_PROP_TAP_DRAG_LOCK "libinput Tapping Drag Lock Enabled"
@@ -48,6 +54,18 @@
/* Pointer accel speed: FLOAT, 1 value, 32 bit, read-only*/
#define LIBINPUT_PROP_ACCEL_DEFAULT "libinput Accel Speed Default"
/* Pointer accel profile: BOOL, 2 values in oder adaptive, flat,
* only one is enabled at a time at max, read-only */
#define LIBINPUT_PROP_ACCEL_PROFILES_AVAILABLE "libinput Accel Profiles Available"
/* Pointer accel profile: BOOL, 2 values in order adaptive, flat,
only one is enabled at a time at max, read-only */
#define LIBINPUT_PROP_ACCEL_PROFILE_ENABLED_DEFAULT "libinput Accel Profile Enabled Default"
/* Pointer accel profile: BOOL, 2 values in order adaptive, flat,
only one is enabled at a time at max */
#define LIBINPUT_PROP_ACCEL_PROFILE_ENABLED "libinput Accel Profile Enabled"
/* Natural scrolling: BOOL, 1 value */
#define LIBINPUT_PROP_NATURAL_SCROLL "libinput Natural Scrolling Enabled"

View File

@@ -50,6 +50,15 @@ directives, this option is set by the server.
The mapping from device node to hardware is system-dependent. Property:
"Device Node" (read-only).
.TP 7
.BI "Option \*qAccelProfile\*q \*q" string \*q
Sets the pointer acceleration profile to the given profile. Permitted values
are
.BI adaptive,
.BI flat.
Not all devices support this option or all profiles. If a profile is
unsupported, the default profile for this is used. For a description on the
profiles and their behavior, see the libinput documentation.
.TP 7
.BI "Option \*qAccelSpeed\*q \*q" float \*q
Sets the pointer acceleration speed within the range [-1, 1]
.TP 7
@@ -120,6 +129,14 @@ mouse is connected".
.BI "Option \*qTapping\*q \*q" bool \*q
Enables or disables tap-to-click behavior.
.TP 7
.BI "Option \*qTappingDrag\*q \*q" bool \*q
Enables or disables drag during tapping behavior ("tap-and-drag"). When
enabled, a tap followed by a finger held down causes a single button down
only, all motions of that finger thus translate into dragging motion.
Tap-and-drag requires option
.B Tapping
to be enabled.
.TP 7
.BI "Option \*qTappingDragLock\*q \*q" bool \*q
Enables or disables drag lock during tapping behavior. When enabled, a
finger up during tap-and-drag will not immediately release the button. If

File diff suppressed because it is too large Load Diff