set_mode
},
{"list",
- "[--loop || --short || <device name>...]",
+ "[--short || --long] [<device name>...]",
list
},
{"query-state",
"[-proximity] <device name>",
test
},
- {"version",
- "",
- version
- },
#if HAVE_XI2
{ "create-master",
"<id> [<sendCore (dflt:1)>] [<enable (dflt:1)>]",
delete_prop
},
{ "set-prop",
- "<device> <property> <val> [<val> ...]",
+ "<device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]",
set_prop
},
{NULL, NULL, NULL
}
};
+static const char version_id[] = VERSION;
+
+int
+print_version()
+{
+ XExtensionVersion *version;
+ Display *display;
+
+ printf("xinput version %s\n", version_id);
+
+ display = XOpenDisplay(NULL);
+
+ printf("XI version on server: ");
+
+ if (display == NULL)
+ printf("Failed to open display.\n");
+ else {
+ version = XGetExtensionVersion(display, INAME);
+ if (!version || (version == (XExtensionVersion*) NoSuchExtension))
+ printf(" Extension not supported.\n");
+ else {
+ printf("%d.%d\n", version->major_version,
+ version->minor_version);
+ XFree(version);
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
int
xinput_version(Display *display)
{
return EXIT_FAILURE;
}
+ func = argv[1];
+ while((*func) == '-') func++;
+
+ if (strcmp("version", func) == 0) {
+ return print_version(argv[0]);
+ }
+
display = XOpenDisplay(NULL);
if (display == NULL) {
return EXIT_FAILURE;
}
- func = argv[1];
- while((*func) == '-') func++;
-
if (!xinput_version(display)) {
fprintf(stderr, "%s extension not available\n", INAME);
return EXIT_FAILURE;