Git init
authorKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 16:09:53 +0000 (01:09 +0900)
committerKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 16:09:53 +0000 (01:09 +0900)
34 files changed:
AUTHORS [new file with mode: 0644]
COPYING [new file with mode: 0755]
ChangeLog [new file with mode: 0755]
INSTALL [new file with mode: 0755]
Makefile.am [new file with mode: 0755]
NEWS [new file with mode: 0644]
README [new file with mode: 0644]
autogen.sh [new file with mode: 0644]
configure.ac [new file with mode: 0755]
debian/changelog [new file with mode: 0755]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0755]
debian/copyright [new file with mode: 0644]
debian/gbp.conf [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/watch [new file with mode: 0644]
man/Makefile.am [new file with mode: 0755]
man/xinput.man [new file with mode: 0755]
packaging/xorg-x11-utils-xinput.spec [new file with mode: 0644]
src/Makefile.am [new file with mode: 0644]
src/buttonmap.c [new file with mode: 0644]
src/feedback.c [new file with mode: 0644]
src/hierarchy.c [new file with mode: 0644]
src/list.c [new file with mode: 0755]
src/property.c [new file with mode: 0755]
src/setcp.c [new file with mode: 0644]
src/setint.c [new file with mode: 0644]
src/setmode.c [new file with mode: 0755]
src/setptr.c [new file with mode: 0644]
src/state.c [new file with mode: 0644]
src/test.c [new file with mode: 0644]
src/test_xi2.c [new file with mode: 0755]
src/xinput.c [new file with mode: 0755]
src/xinput.h [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..73bc34e
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+Maintainer: Philip Langdale <philipl@alumni.utexas.net>
+Creator: Frederic Lepied <Frederic.Lepied@sugix.frmug.org>
diff --git a/COPYING b/COPYING
new file mode 100755 (executable)
index 0000000..ebf5d6b
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,66 @@
+Copyright 1996-1997 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
+                                                                           
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is  hereby granted without fee, provided that
+the  above copyright   notice appear  in   all  copies and  that both  that
+copyright  notice   and   this  permission   notice  appear  in  supporting
+documentation, and that   the  name of  the authors   not  be  used  in
+advertising or publicity pertaining to distribution of the software without
+specific,  written      prior  permission.     The authors  make  no
+representations about the suitability of this software for any purpose.  It
+is provided "as is" without express or implied warranty.                   
+                                                                           
+THE AUTHORS  DISCLAIMS ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
+INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
+EVENT  SHALL THE AUTHORS  BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
+TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
+PERFORMANCE OF THIS SOFTWARE.
+
+
+Copyright 2007 Peter Hutterer
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the author shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the author.
+
+
+Copyright © 2009 Red Hat, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/ChangeLog b/ChangeLog
new file mode 100755 (executable)
index 0000000..7ba8866
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,1454 @@
+commit 13d9a0906acca18a268b8898addc1a192c5a2b12
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Nov 11 13:56:22 2010 +1000
+
+    xinput 1.5.3
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 84798d18421535f47a00f4bc43787432f6725032
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Oct 11 13:46:54 2010 +1000
+
+    Print an error if mode is neither ABSOLUTE nor RELATIVE.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Julien Cristau <jcristau@debian.org>
+
+commit 6a794ab3ceb6d3527c0a87f610bc1d6cf26971ba
+Author: Chase Douglas <chase.douglas@canonical.com>
+Date:   Thu Jul 1 18:36:42 2010 -0400
+
+    xinput: Split XI2 valuators and print index of events
+    
+    XI2 events support bitmask selected valuators. When printing masked
+    events, we need to also print the index of the valuator value. This
+    change prints each valuator on its own line, prefixed by its index
+    
+    Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit a5c9b0ffb969f71ec73a6c65f5135f5aa7805a38
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jun 9 15:52:31 2010 +1000
+
+    list: only check the last bit in the device mode.
+    
+    This works around a bug in X servers 1.7.x, 1.8.0 and 1.8.1 where the device
+    mode could sometimes be binary OR'd with the OutOfProximity flag. The result
+    was a value of 0b10 for relative and 0b11 for Absolute, both of which were
+    interpreted as relative by this code.
+    
+    Affected is only the XIQueryDevice call, not the XListInputDevices call.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 3778f707cca0b9f023a8a5fc86e26776ef6e1b6c
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jun 4 11:11:03 2010 +1000
+
+    xinput 1.5.2
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 87ec8d42c7f8e4e0613bcbe59fb2db991e1e4acb
+Author: Kees Cook <kees.cook@canonical.com>
+Date:   Wed Apr 14 21:19:48 2010 -0700
+
+    Atoms from XIGetProperty are 32bits (#27657)
+    
+    A 32bit value must be dereferenced to correctly zero-extend an Atom
+    from XIGetProperty.  On 64bit systems, Atom is 64bits, so the final
+    Atom in a list will read garbage in the upper half of the Atom.
+    
+    X.Org Bug 27657 <http://bugs.freedesktop.org/show_bug.cgi?id=27657>
+    
+    Signed-off-by: Kees Cook <kees.cook@canonical.com>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 79eada1b0a221c10a3300fa0c988879fd9062d99
+Author: Will Thompson <will.thompson@collabora.co.uk>
+Date:   Tue Apr 6 11:26:39 2010 +0100
+
+    Support pointer: and keyboard: prefices for XI2 device names
+    
+    I have a keyboard which is also a mouse, and shows up as two devices
+    with the same name. This patch allows me to reliably refer to the
+    pointer device.
+    
+    Signed-off-by: Will Thompson <will.thompson@collabora.co.uk>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 26c8ad96bed67087f89439ec595e928e7f5c8a9c
+Author: Will Thompson <will.thompson@collabora.co.uk>
+Date:   Thu Apr 1 15:35:34 2010 +0100
+
+    Warn and fail if a device name is ambiguous.
+    
+    The XI1 path bails out if the user specifies a device by name and there
+    is more than one device, but the XI2 path previously just silently chose
+    the first one. This patch makes it fail outright.
+    
+    Signed-off-by: Will Thompson <will.thompson@collabora.co.uk>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 19751d021524ee7237704b6158947c26aad4e8c5
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Apr 29 16:03:28 2010 +1000
+
+    test-xi2: Print out the sourceid for enter/leave events.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit de293d5bb46de46aaa6799940824c31de95f905b
+Author: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
+Date:   Fri Apr 2 00:30:49 2010 -0500
+
+    man: use automake silent rules
+    
+    Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
+    Reviewed-by:  Rémi Cardona <remi@gentoo.org>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit e980a1fa1237089c0d28210fc32210d63113793f
+Author: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
+Date:   Fri Apr 2 00:30:48 2010 -0500
+
+    man: Use AC_PROG_SED to find sed
+    
+    Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
+    Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
+    Acked-by: Gaetan Nadon <memsize@videotron.ca>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit f1577913026eead06795c629798a41e9e7d939c1
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Mar 15 11:34:55 2010 +1000
+
+    xinput 1.5.1
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 88282e21598b25fca7868bf7d5fbaa76cc603bb4
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Mar 2 14:07:40 2010 +1000
+
+    test-xi2: print event type name as well.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
+
+commit 4966627f5fc74b30a5cc9ca9292a0314aabf1734
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Feb 4 15:05:36 2010 +1000
+
+    man: document XI2 options
+    
+    Document the options to modifiy the device hierarchy and change the
+    ClientPointer.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 8cd99782831c6d6e8407c7e99471780d118d2648
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jan 11 09:23:32 2010 +1000
+
+    man: remove reference to XListInputDevices
+    
+    xinput --list uses XListInputDevices on XI1 servers and XIQueryDevice on XI2
+    servers. Also, who cares about that when reading the man page anyway...
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Acked-by: Julien Cristau <jcristau@debian.org>
+
+commit 45aa64622fd2aea01de15bf192e39e1cbade9918
+Author: Simon Thum <simon.thum@gmx.de>
+Date:   Sun Oct 18 15:10:56 2009 +0200
+
+    Clarify role of set-ptr-feedback
+    
+    Signed-off-by: Simon Thum <simon.thum@gmx.de>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit a80014b71a878c5377c3b853f242ead4a6f8a270
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Sun Nov 29 11:04:57 2009 +0100
+
+    Add Peter and Red Hat's copyright notices and licenses to COPYING
+
+commit 4ebc9712dec4de0a466292fb4e2fa5167004a802
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Nov 26 09:19:54 2009 -0500
+
+    Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES
+    
+    Now that the INSTALL file is generated.
+    Allows running make maintainer-clean.
+
+commit f6c61dfdf92cc783867f2b1dd27dc400a0625f16
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Wed Oct 28 14:09:08 2009 -0400
+
+    INSTALL, NEWS, README or AUTHORS files are missing/incorrect #24206
+    
+    Add missing INSTALL file. Use standard GNU file on building tarball
+    README may have been updated
+    Remove AUTHORS file as it is empty and no content available yet.
+    Remove NEWS file as it is empty and no content available yet.
+
+commit 1a0f0a03655769afc337a715fcc81fe8ad3c2693
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Oct 27 15:07:25 2009 -0400
+
+    Deploy the new XORG_DEFAULT_OPTIONS #24242
+    
+    This macro aggregate a number of existing macros that sets commmon
+    X.Org components configuration options. It shields the configuration file from
+    future changes.
+
+commit 76c7ff22a8180f7c9cac08ccbf76b9d3d55d5f0f
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Oct 26 22:08:39 2009 -0400
+
+    Makefile.am: ChangeLog not required: EXTRA_DIST or *CLEANFILES #24432
+    
+    ChangeLog filename is known to Automake and requires no further
+    coding in the makefile.
+
+commit 3cc49225212abd82f7795c641baba3fa242fa9e8
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Oct 22 12:34:15 2009 -0400
+
+    .gitignore: use common defaults with custom section # 24239
+    
+    Using common defaults will reduce errors and maintenance.
+    Only the very small or inexistent custom section need periodic maintenance
+    when the structure of the component changes. Do not edit defaults.
+
+commit a813e9afba400280e5aea73f5b4a633a2a867df6
+Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
+Date:   Wed Oct 21 12:47:20 2009 -0700
+
+    This is not a GNU project, so declare it foreign.
+    
+    On Wed, 2009-10-21 at 13:36 +1000, Peter Hutterer wrote:
+    > On Tue, Oct 20, 2009 at 08:23:55PM -0700, Jeremy Huddleston wrote:
+    > > I noticed an INSTALL file in xlsclients and libXvMC today, and it
+    > > was quite annoying to work around since 'autoreconf -fvi' replaces
+    > > it and git wants to commit it.  Should these files even be in git?
+    > > Can I nuke them for the betterment of humanity and since they get
+    > > created by autoreconf anyways?
+    >
+    > See https://bugs.freedesktop.org/show_bug.cgi?id=24206
+    
+    As an interim measure, replace AM_INIT_AUTOMAKE([dist-bzip2]) with
+    AM_INIT_AUTOMAKE([foreign dist-bzip2]). This will prevent the generation
+    of the INSTALL file. It is also part of the 24206 solution.
+    
+    Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
+
+commit 09b075863708e43b9c1202dd052f36d5f865f571
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Oct 13 15:25:19 2009 +1000
+
+    xinput 1.5.0
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 5f49354072a3d331fe359eac0ebff09506668952
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Oct 9 15:28:34 2009 +1000
+
+    Clean up --version, don't require a DISPLAY and display the server version too.
+    
+    version.c was removed, seemed a bit excessive for the 20 lines of code.
+    --version is integrated separate from the other commands now, checked before
+    opening the display. xinput now prints its own version in all cases, even if
+    the display is unavailable. If the display is available, it prints the
+    server version too. Example output:
+    
+    $> xinput --version
+    xinput version 1.4.99.3
+    XI version on server: 2.0
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 7ecd7d55d7a7ab9f5cea5f34f28c7c221171c2bf
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Oct 9 15:07:30 2009 +1000
+
+    man: clean up the man page.
+    
+    Several changes to the man page to tidy it up a bit:
+    - RCS tag removed
+    - synopsis shortened, OPTIONS section added instead
+    - "xinput" dropped before the option descriptions, options in manpage
+      prefixed with '--'.
+    - device_name replaced with just device, since it may be a deviceid.
+    - Removed references to XI man page calls that some options use, it really
+      doesn't matter to users what the underlying Xlib call is.
+    - mark set-int-prop and set-float-prop as deprecated in the man page.
+    - add --test_xi2 flag
+    - Added a few more authors.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 7010a6c924ce6937c8e040c837a118663d6dfdb3
+Author: Thomas Jaeger <ThJaeger@gmail.com>
+Date:   Wed Oct 7 13:05:15 2009 -0400
+
+    Rework 'xinput list' code
+    
+    * Drop the questionable --loop option
+    * Add a --long option (opposite of --short)
+    * Make --short the default if no device argument is given
+    * XI2: Make it possible to query a single device
+    
+    Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
+    
+    squashed in a man page update for --short and --long.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 7d930a42e6c294ecaaf42585e37b8dc24be8a805
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Sep 24 10:45:54 2009 +1000
+
+    Bump to 1.4.99.3
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit a2392f62a93fd288abb8000556d1b34eadaf697f
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Mon Sep 21 17:30:55 2009 -0700
+
+    Use __xorgversion__ instead of RCS $Date in man page header/footer
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 2ba793d412608dcad61dbca1c8c76740d4982e2b
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Tue Sep 15 17:37:34 2009 +0200
+
+    Use do_set_prop for set_{atom,float,int}_prop
+    
+    Signed-off-by: Julien Cristau <jcristau@debian.org>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 79800e1e0fa3b45b6ed37453851df24c98da4435
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Tue Sep 15 17:55:35 2009 +0200
+
+    set-prop: add --type={atom,float,int} and --format={8,16,32} options
+    
+    Allows creating new properties or modifying the type and format of
+    existing ones.
+    
+    Signed-off-by: Julien Cristau <jcristau@debian.org>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 1665fa4e24930f7e3f1cfbc8bf50119ab7d6ca04
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Tue Sep 15 17:33:54 2009 +0200
+
+    Add a format and type argument to the set_prop functions
+    
+    This will allow the addition of command-line options to set format and
+    type, and the reuse of this code for the set-{atom,float,int}-prop
+    paths.
+    
+    Signed-off-by: Julien Cristau <jcristau@debian.org>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 650c52db8b30cebca3386ac350154a6b3a0abbe1
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Sep 16 12:29:26 2009 +1000
+
+    Require xorg-macros 1.3 for XORG_DEFAULT_OPTIONS.
+
+commit 22fdd63f4521c89ae43bbfc6741e872b4a74d18f
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Aug 21 15:56:19 2009 +1000
+
+    test_xi2: Print the key repeat flag if it is set.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 6c362c67ec7fb62d2d7bab5ab4e779147f941a33
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Aug 3 15:59:16 2009 +1000
+
+    Bump to 1.4.99.2
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 10a5596e9cd6dbca0826929e03e9495703279822
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jul 21 16:20:03 2009 +1000
+
+    test-xi2: Update to keycode grabs instead of keysym grabs.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 6aa2dbd555ca4d659acbebffabe28bf648eed32d
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Jul 16 16:14:01 2009 +1000
+
+    Print XINotifyPassiveGrab detail in enter events too.
+
+commit b6949c809c69d824fa5fdb2825f045ed716237d8
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jul 14 16:27:36 2009 +1000
+
+    test_xi: Print deviceid for enter events too
+
+commit 59fc7423bf0e8d29747074449e7a3484cafb2f42
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jul 14 16:13:48 2009 +1000
+
+    Use XI2 defines for enter/leave modes and detail.
+    
+    Doesn't matter much since they are the same as the core ones anyway, but
+    nicer for consistency.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 9a20ce005c12cea9cf215125c96a00c7cbe988c7
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jul 13 16:05:25 2009 +1000
+
+    Adjust to new, split-up raw event types.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 7baaba9fbef48b1f45a51c1654e605df074800b8
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jul 13 09:18:35 2009 +1000
+
+    test_xi2: Plug memory leak with XGetAtomName.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit cb93b032989907e5274d9a5d95ae01535001ec19
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jul 13 09:15:49 2009 +1000
+
+    test_xi2: Update to use cookie events - require libXi 1.2.99.2
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit d7f6f7eda435b550d782b545cd7828b21c19b7b4
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jun 30 16:18:20 2009 +1000
+
+    Plug memory leak from XGetAtomName.
+
+commit 248faefc957a9b0877384842540b2d935e1b5c07
+Author: Benjamin Close <Benjamin.Close@clearchain.com>
+Date:   Wed Jun 24 11:55:00 2009 +0930
+
+    Obtain the XInput opcode and check that GenericEvents are actually XI events
+    
+    Signed-off-by: Benjamin Close <Benjamin.Close@clearchain.com>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 1c28ba44958389892470688ce394c034dc8efa21
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jun 24 10:30:45 2009 +1000
+
+    test_xi2: don't map the window before selecting for events.
+    
+    Mapping the window before selecting for XI2 events leaves some events out
+    (e.g. enter events if the pointer is already in the area where the window is
+    being mapped).
+    
+    Reported-by: Thomas Jaeger
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit f00f6b1c58b3ded52d8cb0002e0bacd558bc874c
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jun 24 10:29:12 2009 +1000
+
+    test_xi2: use %#x alternative printf format.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 97fbbe671827194fa175d6bd15f6189e921393c5
+Author: Thomas Jaeger <ThJaeger@gmail.com>
+Date:   Tue Jun 23 12:49:56 2009 -0400
+
+    remove-master: document possible return modes in --help
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit f1e11109acae93f2d9cbee2333dcf7b65cf6151b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jun 23 13:26:56 2009 +1000
+
+    Fix --help output for create-master and remove-master.
+    
+    Missing <> added. All parameters in the --help output have surrounding <> if
+    the parameter is something the user has to substitute.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 863423141a3347a013004c809e9d8ce29e11d377
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sat Jun 20 17:59:59 2009 +1000
+
+    Bump to 1.4.99.1
+    
+    We've had a 1.4 branch for a while now, this bump is way overdue.
+
+commit e8ca8fa459eb2eb4d9e9faf294d7172fb4fdb17b
+Author: Thomas Jaeger <ThJaeger@gmail.com>
+Date:   Sun Jun 14 13:58:39 2009 -0400
+
+    reattach: Default to return to VCP/VCK when returnMode is AttachToMaster
+    
+    Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit f8b3dc4e1c43140514d20fbc9fddd0f352cbe40b
+Author: Thomas Jaeger <ThJaeger@gmail.com>
+Date:   Mon Jun 15 21:45:32 2009 -0400
+
+    test-xi2: Report correct event coordinates
+    
+    Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit cddc199d10952ec2a851e4b120061701e664be1b
+Author: Thomas Jaeger <ThJaeger@gmail.com>
+Date:   Mon Jun 15 21:37:56 2009 -0400
+
+    test-xi2: Use standard macros instead of BitIsOn/SetBit
+    
+    Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 82d338548e22ae271f50592e759794dd7536a207
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jun 17 21:23:17 2009 +1000
+
+    Require inputproto 1.9.99.12
+
+commit efab9cff2a3605c803786ff9a69ff1aeb155479d
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jun 17 21:23:06 2009 +1000
+
+    Print the valuator value for absolute axes.
+
+commit a4efa37a0646497ed46f4462d8c745ab17339f62
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jun 17 21:22:23 2009 +1000
+
+    Print button and valuator labels when listing a device.
+
+commit 632ef53adf1e18509dfa2a1ae820910aa0a88545
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jun 15 14:10:30 2009 +1000
+
+    Print button state when listing XI2 devices.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit e119d872c74f0190d40d5c4cd742c196aab6bf48
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jun 12 16:31:02 2009 +1000
+
+    Print the sourceid when listing device classes.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit a97520d6e5245ad15d7b7edbf355a343db53e144
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jun 12 16:29:37 2009 +1000
+
+    Use the XI2 class defines for listing device classes in XI2 mode.
+    
+    Purely cosmetic change, the values are the same anyway.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 47983fbd12366ee8ce89b293955b43f7e49b1785
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jun 12 15:47:02 2009 +1000
+
+    Fix build errors introduced by inputproto 1.9.99.11.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 8659d4f88c805e764d671ae50dc110f742727dd7
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jun 3 12:57:10 2009 +1000
+
+    xi2 test: add two missing breaks.
+    
+    Printing a hierarchy event would always print only "master keyboard" or
+    "slave keyboard", never pointers.
+
+commit 8917716f37e4acbd848ea0c6abd1c943bde2f24d
+Author: Thomas Jaeger <ThJaeger@gmail.com>
+Date:   Fri May 29 19:23:04 2009 -0400
+
+    test-xi2: fix modifiers for XIGrabButton call
+    
+    Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 6c701334d13aabc832b41a3a060dedb8978943d3
+Author: Benjamin Close <Benjamin.Close@clearchain.com>
+Date:   Thu May 28 18:44:47 2009 +1000
+
+    Remove superfluous dev assignment.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 969aad3967e58acfcb3da3583858cae09694652a
+Merge: 9aa8f48 5ad5edc
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed May 27 07:34:32 2009 +1000
+
+    Merge branch 'master' into xi2
+
+commit 5ad5edc65e55fe4be63ba31acec4bc1fca96e81b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed May 27 07:33:31 2009 +1000
+
+    Print empty properties as <no items>.
+
+commit 9aa8f4826ed7120ae0ff759c6df40a0d3f37c720
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed May 27 07:33:52 2009 +1000
+
+    Print empty XI2 properties as <no items>
+
+commit 13e9758b2ebd5d545c08903aab0eccd423851a30
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed May 27 07:33:31 2009 +1000
+
+    Print empty properties as <no items>.
+
+commit 5fcd16638abf156a47d4d1c2e3caf0206b97b953
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed May 20 12:11:07 2009 +1000
+
+    Print None properties in XI2 mode too.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 7458e7dde70f5d9ff281848fb1a56e9a5f1dd783
+Merge: 14f47c2 aae3bfe
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed May 20 12:10:44 2009 +1000
+
+    Merge branch 'master' into xi2
+
+commit aae3bfee098567a80444b970aea4c737c736254c
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed May 20 12:02:31 2009 +1000
+
+    Deal with None atoms.
+    
+    An atom may in some cases be 0 (None). Deal with this instead of failing with
+    BadAtom values.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 14f47c23f56c06058673748755b3e31a6d18edf1
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue May 19 15:28:16 2009 +1000
+
+    Print floating slaves in XI2 list mode.
+    
+    Floating slaves are always printed last.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 1c72fd55d61371de81f44be5d92982a3012ad24b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed May 13 14:20:58 2009 +1000
+
+    Update to new inputproto and libXi naming conventions.
+    
+    Require inputproto 1.9.99.9.
+
+commit 9c6a51e8aaba50b8f3a0f3ad767c34a80aee55a1
+Merge: 239cd6a 4832dc1
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri May 8 15:15:45 2009 +1000
+
+    Merge branch 'master' into xi2
+    
+    Conflicts:
+       src/xinput.h
+
+commit 239cd6a673be2821915301c1b3c3bae063e9dd94
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri May 8 14:21:17 2009 +1000
+
+    Update to new inputproto defines.
+
+commit 5d973706f4f706b7576bb6feac4beb7273438b78
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Apr 30 16:53:05 2009 +1000
+
+    update test_xi2 with a few more tests.
+
+commit 4832dc1f3ee8d11eadc99b5cd4e8158773d11f9b
+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>
+
+commit d15a6c0c4cbf2b7d3feec0c829145e3036d84e4d
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu May 7 12:56:58 2009 +1000
+
+    Clean up xinput.h a bit
+    
+    Remove the unnecessary NeedFunctionPrototypes ifdef.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 125074488dc27f484a30a8d076133c73f4d9ef48
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu May 7 14:37:58 2009 +1000
+
+    Add support for XI2 property requests.
+    
+    If XI2 is available, we use XI2 for list-props, delete-prop and set-prop.
+
+commit ff1b12265de1010aa22011c5db829274a8a3dab1
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu May 7 14:13:45 2009 +1000
+
+    Get the XIDeviceInfo instead of just the id.
+    
+    This way we leak the XIDeviceInfo array, but then again it doesn't matter
+    since we exit after the command anyway.
+    And with the XIDeviceInfo around, we can actually print the name and
+    whatnot.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit ba2396b40a427c30c58f8c17b64f4cf7bfaa2909
+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>
+
+commit ea87f587e4090d2881ce8957476411b6de1c260b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu May 7 13:59:12 2009 +1000
+
+    Remove one more unnecessary ifdef.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit a783c19f94e6fed28aeaf0550558cd0b63402b9c
+Merge: 65e3e12 4e6e0dd
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu May 7 13:06:05 2009 +1000
+
+    Merge branch 'master' into xi2
+    
+    Conflicts:
+       src/property.c
+       src/xinput.c
+       src/xinput.h
+
+commit 4e6e0dd562e8e844bede349bd11c339644447d78
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu May 7 12:56:58 2009 +1000
+
+    Clean up xinput.h a bit
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 4b4b2e3f31cf08073887d8583997eb3340a6c2e1
+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>
+
+commit 42dca922d287ffddcf2185ca96738f1505a04c27
+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>
+
+commit e9af7c5f602b5580df36c77ee1c2ed22ccf72134
+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>
+
+commit 65e3e12fa6fc2043fbb0122c72a4f7df09b1c659
+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>
+
+commit e7cd0436689b54d14e05a601e426cd600994db89
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Mon Apr 20 13:58:03 2009 +0200
+
+    xinput: add set-prop command
+    
+    There's no reason to require the user to know the difference between
+    set-int-prop, set-float-prop and set-atom-prop, and to know the required
+    format for each integer property, since we can just ask
+    XGetDeviceProperty.
+    
+    Signed-off-by: Julien Cristau <jcristau@debian.org>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 167034ba2798fbe34abf4748068ae480e45bfe13
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Thu Apr 16 18:55:46 2009 +0200
+
+    Factorize atom parsing in its own function
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 2722d1a177c9482989e314e0177c782563a0b54e
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Apr 20 08:28:53 2009 +1000
+
+    XSync the display before jumping in the grab code.
+    
+    The grab code only handles button presses, so we need to remove all events
+    before (exposures, enter/leave, etc.).
+
+commit 0df21cff5cdf2cf4af0af353f0dbfc7c33388b32
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Apr 19 21:28:25 2009 +1000
+
+    Add a hunk to test XI2 sync'd grabs.
+
+commit dd27752cbff03ea79ac76801d3748edc348570dc
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Apr 19 21:27:40 2009 +1000
+
+    Register for exposure events and block until we're mapped.
+
+commit a7de225eea0c7561e73d44c63844a8e98dea9676
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Apr 19 21:09:49 2009 +1000
+
+    Print event/root x/y on device events.
+
+commit 795799eff591be1fa8ce5199aa89a86dcb4b04e8
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Apr 19 20:33:40 2009 +1000
+
+    Actually print event_y when trying to print event_y in Enter/Leave events.
+
+commit 57d367b74d1068d38ce313a06a36654fd82ad460
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sat Apr 18 08:43:43 2009 +1000
+
+    replace BYTE with an unsigned char.
+
+commit a577bada8dddf3241a59cab812f5128131c46b29
+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>
+
+commit de6326a75de810752a5b4e4c2f5fe98a2f7241a9
+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>
+
+commit 1e3da5be51efebdd75df540a1c94baa6505cfc9a
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Apr 14 13:54:40 2009 +1000
+
+    Fix 64 bit issues with set-int-prop.
+    
+    libX11 expects longs for 32 bit numbers.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 2f8f2193fdfe783c0854772cc46f1b2e0b2e3ec4
+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>
+
+commit 17d537fd65ba9b1c99a0dde7833eb4069cc624a8
+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>
+
+commit 286724a1417ffda447be918e8bcf46cc37ed715b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Apr 6 09:54:07 2009 +1000
+
+    xinput 1.4.1
+
+commit 4134bd0f23acf3ff30311007ceba9ecbe568a70a
+Author: Benjamin Close <Benjamin.Close@clearchain.com>
+Date:   Thu Feb 19 14:39:29 2009 +1030
+
+    Error out when selecting a device by name but more than one instance of the name exists
+    
+    Previously the check was in place for the duplicate name, however the first
+    device with the requested name  was still selected regardless.
+    Correct this by exiting out forcing the user to select by id instead
+    
+    Signed-off-by: Benjamin Close <Benjamin.Close@clearchain.com>
+
+commit b04e8b472022c185123638a3d4639fbbcf0f144f
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Mar 11 09:52:08 2009 +1000
+
+    Print enter/leave and focus events.
+
+commit 70aac046bb4fb0028fcf018ae72bf29acfe6abac
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Mar 10 15:41:15 2009 +1000
+
+    Register for raw events
+
+commit 54136f2c2a37e92a5b5e49035d27ce6728e12e3a
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Mar 10 13:23:53 2009 +1000
+
+    Change event registration a bit, using SetBit instead.
+
+commit 959faacf2e125312b3ff0cc71f4e0b4ee059757f
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Mar 8 17:41:23 2009 +1000
+
+    Print out hierarchy events
+
+commit ab0632284539460dd66c76e023894540fe77fcd2
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Mar 8 12:25:15 2009 +1000
+
+    Print DeviceChanged events.
+
+commit 57940c7995a3779792213468cafe7d982d009035
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Mar 3 15:44:45 2009 +1000
+
+    Add test_xi2 for xi2 testing.
+
+commit 3cad22debfaceca754fc166ca766d92b7a8faf70
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Mar 4 21:57:54 2009 +1000
+
+    If XI2 is available, list devices through XIQueryDevice.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 5aa923fc560718b9a093ad18966f4530eef0efd7
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Feb 26 16:14:21 2009 +1000
+
+    Update to new XI2 requests and sanitize the check for XI2 in configure.
+    
+    Check for the actual library version, not for some random function inside the
+    library.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit a12acdea9e289c9495bc14dd886e9a68cf9a533f
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Mar 4 21:25:50 2009 +1000
+
+    Change is_xinput_present() to xinput_version().
+    
+    Returns major version of XI.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit a197551573663cab9e79e07e2de9d423c7a7a572
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Mar 6 22:13:17 2009 +1000
+
+    add xi2_find_device_id
+
+commit 4ad33929e0f640dbc91004857ed2168006d21a71
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Feb 26 16:09:17 2009 +1000
+
+    Rip HAVE_XI2 conditional functionality out.
+    
+    XI2 needs to be harder separated now.
+
+commit 10f5f9da1d4d7f6eb75d10316f318a7c9d7dc28b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Feb 26 15:53:24 2009 +1000
+
+    Clean up xinput.h a bit.
+    
+    All functions have to look the same anyway, so might as well use a one-line
+    macro to declare them.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 199c323332dac782b45dcb092da0322149843d5a
+Author: Benjamin Close <Benjamin.Close@clearchain.com>
+Date:   Thu Mar 12 21:17:53 2009 +1000
+
+    Error out when  more than one instance of a name exists
+    
+    Previously the check was in place for the duplicate name, however the first
+    device with the requested name  was still selected regardless.
+    Correct this by exiting out forcing the user to select by id instead.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 49ef8a40f96c0383a8a42a78fda3a990ac934e59
+Author: Simon Thum <simon.thum@gmx.de>
+Date:   Wed Jan 21 14:09:29 2009 +0100
+
+    small fixes to the propery output
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit d923fd3366de8e26a328f3aa89bd531dd4a6304d
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Wed Jan 21 19:35:52 2009 -0200
+
+    Correct make distcheck and sparse warnings.
+
+commit 6f444b5d063452e7a8705c756269960e509241d8
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jan 16 12:48:05 2009 +1000
+
+    xinput 1.4.0
+
+commit aabe69b44c14c443df1dfb25d23e1c180a6a029d
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jan 16 09:53:01 2009 +1000
+
+    Add set-atom-prop to set properties containing other properties.
+
+commit 9870cb4120961f15d3e372a1ba49b5d32013e819
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jan 16 09:51:57 2009 +1000
+
+    Don't linebreak after listing a string or atom property.
+
+commit 4f474d5e78789cb0248e69852ab9abc992acad23
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jan 16 09:50:05 2009 +1000
+
+    Fix wrong type conversion in listing Atom properties.
+
+commit 1b6fbf9ead978322beccc1970b925dce0cd43815
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jan 16 09:06:54 2009 +1000
+
+    Require libXi 1.2 and inputproto 1.5.
+    
+    Device properties are available in a released libXi version now, so there's no
+    need to keep them conditional, make 1.5 mandatory.
+    
+    We also have the explicit check for XI2 functions in libXi, so there's no need
+    to have requirements for inputproto 1.9.99.5.
+
+commit 99c932c1a0db7821df3ef78efcfe4824697c4815
+Author: Simon Thum <simon.thum@gmx.de>
+Date:   Mon Jan 12 14:24:26 2009 +1000
+
+    Add set-float-prop option to set properties using floating point numbers.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
+
+commit ffff875c2c587e3ad64d57afc1c432de77497c10
+Author: Sascha Hlusiak <saschahlusiak@arcor.de>
+Date:   Tue Sep 30 17:54:08 2008 +0200
+
+    Call XSync instead XFlush to be able to handle errors
+    
+    When setting properties, the program terminated successfully before any BadMatch or
+    BadValue could be processed. Calling XSync informs the user about errors.
+
+commit 50e5235ecd7142892567c7d3ea6460907538b421
+Author: Sascha Hlusiak <saschahlusiak@arcor.de>
+Date:   Tue Sep 30 15:27:56 2008 +0200
+
+    Add --get-button-map option.
+
+commit 7f046c957d4529249bcb69b35f6513411f6efcf5
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Fri Sep 26 13:57:41 2008 +0930
+
+    Require inputproto 1.9.99.5
+
+commit ccef360e5ee6598a0ab722389bdf8d391ff7efee
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Fri Sep 26 13:55:33 2008 +0930
+
+    Add --delete-prop option.
+
+commit db4b03629f690d69320f401b9568d5a861b19f9c
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Fri Sep 26 13:51:36 2008 +0930
+
+    Use updated property events.
+    
+    No more QueryDeviceProperty request.
+
+commit 6b85506eaf5bef0a7d823450d34e08e51a8010bb
+Author: Bryce Harrington <bryce@canonical.com>
+Date:   Sat Aug 30 15:01:59 2008 +0930
+
+    Add --list-props, --watch-props and --set-int-prop options to man page.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
+
+commit 1c7b473b7e64f8b616aba70926f93d37d5269c28
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Fri Aug 15 15:38:13 2008 +0930
+
+    Require inputproto 1.9.99.4
+
+commit ca0b0fa7f84642cf2b1ba7d5d88487afbc8a6d29
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Fri Aug 15 15:28:55 2008 +0930
+
+    Use XI 1.5 property events.
+
+commit 316cc15f4217db0e4e47846e200d274dd5893b3a
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Thu Aug 7 17:52:08 2008 +0930
+
+    Don't require extension devices for button mapping.
+    
+    VCK and VCP can be opened too now.
+
+commit b0c15823f1faadb24d5b7457f5b5fd1c9f248a1f
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Thu Aug 7 17:51:34 2008 +0930
+
+    Print property values in addition to their names.
+
+commit 5d833a190319b64d81293514027cebaaa3f74ffd
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Thu Aug 7 17:49:48 2008 +0930
+
+    Property code: If the Atom specified was an Atom, actually use it too.
+    
+    Don't ignore an atom if it has been specified with it's number instead of the
+    name.
+
+commit 6ebdca422d12e3326f9ab59767e05eefd24ff85f
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jul 8 18:00:21 2008 +0930
+
+    Add list-props, set-int-prop and watch-props parameters.
+    
+    These parameters allow modification and display of input device properties.
+
+commit 98b79fc5b050eea6141ad78cff4e0577f8e75c77
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jul 8 18:01:48 2008 +0930
+
+    Remove ChangeLog, is autogenerated now anyway.
+
+commit 86cab0389d9a02901c82e2072e4043a404fb2ebc
+Author: Benjamin Close <Benjamin.Close@clearchain.com>
+Date:   Wed Jun 25 15:13:54 2008 +0930
+
+    Clean up the detection of XI2
+    
+    Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
+
+commit 6482e8ef8039eba98de03f0bb708d1151bc1577e
+Author: Benjamin Close <Benjamin.Close@clearchain.com>
+Date:   Thu Jun 5 14:30:09 2008 +0930
+
+    Correct the check for XI2, not every shell supports ==, but they do =
+    
+    Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
+
+commit 8578813fda6787866b6a23b265696a673b213724
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Tue May 27 11:33:36 2008 +0930
+
+    Test for XI2 functions in libXi, add #ifdefs to build in non-XI2 setups.
+
+commit 380b9665e86f403b56f9b96c2773b91d69588fb1
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Tue May 27 10:16:08 2008 +0930
+
+    Use find_device_info instead of requireing device ids on the cmdline.
+
+commit 6ecbe3059cbc3561657841b9ee9b61e03c583eb8
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+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
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Mon Apr 7 17:24:16 2008 +0930
+
+    Merge branch 'master' into mpx
+    
+    Conflicts:
+    
+       src/xinput.c
+    
+    (just a whitespace conflict)
+
+commit 834422a9c68ecf84f5b8477567a785bc8e26217a
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Sun Mar 16 19:37:17 2008 -0300
+
+    Compile warning fix.
+    
+      Ansify a function without arguments.
+    
+    Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
+
+commit 8c7460ee11d9fbdcbdf13f2fa7fb62f26bac92dc
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Sun Mar 16 19:36:17 2008 -0300
+
+    Mandriva patches to xinput.
+    
+      Change to src/list.c fixes a typo/oversight.
+      Change to configure.ac required to avoid possible error in configure step
+    due to "unquoted" version test.
+    
+    Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
+
+commit ac3498c9b8a54143a9d023fe530c62e24c4651e0
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Mon Feb 18 17:17:39 2008 +1030
+
+    Modify to work with the changes in the XChangeDeviceHierarchy API.
+
+commit 6729d777c48f38290c8f0e8d0e5f17182faa5120
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Wed Feb 13 16:35:18 2008 +1030
+
+    Update XiSelectEvent API usage, has device argument now.
+
+commit 865c7bd8013f9882163234cce6cdd4168525815c
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Tue Jan 15 20:32:47 2008 +1030
+
+    Remove deprecated imakefile.
+
+commit a01e5475d17c584bfa3b2d67570d675aebf4e6fd
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Tue Jan 15 20:32:28 2008 +1030
+
+    Replace Fred's name in the main license text with a general "The authors".
+    
+    Makes it less messy to add authors.
+    
+    Frederic Lepied's permission obtained via email.
+
+commit b06af76677cd70912c9c4f381b0baed28b4f89a4
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Thu Jan 10 20:19:55 2008 +0100
+
+    Change xinput_CFLAGS to AM_CFLAGS to clear automake-1.10 warning
+    
+    src/Makefile.am:27: compiling `buttonmap.c' with per-target flags requires `AM_PROG_CC_C_O' in `configure.ac'
+    
+    Also remove -lm from xinput_LDADD, as it isn't needed.
+
+commit 456a1eab4b0b2f4a9bdc8ca02657869595c4bc60
+Author: Philip Langdale <philipl@fido2.homeip.net>
+Date:   Wed Jan 9 18:25:27 2008 -0800
+
+    Add ChangeLog rule.
+
+commit caee9103c1569b7eba189e7a7c977971efec4458
+Author: Philip Langdale <philipl@fido2.homeip.net>
+Date:   Wed Jan 9 18:24:28 2008 -0800
+
+    Update .gitignore
+
+commit 49d37729f1d7212aad8afbd91b49a37c4e93a796
+Author: Philip Langdale <philipl@fido2.homeip.net>
+Date:   Wed Jan 9 18:22:27 2008 -0800
+
+    Update news for 1.3.0 release.
+
+commit ff7a63770ab9ce7336c7a9a70b0ae86de4b35bf3
+Author: Philip Langdale <philipl@fido2.homeip.net>
+Date:   Wed Jan 9 18:17:43 2008 -0800
+
+    Add a warning when the user specifies an ambiguous device name
+    suggesting that they use the device id instead.
+
+commit 06447732750a022a44476f8929568f0b11bfc6e9
+Author: Philip Langdale <philipl@fido2.homeip.net>
+Date:   Wed Jan 9 18:16:54 2008 -0800
+
+    Update man page.
+
+commit fcace3ec3be0276e163651c30681edec6ffdea17
+Author: Philip Langdale <philipl@fido2.homeip.net>
+Date:   Wed Jan 9 18:14:12 2008 -0800
+
+    Update documentation
+
+commit 115cbd4025a9eb9531633c3e8481cb1923789f57
+Author: Philip Langdale <philipl@fido2.homeip.net>
+Date:   Wed Jan 9 18:08:37 2008 -0800
+
+    Make dependency on inputproto >= 1.4 explicit.
+
+commit 2497824aa16683eaeaab4bf374ddc9e04688320a
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Mon Jan 7 18:56:54 2008 +1030
+
+    Don't overwrite daemon with argc.
+    
+    This must be a leftover from my excessive out-of-order cherry-picking. Turns
+    out when --short was supplied we'd set daemon to argc, causing a loop waiting
+    for an event that'd never come. A bit like Godot actually.
+
+commit a6feac1e18cdeffc42bc992faa8c95eaec420378
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Dec 20 12:29:27 2007 +1030
+
+    Add support to set the client pointer.
+    
+    Couple of whitespace changes too.
+
+commit d02601e5c88d1d40e12cd71c2c10c7822919f7b8
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Dec 20 12:27:32 2007 +1030
+
+    Register for DeviceClassesChangedEvents, reprint the list when we get one.
+    
+    Only in list --loop mode though.
+
+commit 60dafc9de224e2f1e53826858e5335916dc6d8c8
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Dec 20 12:21:34 2007 +1030
+
+    Add --loop to "xinput list". Re-prints devices when hierarchy changes.
+
+commit d1428764180c927cfa45298f5b7d0bf14eacc2da
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Nov 8 14:53:18 2007 +1030
+
+    Add support for device hierarchy changes.
+
+commit 1b4b4191e09ad01bd818d4307836b37ffd8fa5bd
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Sun Nov 18 12:36:32 2007 +1030
+
+    Print out attachment of slave devices.
+
+commit 82dfa529165657edc4e66e072d1515638e1edc66
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Dec 20 12:06:33 2007 +1030
+
+    Remove leftover trailing whitespaces.
+
+commit 9b24e279439a800e72819ca63441a083a89643b6
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Dec 20 11:52:41 2007 +1030
+
+    Add --short argument to list. Only prints name and ID.
+
+commit 2a67ff9098efa0e1d53388816a0344067a3c21be
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Dec 20 11:45:11 2007 +1030
+
+    Support GNU style options the dodgy way.
+    
+    Simply removing all preceding "-" from the function name before running the
+    usual comparison.
+
+commit 6a8c883794a3fc66d95e94c5a1e2902a46f9ede8
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Tue Nov 27 09:41:56 2007 +1030
+
+    Remove a few trailing whitespaces.
+
+commit 14f32f4cb911a0086ccec94a64eb61533dc332bf
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Mon Dec 3 12:40:03 2007 +1030
+
+    Remove trailing whitespaces (buttonmap.c)
+
+commit 58c513b0b9f610db2df8b26c483db6eb1b04dfdf
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Nov 15 16:21:32 2007 +1030
+
+    Let autoconf substitute the VERSION.
+
+commit c0178d2afef586f58f42508a9b8bd78e4e6e0cb8
+Author: Philip Langdale <plangdale@vmware.com>
+Date:   Thu Nov 8 14:55:41 2007 +1030
+
+    Expand check to support XExtensionKeyboard/Pointer.
+    
+    Search for PtrFeedbackClass instead of assuming it's the first class in the
+    list.
+
+commit 451740ba094c37ac9e06c7ba7f466b5ab1beea08
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Nov 8 14:23:40 2007 +1030
+
+    Death to RCS tags, remove compiler warning, get version from config.h.
+
+commit 8806f3db5417f1c5946b6589cf2f043e9e7c68d3
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Nov 8 14:16:34 2007 +1030
+
+    Autotool the lot.
+
+commit 1e0b1816a95910631a6b1c8572b9689c32aeb3a0
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Nov 8 10:21:21 2007 +1030
+
+    xinput as straight from the tarball.
diff --git a/INSTALL b/INSTALL
new file mode 100755 (executable)
index 0000000..8b82ade
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,291 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007, 2008 Free Software Foundation, Inc.
+
+   This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+   Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.
+
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+  6. Often, you can also type `make uninstall' to remove the installed
+     files again.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+   By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
+a workaround.  If GNU CC is not installed, it is therefore recommended
+to try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+     Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+     Print a summary of the options unique to this package's
+     `configure', and exit.  The `short' variant lists options used
+     only in the top level, while the `recursive' variant lists options
+     also present in any nested packages.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--prefix=DIR'
+     Use DIR as the installation prefix.  *Note Installation Names::
+     for more details, including other options available for fine-tuning
+     the installation locations.
+
+`--no-create'
+`-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+
diff --git a/Makefile.am b/Makefile.am
new file mode 100755 (executable)
index 0000000..b18eaf1
--- /dev/null
@@ -0,0 +1,34 @@
+#  Copyright 2005 Adam Jackson.
+#
+#  Permission is hereby granted, free of charge, to any person obtaining a
+#  copy of this software and associated documentation files (the "Software"),
+#  to deal in the Software without restriction, including without limitation
+#  on the rights to use, copy, modify, merge, publish, distribute, sub
+#  license, and/or sell copies of the Software, and to permit persons to whom
+#  the Software is furnished to do so, subject to the following conditions:
+#
+#  The above copyright notice and this permission notice (including the next
+#  paragraph) shall be included in all copies or substantial portions of the
+#  Software.
+#
+#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+#  FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
+#  ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+#  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+AUTOMAKE_OPTIONS = foreign
+SUBDIRS = src man
+
+MAINTAINERCLEANFILES = ChangeLog INSTALL
+
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+       $(INSTALL_CMD)
+
+ChangeLog:
+       $(CHANGELOG_CMD)
+
+dist-hook: ChangeLog INSTALL
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..b81f91a
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,5 @@
+xinput 1.3.0 - 2008/01/09
+=========================
+
+ * Add support for Xorg 1.4
+ * Warn if a specified device name is ambiguous.
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..08a4ec9
--- /dev/null
+++ b/README
@@ -0,0 +1,29 @@
+                               xinput
+                               ======
+
+Overview
+========
+
+xinput is a utility to configure and test XInput devices. It wasn't
+originally designed to be the primary tool for doing this but it's
+still pretty much the only program out there for doing it. :-)
+
+Requirements
+============
+
+xinput depends on the X11 headers and particularly the XInput headers.
+As xinput now supports the new device types added in Xserver 1.4 (Xorg 7.3),
+your headers must be from that version or newer.
+
+Otherwise it will just require a working ANSI C compiler.
+
+Building and Installation
+=========================
+
+xinput uses autotools so the usual pattern applies:
+
+./configure
+make
+make install
+
+See the INSTALL file for details.
diff --git a/autogen.sh b/autogen.sh
new file mode 100644 (file)
index 0000000..e81f989
--- /dev/null
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+autoreconf -v --install || exit 1
+cd $ORIGDIR || exit $?
+
+$srcdir/configure --enable-maintainer-mode "$@"
+
diff --git a/configure.ac b/configure.ac
new file mode 100755 (executable)
index 0000000..1dc2ce2
--- /dev/null
@@ -0,0 +1,39 @@
+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.5.3], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xinput)
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AM_MAINTAINER_MODE
+
+# Require xorg-macros: XORG_DEFAULT_OPTIONS
+m4_ifndef([XORG_MACROS_VERSION],
+          [m4_fatal([must install xorg-macros 1.3 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.3)
+XORG_DEFAULT_OPTIONS
+
+AM_CONFIG_HEADER(config.h)
+
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_SED
+
+
+# Checks for pkg-config packages
+PKG_CHECK_MODULES(XINPUT, x11 xext [xi >= 1.2] [inputproto >= 1.5])
+
+# XI2 support
+PKG_CHECK_MODULES(XI2, [xi >= 1.2.99.2] [inputproto >= 1.9.99.15],
+                  HAVE_XI2="yes"; AC_DEFINE(HAVE_XI2, 1, [XI2 available]),
+                  HAVE_XI2="no");
+AM_CONDITIONAL(HAVE_XI2, [ test "$HAVE_XI2" = "yes" ])
+
+AC_SUBST(XINPUT_CFLAGS)
+AC_SUBST(XINPUT_LIBS)
+AC_SUBST(HAVE_XI2)
+
+AC_SUBST(VERSION)
+
+AC_OUTPUT([Makefile
+           src/Makefile
+           man/Makefile])
diff --git a/debian/changelog b/debian/changelog
new file mode 100755 (executable)
index 0000000..60e2d24
--- /dev/null
@@ -0,0 +1,174 @@
+xinput (1.5.2-2slp2) unstable; urgency=low
+
+  * [X11R7.6] upgrade package  
+  * Git: 165.213.180.234:slp/pkgs/xorg/app/xinput
+  * Tag: xinput_1.5.2-2slp2
+
+ -- SooChan Lim <sc1.lim@samsung.com>  Tue, 11 Jan 2011 16:00:37 +0900
+
+xinput (1.5.2-1) unstable; urgency=low
+
+  [ Julien Cristau ]
+  * Bump Standards-Version to 3.8.4.
+
+  [ Robert Hooker ]
+  * New upstream release.
+
+ -- Julien Cristau <jcristau@debian.org>  Fri, 04 Jun 2010 14:48:05 +0200
+
+xinput (1.5.1-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Julien Cristau <jcristau@debian.org>  Mon, 15 Mar 2010 22:29:17 +0100
+
+xinput (1.5.0-5slp2) unstable; urgency=low
+
+  * Add xinput-dbg package
+  * Git: 165.213.180.234:/git/slp/pkgs/xorg/app/xinput
+  * Tag: xinput_1.5.0-5slp2
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Mon, 22 Nov 2010 16:20:48 +0900
+
+xinput (1.5.0-4slp2) unstable; urgency=low
+
+  * Change revision
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Thu, 25 Mar 2010 18:53:32 +0900
+
+xinput (1.5.0-3) unstable; urgency=low
+
+  * Import debian package
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Tue, 19 Jan 2010 19:47:39 +0900
+
+xinput (1.5.0-2) unstable; urgency=low
+
+  * Add Depends on ${misc:Depends} (lintian).
+  * Upload to unstable.
+
+ -- Julien Cristau <jcristau@debian.org>  Wed, 06 Jan 2010 22:46:52 +0000
+
+xinput (1.5.0-1) experimental; urgency=low
+
+  * New upstream release.
+  * Bump build-deps on libXi and inputproto for XI2.
+  * Bump Standards-Version to 3.8.3.
+  * Update debian/copyright.
+
+ -- Julien Cristau <jcristau@debian.org>  Sun, 29 Nov 2009 11:29:03 +0100
+
+xinput (1.4.2-1) unstable; urgency=low
+
+  * New upstream release, with 64-bit fixes.
+
+ -- Julien Cristau <jcristau@debian.org>  Sat, 09 May 2009 20:30:25 +0200
+
+xinput (1.4.1-1) unstable; urgency=low
+
+  * New upstream release.
+  * Upload to unstable.
+
+ -- Julien Cristau <jcristau@debian.org>  Fri, 10 Apr 2009 11:26:09 +0100
+
+xinput (1.4.0-1) experimental; urgency=low
+
+  * New upstream release.
+  * Update debian/copyright.
+  * Bump build-dep on libxi-dev to 2:1.2.0 and x11proto-input-dev to 1.5.
+
+ -- Julien Cristau <jcristau@debian.org>  Thu, 22 Jan 2009 11:15:40 +0100
+
+xinput (1.3.0-1) unstable; urgency=low
+
+  * New upstream release.
+  * Update debian/copyright.
+  * Use autoconf instead of imake.
+  * New maintainer (closes: #460127).  Thanks to Frédéric Lepied for his work
+    on this package so far.
+
+ -- Julien Cristau <jcristau@debian.org>  Thu, 10 Jan 2008 23:20:05 +0100
+
+xinput (1.2-5.3) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Replace debmake with debhelper.  Closes: #368274.
+  * debian/rules: Remove reference to /usr/X11R6.  Closes: #367843.
+  * debian/prerm: Remove /usr/doc compatibility code.
+  * Conforms to Standards version 3.7.2.
+
+ -- Matej Vela <vela@debian.org>  Mon,  5 Jun 2006 10:10:46 +0200
+
+xinput (1.2-5.2) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * Split xlibs-dev build-dep (Closes: #346819).
+
+ -- Luk Claes <luk@debian.org>  Fri, 20 Jan 2006 23:25:03 +0100
+
+xinput (1.2-5.1) unstable; urgency=low
+
+  * Non-Maintainer Upload.
+  * debian/control:
+    - Bumped Standards-Version to 3.5.8.
+    - Replaced xlib6g-dev build dependency with xlibs-dev. Closes: #170168.
+    - Removed full-stop from short description.
+    - Changed long descripting which must not be the same as the
+      long description.
+  * debian/postinst: removed. It is no longer necessary since its
+    only purpose was to create the /usr/doc link for the package.
+  * debian/rules: fixed call to dpkg-gencontrol to force inclusion
+    of section and priority in control file.
+  
+ -- Jerome Marant <jerome@debian.org>  Sat,  8 Mar 2003 10:06:30 +0100
+
+xinput (1.2-5) unstable; urgency=low
+
+  * corrected Build-Depends
+
+ -- Frederic Lepied <Lepied@debian.org>  Tue, 20 Nov 2001 01:52:48 +0000
+
+xinput (1.2-4) unstable; urgency=low
+
+  * updated Standards-Version and added Build-Depends.
+
+ -- Frederic Lepied <Lepied@debian.org>  Sat, 23 Dec 2000 10:42:46 +0000
+
+xinput (1.2-3) unstable; urgency=low
+
+  * compiled with xlib6g (bug #12809).
+
+ -- Frederic Lepied <Lepied@debian.org>  Fri, 12 Sep 1997 17:15:26 +0200
+
+xinput (1.2-2) unstable; urgency=low
+
+  * compiled with libc6.
+
+ -- Frederic Lepied <Lepied@debian.org>  Sun,  6 Jul 1997 08:45:55 +0200
+
+xinput (1.2-1) unstable; urgency=low
+
+  * rename changelog.upstream into changelog (bug #9632).
+  * Upstream release.
+
+ -- Frederic Lepied <Lepied@debian.org>  Wed, 18 Jun 1997 05:36:57 +0200
+
+xinput (1.1.1-1) unstable; urgency=low
+
+  * Upstream release.
+
+ -- Frederic Lepied <Lepied@debian.org>  Tue, 11 Feb 1997 09:24:23 +0100
+
+xinput (1.1-1) unstable; urgency=low
+
+  * Upstream release.
+
+ -- Frederic Lepied <Lepied@debian.org>  Fri, 17 Jan 1997 18:51:09 +0100
+
+xinput (1.0.1-1) unstable; urgency=low
+
+  * debianized
+  
+ -- Frederic Lepied <Lepied@debian.org>  Fri, 18 Oct 1996 14:43:37 +0200
+
+
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100755 (executable)
index 0000000..10967fb
--- /dev/null
@@ -0,0 +1,20 @@
+Source: xinput
+Section: x11
+Priority: optional
+Maintainer: Sung-Jin Park <sj76.park@samsung.com>, Sangjin Lee <lsj119@samsung.com>, Julien Cristau <jcristau@debian.org>
+Uploaders: SooChan Lim <sc1.lim@samsung.com>, Sung-Jin Park <sj76.park@samsung.com>
+Standards-Version: 3.8.4
+Build-Depends: debhelper (>= 5), libx11-dev, libxi-dev (>= 2:1.3), libxext-dev, x11proto-input-dev (>= 2.0), pkg-config, automake, autoconf, xutils-dev
+
+Package: xinput
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends},
+Description: Runtime configuration and test of XInput devices
+ Xinput is an utility for configuring and testing XInput
+ devices.
+
+Package: xinput-dbg
+Architecture: any
+Section: debug
+Depends: ${shlibs:Depends}, ${misc:Depends}, xinput (=${Source-Version})
+Description: Debug package of xinput
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..2c0822a
--- /dev/null
@@ -0,0 +1,72 @@
+This package was debianized by Frederic Lepied Lepied@debian.org on
+Fri, 17 Jan 1997 18:51:09 +0100.
+
+It was downloaded from http://xorg.freedesktop.org/releases/individual/app/
+
+Copyright 1996-1997 by Frederic Lepied, France.
+                       <Frederic.Lepied@sugix.frmug.org>
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is  hereby granted without fee, provided that
+the  above copyright   notice appear  in   all  copies and  that both  that
+copyright  notice   and   this  permission   notice  appear  in  supporting
+documentation, and that   the  name of  the authors  not  be  used  in
+advertising or publicity pertaining to distribution of the software without
+specific,  written      prior  permission.     The authors  make  no
+representations about the suitability of this software for any purpose.  It
+is provided "as is" without express or implied warranty.
+
+THE AUTHORS DISCLAIM ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
+INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
+EVENT  SHALL THE AUTHORS  BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
+TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
+PERFORMANCE OF THIS SOFTWARE.
+
+
+Copyright 2007 Peter Hutterer
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the author shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from the author.
+
+
+Copyright © 2009 Red Hat, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644 (file)
index 0000000..919f03c
--- /dev/null
@@ -0,0 +1,8 @@
+[DEFAULT]
+upstream-branch = upstream-unstable
+debian-branch = debian-unstable
+debian-tag = xinput-%(version)s
+upstream-tag = xinput-%(version)s
+
+[git-buildpackage]
+sign-tags = True
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..845f333
--- /dev/null
@@ -0,0 +1,75 @@
+#!/usr/bin/make -f
+# This file is public domain software, originally written by Joey Hess. 
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+#DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(DEB_HOST_GNU_TYPE)
+
+ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+       confflags = --build $(DEB_HOST_GNU_TYPE)
+else
+       confflags = --build $(DEB_HOST_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
+endif
+
+
+build: build-stamp
+build-stamp: obj-$(DEB_BUILD_GNU_TYPE)/config.status
+       dh_testdir
+
+       cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE)
+
+       touch build-stamp
+
+obj-$(DEB_BUILD_GNU_TYPE)/config.status: configure
+       dh_testdir
+       mkdir obj-$(DEB_BUILD_GNU_TYPE)
+       cd obj-$(DEB_BUILD_GNU_TYPE) && ../configure --prefix=/usr $(confflags)
+
+configure: configure.ac
+       autoreconf -vfi
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp
+
+       rm -rf obj-*
+       rm -f Makefile.in */Makefile.in
+       rm -f aclocal.m4 config.guess config.sub config.h.in configure
+       rm -f depcomp install-sh missing
+       dh_clean
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       cd obj-$(DEB_BUILD_GNU_TYPE) && \
+               $(MAKE) DESTDIR=$(CURDIR)/debian/xinput install
+
+# Build architecture-independent files here.
+binary-indep: build install
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+#      dh_installchangelogs
+#      dh_installdocs README
+       dh_link
+       dh_strip --dbg-package=xinput-dbg
+       dh_compress
+       dh_fixperms
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/debian/watch b/debian/watch
new file mode 100644 (file)
index 0000000..0915e39
--- /dev/null
@@ -0,0 +1,2 @@
+version=3
+http://xorg.freedesktop.org/releases/individual/app/ xinput-(.*)\.tar\.gz
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100755 (executable)
index 0000000..6608ff7
--- /dev/null
@@ -0,0 +1,51 @@
+# 
+#  Copyright 2007 Peter Hutterer <peter@cs.unisa.edu.au>
+# 
+#  Permission to use, copy, modify, distribute, and sell this software and its
+#  documentation for any purpose is hereby granted without fee, provided that
+#  the above copyright notice appear in all copies and that both that
+#  copyright notice and this permission notice appear in supporting
+#  documentation, and that the name of the author not be used in
+#  advertising or publicity pertaining to distribution of the software without
+#  specific, written prior permission.  The author makes no
+#  representations about the suitability of this software for any purpose.  It
+#  is provided "as is" without express or implied warranty.
+# 
+#  THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+#  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+#  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+#  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+#  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+#  PERFORMANCE OF THIS SOFTWARE.
+
+
+appmandir = $(APP_MAN_DIR)
+appman_PRE = xinput.man
+appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
+
+EXTRA_DIST = $(appman_PRE)
+CLEANFILES = $(appman_DATA)
+
+# Strings to replace in man pages
+XORGRELSTRING = @PACKAGE_STRING@
+  XORGMANNAME = X Version 11
+
+MAN_SUBSTS = \
+       -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+       -e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
+       -e 's|__xservername__|Xorg|g' \
+       -e 's|__xconfigfile__|xorg.conf|g' \
+       -e 's|__projectroot__|$(prefix)|g' \
+       -e 's|__apploaddir__|$(appdefaultdir)|' \
+       -e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
+       -e 's|__libmansuffix__|$(LIB_MAN_SUFFIX)|g' \
+       -e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
+       -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
+       -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
+
+SUFFIXES = .$(APP_MAN_SUFFIX) .man
+
+.man.$(APP_MAN_SUFFIX):
+       $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+
diff --git a/man/xinput.man b/man/xinput.man
new file mode 100755 (executable)
index 0000000..b922656
--- /dev/null
@@ -0,0 +1,163 @@
+.TH xinput 1 __xorgversion__
+
+.SH NAME
+xinput - utility to configure and test X input devices
+
+.SH SYNOPSIS
+.B xinput [OPTIONS] [DEVICE]
+
+.SH DESCRIPTION
+xinput is a utility to list available input devices, query information about
+a device and change input device settings.
+.SH OPTIONS
+.TP 8
+.B --version
+Test if the X Input extension is available and return the version number
+of the program and the version supported by the server. This option does not
+require a device name.
+.PP
+.TP 8
+.B --list [--short || --long] [\fIdevice\fP]
+If no argument is given list all the input devices. If an argument is given,
+show all the features of \fIdevice\fP.
+If --long is provided, the output includes detailed information about the
+capabilities of each devices. Otherwise, or if --short is provided, only the
+device names and some minimal information is listed.
+.PP
+.TP 8
+.B --get-feedbacks \fIdevice\fP
+Display the feedbacks of \fIdevice\fP.
+.PP
+.TP 8
+.B --set-pointer \fIdevice\fP
+Switch \fIdevice\fP in core pointer.
+This option does nothing on X servers 1.5 and later.
+.PP
+.TP 8
+.B --set-mode \fIdevice\fP \fIABSOLUTE|RELATIVE\fP
+Change the mode of \fIdevice\fP.
+.PP
+.TP 8
+.B --set-ptr-feedback \fIdevice\fP \fIthreshold\fP \fInum\fP \fIdenom\fP
+Change the pointer acceleration (or feedback) parameters of \fIdevice\fP.
+The xset(1) man page has more details. For X.Org Server 1.7
+and above, there are additional device properties pertaining to pointer
+acceleration. These do not replace, but complement the pointer feedback
+setting.
+.PP
+.TP 8
+.B --set-integer-feedback \fIdevice\fP \fIindex\fP \fIvalue\fP
+Change the value of an integer feedback of \fIdevice\fP.
+.PP
+.TP 8
+.B --set-button-map \fIdevice\fP \fImap_button_1\fP [\fImap_button_2\fP [\fI...\fP]]
+Change the button mapping of \fIdevice\fP. The buttons are specified in
+physical order (starting with button 1) and are mapped to the logical button
+provided. 0 disables a button. The default button mapping for a device is 1
+2 3 4 5 6 etc.
+.PP
+.TP 8
+.B --query-state \fIdevice\fP
+Query the device state.
+.PP
+.TP 8
+.B --list-props \fIdevice\fP [\fIdevice\fP [\fI...\fP]]
+Lists properties that can be set for the given device(s).
+.PP
+.TP 8
+.B --set-int-prop \fIdevice\fP \fIproperty\fP \fIformat\fP \fIvalue\fP
+Sets an integer property for the device.  Appropriate values for \fIformat\fP
+are 8, 16, or 32, depending on the property. Deprecated, use
+.B --set-prop
+instead.
+.PP
+.TP 8
+.B --set-float-prop \fIdevice\fP \fIproperty\fP \fIvalue\fP
+Sets a float property for the device. Deprecated, use
+.B --set-prop
+instead.
+.PP
+.TP 8
+.B --set\-prop [\-\-type=\fIatom|float|int\fP] [\-\-format=\fI8|16|32\fP] \fIdevice\fP \fIproperty\fP \fIvalue\fP [...]
+Set the property to the given value(s).  If not specified, the format and type
+of the property are left as-is.  The arguments are interpreted according to the
+property type.
+.PP
+.TP 8
+.B --watch-props \fIdevice\fP
+Prints to standard out when property changes occur.
+.PP
+.TP 8
+.B --delete-prop \fIdevice\fP \fIproperty\fP
+Delete the property from the device.
+.PP
+.TP 8
+.B --test [-proximity] \fIdevice\fP
+Register all extended events from \fIdevice\fP and enter an endless
+loop displaying events received. If the -proximity is given, ProximityIn
+and ProximityOut are registered.
+.PP
+.TP 8
+.B --test_xi2
+Register for a number of XI2 events and display them. This option does not
+take a device argument.
+.PP
+.TP 8
+.B --create-master \fIprefix\fP [sendCore] [enable]
+Create a new pair of master devices on an XI2-enabled server with the given
+\fIprefix\fP. The server will create one master pointer named "\fIprefix\fP
+pointer" and one master keyboard named "\fIprefix\fP keyboard".  If
+\fIsendCore\fP is 1, this pair of master devices is set to send core events
+(default).  If \fIenable\fP is 1, this master device pair will be enabled
+immediately (default).
+.PP
+.TP 8
+.B --remove-master \fImaster\fP [Floating|AttachToMaster] [returnPointer] [returnKeyboard]
+Remove \fImaster\fP  and its paired master device. Attached slave devices
+are set floating if \fIFloating\fP is specified or the argument is omitted.
+If the second argument is \fIAttachToMaster\fP, \fIreturnPointer\fP
+specifies the master pointer to attach all slave pointers to and
+\fIreturnKeyboard\fP specifies the master keyboard to attach all slave
+keyboards to.
+.PP
+.TP 8
+.B --reattach \fIslave\fP \fImaster\fP
+Reattach \fIslave\fP to \fImaster\fP.
+.PP
+.TP 8
+.B --float \fIslave\fP
+Remove \fIslave\fP from its current master device.
+.PP
+.TP 8
+.B --set-cp \fIwindow\fP \fImaster\fP
+Set the ClientPointer for the client owning \fIwindow\fP to \fImaster\fP.
+\fImaster\fP must specify a master pointer.
+.PP
+\fIdevice\fP can be the device name as a string or the XID of the
+device.
+.PP
+\fIslave\fP can be the device name as a string or the XID of a slave
+device.
+.PP
+\fImaster\fP can be the device name as a string or the XID of a master
+device.
+.PP
+\fIproperty\fP can be the property as a string or the Atom value.
+.PP
+.SH "SEE ALSO"
+X(__miscmansuffix__), xset(1)
+.SH COPYRIGHT
+Copyright 1996,1997, Frederic Lepied.
+.PP
+Copyright 2008, Philip Langdale.
+
+.SH AUTHORS
+
+.nf
+Philip Langdale, <philipl@alumni.utexas.net>
+Frederic Lepied, France <Frederic.Lepied@sugix.frmug.org>
+Peter Hutterer <peter.hutterer@who-t.net>
+Julien Cristau <jcristau@debian.org>
+Thomas Jaeger <ThJaeger@gmail.com>
+and more.
+.fi
diff --git a/packaging/xorg-x11-utils-xinput.spec b/packaging/xorg-x11-utils-xinput.spec
new file mode 100644 (file)
index 0000000..502507f
--- /dev/null
@@ -0,0 +1,47 @@
+
+Name:       xorg-x11-utils-xinput
+Summary:    X.Org X11 xinput utility
+Version:    1.5.2
+Release:    2
+Group:      System/X11
+License:    MIT
+URL:        http://www.x.org
+Source0:    http://xorg.freedesktop.org/releases/individual/app/xinput-%{version}.tar.gz
+BuildRequires:  pkgconfig(xorg-macros)
+BuildRequires:  pkgconfig(x11)
+BuildRequires:  pkgconfig(xext)
+BuildRequires:  pkgconfig(xi)
+BuildRequires:  pkgconfig(inputproto)
+Obsoletes:   xorg-x11-app-xinput
+
+
+%description
+Description: %{summary}
+
+
+
+%prep
+%setup -q -n xinput-%{version}
+
+
+%build
+
+%reconfigure --disable-static \
+    --libdir=%{_datadir}
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+
+
+
+
+%files
+%defattr(-,root,root,-)
+%{_bindir}/xinput
+%{_mandir}/man1/xinput.1.gz
+
+
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644 (file)
index 0000000..ba0d325
--- /dev/null
@@ -0,0 +1,45 @@
+# 
+#  Copyright 2007 Peter Hutterer <peter@cs.unisa.edu.au>
+# 
+#  Permission to use, copy, modify, distribute, and sell this software and its
+#  documentation for any purpose is hereby granted without fee, provided that
+#  the above copyright notice appear in all copies and that both that
+#  copyright notice and this permission notice appear in supporting
+#  documentation, and that the name of the author not be used in
+#  advertising or publicity pertaining to distribution of the software without
+#  specific, written prior permission.  The author makes no
+#  representations about the suitability of this software for any purpose.  It
+#  is provided "as is" without express or implied warranty.
+# 
+#  THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+#  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+#  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+#  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+#  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+#  PERFORMANCE OF THIS SOFTWARE.
+
+bin_PROGRAMS = xinput
+
+AM_CFLAGS = $(XINPUT_CFLAGS)
+xinput_LDADD = $(XINPUT_LIBS)
+
+
+if HAVE_XI2
+xinput2_files = hierarchy.c setcp.c test_xi2.c
+endif
+
+xinput_SOURCES = \
+    buttonmap.c \
+    feedback.c \
+    list.c \
+    setint.c \
+    setmode.c \
+    setptr.c \
+    state.c \
+    property.c \
+    test.c \
+    xinput.c \
+    xinput.h \
+    $(xinput2_files)
+
diff --git a/src/buttonmap.c b/src/buttonmap.c
new file mode 100644 (file)
index 0000000..7fed927
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is  hereby granted without fee, provided that
+ * the  above copyright   notice appear  in   all  copies and  that both  that
+ * copyright  notice   and   this  permission   notice  appear  in  supporting
+ * documentation, and that   the  name of  the authors  not  be  used  in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific,  written      prior  permission.     The authors  make  no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
+ * EVENT  SHALL THE AUTHORS  BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
+ * TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include "xinput.h"
+
+
+int
+get_button_map(Display *display,
+              int      argc,
+              char     *argv[],
+              char     *name,
+              char     *desc)
+{
+    XDeviceInfo                *info;
+    XDevice            *device;
+    XAnyClassPtr       ip;
+    int                        i;
+    int                        nbuttons;
+
+    if (argc != 1) {
+       fprintf(stderr, "usage: xinput %s %s\n", name, desc);
+       return EXIT_FAILURE;
+    }
+
+    info = find_device_info(display, argv[0], False);
+
+    if (!info) {
+       fprintf(stderr, "unable to find device %s\n", argv[0]);
+       return EXIT_FAILURE;
+    }
+
+    ip = (XAnyClassPtr) info->inputclassinfo;
+    nbuttons = 0;
+
+    /* try to find the number of buttons */
+    for(i=0; i<info->num_classes; i++) {
+       if (ip->class == ButtonClass) {
+           nbuttons = ((XButtonInfoPtr)ip)->num_buttons;
+           break;
+       }
+       ip = (XAnyClassPtr) ((char *) ip + ip->length);
+    }
+    if (nbuttons == 0) {
+       fprintf(stderr, "device has no buttons\n");
+       return EXIT_FAILURE;
+    }
+
+    device = XOpenDevice(display, info->id);
+    if (device) {
+       int             idx;
+       unsigned char   *map;
+
+       map = (unsigned char *) malloc(sizeof(unsigned char) * nbuttons);
+
+       XGetDeviceButtonMapping(display, device, map, nbuttons);
+
+       for(idx=1; idx < nbuttons + 1; idx++) {
+           printf("%d ", map[idx - 1]);
+       }
+        printf("\n");
+       XCloseDevice(display, device);
+       return EXIT_SUCCESS;
+    } else {
+       fprintf(stderr, "Unable to open device\n");
+       return EXIT_FAILURE;
+    }
+}
+
+
+
+int
+set_button_map(Display *display,
+              int      argc,
+              char     *argv[],
+              char     *name,
+              char     *desc)
+{
+    XDeviceInfo                *info;
+    XDevice            *device;
+    XAnyClassPtr       ip;
+    int                        i;
+    int                        nbuttons;
+
+    if (argc < 2) {
+       fprintf(stderr, "usage: xinput %s %s\n", name, desc);
+       return EXIT_FAILURE;
+    }
+
+    info = find_device_info(display, argv[0], False);
+
+    if (!info) {
+       fprintf(stderr, "unable to find device %s\n", argv[0]);
+       return EXIT_FAILURE;
+    }
+
+    ip = (XAnyClassPtr) info->inputclassinfo;
+    nbuttons = 0;
+
+    /* try to find the number of buttons */
+    for(i=0; i<info->num_classes; i++) {
+       if (ip->class == ButtonClass) {
+           nbuttons = ((XButtonInfoPtr)ip)->num_buttons;
+           break;
+       }
+       ip = (XAnyClassPtr) ((char *) ip + ip->length);
+    }
+    if (nbuttons == 0) {
+       fprintf(stderr, "device has no buttons\n");
+       return EXIT_FAILURE;
+    }
+
+    device = XOpenDevice(display, info->id);
+    if (device) {
+       int             idx;
+       unsigned char   *map;
+       int             min;
+
+       map = (unsigned char *) malloc(sizeof(unsigned char) * nbuttons);
+
+       XGetDeviceButtonMapping(display, device, map, nbuttons);
+
+       min = (argc > nbuttons + 1) ? nbuttons + 1 : argc;
+
+       for(idx=1; idx < min; idx++) {
+           map[idx - 1] = atoi(argv[idx]);
+       }
+       XSetDeviceButtonMapping(display, device, map, nbuttons);
+       XCloseDevice(display, device);
+       return EXIT_SUCCESS;
+    } else {
+       fprintf(stderr, "Unable to open device\n");
+       return EXIT_FAILURE;
+    }
+}
+
+/* end of buttonmap.c */
diff --git a/src/feedback.c b/src/feedback.c
new file mode 100644 (file)
index 0000000..3fad9a9
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is  hereby granted without fee, provided that
+ * the  above copyright   notice appear  in   all  copies and  that both  that
+ * copyright  notice   and   this  permission   notice  appear  in  supporting
+ * documentation, and that   the  name of  the authors  not  be  used  in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific,  written      prior  permission.     The authors  make  no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
+ * EVENT  SHALL THE AUTHORS  BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
+ * TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include "xinput.h"
+
+int
+set_ptr_feedback(Display       *display,
+                int            argc,
+                char           *argv[],
+                char           *name,
+                char           *desc)
+{
+    XDeviceInfo                *info;
+    XDevice            *device;
+    XPtrFeedbackControl        feedback;
+    XFeedbackState     *state;
+    int                        num_feedbacks;
+    int                        loop;
+    int                        id;
+
+    if (argc != 4) {
+       fprintf(stderr, "usage: xinput %s %s\n", name, desc);
+       return 1;
+    }
+
+    info = find_device_info(display, argv[0], True);
+
+    if (!info) {
+       fprintf(stderr, "unable to find device %s\n", argv[0]);
+       return 1;
+    }
+
+    device = XOpenDevice(display, info->id);
+
+    if (!device) {
+       fprintf(stderr, "unable to open device %s\n", argv[0]);
+       return 1;
+    }
+
+    /* We will match the first Ptr Feedback class. Can there be more? */
+    id = -1;
+    state = XGetFeedbackControl(display, device, &num_feedbacks);
+    for(loop=0; loop<num_feedbacks; loop++) {
+       if (state->class == PtrFeedbackClass) {
+          id = state->id;
+       }
+       state = (XFeedbackState*) ((char*) state + state->length);
+    }
+
+    if (id == -1) {
+       fprintf(stderr, "unable to find PtrFeedbackClass for %s\n", argv[0]);
+       return 1;
+    }
+
+    feedback.class       = PtrFeedbackClass;
+    feedback.length      = sizeof(XPtrFeedbackControl);
+    feedback.id                 = id;
+    feedback.threshold  = atoi(argv[1]);
+    feedback.accelNum   = atoi(argv[2]);
+    feedback.accelDenom  = atoi(argv[3]);
+
+    XChangeFeedbackControl(display, device, DvAccelNum|DvAccelDenom|DvThreshold,
+                          (XFeedbackControl*) &feedback);
+    return EXIT_SUCCESS;
+}
+
+
+int
+get_feedbacks(Display  *display,
+             int       argc,
+             char      *argv[],
+             char      *name,
+             char      *desc)
+{
+    XDeviceInfo                *info;
+    XDevice            *device;
+    XFeedbackState     *state;
+    int                        num_feedbacks;
+    int                        loop;
+    XPtrFeedbackState  *p;
+    XKbdFeedbackState  *k;
+    XBellFeedbackState *b;
+    XLedFeedbackState  *l;
+    XIntegerFeedbackState *i;
+    XStringFeedbackState *s;
+
+    if (argc != 1) {
+       fprintf(stderr, "usage: xinput %s %s\n", name, desc);
+       return 1;
+    }
+
+    info = find_device_info(display, argv[0], True);
+
+    if (!info) {
+       fprintf(stderr, "unable to find device %s\n", argv[0]);
+       return 1;
+    }
+
+    device = XOpenDevice(display, info->id);
+
+    if (!device) {
+       fprintf(stderr, "unable to open device %s\n", argv[0]);
+       return 1;
+    }
+
+    state = XGetFeedbackControl(display, device, &num_feedbacks);
+
+    printf("%d feedback class%s\n", num_feedbacks,
+          (num_feedbacks > 1) ? "es" : "");
+
+    for(loop=0; loop<num_feedbacks; loop++) {
+       switch (state->class) {
+       case KbdFeedbackClass:
+           k = (XKbdFeedbackState*) state;
+           printf("KbdFeedbackClass id=%ld\n", state->id);
+           printf("\tclick is %d\n", k->click);
+           printf("\tpercent is %d\n", k->percent);
+           printf("\tpitch is %d\n", k->pitch);
+           printf("\tduration is %d\n", k->duration);
+           printf("\tled_mask is %d\n", k->led_mask);
+           printf("\tglobal_auto_repeat is %d\n", k->global_auto_repeat);
+           break;
+
+       case PtrFeedbackClass:
+           p = (XPtrFeedbackState*) state;
+           printf("PtrFeedbackClass id=%ld\n", state->id);
+           printf("\taccelNum is %d\n", p->accelNum);
+           printf("\taccelDenom is %d\n", p->accelDenom);
+           printf("\tthreshold is %d\n", p->threshold);
+           break;
+
+       case StringFeedbackClass:
+           s = (XStringFeedbackState*) state;
+           printf("XStringFeedbackControl id=%ld\n", state->id);
+           printf("\tmax_symbols is %d\n", s->max_symbols);
+           printf("\tnum_syms_supported is %d\n", s->num_syms_supported);
+           break;
+
+       case IntegerFeedbackClass:
+           i = (XIntegerFeedbackState*) state;
+           printf("XIntegerFeedbackControl id=%ld\n", state->id);
+           printf("\tresolution is %d\n", i->resolution);
+           printf("\tminVal is %d\n", i->minVal);
+           printf("\tmaxVal is %d\n", i->maxVal);
+           break;
+
+       case LedFeedbackClass:
+           l = (XLedFeedbackState*) state;
+           printf("XLedFeedbackState id=%ld\n", state->id);
+           printf("\tled_values is %d\n", l->led_values);
+           break;
+
+       case BellFeedbackClass:
+           b = (XBellFeedbackState*) state;
+           printf("XBellFeedbackControl id=%ld\n", state->id);
+           printf("\tpercent is %d\n", b->percent);
+           printf("\tpitch is %d\n", b->pitch);
+           printf("\tduration is %d\n", b->duration);
+           break;
+       }
+       state = (XFeedbackState*) ((char*) state + state->length);
+    }
+    return EXIT_SUCCESS;
+}
+
+/* end of ptrfdbk.c */
diff --git a/src/hierarchy.c b/src/hierarchy.c
new file mode 100644 (file)
index 0000000..7f35c39
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2007 Peter Hutterer <peter@cs.unisa.edu.au>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the author shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization
+ * from the author.
+ *
+ */
+
+#include "xinput.h"
+#include <string.h>
+
+#define Error(error, ...) \
+{ \
+    fprintf(stderr, __VA_ARGS__); \
+    return error;\
+}
+/**
+ * Create a new master device. Name must be supplied, other values are
+ * optional.
+ */
+int
+create_master(Display* dpy, int argc, char** argv, char* name, char *desc)
+{
+    XIAddMasterInfo c;
+
+    if (argc == 0)
+    {
+        fprintf(stderr, "Usage: xinput %s %s\n", name, desc);
+        return EXIT_FAILURE;
+    }
+
+    c.type = XIAddMaster;
+    c.name = argv[0];
+    c.send_core = (argc >= 2) ? atoi(argv[1]) : 1;
+    c.enable = (argc >= 3) ? atoi(argv[2]) : 1;
+
+    return XIChangeHierarchy(dpy, (XIAnyHierarchyChangeInfo*)&c, 1);
+}
+
+/**
+ * Remove a master device.
+ * By default, all attached devices are set to Floating, unless parameters are
+ * given.
+ */
+int
+remove_master(Display* dpy, int argc, char** argv, char *name, char *desc)
+{
+    XIRemoveMasterInfo r;
+    XIDeviceInfo *info;
+    int ret;
+
+    if (argc == 0)
+    {
+        fprintf(stderr, "usage: xinput %s %s\n", name, desc);
+        return EXIT_FAILURE;
+    }
+
+    info = xi2_find_device_info(dpy, argv[0]);
+
+    if (!info) {
+       fprintf(stderr, "unable to find device %s\n", argv[0]);
+       return EXIT_FAILURE;
+    }
+
+    r.type = XIRemoveMaster;
+    r.deviceid = info->deviceid;
+    if (argc >= 2)
+    {
+        if (!strcmp(argv[1], "Floating"))
+            r.return_mode = XIFloating;
+        else if (!strcmp(argv[1], "AttachToMaster"))
+            r.return_mode = XIAttachToMaster;
+        else
+            Error(BadValue, "Invalid return_mode.\n");
+    } else
+        r.return_mode = XIFloating;
+
+    if (r.return_mode == XIAttachToMaster)
+    {
+        r.return_pointer = 0;
+        if (argc >= 3) {
+            info = xi2_find_device_info(dpy, argv[2]);
+            if (!info) {
+                fprintf(stderr, "unable to find device %s\n", argv[2]);
+                return EXIT_FAILURE;
+            }
+
+            r.return_pointer = info->deviceid;
+        }
+
+        r.return_keyboard = 0;
+        if (argc >= 4) {
+            info = xi2_find_device_info(dpy, argv[3]);
+            if (!info) {
+                fprintf(stderr, "unable to find device %s\n", argv[3]);
+                return EXIT_FAILURE;
+            }
+
+            r.return_keyboard = info->deviceid;
+        }
+
+        if (!r.return_pointer || !r.return_keyboard) {
+            int i, ndevices;
+            info = XIQueryDevice(dpy, XIAllMasterDevices, &ndevices);
+            for(i = 0; i < ndevices; i++) {
+                if (info[i].use == XIMasterPointer && !r.return_pointer)
+                    r.return_pointer = info[i].deviceid;
+                if (info[i].use == XIMasterKeyboard && !r.return_keyboard)
+                    r.return_keyboard = info[i].deviceid;
+                if (r.return_pointer && r.return_keyboard)
+                    break;
+            }
+
+            XIFreeDeviceInfo(info);
+        }
+    }
+
+    ret = XIChangeHierarchy(dpy, (XIAnyHierarchyChangeInfo*)&r, 1);
+    return ret;
+}
+
+/**
+ * Swap a device from one master to another.
+ */
+int
+change_attachment(Display* dpy, int argc, char** argv, char *name, char* desc)
+{
+    XIDeviceInfo *sd_info, *md_info;
+    XIAttachSlaveInfo c;
+    int ret;
+
+    if (argc < 2)
+    {
+        fprintf(stderr, "usage: xinput %s %s\n", name, desc);
+        return EXIT_FAILURE;
+    }
+
+    sd_info = xi2_find_device_info(dpy, argv[0]);
+    md_info= xi2_find_device_info(dpy, argv[1]);
+
+    if (!sd_info) {
+       fprintf(stderr, "unable to find device %s\n", argv[0]);
+       return EXIT_FAILURE;
+    }
+
+    if (!md_info) {
+       fprintf(stderr, "unable to find device %s\n", argv[1]);
+       return EXIT_FAILURE;
+    }
+
+    c.type = XIAttachSlave;
+    c.deviceid = sd_info->deviceid;
+    c.new_master = md_info->deviceid;
+
+    ret = XIChangeHierarchy(dpy, (XIAnyHierarchyChangeInfo*)&c, 1);
+    return ret;
+}
+
+/**
+ * Set a device floating.
+ */
+int
+float_device(Display* dpy, int argc, char** argv, char* name, char* desc)
+{
+    XIDeviceInfo *info;
+    XIDetachSlaveInfo c;
+    int ret;
+
+    if (argc < 1)
+    {
+        fprintf(stderr, "usage: xinput %s %s\n", name, desc);
+        return EXIT_FAILURE;
+    }
+
+    info = xi2_find_device_info(dpy, argv[0]);
+
+    if (!info) {
+       fprintf(stderr, "unable to find device %s\n", argv[0]);
+       return EXIT_FAILURE;
+    }
+
+    c.type = XIDetachSlave;
+    c.deviceid = info->deviceid;
+
+    ret = XIChangeHierarchy(dpy, (XIAnyHierarchyChangeInfo*)&c, 1);
+    return ret;
+}
+
+
diff --git a/src/list.c b/src/list.c
new file mode 100755 (executable)
index 0000000..8633c62
--- /dev/null
@@ -0,0 +1,327 @@
+/*
+ * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is  hereby granted without fee, provided that
+ * the  above copyright   notice appear  in   all  copies and  that both  that
+ * copyright  notice   and   this  permission   notice  appear  in  supporting
+ * documentation, and that   the  name of  the authors  not  be  used  in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific,  written      prior  permission.     The authors  make  no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
+ * EVENT  SHALL THE AUTHORS  BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
+ * TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include "xinput.h"
+#include <string.h>
+#include <X11/extensions/XIproto.h> /* for XI_Device***ChangedNotify */
+
+static void
+print_info(Display* dpy, XDeviceInfo   *info, Bool shortformat)
+{
+    int                        i,j;
+    XAnyClassPtr       any;
+    XKeyInfoPtr                k;
+    XButtonInfoPtr     b;
+    XValuatorInfoPtr   v;
+    XAxisInfoPtr       a;
+
+    printf("\"%s\"\tid=%ld\t[", info->name, info->id);
+
+    switch (info->use) {
+    case IsXPointer:
+       printf("XPointer");
+       break;
+    case IsXKeyboard:
+       printf("XKeyboard");
+       break;
+    case IsXExtensionDevice:
+       printf("XExtensionDevice");
+       break;
+    case IsXExtensionKeyboard:
+       printf("XExtensionKeyboard");
+       break;
+    case IsXExtensionPointer:
+       printf("XExtensionPointer");
+       break;
+    default:
+       printf("Unknown class");
+       break;
+    }
+    printf("]\n");
+
+    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++) {
+           switch (any->class) {
+           case KeyClass:
+               k = (XKeyInfoPtr) any;
+               printf("\tNum_keys is %d\n", k->num_keys);
+               printf("\tMin_keycode is %d\n", k->min_keycode);
+               printf("\tMax_keycode is %d\n", k->max_keycode);
+               break;
+
+           case ButtonClass:
+               b = (XButtonInfoPtr) any;
+               printf("\tNum_buttons is %d\n", b->num_buttons);
+               break;
+
+           case ValuatorClass:
+               v = (XValuatorInfoPtr) any;
+               a = (XAxisInfoPtr) ((char *) v +
+                                   sizeof (XValuatorInfo));
+               printf("\tNum_axes is %d\n", v->num_axes);
+               printf("\tMode is %s\n", (v->mode == Absolute) ? "Absolute" : "Relative");
+               printf("\tMotion_buffer is %ld\n", v->motion_buffer);
+               for (j=0; j<v->num_axes; j++, a++) {
+                   printf("\tAxis %d :\n", j);
+                   printf("\t\tMin_value is %d\n", a->min_value);
+                   printf("\t\tMax_value is %d\n", a->max_value);
+                   printf ("\t\tResolution is %d\n", a->resolution);
+               }
+               break;
+           default:
+               printf ("unknown class\n");
+           }
+           any = (XAnyClassPtr) ((char *) any + any->length);
+       }
+    }
+}
+
+static int list_xi1(Display     *display,
+                    int                shortformat)
+{
+    XDeviceInfo                *info;
+    int                        loop;
+    int                 num_devices;
+
+    info = XListInputDevices(display, &num_devices);
+    for(loop=0; loop<num_devices; loop++) {
+        print_info(display, info+loop, shortformat);
+    }
+    return EXIT_SUCCESS;
+}
+
+#ifdef HAVE_XI2
+/* also used from test_xi2.c */
+void
+print_classes_xi2(Display* display, XIAnyClassInfo **classes,
+                  int num_classes)
+{
+    int i, j;
+
+    printf("\tReporting %d classes:\n", num_classes);
+    for (i = 0; i < num_classes; i++)
+    {
+        printf("\t\tClass originated from: %d\n", classes[i]->sourceid);
+        switch(classes[i]->type)
+        {
+            case XIButtonClass:
+                {
+                    XIButtonClassInfo *b = (XIButtonClassInfo*)classes[i];
+                    char *name;
+                    printf("\t\tButtons supported: %d\n", b->num_buttons);
+                    printf("\t\tButton labels:");
+                    for (j = 0; j < b->num_buttons; j++)
+                    {
+                        name = (b->labels[j]) ? XGetAtomName(display, b->labels[j]) : NULL;
+                        printf(" %s", (name) ? name : "None");
+                        XFree(name);
+                    }
+                    printf("\n");
+                    printf("\t\tButton state:");
+                    for (j = 0; j < b->state.mask_len * 8; j++)
+                        if (XIMaskIsSet(b->state.mask, j))
+                            printf(" %d", j);
+                    printf("\n");
+
+                }
+                break;
+            case XIKeyClass:
+                {
+                    XIKeyClassInfo *k = (XIKeyClassInfo*)classes[i];
+                    printf("\t\tKeycodes supported: %d\n", k->num_keycodes);
+                }
+                break;
+            case XIValuatorClass:
+                {
+                    XIValuatorClassInfo *v = (XIValuatorClassInfo*)classes[i];
+                    char *name = v->label ?  XGetAtomName(display, v->label) : NULL;
+
+                    /* XXX: Bug in X servers 1.7..1.8.1, mode was |
+                       OutOfProximity. Remove this once 1.9 is out. */
+                    v->mode &= DeviceMode;
+
+                    printf("\t\tDetail for Valuator %d:\n", v->number);
+                    printf("\t\t  Label: %s\n",  (name) ? name : "None");
+                    printf("\t\t  Range: %f - %f\n", v->min, v->max);
+                    printf("\t\t  Resolution: %d units/m\n", v->resolution);
+                    printf("\t\t  Mode: %s\n", v->mode == Absolute ? "absolute" :
+                            "relative");
+                    if (v->mode == Absolute)
+                        printf("\t\t  Current value: %f\n", v->value);
+                    XFree(name);
+                }
+                break;
+        }
+    }
+
+    printf("\n");
+}
+
+static void
+print_info_xi2(Display* display, XIDeviceInfo *dev, Bool shortformat)
+{
+    printf("%-40s\tid=%d\t[", dev->name, dev->deviceid);
+    switch(dev->use)
+    {
+        case XIMasterPointer:
+            printf("master pointer  (%d)]\n", dev->attachment);
+            break;
+        case XIMasterKeyboard:
+            printf("master keyboard (%d)]\n", dev->attachment);
+            break;
+        case XISlavePointer:
+            printf("slave  pointer  (%d)]\n", dev->attachment);
+            break;
+        case XISlaveKeyboard:
+            printf("slave  keyboard (%d)]\n", dev->attachment);
+            break;
+        case XIFloatingSlave:
+            printf("floating slave]\n");
+            break;
+    }
+
+    if (shortformat)
+        return;
+
+    if (!dev->enabled)
+        printf("\tThis device is disabled\n");
+
+    print_classes_xi2(display, dev->classes, dev->num_classes);
+}
+
+
+static int
+list_xi2(Display *display,
+         int     shortformat)
+{
+    int major = XI_2_Major,
+        minor = XI_2_Minor;
+    int ndevices;
+    int i, j;
+    XIDeviceInfo *info, *dev;
+
+    if (XIQueryVersion(display, &major, &minor) != Success ||
+        (major * 1000 + minor) < (XI_2_Major * 1000 + XI_2_Minor))
+    {
+        fprintf(stderr, "XI2 not supported.\n");
+        return EXIT_FAILURE;
+    }
+
+    info = XIQueryDevice(display, XIAllDevices, &ndevices);
+
+    for(i = 0; i < ndevices; i++)
+    {
+        dev = &info[i];
+        if (dev->use == XIMasterPointer || dev->use == XIMasterKeyboard)
+        {
+            if (dev->use == XIMasterPointer)
+                printf("⎡ ");
+            else
+                printf("⎣ ");
+
+            print_info_xi2(display, dev, shortformat);
+            for (j = 0; j < ndevices; j++)
+            {
+                XIDeviceInfo* sd = &info[j];
+
+                if ((sd->use == XISlavePointer || sd->use == XISlaveKeyboard) &&
+                     (sd->attachment == dev->deviceid))
+                {
+                    printf("%s   ↳ ", dev->use == XIMasterPointer ? "⎜" : " ");
+                    print_info_xi2(display, sd, shortformat);
+                }
+            }
+        }
+    }
+
+    for (i = 0; i < ndevices; i++)
+    {
+        dev = &info[i];
+        if (dev->use == XIFloatingSlave)
+        {
+            printf("∼ ");
+            print_info_xi2(display, dev, shortformat);
+        }
+    }
+
+
+    XIFreeDeviceInfo(info);
+    return EXIT_SUCCESS;
+}
+#endif
+
+int
+list(Display   *display,
+     int       argc,
+     char      *argv[],
+     char      *name,
+     char      *desc)
+{
+    int shortformat = (argc >= 1 && strcmp(argv[0], "--short") == 0);
+    int longformat = (argc >= 1 && strcmp(argv[0], "--long") == 0);
+    int arg_dev = shortformat || longformat;
+
+    if (argc > arg_dev)
+    {
+#ifdef HAVE_XI2
+        if (xinput_version(display) == XI_2_Major)
+        {
+            XIDeviceInfo *info = xi2_find_device_info(display, argv[arg_dev]);
+
+            if (!info) {
+                fprintf(stderr, "unable to find device %s\n", argv[arg_dev]);
+                return EXIT_FAILURE;
+            } else {
+                print_info_xi2(display, info, shortformat);
+                return EXIT_SUCCESS;
+            }
+        } else
+#endif
+        {
+            XDeviceInfo *info = find_device_info(display, argv[arg_dev], False);
+
+            if (!info) {
+                fprintf(stderr, "unable to find device %s\n", argv[arg_dev]);
+                return EXIT_FAILURE;
+            } else {
+                print_info(display, info, shortformat);
+                return EXIT_SUCCESS;
+            }
+        }
+    } else {
+#ifdef HAVE_XI2
+        if (xinput_version(display) == XI_2_Major)
+            return list_xi2(display, !longformat);
+#endif
+        return list_xi1(display, !longformat);
+    }
+}
+
+/* end of list.c */
diff --git a/src/property.c b/src/property.c
new file mode 100755 (executable)
index 0000000..f8b21c7
--- /dev/null
@@ -0,0 +1,801 @@
+/*
+ * Copyright 2007 Peter Hutterer
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the author shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization
+ * from the author.
+ *
+ */
+
+#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <X11/Xatom.h>
+#include <X11/extensions/XIproto.h>
+
+#include "xinput.h"
+
+static Atom parse_atom(Display *dpy, char *name) {
+    Bool is_atom = True;
+    int i;
+
+    for (i = 0; name[i] != '\0'; i++) {
+        if (!isdigit(name[i])) {
+            is_atom = False;
+            break;
+        }
+    }
+
+    if (is_atom)
+        return atoi(name);
+    else
+        return XInternAtom(dpy, name, False);
+}
+
+static void
+print_property(Display *dpy, XDevice* dev, Atom property)
+{
+    Atom                act_type;
+    char                *name;
+    int                 act_format;
+    unsigned long       nitems, bytes_after;
+    unsigned char       *data, *ptr;
+    int                 j, done = False, size;
+
+    name = XGetAtomName(dpy, property);
+    printf("\t%s (%ld):\t", name, property);
+
+    if (XGetDeviceProperty(dpy, dev, property, 0, 1000, False,
+                           AnyPropertyType, &act_type, &act_format,
+                           &nitems, &bytes_after, &data) == Success)
+    {
+        Atom float_atom = XInternAtom(dpy, "FLOAT", True);
+
+        ptr = data;
+
+        if (nitems == 0)
+            printf("<no items>");
+
+        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)
+            {
+                case XA_INTEGER:
+                    switch(act_format)
+                    {
+                        case 8:
+                            printf("%d", *((char*)ptr));
+                            break;
+                        case 16:
+                            printf("%d", *((short*)ptr));
+                            break;
+                        case 32:
+                            printf("%ld", *((long*)ptr));
+                            break;
+                    }
+                    break;
+                case XA_STRING:
+                    if (act_format != 8)
+                    {
+                        printf("Unknown string format.\n");
+                        done = True;
+                        break;
+                    }
+                    printf("\"%s\"", ptr);
+                    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:
+                    {
+                        Atom a = *(Atom*)ptr;
+                        printf("\"%s\" (%d)",
+                                (a) ? XGetAtomName(dpy, a) : "None",
+                                (int)a);
+                        break;
+                    }
+                default:
+                    if (float_atom != None && act_type == float_atom)
+                    {
+                        printf("%f", *((float*)ptr));
+                        break;
+                    }
+
+                    printf("\t... of unknown type %s\n",
+                            XGetAtomName(dpy, act_type));
+                    done = True;
+                    break;
+            }
+
+            ptr += size;
+
+            if (done == True)
+                break;
+            if (j < nitems - 1)
+                printf(", ");
+        }
+        printf("\n");
+        XFree(data);
+    } else
+        printf("\tFetch failure\n");
+
+}
+
+static int
+list_props_xi1(Display *dpy, int argc, char** argv, char* name, char *desc)
+{
+    XDeviceInfo *info;
+    XDevice     *dev;
+    int          i;
+    int         nprops;
+    Atom        *props;
+
+    if (argc == 0)
+    {
+        fprintf(stderr, "Usage: xinput %s %s\n", name, desc);
+        return EXIT_FAILURE;
+    }
+
+    for (i = 0; i < argc; i++)
+    {
+        info = find_device_info(dpy, argv[i], False);
+        if (!info)
+        {
+            fprintf(stderr, "unable to find device %s\n", argv[i]);
+            continue;
+        }
+
+        dev = XOpenDevice(dpy, info->id);
+        if (!dev)
+        {
+            fprintf(stderr, "unable to open device '%s'\n", info->name);
+            continue;
+        }
+
+        props = XListDeviceProperties(dpy, dev, &nprops);
+        if (!nprops)
+        {
+            printf("Device '%s' does not report any properties.\n", info->name);
+            continue;
+        }
+
+        printf("Device '%s':\n", info->name);
+        while(nprops--)
+        {
+            print_property(dpy, dev, props[nprops]);
+        }
+
+        XFree(props);
+        XCloseDevice(dpy, dev);
+    }
+    return EXIT_SUCCESS;
+}
+
+
+int watch_props(Display *dpy, int argc, char** argv, char* n, char *desc)
+{
+    XDevice     *dev;
+    XDeviceInfo *info;
+    XEvent      ev;
+    XDevicePropertyNotifyEvent *dpev;
+    char        *name;
+    int         type_prop;
+    XEventClass cls_prop;
+
+    if (list_props(dpy, argc, argv, n, desc) != EXIT_SUCCESS)
+        return EXIT_FAILURE;
+
+    info = find_device_info(dpy, argv[0], False);
+    if (!info)
+    {
+        fprintf(stderr, "unable to find device %s\n", argv[0]);
+        return EXIT_FAILURE;
+    }
+
+    dev = XOpenDevice(dpy, info->id);
+    if (!dev)
+    {
+        fprintf(stderr, "unable to open device '%s'\n", info->name);
+        return EXIT_FAILURE;
+    }
+
+    DevicePropertyNotify(dev, type_prop, cls_prop);
+    XSelectExtensionEvent(dpy, DefaultRootWindow(dpy), &cls_prop, 1);
+
+    while(1)
+    {
+        XNextEvent(dpy, &ev);
+
+        dpev = (XDevicePropertyNotifyEvent*)&ev;
+        if (dpev->type != type_prop)
+            continue;
+
+        name = XGetAtomName(dpy, dpev->atom);
+        printf("Property '%s' changed.\n", name);
+        print_property(dpy, dev, dpev->atom);
+    }
+
+    XCloseDevice(dpy, dev);
+}
+
+static int
+delete_prop_xi1(Display *dpy, int argc, char** argv, char* n, char *desc)
+{
+    XDevice     *dev;
+    XDeviceInfo *info;
+    char        *name;
+    Atom        prop;
+
+    info = find_device_info(dpy, argv[0], False);
+    if (!info)
+    {
+        fprintf(stderr, "unable to find device %s\n", argv[0]);
+        return EXIT_FAILURE;
+    }
+
+    dev = XOpenDevice(dpy, info->id);
+    if (!dev)
+    {
+        fprintf(stderr, "unable to open device '%s'\n", info->name);
+        return EXIT_FAILURE;
+    }
+
+    name = argv[1];
+
+    prop = parse_atom(dpy, name);
+
+    XDeleteDeviceProperty(dpy, dev, prop);
+
+    XCloseDevice(dpy, dev);
+    return EXIT_SUCCESS;
+}
+
+static int
+do_set_prop_xi1(Display *dpy, Atom type, int format, int argc, char **argv, char *n, char *desc)
+{
+    XDeviceInfo  *info;
+    XDevice      *dev;
+    Atom          prop;
+    Atom          old_type;
+    char         *name;
+    int           i;
+    Atom          float_atom;
+    int           old_format, nelements = 0;
+    unsigned long act_nitems, bytes_after;
+    char         *endptr;
+    union {
+        unsigned char *c;
+        short *s;
+        long *l;
+        Atom *a;
+    } data;
+
+    if (argc < 3)
+    {
+        fprintf(stderr, "Usage: xinput %s %s\n", n, desc);
+        return EXIT_FAILURE;
+    }
+
+    info = find_device_info(dpy, argv[0], False);
+    if (!info)
+    {
+        fprintf(stderr, "unable to find device %s\n", argv[0]);
+        return EXIT_FAILURE;
+    }
+
+    dev = XOpenDevice(dpy, info->id);
+    if (!dev)
+    {
+        fprintf(stderr, "unable to open device %s\n", argv[0]);
+        return EXIT_FAILURE;
+    }
+
+    name = argv[1];
+
+    prop = parse_atom(dpy, name);
+
+    if (prop == None) {
+        fprintf(stderr, "invalid property %s\n", name);
+        return EXIT_FAILURE;
+    }
+
+    float_atom = XInternAtom(dpy, "FLOAT", False);
+
+    nelements = argc - 2;
+    if (type == None || format == 0) {
+        if (XGetDeviceProperty(dpy, dev, prop, 0, 0, False, AnyPropertyType,
+                               &old_type, &old_format, &act_nitems,
+                               &bytes_after, &data.c) != Success) {
+            fprintf(stderr, "failed to get property type and format for %s\n",
+                    name);
+            return EXIT_FAILURE;
+        } else {
+            if (type == None)
+                type = old_type;
+            if (format == 0)
+                format = old_format;
+        }
+
+        XFree(data.c);
+    }
+
+    if (type == None) {
+        fprintf(stderr, "property %s doesn't exist, you need to specify "
+                "its type and format\n", name);
+        return EXIT_FAILURE;
+    }
+
+    data.c = calloc(nelements, sizeof(long));
+
+    for (i = 0; i < nelements; i++)
+    {
+        if (type == XA_INTEGER) {
+            switch (format)
+            {
+                case 8:
+                    data.c[i] = atoi(argv[2 + i]);
+                    break;
+                case 16:
+                    data.s[i] = atoi(argv[2 + i]);
+                    break;
+                case 32:
+                    data.l[i] = atoi(argv[2 + i]);
+                    break;
+                default:
+                    fprintf(stderr, "unexpected size for property %s", name);
+                    return EXIT_FAILURE;
+            }
+        } else if (type == float_atom) {
+            if (format != 32) {
+                fprintf(stderr, "unexpected format %d for property %s\n",
+                        format, name);
+                return EXIT_FAILURE;
+            }
+            *(float *)(data.l + 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;
+            }
+        } else if (type == XA_ATOM) {
+            if (format != 32) {
+                fprintf(stderr, "unexpected format %d for property %s\n",
+                        format, name);
+                return EXIT_FAILURE;
+            }
+            data.a[i] = parse_atom(dpy, argv[2 + i]);
+        } else {
+            fprintf(stderr, "unexpected type for property %s\n", name);
+            return EXIT_FAILURE;
+        }
+    }
+
+    XChangeDeviceProperty(dpy, dev, prop, type, format, PropModeReplace,
+                          data.c, nelements);
+    free(data.c);
+    XCloseDevice(dpy, dev);
+    return EXIT_SUCCESS;
+}
+
+#if HAVE_XI2
+static void
+print_property_xi2(Display *dpy, int deviceid, Atom property)
+{
+    Atom                act_type;
+    char                *name;
+    int                 act_format;
+    unsigned long       nitems, bytes_after;
+    unsigned char       *data, *ptr;
+    int                 j, done = False;
+
+    name = XGetAtomName(dpy, property);
+    printf("\t%s (%ld):\t", name, property);
+
+    if (XIGetProperty(dpy, deviceid, property, 0, 1000, False,
+                           AnyPropertyType, &act_type, &act_format,
+                           &nitems, &bytes_after, &data) == Success)
+    {
+        Atom float_atom = XInternAtom(dpy, "FLOAT", True);
+
+        ptr = data;
+
+        if (nitems == 0)
+            printf("<no items>");
+
+        for (j = 0; j < nitems; j++)
+        {
+            switch(act_type)
+            {
+                case XA_INTEGER:
+                    switch(act_format)
+                    {
+                        case 8:
+                            printf("%d", *((int8_t*)ptr));
+                            break;
+                        case 16:
+                            printf("%d", *((int16_t*)ptr));
+                            break;
+                        case 32:
+                            printf("%d", *((int32_t*)ptr));
+                            break;
+                    }
+                    break;
+                case XA_STRING:
+                    if (act_format != 8)
+                    {
+                        printf("Unknown string format.\n");
+                        done = True;
+                        break;
+                    }
+                    printf("\"%s\"", ptr);
+                    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:
+                    {
+                        Atom a = *(uint32_t*)ptr;
+                        printf("\"%s\" (%ld)",
+                                (a) ? XGetAtomName(dpy, a) : "None",
+                                a);
+                        break;
+                    }
+                    break;
+                default:
+                    if (float_atom != None && act_type == float_atom)
+                    {
+                        printf("%f", *((float*)ptr));
+                        break;
+                    }
+
+                    printf("\t... of unknown type %s\n",
+                            XGetAtomName(dpy, act_type));
+                    done = True;
+                    break;
+            }
+
+            ptr += act_format/8;
+
+            if (done == True)
+                break;
+            if (j < nitems - 1)
+                printf(", ");
+        }
+        printf("\n");
+        XFree(data);
+    } else
+        printf("\tFetch failure\n");
+
+}
+
+static int
+list_props_xi2(Display *dpy, int argc, char** argv, char* name, char *desc)
+{
+    XIDeviceInfo *info;
+    int         i;
+    int         nprops;
+    Atom        *props;
+
+    if (argc == 0)
+    {
+        fprintf(stderr, "Usage: xinput %s %s\n", name, desc);
+        return EXIT_FAILURE;
+    }
+
+    for (i = 0; i < argc; i++)
+    {
+        info = xi2_find_device_info(dpy, argv[i]);
+        if (!info)
+        {
+            fprintf(stderr, "unable to find device %s\n", argv[i]);
+            continue;
+        }
+
+        props = XIListProperties(dpy, info->deviceid, &nprops);
+        if (!nprops)
+        {
+            printf("Device '%s' does not report any properties.\n", info->name);
+            continue;
+        }
+
+        printf("Device '%s':\n", info->name);
+        while(nprops--)
+        {
+            print_property_xi2(dpy, info->deviceid, props[nprops]);
+        }
+
+        XFree(props);
+    }
+    return EXIT_SUCCESS;
+}
+
+static int
+delete_prop_xi2(Display *dpy, int argc, char** argv, char* n, char *desc)
+{
+    XIDeviceInfo *info;
+    char        *name;
+    Atom        prop;
+
+    info = xi2_find_device_info(dpy, argv[0]);
+    if (!info)
+    {
+        fprintf(stderr, "unable to find device %s\n", argv[0]);
+        return EXIT_FAILURE;
+    }
+
+    name = argv[1];
+
+    prop = parse_atom(dpy, name);
+
+    XIDeleteProperty(dpy, info->deviceid, prop);
+
+    return EXIT_SUCCESS;
+}
+
+static int
+do_set_prop_xi2(Display *dpy, Atom type, int format, int argc, char **argv, char *n, char *desc)
+{
+    XIDeviceInfo *info;
+    Atom          prop;
+    Atom          old_type;
+    char         *name;
+    int           i;
+    Atom          float_atom;
+    int           old_format, nelements = 0;
+    unsigned long act_nitems, bytes_after;
+    char         *endptr;
+    union {
+        unsigned char *c;
+        int16_t *s;
+        int32_t *l;
+    } data;
+
+    if (argc < 3)
+    {
+        fprintf(stderr, "Usage: xinput %s %s\n", n, desc);
+        return EXIT_FAILURE;
+    }
+
+    info = xi2_find_device_info(dpy, argv[0]);
+    if (!info)
+    {
+        fprintf(stderr, "unable to find device %s\n", argv[0]);
+        return EXIT_FAILURE;
+    }
+
+    name = argv[1];
+
+    prop = parse_atom(dpy, name);
+
+    if (prop == None) {
+        fprintf(stderr, "invalid property %s\n", name);
+        return EXIT_FAILURE;
+    }
+
+    float_atom = XInternAtom(dpy, "FLOAT", False);
+
+    nelements = argc - 2;
+    if (type == None || format == 0) {
+        if (XIGetProperty(dpy, info->deviceid, prop, 0, 0, False,
+                          AnyPropertyType, &old_type, &old_format, &act_nitems,
+                          &bytes_after, &data.c) != Success) {
+            fprintf(stderr, "failed to get property type and format for %s\n",
+                    name);
+            return EXIT_FAILURE;
+        } else {
+            if (type == None)
+                type = old_type;
+            if (format == 0)
+                format = old_format;
+        }
+
+        XFree(data.c);
+    }
+
+    if (type == None) {
+        fprintf(stderr, "property %s doesn't exist, you need to specify "
+                "its type and format\n", name);
+        return EXIT_FAILURE;
+    }
+
+    data.c = calloc(nelements, sizeof(int32_t));
+
+    for (i = 0; i < nelements; i++)
+    {
+        if (type == XA_INTEGER) {
+            switch (format)
+            {
+                case 8:
+                    data.c[i] = atoi(argv[2 + i]);
+                    break;
+                case 16:
+                    data.s[i] = atoi(argv[2 + i]);
+                    break;
+                case 32:
+                    data.l[i] = atoi(argv[2 + i]);
+                    break;
+                default:
+                    fprintf(stderr, "unexpected size for property %s", name);
+                    return EXIT_FAILURE;
+            }
+        } else if (type == float_atom) {
+            if (format != 32) {
+                fprintf(stderr, "unexpected format %d for property %s\n",
+                        format, name);
+                return EXIT_FAILURE;
+            }
+            *(float *)(data.l + 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;
+            }
+        } else if (type == XA_ATOM) {
+            if (format != 32) {
+                fprintf(stderr, "unexpected format %d for property %s\n",
+                        format, name);
+                return EXIT_FAILURE;
+            }
+            data.l[i] = parse_atom(dpy, argv[2 + i]);
+        } else {
+            fprintf(stderr, "unexpected type for property %s\n", name);
+            return EXIT_FAILURE;
+        }
+    }
+
+    XIChangeProperty(dpy, info->deviceid, prop, type, format, PropModeReplace,
+                          data.c, nelements);
+    free(data.c);
+    return EXIT_SUCCESS;
+}
+#endif
+
+int list_props(Display *display, int argc, char *argv[], char *name,
+               char *desc)
+{
+#ifdef HAVE_XI2
+    if (xinput_version(display) == XI_2_Major)
+        return list_props_xi2(display, argc, argv, name, desc);
+#endif
+    return list_props_xi1(display, argc, argv, name, desc);
+
+}
+
+int delete_prop(Display *display, int argc, char *argv[], char *name,
+                char *desc)
+{
+#ifdef HAVE_XI2
+    if (xinput_version(display) == XI_2_Major)
+        return delete_prop_xi2(display, argc, argv, name, desc);
+#endif
+    return delete_prop_xi1(display, argc, argv, name, desc);
+
+}
+
+static int
+do_set_prop(Display *display, Atom type, int format, int argc, char *argv[], char *name, char *desc)
+{
+#ifdef HAVE_XI2
+    if (xinput_version(display) == XI_2_Major)
+        return do_set_prop_xi2(display, type, format, argc, argv, name, desc);
+#endif
+    return do_set_prop_xi1(display, type, format, argc, argv, name, desc);
+}
+
+int
+set_atom_prop(Display *dpy, int argc, char** argv, char* n, char *desc)
+{
+    return do_set_prop(dpy, XA_ATOM, 32, argc, argv, n, desc);
+}
+
+int
+set_int_prop(Display *dpy, int argc, char** argv, char* n, char *desc)
+{
+    int          i;
+    int          format;
+
+    if (argc < 3)
+    {
+        fprintf(stderr, "Usage: xinput %s %s\n", n, desc);
+        return EXIT_FAILURE;
+    }
+
+    format    = atoi(argv[2]);
+    if (format != 8 && format != 16 && format != 32)
+    {
+        fprintf(stderr, "Invalid format %d\n", format);
+        return EXIT_FAILURE;
+    }
+
+    for (i = 3; i < argc; i++)
+        argv[i - 1] = argv[i];
+
+    return do_set_prop(dpy, XA_INTEGER, format, argc - 1, argv, n, desc);
+}
+
+int
+set_float_prop(Display *dpy, int argc, char** argv, char* n, char *desc)
+{
+    Atom float_atom = XInternAtom(dpy, "FLOAT", False);
+
+    if (sizeof(float) != 4)
+    {
+       fprintf(stderr, "sane FP required\n");
+       return EXIT_FAILURE;
+    }
+
+    return do_set_prop(dpy, float_atom, 32, argc, argv, n, desc);
+}
+
+int set_prop(Display *display, int argc, char *argv[], char *name,
+             char *desc)
+{
+    Atom type = None;
+    int format = 0;
+    int i = 0, j;
+
+    while (i < argc) {
+        char *option = strchr(argv[i], '=');
+        /* skip non-option arguments */
+        if (strncmp(argv[i], "--", 2) || !option) {
+            i++;
+            continue;
+        }
+
+        if (!strncmp(argv[i], "--type=", strlen("--type="))) {
+            if (!strcmp(option + 1, "int")) {
+                type = XA_INTEGER;
+            } else if (!strcmp(option + 1, "float")) {
+                type = XInternAtom(display, "FLOAT", False);
+                format = 32;
+            } else if (!strcmp(option + 1, "atom")) {
+                type = XA_ATOM;
+                format = 32;
+            } else {
+                fprintf(stderr, "unknown property type %s\n", option + 1);
+                return EXIT_FAILURE;
+            }
+        } else if (!strncmp(argv[i], "--format=", strlen("--format="))) {
+            format = atoi(option + 1);
+            if (format != 8 && format != 16 && format != 32) {
+                fprintf(stderr, "invalid property format %s\n", option + 1);
+                return EXIT_FAILURE;
+            }
+        } else {
+            fprintf(stderr, "invalid option %s\n", argv[i]);
+            return EXIT_FAILURE;
+        }
+
+        for (j = i; j + 1 < argc; j++)
+            argv[j] = argv[j + 1];
+        argc--;
+    }
+
+    return do_set_prop(display, type, format, argc, argv, name, desc);
+}
diff --git a/src/setcp.c b/src/setcp.c
new file mode 100644 (file)
index 0000000..7a28644
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2007 Peter Hutterer <peter@cs.unisa.edu.au>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the author shall
+ * not be used in advertising or otherwise to promote the sale, use or
+ * other dealings in this Software without prior written authorization
+ * from the author.
+ *
+ */
+
+
+#include "xinput.h"
+#include <string.h>
+
+int
+set_clientpointer(Display* dpy, int argc, char** argv, char* name, char *desc)
+{
+    XIDeviceInfo *info;
+    XID window;
+    char* id;
+    char* dummy;
+
+    if (argc <= 1)
+    {
+        fprintf(stderr, "Usage: xinput %s %s\n", name, desc);
+        return EXIT_FAILURE;
+    }
+
+    id = argv[0];
+
+    while(*id == '0') id++;
+
+    window = strtol(argv[0], &dummy, (*id == 'x') ? 16 : 10);
+
+    info = xi2_find_device_info(dpy, argv[1]);
+
+    if (!info) {
+       fprintf(stderr, "unable to find device %s\n", argv[1]);
+       return EXIT_FAILURE;
+    }
+
+    XISetClientPointer(dpy, window, info->deviceid);
+    return 0;
+}
diff --git a/src/setint.c b/src/setint.c
new file mode 100644 (file)
index 0000000..7e7870a
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is  hereby granted without fee, provided that
+ * the  above copyright   notice appear  in   all  copies and  that both  that
+ * copyright  notice   and   this  permission   notice  appear  in  supporting
+ * documentation, and that   the  name of  the authors  not  be  used  in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific,  written      prior  permission.     The authors  make  no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
+ * EVENT  SHALL THE AUTHORS  BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
+ * TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include "xinput.h"
+
+int
+set_integer_feedback(Display   *display,
+                    int        argc,
+                    char       *argv[],
+                    char       *name,
+                    char       *desc)
+{
+    XDeviceInfo                        *info;
+    XDevice                    *device;
+    XIntegerFeedbackControl    control;
+
+    if (argc != 3) {
+       fprintf(stderr, "usage: xinput %s %s\n", name, desc);
+       return EXIT_FAILURE;
+    }
+
+    control.class = IntegerFeedbackClass;
+    control.length = sizeof(XIntegerFeedbackControl);
+    control.id = atoi(argv[1]);
+    control.int_to_display = atoi(argv[2]);
+
+    info = find_device_info(display, argv[0], True);
+
+    if (!info) {
+       fprintf(stderr, "unable to find device %s\n", argv[0]);
+       return EXIT_FAILURE;
+    }
+
+    device = XOpenDevice(display, info->id);
+
+    if (device) {
+       XChangeFeedbackControl(display, device, DvInteger, (XFeedbackControl *) &control);
+
+       return EXIT_SUCCESS;
+    } else {
+       fprintf(stderr, "Unable to open device\n");
+       return EXIT_FAILURE;
+    }
+}
+
+/* end of setint.c */
diff --git a/src/setmode.c b/src/setmode.c
new file mode 100755 (executable)
index 0000000..6812fdf
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is  hereby granted without fee, provided that
+ * the  above copyright   notice appear  in   all  copies and  that both  that
+ * copyright  notice   and   this  permission   notice  appear  in  supporting
+ * documentation, and that   the  name of  the authors  not  be  used  in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific,  written      prior  permission.     The authors  make  no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
+ * EVENT  SHALL THE AUTHORS  BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
+ * TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include "xinput.h"
+#include <string.h>
+
+int
+set_mode(Display       *display,
+        int            argc,
+        char           *argv[],
+        char           *name,
+        char           *desc)
+{
+    XDeviceInfo                *info;
+    XDevice            *device;
+    int                        mode;
+
+    if (argc != 2) {
+       fprintf(stderr, "usage: xinput %s %s\n", name, desc);
+       return EXIT_FAILURE;
+    }
+
+    info = find_device_info(display, argv[0], True);
+
+    if (!info) {
+       fprintf(stderr, "unable to find device %s\n", argv[0]);
+       return EXIT_FAILURE;
+    }
+
+    if (strcmp(argv[1], "ABSOLUTE") == 0) {
+       mode = Absolute;
+    } else if (strcmp(argv[1], "RELATIVE") == 0) {
+       mode = Relative;
+    } else {
+       fprintf(stderr, "Invalid mode, use ABSOLUTE or RELATIVE.\n");
+       return EXIT_FAILURE;
+    }
+
+    device = XOpenDevice(display, info->id);
+
+    if (device) {
+       XSetDeviceMode(display, device, mode);
+
+       return EXIT_SUCCESS;
+    } else {
+       fprintf(stderr, "Unable to open device\n");
+       return EXIT_FAILURE;
+    }
+}
+
+/* end of setmode.c */
diff --git a/src/setptr.c b/src/setptr.c
new file mode 100644 (file)
index 0000000..f6f9410
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is  hereby granted without fee, provided that
+ * the  above copyright   notice appear  in   all  copies and  that both  that
+ * copyright  notice   and   this  permission   notice  appear  in  supporting
+ * documentation, and that   the  name of  the authors  not  be  used  in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific,  written      prior  permission.     The authors  make  no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
+ * EVENT  SHALL THE AUTHORS  BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
+ * TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include "xinput.h"
+
+int
+set_pointer(Display    *display,
+           int         argc,
+           char        *argv[],
+           char        *name,
+           char        *desc)
+{
+    XDeviceInfo                *info;
+    XDevice            *device;
+    int                        xaxis = 0;
+    int                        yaxis = 1;
+
+    if ((argc != 1) && (argc != 3)) {
+       fprintf(stderr, "usage: xinput %s %s\n", name, desc);
+       return EXIT_FAILURE;
+    }
+
+    if (argc == 3) {
+       xaxis = atoi(argv[1]);
+       yaxis = atoi(argv[2]);
+    }
+
+    info = find_device_info(display, argv[0], True);
+
+    if (!info) {
+       fprintf(stderr, "unable to find device %s\n", argv[0]);
+       return EXIT_FAILURE;
+    }
+
+    device = XOpenDevice(display, info->id);
+
+    if (device) {
+       XChangePointerDevice(display, device, xaxis, yaxis);
+
+       return EXIT_SUCCESS;
+    } else {
+       fprintf(stderr, "Unable to open device\n");
+       return EXIT_FAILURE;
+    }
+}
+
+/* end of setptr.c */
diff --git a/src/state.c b/src/state.c
new file mode 100644 (file)
index 0000000..8b800cb
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Copyright 1996-1997 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is  hereby granted without fee, provided that
+ * the  above copyright   notice appear  in   all  copies and  that both  that
+ * copyright  notice   and   this  permission   notice  appear  in  supporting
+ * documentation, and that   the  name of  the authors  not  be  used  in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific,  written      prior  permission.     The authors  make  no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
+ * EVENT  SHALL THE AUTHORS  BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
+ * TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include "xinput.h"
+
+int
+query_state(Display    *display,
+           int         argc,
+           char        *argv[],
+           char        *name,
+           char        *desc)
+{
+    XDeviceInfo                *info;
+    XDevice            *device;
+    XDeviceState       *state;
+    int                        loop;
+    int                        loop2;
+    XInputClass                *cls;
+    XValuatorState     *val_state;
+    XKeyState          *key_state;
+    XButtonState       *but_state;
+
+    if (argc != 1) {
+       fprintf(stderr, "usage: xinput %s %s\n", name, desc);
+       return 1;
+    }
+
+    info = find_device_info(display, argv[0], True);
+
+    if (!info) {
+       fprintf(stderr, "unable to find device %s\n", argv[0]);
+       return 1;
+    }
+
+    device = XOpenDevice(display, info->id);
+
+    if (!device) {
+       fprintf(stderr, "unable to open device %s\n", argv[0]);
+       return 1;
+    }
+
+    state = XQueryDeviceState(display, device);
+
+    if (state) {
+        cls = state->data;
+       printf("%d class%s :\n", state->num_classes,
+              (state->num_classes > 1) ? "es" : "");
+       for(loop=0; loop<state->num_classes; loop++) {
+         switch(cls->class) {
+         case ValuatorClass:
+           val_state = (XValuatorState *) cls;
+           printf("ValuatorClass Mode=%s Proximity=%s\n",
+                  val_state->mode & 1 ? "Absolute" : "Relative",
+                  val_state->mode & 2 ? "Out" : "In");
+           for(loop2=0; loop2<val_state->num_valuators; loop2++) {
+             printf("\tvaluator[%d]=%d\n", loop2, val_state->valuators[loop2]);
+           }
+           break;
+
+         case ButtonClass:
+           but_state = (XButtonState *) cls;
+           printf("ButtonClass\n");
+           for(loop2=1; loop2<=but_state->num_buttons; loop2++) {
+             printf("\tbutton[%d]=%s\n", loop2,
+                    (but_state->buttons[loop2 / 8] & (1 << (loop2 % 8))) ? "down" : "up" );
+           }
+           break;
+
+         case KeyClass:
+           key_state = (XKeyState *) cls;
+           printf("KeyClass\n");
+           for(loop2=0; loop2<key_state->num_keys; loop2++) {
+             printf("\tkey[%d]=%s\n", loop2,
+                    (key_state->keys[loop2 / 8] & (1 << (loop2 % 8))) ? "down" : "up" );
+           }
+
+           break;
+
+         }
+         cls = (XInputClass *) ((char *) cls + cls->length);
+       }
+       XFreeDeviceState(state);
+    }
+    return EXIT_SUCCESS;
+}
+
+/* end of state.c */
diff --git a/src/test.c b/src/test.c
new file mode 100644 (file)
index 0000000..4e2c2e6
--- /dev/null
@@ -0,0 +1,199 @@
+/*
+ * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is  hereby granted without fee, provided that
+ * the  above copyright   notice appear  in   all  copies and  that both  that
+ * copyright  notice   and   this  permission   notice  appear  in  supporting
+ * documentation, and that   the  name of  the authors  not  be  used  in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific,  written      prior  permission.     The authors  make  no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
+ * EVENT  SHALL THE AUTHORS  BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
+ * TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include "xinput.h"
+#include <string.h>
+
+#define INVALID_EVENT_TYPE     -1
+
+static int           motion_type = INVALID_EVENT_TYPE;
+static int           button_press_type = INVALID_EVENT_TYPE;
+static int           button_release_type = INVALID_EVENT_TYPE;
+static int           key_press_type = INVALID_EVENT_TYPE;
+static int           key_release_type = INVALID_EVENT_TYPE;
+static int           proximity_in_type = INVALID_EVENT_TYPE;
+static int           proximity_out_type = INVALID_EVENT_TYPE;
+
+static int
+register_events(Display                *dpy,
+               XDeviceInfo     *info,
+               char            *dev_name,
+               Bool            handle_proximity)
+{
+    int                        number = 0;     /* number of events registered */
+    XEventClass                event_list[7];
+    int                        i;
+    XDevice            *device;
+    Window             root_win;
+    unsigned long      screen;
+    XInputClassInfo    *ip;
+
+    screen = DefaultScreen(dpy);
+    root_win = RootWindow(dpy, screen);
+
+    device = XOpenDevice(dpy, info->id);
+
+    if (!device) {
+       fprintf(stderr, "unable to open device %s\n", dev_name);
+       return 0;
+    }
+
+    if (device->num_classes > 0) {
+       for (ip = device->classes, i=0; i<info->num_classes; ip++, i++) {
+           switch (ip->input_class) {
+           case KeyClass:
+               DeviceKeyPress(device, key_press_type, event_list[number]); number++;
+               DeviceKeyRelease(device, key_release_type, event_list[number]); number++;
+               break;
+
+           case ButtonClass:
+               DeviceButtonPress(device, button_press_type, event_list[number]); number++;
+               DeviceButtonRelease(device, button_release_type, event_list[number]); number++;
+               break;
+
+           case ValuatorClass:
+               DeviceMotionNotify(device, motion_type, event_list[number]); number++;
+               if (handle_proximity) {
+                   ProximityIn(device, proximity_in_type, event_list[number]); number++;
+                   ProximityOut(device, proximity_out_type, event_list[number]); number++;
+               }
+               break;
+
+           default:
+               fprintf(stderr, "unknown class\n");
+               break;
+           }
+       }
+
+       if (XSelectExtensionEvent(dpy, root_win, event_list, number)) {
+           fprintf(stderr, "error selecting extended events\n");
+           return 0;
+       }
+    }
+    return number;
+}
+
+static void
+print_events(Display   *dpy)
+{
+    XEvent        Event;
+
+    while(1) {
+       XNextEvent(dpy, &Event);
+
+       if (Event.type == motion_type) {
+           int loop;
+           XDeviceMotionEvent *motion = (XDeviceMotionEvent *) &Event;
+
+           printf("motion ");
+
+           for(loop=0; loop<motion->axes_count; loop++) {
+               printf("a[%d]=%d ", motion->first_axis + loop, motion->axis_data[loop]);
+           }
+           printf("\n");
+       } else if ((Event.type == button_press_type) ||
+                  (Event.type == button_release_type)) {
+           int loop;
+           XDeviceButtonEvent *button = (XDeviceButtonEvent *) &Event;
+
+           printf("button %s %d ", (Event.type == button_release_type) ? "release" : "press  ",
+                  button->button);
+
+           for(loop=0; loop<button->axes_count; loop++) {
+               printf("a[%d]=%d ", button->first_axis + loop, button->axis_data[loop]);
+           }
+           printf("\n");
+       } else if ((Event.type == key_press_type) ||
+                  (Event.type == key_release_type)) {
+           int loop;
+           XDeviceKeyEvent *key = (XDeviceKeyEvent *) &Event;
+
+           printf("key %s %d ", (Event.type == key_release_type) ? "release" : "press  ",
+                  key->keycode);
+
+           for(loop=0; loop<key->axes_count; loop++) {
+               printf("a[%d]=%d ", key->first_axis + loop, key->axis_data[loop]);
+           }
+           printf("\n");
+       } else if ((Event.type == proximity_out_type) ||
+                  (Event.type == proximity_in_type)) {
+           int loop;
+           XProximityNotifyEvent *prox = (XProximityNotifyEvent *) &Event;
+
+           printf("proximity %s ", (Event.type == proximity_in_type) ? "in " : "out");
+
+           for(loop=0; loop<prox->axes_count; loop++) {
+               printf("a[%d]=%d ", prox->first_axis + loop, prox->axis_data[loop]);
+           }
+           printf("\n");
+       }
+       else {
+           printf("what's that %d\n", Event.type);
+       }
+    }
+}
+
+int
+test(Display   *display,
+     int       argc,
+     char      *argv[],
+     char      *name,
+     char      *desc)
+{
+    XDeviceInfo                *info;
+
+    if (argc != 1 && argc != 2) {
+       fprintf(stderr, "usage: xinput %s %s\n", name, desc);
+       return EXIT_FAILURE;
+    } else {
+       Bool    handle_proximity = False;
+       int     idx = 0;
+
+       if (argc == 2) {
+           if (strcmp("-proximity", argv[0]) != 0) {
+               fprintf(stderr, "usage: xinput %s %s\n", name, desc);
+               return EXIT_FAILURE;
+           }
+           handle_proximity = 1;
+           idx = 1;
+       }
+
+       info = find_device_info(display, argv[idx], True);
+
+       if (!info) {
+           fprintf(stderr, "unable to find device %s\n", argv[idx]);
+           return EXIT_FAILURE;
+       } else {
+           if (register_events(display, info, argv[idx], handle_proximity)) {
+               print_events(display);
+           }
+           else {
+               fprintf(stderr, "no event registered...\n");
+               return EXIT_FAILURE;
+           }
+       }
+    }
+    return EXIT_FAILURE;
+}
+
+/* end of test.c */
diff --git a/src/test_xi2.c b/src/test_xi2.c
new file mode 100755 (executable)
index 0000000..c59ba26
--- /dev/null
@@ -0,0 +1,409 @@
+/*
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+
+#include "xinput.h"
+#include <string.h>
+
+extern void print_classes_xi2(Display*, XIAnyClassInfo **classes,
+                              int num_classes);
+
+static Window create_win(Display *dpy)
+{
+    Window win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 200,
+            200, 0, 0, WhitePixel(dpy, 0));
+    Window subwindow = XCreateSimpleWindow(dpy, win, 50, 50, 50, 50, 0, 0,
+            BlackPixel(dpy, 0));
+
+    XMapWindow(dpy, subwindow);
+    XSelectInput(dpy, win, ExposureMask);
+    return win;
+}
+
+static void print_deviceevent(XIDeviceEvent* event)
+{
+    double *val;
+    int i;
+
+    printf("    device: %d (%d)\n", event->deviceid, event->sourceid);
+    printf("    detail: %d\n", event->detail);
+    printf("    flags: %s\n", (event->flags & XIKeyRepeat) ? "repeat" : "");
+
+    printf("    root: %.2f/%.2f\n", event->root_x, event->root_y);
+    printf("    event: %.2f/%.2f\n", event->event_x, event->event_y);
+
+    printf("    buttons:");
+    for (i = 0; i < event->buttons.mask_len * 8; i++)
+        if (XIMaskIsSet(event->buttons.mask, i))
+            printf(" %d", i);
+    printf("\n");
+
+    printf("    modifiers: locked %#x latched %#x base %#x effective: %#x\n",
+            event->mods.locked, event->mods.latched,
+            event->mods.base, event->mods.effective);
+    printf("    group: locked %#x latched %#x base %#x effective: %#x\n",
+            event->group.locked, event->group.latched,
+            event->group.base, event->group.effective);
+    printf("    valuators:\n");
+
+    val = event->valuators.values;
+    for (i = 0; i < event->valuators.mask_len * 8; i++)
+        if (XIMaskIsSet(event->valuators.mask, i))
+            printf("        %i: %.2f\n", i, *val++);
+
+    printf("    windows: root 0x%lx event 0x%lx child 0x%ld\n",
+            event->root, event->event, event->child);
+}
+
+static void print_devicechangedevent(Display *dpy, XIDeviceChangedEvent *event)
+{
+    printf("    device: %d (%d)\n", event->deviceid, event->sourceid);
+    printf("    reason: %s\n", (event->reason == XISlaveSwitch) ? "SlaveSwitch" :
+                                "DeviceChanged");
+    print_classes_xi2(dpy, event->classes, event->num_classes);
+}
+
+static void print_hierarchychangedevent(XIHierarchyEvent *event)
+{
+    int i;
+    printf("    Changes happened: %s %s %s %s %s %s %s %s\n",
+            (event->flags & XIMasterAdded) ? "[new master]" : "",
+            (event->flags & XIMasterRemoved) ? "[master removed]" : "",
+            (event->flags & XISlaveAdded) ? "[new slave]" : "",
+            (event->flags & XISlaveRemoved) ? "[slave removed]" : "",
+            (event->flags & XISlaveAttached) ? "[slave attached]" : "",
+            (event->flags & XISlaveDetached) ? "[slave detached]" : "",
+            (event->flags & XIDeviceEnabled) ? "[device enabled]" : "",
+            (event->flags & XIDeviceDisabled) ? "[device disabled]" : "");
+
+    for (i = 0; i < event->num_info; i++)
+    {
+        char *use;
+        switch(event->info[i].use)
+        {
+            case XIMasterPointer: use = "master pointer"; break;
+            case XIMasterKeyboard: use = "master keyboard"; break;
+            case XISlavePointer: use = "slave pointer"; break;
+            case XISlaveKeyboard: use = "slave keyboard"; break;
+            case XIFloatingSlave: use = "floating slave"; break;
+                break;
+        }
+
+        printf("    device %d [%s (%d)] is %s\n",
+                event->info[i].deviceid,
+                use,
+                event->info[i].attachment,
+                (event->info[i].enabled) ? "enabled" : "disabled");
+        if (event->info[i].flags)
+        {
+            printf("    changes: %s %s %s %s %s %s %s %s\n",
+                    (event->info[i].flags & XIMasterAdded) ? "[new master]" : "",
+                    (event->info[i].flags & XIMasterRemoved) ? "[master removed]" : "",
+                    (event->info[i].flags & XISlaveAdded) ? "[new slave]" : "",
+                    (event->info[i].flags & XISlaveRemoved) ? "[slave removed]" : "",
+                    (event->info[i].flags & XISlaveAttached) ? "[slave attached]" : "",
+                    (event->info[i].flags & XISlaveDetached) ? "[slave detached]" : "",
+                    (event->info[i].flags & XIDeviceEnabled) ? "[device enabled]" : "",
+                    (event->info[i].flags & XIDeviceDisabled) ? "[device disabled]" : "");
+        }
+    }
+}
+
+static void print_rawevent(XIRawEvent *event)
+{
+    int i;
+    double *val, *raw_val;
+
+    printf("    device: %d\n", event->deviceid);
+    printf("    detail: %d\n", event->detail);
+    printf("    valuators:\n");
+
+    val = event->valuators.values;
+    raw_val = event->raw_values;
+    for (i = 0; i < event->valuators.mask_len * 8; i++)
+        if (XIMaskIsSet(event->valuators.mask, i))
+            printf("         %2d: %.2f (%.2f)\n", i, *val++, *raw_val++);
+    printf("\n");
+}
+
+static void print_enterleave(XILeaveEvent* event)
+{
+    char *mode, *detail;
+    int i;
+
+    printf("    device: %d (%d)\n", event->deviceid, event->sourceid);
+    printf("    windows: root 0x%lx event 0x%lx child 0x%ld\n",
+            event->root, event->event, event->child);
+    switch(event->mode)
+    {
+        case XINotifyNormal:       mode = "NotifyNormal"; break;
+        case XINotifyGrab:         mode = "NotifyGrab"; break;
+        case XINotifyUngrab:       mode = "NotifyUngrab"; break;
+        case XINotifyWhileGrabbed: mode = "NotifyWhileGrabbed"; break;
+        case XINotifyPassiveGrab:  mode = "NotifyPassiveGrab"; break;
+        case XINotifyPassiveUngrab:mode = "NotifyPassiveUngrab"; break;
+    }
+    switch (event->detail)
+    {
+        case XINotifyAncestor: detail = "NotifyAncestor"; break;
+        case XINotifyVirtual: detail = "NotifyVirtual"; break;
+        case XINotifyInferior: detail = "NotifyInferior"; break;
+        case XINotifyNonlinear: detail = "NotifyNonlinear"; break;
+        case XINotifyNonlinearVirtual: detail = "NotifyNonlinearVirtual"; break;
+        case XINotifyPointer: detail = "NotifyPointer"; break;
+        case XINotifyPointerRoot: detail = "NotifyPointerRoot"; break;
+        case XINotifyDetailNone: detail = "NotifyDetailNone"; break;
+    }
+    printf("    mode: %s (detail %s)\n", mode, detail);
+    printf("    flags: %s %s\n", event->focus ? "[focus]" : "",
+                                 event->same_screen ? "[same screen]" : "");
+    printf("    buttons:");
+    for (i = 0; i < event->buttons.mask_len * 8; i++)
+        if (XIMaskIsSet(event->buttons.mask, i))
+            printf(" %d", i);
+    printf("\n");
+
+    printf("    modifiers: locked %#x latched %#x base %#x effective: %#x\n",
+            event->mods.locked, event->mods.latched,
+            event->mods.base, event->mods.effective);
+    printf("    group: locked %#x latched %#x base %#x effective: %#x\n",
+            event->group.locked, event->group.latched,
+            event->group.base, event->group.effective);
+
+    printf("    root x/y:  %.2f / %.2f\n", event->root_x, event->root_y);
+    printf("    event x/y: %.2f / %.2f\n", event->event_x, event->event_y);
+
+}
+
+static void print_propertyevent(Display *display, XIPropertyEvent* event)
+{
+    char *changed;
+    char *name;
+
+    if (event->what == XIPropertyDeleted)
+        changed = "deleted";
+    else if (event->what == XIPropertyCreated)
+        changed = "created";
+    else
+        changed = "modified";
+    name = XGetAtomName(display, event->property);
+    printf("     property: %ld '%s'\n", event->property, name);
+    printf("     changed: %s\n", changed);
+
+    XFree(name);
+}
+void
+test_sync_grab(Display *display, Window win)
+{
+    int loop = 3;
+    int rc;
+    XIEventMask mask;
+
+    /* Select for motion events */
+    mask.deviceid = XIAllDevices;
+    mask.mask_len = 2;
+    mask.mask = calloc(2, sizeof(char));
+    XISetMask(mask.mask, XI_ButtonPress);
+
+    if ((rc = XIGrabDevice(display, 2,  win, CurrentTime, None, GrabModeSync,
+                           GrabModeAsync, False, &mask)) != GrabSuccess)
+    {
+        fprintf(stderr, "Grab failed with %d\n", rc);
+        return;
+    }
+    free(mask.mask);
+
+    XSync(display, True);
+    XIAllowEvents(display, 2, SyncPointer, CurrentTime);
+    XFlush(display);
+
+    printf("Holding sync grab for %d button presses.\n", loop);
+
+    while(loop--)
+    {
+        XIEvent ev;
+
+        XNextEvent(display, (XEvent*)&ev);
+        if (ev.type == GenericEvent && ev.extension == xi_opcode )
+        {
+            XIDeviceEvent *event = (XIDeviceEvent*)&ev;
+            print_deviceevent(event);
+            XIAllowEvents(display, 2, SyncPointer, CurrentTime);
+        }
+    }
+
+    XIUngrabDevice(display, 2, CurrentTime);
+    printf("Done\n");
+}
+
+static const char* type_to_name(int evtype)
+{
+    const char *name;
+
+    switch(evtype) {
+        case XI_DeviceChanged:    name = "DeviceChanged";       break;
+        case XI_KeyPress:         name = "KeyPress";            break;
+        case XI_KeyRelease:       name = "KeyRelease";          break;
+        case XI_ButtonPress:      name = "ButtonPress";         break;
+        case XI_ButtonRelease:    name = "ButtonRelease";       break;
+        case XI_Motion:           name = "Motion";              break;
+        case XI_Enter:            name = "Enter";               break;
+        case XI_Leave:            name = "Leave";               break;
+        case XI_FocusIn:          name = "FocusIn";             break;
+        case XI_FocusOut:         name = "FocusOut";            break;
+        case XI_HierarchyChanged: name = "HierarchyChanged";    break;
+        case XI_PropertyEvent:    name = "PropertyEvent";       break;
+        case XI_RawKeyPress:      name = "RawKeyPress";         break;
+        case XI_RawKeyRelease:    name = "RawKeyRelease";       break;
+        case XI_RawButtonPress:   name = "RawButtonPress";      break;
+        case XI_RawButtonRelease: name = "RawButtonRelease";    break;
+        case XI_RawMotion:        name = "RawMotion";           break;
+        default:
+                                  name = "unknown event type"; break;
+    }
+    return name;
+}
+
+
+int
+test_xi2(Display       *display,
+         int   argc,
+         char  *argv[],
+         char  *name,
+         char  *desc)
+{
+    XIEventMask mask;
+    Window win;
+
+    list(display, argc, argv, name, desc);
+    win = create_win(display);
+
+    /* Select for motion events */
+    mask.deviceid = XIAllDevices;
+    mask.mask_len = XIMaskLen(XI_RawMotion);
+    mask.mask = calloc(mask.mask_len, sizeof(char));
+    XISetMask(mask.mask, XI_ButtonPress);
+    XISetMask(mask.mask, XI_ButtonRelease);
+    XISetMask(mask.mask, XI_KeyPress);
+    XISetMask(mask.mask, XI_KeyRelease);
+    XISetMask(mask.mask, XI_Motion);
+    XISetMask(mask.mask, XI_DeviceChanged);
+    XISetMask(mask.mask, XI_Enter);
+    XISetMask(mask.mask, XI_Leave);
+    XISetMask(mask.mask, XI_FocusIn);
+    XISetMask(mask.mask, XI_FocusOut);
+    XISetMask(mask.mask, XI_HierarchyChanged);
+    XISetMask(mask.mask, XI_PropertyEvent);
+    XISelectEvents(display, win, &mask, 1);
+    XMapWindow(display, win);
+    XSync(display, False);
+
+    {
+        XIGrabModifiers modifiers[] = {{0, 0}, {0, 0x10}, {0, 0x1}, {0, 0x11}};
+        int nmods = sizeof(modifiers)/sizeof(modifiers[0]);
+
+        mask.deviceid = 2;
+        memset(mask.mask, 0, 2);
+        XISetMask(mask.mask, XI_KeyPress);
+        XISetMask(mask.mask, XI_KeyRelease);
+        XISetMask(mask.mask, XI_ButtonPress);
+        XISetMask(mask.mask, XI_ButtonRelease);
+        XISetMask(mask.mask, XI_Motion);
+        XIGrabButton(display, 2, 1, win, None, GrabModeAsync, GrabModeAsync,
+                False, &mask, nmods, modifiers);
+        XIGrabKeycode(display, 3, 24 /* q */, win, GrabModeAsync, GrabModeAsync,
+                False, &mask, nmods, modifiers);
+        XIUngrabButton(display, 3, 1, win, nmods - 2, &modifiers[2]);
+        XIUngrabKeycode(display, 3, 24 /* q */, win, nmods - 2, &modifiers[2]);
+    }
+
+    mask.deviceid = XIAllMasterDevices;
+    memset(mask.mask, 0, 2);
+    XISetMask(mask.mask, XI_RawKeyPress);
+    XISetMask(mask.mask, XI_RawKeyRelease);
+    XISetMask(mask.mask, XI_RawButtonPress);
+    XISetMask(mask.mask, XI_RawButtonRelease);
+    XISetMask(mask.mask, XI_RawMotion);
+    XISelectEvents(display, DefaultRootWindow(display), &mask, 1);
+
+    free(mask.mask);
+
+    {
+        XEvent event;
+        XMaskEvent(display, ExposureMask, &event);
+        XSelectInput(display, win, 0);
+    }
+
+    /*
+    test_sync_grab(display, win);
+    */
+
+    while(1)
+    {
+        XEvent ev;
+        XGenericEventCookie *cookie = (XGenericEventCookie*)&ev.xcookie;
+        XNextEvent(display, (XEvent*)&ev);
+
+        if (XGetEventData(display, cookie) &&
+            cookie->type == GenericEvent &&
+            cookie->extension == xi_opcode)
+        {
+            printf("EVENT type %d (%s)\n", cookie->evtype, type_to_name(cookie->evtype));
+            switch (cookie->evtype)
+            {
+                case XI_DeviceChanged:
+                    print_devicechangedevent(display, cookie->data);
+                    break;
+                case XI_HierarchyChanged:
+                    print_hierarchychangedevent(cookie->data);
+                    break;
+                case XI_RawKeyPress:
+                case XI_RawKeyRelease:
+                case XI_RawButtonPress:
+                case XI_RawButtonRelease:
+                case XI_RawMotion:
+                    print_rawevent(cookie->data);
+                    break;
+                case XI_Enter:
+                case XI_Leave:
+                case XI_FocusIn:
+                case XI_FocusOut:
+                    print_enterleave(cookie->data);
+                    break;
+                case XI_PropertyEvent:
+                    print_propertyevent(display, cookie->data);
+                    break;
+                default:
+                    print_deviceevent(cookie->data);
+                    break;
+            }
+        }
+
+        XFreeEventData(display, cookie);
+    }
+
+    XDestroyWindow(display, win);
+
+    return EXIT_SUCCESS;
+}
diff --git a/src/xinput.c b/src/xinput.c
new file mode 100755 (executable)
index 0000000..9ca3832
--- /dev/null
@@ -0,0 +1,375 @@
+/*
+ * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is  hereby granted without fee, provided that
+ * the  above copyright   notice appear  in   all  copies and  that both  that
+ * copyright  notice   and   this  permission   notice  appear  in  supporting
+ * documentation, and that   the  name of  the authors  not  be  used  in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific,  written      prior  permission.     The authors  make  no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
+ * EVENT  SHALL THE AUTHORS  BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
+ * TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#include "xinput.h"
+#include <ctype.h>
+#include <string.h>
+
+int xi_opcode;
+
+typedef int (*prog)(Display* display, int argc, char *argv[],
+                   char *prog_name, char *prog_desc);
+
+typedef struct
+{
+    char       *func_name;
+    char       *arg_desc;
+    prog       func;
+} entry;
+
+static entry drivers[] =
+{
+    {"get-feedbacks",
+     "<device name>",
+     get_feedbacks
+    },
+    {"set-ptr-feedback",
+     "<device name> <threshold> <num> <denom>",
+     set_ptr_feedback
+    },
+    {"set-integer-feedback",
+     "<device name> <feedback id> <value>",
+     set_integer_feedback
+    },
+    {"get-button-map",
+     "<device name>",
+     get_button_map
+    },
+    {"set-button-map",
+     "<device name> <map button 1> [<map button 2> [...]]",
+     set_button_map
+    },
+    {"set-pointer",
+     "<device name> [<x index> <y index>]",
+     set_pointer
+    },
+    {"set-mode",
+     "<device name> ABSOLUTE|RELATIVE",
+     set_mode
+    },
+    {"list",
+     "[--short || --long] [<device name>...]",
+     list
+    },
+    {"query-state",
+     "<device name>",
+     query_state
+    },
+    {"test",
+     "[-proximity] <device name>",
+     test
+    },
+#if HAVE_XI2
+    { "create-master",
+      "<id> [<sendCore (dflt:1)>] [<enable (dflt:1)>]",
+      create_master
+    },
+    { "remove-master",
+      "<id> [Floating|AttachToMaster (dflt:Floating)] [<returnPointer>] [<returnKeyboard>]",
+      remove_master
+    },
+    { "reattach",
+      "<id> <master>",
+      change_attachment
+    },
+    { "float",
+      "<id>",
+      float_device
+    },
+    { "set-cp",
+      "<window> <device>",
+      set_clientpointer
+    },
+    { "test-xi2",
+      "<device>",
+      test_xi2,
+    },
+#endif
+    { "list-props",
+      "<device> [<device> ...]",
+      list_props
+    },
+    { "set-int-prop",
+      "<device> <property> <format (8, 16, 32)> <val> [<val> ...]",
+      set_int_prop
+    },
+    { "set-float-prop",
+      "<device> <property> <val> [<val> ...]",
+      set_float_prop
+    },
+    { "set-atom-prop",
+      "<device> <property> <val> [<val> ...]",
+      set_atom_prop
+    },
+    { "watch-props",
+      "<device>",
+      watch_props
+    },
+    { "delete-prop",
+      "<device> <property>",
+      delete_prop
+    },
+    { "set-prop",
+      "<device> [--type=atom|float|int] [--format=8|16|32] <property> <val> [<val> ...]",
+      set_prop
+    },
+    {NULL, NULL, NULL
+    }
+};
+
+static const char version_id[] = VERSION;
+
+int
+print_version()
+{
+    XExtensionVersion  *version;
+    Display *display;
+
+    printf("xinput version %s\n", version_id);
+
+    display = XOpenDisplay(NULL);
+
+    printf("XI version on server: ");
+
+    if (display == NULL)
+        printf("Failed to open display.\n");
+    else {
+        version = XGetExtensionVersion(display, INAME);
+        if (!version || (version == (XExtensionVersion*) NoSuchExtension))
+            printf(" Extension not supported.\n");
+        else {
+            printf("%d.%d\n", version->major_version,
+                    version->minor_version);
+            XFree(version);
+            return 0;
+        }
+    }
+
+    return 1;
+}
+
+int
+xinput_version(Display *display)
+{
+    XExtensionVersion  *version;
+    static int vers = -1;
+
+    if (vers != -1)
+        return vers;
+
+    version = XGetExtensionVersion(display, INAME);
+
+    if (version && (version != (XExtensionVersion*) NoSuchExtension)) {
+       vers = version->major_version;
+       XFree(version);
+    }
+
+    return vers;
+}
+
+XDeviceInfo*
+find_device_info(Display       *display,
+                char           *name,
+                Bool           only_extended)
+{
+    XDeviceInfo        *devices;
+    XDeviceInfo *found = NULL;
+    int                loop;
+    int                num_devices;
+    int                len = strlen(name);
+    Bool       is_id = True;
+    XID                id = (XID)-1;
+
+    for(loop=0; loop<len; loop++) {
+       if (!isdigit(name[loop])) {
+           is_id = False;
+           break;
+       }
+    }
+
+    if (is_id) {
+       id = atoi(name);
+    }
+
+    devices = XListInputDevices(display, &num_devices);
+
+    for(loop=0; loop<num_devices; loop++) {
+       if ((!only_extended || (devices[loop].use >= IsXExtensionDevice)) &&
+           ((!is_id && strcmp(devices[loop].name, name) == 0) ||
+            (is_id && devices[loop].id == id))) {
+           if (found) {
+               fprintf(stderr,
+                       "Warning: There are multiple devices named \"%s\".\n"
+                       "To ensure the correct one is selected, please use "
+                       "the device ID instead.\n\n", name);
+               return NULL;
+           } else {
+               found = &devices[loop];
+           }
+       }
+    }
+    return found;
+}
+
+#ifdef HAVE_XI2
+Bool is_pointer(int use)
+{
+    return use == XIMasterPointer || use == XISlavePointer;
+}
+
+Bool is_keyboard(int use)
+{
+    return use == XIMasterKeyboard || use == XISlaveKeyboard;
+}
+
+Bool device_matches(XIDeviceInfo *info, char *name)
+{
+    if (strcmp(info->name, name) == 0) {
+        return True;
+    }
+
+    if (strncmp(name, "pointer:", strlen("pointer:")) == 0 &&
+        strcmp(info->name, name + strlen("pointer:")) == 0 &&
+        is_pointer(info->use)) {
+        return True;
+    }
+
+    if (strncmp(name, "keyboard:", strlen("keyboard:")) == 0 &&
+        strcmp(info->name, name + strlen("keyboard:")) == 0 &&
+        is_keyboard(info->use)) {
+        return True;
+    }
+
+    return False;
+}
+
+XIDeviceInfo*
+xi2_find_device_info(Display *display, char *name)
+{
+    XIDeviceInfo *info;
+    XIDeviceInfo *found = NULL;
+    int ndevices;
+    Bool is_id = True;
+    int i, id = -1;
+
+    for(i = 0; i < strlen(name); i++) {
+       if (!isdigit(name[i])) {
+           is_id = False;
+           break;
+       }
+    }
+
+    if (is_id) {
+       id = atoi(name);
+    }
+
+    info = XIQueryDevice(display, XIAllDevices, &ndevices);
+    for(i = 0; i < ndevices; i++)
+    {
+        if (is_id ? info[i].deviceid == id : device_matches (&info[i], name)) {
+            if (found) {
+                fprintf(stderr,
+                        "Warning: There are multiple devices matching '%s'.\n"
+                        "To ensure the correct one is selected, please use "
+                        "the device ID, or prefix the\ndevice name with "
+                        "'pointer:' or 'keyboard:' as appropriate.\n\n", name);
+                XIFreeDeviceInfo(info);
+                return NULL;
+            } else {
+                found = &info[i];
+            }
+        }
+    }
+
+    return found;
+}
+#endif
+
+static void
+usage(void)
+{
+    entry      *pdriver = drivers;
+
+    fprintf(stderr, "usage :\n");
+
+    while(pdriver->func_name) {
+       fprintf(stderr, "\txinput %s %s\n", pdriver->func_name,
+               pdriver->arg_desc);
+       pdriver++;
+    }
+}
+
+int
+main(int argc, char * argv[])
+{
+    Display    *display;
+    entry      *driver = drivers;
+    char        *func;
+    int event, error;
+
+    if (argc < 2) {
+       usage();
+       return EXIT_FAILURE;
+    }
+
+    func = argv[1];
+    while((*func) == '-') func++;
+
+    if (strcmp("version", func) == 0) {
+        return print_version(argv[0]);
+    }
+
+    display = XOpenDisplay(NULL);
+
+    if (display == NULL) {
+       fprintf(stderr, "Unable to connect to X server\n");
+       return EXIT_FAILURE;
+    }
+
+    if (!XQueryExtension(display, "XInputExtension", &xi_opcode, &event, &error)) {
+        printf("X Input extension not available.\n");
+        return EXIT_FAILURE;
+    }
+
+    if (!xinput_version(display)) {
+       fprintf(stderr, "%s extension not available\n", INAME);
+       return EXIT_FAILURE;
+    }
+
+    while(driver->func_name) {
+       if (strcmp(driver->func_name, func) == 0) {
+           int r = (*driver->func)(display, argc-2, argv+2,
+                                   driver->func_name, driver->arg_desc);
+           XSync(display, False);
+           XCloseDisplay(display);
+           return r;
+       }
+       driver++;
+    }
+
+    usage();
+
+    return EXIT_FAILURE;
+}
+
+/* end of xinput.c */
diff --git a/src/xinput.h b/src/xinput.h
new file mode 100644 (file)
index 0000000..d44ce09
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright 1996 by Frederic Lepied, France. <Frederic.Lepied@sugix.frmug.org>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is  hereby granted without fee, provided that
+ * the  above copyright   notice appear  in   all  copies and  that both  that
+ * copyright  notice   and   this  permission   notice  appear  in  supporting
+ * documentation, and that   the  name of  the authors  not  be  used  in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific,  written      prior  permission.     The authors  make  no
+ * representations about the suitability of this software for any purpose.  It
+ * is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL   WARRANTIES WITH REGARD  TO  THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED   WARRANTIES OF MERCHANTABILITY  AND   FITNESS, IN NO
+ * EVENT  SHALL THE AUTHORS  BE   LIABLE   FOR ANY  SPECIAL, INDIRECT   OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA  OR PROFITS, WHETHER  IN  AN ACTION OF  CONTRACT,  NEGLIGENCE OR OTHER
+ * TORTIOUS  ACTION, ARISING    OUT OF OR   IN  CONNECTION  WITH THE USE    OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <X11/Xlib.h>
+#include <X11/extensions/XInput.h>
+#ifdef HAVE_XI2
+#include <X11/extensions/XInput2.h>
+#endif
+#include <X11/Xutil.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 1
+#endif
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 0
+#endif
+
+extern int xi_opcode; /* xinput extension op code */
+XDeviceInfo* find_device_info( Display *display, char *name, Bool only_extended);
+#if HAVE_XI2
+XIDeviceInfo* xi2_find_device_info(Display *display, char *name);
+int xinput_version(Display* display);
+#endif
+
+int get_feedbacks( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int set_ptr_feedback( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int get_button_map( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int set_button_map( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int set_pointer( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+
+int set_mode( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int list( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int test( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int version( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int set_integer_feedback( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int query_state( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+
+/* X Input 1.5 */
+int list_props( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int set_int_prop( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int set_float_prop( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int set_atom_prop( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int watch_props( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int delete_prop( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int set_prop( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+
+/* X Input 2.0 */
+int create_master( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int remove_master( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int change_attachment( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int float_device( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int set_clientpointer( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+int test_xi2( Display* display, int argc, char *argv[], char *prog_name, char *prog_desc);
+
+/* end of xinput.h */