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

Julien Cristau jcristau at debian.org
Wed Oct 26 01:49:20 PDT 2011


On Wed, Oct 26, 2011 at 08:13:32 +1000, Peter Hutterer wrote:

> 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
> +

Maybe move the declarations to xinput.h?

Cheers,
Julien

>  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


More information about the xorg-devel mailing list