This lets the xfree86 layer change to the NotifyFd interface without
affecting the driver.

Signed-off-by: Keith Packard <[email protected]>
---
 configure.ac       |  8 ++++++++
 src/xf86libinput.c | 11 +++++++++++
 2 files changed, 19 insertions(+)

diff --git a/configure.ac b/configure.ac
index 64886f6..fc6f025 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,6 +63,14 @@ AC_ARG_WITH(xorg-conf-dir,
             [xorgconfdir="$prefix/share/X11/xorg.conf.d"])
 AC_SUBST(xorgconfdir)
 
+save_CFLAGS="$CFLAGS"
+CFLAGS="$XORG_CFLAGS"
+AC_CHECK_DECL(AddEnabledDevice,
+             [AC_DEFINE(HAVE_ADD_ENABLED_DEVICE, 1, [Have old AddEnabledDevice 
API])],
+             [],
+             [#include "os.h"])
+CFLAGS="$save_CFLAGS"
+
 # X Server SDK location is required to install header files
 sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
 
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 49f0583..478f7a4 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -522,8 +522,12 @@ xf86libinput_on(DeviceIntPtr dev)
        pInfo->fd = libinput_get_fd(libinput);
 
        if (driver_context.device_enabled_count == 0) {
+#if !HAVE_ADD_ENABLED_DEVICE
+               xf86AddEnabledDevice(pInfo);
+#else
                /* Can't use xf86AddEnabledDevice on an epollfd */
                AddEnabledDevice(pInfo->fd);
+#endif
        }
 
        driver_context.device_enabled_count++;
@@ -542,7 +546,11 @@ xf86libinput_off(DeviceIntPtr dev)
        struct xf86libinput_device *shared_device = driver_data->shared_device;
 
        if (--driver_context.device_enabled_count == 0) {
+#if !HAVE_ADD_ENABLED_DEVICE
+               xf86RemoveEnabledDevice(pInfo);
+#else
                RemoveEnabledDevice(pInfo->fd);
+#endif
        }
 
        if (use_server_fd(pInfo)) {
@@ -2522,6 +2530,9 @@ xf86libinput_pre_init(InputDriverPtr drv,
        pInfo->read_input = xf86libinput_read_input;
        pInfo->control_proc = NULL;
        pInfo->switch_mode = NULL;
+#ifdef XI86_SIGNAL_IO
+       pInfo->flags &= ~XI86_SIGNAL_IO;
+#endif
 
        driver_data = calloc(1, sizeof(*driver_data));
        if (!driver_data)
-- 
2.8.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to