update to xinput 1.4.2

This commit is contained in:
matthieu 2009-05-18 20:50:15 +00:00
parent 403de0648e
commit 224dd37703
7 changed files with 146 additions and 31 deletions

View File

@ -1,3 +1,94 @@
commit 5600d953531f377b5be114c9b72aca281f9bbca5
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu May 7 15:21:16 2009 +1000
xinput 1.4.2
commit 0996eebd20b017078b7a61e42b13b3c1c5acd1b8
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu May 7 14:00:46 2009 +1000
XCloseDisplay when we're done.
This isn't really necessary, but we might as well be correct.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 4832dc1f3ee8d11eadc99b5cd4e8158773d11f9b)
commit c6c2736a31c00717c5915e97a22b85d96ce163fe
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri May 1 11:22:53 2009 +1000
Create the float property if it doesn't exist.
If we don't have the float property we won't be able to use float properties
for device configuration since the drivers may not understand it.
We might still want to apply properties for client settings though.
Reported-by: Simon Thum <simon.thum@gmx.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 4b4b2e3f31cf08073887d8583997eb3340a6c2e1)
commit c7df478676b6573a07f74484668f9130706c4a1f
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Apr 30 14:50:08 2009 +1000
If there's multiple null-terminated strings in the property, print all.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Simon Thum <simon.thum@gmx.de>
(cherry picked from commit 42dca922d287ffddcf2185ca96738f1505a04c27)
commit 0616fc2e8c76c70d95173377abf39b2c7edfce19
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri May 1 09:14:46 2009 +1000
The float_atom should actually be an Atom
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit e9af7c5f602b5580df36c77ee1c2ed22ccf72134)
commit 4fa194b42a5a6a15b533be070d21d981751b9b83
Author: Peter Hutterer <peter.hutterer@redhat.com>
Date: Thu Apr 16 09:20:16 2009 -0400
Fix set-float-prop on 64-bit architectures.
Since 32-byte data on 64-bit machines must be passed in as 64-bit longs, let's
typecast around a bit.
Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
(cherry picked from commit a577bada8dddf3241a59cab812f5128131c46b29)
commit 7abb366e80d3a309d4ab8cd459ce184c6806b6d1
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue Apr 14 09:13:15 2009 -0400
fix 64 bit issues with set-int-prop and list-props.
libX11 uses longs for 32 bit values, increasing hilarity on 64 bit machines.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit de6326a75de810752a5b4e4c2f5fe98a2f7241a9)
commit 4dc5f13e13c9434d6fa9ed9f10a8e12a55aedc24
Author: Simon Thum <simon.thum@gmx.de>
Date: Thu Mar 26 13:52:15 2009 +0100
xinput: include device type in device list
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 2f8f2193fdfe783c0854772cc46f1b2e0b2e3ec4)
commit 61b2df1cd0135d90c65219cfa17caedbe60a44a2
Author: Simon Thum <simon.thum@gmx.de>
Date: Thu Mar 26 15:19:47 2009 +0100
xinput: mention set-float-prop in manpage
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 17d537fd65ba9b1c99a0dde7833eb4069cc624a8)
commit 286724a1417ffda447be918e8bcf46cc37ed715b
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Mon Apr 6 09:54:07 2009 +1000
@ -201,7 +292,7 @@ Date: Tue Apr 29 11:20:03 2008 +0930
Use new XQueryInputVersion() request to tell the server we can do XI 2.
commit e3b705dc15d07bbb478ced6b54a5e0553d978113
Merge: ac3498c... 834422a...
Merge: ac3498c 834422a
Author: Peter Hutterer <peter@cs.unisa.edu.au>
Date: Mon Apr 7 17:24:16 2008 +0930

20
app/xinput/configure vendored
View File

@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.62 for xinput 1.4.1.
# Generated by GNU Autoconf 2.62 for xinput 1.4.2.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>.
#
@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='xinput'
PACKAGE_TARNAME='xinput'
PACKAGE_VERSION='1.4.1'
PACKAGE_STRING='xinput 1.4.1'
PACKAGE_VERSION='1.4.2'
PACKAGE_STRING='xinput 1.4.2'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg'
# Factoring default headers for most tests.
@ -1318,7 +1318,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures xinput 1.4.1 to adapt to many kinds of systems.
\`configure' configures xinput 1.4.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1388,7 +1388,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of xinput 1.4.1:";;
short | recursive ) echo "Configuration of xinput 1.4.2:";;
esac
cat <<\_ACEOF
@ -1487,7 +1487,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
xinput configure 1.4.1
xinput configure 1.4.2
generated by GNU Autoconf 2.62
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@ -1501,7 +1501,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by xinput $as_me 1.4.1, which was
It was created by xinput $as_me 1.4.2, which was
generated by GNU Autoconf 2.62. Invocation command line was
$ $0 $@
@ -2150,7 +2150,7 @@ fi
# Define the identity of the package.
PACKAGE='xinput'
VERSION='1.4.1'
VERSION='1.4.2'
cat >>confdefs.h <<_ACEOF
@ -5242,7 +5242,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by xinput $as_me 1.4.1, which was
This file was extended by xinput $as_me 1.4.2, which was
generated by GNU Autoconf 2.62. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -5295,7 +5295,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
xinput config.status 1.4.1
xinput config.status 1.4.2
configured by $0, generated by GNU Autoconf 2.62,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

View File

@ -2,7 +2,7 @@ dnl Copyright 2007 Peter Hutterer <peter@cs.unisa.edu.au>
dnl Process this file with autoconf to create configure.
AC_PREREQ([2.57])
AC_INIT(xinput,[1.4.1], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xinput)
AC_INIT(xinput,[1.4.2], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xinput)
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE

View File

@ -1,5 +1,5 @@
.\" $Id: xinput.man,v 1.2 2009/05/02 15:24:13 matthieu Exp $
.TH xinput 1 "$Date: 2009/05/02 15:24:13 $" "Frederic Lepied"
.\" $Id: xinput.man,v 1.3 2009/05/18 20:50:16 matthieu Exp $
.TH xinput 1 "$Date: 2009/05/18 20:50:16 $" "Frederic Lepied"
.SH NAME
xinput - utility to configure and test XInput devices
@ -65,6 +65,10 @@ Sets an integer property for the device. Appropriate values for \fIformat\fP
are 8, 16, or 32, depending on the property.
.PP
.TP 8
.B xinput set-float-prop \fIdevice_name\fP \fIproperty\fP \fIvalue\fP
Sets a float property for the device.
.PP
.TP 8
.B xinput watch-props \fIdevice_name\fP
Prints to standard out when property changes occur.
.PP

View File

@ -26,7 +26,7 @@
#include <X11/extensions/XIproto.h> /* for XI_Device***ChangedNotify */
static void
print_info(XDeviceInfo *info, Bool shortformat)
print_info(Display* dpy, XDeviceInfo *info, Bool shortformat)
{
int i,j;
XAnyClassPtr any;
@ -65,6 +65,9 @@ print_info(XDeviceInfo *info, Bool shortformat)
if (shortformat)
return;
if(info->type != None)
printf("\tType is %s\n", XGetAtomName(dpy, info->type));
if (info->num_classes > 0) {
any = (XAnyClassPtr) (info->inputclassinfo);
for (i=0; i<info->num_classes; i++) {
@ -140,7 +143,7 @@ list(Display *display,
do {
info = XListInputDevices(display, &num_devices);
for(loop=0; loop<num_devices; loop++) {
print_info(info+loop, shortformat);
print_info(display, info+loop, shortformat);
}
#if HAVE_XI2
@ -175,7 +178,7 @@ list(Display *display,
fprintf(stderr, "unable to find device %s\n", argv[loop]);
ret = EXIT_FAILURE;
} else {
print_info(info, shortformat);
print_info(display, info, shortformat);
}
}
return ret;

View File

@ -42,7 +42,7 @@ print_property(Display *dpy, XDevice* dev, Atom property)
int act_format;
unsigned long nitems, bytes_after;
unsigned char *data, *ptr;
int j, done = False;
int j, done = False, size;
name = XGetAtomName(dpy, property);
printf("\t%s (%ld):\t", name, property);
@ -51,10 +51,17 @@ print_property(Display *dpy, XDevice* dev, Atom property)
AnyPropertyType, &act_type, &act_format,
&nitems, &bytes_after, &data) == Success)
{
int float_atom = XInternAtom(dpy, "FLOAT", False);
Atom float_atom = XInternAtom(dpy, "FLOAT", True);
ptr = data;
switch(act_format)
{
case 8: size = sizeof(char); break;
case 16: size = sizeof(short); break;
case 32: size = sizeof(long); break;
}
for (j = 0; j < nitems; j++)
{
switch(act_type)
@ -63,19 +70,28 @@ print_property(Display *dpy, XDevice* dev, Atom property)
switch(act_format)
{
case 8:
printf("%d", *((int8_t*)ptr));
printf("%d", *((char*)ptr));
break;
case 16:
printf("%d", *((int16_t*)ptr));
printf("%d", *((short*)ptr));
break;
case 32:
printf("%d", *((int32_t*)ptr));
printf("%ld", *((long*)ptr));
break;
}
break;
case XA_STRING:
if (act_format != 8)
{
printf("Unknown string format.\n");
done = True;
break;
}
printf("\"%s\"", ptr);
done = True;
j += strlen((char*)ptr); /* The loop's j++ jumps over the
terminating 0 */
ptr += strlen((char*)ptr); /* ptr += size below jumps over
the terminating 0 */
break;
case XA_ATOM:
printf("\"%s\"", XGetAtomName(dpy, *(Atom*)ptr));
@ -93,7 +109,7 @@ print_property(Display *dpy, XDevice* dev, Atom property)
break;
}
ptr += act_format/8;
ptr += size;
if (j < nitems - 1)
printf(", ");
@ -210,19 +226,19 @@ set_int_prop(Display *dpy, int argc, char** argv, char* n, char *desc)
return EXIT_FAILURE;
}
data = calloc(nelements, format/8);
data = calloc(nelements, sizeof(long));
for (i = 0; i < nelements; i++)
{
switch(format)
{
case 8:
*(((int8_t*)data) + i) = atoi(argv[3 + i]);
*(((char*)data) + i) = atoi(argv[3 + i]);
break;
case 16:
*(((int16_t*)data) + i) = atoi(argv[3 + i]);
*(((short*)data) + i) = atoi(argv[3 + i]);
break;
case 32:
*(((int32_t*)data) + i) = atoi(argv[3 + i]);
*(((long*)data) + i) = atoi(argv[3 + i]);
break;
}
}
@ -244,7 +260,7 @@ set_float_prop(Display *dpy, int argc, char** argv, char* n, char *desc)
char *name;
int i;
Bool is_atom = True;
float *data;
long *data;
int nelements = 0;
char* endptr;
@ -298,10 +314,10 @@ set_float_prop(Display *dpy, int argc, char** argv, char* n, char *desc)
return EXIT_FAILURE;
}
data = calloc(nelements, 4);
data = calloc(nelements, sizeof(long));
for (i = 0; i < nelements; i++)
{
*(data + i) = strtod(argv[2 + i], &endptr);
*((float*)(data + i)) = strtod(argv[2 + i], &endptr);
if(endptr == argv[2 + i]){
fprintf(stderr, "argument %s could not be parsed\n", argv[2 + i]);
return EXIT_FAILURE;

View File

@ -246,6 +246,7 @@ main(int argc, char * argv[])
int r = (*driver->func)(display, argc-2, argv+2,
driver->func_name, driver->arg_desc);
XSync(display, False);
XCloseDisplay(display);
return r;
}
driver++;