[PATCH xinput 1/2] Centralise supported major/minor version.
walter harms
wharms at bfs.de
Wed Oct 26 02:03:35 PDT 2011
Am 26.10.2011 00:13, schrieb Peter Hutterer:
> 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
> +
should move to the propper .h ?
I do not know how the version code handling is done with Xorg.
In most cases it is done like this example from linux/version.h
That would reduce the _major,_minor to a simple _version.
#define LINUX_VERSION_CODE 132630
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
re,
wh
> 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