X-Git-Url: https://diplodocus.org/git/xorg-xinput/blobdiff_plain/6ebdca422d12e3326f9ab59767e05eefd24ff85f..1c7b473b7e64f8b616aba70926f93d37d5269c28:/src/property.c diff --git a/src/property.c b/src/property.c index 269fecc..0e62035 100644 --- a/src/property.c +++ b/src/property.c @@ -50,7 +50,7 @@ print_property(Display *dpy, XDevice* dev, Atom property) return; name = XGetAtomName(dpy, property); - printf("\t%s:\t", name); + printf("\t%s (%d):\t", name, property); if (XGetDeviceProperty(dpy, dev, property, 0, 1000, False, False, AnyPropertyType, &act_type, &act_format, @@ -215,6 +215,8 @@ set_int_prop(Display *dpy, int argc, char** argv, char* n, char *desc) if (!is_atom) prop = XInternAtom(dpy, name, False); + else + prop = atoi(name); nelements = argc - 3; format = atoi(argv[2]); @@ -257,6 +259,8 @@ int watch_props(Display *dpy, int argc, char** argv, char* n, char *desc) XEvent ev; XDevicePropertyNotifyEvent *dpev; char *name; + int type_prop; + XEventClass cls_prop; if (list_props(dpy, argc, argv, n, desc) != EXIT_SUCCESS) return EXIT_FAILURE; @@ -275,17 +279,17 @@ int watch_props(Display *dpy, int argc, char** argv, char* n, char *desc) return EXIT_FAILURE; } - XiSelectEvent(dpy, DefaultRootWindow(dpy), NULL, - XI_DevicePropertyNotifyMask); + DevicePropertyNotify(dev, type_prop, cls_prop); + XSelectExtensionEvent(dpy, DefaultRootWindow(dpy), &cls_prop, 1); while(1) { XNextEvent(dpy, &ev); dpev = (XDevicePropertyNotifyEvent*)&ev; - if (dpev->type != GenericEvent && - dpev->type != XI_DevicePropertyNotify) + if (dpev->type != type_prop) continue; + name = XGetAtomName(dpy, dpev->atom); printf("Property '%s' changed.\n", name); print_property(dpy, dev, dpev->atom);