XIEvent ev;
XNextEvent(display, (XEvent*)&ev);
- if (ev.type == GenericEvent)
+ if (ev.type == GenericEvent && ev.extension == xi_opcode )
{
XIDeviceEvent *event = (XIDeviceEvent*)&ev;
print_deviceevent(event);
{
XIEvent ev;
XNextEvent(display, (XEvent*)&ev);
- if (ev.type == GenericEvent)
+ if (ev.type == GenericEvent && ev.extension == xi_opcode)
{
XIDeviceEvent *event = (XIDeviceEvent*)&ev;
#include <ctype.h>
#include <string.h>
+int xi_opcode;
+
typedef int (*prog)(Display* display, int argc, char *argv[],
char *prog_name, char *prog_desc);
Display *display;
entry *driver = drivers;
char *func;
+ int event, error;
if (argc < 2) {
usage();
return EXIT_FAILURE;
}
+ if (!XQueryExtension(display, "XInputExtension", &xi_opcode, &event, &error)) {
+ printf("X Input extension not available.\n");
+ return EXIT_FAILURE;
+ }
+
func = argv[1];
while((*func) == '-') func++;
#define EXIT_FAILURE 0
#endif
+extern int xi_opcode; /* xinput extension op code */
XDeviceInfo* find_device_info( Display *display, char *name, Bool only_extended);
#if HAVE_XI2
XIDeviceInfo* xi2_find_device_info(Display *display, char *name);