[PATCH xf86-input-libinput] Switch to xf86AddEnabledDevice if we have the input thread

Peter Hutterer peter.hutterer at who-t.net
Mon May 30 08:12:36 UTC 2016


Pre input-thread xf86AddEnabledDevice was hooked up to the signal handler.
libinput never was capable of running inside a signal handler, so we had to
use AddEnabledDevice() instead which merely hooks to the server's select loop.

Now with the input thread we can use xf86AddEnabledDevice and let the server
decide what is best from there.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Effectively the same but the meat around it is different. More expressive
with HAVE_INPUT_THEAD and the ABI check instead of AC_CHECK_DECL.

 src/xf86libinput.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 7034796..644887b 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -55,6 +55,12 @@
 #undef HAVE_VMASK_UNACCEL
 #endif
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 23
+#define HAVE_INPUT_THEAD 1
+#else
+#undef HAVE_INPUT_THEAD
+#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 +528,12 @@ xf86libinput_on(DeviceIntPtr dev)
 	pInfo->fd = libinput_get_fd(libinput);
 
 	if (driver_context.device_enabled_count == 0) {
+#if HAVE_INPUT_THEAD
+		xf86AddEnabledDevice(pInfo);
+#else
 		/* Can't use xf86AddEnabledDevice on an epollfd */
 		AddEnabledDevice(pInfo->fd);
+#endif
 	}
 
 	driver_context.device_enabled_count++;
@@ -542,7 +552,11 @@ xf86libinput_off(DeviceIntPtr dev)
 	struct xf86libinput_device *shared_device = driver_data->shared_device;
 
 	if (--driver_context.device_enabled_count == 0) {
+#if HAVE_INPUT_THEAD
+		xf86RemoveEnabledDevice(pInfo);
+#else
 		RemoveEnabledDevice(pInfo->fd);
+#endif
 	}
 
 	if (use_server_fd(pInfo)) {
-- 
2.7.4



More information about the xorg-devel mailing list