X-Git-Url: https://diplodocus.org/git/xorg-xinput/blobdiff_plain/a01e5475d17c584bfa3b2d67570d675aebf4e6fd..7f046c957d4529249bcb69b35f6513411f6efcf5:/src/list.c?ds=sidebyside diff --git a/src/list.c b/src/list.c index 1bdffed..de8aca7 100644 --- a/src/list.c +++ b/src/list.c @@ -23,6 +23,7 @@ #include "xinput.h" #include +#include /* for XI_Device***ChangedNotify */ static void print_info(XDeviceInfo *info, Bool shortformat) @@ -33,6 +34,9 @@ print_info(XDeviceInfo *info, Bool shortformat) XButtonInfoPtr b; XValuatorInfoPtr v; XAxisInfoPtr a; +#if HAVE_XI2 + XAttachInfoPtr att; +#endif printf("\"%s\"\tid=%ld\t[", info->name, info->id); @@ -91,7 +95,12 @@ print_info(XDeviceInfo *info, Bool shortformat) 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"); } @@ -110,25 +119,60 @@ list(Display *display, XDeviceInfo *info; int loop; int shortformat = False; + int daemon = False; shortformat = (argc == 1 && strcmp(argv[0], "--short") == 0); + daemon = (argc == 1 && strcmp(argv[0], "--loop") == 0); - if (argc == 0 || shortformat) { + if (argc == 0 || shortformat || daemon) { int num_devices; - - info = XListInputDevices(display, &num_devices); - - for(loop=0; loopevtype == XI_DeviceHierarchyChangedNotify) + { + printf("Hierarchy change.\n"); + } else if (gev->evtype == XI_DeviceClassesChangedNotify) + { + printf("Device classes changed.\n"); + free(((XDeviceClassesChangedEvent*)&ev)->inputclassinfo); + } + break; + } + } +#endif + } while(daemon); } else { int ret = EXIT_SUCCESS; for(loop=0; loop