]> diplodocus.org Git - xorg-xinput/commitdiff
Fix broken "xinput list <devicename>".
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 18 Jan 2011 03:20:58 +0000 (13:20 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 19 Jan 2011 21:41:58 +0000 (07:41 +1000)
Default behaviour for --list is to list --short if no device is given and
--long if a device is given. Restore this behaviour.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Dirk Wallenstein <halsmit@t-online.de>
Tested-by: Dirk Wallenstein <halsmit@t-online.de>
src/list.c

index ca3c6bfaa3364f94ed3864efcaa864cb183ae1b4..b3bf87382a1065e53d9ba5d97548499e92fa5d60 100644 (file)
@@ -25,6 +25,7 @@
 #include <string.h>
 
 enum print_format {
+    FORMAT_NONE,
     FORMAT_SHORT,
     FORMAT_LONG,
     FORMAT_NAME,
@@ -315,8 +316,8 @@ list(Display        *display,
      char      *name,
      char      *desc)
 {
-    enum print_format format = FORMAT_SHORT;
-    int arg_dev = 0;
+    enum print_format format = FORMAT_NONE;
+    int arg_dev = 1;
 
     if (argc >= 1)
     {
@@ -328,11 +329,14 @@ list(Display      *display,
             format = FORMAT_NAME;
         else if (strcmp(argv[0], "--id-only") == 0)
             format = FORMAT_ID;
-        arg_dev++;
+        else
+            arg_dev--;
     }
 
     if (argc > arg_dev)
     {
+        if (format == FORMAT_NONE)
+            format = FORMAT_LONG;
 #ifdef HAVE_XI2
         if (xinput_version(display) == XI_2_Major)
         {
@@ -359,6 +363,8 @@ list(Display        *display,
             }
         }
     } else {
+        if (format == FORMAT_NONE)
+            format = FORMAT_SHORT;
 #ifdef HAVE_XI2
         if (xinput_version(display) == XI_2_Major)
             return list_xi2(display, format);