]> diplodocus.org Git - xorg-xinput/blobdiff - src/xinput.c
Add Peter and Red Hat's copyright notices and licenses to COPYING
[xorg-xinput] / src / xinput.c
index 8340211a785e120182fe0a853aaad9dfe9b10ef4..149662d2068c4fb8878e91fa565aa65962afc0a0 100644 (file)
@@ -68,7 +68,7 @@ static entry drivers[] =
      set_mode
     },
     {"list",
      set_mode
     },
     {"list",
-     "[--loop || --short || <device name>...]",
+     "[--short || --long] [<device name>...]",
      list
     },
     {"query-state",
      list
     },
     {"query-state",
@@ -79,10 +79,6 @@ static entry drivers[] =
      "[-proximity] <device name>",
      test
     },
      "[-proximity] <device name>",
      test
     },
-    {"version",
-     "",
-     version
-    },
 #if HAVE_XI2
     { "create-master",
       "<id> [<sendCore (dflt:1)>] [<enable (dflt:1)>]",
 #if HAVE_XI2
     { "create-master",
       "<id> [<sendCore (dflt:1)>] [<enable (dflt:1)>]",
@@ -134,13 +130,44 @@ static entry drivers[] =
       delete_prop
     },
     { "set-prop",
       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
     }
 };
 
       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)
 {
 int
 xinput_version(Display *display)
 {
@@ -266,6 +293,13 @@ main(int argc, char * argv[])
        return EXIT_FAILURE;
     }
 
        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) {
     display = XOpenDisplay(NULL);
 
     if (display == NULL) {
@@ -278,9 +312,6 @@ main(int argc, char * argv[])
         return EXIT_FAILURE;
     }
 
         return EXIT_FAILURE;
     }
 
-    func = argv[1];
-    while((*func) == '-') func++;
-
     if (!xinput_version(display)) {
        fprintf(stderr, "%s extension not available\n", INAME);
        return EXIT_FAILURE;
     if (!xinput_version(display)) {
        fprintf(stderr, "%s extension not available\n", INAME);
        return EXIT_FAILURE;