[PATCH xf86-input-libinput] Use xf86AddEnabledDevice instead of AddEnabledDevice when threaded [v3]
Keith Packard
keithp at keithp.com
Mon May 30 08:13:41 UTC 2016
libinput can't run at SIGIO time, so it has been using
AddEnabledDevice to run in non-signal context.
Threaded input runs all input in non-signal context, so we want to use
xf86AddEnabledDevice at last.
v2: use XINPUT ABI version check instead of testing for presence of
AddEnabledDevice, which can't get removed from the server until
a few more patches past the threaded input change are merged.
v3: remove reference to XI86_SIGNAL_IO, which was presumably
a planned change to the xf86AddEnabledDevice path to make that
not use SIGIO.
Signed-off-by: Keith Packard <keithp at keithp.com>
Tested-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/xf86libinput.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 7034796..5295085 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -55,6 +55,10 @@
#undef HAVE_VMASK_UNACCEL
#endif
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 23
+#define HAVE_THREADED_INPUT 1
+#endif
+
#define TOUCHPAD_NUM_AXES 4 /* x, y, hscroll, vscroll */
#define TABLET_NUM_BUTTONS 7 /* we need scroll buttons */
#define TOUCH_MAX_SLOTS 15
@@ -522,8 +526,12 @@ xf86libinput_on(DeviceIntPtr dev)
pInfo->fd = libinput_get_fd(libinput);
if (driver_context.device_enabled_count == 0) {
+#if HAVE_THREADED_INPUT
+ xf86AddEnabledDevice(pInfo);
+#else
/* Can't use xf86AddEnabledDevice on an epollfd */
AddEnabledDevice(pInfo->fd);
+#endif
}
driver_context.device_enabled_count++;
@@ -542,7 +550,11 @@ xf86libinput_off(DeviceIntPtr dev)
struct xf86libinput_device *shared_device = driver_data->shared_device;
if (--driver_context.device_enabled_count == 0) {
+#if HAVE_THREADED_INPUT
+ xf86RemoveEnabledDevice(pInfo);
+#else
RemoveEnabledDevice(pInfo->fd);
+#endif
}
if (use_server_fd(pInfo)) {
--
2.8.1
More information about the xorg-devel
mailing list