[PATCH xinput 1/2] Centralise supported major/minor version.

Peter Hutterer peter.hutterer at who-t.net
Tue Oct 25 15:13:32 PDT 2011


Only have one location where the currently supported major/minor version is
listed.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/list.c   |    9 +++++++--
 src/xinput.c |    8 ++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/list.c b/src/list.c
index 64848e3..40ee7b9 100644
--- a/src/list.c
+++ b/src/list.c
@@ -24,6 +24,11 @@
 #include "xinput.h"
 #include <string.h>
 
+#if HAVE_XI2
+extern int xi2_supported_major;
+extern int xi2_supported_minor;
+#endif
+
 enum print_format {
     FORMAT_NONE,
     FORMAT_SHORT,
@@ -278,8 +283,8 @@ static int
 list_xi2(Display *display,
          enum print_format format)
 {
-    int major = 2,
-        minor = 0;
+    int major = xi2_supported_major,
+        minor = xi2_supported_minor;
     int ndevices;
     int i, j;
     XIDeviceInfo *info, *dev;
diff --git a/src/xinput.c b/src/xinput.c
index 432cffc..ddb61ab 100644
--- a/src/xinput.c
+++ b/src/xinput.c
@@ -26,6 +26,10 @@
 #include <string.h>
 
 int xi_opcode;
+#if HAVE_XI2
+int xi2_supported_major = 2;
+int xi2_supported_minor = 0;
+#endif
 
 typedef int (*prog)(Display* display, int argc, char *argv[],
 		    char *prog_name, char *prog_desc);
@@ -192,8 +196,8 @@ xinput_version(Display	*display)
     /* Announce our supported version so the server treats us correctly. */
     if (vers >= XI_2_Major)
     {
-        int maj = 2,
-            min = 0;
+        int maj = xi2_supported_major,
+            min = xi2_supported_minor;
         XIQueryVersion(display, &maj, &min);
     }
 #endif
-- 
1.7.7



More information about the xorg-devel mailing list