[PATCH xinput 4/3] Fix broken "xinput list <devicename>".

Peter Hutterer peter.hutterer at who-t.net
Mon Jan 17 19:23:40 PST 2011


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 at who-t.net>
---

sorry, noticed this a minute after the patch series was out.

 src/list.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/list.c b/src/list.c
index ca3c6bf..b3bf873 100644
--- a/src/list.c
+++ b/src/list.c
@@ -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);
-- 
1.7.3.4


More information about the xorg-devel mailing list