# Checks for pkg-config packages
PKG_CHECK_MODULES(XINPUT, x11 xext xi [inputproto >= 1.4])
+
+LIBS="$XINPUT_LIBS $LIBS"
+AC_CHECK_LIB(Xi, XSetClientPointer,
+ have_xi2=yes AC_DEFINE(HAVE_XI2, 1, [Enabling XI 2 calls]),
+ have_xi2=no)
+AM_CONDITIONAL(HAVE_XI2, test "x$have_xi2" == xyes)
+
AC_SUBST(XINPUT_CFLAGS)
AC_SUBST(XINPUT_LIBS)
+AC_SUBST(HAVE_XI2)
AC_SUBST(VERSION)
AM_CFLAGS = $(XINPUT_CFLAGS)
xinput_LDADD = $(XINPUT_LIBS)
+
+if HAVE_XI2
+ xinput2_files = hierarchy.c setcp.c
+endif # HAVE_XI2
+
xinput_SOURCES = \
buttonmap.c \
feedback.c \
- hierarchy.c \
list.c \
setint.c \
- setcp.c \
setmode.c \
setptr.c \
state.c \
test.c \
version.c \
xinput.c \
- xinput.h
+ xinput.h \
+ $(xinput2_files)
+
XButtonInfoPtr b;
XValuatorInfoPtr v;
XAxisInfoPtr a;
+#if HAVE_XI2
XAttachInfoPtr att;
+#endif
printf("\"%s\"\tid=%ld\t[", info->name, info->id);
printf ("\t\tResolution is %d\n", a->resolution);
}
break;
+#if HAVE_XI2
case AttachClass:
att = (XAttachInfoPtr)any;
printf("\tAttached to %d\n", att->attached);
break;
-
+#endif
default:
printf ("unknown class\n");
}
int num_devices;
XEvent ev;
+#if HAVE_XI2
if (daemon)
{
XiSelectEvent(display, DefaultRootWindow(display), NULL,
XI_DeviceHierarchyChangedMask |
XI_DeviceClassesChangedMask);
}
+#endif
do {
info = XListInputDevices(display, &num_devices);
print_info(info+loop, shortformat);
}
+#if HAVE_XI2
/* just wait for the next generic event to come along */
while (daemon && !XNextEvent(display, &ev))
{
break;
}
}
+#endif
} while(daemon);
} else {
int ret = EXIT_SUCCESS;
"",
version
},
+#if HAVE_XI2
{ "create-master",
"<id> [sendCore (dflt:1)] [enable (dflt:1)]",
create_master
"<window> <device>",
set_clientpointer
},
+#endif
{0, 0, 0
}
};
XExtensionVersion *version;
Bool present;
+#if HAVE_XI2
version = XQueryInputVersion(display, XI_2_Major, XI_2_Minor);
+#else
+ version = XGetExtensionVersion(display, INAME);
+#endif
if (version && (version != (XExtensionVersion*) NoSuchExtension)) {
present = version->present;
*
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <X11/Xlib.h>
#include <X11/extensions/XInput.h>
#include <X11/Xutil.h>