Compare commits

...

19 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
4 changed files with 608 additions and 86 deletions

View File

@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-input-libinput],
[0.15.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 >= 1.0.901])
PKG_CHECK_MODULES(LIBINPUT, [libinput >= 1.1.901])
# Define a configure option for an alternate input module directory
AC_ARG_WITH(xorg-module-dir,

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"

View File

@@ -129,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