Git init
authorKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:49:25 +0000 (00:49 +0900)
committerKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:49:25 +0000 (00:49 +0900)
201 files changed:
COPYING [new file with mode: 0755]
ChangeLog [new file with mode: 0755]
Makefile.am [new file with mode: 0755]
README [new file with mode: 0644]
autogen.sh [new file with mode: 0644]
configure.ac [new file with mode: 0755]
debian/README.source [new file with mode: 0644]
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/libxi-dev.install [new file with mode: 0755]
debian/libxi-dev.manpages [new file with mode: 0644]
debian/libxi6-udeb.install [new file with mode: 0644]
debian/libxi6.install [new file with mode: 0644]
debian/libxi6.symbols [new file with mode: 0644]
debian/patches/0001-Initialize-extension-with-the-right-number-of-events.patch [new file with mode: 0644]
debian/patches/series [new file with mode: 0644]
debian/rules [new file with mode: 0755]
debian/watch [new file with mode: 0644]
debian/xsfbs/repack.sh [new file with mode: 0644]
debian/xsfbs/xsfbs.mk [new file with mode: 0644]
debian/xsfbs/xsfbs.sh [new file with mode: 0644]
doc/Makefile.am [new file with mode: 0755]
doc/porting.xml [new file with mode: 0755]
include/X11/extensions/XInput.h [new file with mode: 0644]
include/X11/extensions/XInput2.h [new file with mode: 0644]
man/Makefile.am [new file with mode: 0755]
man/XAllowDeviceEvents.man [new file with mode: 0755]
man/XAllowDeviceEvents.txt [new file with mode: 0755]
man/XChangeDeviceControl.man [new file with mode: 0644]
man/XChangeDeviceDontPropagateList.man [new file with mode: 0755]
man/XChangeDeviceDontPropagateList.txt [new file with mode: 0755]
man/XChangeDeviceKeyMapping.man [new file with mode: 0755]
man/XChangeDeviceProperty.man [new file with mode: 0755]
man/XChangeFeedbackControl.man [new file with mode: 0755]
man/XChangeKeyboardDevice.man [new file with mode: 0755]
man/XChangeKeyboardDevice.txt [new file with mode: 0755]
man/XChangePointerDevice.man [new file with mode: 0755]
man/XChangePointerDevice.txt [new file with mode: 0755]
man/XCloseDevice.man [new file with mode: 0755]
man/XDeleteDeviceProperty.man [new file with mode: 0755]
man/XDeviceBell.man [new file with mode: 0755]
man/XDeviceBell.txt [new file with mode: 0755]
man/XDeviceTimeCoord.man [new file with mode: 0755]
man/XFreeDeviceList.man [new file with mode: 0755]
man/XGetDeviceButtonMapping.man [new file with mode: 0755]
man/XGetDeviceControl.man [new file with mode: 0755]
man/XGetDeviceControl.txt [new file with mode: 0755]
man/XGetDeviceDontPropagateList.man [new file with mode: 0755]
man/XGetDeviceFocus.man [new file with mode: 0755]
man/XGetDeviceKeyMapping.man [new file with mode: 0755]
man/XGetDeviceKeyMapping.txt [new file with mode: 0755]
man/XGetDeviceModifierMapping.man [new file with mode: 0755]
man/XGetDeviceModifierMapping.txt [new file with mode: 0755]
man/XGetDeviceMotionEvents.man [new file with mode: 0755]
man/XGetDeviceMotionEvents.txt [new file with mode: 0755]
man/XGetDeviceProperty.man [new file with mode: 0755]
man/XGetDeviceProperty.txt [new file with mode: 0755]
man/XGetExtensionVersion.man [new file with mode: 0755]
man/XGetExtensionVersion.txt [new file with mode: 0755]
man/XGetFeedbackControl.man [new file with mode: 0755]
man/XGetFeedbackControl.txt [new file with mode: 0755]
man/XGetSelectedExtensionEvents.man [new file with mode: 0755]
man/XGrabDevice.man [new file with mode: 0755]
man/XGrabDevice.txt [new file with mode: 0755]
man/XGrabDeviceButton.man [new file with mode: 0755]
man/XGrabDeviceButton.txt [new file with mode: 0755]
man/XGrabDeviceKey.man [new file with mode: 0755]
man/XGrabDeviceKey.txt [new file with mode: 0755]
man/XIChangeHierarchy.man [new file with mode: 0755]
man/XIChangeHierarchy.txt [new file with mode: 0755]
man/XIChangeProperty.man [new file with mode: 0755]
man/XIChangeProperty.txt [new file with mode: 0755]
man/XIDefineCursor.man [new file with mode: 0755]
man/XIDefineCursor.txt [new file with mode: 0755]
man/XIDeleteProperty.man [new file with mode: 0755]
man/XIFreeDeviceInfo.man [new file with mode: 0755]
man/XIGetClientPointer.man [new file with mode: 0755]
man/XIGetFocus.man [new file with mode: 0755]
man/XIGetProperty.man [new file with mode: 0755]
man/XIGetSelectedEvents.man [new file with mode: 0755]
man/XIGrabButton.man [new file with mode: 0755]
man/XIGrabButton.txt [new file with mode: 0755]
man/XIGrabDevice.man [new file with mode: 0755]
man/XIGrabDevice.txt [new file with mode: 0755]
man/XIGrabEnter.man [new file with mode: 0755]
man/XIGrabEnter.txt [new file with mode: 0755]
man/XIGrabFocusIn.man [new file with mode: 0755]
man/XIGrabKeycode.man [new file with mode: 0755]
man/XIListProperties.man [new file with mode: 0755]
man/XIListProperties.txt [new file with mode: 0755]
man/XIQueryDevice.man [new file with mode: 0755]
man/XIQueryDevice.txt [new file with mode: 0755]
man/XIQueryPointer.man [new file with mode: 0755]
man/XIQueryPointer.txt [new file with mode: 0755]
man/XIQueryVersion.man [new file with mode: 0755]
man/XIQueryVersion.txt [new file with mode: 0755]
man/XISelectEvents.man [new file with mode: 0755]
man/XISelectEvents.txt [new file with mode: 0755]
man/XISetClientPointer.man [new file with mode: 0755]
man/XISetClientPointer.txt [new file with mode: 0755]
man/XISetFocus.man [new file with mode: 0755]
man/XISetFocus.txt [new file with mode: 0755]
man/XIUndefineCursor.man [new file with mode: 0755]
man/XIUngrabButton.man [new file with mode: 0755]
man/XIUngrabDevice.man [new file with mode: 0755]
man/XIUngrabEnter.man [new file with mode: 0755]
man/XIUngrabFocusIn.man [new file with mode: 0755]
man/XIUngrabKeycode.man [new file with mode: 0755]
man/XIWarpPointer.man [new file with mode: 0755]
man/XIWarpPointer.txt [new file with mode: 0755]
man/XListDeviceProperties.man [new file with mode: 0755]
man/XListDeviceProperties.txt [new file with mode: 0755]
man/XListInputDevices.man [new file with mode: 0755]
man/XListInputDevices.txt [new file with mode: 0755]
man/XOpenDevice.man [new file with mode: 0755]
man/XOpenDevice.txt [new file with mode: 0755]
man/XQueryDeviceState.man [new file with mode: 0755]
man/XQueryDeviceState.txt [new file with mode: 0755]
man/XSelectExtensionEvent.man [new file with mode: 0755]
man/XSelectExtensionEvent.txt [new file with mode: 0755]
man/XSendExtensionEvent.man [new file with mode: 0755]
man/XSendExtensionEvent.txt [new file with mode: 0755]
man/XSetDeviceButtonMapping.man [new file with mode: 0755]
man/XSetDeviceButtonMapping.txt [new file with mode: 0755]
man/XSetDeviceFocus.man [new file with mode: 0755]
man/XSetDeviceFocus.txt [new file with mode: 0755]
man/XSetDeviceMode.man [new file with mode: 0755]
man/XSetDeviceMode.txt [new file with mode: 0755]
man/XSetDeviceModifierMapping.man [new file with mode: 0755]
man/XSetDeviceValuators.man [new file with mode: 0755]
man/XSetDeviceValuators.txt [new file with mode: 0755]
man/XUngrabDevice.man [new file with mode: 0755]
man/XUngrabDeviceButton.man [new file with mode: 0755]
man/XUngrabDeviceKey.man [new file with mode: 0755]
packaging/libXi.spec [new file with mode: 0644]
specs/Makefile.am [new file with mode: 0755]
specs/encoding.xml [new file with mode: 0755]
specs/inputlib.xml [new file with mode: 0755]
specs/library.xml [new file with mode: 0755]
src/Makefile.am [new file with mode: 0755]
src/XAllowDv.c [new file with mode: 0644]
src/XChDProp.c [new file with mode: 0644]
src/XChgDCtl.c [new file with mode: 0644]
src/XChgFCtl.c [new file with mode: 0644]
src/XChgKMap.c [new file with mode: 0644]
src/XChgKbd.c [new file with mode: 0644]
src/XChgPnt.c [new file with mode: 0644]
src/XChgProp.c [new file with mode: 0644]
src/XCloseDev.c [new file with mode: 0644]
src/XDelDProp.c [new file with mode: 0644]
src/XDevBell.c [new file with mode: 0644]
src/XExtInt.c [new file with mode: 0755]
src/XExtToWire.c [new file with mode: 0755]
src/XFreeLst.c [new file with mode: 0644]
src/XGMotion.c [new file with mode: 0644]
src/XGetBMap.c [new file with mode: 0644]
src/XGetCPtr.c [new file with mode: 0644]
src/XGetDCtl.c [new file with mode: 0755]
src/XGetDProp.c [new file with mode: 0644]
src/XGetFCtl.c [new file with mode: 0755]
src/XGetKMap.c [new file with mode: 0644]
src/XGetMMap.c [new file with mode: 0644]
src/XGetProp.c [new file with mode: 0644]
src/XGetVers.c [new file with mode: 0755]
src/XGrDvBut.c [new file with mode: 0644]
src/XGrDvKey.c [new file with mode: 0644]
src/XGrabDev.c [new file with mode: 0644]
src/XGtFocus.c [new file with mode: 0644]
src/XGtSelect.c [new file with mode: 0644]
src/XIAllowEvents.c [new file with mode: 0644]
src/XIDefineCursor.c [new file with mode: 0644]
src/XIGetDevFocus.c [new file with mode: 0644]
src/XIGrabDevice.c [new file with mode: 0644]
src/XIHierarchy.c [new file with mode: 0644]
src/XIPassiveGrab.c [new file with mode: 0644]
src/XIProperties.c [new file with mode: 0755]
src/XIQueryDevice.c [new file with mode: 0644]
src/XIQueryPointer.c [new file with mode: 0644]
src/XIQueryVersion.c [new file with mode: 0755]
src/XISelEv.c [new file with mode: 0755]
src/XISetDevFocus.c [new file with mode: 0644]
src/XIWarpPointer.c [new file with mode: 0644]
src/XIint.h [new file with mode: 0755]
src/XListDProp.c [new file with mode: 0644]
src/XListDev.c [new file with mode: 0755]
src/XOpenDev.c [new file with mode: 0644]
src/XQueryDv.c [new file with mode: 0755]
src/XSelect.c [new file with mode: 0644]
src/XSetBMap.c [new file with mode: 0755]
src/XSetCPtr.c [new file with mode: 0644]
src/XSetDVal.c [new file with mode: 0644]
src/XSetMMap.c [new file with mode: 0644]
src/XSetMode.c [new file with mode: 0644]
src/XSndExEv.c [new file with mode: 0644]
src/XStFocus.c [new file with mode: 0644]
src/XUngrDev.c [new file with mode: 0644]
src/XUngrDvB.c [new file with mode: 0644]
src/XUngrDvK.c [new file with mode: 0644]
xi.pc.in [new file with mode: 0644]

diff --git a/COPYING b/COPYING
new file mode 100755 (executable)
index 0000000..3b8f4fd
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,84 @@
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL HEWLETT-PACKARD 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 2008 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..c3c12a2
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,2733 @@
+commit ea7e12eaf84ada28f4933e85ecf51a47c9db0b93
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Nov 2 14:26:34 2010 +1000
+
+    libXi 1.4
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 556246beaffb42e1f58d816542d91e360ea02080
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Nov 2 11:22:01 2010 +1000
+
+    man: XGetDeviceProperty(3) has no parameter 'pending'.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Julien Cristau <jcristau@debian.org>
+
+commit ccbebb111fb2084716fce67cb44b5bd8b86adbbc
+Author: Jesse Adkins <jesserayadkins@gmail.com>
+Date:   Tue Sep 28 13:30:03 2010 -0700
+
+    Purge cvs tags.
+    
+    Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com>
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit f237427f897d1dc527494653735d4bb93d740546
+Author: Carlos Garnacho <carlosg@gnome.org>
+Date:   Wed Oct 6 11:04:21 2010 +0200
+
+    Fix typo when converting raw events from the wire.
+    
+    The raw values were being miscalculated, containing only the integral part
+    of the FP3232, meanwhile normal valuators were mistakenly added the fractional
+    part of its corresponding raw value.
+    
+    Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
+    Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit abc26c71b6032683b89085a7ebcd40ca81cdf3f2
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Sun Oct 3 17:04:57 2010 +0200
+
+    man: fix typo in XIQueryDevice doc
+    
+    Don't pretend this is XIQueryPointer.
+    
+    Debian bug#598964
+    Reported-by: Joachim Breitner <nomeata@debian.org>
+    Signed-off-by: Julien Cristau <jcristau@debian.org>
+
+commit a00926cd16a0b6ddb9f7b074dce88e3fb840831c
+Author: Matthieu Herrb <matthieu.herrb@laas.fr>
+Date:   Wed Aug 25 22:21:55 2010 +0200
+
+    Fix build with gcc 2.95
+    
+    Signed-off-by: Matthieu Herrb <matthieu.herrb@laas.fr>
+    Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+    Reviewed-by: Matt Turner <mattst88@gmail.com>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 3f2814a0f9193cb33b44ef53059a4b349cf4cabc
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Aug 2 15:40:32 2010 +1000
+
+    man: improve readability of XAllowDeviceEvents.
+    
+    Parse the options to event-mode as a list. This requires un-indenting the
+    rest, otherwise the asciidoc/xmlto conversion will indent the trailing
+    paragraphs more than the list
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit d3eb99478ca96fdfc4ceb2a9809f19f803bba6c7
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Aug 15 18:05:13 2010 -0400
+
+    man: add $(AM_V_GEN) for silent rules where missing
+    
+    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit dbcca7e1296ae671964c55be13bfbb9113a600a0
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Aug 15 17:46:52 2010 -0400
+
+    man: whitespace management
+    
+    This style should make it easier to read filenames
+    in a large list.
+    
+    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit bc9f68de51ec7d3d88330ff843eccd6cbf9a93ad
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Aug 15 12:53:04 2010 -0400
+
+    man: Use MAN_SUBST now supplied in XORG_MANPAGE_SECTIONS
+    
+    The value of MAN_SUBST is the same for all X.Org packages.
+    Use AC_PROG_SED now supplied by XORG_DEFAULT_OPTIONS
+    
+    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 20b843c820dd147a0f8f7e6d06da7a0c18d40f1c
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Aug 15 09:33:17 2010 -0400
+
+    man: add/change comments regarding the 3 step conversion from text source
+    
+    In the hope of making it easier to learn.
+    This makefile may serve as a reference.
+    
+    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit e7b4e33a3ea1a3cce074da2d91bda7258e01652a
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Aug 15 07:54:39 2010 -0400
+
+    man: rename libman_pre to libman_PRE
+    
+    To be consistent with all other man pages makefiles.
+    
+    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit d854293a63be4a983e3e8fe8a1110a5ea1ffba2a
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Aug 15 07:32:10 2010 -0400
+
+    man: use "shadows" terminology in variable names.
+    
+    For man pages that are just links to a main man page.
+    This is how they are referred to in all other librairies.
+    
+    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 9fe6bfec833a66a3a8ca70b8769eada91a320bf7
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sat Aug 14 21:41:51 2010 -0400
+
+    man: remove used LIB_MAN_DIR_SUFFIX (part of an unrequired broken fix)
+    
+    Local fix in CVS for bug 5628 is not required
+    as the problem has been fixed in
+    util-macros d9062e4077ebfd0985baf8418f3d0f111b9ddbba
+    
+    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 8daf961d0fe6a1433c8248d984618a7e22ff88b8
+Author: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
+Date:   Fri Jun 18 11:32:36 2010 +0300
+
+    Always unlock display correctly
+    
+    XISelectEvents and XIGetSelectedEvents were not unlocking display in all
+    return paths.
+    
+    Reported-by: Julien Cristau <jcristau@debian.org>
+    Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
+
+commit 3a6839b4a229aa59188025c9b285023110a20aad
+Author: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
+Date:   Mon Jun 14 10:37:56 2010 +0300
+
+    Use single error path in XGetDeviceControl
+    
+    This reduces code duplication and fixes possible leak of d. d would leak if
+    allocation of Device fails.
+    
+    Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
+    Reviewed-by: Julien Cristau <jcristau@debian.org>
+
+commit 850288fee663c07fbd491859629543f78bbadd3c
+Author: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
+Date:   Mon Jun 14 10:37:56 2010 +0300
+
+    Use single error path in XGetFeedbackControl
+    
+    This reduces code duplication and fixes possible leak of f. f would leak if
+    allocation of Feedback fails.
+    
+    Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
+    Reviewed-by: Julien Cristau <jcristau@debian.org>
+
+commit 9ca839742b49d49e98a17baa40c9662ee76c397f
+Author: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
+Date:   Mon Jun 14 10:16:22 2010 +0300
+
+    Use single error path in XQueryDeviceState
+    
+    This reduces code duplication and fixes possible leak of data. data would
+    leak if allocation of state fails.
+    
+    Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
+    Reviewed-by: Julien Cristau <jcristau@debian.org>
+
+commit b953bf7b9775e5970776a21ae3f7919592289c92
+Author: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
+Date:   Mon Jun 14 10:05:36 2010 +0300
+
+    Fix memory leak in XIGetSelectedEvents
+    
+    mask_in was leaking for every successfull XIGetSelectedEvents.
+    
+    Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
+    Reviewed-by: Julien Cristau <jcristau@debian.org>
+
+commit 6199f89992e2b6ba5f96833f4f4087b61ca61ac5
+Author: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
+Date:   Fri Jun 11 17:30:44 2010 +0300
+
+    Fix usage of uninitialized value
+    
+    In error case length of extra data could be uninitialized. This would
+    result randomly sized request later in function.
+    
+    Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com>
+    Reviewed-by: Julien Cristau <jcristau@debian.org>
+
+commit d364aaaa47a69789b7acfd54b625caa299780480
+Author: Matt Dew <matt@osource.org>
+Date:   Sat Jul 10 09:48:13 2010 -0400
+
+    specs: convert input .ms specs from xorg-docs module to DocBook XML
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 30b076ea0b761c4a94c275be273accf311dc81c2
+Author: Fernando Carrijo <fcarrijo@yahoo.com.br>
+Date:   Thu Jul 1 06:58:28 2010 -0300
+
+    Purge macros NEED_EVENTS and NEED_REPLIES
+    
+    Signed-off-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
+    Acked-by: Tiago Vignatti <tiago.vignatti@nokia.com>
+    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 54fbe5759aa961dccc618b35573845f847675570
+Author: Jamey Sharp <jamey@minilop.net>
+Date:   Fri Apr 9 17:31:00 2010 -0700
+
+    Don't unlock the Display twice.
+    
+    _xiQueryVersion's caller must wrap it in a LockDisplay/UnlockDisplay
+    pair, so it shouldn't call UnlockDisplay itself.
+    
+    Signed-off-by: Jamey Sharp <jamey@minilop.net>
+
+commit f7c3b023f04e06dfe380dce488f80943a10be57e
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Mar 29 16:50:34 2010 -0400
+
+    config: update AC_PREREQ statement to 2.60
+    
+    Unrelated to the previous patches, the new value simply reflects
+    the reality that the minimum level for autoconf to configure
+    all x.org modules is 2.60 dated June 2006.
+    
+    ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit e48a8569f854237f2fead7c7a75e90b6c5fe8693
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Mar 29 14:53:48 2010 -0400
+
+    config: remove the pkgconfig pc.in file from EXTRA_DIST
+    
+    Automake always includes it in the tarball.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 93aca1583dcdd21d79c7ab75d81a49359523a0e2
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Mar 11 10:16:51 2010 -0500
+
+    doc: specify minimum version for xmlto and ascidoc
+    
+    Specify 0.0.20 as the minimum version for xmlto.
+    Older versions do not have fop backend.
+    
+    Specify 8.4.5 as the minimum version for ascidooc.
+    Older versions stop with errors.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 299de21b2ab3cfa2078823215f84da67e7b3d1a3
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Dec 9 13:59:57 2009 +1000
+
+    Initialize extension with the right number of events.
+    
+    If the server supports a lower XI version than the client, the Xlib-internal
+    event vector may be smashed. See libXext for more details.
+    http://cgit.freedesktop.org/xorg/lib/libXext/commit/?id=83fdb27df4ddc2fb088ddf2ec65f0db6b7c57287
+    
+    This patch queries the server for the supported XI extension before
+    registering the extension with Xlib. The number of events registered depends
+    on the server version.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Julien Cristau <jcristau@debian.org>
+
+commit 4debc545611edd35f8fd35a52f4adf4263e49200
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Feb 16 10:37:21 2010 -0500
+
+    config: move CWARNFLAGS from configure.ac to Makefile.am
+    
+    Compiler warning flags should be explicitly set in the makefile
+    rather than being merged with other packages compiler flags.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit d7e421f97db74332783ae885f6835f84133c92b5
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Feb 18 16:52:12 2010 +1000
+
+    man: fix types for XGetSelectedExtensionEvents.
+    
+    The return values are of type XEventClass** and int*, respectively.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
+
+commit b75b8fa4bda0fb18872fa82a04fe7f609a147f8b
+Author: Dan Nicholson <dbn.lists@gmail.com>
+Date:   Tue Jan 26 09:17:12 2010 -0800
+
+    Need both xmlto and asciidoc to install man pages from a checkout
+    
+    The check for whether to build the pages looked for both xmlto and
+    asciidoc, but the check to install didn't. Refactor a bit so that the
+    check is done only once.
+    
+    Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
+    Tested-by: Gaetan Nadon <memsize@videotron.ca>
+    Tested-by: Christian Hartmann <cornogle@googlemail.com>
+
+commit f10f6f2fd420786cddac875d1b6de2004ba8c9d4
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sat Jan 23 14:46:59 2010 -0500
+
+    man: remove redundant nodist prefix to libman_DATA
+    
+    The final, macro substituded, man pages (with file extension .3
+    on my platform), are installed, but not distributed. There is no
+    need to override the correct default behaviour.
+    
+    Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit c183e15263787af913bf8eb7be707e0f2e974824
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sat Jan 23 10:04:38 2010 -0500
+
+    man: allow installing prebuilt man pages from tarball
+    
+    The man pages source may be supplied in the tarball or built
+    from git. The makefile needs to take that into consideration
+    and adjust the targets accordingly.
+    
+    Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit c94494c144c634b7fa3187c55458cafa0e06a69c
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Jan 19 13:44:49 2010 -0500
+
+    config: replace custom code with reusable macro XORG_WITH_XMLTO
+    
+    XORG_WITH_XMLTO provides additional functions like a configure
+    option which allow platform builders to control the usage of
+    the xmlto program.
+    
+    This is a requirement from platforms that do not have such doc tool.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit bb07265cfbd919de4903dadbfe42d1779c20225c
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Jan 14 09:22:08 2010 -0500
+
+    COPYING: add missing copyright notice
+    
+    Refer to: XiAllowEvents.c
+    Copyright Â© 2009 Red Hat, Inc.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 20f1b09cfdeeb2e4536e82a09b32693de65f3566
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jan 14 21:39:47 2010 -0800
+
+    Update Sun license notices to current X.Org standard form
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit d42cdd631728eae399287b666f0f445e7af47ad3
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Fri Jan 1 13:43:03 2010 -0500
+
+    man: ignore generated .man from .txt files in this directory
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 9620cfa989d214a4d97c74767c218d06ed2ac792
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Fri Nov 27 20:56:04 2009 -0500
+
+    Makefile.am: add ChangeLog and INSTALL on MAINTAINERCLEANFILES
+    
+    Now that the INSTALL file is generated.
+    Allows running make maintainer-clean.
+
+commit d157e3b4ac31710fb1d4d62f1cc4fa743ec61522
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Wed Oct 28 14:09:10 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 847b72d9de8dd839c391321b50312368e63e7305
+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 f1c7f651838c7f2f33c0c9f9306d8d6df36206c7
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Oct 26 22:08:43 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 a9a766f9dd0e8cf32e576c040d1604422193ab07
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Oct 22 12:34:19 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 63621888d6e36a2f9e41e81c14728d70beeff5ee
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Oct 2 12:09:17 2009 +1000
+
+    libXi 1.3
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 9dc825a3dede81d2425770662daefe7e19644d6d
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Oct 2 12:08:30 2009 +1000
+
+    Require macros 1.3 for XORG_DEFAULT_OPTIONS
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 3530845c70b0d7f9f853b29337c9397a3a599e52
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Tue Sep 29 14:15:06 2009 +0200
+
+    Don't export sizeDeviceClassType, size_classes and copy_classes
+    
+    Signed-off-by: Julien Cristau <jcristau@debian.org>
+
+commit 801d77d035a10250dab728c046a6e9b2775e6dfb
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Sep 24 14:14:48 2009 +1000
+
+    XQueryDeviceState: correct length of XValuatorState
+    
+    The length is suppposed to be the complete class size, not just the struct
+    size. Since XValuatorState is followed by multiple valuator values the
+    size of the class is variable and dependent on the number of valuators.
+    
+    The server assembles the valuator state last. This bug is unlikely to affect
+    clients as they should never go past the last class anyway.
+    
+    Tested-by: Thomas Jaeger
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit bff36ef5797d7da11972ee22ea224e207af77455
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Sep 24 13:10:26 2009 +1000
+
+    man: correct XQueryDeviceState return value.
+    
+    And one indentation fix in the same man page.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 9c5ba6ff3fcff30507f285f2e67afbdb296a2318
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Sep 14 16:34:18 2009 +1000
+
+    Declare _xibad* functions before the Bad* macros.
+    
+    Reported-by: Christian Beier
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 369600cf37cd884793c4802a56c8355bc1812dc6
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Sep 7 12:22:06 2009 +1000
+
+    mask_len in XIGrabDevice is in 4-byte units (#23708)
+    
+    X.Org Bug 23708 <http://bugs.freedesktop.org/show_bug.cgi?id=23708>
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit fa09375a69a02cd789c70d60970a669700eaeb20
+Author: Arkadiusz MiÅ›kiewicz <arekm@maven.pl>
+Date:   Sat Sep 5 20:39:47 2009 +0200
+
+    libXi: Man page files end with LIB_MAN_SUFFIX not LIB_MAN_DIR_SUFFIX.
+    
+    Using LIB_MAN_DIR_SUFFIX as man page files suffix is invalid since
+    there can be files ending with eg. 5x while being in man5 dir
+    (share/man/man5/man.5x) as required by FHS 2.3.
+    
+    Man page files and with LI
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 693d9a43f16d4ffd085099b532a10467aa095c17
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Sep 1 16:42:38 2009 +1000
+
+    Initialize send_event for cookie events. (#23609)
+    
+    X.Org Bug 23609 <http://bugs.freedesktop.org/show_bug.cgi?id=23609>
+
+commit eb9a2d63487641faa97d88cef3fa1c892a8f342f
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Aug 25 11:03:04 2009 +1000
+
+    Bump to 1.2.99.4
+
+commit 2ce629c30745fc4027d2a95745bf21e8d8c7b893
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Aug 25 09:55:23 2009 +1000
+
+    Remove the asciidoc warning from configure.
+    
+    This warning was put in when the released version of asciidoc required an
+    additional patch to build libXi.
+    The release of asciidoc 8.4.5 included this patch thus we don't need this
+    explicit warning anymore.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 17bbc8c30fb34c7130b71e5cc0b0e17093271266
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Aug 24 15:54:09 2009 +1000
+
+    man: fix XIQueryPointer parameter ordering.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 207a7f3d5bd559ffb67de2910795d7cd6508ce09
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Aug 24 15:31:55 2009 +1000
+
+    Update XIWarpPointer to take doubles (inputproto >= 1.9.99.902)
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit a8a8b40fa447c85eb5d1d61ef416d3cf198c72c1
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Aug 18 15:21:56 2009 +1000
+
+    man: XIDefineCursor can generate BadDevice errors.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 326a0c01ef6e3c1f0577e185c23eec80ecf59192
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Aug 18 15:08:50 2009 +1000
+
+    man: typo fixes in XIUndefineCursor, add BadCursor note.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 42a718457d183aab42778fbb127fafbae6b3e6d8
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Aug 5 16:00:44 2009 +1000
+
+    man: point out temporary detachment of slave devices.
+    
+    Affects XIGrabDevice, XIGrabButton/Key and XIGrabEnter/GrabFocusIN
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 1a5f4fd2fa3ac7cfa1671d5cf0975ff365294f29
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Aug 5 15:58:57 2009 +1000
+
+    man: fix XIGrabEnter man page - text with needed to be reduced.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 0d19a3ec942aedf5432a9bda1e80f29f7186ce5b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Aug 5 15:34:10 2009 +1000
+
+    Update library version for new symbols.
+    
+    XI2 adds a whole lot of new symbols but leaves the existing ones. Minor bump
+    only.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 936f4993a9ece131aff03cf789b8c21cadaed47e
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Aug 5 08:50:20 2009 +1000
+
+    man: correct XListInputDevices description of the name field.
+    
+    A device's name is the identifier set either by the server the
+    xorg.conf/HAL. The preconfigured device types (XI_MOUSE, XI_KEYBOARD, etc.)
+    are atoms listed in the type field only.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit bc3900ea706438005f8b5613de4d9fb6bd954f62
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Aug 4 14:03:44 2009 +1000
+
+    Cosmetic fix, move a 'char*   name' to 'char   *name'
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 30de3da4c87322a73b2ab72e6ac83f689ec42adf
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Aug 4 13:26:45 2009 +1000
+
+    Allow foreign automake, remove empty AUTHORS and NEWS.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 4d8676a859a2a8ebde03d8a9fe6bd79060f16cf5
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Aug 4 11:45:53 2009 +1000
+
+    man: add XIQueryDevice and XIFreeDeviceInfo man page.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit c5a5d1800566b0ec073418a827ed5bc8195dd24e
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Aug 4 10:48:50 2009 +1000
+
+    Remove leftover RCS tags.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit aa8272dd31b69f84d19dbe2c45889b806df8260e
+Author: Dan Nicholson <dbn.lists@gmail.com>
+Date:   Mon Aug 3 06:09:12 2009 -0700
+
+    man: missing .man suffixes in prereq rules breaks parallel make
+    
+    Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
+
+commit 888f6c238de6f09cc5b079ae22c6f37496083007
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jul 22 14:16:11 2009 +1000
+
+    Bump to 1.2.99.3
+
+commit c439c39cc0f985743fbc464849f6caa805b1a1a9
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jul 21 11:41:43 2009 +1000
+
+    Replace keysym grabs with keycode grabs.
+    
+    Keysym grabs are tricky to get right for applications that are more
+    complicated than demo applications. otoh, we know keycode grabs are
+    working.
+    So let's go with keycode grabs for now and add keysym grabs later
+    when we've sorted out the details.
+    
+    Requires inputproto 1.9.99.15
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 4f224f4da1405959b74c05d6b15469cf6c0c498f
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jul 15 10:27:21 2009 +1000
+
+    Fix wrong raw_valuator wire copy, add fractional parts.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 550a33ed79925501d9a5e8b73ef256fd9e0937b5
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jul 14 15:28:00 2009 +1000
+
+    man: fix wrong parameter in XIGrabKeysym man pages.
+    
+    XIGrabKeysym doesn't provide a cursor argument.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 504a5a770bd1d34ea7edc3b94815b2b98a61afc0
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Mon Jul 13 16:53:57 2009 +1000
+
+    Add flags to XIDeviceEvent and XIRawEvent.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 94bfb0cc3ebbefe548b440f8c5e14154c3a76440
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jul 13 15:37:32 2009 +1000
+
+    Cater for new event-specific raw event types.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit e600e6cf47abd61bd3554967c4fdb0f78cc68f41
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jul 13 15:37:59 2009 +1000
+
+    Fix broken formatting, remove empty comment.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 1fc161f058eecb61d37135fd024703a385769417
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jul 13 09:14:03 2009 +1000
+
+    Bump to 1.2.99.2
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 386283e4a6653eef5e92bad8867b64a3e10a5138
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jul 13 11:34:20 2009 +1000
+
+    Reshuffle deviceid + sourceid in XI2 events to allow for common typecasting.
+    
+    Except for two events, all events include a deviceid. Place it at the same
+    position in the struct for these events to allow quick checking with common
+    typecasts.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit d02c85fbd2a204a78a9d515960d817ed37e3d492
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jul 13 11:24:35 2009 +1000
+
+    Add the deviceid to XI2 property events.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 07d7fc323367ac93c3c26eaf130284e31aa961ea
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jul 13 11:05:33 2009 +1000
+
+    Plug memory leak in XIHierarchyEvent copy.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 753fb6afb13a7ce154cd24261eadb56c3f4243c5
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jul 13 10:05:33 2009 +1000
+
+    Fix segfault in XIDeviceChangedEvent wire parsing.
+    
+    Introduced by 225071e2e67fb65a0258397212f9826c9b25e078.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 9d92265081830b700926b4a7b73975dd65217551
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Jul 9 13:46:52 2009 +1000
+
+    Remove padding from XIEvent.
+    
+    The padding was originally to force the same size as the XEvent struct. This
+    only works on 32 bit however, the 64-bit XEvent struct is larger.
+    Let's just ignore the padding, there's no point to it anyway, all the Xlib
+    functions require XEvents anyway.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 4dacd34cc05054a0ab26621aaec8125b2ffe5bbf
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jul 8 16:00:57 2009 +1000
+
+    Add event copying for raw events.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 79b1ee174bb08722198e6d00c9d1a1e9e9352b8a
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jul 8 15:42:58 2009 +1000
+
+    Switch to new XIEvent structures - no need for pointers anymore.
+    
+    This removes all those pointers from event structures that were just there
+    due to the pre-cookie struct size limit. Pointers remaining are only those
+    that are of variable length (e.g. masks and valuator states).
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 64a106509ba18506e88989571c1392d48ae18a54
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jul 8 15:18:57 2009 +1000
+
+    Remove XIFreeEventData - obsolete with cookie events.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit ba0407100fd1314feb8dc0eace4352d00709cab3
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jun 24 11:18:10 2009 +1000
+
+    Add effective modifiers/group to events - require inputproto 1.9.99.13
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit d6439bc4c5c26577d0c839555a85bd1a9db784f3
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jun 24 10:09:42 2009 +1000
+
+    Change floats to doubles in DeviceEvents and EnterEvents.
+    
+    All the other bits use doubles, there's no reason to use floats here.
+
+commit 225071e2e67fb65a0258397212f9826c9b25e078
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jul 7 16:46:22 2009 +1000
+
+    Split copy_classes and size_classes to avoid memory leak
+    
+    The switch to cookie events introduced a memory leak in
+    XIDeviceChangedEvents.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 55157345c261653160e0f55841dcb32910ae4106
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Jul 2 11:41:40 2009 +1000
+
+    Use cookie events for XI2 events.
+    
+    Instead of squashing the events directly into the XEvent use the new libX11
+    cookie events. This allows us to have larger events without the 96 byte
+    restriction.
+    
+    Requires libX11 1.2.99.1
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 0e2be045663045dc087f21df95de91f824322915
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jul 8 11:07:56 2009 +1000
+
+    Add next_block() call to advance pointers over memory.
+    
+    Simple call to get the pointer to the next field when operating on a wire
+    protocol struct or on a single-memory-block Xlib structure.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit c81a383f11c87976454200805b4b5416a414b4c5
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jun 24 10:06:29 2009 +1000
+
+    Add typedefs for focus in/out events.
+    
+    The events themselves are the same as enter/leave events.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit d3d00ddb93f01690ba81ce9ec504c1b352f5539d
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jun 19 15:48:32 2009 +1000
+
+    man: add some missing XI2 refpages
+    
+    These missing pages may cause parallel builds to fail.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 47aeafbbd30800fa9a7a1136cb4fdb50cebe005f
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jun 17 09:15:48 2009 +1000
+
+    Require inputproto 1.9.99.12
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit a514d16c4535890e5aa2b5835d9a571155830251
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jun 17 09:00:10 2009 +1000
+
+    Axis and button labels should be called labels, not names.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 099e6f77482e971103570cfd38092c3839f94927
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jun 16 14:20:30 2009 +1000
+
+    Protect button label copying against 64-bit Atom madness.
+    
+    Datatype Atom is 8 bytes on 64 bit architectures, but it's always 4 bytes on
+    the wire.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit bd2a3ad028a87f76ad244efe3650d7efd3a700dd
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jun 16 13:24:34 2009 +1000
+
+    Include the current valuator state in XIQueryDevice.
+
+commit 1ca170b8d19b1170356a1edf4717cd4a95671a13
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Jun 14 08:40:59 2009 +1000
+
+    XIButtonClass now includes a XIButtonState struct.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 4ec5f70a813ba08bfcea7b2ff90f7647a94a95d7
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jun 12 16:34:13 2009 +1000
+
+    Fix a few wrong 'evtype' comments.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit e018af45b7d0db784272fc9fc548bce382799144
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Jun 7 17:56:17 2009 +1000
+
+    Add sourceid to device classes.
+
+commit 5f217c70a42b743e7260035bd02065eca39bc268
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jun 12 15:51:58 2009 +1000
+
+    XISelectEvents and XIGetSelectedEvents use "win" now instead of "window"
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 92e5ad0a641d84cf4464f37ac372724a808a785f
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jun 8 15:43:24 2009 +1000
+
+    Require inputproto 1.9.99.11.
+
+commit 467bfbc6598c8c30ab9b703160cc42ae82e75f1c
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jun 8 14:21:58 2009 +1000
+
+    XIHierarchyEvent should list num_info, not num_devices.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 0254852c8fb0793401368c7afc6041f807ee1d87
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jun 8 13:34:50 2009 +1000
+
+    Rename XICreateMaster to XIAddMaster for consistency.
+    
+    add/remove is used for slave devices and for flags, so we should use it in
+    XIChangeHierarchy as well.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 4a61fe9f05b8e7214303722dd12195488df9c599
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jun 8 13:37:38 2009 +1000
+
+    Silence warning: missing prototype for copy_classes
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 05531681e5175b823935e6bdfc53c9b5f63efc9d
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Jun 7 15:00:40 2009 +1000
+
+    Remove CamelCase use from XIChangeHierarchy.
+    
+    Everything else uses underscore notation.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 45d35bcfbe2acd4dd2b560dbc21266e915cbb1e6
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Jun 7 14:59:19 2009 +1000
+
+    man: XIChangeHierarchy uses device ids, not XDevice*
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 199dd64b809c7622b0f0bd94e1c5551c931ea1e5
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Jun 7 14:55:42 2009 +1000
+
+    Hierarchy changes should use "deviceid", not device.
+    
+    Every other call/interface uses deviceid, so change for consistency.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 27d39fdbfddec6bb92ee3d3b7ef6c21ab3026926
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jun 4 07:33:29 2009 -0700
+
+    Fix typo in man/XGetDeviceProperty.txt (wether->whether)
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit e43d88541e815aa64108a6c5bc3dae5816c822dc
+Author: Matthias Hopf <mhopf@suse.de>
+Date:   Thu Jun 4 16:29:20 2009 +0200
+
+    Fix building if asciidoc or xmlto is not installed.
+
+commit 5975cb9e6f89bf71b1740cee951fc583d7b7cfc1
+Merge: 8ea9ebc 279a8c3
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Jun 4 15:49:07 2009 +1000
+
+    Merge branch 'master' into xi2
+    
+    Conflicts:
+       man/XI.xml
+
+commit 8ea9ebcedcb99480a5774c7755329a2ca8fda07b
+Author: Benjamin Close <Benjamin.Close@clearchain.com>
+Date:   Wed Jun 3 10:25:40 2009 +1000
+
+    configure: Search for sed as required by the man pages.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit d5a69432887ba79495e58bef45ec8fc2f5dfbe1e
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jun 2 14:54:03 2009 +1000
+
+    Fix typo in Makefile.am, leading to the XI2 source skipping compilation.
+    
+    Introduced with 59dc570e6ad4adab8066c7b8d2bff77cbf70bed4.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 5500d5b6f9fe3b94d68046529fbf6c80e5a4f518
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jun 2 12:49:40 2009 +1000
+
+    man: resurrect XGetDeviceProperty man pages (and associates)
+    
+    These man pages got lost in the asciidoc conversion.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit d0be870ee7798deb8cb50cdf350892c9dfc64538
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jun 2 12:18:58 2009 +1000
+
+    Add XI2 property man pages.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 8439d93ef77a934fab171ff9385277f3f2f46213
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jun 2 11:46:56 2009 +1000
+
+    man: fix copy/paste errors in XListDeviceProperties.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 59dc570e6ad4adab8066c7b8d2bff77cbf70bed4
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jun 2 11:38:35 2009 +1000
+
+    Rename remaining XI2 sources to XI<foobar>.c
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 2174d35d5cdc475699be968a0c1b1aa82566171f
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun May 31 21:29:47 2009 +1000
+
+    Return BadRequest from XIQueryVersion if XI2 isn't supported.
+    
+    XIQueryVersion (like all other calls) makes sure XGetExtensionVersion is
+    called beforehand anyway. So if that doesn't match 2.0 or higher, return
+    BadRquest before issuing the real request (which would trigger a BadRequest
+    error). This way, clients can use XIQueryVersion without having to set up
+    the error handler.
+    
+    XIQueryVersion is now guaranteed to return the server-supported version.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit b1dedc1293a854360d44856cd603d339ce95c777
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jun 1 09:54:03 2009 +1000
+
+    Use Dont_Check for most XI2 requests.
+    
+    If a client issues an XI2 request against a non-XI2 server it should
+    generate a BadRequest error from the server.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 4d962ed1841f35aa255bbec89e37f396612cfd96
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon May 25 16:34:01 2009 +1000
+
+    Add support for Enter/FocusIn passive grabs.
+
+commit 7922430e0d063b0c3617050320d613d9dc7de7ba
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed May 27 14:15:49 2009 +1000
+
+    Require inputproto 1.9.99.10
+
+commit a2a09f6a4fb2dcd36f89fccc8efd8386eca7d804
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed May 27 14:13:54 2009 +1000
+
+    Fix wrong pointer argument in _XIPassiveUngrabDevice.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 9b9f9373f32ebe9a15f286d16b6ba880b44a9c22
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon May 25 12:45:52 2009 +1000
+
+    Add XIGetSelectedEvents.
+
+commit 13ce4a03824a7c5ac0270198d265b02b18786e1f
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue May 19 13:54:33 2009 +1000
+
+    XIPassiveGrab: take the address of modifiers for memcpy, not the value.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 7f1f0b9cf8ad17b5a4694406137a1c2114918a67
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon May 18 16:18:27 2009 +1000
+
+    XIQueryPointer: fix wrong reply extra data reading.
+    
+    libXi does it differently than the server, so don't try to access &reply[1],
+    instead use _XRead as it should be.
+    
+    Reported-by: Mark Dokter
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit db94dc37529fc3e5e3decad67d312ea108e860d2
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon May 18 15:14:03 2009 +1000
+
+    XIQueryPointer should return doubles for the FP1616 wire data.
+
+commit 615545f9cba36ab7732d2325970a7c84b2fa6e8c
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri May 15 14:16:31 2009 +1000
+
+    Switch man pages to asciidoc.
+    
+    The docbook xml is unreadable and unwritable. Switch everything to asciidoc,
+    at least thay we we can write man pages without losing sanity.
+    
+    asciidoc seems to have some issues with __libmansuffix__, so instead we just
+    use libmansuffix (without underscores).
+    The current asciidoc version is buggy for multiple man targets (more than
+    one man page in a single file), so stick a big warning into configure that a
+    patch is required to the the right asciidoc->docbook conversion.
+    
+    Many thanks to Dan Nicholson for the Makefile.am.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 9966ab40b850c780e439f86e165188919f884b64
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sat May 16 12:34:01 2009 +1000
+
+    Require inputproto 1.9.99.9
+
+commit eaf40d1bd1a5737afa5f00c4bc2208fd1562417b
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Fri May 15 06:21:49 2009 -0400
+
+    Remove duplicated code paths in XIGetProperty.
+    
+    XIGetProperty always returns in the specified format (8, 16, 32) and never in
+    the Xlib's 64-bit long hackery. So we can clean this code up a bit.
+    
+    This doesn't affect XListProperties, it still returns an Atom list.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
+
+commit 04bf8fe62832a38f56041d860a717f13fd3a7295
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu May 14 16:56:17 2009 +1000
+
+    Return failed modifiers for passive XI2 grabs.
+
+commit 68da471cd7ad3b5d76bfc1207083f892b15dd34a
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu May 14 16:34:55 2009 +1000
+
+    Update XIQueryPointer to include full modifier state.
+
+commit 3017a5124fe98eb0d1f0e4d0bdce35df06ea751b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu May 14 16:26:17 2009 +1000
+
+    Update man pages for XI2.
+    
+    Shuffling device properties up before all XI2 calls and adding all XI2 calls
+    (bar device property calls). Needs proofreading.
+
+commit ea377ea55b2014310fb0777e41ae7044396e25a3
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu May 14 14:19:44 2009 +1000
+
+    Label major/minor version in XIQueryVersion as _inout.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 0dd26fd87571c1e87ca6e8734e2c55f21e53ceb8
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu May 14 11:31:28 2009 +1000
+
+    Xinput2.h: nmasks should be num_masks in XISelectEvents
+
+commit b4d74eebcec3080fa4ac33c74835246457b00de3
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue May 12 19:25:15 2009 +1000
+
+    Adust to new device names (less "Device" in function names)
+
+commit eebdca00c416924b0423879a62498df8afed633e
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue May 12 17:33:48 2009 +1000
+
+    XISelectEvents, not the singular version
+
+commit 23246e5788a01091ed666539359614cd5c100a9b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue May 12 16:14:23 2009 +1000
+
+    Support per-device flags for XIDeviceHierarchyEvents
+
+commit 9451d09d2b9cdbe2deff7986a4c5553ba922989c
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu May 7 16:25:13 2009 +1000
+
+    Use the new prefixed constants for XI2 and require inputproto 1.99.9.8
+
+commit 92cfef2cebfa85bdb0c1b3b6ee2f78520b003eb7
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu May 7 11:41:46 2009 +1000
+
+    Add XI2 property requests.
+    
+    Without Xlib's 64-bit hilarity. A property claiming to be 32 bit is treated
+    as 32 bit value.
+
+commit 130774c208a2f331d6110b255676ad6cb8a1a414
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu May 7 11:02:02 2009 +1000
+
+    Add property event conversion.
+
+commit 70d9a55c86f15b71ff8b53a61b8fb0e1723e0824
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon May 4 19:05:06 2009 +1000
+
+    Add XIPassiveGrabDevice.
+
+commit 279a8c3a6466d885fa618cccb0b12f6c45608982
+Author: Bernhard R. Link <brlink@debian.org>
+Date:   Tue Apr 28 19:45:52 2009 +0200
+
+    man: fix a number of return/parameter types
+    
+    Debian bug#525546 <http://bugs.debian.org/525546>
+    
+    [jcristau: also fixed the window parameter of
+     X{Change,Get}DeviceDontPropagateList]
+    Signed-off-by: Julien Cristau <jcristau@debian.org>
+
+commit 6e4b80a35e5b763d4a854f1c10443b95e6ad51bd
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Apr 19 21:57:42 2009 +1000
+
+    Silence a compiler warning by using a uchar instead of a char.
+
+commit 1c777e3c1127dec35166007c6e3ca65e34735eb5
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Apr 19 21:56:29 2009 +1000
+
+    Type-cast before passing into wireToFooBarEvent.
+
+commit 443a69833a29b557f78ec09f9eef395f52a64e10
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Apr 19 21:53:17 2009 +1000
+
+    Convert FP1616 from int32_t to double.
+
+commit 516a52f9a5b095ab60086426a1945d30a44e7ef2
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Apr 19 21:41:35 2009 +1000
+
+    XIQueryVersion: ensure we unlock in all cases and return the status.
+
+commit 76c9ba562bb012790636913ea6c5a6e96af578ff
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Apr 19 20:09:02 2009 +1000
+
+    Add missing eventtype to XIRawDeviceEvent.
+    
+    Reported-by: Paul TBBle Hampson <Paul.Hampson@Pobox.com>
+
+commit 8487030472914230bec6ecb95e58cf621e69b608
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Apr 19 19:58:39 2009 +1000
+
+    Add a bunch of missing LockDisplay() calls.
+    
+    Reported-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
+
+commit 3a699cda35a7c190010e5a974cd7a4e7be9df049
+Author: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
+Date:   Sun Apr 19 06:52:30 2009 +1000
+
+    libxi: Unlock display after XIQueryVersion
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 6ad47bc1338ba96c4a43a33ee3633f41e9543bd6
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Apr 16 22:16:06 2009 +1000
+
+    Add XIAllowEvents
+
+commit b3da79aba9cd8c615e953ee08d69f44c23fe3ab5
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Apr 15 21:39:30 2009 +1000
+
+    Add XIGrabDevice
+
+commit 01a029e597a25f10d00accafb04d72dad39e82cf
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Apr 12 17:44:19 2009 +1000
+
+    parse subpixels
+
+commit 6c1d6174a0ba33ff377cb74adf6c0bbe0279f93b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Mar 26 16:37:49 2009 +1000
+
+    XIint.h only needs XI.h as include, not the rest.
+    
+    This fixes 64bit compilation issues.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 2bc4ebba78056eecf76a294f1c3edff892b286f7
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Mar 26 16:30:45 2009 +1000
+
+    Remove public declarations for SizeClassInfo and ParseClassInfo.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 20629761be39493b650f48e120d5c970bca5e796
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Mar 12 16:25:02 2009 +1000
+
+    Add XISetDeviceFocus and XIGetDeviceFocus
+
+commit 190035dbb9e74668f7965967a9529fec51d42d14
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Mar 12 15:56:07 2009 +1000
+
+    man: note that XListInputDevices does not list other MDs.
+
+commit 8730fa24af5a344876f0c5bfd840d856b5d2b038
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Mar 11 16:32:23 2009 +1000
+
+    Handle XI2 focus events.
+    
+    These events are identical to enter/leave events.
+
+commit ffa8a602e7ae20c7430090360818d635f13b392d
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Mar 11 14:20:05 2009 +1000
+
+    Add support for XI2 Enter/Leave events
+
+commit 5ff39db5c98a9e7e0e85ead6f4ffc59f6f071bd6
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Mar 10 16:24:44 2009 +1000
+
+    Remove if 0 code block
+
+commit c6985e7651636d75ad7f7ed1b3ef434e123a8492
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Mar 10 15:42:51 2009 +1000
+
+    Add support for Raw events.
+
+commit 2712dbc2609ad75674c77df04d42899844968e10
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Mar 8 21:16:54 2009 +1000
+
+    Add support for XIHierarchyEvent.
+
+commit 30c2e3f9398f3d9cbae70150e4bb5cec6dfcc0a1
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sun Mar 8 21:16:33 2009 +1000
+
+    Add support for XIDeviceChangedEvent
+
+commit 0cac1faccebdd317e889d2ae1a1570dc9430725f
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Mar 6 12:02:45 2009 +1000
+
+    Add XIFreeEventData
+
+commit 35a9ea79fc97bf80bfc4aea7f98ae97ac8cff762
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Mar 5 17:01:58 2009 +1000
+
+    Add support for XIDeviceEvents.
+
+commit f00f4dccba7f109dd6ec00be34543766f38264e9
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Mar 6 11:55:18 2009 +1000
+
+    Add Generic XIEvent struct.
+
+commit 13445f170c80f9e2c48e78aa1ec14e956b75c297
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Mar 3 15:29:25 2009 +1000
+
+    XIint.h fix compile error, include XInput.h
+
+commit b42809a2e9a8fa821ce6b43e5aba374e922aab39
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Mar 3 15:17:54 2009 +1000
+
+    XExtInt compile fix - include XI2.h
+
+commit c6da12b3965f60d893c3fabad4f95dac10ebe7d9
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Mar 4 21:01:58 2009 +1000
+
+    XInput2.h: Get rid of the /* foo */ in the declarations.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 65dbec3d82259bd7bbde5b7a2cdba44727a5606a
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Mar 6 11:55:41 2009 +1000
+
+    include: Move events up to before function definitions.
+
+commit 13ed59c032b74d106acd08d8893c2708ef5564c5
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Sat Feb 28 10:32:54 2009 +1000
+
+    Add XIQueryDevice implementation.
+
+commit 88fcb0938a898ef6c9f48fce2874c37e3788fe9c
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Feb 26 16:49:45 2009 +1000
+
+    Add XIQueryVersion() - query and announce the supported XI version.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 2780363f96d07f8ca62507246bb04f6894e3b13d
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Mar 5 15:53:02 2009 +1000
+
+    XISelectEvent: make sure padding is zeroed out.
+
+commit ee1a0b4f507f32c7abe07b3324dc3a6c210964c4
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jan 16 13:36:59 2009 +1000
+
+    Replace XiSelectEvent() with XISelectEvent().
+
+commit 5f4058db225d7cb4455fd27b11dff10422e94748
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Mar 3 14:39:28 2009 +1000
+
+    Replace all XDevice* with ints.
+    
+    There's no reason to have XDevice structs. It's not as if they carry useful
+    information.
+
+commit 2d5bdbe0fad5f22f153aa74e38aa3a1ca09d4192
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Mar 3 14:53:23 2009 +1000
+
+    Change XIGetClientPtr to take an int, not an XID
+
+commit 6be974ec5597ef37fbd3a6057d52a38356f544e0
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Feb 25 15:53:29 2009 +1000
+
+    Fix the already existing XI2 calls to the new XI2 protocol. FIXME
+    
+    FIXME: not bisectable due to XiSelectInput.
+    
+    This includes namespacing them with an XI2 prefix.
+    
+    Affected calls:
+        XIGetClientPointer
+        XISetClientPointer
+        XIDefineDeviceCursor
+        XIUndefineDeviceCursor
+        XIWarpDevicePointer
+        XIQueryDevicePointer
+        XIChangeDeviceHierarchy (+ event)
+
+commit 60b2d114d06617ca60c2905373829299dc051c7f
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Feb 25 15:32:53 2009 +1000
+
+    Move current XI2 stuff out of XInput.h, into XInput2.h
+    
+    This means XInput2.h is rather messy, but it also means we can leave XInput.h
+    untouched for the XI2 rework.
+
+commit c0e3fef8cc7f1953377f61b80d9b8a5ce2fcf2b7
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Feb 26 15:23:57 2009 +1000
+
+    Require inputproto 1.9.99.7.
+
+commit 660b0abdb8dbc7959f9d97b83ac48110a56fd216
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Feb 25 16:24:56 2009 +1000
+
+    XIint.h: include XIproto.h for xAnyClassPtr.
+
+commit 3e38a82102975670d490d95f595a410f38f4e221
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Feb 25 16:02:07 2009 +1000
+
+    Disable generic event handling for now to allow bisecting.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit c56b75732f4506bae234a5cda474c837bb274d6b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Feb 26 16:33:24 2009 +1000
+
+    Back out the XQueryInputVersion hack, restore previous state.
+    
+    XI2 should use a separate request to query the version rather than piggy-back
+    on an existing badly defined request.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 5ead375009f53c9a4634dc8f1939463ac8ef510a
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Feb 25 15:58:41 2009 +1000
+
+    Remove XExtendedGrabDevice.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 3992afdd5593f391bcff1eb39d7e975886d817e3
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Feb 25 16:12:35 2009 +1000
+
+    Remove DeviceEnter/LeaveNotify handling.
+    
+    This will be replaced by XI2 GenericEvents.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 62858c426e6de1b99df660251737233afd335302
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Feb 25 16:04:16 2009 +1000
+
+    Remove AttachClass handling from ListDevices.
+    
+    If you want attachment information, use XI2 and XQueryDevice().
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit cbdc33d903ec6f90a42ec3c31905eeaef9ecf0a2
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Feb 25 17:00:16 2009 +1000
+
+    XGetDeviceControl: size the libXi structs, not the wire structs (#20293)
+    
+    X.Org Bug 20293 <http://bugs.freedesktop.org/show_bug.cgi?id=20293>
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 78f64722c57ff5ec5d0ae35da0c8f151598e6d6b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Feb 25 16:59:04 2009 +1000
+
+    XGetDeviceControl: Add a missing break leading to wrong length calculation.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 8f174b7f5e57c6b3e123476f384ce9164cda11b7
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Feb 25 15:28:28 2009 +1000
+
+    Remove leftover WindowAccess function declarations.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 6e1159a9059d762d6b5d24455237a088e839fe2c
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Mon Feb 2 20:34:34 2009 -0800
+
+    Add README with pointers to mailing list, bugzilla & git repos
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit ba2546a51d5f9087ec54fba7cae46ea1f210198a
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Thu Jan 29 19:30:30 2009 -0200
+
+    Return NULL on error, and match LockDisplay with UnlockDisplay.
+
+commit 4a1d1ff1195a2ed43ace1a33e429f2272f1331af
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Thu Jan 29 19:22:47 2009 -0200
+
+    Janitor: make distcheck, compile warnings, extra .gitignore files.
+
+commit d0326fe8cdbb08d4f52d79fd3fd4e1b2a0951d5e
+Author: Dan Nicholson <dbn.lists@gmail.com>
+Date:   Tue Jan 13 15:54:35 2009 -0800
+
+    Fix build when xmlto is not available
+    
+    When xmlto is not available, make bombs since it has no way to generate
+    the man pages from the XI.xml. This returns the man page installation to
+    only occuring when xmlto is available. Unfortunately, this means they
+    will also not be installed when the generated pages are distributed.
+    
+    Signed-off-by: Dan Nicholson <dbn.lists@gmail.com>
+
+commit 9911b7846ca2cedf08a963c84efe7907438975c1
+Author: Dan Nicholson <dbn.lists@gmail.com>
+Date:   Tue Dec 16 16:45:16 2008 -0800
+
+    Be smarter about generating man pages
+    
+    With the current rules, the man pages will be generated repeatedly if you
+    have xmlto installed. This is because make always thinks they are out of
+    date with respect to their prerequisite, do_xmlto_stage. They are changed
+    here to handle the multiple output files as described in the automake
+    manual.
+    
+    distcheck has been confirmed to still work such that building from the
+    tarball does not require xmlto. On the other hand, if the user wants to
+    rebuild the man pages, they'll have to explicitly touch XI.xml.
+    
+    It may be better to split the xml into per-page files so that xmlto only
+    generates one output at a time. A toplevel XI.xml can still pull together
+    all the pieces with XInclude.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 9e9bf1e477e764b596eb89119c0497b274b87897
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Sun Dec 21 16:08:08 2008 +0100
+
+    Hide private functions
+
+commit db1215bf4785acb20610a7f1302e8dc3ec4d19e0
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Fri Dec 19 16:06:50 2008 +0100
+
+    COPYING: add Peter's copyright notice and license
+
+commit dd89e1187114ba7ece2e4bcc9c25ea5139ea4f0a
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Dec 8 08:34:53 2008 +1000
+
+    Restore XAllowDeviceEvents()
+    
+    Got accidentally removed as part of
+    f938c524f74fa8828a  Purge device-based window access code.
+    
+    XAllowDeviceEvents is the XI equivalent to XAllowEvents, required to thaw devices
+    after grabs, not related to the access control code.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 13dee4565b509ed1ef2fbc78b1987a69f10b02e7
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Mon Nov 17 11:34:44 2008 +1000
+
+    Bump to 1.2.99.1
+    
+    We need libXi 1.2 for the property support, so let's bump this one up by one.
+
+commit 74b2cb0be98057a522c543b5259396ec1b456794
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Wed Nov 12 22:26:43 2008 +1000
+
+    man: fix out of source builds.
+    
+    As pointed out by johnflux on IRC.
+
+commit f938c524f74fa8828a954bed51d0f3c4c7eb0fad
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Fri Oct 31 18:02:02 2008 +1030
+
+    Purge device-based window access code.
+    
+    Requires inputproto 1.9.99.6.
+
+commit e5c529813b04327babc20e51ca56006210cb0c37
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Mon Sep 29 16:40:21 2008 +0930
+
+    Add XI_JOYSTICK to list of defined types.
+
+commit e179b124aac13387c6f730197b8852c1f69eb9e3
+Author: Shunichi Fuji <palglowr@gmail.com>
+Date:   Fri Sep 26 14:47:49 2008 +0930
+
+    Build fix: remove dropped man pages for Conrigure/QueryDeviceProperty.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
+
+commit ec2665e6ba0e71a1726816054b40f71782874373
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Fri Sep 26 10:13:57 2008 +0930
+
+    Require inputproto 1.9.99.5.
+
+commit f9a5371d43b2c6023745f766d0e8ceff2acdff60
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Fri Sep 26 10:12:31 2008 +0930
+
+    Adjust to new property API.
+    
+    XConfigureDeviceProperty is gone.
+    XQueryDeviceProperty is gone.
+    XGetDeviceProperty doesn't have "pending" anymore.
+
+commit 822bff60ea26c0b509fd4de35099b4d94e9e99de
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Fri Aug 15 15:08:07 2008 +0930
+
+    Require inputproto 1.9.99.4.
+
+commit bec02767629ed795582ba3f645299d7036093511
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Wed Aug 13 12:03:29 2008 +0930
+
+    Backport device property code to XI 1.5.
+    
+    Ditching generic events, using normal XI events instead.
+
+commit c5179577ddf0680dffb480d27db9036e9bd27716
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Wed Aug 13 10:27:03 2008 +0930
+
+    Remove RCS tags.
+
+commit bfd2e08f3530091fbcd8c078f684e9aab9057df0
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jul 9 15:38:57 2008 +0930
+
+    Update man pages to include new device properties calls.
+
+commit 0211e3e8277c590349903989f1676f6af4baa44b
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jul 9 16:54:32 2008 +0930
+
+    Add XDevicePropertyNotifyEvent support.
+
+commit 7d5bb99ffce3200f82420c5a5ebac3b445aac633
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jul 9 16:53:46 2008 +0930
+
+    Add support for input device properties requests.
+
+commit 908ac35ebb25e2f55945825e6256d1848e17cc38
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu May 29 13:19:06 2008 +0930
+
+    Bump to 1.1.99.1
+
+commit f4739e18bb44e7a04ed0ea6ec87d53ae5fb13e7d
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu May 29 13:18:38 2008 +0930
+
+    Update required packages again, needs updated libX11, libXext, etc.
+
+commit 9831db88ee8e69dc6cf8fad0ac83d40bedd5c463
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu May 29 12:45:57 2008 +0930
+
+    Don't fail man build when missing xmlto.
+    
+    If xmlto is missing during configure, print out a warning and just do an empty
+    man build with no man pages at all. Better than failing with obscure errors.
+
+commit fd8198513c865f616be8059907550db7f777b089
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Wed May 28 17:14:17 2008 +0930
+
+    Reguire inputproto 1.9.99.
+
+commit 135b25157ee3e44467264a6df2e1f92f3a785643
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Fri May 23 10:30:56 2008 +0930
+
+    Add .PHONY build target to fix parallel builds.
+    
+    Copied from libXtst.
+
+commit 74cc34496d6ed23d8dad259c036bbfaa63b8eb15
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu May 22 12:58:55 2008 +0930
+
+    Ansify the XI 2 functions.
+
+commit 50990b8deb8b8484e9e02e313387ea4d2ddbd242
+Merge: 26dde5a 145947e
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu May 22 12:48:40 2008 +0930
+
+    Merge branch 'master' into mpx
+
+commit 145947ed603207e85a7fcb502f88717a22dfec55
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Fri Feb 29 18:14:00 2008 -0300
+
+    libXi ansification.
+    
+    Thre are still two remaining compiler warnings, because of non matching
+    function prototypes and function pointer arguments prototypes:
+    
+    src/XSndExEv.c:XSendExtensionEvent()
+      variable register Status(**fp) (Display *, XEvent*, xEvent **, int *)
+      doesn't match struct _XDisplay's:
+      Status (*wire_vec[128])( /* vector for event to wire */
+                    Display *       /* dpy */,
+                    XEvent *        /* re */,
+                    xEvent *        /* event */
+                    );
+    
+    and
+    
+    src/XExtInt.c:xinput_extension_hooks field event_to_wire of type
+      XExtensionHooks that has the prototype     Status (*event_to_wire)(
+             Display*                  /* display */,
+                  XEvent*                      /* re */,
+                  xEvent*                      /* event */
+      );
+      does not match Status
+      _XiEventToWire(
+        register Display        *dpy,          /* pointer to display structure */
+        register XEvent         *re,           /* pointer to client event */
+        register xEvent        **event,        /* wire protocol event */
+        register int    *count);
+    
+    Signed-off-by: Peter Hutterer <peter@cs.unisa.edu.au>
+
+commit 26dde5aaf4bbc89140cc4e3d13fe18036041022d
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Wed Apr 30 10:35:12 2008 +0930
+
+    Fix up AM_CFLAGS, pulled in the system-includes before the local ones.
+
+commit d68d321c0692848dd5eb67a3713676498c1c646b
+Merge: 7d0977b 3e99cc2
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Mon Apr 28 14:35:11 2008 +0930
+
+    Merge branch 'master' into mpx
+    
+    Conflicts:
+    
+       .gitignore
+       man/XGrabDeviceKey.man
+       man/XListInputDevices.man
+
+commit 7d0977bc02ce4f29c0ed335fcdcce4ed7c328259
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Mon Apr 28 11:24:40 2008 +0930
+
+    man: more formatting changes (indentation, whitespaces, linewidth).
+
+commit 2e4cb17b0354fb424f841431a4a20cf6a3e3059c
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Sun Apr 27 19:46:21 2008 +0930
+
+    man: formatting changes in XI.xml
+
+commit 212fb41a101833c817195ef02d20248523929ef3
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Sun Apr 27 19:26:55 2008 +0930
+
+    man: fix up use of <function> tag and some whitespaces.
+
+commit 4ce9781be5f3468d184e34bf36329aa220c726bb
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Sun Apr 27 19:11:06 2008 +0930
+
+    man: add old HP, Ardent Computer copyright, plus my new one.
+
+commit 36f17efe0a4b0278fd442c0bcd97a9d762d96011
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Sun Apr 27 19:01:39 2008 +0930
+
+    .gitignore: add man pages.
+
+commit ea09ee20525e4e6a0a6517654ed12fd419f00b23
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Sun Apr 27 19:01:03 2008 +0930
+
+    man: switch over to using xmlto to generate man pages.
+    
+    Removing all nroff man pages.
+
+commit b620f6995b76742c95b32db054d0b5d9fef7a33d
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Sun Apr 27 18:57:48 2008 +0930
+
+    man: fixes in XI.xml
+    
+    Some global whitespace replacements (e.g. space before comma)
+    Splitting refnames where two functions are listed.
+    Adding refmiscinfo tags (see libXtst)
+
+commit 51886a38dd42bb62bf3ffcadbf73472e6d2b514f
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Sun Apr 27 16:33:00 2008 +0930
+
+    man: add XI.xml. Contains all libXi man pages in docbook.format.
+    
+    Note that conversion was half-automated and half-manual. There's a lot of
+    little things to be fixed up.
+
+commit c142891001e53b3c9d1d4a0cfcb0ff555c2f0070
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Sat Apr 26 17:07:39 2008 +0930
+
+    Deprecate XGetExtensionVersion(), replace with XQueryInputVersion().
+    
+    We need XI to be able to do some sort of versioning support.
+
+commit 94284e40f5fc9bf30cc2cc5915f6adb22de7bffe
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Fri Apr 25 18:07:36 2008 +0930
+
+    Add XInput.h file from inputproto package.
+    
+    This file only belongs to libXi, it shouldn't have been in the inputproto
+    package in the first place. For a revision history of this file refer to
+    git://anongit.freedesktop.org/git/xorg/proto/inputproto
+
+commit 166083c09a96b1b7e612bdbb1515d79c3bf57185
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Fri Apr 25 18:05:37 2008 +0930
+
+    Removing previously removed man pages from Makefile.am as well...
+
+commit c1c8a0e585089b3c18ddbd9039f0053a40dbe6cb
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Fri Apr 25 17:58:16 2008 +0930
+
+    Extend XListInputDevices man page to include MPX details.
+
+commit 064f0ec80c6e3cd2f05dd104ca17359b2f7ab833
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Fri Apr 25 17:37:24 2008 +0930
+
+    Remove XChangePointerKeyboardPairing call.
+
+commit ef953b30eb212a65e2aa841c8ccdbbe9127b3b56
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Fri Apr 25 17:34:57 2008 +0930
+
+    Remove XChangePointerKeyboardPairing and XGetPairedPointer man pages.
+    
+    Calls don't exist anymore.
+
+commit 3e99cc281509c70c9240e71ae55cf4e62c6569ba
+Author: Matthieu Herrb <matthieu.herrb@laas.fr>
+Date:   Sun Mar 9 08:30:32 2008 +0100
+
+    nuke RCS Ids
+
+commit df2cf307c365feea924f2c907d8109cf53461a75
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Tue Feb 26 15:47:25 2008 +1030
+
+    Remove XGetPairedPointer(), was removed from the protocol.
+    
+    The information needed is in the attached field of ListInputDevices.
+
+commit 5ca4f620883c63e57edd409b139d82092679010a
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Tue Feb 26 15:45:46 2008 +1030
+
+    Remove XExtendedUngrabDevice. XUngrabDevice does the same.
+
+commit 2b25e823d3c0820b135fb42584be462dba342aa7
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Feb 14 18:30:09 2008 +1030
+
+    XChangeDeviceHiearchy has changed to take a array of unions.
+    
+    And the parameters were swapped around too.
+
+commit 80159390595f9a8970c114c66190db371d585da1
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Feb 14 09:24:29 2008 +1030
+
+    XQueryDevicePointer: remove unused variables.
+
+commit e3492c8385b2d0cce0c6e3e862f43a63f3e8917b
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Feb 14 09:23:03 2008 +1030
+
+    XQueryDevicePointer: "shared" parameter removed.
+
+commit aa6c7a07d7f3f73980ad3b6c537b5f83bc3ddd30
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Feb 14 09:21:26 2008 +1030
+
+    Remove XFakeDeviceData call.
+    
+    This call needs to be better refined and tested before we put it in.
+
+commit d97dcf6896a1c16b46068d16d3d689a3720cce46
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Feb 14 09:20:53 2008 +1030
+
+    Remove RawDeviceEvent parsing. These events have been removed.
+
+commit 447441f4dfdd114ce1f738ccfda097ca1f4d609a
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Feb 14 09:19:35 2008 +1030
+
+    Remove XGrabAccessControl and XUngrabAccessControl calls.
+
+commit 1b15f1bc3b8b33da3a30b7ee23c728dce9e48929
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Sat Jan 26 10:50:28 2008 +1030
+
+    XiSelectEvent: add additional device parameter.
+
+commit 411340ccb7070e2e966a36f64f2fb3019ea0242a
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Nov 29 13:49:21 2007 -0800
+
+    Coverity #743/744: Returned without freeing storage bufp/savp
+    
+    If either bufp or savp failed to malloc, we returned without freeing the other.
+
+commit 5ac8f5dcfb2cf5f695c903179a5a95ac6bd4303e
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Tue Nov 27 10:47:56 2007 +1030
+
+    GetDeviceControl: calculate the length field correctly.
+    
+    Length field should indicate the length of the struct in bytes. Not the length
+    of the pointer to the struct...
+    (cherry picked from commit ddcc71df2a273a410cb5a933aef5501fa56d84cf)
+
+commit ddcc71df2a273a410cb5a933aef5501fa56d84cf
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Tue Nov 27 10:47:56 2007 +1030
+
+    GetDeviceControl: calculate the length field correctly.
+    
+    Length field should indicate the length of the struct in bytes. Not the length
+    of the pointer to the struct...
+
+commit a9191fcf42a4f5ef5022450b327afe2562c9a0e2
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Wed Nov 14 10:11:15 2007 +1030
+
+    Remove XRegisterPairingClient and XUnregisterPairingClient.
+    
+    Deprecated with the introduction of the device hierarchy.
+
+commit 16dc064bf997dfa9226a574e5989d8cd1209a5b0
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Tue Nov 13 11:39:54 2007 +1030
+
+    Add XDeviceClassesChangedEvent parsing.
+    
+    Some stuff from XListInputDevices moved into separate functions to be re-used
+    in the event parsing.
+
+commit 0e6331a2c8494cd24d75ab80443f9f071be47334
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Nov 8 17:47:06 2007 +1030
+
+    Remove PKPairingChangedEvent, replace with DeviceHierarchyChangedNotify event.
+    
+    Remove leftovers of RandomStringEvent as well.
+
+commit a7f53f26ac83257f594058c484ecd19e009e142c
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Fri Oct 19 14:27:58 2007 +0930
+
+    Add XChangeDeviceHierarchy.
+    
+    Used to create/remove master devices or change attachment of slave devices.
+
+commit d1f92d6c14d7c9b553b8530a1daf0a77a8babccf
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Oct 18 12:22:37 2007 +0930
+
+    Create AttachInfo class for all devices, containing attachment info.
+    
+    Thanks to Xlib's braindead design we can't just add the field to XDeviceInfo.
+    So we just fake up a new class, add it to all devices and let clients deal
+    with it.
+
+commit fbd0431546c3ede8d606559fdd7a18f4cce05743
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Oct 18 10:39:21 2007 +0930
+
+    Add XI_2_Major and XI_2_Minor to versions.
+
+commit 0239ef13d66113024066b7db8ade3942af563656
+Author: Eric Anholt <eric@anholt.net>
+Date:   Wed Sep 5 09:45:20 2007 -0700
+
+    Bump version to 1.1.3.
+
+commit 235b283ef6eda4591c95b4749d0a8cd0181783a6
+Author: James Cloos <cloos@jhcloos.com>
+Date:   Mon Sep 3 05:53:41 2007 -0400
+
+    Add *~ to .gitignore to skip patch/emacs droppings
+
+commit 89d7e38124cdb34c55f8c28680725b5b645fe106
+Author: Eric S. Raymond <esr@thyrsus.com>
+Date:   Sun Jan 14 10:51:00 2007 -0800
+
+    Bug #9659: Bad markup on XListInputDevices.3x
+    
+    X.Org Bugzilla #9659 <https://bugs.freedesktop.org/show_bug.cgi?id=9659>
+
+commit bf01e98979e6fa500f74d882c1b21746c60d5d31
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Wed Aug 1 05:16:45 2007 +0300
+
+    XSetDeviceFocus: Add missing extension check
+    
+    Actually check for Xi existing before we try to do anything fancy.
+
+commit 8f5f7e9d6fc288a5cc00df3a7fec44211cdbe8f4
+Author: David Weinehall <tao@debian.org>
+Date:   Wed Aug 1 05:12:21 2007 +0300
+
+    XGetSelectedExtensionEvents: Still more locking bugs
+    
+    Fix a couple more return-without-unlocks.
+
+commit a07c3cc1eec0427a056414ef44ef6ee4204df383
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Wed Aug 1 03:03:44 2007 +0300
+
+    XChangeDeviceControl: Fix completely broken locking
+    
+    Drop the display lock when we exit from XChangeDeviceControl(), instead of
+    leaking it.
+
+commit 7f1b5257b7eb0c873988c33453c110fc5f9996dd
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Wed Aug 1 01:59:17 2007 +0300
+
+    Bump to 1.1.2
+
+commit 257345a0500ef0b7cf8e56f19a8bf93721408673
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Wed Aug 1 01:37:05 2007 +0300
+
+    DevicePresenceNotify: Don't make non-static function, static
+    
+    I wish that there was a better way to do this, but c'est la vie.  It's our
+    exposed API, so we've just got to deal for now.
+
+commit 3da6998ef89c99ad01f20a8f37e3c26c0b7c1ced
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Fri Jul 27 01:30:13 2007 +0930
+
+    XChangePointerKeyboardPairing, XGetPairedPointer, XSetClientPointer man pages.
+    
+    Use XID instead of int for XGetPairedPointer.
+
+commit 25c023f91851a4b32b295b6d5633f6ee87d0ba14
+Author: Paulo Ricardo Zanoni <prz05@c3sl.ufpr.br>
+Date:   Tue Jul 10 10:14:47 2007 +0930
+
+    Access control: change calls to use XID* instead of char*.
+    
+    X{Deny|Perm}Devices: clear perm/deny list if called with no devices.
+
+commit 9d0aa39742a0d1d4221ad4104708b0f8f60c14c7
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Jul 5 10:47:45 2007 +0930
+
+    Bump to version 1.1.1.
+
+commit ddc3b9cbbcc892a48dce2bd441e6d404cd44d943
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Wed Jun 13 15:36:01 2007 +0930
+
+    Bug 9657: Bad markup on XGrabDeviceKey.3x
+    
+    <https://bugs.freedesktop.org/show_bug.cgi?id=9657>
+
+commit caa4ab9a959140119c6c2fd12a379b55b0dff258
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Wed Jun 13 15:36:01 2007 +0930
+
+    Bug 9657: Bad markup on XGrabDeviceKey.3x
+    
+    <https://bugs.freedesktop.org/show_bug.cgi?id=9657>
+
+commit f128ce2d1f8dcd841185c728a6c2b44bb64108f6
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu May 17 20:16:49 2007 +0930
+
+    Squish flag and same_screen into the upper bits of mode (DeviceEnterLeave).
+
+commit 12e3d8b1db94feecf27ed98c8ac523f755c59e45
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Mon May 14 18:09:38 2007 +0930
+
+    Add XExtendedGrabDevice and XExtendedUngrabDevice.
+
+commit f8215ada9c1f3e8f001c77362005168492e35cf4
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Mon May 7 14:13:40 2007 +0930
+
+    Add XiSelectEvent call.
+    
+    Should have been part of 44ccc08bb19d9d55fb9ff6bfb0592d5d79b9b712.
+
+commit d76c4412c9fab7dae6b0283feb847174fb19d1fe
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Wed May 2 18:17:34 2007 +0930
+
+    Add XFakeDeviceData call.
+
+commit fe33724ed6cdaad6b13a7ca1c9f03dbb98d93982
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Wed May 2 09:44:37 2007 +0930
+
+    Add deviceid and ev-to-wire conversion for RawDeviceEvent.
+
+commit 44ccc08bb19d9d55fb9ff6bfb0592d5d79b9b712
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Tue May 1 22:30:04 2007 +0930
+
+    Add XGE support. Supporting RawDeviceEvents and PairingChangedNotifies.
+
+commit 656b31865bf44b5e9bb9603bed6115d497d94796
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Mar 22 21:15:00 2007 +1030
+
+    Change XSetClientPointer API to use XDevice argument instead of deviceid.
+
+commit 6476513b250a4ea4de1e93bfe00046e9b6a46732
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Mar 22 17:28:54 2007 +1030
+
+    Add XGetClientPointer call.
+    Add XGetPairedPointer call.
+
+commit e3ddf2f58a0e9822c248a362a975bf7bb786e23d
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Fri Mar 9 15:47:36 2007 +1030
+
+    Add XSetClientPointer call.
+
+commit f1df9eb1ffc23b83418f9a9ce31d8b2ec748fbd4
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Feb 22 20:07:11 2007 +1030
+
+    Add calls to allow per-device window access control
+    Cosmetic change,  error return value in XQueryDevicePointer.
+
+commit 21765b25a938cf6c8302415d5d15e9a08c7bed98
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Wed Feb 21 10:02:46 2007 +1030
+
+    Adding XRegisterPairingClient and XUnregisterPairingClient calls.
+
+commit 1ab0fa01391156d96cf6d3adc1076ad5216ac23d
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Feb 15 14:28:17 2007 +1030
+
+    Use flags byte in deviceEnterNotify and XDeviceCrossingEvents.
+
+commit 6a123cbfed985382f5b0c209d880dabeb8ee9733
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Mon Jan 29 18:20:47 2007 +1030
+
+    Adding XChangePointerKeyboardPairing call.
+
+commit bfd533c3a7e854d893a06e6a7fe2b3f079508a4d
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Wed Jan 10 14:53:44 2007 +1030
+
+    Adding DeviceEnterNotify and DeviceLeaveNotify calls
+    New XI version using Add_MPX_Major/Minor
+
+commit ebc24f1fad85281a1e9e795ec261eea111f40304
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Mon Jan 8 12:32:27 2007 +1030
+
+    Adding XDefineDeviceCursor and XUndefDeviceCursor calls
+    Fix casting typo in XWarpDevicePointer and XQueryDevicePointer
+    Reverting useless whitespace commit in XExtInt.c
+
+commit 448def03e88d3460ce97a49df0816dedd609c1e3
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Wed Dec 20 13:08:29 2006 +1030
+
+    Adding XWarpDevicePointer and XQueryDevicePointer calls.
+
+commit c8696a5230c565f8999fea136a85a875b04e7b9a
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Wed Dec 6 18:56:56 2006 +0200
+
+    Makefile.am: make ChangeLog hook safer
+    
+    Make ChangeLog hook as safe as possible.
+
+commit 60dccd9a7be95e35b4b8c90934888efedfde84cc
+Author: Jamey Sharp <jamey@minilop.net>
+Date:   Sun Nov 19 01:04:26 2006 -0800
+
+    Bug #8663: _XiCheckExtInit must drop the Display lock in all error cases.
+
+commit 41710257257939b181a1615937610550b40621b9
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Wed Nov 8 16:19:58 2006 +0200
+
+    DevicePresenceNotify: remove verbosity, fill out all fields
+    Don't throw a printf every time we get a DPN, and fill in all the fields
+    when copying the structure.
+
+commit eeebae55766bd4c0121479a7b7188d6a0545f66c
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Sat Oct 21 12:08:21 2006 +0300
+
+    re-enable iscore in DEVICE_CORE, re-enable DEVICE_ENABLE
+
+commit 50c88082ba2ee4785f4beaa351f2b772f1a381ad
+Author: Zephaniah E. Hull <warp@agamemnon.b5>
+Date:   Sat Oct 21 04:01:46 2006 -0400
+
+    Comment out DEVICE_ENABLE, and use of iscore in the DEVICE_CORE control.
+    (We now compile again.)
+    
+    Track the DEVICE_TOUCHSCREEN -> DEVICE_ABS_CALIB and new DEVICE_ABS_AREA
+    changes to the input protocol.
+
+commit 2a3f042241bb63601f5745f397bb1b66ecc5a592
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Fri Oct 20 00:39:50 2006 +0300
+
+    add DEVICE_ENABLE control, add iscore to DEVICE_CORE
+    
+    Add DEVICE_ENABLE for enabling/disabling devices, and an 'iscore'
+    flag to DEVICE_CORE that specifies whether or not the device is a
+    virtual core device.
+
+commit c27e00ceceed3fea011c98c0e70ab568bf0687c6
+Author: Jamey Sharp <jamey@minilop.net>
+Date:   Sun Oct 15 00:26:21 2006 -0700
+
+    Don't call XInput_find_display in _XiCheckExtInit, while the Display lock is held.
+    
+    All callers of _XiCheckExtInit have already called XInput_find_display
+    first outside the lock, so just pass their copy of the XExtDisplayInfo
+    structure down. Besides being more correct, this should be slightly
+    faster. :-)
+    
+    Thanks to Magnus Kessler <Magnus.Kessler@gmx.net> for identifying
+    the bug and proposing a workaround.
+
+commit 5dda1e1509d40ef64ebc816ce538cef462a4fa51
+Author: Jamey Sharp <jamey@minilop.net>
+Date:   Sun Oct 15 00:03:57 2006 -0700
+
+    Don't call XInput_find_display in _XiGetExtensionVersion, while the Display lock is held.
+    
+    _XiGetExtensionVersion has two callers. One had already called
+    XInput_find_display, and the other could easily do so outside the
+    Display lock. So I change the _XiGetExtensionVersion interface to
+    accept a previously-computed XExtDisplayInfo from the caller.
+    Besides being more correct, this should be slightly faster. :-)
+    
+    Thanks to Magnus Kessler <Magnus.Kessler@gmx.net> for identifying
+    the bug and proposing a workaround.
+
+commit 8e317d390d1ef8f2c072957355b5d71db3b89c43
+Author: Jamey Sharp <jamey@minilop.net>
+Date:   Sat Oct 14 23:56:20 2006 -0700
+
+    Add *.o to .gitignore.
+
+commit 6e08a76fd8e356f98d2d6913f0c1b1401090768d
+Merge: ba84e84 360ceac
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Sun Sep 24 20:02:24 2006 +0300
+
+    Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/lib/libXi
+
+commit ba84e84575b4167b0c6298e86a860b0741e2d2a3
+Merge: 93d3c2c 576c579
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Sun Sep 24 19:58:56 2006 +0300
+
+    Merge branch 'input-hotplug'
+
+commit 360ceacb2a3cbad1652d1b02d79b24469db2980a
+Author: Drew Parsons <dparsons@debian.org>
+Date:   Mon Aug 14 14:10:52 2006 -0700
+
+    Bug 7855/Patch 6530: incorrect manpage section suffix
+    
+    Bug 7855 <https://bugs.freedesktop.org/show_bug.cgi?id=7855>
+    Patch 6530 <https://bugs.freedesktop.org/attachment.cgi?id=6530>
+    Based on patch by Fabio M. Di Nitto c/- Colin Watson, Debian Bug#377204.
+
+commit 576c5794cf4b786dfc183c9b6f0a387cad4a5460
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Tue Jul 18 11:46:02 2006 -0400
+
+    bump version to 1.1.0, require inputproto 1.4
+    Bump the version to 1.1.0, and make sure we build with inputproto 1.4,
+    for the DEVICE_{TOUCHSCREEN,CORE} controls, and DevicePresenceNotify.
+
+commit b22d8d0e1519d3f86474f4a79f3c4b27b46c662a
+Author: Daniel Stone <krh@redhat.com>
+Date:   Tue Jul 18 11:45:07 2006 -0400
+
+    add DevicePresenceNotify event
+    Add a DevicePresenceNotify event, which notes that something about the
+    device list changed.
+
+commit 878d9e76764d27f5af861817b46b2caf2d89d7c4
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Tue Jul 18 11:43:24 2006 -0400
+
+    add sensible DEVICE_TOUCHSCREEN and DEVICE_CORE controls
+    Add a more sensible DEVICE_TOUCHSCREEN control, which allows you to
+    clip the x and y values.
+    Add a DEVICE_CORE control, which toggles the sending of core events
+    by extended devices.
+
+commit 93d3c2c45ccd9a806342746c4df33c684a284dd6
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Tue Jul 18 11:39:16 2006 -0400
+
+    remove ChangeLog, add dist hook
+    Remove ChangeLog from the tree, and add a git dist hook to generate
+    it automatically.
+
+commit 8f0d3c6d1f64fdc3b20d0beb831fa457214d5188
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Tue Jul 18 11:28:58 2006 -0400
+
+    fix indentation on function declarations
+    Another brief run with indent.
+
+commit 2d9a57cd77575ca9850d226c79a897cbe88d06e9
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jul 13 14:58:59 2006 -0700
+
+    renamed: .cvsignore -> .gitignore
+
+commit 5693a8da9bdf553e1c9a8ebd50d0d75018cc5c0e
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu Apr 27 00:14:32 2006 +0000
+
+    Bump to 1.0.1
+
+commit f50ac4deec13dfd070715f636887e12f6301070f
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Fri Mar 31 14:50:24 2006 +0000
+
+    Mass reindent. Sorry.
+
+commit 6b055729fd0f89eedd2bf00befd8e42804f12b4a
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Mon Mar 20 19:54:58 2006 +0000
+
+    Bug #6286: Fix build on Cygwin. (Yaakov Selkowitz)
+
+commit 48ad6d382f6fdc9fba416cc5ee9d49324b515b68
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sun Feb 12 18:19:22 2006 +0000
+
+    Bug #5628 <https://bugs.freedesktop.org/show_bug.cgi?id=5628> Shadow pages
+        not created correctly when MANDIR & MANSUFFIX don't match.
+
+commit 04debb347c80f9487b4b507e5202d323d6b2d05a
+Author: Kevin E Martin <kem@kem.org>
+Date:   Thu Dec 15 00:24:30 2005 +0000
+
+    Update package version number for final X11R7 release candidate.
+
+commit 2c3bffb3e4ba665da6a9a152a65ac94b7eb8421e
+Author: Kevin E Martin <kem@kem.org>
+Date:   Tue Dec 6 22:48:43 2005 +0000
+
+    Change *man_SOURCES ==> *man_PRE to fix autotools warnings.
+
+commit 82059b8d9f29e140a9abd40e93bb9f66f0963638
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Dec 3 05:49:44 2005 +0000
+
+    Update package version number for X11R7 RC3 release.
+
+commit f8652da907e902e4ee0b682851e2918a363f0d3d
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Dec 3 04:41:49 2005 +0000
+
+    Add check and cflags for malloc(0) returning NULL.
+
+commit 5401f8a75cdc9ef218acda9a25f440ff136d2543
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Mon Nov 28 22:03:05 2005 +0000
+
+    Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4
+        update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir)
+
+commit fcbf0710165e6f87633e5a044229172c81a90341
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Nov 19 07:15:41 2005 +0000
+
+    Update pkgconfig files to separate library build-time dependencies from
+        application build-time dependencies, and update package deps to work
+        with separate build roots.
+
+commit ef419a10f278e3fc66f2e4166c895e7ffcaab58d
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Oct 19 02:48:10 2005 +0000
+
+    Update package version number for RC1 release.
+
+commit 367dcdc269e67130569ad4665a50fe053070afe7
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Tue Oct 18 00:00:08 2005 +0000
+
+    Use @LIB_MAN_SUFFIX@ instead of $(LIB_MAN_SUFFIX) in macro substitutions to
+        work better with BSD make
+
+commit 8ec9b7efc4f3d9fca2ba25f090b282469c996145
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Mon Oct 17 21:13:21 2005 +0000
+
+    Rename .shadows.DONE to shadows.DONE to avoid some make's thinking it's a
+        suffix rule (reported by Matthieu Herrb)
+
+commit 6967e23708c1411c3ce0fd832f811bb769c99626
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Thu Oct 13 04:25:46 2005 +0000
+
+    Add generated man pages to .cvsignores
+
+commit 7e777d014ec5b9c768f9c0d5a6dc27ff7e89135b
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Wed Oct 12 01:01:29 2005 +0000
+
+    Use sed to put version number in man page Add shadow man pages for man
+        pages that document multiple functions.
+
+commit af2031f4df3080f91ff258b92a4d373b5f28ef48
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Oct 5 19:55:52 2005 +0000
+
+    Added missing file to EXTRA_DIST
+
+commit 403868cc906504c2339a7e204dad39b735b53440
+Author: Kevin E Martin <kem@kem.org>
+Date:   Fri Jul 29 21:22:51 2005 +0000
+
+    Various changes preparing packages for RC0:
+    - Verify and update package version numbers as needed
+    - Implement versioning scheme
+    - Change bug address to point to bugzilla bug entry form
+    - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to
+        reenable it)
+    - Fix makedepend to use pkgconfig and pass distcheck
+    - Update build script to build macros first
+    - Update modular Xorg version
+
+commit e715500a2a4e21adc162bbc0bb3edb60a131831a
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Sat Jul 16 07:10:44 2005 +0000
+
+    Set soversion to 6.0.0 using -version-number.
+
+commit 8603538c6ab5488e70179bdfcf46196b7defe253
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Tue Jul 12 07:59:16 2005 +0000
+
+    Change version to 1.3.0 and soversion to 6.0.0; add XIint.h to distfiles.
+
+commit da5d2fbc2d5ed6ebe09d69816e5d9ac9972a04b2
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Jul 9 06:40:48 2005 +0000
+
+    Add .cvsignore files Switch _la_CFLAGS for AM_CFLAGS to clean up directory
+
+commit 411d59f535e4b5bda9c0fed9384506500c2c18ca
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Fri Jul 1 20:09:11 2005 +0000
+
+    xtrap.pc.in: s/Xfixes/XTrap/ xi.pc.in: s/Xt/Xi/ Xv/src/Makefile.am: remove
+        whitespace after backslash modularizeapp.sh: s/destkop/desktop/
+        modular/symlink.sh: Add bitmaps for xeyes, system.xsm for xsm, and
+        Xvidtune.cpp for xvidtune. Also comment out non-existing mga_bios.h
+    Check in buildsystems for xsetroot, xsm, xstdcmap, xtrap, and xvinfo
+
+commit 42f0c4cae76a67e6684b3b3e76d61780a197c798
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Fri Jul 1 16:16:15 2005 +0000
+
+    spell freedesktop.org correctly
+
+commit b50e6e06f22d3c653166e1817d75c3f4a98b2748
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sun May 22 19:37:27 2005 +0000
+
+    Autotool libXi
+
+commit c1990aed3deb74e3bec72a99bf43debe53d8506a
+Author: Egbert Eich <eich@suse.de>
+Date:   Fri Apr 23 18:43:44 2004 +0000
+
+    Merging XORG-CURRENT into trunk
+
+commit 1ca71687d852a2aba9389f71af0c9df396bbb4b3
+Author: Egbert Eich <eich@suse.de>
+Date:   Sun Mar 14 08:32:12 2004 +0000
+
+    Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004
+
+commit e1cf8e198c35b65c95d54a5dfe888e054f4b7056
+Author: Egbert Eich <eich@suse.de>
+Date:   Wed Mar 3 12:11:28 2004 +0000
+
+    Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004
+
+commit 07b3ed21a6223e9d913e8222bf3a94174a82383a
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 13:35:33 2004 +0000
+
+    readding XFree86's cvs IDs
+
+commit 52336bb78203b3ee478404ba8bf680ae305a0d31
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 09:22:43 2004 +0000
+
+    Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004
+
+commit 1b4f7c4f6dbbc62db74f433a73d129ae507642cd
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Tue Nov 25 19:28:15 2003 +0000
+
+    XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks
+
+commit 3986f13c9319b4f64c7b2ec56391370735e7d51d
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 16:48:49 2003 +0000
+
+    XFree86 4.3.0.1
+
+commit 6b1f87ebe718c9c745d5f4b26343ee3cf34ff5cc
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 16:48:49 2003 +0000
+
+    Initial revision
+
+commit 981020ce68e4c8d9c0dafba631b0fd3328d7fc59
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 15:54:38 2003 +0000
+
+    R6.6 is the Xorg base-line
diff --git a/Makefile.am b/Makefile.am
new file mode 100755 (executable)
index 0000000..d399af2
--- /dev/null
@@ -0,0 +1,17 @@
+SUBDIRS = src 
+#SUBDIRS = src man doc specs
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = xi.pc
+
+MAINTAINERCLEANFILES = ChangeLog INSTALL
+
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+       $(INSTALL_CMD)
+
+ChangeLog:
+       $(CHANGELOG_CMD)
+
+dist-hook: ChangeLog INSTALL
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..44c705e
--- /dev/null
+++ b/README
@@ -0,0 +1,25 @@
+libXi - library for the X Input Extension
+
+All questions regarding this software should be directed at the
+Xorg mailing list:
+
+        http://lists.freedesktop.org/mailman/listinfo/xorg
+
+Please submit bug reports to the Xorg bugzilla:
+
+        https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
+
+The master development code repository can be found at:
+
+        git://anongit.freedesktop.org/git/xorg/lib/libXi
+
+        http://cgit.freedesktop.org/xorg/lib/libXi
+
+For patch submission instructions, see:
+
+       http://www.x.org/wiki/Development/Documentation/SubmittingPatches
+
+For more information on the git code manager, see:
+
+        http://wiki.x.org/wiki/GitPage
+
diff --git a/autogen.sh b/autogen.sh
new file mode 100644 (file)
index 0000000..904cd67
--- /dev/null
@@ -0,0 +1,12 @@
+#! /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..85c620e
--- /dev/null
@@ -0,0 +1,52 @@
+dnl Process this file with autoconf to create configure.
+
+AC_PREREQ([2.60])
+
+AC_INIT(libXi, 1.4.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXi)
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AM_MAINTAINER_MODE
+
+# Require xorg-macros minimum of 1.10 for DocBook XML documentation
+m4_ifndef([XORG_MACROS_VERSION],
+          [m4_fatal([must install xorg-macros 1.10 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.10)
+XORG_DEFAULT_OPTIONS
+XORG_ENABLE_SPECS
+XORG_WITH_XMLTO(0.0.20)
+XORG_WITH_FOP
+XORG_CHECK_SGML_DOCTOOLS(1.5)
+XORG_WITH_ASCIIDOC(8.4.5)
+AM_CONFIG_HEADER(src/config.h)
+
+# Check for progs
+AC_PROG_CC
+AC_PROG_LIBTOOL
+AC_PROG_SED
+
+# Checks for pkg-config packages
+PKG_CHECK_MODULES(XI, [xproto >= 7.0.13] [x11 >= 1.2.99.1] [xextproto >= 7.0.3] [xext >= 1.0.99.1] [inputproto >= 1.9.99.902])
+
+# Check for xmlto and asciidoc for man page conversion
+# (only needed by people building tarballs)
+if test "$have_xmlto" = yes && test "$have_asciidoc" = yes; then
+       have_doctools=yes
+else
+       have_doctools=no
+fi
+AM_CONDITIONAL([HAVE_DOCTOOLS], [test $have_doctools = yes])
+if test $have_doctools = no; then
+       AC_MSG_WARN([xmlto or asciidoc not found - cannot create man pages without it])
+fi
+
+# Determine if the source for man pages is available
+# It may already be present (tarball) or can be generated using doctools
+AM_CONDITIONAL([INSTALL_MANPAGES],
+       [test -f "$srcdir/man/XAllowDeviceEvents.man" || \
+         test $have_doctools = yes])
+
+XORG_CHECK_MALLOC_ZERO
+
+AC_OUTPUT([Makefile
+           src/Makefile
+           xi.pc])
+
diff --git a/debian/README.source b/debian/README.source
new file mode 100644 (file)
index 0000000..34ab4bf
--- /dev/null
@@ -0,0 +1,73 @@
+------------------------------------------------------
+Quick Guide To Patching This Package For The Impatient
+------------------------------------------------------
+
+1. Make sure you have quilt installed
+2. Unpack the package as usual with "dpkg-source -x"
+3. Run the "patch" target in debian/rules
+4. Create a new patch with "quilt new" (see quilt(1))
+5. Edit all the files you want to include in the patch with "quilt edit" 
+   (see quilt(1)).
+6. Write the patch with "quilt refresh" (see quilt(1))
+7. Run the "clean" target in debian/rules
+
+Alternatively, instead of using quilt directly, you can drop the patch in to 
+debian/patches and add the name of the patch to debian/patches/series.
+
+------------------------------------
+Guide To The X Strike Force Packages
+------------------------------------
+
+The X Strike Force team maintains X packages in git repositories on
+git.debian.org in the pkg-xorg subdirectory. Most upstream packages
+are actually maintained in git repositories as well, so they often
+just need to be pulled into git.debian.org in a "upstream-*" branch.
+Otherwise, the upstream sources are manually installed in the Debian
+git repository.
+
+The .orig.tar.gz upstream source file could be generated this
+"upstream-*" branch in the Debian git repository but it is actually
+copied from upstream tarballs directly.
+
+Due to X.org being highly modular, packaging all X.org applications
+as their own independent packages would have created too many Debian
+packages. For this reason, some X.org applications have been grouped
+into larger packages: xutils, xutils-dev, x11-apps, x11-session-utils,
+x11-utils, x11-xfs-utils, x11-xkb-utils, x11-xserver-utils.
+Most packages, including the X.org server itself and all libraries
+and drivers are, however maintained independently.
+
+The Debian packaging is added by creating the "debian-*" git branch
+which contains the aforementioned "upstream-*" branch plus the debian/
+repository files.
+When a patch has to be applied to the Debian package, two solutions
+are involved:
+* If the patch is available in one of the upstream branches, it
+  may be git'cherry-picked into the Debian repository. In this
+  case, it appears directly in the .diff.gz.
+* Otherwise, the patch is added to debian/patches/ which is managed
+  with quilt as documented in /usr/share/doc/quilt/README.source.
+
+quilt is actually invoked by the Debian X packaging through a larger
+set of scripts called XSFBS. XSFBS brings some other X specific
+features such as managing dependencies and conflicts due to the video
+and input driver ABIs.
+XSFBS itself is maintained in a separate repository at
+  git://git.debian.org/pkg-xorg/xsfbs.git
+and it is pulled inside the other Debian X repositories when needed.
+
+The XSFBS patching system requires a build dependency on quilt. Also
+a dependency on $(STAMP_DIR)/patch has to be added to debian/rules
+so that the XSFBS patching occurs before the actual build. So the
+very first target of the build (likely the one running autoreconf)
+should depend on $(STAMP_DIR)/patch. It should also not depend on
+anything so that parallel builds are correctly supported (nothing
+should probably run while patching is being done). And finally, the
+clean target should depend on the xsfclean target so that patches
+are unapplied on clean.
+
+When the upstream sources contain some DFSG-nonfree files, they are
+listed in text files in debian/prune/ in the "debian-*" branch of
+the Debian repository. XSFBS' scripts then take care of removing
+these listed files during the build so as to generate a modified
+DFSG-free .orig.tar.gz tarball.
diff --git a/debian/changelog b/debian/changelog
new file mode 100755 (executable)
index 0000000..c8dd5b8
--- /dev/null
@@ -0,0 +1,330 @@
+libxi (2:1.4.0-1slp2) unstable; urgency=low
+
+  * [X11R7.6] upgrade package 
+  * Git: 165.213.180.234:slp/pkgs/xorg/lib/libxi
+  * Tag: libxi_1.4.0-1slp2
+
+ -- SooChan Lim <sc1.lim@samsung.com>  Wed, 05 Jan 2011 19:53:50 +0900
+
+libxi (2:1.3.2-10slp2) unstable; urgency=low
+
+  * Reupload package to rebuild on new version of libx11 (libx11_1.3.2-11slp2)
+  * Git: 165.213.180.234:/git/slp/pkgs/xorg/lib/libxi
+  * Tag: libxi_1.3.2-10slp2
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Sat, 27 Nov 2010 21:40:43 +0900
+
+libxi (2:1.3.2-9slp2) unstable; urgency=low
+
+  * Reupload package to rebuild on new version of libx11
+  * Git: 165.213.180.234:/git/slp/pkgs/xorg/lib/libxi
+  * Tag: libxi_1.3.2-9slp2
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Sat, 27 Nov 2010 18:37:31 +0900
+
+libxi (2:1.3.2-8slp2) unstable; urgency=low
+
+  * Apply XI2 sendevent patch and enable _F_ENABLE_XI2_SENDEVENT_ macro
+  * Git: 165.213.180.234:/git/slp/pkgs/xorg/lib/libxi
+  * Tag: libxi_1.3.2-8slp2
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Sat, 27 Nov 2010 17:31:41 +0900
+
+libxi (2:1.3.2-7slp2) unstable; urgency=low
+
+  * Update maintainer
+  * Git: 165.213.180.234:/git/slp/pkgs/xorg/lib/libxi
+  * Tag: libxi_1.3.2-7slp2
+
+ -- SooChan Lim <sc1.lim@samsung.com>  Sat, 20 Nov 2010 14:58:21 +0900
+
+libxi (2:1.3.2-6slp2) unstable; urgency=low
+
+  * Update maintainer
+  * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/X11
+  * Tag: libxi_1.3.2-6slp2
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Wed, 21 Apr 2010 13:49:05 +0900
+
+libxi (2:1.3.2-5slp2) unstable; urgency=low
+
+  * modify the package name
+
+ -- SooChan Lim <sc1.lim@samsung.com>  Thu, 25 Mar 2010 17:52:46 +0900
+
+libxi (2:1.3.2-4) unstable; urgency=low
+
+  * Fix debian/rules to install .la files properly
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Mon, 07 Dec 2009 14:54:11 +0900
+
+libxi (2:1.3.2-3) unstable; urgency=low
+
+  * Install .la files
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Mon, 07 Dec 2009 10:29:46 +0900
+
+libxi (2:1.3.2-2) unstable; urgency=low
+
+  * Import Debian Package
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Wed, 02 Dec 2009 13:04:50 +0900
+
+libxi (2:1.3.2-1) experimental; urgency=low
+
+  * Initial release (change 1.3 to 1.3.2)
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Sat, 21 Nov 2009 18:39:28 +0100
+
+libxi (2:1.3-4) unstable; urgency=low
+
+  * Add udeb needed for the graphical installer: libxi6-udeb.
+  * Version/Bump some B-D to make sure the udeb gets its dependencies on
+    the (recently-added) udebs rather than on the libraries:
+     - libx11-dev
+     - libxext-dev
+  * Add myself to Uploaders.
+
+ -- Cyril Brulebois <kibi@debian.org>  Thu, 11 Mar 2010 22:49:49 +0100
+
+libxi (2:1.3-3) unstable; urgency=low
+
+  [ Julien Cristau ]
+  * Rename the build directory to not include DEB_BUILD_GNU_TYPE for no
+    good reason.  Thanks, Colin Watson!
+  * Remove myself from Uploaders
+  * Update patch from 2:1.3-2 to not crash if an app (like, say, anything
+    using Qt3) calls libXi functions but the extension isn't available
+    (closes: #568323).  Thanks, Roman Mamedov!
+
+  [ Brice Goglin ]
+  * Remove Jamey Sharp and Josh Triplett from Uploaders, closes: #568276.
+
+  [ Cyril Brulebois ]
+  * Bump Standards-Version from 3.8.3 to 3.8.4 (no changes needed).
+  * Upload to unstable.
+
+ -- Cyril Brulebois <kibi@debian.org>  Wed, 03 Mar 2010 22:14:43 +0100
+
+libxi (2:1.3-2) unstable; urgency=low
+
+  * Initialize extension with the right number of events.  This should fix
+    issues when libXi announces more events than the X server will actually
+    send for that extension, and thus smashes Xlib's event vector (closes:
+    #515734, #515946).  Patch by Peter Hutterer, analysis by Nathan Kidd.
+  * Upload to unstable.
+
+ -- Julien Cristau <jcristau@debian.org>  Wed, 06 Jan 2010 16:23:44 +0000
+
+libxi (2:1.3-1) experimental; urgency=low
+
+  * Bump Standards-Version to 3.8.3.
+  * Add build-deps on xmlto and asciidoc to build the manpages.
+  * New upstream release.
+
+ -- Julien Cristau <jcristau@debian.org>  Sat, 21 Nov 2009 18:39:28 +0100
+
+libxi (2:1.2.99.4-1) experimental; urgency=low
+
+  [ Timo Aaltonen ]
+  * Add README.source from xsfbs.  Bump Standards-Version to 3.8.1.
+
+  [ Julien Cristau ]
+  * Move libxi6-dbg to section 'debug'.
+  * Drop libxi-dev pre-dependency on x11-common, only needed for upgrades from
+    sarge.
+  * New upstream release candidate.
+  * XInput.h moved here from x11proto-input-dev; add Replaces.
+  * Also remove config.h.in in clean.
+  * Bump shlibs and update symbols.
+
+ -- Julien Cristau <jcristau@debian.org>  Tue, 29 Sep 2009 14:24:21 +0200
+
+libxi (2:1.2.1-2) unstable; urgency=low
+
+  * Fix typo in debian/rules, which made us build with make -j if
+    DEB_BUILD_OPTIONS didn't ask for it.  Thanks to Samuel Thibault for
+    reporting the problem!
+
+ -- Julien Cristau <jcristau@debian.org>  Mon, 16 Mar 2009 15:27:45 +0100
+
+libxi (2:1.2.1-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Julien Cristau <jcristau@debian.org>  Thu, 12 Mar 2009 16:00:29 +0100
+
+libxi (2:1.2.0-2) unstable; urgency=low
+
+  * Add symbols file.
+  * Upload to unstable.
+
+ -- Julien Cristau <jcristau@debian.org>  Mon, 16 Feb 2009 19:53:01 +0100
+
+libxi (2:1.2.0-1) experimental; urgency=low
+
+  [ Timo Aaltonen ]
+  * New upstream release.
+  * debian/control:
+    - Bump x11proto-input-dev build-dep to 1.5.
+  * debian/rules:
+    - Bump the shlibs for libxi6.
+
+  [ Julien Cristau ]
+  * Drop -1 debian revisions from build-deps.
+  * Bump Standards-Version to 3.7.3.
+  * Drop the XS- prefix from Vcs-* control fields.
+  * libxi6{,-dbg} don't need to depend on x11-common.
+  * Wrap build-deps in debian/control.
+  * Build-depend on automake and libtool, run autoreconf on build, and allow
+    parallel builds.
+  * Bump libxi-dev's dependency on x11proto-input-dev to 1.5 as well.
+
+  [ Brice Goglin ]
+  * Add a link to www.X.org in the long description.
+
+ -- Julien Cristau <jcristau@debian.org>  Fri, 19 Dec 2008 15:55:22 +0100
+
+libxi (2:1.1.4-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Julien Cristau <jcristau@debian.org>  Mon, 17 Nov 2008 03:16:48 +0100
+
+libxi (2:1.1.3-1) unstable; urgency=low
+
+  * Add upstream URL to debian/copyright.
+  * New upstream release.
+
+ -- Julien Cristau <jcristau@debian.org>  Thu, 06 Sep 2007 01:45:30 +0200
+
+libxi (2:1.1.2-1) unstable; urgency=low
+
+  * New upstream release
+    + fixes locking bugs (closes: #429147).
+  * Add myself to Uploaders and remove Branden and Fabio with their
+    permission.
+  * Use ${binary:Version} instead of ${Source-Version}.
+  * Add a XS-Vcs-Browser header.
+
+ -- Julien Cristau <jcristau@debian.org>  Wed, 01 Aug 2007 05:07:05 +0200
+
+libxi (2:1.1.1-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Julien Cristau <jcristau@debian.org>  Fri, 06 Jul 2007 03:52:46 +0200
+
+libxi (2:1.1.0-2) experimental; urgency=low
+
+  * Pull fixes from upstream git.
+    + remove patch 00_upstream_002_XiCheckExtInit_unlockdisplay.diff applied
+      upstream.
+  * Bump epoch to 2 so ubuntu can sync this package.
+
+ -- Julien Cristau <jcristau@debian.org>  Mon,  5 Mar 2007 17:24:20 +0100
+
+libxi (1:1.1.0-1) experimental; urgency=low
+
+  * Adjust Section values to what the override says.
+  * Update location of upstream repository from CVS to git in the long
+    descriptions.
+  * New upstream release.
+    + Drop patches applied upstream
+    + Bump build-dependency on x11proto-input-dev to >= 1.4.
+  * Install the upstream changelog.
+  * Add XS-Vcs-Git header in debian/control.
+
+ -- Julien Cristau <jcristau@debian.org>  Fri,  9 Feb 2007 12:34:51 +0100
+
+libxi (1:1.0.1-4) unstable; urgency=low
+
+  * libXi: Various Display locking correctness issues (Closes: #400442)
+  * Add Josh and myself to Uploaders.
+
+ -- Jamey Sharp <sharpone@debian.org>  Mon, 27 Nov 2006 15:07:34 -0800
+
+libxi (1:1.0.1-3) unstable; urgency=low
+
+  * Bring X11R7.1 into unstable.  Still closes #377204.
+  * dbg package has priority extra.
+
+ -- Drew Parsons <dparsons@debian.org>  Sat, 26 Aug 2006 20:46:35 +1000
+
+libxi (1:1.0.1-2) experimental; urgency=low
+
+  * Patch 10_manpage_section.diff sets the man page section according
+    to the definition given by xutils macros.  Set Build-Depends:
+    xutils-dev to prove the point.  Install man pages using
+    dh_installman.  Closes: #377204.
+
+ -- Drew Parsons <dparsons@debian.org>  Fri, 11 Aug 2006 15:03:27 +1000
+
+libxi (1:1.0.1-1) experimental; urgency=low
+
+  * New upstream version (X11R7.1).
+    - applies patch 01_manpage_location.diff.
+  * libxi provides no header files, so don't try to install usr/include/X11/*
+  * Exclude .la from dh_install.
+
+ -- Drew Parsons <dparsons@debian.org>  Thu, 10 Aug 2006 03:00:53 +1000
+
+libxi (1:1.0.0-6) UNRELEASED; urgency=low
+
+  * Test for obj-$(DEB_BUILD_GNU_TYPE) before creating it during build;
+    idempotency fix.
+  * Run dh_install w/ --list-missing.
+  * Drop duplicate x11-common dep in -dev package.
+  * Bump standards version to 3.7.2.0.
+  * Version x11-common pre-dep in -dev package to 1:7.0.0 to match
+    the rest of Debian.
+  * Bump debhelper compat to 5.
+  * Fix dh_strip call to skip the -dbg package.
+
+ -- Andres Salomon <dilinger@debian.org>  Mon, 17 Jul 2006 01:21:03 -0400
+
+libxi (1:1.0.0-5) unstable; urgency=low
+
+  * Reorder makeshlib command in rules file so that ldconfig is run
+    properly. Thanks Drew Parsons and Steve Langasek.
+  * Add quilt to build-depends
+
+ -- David Nusinow <dnusinow@debian.org>  Wed, 19 Apr 2006 00:36:48 -0400
+
+libxi (1:1.0.0-4) unstable; urgency=low
+
+  * Remove references to xss in -dev and -dbg package descriptions. Thanks
+    Josh Triplett. (closes: #362059)
+
+ -- David Nusinow <dnusinow@debian.org>  Tue, 11 Apr 2006 20:26:26 -0400
+
+libxi (1:1.0.0-3) unstable; urgency=low
+
+  * Upload to unstable
+
+ -- David Nusinow <dnusinow@debian.org>  Thu, 23 Mar 2006 22:44:42 -0500
+
+libxi (1:1.0.0-2) experimental; urgency=low
+
+  * Backport manpage location fix
+
+ -- David Nusinow <dnusinow@debian.org>  Thu,  9 Mar 2006 23:22:36 -0500
+
+libxi (1:1.0.0-1) experimental; urgency=low
+
+  * First modular upload to Debian
+  * Install manpages in libxi-dev. Thanks Julien Cristau.
+
+ -- David Nusinow <dnusinow@debian.org>  Thu, 29 Dec 2005 20:53:15 -0500
+
+libxi (1:1.3.0-2) breezy; urgency=low
+
+  * Bump libx11-dev and libxext-dev Build-Deps to avoid _XOPEN_SOURCE.
+
+ -- Daniel Stone <daniel.stone@ubuntu.com>  Sat, 23 Jul 2005 00:28:53 +1000
+
+libxi (1:1.3.0-1) breezy; urgency=low
+
+  * First libxi release.
+
+ -- Daniel Stone <daniel.stone@ubuntu.com>  Mon, 16 May 2005 22:10:17 +1000
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..160b558
--- /dev/null
@@ -0,0 +1,85 @@
+Source: libxi
+Section: x11
+Priority: optional
+Maintainer: Sung-Jin Park <sj76.park@samsung.com>, Sangjin Lee <lsj119@samsung.com>, Debian X Strike Force <debian-x@lists.debian.org>
+Uploaders: Sung-Jin Park <sj76.park@samsung.com>, David Nusinow <dnusinow@debian.org>, Drew Parsons <dparsons@debian.org>, Cyril Brulebois <kibi@debian.org>
+Build-Depends: debhelper (>= 5.0.0), x11proto-core-dev (>= 7.0.13), x11proto-xext-dev (>= 7.0.3), x11proto-input-dev (>= 1.9.99.902), libx11-dev (>= 2:1.3.3-2), libxext-dev (>= 2:1.1.1-3), xmlto, asciidoc (>= 8.4.5), pkg-config, quilt, xutils-dev (>= 1:7.4+4), automake, libtool
+Standards-Version: 3.8.4
+Vcs-Git: git://git.debian.org/git/pkg-xorg/lib/libxi
+Vcs-Browser: http://git.debian.org/?p=pkg-xorg/lib/libxi.git
+
+Package: libxi6
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: X11 Input extension library
+ libXi provides an X Window System client interface to the XINPUT
+ extension to the X protocol.
+ .
+ The Input extension allows setup and configuration of multiple input devices,
+ and will soon allow hotplugging of input devices; to be added and removed on
+ the fly.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ <URL:http://xorg.freedesktop.org>
+ <URL:http://lists.freedesktop.org/mailman/listinfo/xorg>
+ .
+ This module can be found at
+ git://anongit.freedesktop.org/git/xorg/lib/libXi
+
+#Package: libxi6-udeb
+#XC-Package-Type: udeb
+#Section: debian-installer
+#Architecture: any
+#Depends: ${shlibs:Depends}, ${misc:Depends}
+#Description: X11 Input extension library
+# This is a udeb, or a microdeb, for the debian-installer.
+
+Package: libxi6-dbg
+Section: debug
+Architecture: any
+Priority: extra
+Depends: ${shlibs:Depends}, ${misc:Depends}, libxi6 (= ${binary:Version})
+Description: X11 Input extension library (debug package)
+ libXi provides an X Window System client interface to the XINPUT
+ extension to the X protocol.
+ .
+ The Input extension allows setup and configuration of multiple input devices,
+ and will soon allow hotplugging of input devices; to be added and removed on
+ the fly.
+ .
+ This package contains the debug versions of the library found in libxi6.
+ Non-developers likely have little use for this package.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ <URL:http://xorg.freedesktop.org>
+ <URL:http://lists.freedesktop.org/mailman/listinfo/xorg>
+ .
+ This module can be found at
+ git://anongit.freedesktop.org/git/xorg/lib/libXi
+
+Package: libxi-dev
+Section: libdevel
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, libxi6 (= ${binary:Version}), libx11-dev, libxext-dev, x11proto-input-dev (>= 1.9.99.902)
+Replaces: x11proto-input-dev (<< 1.9.99)
+Description: X11 Input extension library (development headers)
+ libXi provides an X Window System client interface to the XINPUT
+ extension to the X protocol.
+ .
+ The Input extension allows setup and configuration of multiple input devices,
+ and will soon allow hotplugging of input devices; to be added and removed on
+ the fly.
+ .
+ This package contains the development headers for the library found in
+ libxi6.  Non-developers likely have little use for this package.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ <URL:http://xorg.freedesktop.org>
+ <URL:http://lists.freedesktop.org/mailman/listinfo/xorg>
+ .
+ This module can be found at
+ git://anongit.freedesktop.org/git/xorg/lib/libXi
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..9b57e3e
--- /dev/null
@@ -0,0 +1,44 @@
+This package was downloaded from
+http://xorg.freedesktop.org/releases/individual/lib/
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL HEWLETT-PACKARD 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.
diff --git a/debian/libxi-dev.install b/debian/libxi-dev.install
new file mode 100755 (executable)
index 0000000..603991e
--- /dev/null
@@ -0,0 +1,5 @@
+usr/lib/libXi.a
+usr/lib/libXi.so
+usr/lib/libXi.la
+usr/lib/pkgconfig/xi.pc
+usr/include/X11/extensions/
diff --git a/debian/libxi-dev.manpages b/debian/libxi-dev.manpages
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/debian/libxi6-udeb.install b/debian/libxi6-udeb.install
new file mode 100644 (file)
index 0000000..32abb0e
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/libXi.so.6*
diff --git a/debian/libxi6.install b/debian/libxi6.install
new file mode 100644 (file)
index 0000000..32abb0e
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/libXi.so.6*
diff --git a/debian/libxi6.symbols b/debian/libxi6.symbols
new file mode 100644 (file)
index 0000000..975a92b
--- /dev/null
@@ -0,0 +1,80 @@
+libXi.so.6 libxi6 #MINVER#
+ XAllowDeviceEvents@Base 0
+ XChangeDeviceControl@Base 0
+ XChangeDeviceDontPropagateList@Base 0
+ XChangeDeviceKeyMapping@Base 0
+ XChangeDeviceProperty@Base 2:1.2.0
+ XChangeFeedbackControl@Base 0
+ XChangeKeyboardDevice@Base 0
+ XChangePointerDevice@Base 0
+ XCloseDevice@Base 0
+ XDeleteDeviceProperty@Base 2:1.2.0
+ XDeviceBell@Base 0
+ XFreeDeviceControl@Base 0
+ XFreeDeviceList@Base 0
+ XFreeDeviceMotionEvents@Base 0
+ XFreeDeviceState@Base 0
+ XFreeFeedbackList@Base 0
+ XGetDeviceButtonMapping@Base 0
+ XGetDeviceControl@Base 0
+ XGetDeviceDontPropagateList@Base 0
+ XGetDeviceFocus@Base 0
+ XGetDeviceKeyMapping@Base 0
+ XGetDeviceModifierMapping@Base 0
+ XGetDeviceMotionEvents@Base 0
+ XGetDeviceProperty@Base 2:1.2.0
+ XGetExtensionVersion@Base 0
+ XGetFeedbackControl@Base 0
+ XGetSelectedExtensionEvents@Base 0
+ XGrabDevice@Base 0
+ XIAllowEvents@Base 2:1.2.99.4
+ XIChangeHierarchy@Base 2:1.2.99.4
+ XIChangeProperty@Base 2:1.2.99.4
+ XIDefineCursor@Base 2:1.2.99.4
+ XIDeleteProperty@Base 2:1.2.99.4
+ XIFreeDeviceInfo@Base 2:1.2.99.4
+ XIGetClientPointer@Base 2:1.2.99.4
+ XIGetFocus@Base 2:1.2.99.4
+ XIGetProperty@Base 2:1.2.99.4
+ XIGetSelectedEvents@Base 2:1.2.99.4
+ XIGrabButton@Base 2:1.2.99.4
+ XIGrabDevice@Base 2:1.2.99.4
+ XIGrabEnter@Base 2:1.2.99.4
+ XIGrabFocusIn@Base 2:1.2.99.4
+ XIGrabKeycode@Base 2:1.2.99.4
+ XIListProperties@Base 2:1.2.99.4
+ XIQueryDevice@Base 2:1.2.99.4
+ XIQueryPointer@Base 2:1.2.99.4
+ XIQueryVersion@Base 2:1.2.99.4
+ XISelectEvents@Base 2:1.2.99.4
+ XISetClientPointer@Base 2:1.2.99.4
+ XISetFocus@Base 2:1.2.99.4
+ XIUndefineCursor@Base 2:1.2.99.4
+ XIUngrabButton@Base 2:1.2.99.4
+ XIUngrabDevice@Base 2:1.2.99.4
+ XIUngrabEnter@Base 2:1.2.99.4
+ XIUngrabFocusIn@Base 2:1.2.99.4
+ XIUngrabKeycode@Base 2:1.2.99.4
+ XIWarpPointer@Base 2:1.2.99.4
+ XGrabDeviceButton@Base 0
+ XGrabDeviceKey@Base 0
+ XListDeviceProperties@Base 2:1.2.0
+ XListInputDevices@Base 0
+ XOpenDevice@Base 0
+ XQueryDeviceState@Base 0
+ XSelectExtensionEvent@Base 0
+ XSendExtensionEvent@Base 0
+ XSetDeviceButtonMapping@Base 0
+ XSetDeviceFocus@Base 0
+ XSetDeviceMode@Base 0
+ XSetDeviceModifierMapping@Base 0
+ XSetDeviceValuators@Base 0
+ XUngrabDevice@Base 0
+ XUngrabDeviceButton@Base 0
+ XUngrabDeviceKey@Base 0
+ _XiGetDevicePresenceNotifyEvent@Base 2:1.1.2
+ _xibadclass@Base 0
+ _xibaddevice@Base 0
+ _xibadevent@Base 0
+ _xibadmode@Base 0
+ _xidevicebusy@Base 0
diff --git a/debian/patches/0001-Initialize-extension-with-the-right-number-of-events.patch b/debian/patches/0001-Initialize-extension-with-the-right-number-of-events.patch
new file mode 100644 (file)
index 0000000..6261652
--- /dev/null
@@ -0,0 +1,174 @@
+From 5e87ce95525d6634066384b8dc829bb7c90ec008 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer@who-t.net>
+Date: Wed, 9 Dec 2009 14:06:36 +1000
+Subject: [PATCH] Initialize extension with the right number of events.
+
+If the server supports a lower XI version than the client, the Xlib-internal
+event vector may be smashed. See libXext for more details.
+http://cgit.freedesktop.org/xorg/lib/libXext/commit/?id=83fdb27df4ddc2fb088ddf2ec65f0db6b7c57287
+
+This patch queries the server for the supported XI extension before
+registering the extension with Xlib. The number of events registered depends
+on the server version.
+
+Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+---
+ src/XExtInt.c  |   61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
+ src/XGetVers.c |   24 ++++++++++++++-------
+ src/XIint.h    |    1 +
+ 3 files changed, 77 insertions(+), 9 deletions(-)
+
+Index: libxi/src/XExtInt.c
+===================================================================
+--- libxi.orig/src/XExtInt.c
++++ libxi/src/XExtInt.c
+@@ -173,6 +173,64 @@
+     "BadClass, invalid event class",  /* BadClass */
+ };
++/* Get the version supported by the server to know which number of
++* events are support. Otherwise, a wrong number of events may smash
++* the Xlib-internal event processing vector.
++*
++* Since the extension hasn't been initialized yet, we need to
++* manually get the opcode, then the version.
++*/
++static int
++_XiFindEventsSupported(Display *dpy)
++{
++    XExtCodes codes;
++    XExtensionVersion *extversion = NULL;
++    int nevents = 0;
++
++    if (!XQueryExtension(dpy, INAME, &codes.major_opcode,
++                &codes.first_event, &codes.first_error))
++        goto out;
++
++    LockDisplay(dpy);
++    extversion = _XiGetExtensionVersionRequest(dpy, INAME,
++            codes.major_opcode);
++    UnlockDisplay(dpy);
++    SyncHandle();
++    if (!extversion || !extversion->present)
++        goto out;
++
++    if (extversion->major_version >= 2)
++        nevents = IEVENTS; /* number is fixed, XI2 adds GenericEvents only */
++    else if (extversion->major_version <= 0)
++    {
++        fprintf(stderr,
++                "XInput_find_display: invalid extension version %d.%d\n",
++                extversion->major_version, extversion->minor_version);
++        goto out;
++    }
++    else
++    {
++        switch(extversion->minor_version)
++        {
++            case XI_Add_DeviceProperties_Minor:
++                nevents = XI_DevicePropertyNotify + 1;
++                break;
++            case  XI_Add_DevicePresenceNotify_Minor:
++                nevents = XI_DevicePresenceNotify + 1;
++                break;
++            default:
++                nevents = XI_DeviceButtonstateNotify + 1;
++                break;
++        }
++    }
++
++out:
++    if (extversion)
++        XFree(extversion);
++    return nevents;
++}
++
++
+ _X_HIDDEN
+ XExtDisplayInfo *XInput_find_display (Display *dpy)
+ {
+@@ -180,12 +238,16 @@
+     if (!xinput_info) { if (!(xinput_info = XextCreateExtension())) return NULL; }
+     if (!(dpyinfo = XextFindDisplay (xinput_info, dpy)))
+     {
++      int nevents = _XiFindEventsSupported(dpy);
++
+       dpyinfo = XextAddDisplay (xinput_info, dpy,
+                                 xinput_extension_name,
+                                 &xinput_extension_hooks,
+-                                IEVENTS, NULL);
+-      XESetWireToEventCookie(dpy, dpyinfo->codes->major_opcode, XInputWireToCookie);
+-      XESetCopyEventCookie(dpy, dpyinfo->codes->major_opcode, XInputCopyCookie);
++                                nevents, NULL);
++      if (dpyinfo->codes) {
++        XESetWireToEventCookie(dpy, dpyinfo->codes->major_opcode, XInputWireToCookie);
++        XESetCopyEventCookie(dpy, dpyinfo->codes->major_opcode, XInputCopyCookie);
++      }
+     }
+     return dpyinfo;
+ }
+Index: libxi/src/XGetVers.c
+===================================================================
+--- libxi.orig/src/XGetVers.c
++++ libxi/src/XGetVers.c
+@@ -72,19 +72,15 @@
+     return (ext);
+ }
+-_X_HIDDEN XExtensionVersion *
+-_XiGetExtensionVersion(register Display * dpy, _Xconst char *name,
+-                       XExtDisplayInfo *info)
++_X_HIDDEN XExtensionVersion*
++_XiGetExtensionVersionRequest(Display *dpy, _Xconst char *name, int xi_opcode)
+ {
+     xGetExtensionVersionReq *req;
+     xGetExtensionVersionReply rep;
+     XExtensionVersion *ext;
+-    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+-      return ((XExtensionVersion *) NoSuchExtension);
+-
+     GetReq(GetExtensionVersion, req);
+-    req->reqType = info->codes->major_opcode;
++    req->reqType = xi_opcode;
+     req->ReqType = X_GetExtensionVersion;
+     req->nbytes = strlen(name);
+     req->length += (unsigned)(req->nbytes + 3) >> 2;
+@@ -93,6 +89,7 @@
+     if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) {
+       return (XExtensionVersion *) NULL;
+     }
++
+     ext = (XExtensionVersion *) Xmalloc(sizeof(XExtensionVersion));
+     if (ext) {
+       ext->present = rep.present;
+@@ -101,5 +98,16 @@
+           ext->minor_version = rep.minor_version;
+       }
+     }
+-    return (ext);
++
++    return ext;
++}
++
++_X_HIDDEN XExtensionVersion *
++_XiGetExtensionVersion(register Display * dpy, _Xconst char *name,
++                       XExtDisplayInfo *info)
++{
++    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
++      return ((XExtensionVersion *) NoSuchExtension);
++
++    return _XiGetExtensionVersionRequest(dpy, name, info->codes->major_opcode);
+ }
+Index: libxi/src/XIint.h
+===================================================================
+--- libxi.orig/src/XIint.h
++++ libxi/src/XIint.h
+@@ -14,6 +14,7 @@
+ extern int _XiCheckExtInit(Display *, int, XExtDisplayInfo *);
+ extern XExtensionVersion *_XiGetExtensionVersion(Display *, _Xconst char *, XExtDisplayInfo *);
++extern XExtensionVersion* _XiGetExtensionVersionRequest(Display *dpy, _Xconst char *name, int xi_opcode);
+ extern Status _xiQueryVersion(Display *dpy, int*, int*, XExtDisplayInfo *);
+ extern Status _XiEventToWire(
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644 (file)
index 0000000..89c1e5c
--- /dev/null
@@ -0,0 +1 @@
+0001-Initialize-extension-with-the-right-number-of-events.patch
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..25dc7d0
--- /dev/null
@@ -0,0 +1,110 @@
+#!/usr/bin/make -f
+# debian/rules for the Debian libxi package.
+# Copyright Â© 2004 Scott James Remnant <scott@netsplit.com>
+# Copyright Â© 2005 Daniel Stone <daniel@fooishbar.org>
+# Copyright Â© 2005 David Nusinow <dnusinow@debian.org>
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# set this to the name of the main shlib's binary package
+PACKAGE = libxi6
+
+include debian/xsfbs/xsfbs.mk
+
+LDFLAGS +=  -Wl,--hash-style=both -Wl,--as-needed
+CFLAGS = -Wall -g
+CFLAGS += -D_F_ENABLE_XI2_SENDEVENT_
+
+ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+       NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+       MAKEFLAGS += -j$(NUMJOBS)
+endif
+
+DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
+       confflags += --build=$(DEB_HOST_GNU_TYPE)
+else
+       confflags += --build=$(DEB_HOST_GNU_TYPDEB_HOST_GNU_TYPEE) --host=$(DEB_HOST_GNU_TYPE)
+#      confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
+endif
+
+#configure: $(STAMP_DIR)/patch
+configure: 
+       autoreconf -vfi
+
+obj-$(DEB_BUILD_GNU_TYPE)/config.status: configure
+       mkdir -p obj-$(DEB_BUILD_GNU_TYPE)
+       cd obj-$(DEB_BUILD_GNU_TYPE) && \
+       ../configure --prefix=/usr --mandir=\$${prefix}/share/man \
+                    --infodir=\$${prefix}/share/info $(confflags) \
+                    CFLAGS="$(CFLAGS)" \
+                    LDFLAGS="$(LDFLAGS)" 
+
+
+build: build-stamp
+build-stamp: obj-$(DEB_BUILD_GNU_TYPE)/config.status
+       dh_testdir
+       cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE)
+
+       touch build-stamp
+
+clean: xsfclean
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp
+
+       rm -f config.cache config.log config.status
+       rm -f */config.cache */config.log */config.status
+       rm -f conftest* */conftest*
+       rm -rf autom4te.cache */autom4te.cache
+       rm -rf obj-*
+       rm -f $$(find -name Makefile.in)
+       rm -f INSTALL compile config.guess config.sub configure config.h.in
+       rm -f depcomp install-sh ltmain.sh missing aclocal.m4 mkinstalldirs
+
+       dh_clean
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+
+#      dh_installdocs
+       dh_install --sourcedir=debian/tmp --list-missing --exclude=usr/share/man/man3
+       #dh_install --sourcedir=debian/tmp --list-missing --exclude=libXi.la --exclude=usr/share/man/man3
+#      dh_installman
+#      dh_installchangelogs ChangeLog
+       dh_link
+       dh_strip --dbg-package=$(PACKAGE)-dbg
+       dh_compress
+       dh_fixperms
+       dh_makeshlibs -V'libxi6 (>= 2:1.2.99.4)'
+#      dh_makeshlibs -V'libxi6 (>= 2:1.2.99.4)' --add-udeb=$(PACKAGE)-udeb
+       dh_shlibdeps
+       dh_installdeb
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+# Build architecture-independent files here.
+binary-indep: build install
+# Nothing to do
+
+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..9ae0496
--- /dev/null
@@ -0,0 +1,2 @@
+version=3
+http://xorg.freedesktop.org/releases/individual/lib/ libXi-(.*)\.tar\.gz
diff --git a/debian/xsfbs/repack.sh b/debian/xsfbs/repack.sh
new file mode 100644 (file)
index 0000000..5935cc9
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+set -e
+
+if ! [ -d debian/prune ]; then
+       exit 0
+fi
+
+if [ "x$1" != x--upstream-version ]; then
+       exit 1
+fi
+
+version="$2"
+filename="$3"
+
+if [ -z "$version" ] || ! [ -f "$filename" ]; then
+       exit 1
+fi
+
+dir="$(pwd)"
+tempdir="$(mktemp -d)"
+
+cd "$tempdir"
+tar xf "$dir/$filename"
+cat "$dir"/debian/prune/* | while read file; do rm -f */$file; done
+
+tar czf "$dir/$filename" *
+cd "$dir"
+rm -rf "$tempdir"
+echo "Done pruning upstream tarball"
+
+exit 0
diff --git a/debian/xsfbs/xsfbs.mk b/debian/xsfbs/xsfbs.mk
new file mode 100644 (file)
index 0000000..5e16b10
--- /dev/null
@@ -0,0 +1,276 @@
+#!/usr/bin/make -f
+
+# Debian X Strike Force Build System (XSFBS): Make portion
+
+# Copyright 1996 Stephen Early
+# Copyright 1997 Mark Eichin
+# Copyright 1998-2005, 2007 Branden Robinson
+# Copyright 2005 David Nusinow
+#
+# Licensed under the GNU General Public License, version 2.  See the file
+# /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
+
+# Originally by Stephen Early <sde1000@debian.org>
+# Modified by Mark W. Eichin <eichin@kitten.gen.ma.us>
+# Modified by Adam Heath <doogie@debian.org>
+# Modified by Branden Robinson <branden@debian.org>
+# Modified by Fabio Massimo Di Nitto <fabbione@fabbione.net>
+# Modified by David Nusinow <dnusinow@debian.org>
+# Acknowledgements to Manoj Srivastava.
+
+# Pass $(DH_OPTIONS) into the environment for debhelper's benefit.
+export DH_OPTIONS
+
+# force quilt to not use ~/.quiltrc and to use debian/patches
+QUILT = QUILT_PATCHES=debian/patches quilt --quiltrc /dev/null
+
+# Set up parameters for the upstream build environment.
+
+# Determine (source) package name from Debian changelog.
+SOURCE_NAME:=$(shell dpkg-parsechangelog -ldebian/changelog \
+                        | grep '^Source:' | awk '{print $$2}')
+
+# Determine package version from Debian changelog.
+SOURCE_VERSION:=$(shell dpkg-parsechangelog -ldebian/changelog \
+                        | grep '^Version:' | awk '{print $$2}')
+
+# Determine upstream version number.
+UPSTREAM_VERSION:=$(shell echo $(SOURCE_VERSION) | sed 's/-.*//')
+
+# Determine the source version without the epoch for make-orig-tar-gz
+NO_EPOCH_VER:=$(shell echo $(UPSTREAM_VERSION) | sed 's/^.://')
+
+# Figure out who's building this package.
+BUILDER:=$(shell echo $${DEBEMAIL:-$${EMAIL:-$$(echo $$LOGNAME@$$(cat /etc/mailname 2>/dev/null))}})
+
+# Find out if this is an official build; an official build has nothing but
+# digits, dots, and/or the codename of a release in the Debian part of the
+# version number.  Anything else indicates an unofficial build.
+OFFICIAL_BUILD:=$(shell VERSION=$(SOURCE_VERSION); if ! expr "$$(echo $${VERSION\#\#*-} | sed 's/\(woody\|sarge\|etch\|lenny\)//g')" : ".*[^0-9.].*" >/dev/null 2>&1; then echo yes; fi)
+
+# Set up parameters for the Debian build environment.
+
+# Determine our architecture.
+BUILD_ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
+# Work around some old-time dpkg braindamage.
+BUILD_ARCH:=$(subst i486,i386,$(BUILD_ARCH))
+# The DEB_HOST_ARCH variable may be set per the Debian cross-compilation policy.
+ifdef DEB_HOST_ARCH
+ ARCH:=$(DEB_HOST_ARCH)
+else
+ # dpkg-cross sets the ARCH environment variable; if set, use it.
+ ifdef ARCH
+  ARCH:=$(ARCH)
+ else
+  ARCH:=$(BUILD_ARCH)
+ endif
+endif
+
+# $(STAMP_DIR) houses stamp files for complex targets.
+STAMP_DIR:=stampdir
+
+# $(DEBTREEDIR) is where all install rules are told (via $(DESTDIR)) to place
+# their files.
+DEBTREEDIR:=$(CURDIR)/debian/tmp
+
+# All "important" targets have four lines:
+#   1) A target name that is invoked by a package-building tool or the user.
+#      This consists of a dependency on a "$(STAMP_DIR)/"-prefixed counterpart.
+#   2) A line delcaring 1) as a phony target (".PHONY:").
+#   3) A "$(STAMP_DIR)/"-prefixed target which does the actual work, and may
+#   depend on other targets.
+#   4) A line declaring 3) as a member of the $(stampdir_targets) variable; the
+#   "$(STAMP_DIR)/" prefix is omitted.
+#
+# This indirection is needed so that the "stamp" files that signify when a rule
+# is done can be located in a separate "stampdir".  Recall that make has no way
+# to know when a goal has been met for a phony target (like "build" or
+# "install").
+#
+# At the end of each "$(STAMP_DIR)/" target, be sure to run the command ">$@"
+# so that the target will not be run again.  Removing the file will make Make
+# run the target over.
+
+# All phony targets should be declared as dependencies of .PHONY, even if they
+# do not have "($STAMP_DIR)/"-prefixed counterparts.
+
+# Define a harmless default rule to keep things from going nuts by accident.
+.PHONY: default
+default:
+
+# Set up the $(STAMP_DIR) directory.
+.PHONY: stampdir
+stampdir_targets+=stampdir
+stampdir: $(STAMP_DIR)/stampdir
+$(STAMP_DIR)/stampdir:
+       mkdir $(STAMP_DIR)
+       >$@
+
+# Set up the package build directory as quilt expects to find it.
+.PHONY: prepare
+stampdir_targets+=prepare
+prepare: $(STAMP_DIR)/prepare
+$(STAMP_DIR)/prepare: $(STAMP_DIR)/log $(STAMP_DIR)/genscripts
+       >$@
+
+.PHONY: log
+stampdir_targets+=log
+log: $(STAMP_DIR)/log
+$(STAMP_DIR)/log: $(STAMP_DIR)/stampdir
+       mkdir -p $(STAMP_DIR)/log
+
+# Apply all patches to the upstream source.
+.PHONY: patch
+stampdir_targets+=patch
+patch: $(STAMP_DIR)/patch
+$(STAMP_DIR)/patch: $(STAMP_DIR)/prepare
+       if ! [ `which quilt` ]; then \
+               echo "Couldn't find quilt. Please install it or add it to the build-depends for this package."; \
+               exit 1; \
+       fi; \
+       if $(QUILT) next >/dev/null 2>&1; then \
+         echo -n "Applying patches..."; \
+         if $(QUILT) push -a -v >$(STAMP_DIR)/log/patch 2>&1; then \
+           cat $(STAMP_DIR)/log/patch; \
+           echo "successful."; \
+         else \
+           cat $(STAMP_DIR)/log/patch; \
+           echo "failed! (check $(STAMP_DIR)/log/patch for details)"; \
+           exit 1; \
+         fi; \
+       else \
+         echo "No patches to apply"; \
+       fi; \
+       >$@
+
+# Revert all patches to the upstream source.
+.PHONY: unpatch
+unpatch: $(STAMP_DIR)/log
+       rm -f $(STAMP_DIR)/patch
+       @echo -n "Unapplying patches..."; \
+       if $(QUILT) applied >/dev/null 2>/dev/null; then \
+         if $(QUILT) pop -a -v >$(STAMP_DIR)/log/unpatch 2>&1; then \
+           cat $(STAMP_DIR)/log/unpatch; \
+           echo "successful."; \
+         else \
+           cat $(STAMP_DIR)/log/unpatch; \
+           echo "failed! (check $(STAMP_DIR)/log/unpatch for details)"; \
+           exit 1; \
+         fi; \
+       else \
+         echo "nothing to do."; \
+       fi
+
+# Clean the generated maintainer scripts.
+.PHONY: cleanscripts
+cleanscripts:
+       rm -f $(STAMP_DIR)/genscripts
+       rm -f debian/*.config \
+             debian/*.postinst \
+             debian/*.postrm \
+             debian/*.preinst \
+             debian/*.prerm
+
+# Clean the package build tree.
+.PHONY: xsfclean
+xsfclean: cleanscripts unpatch
+       dh_testdir
+       rm -rf .pc
+       rm -rf $(STAMP_DIR)
+       dh_clean
+
+# Remove files from the upstream source tree that we don't need, or which have
+# licensing problems.  It must be run before creating the .orig.tar.gz.
+#
+# Note: This rule is for Debian package maintainers' convenience, and is not
+# needed for conventional build scenarios.
+.PHONY: prune-upstream-tree
+prune-upstream-tree:
+       # Ensure we're in the correct directory.
+       dh_testdir
+       grep -rvh '^#' debian/prune/ | xargs --no-run-if-empty rm -rf
+
+# Verify that there are no offsets or fuzz in the patches we apply.
+#
+# Note: This rule is for Debian package maintainers' convenience, and is not
+# needed for conventional build scenarios.
+.PHONY: patch-audit
+patch-audit: prepare unpatch
+       @echo -n "Auditing patches..."; \
+       >$(STAMP_DIR)/log/patch; \
+       FUZZY=; \
+       while [ -n "$$($(QUILT) next)" ]; do \
+         RESULT=$$($(QUILT) push -v | tee -a $(STAMP_DIR)/log/patch | grep ^Hunk | sed 's/^Hunk.*\(succeeded\|FAILED\).*/\1/');\
+         case "$$RESULT" in \
+           succeeded) \
+             echo "fuzzy patch: $$($(QUILT) top)" \
+               | tee -a $(STAMP_DIR)/log/$$($(QUILT) top); \
+             FUZZY=yes; \
+             ;; \
+           FAILED) \
+             echo "broken patch: $$($(QUILT) next)" \
+               | tee -a $(STAMP_DIR)/log/$$($(QUILT) next); \
+             exit 1; \
+             ;; \
+         esac; \
+       done; \
+       if [ -n "$$FUZZY" ]; then \
+         echo "there were fuzzy patches; please fix."; \
+         exit 1; \
+       else \
+         echo "done."; \
+       fi
+
+# Generate the maintainer scripts.
+.PHONY: genscripts
+stampdir_targets+=genscripts
+genscripts: $(STAMP_DIR)/genscripts
+$(STAMP_DIR)/genscripts: $(STAMP_DIR)/stampdir
+       for FILE in debian/*.config.in \
+                   debian/*.postinst.in \
+                   debian/*.postrm.in \
+                   debian/*.preinst.in \
+                   debian/*.prerm.in; do \
+         if [ -e "$$FILE" ]; then \
+           MAINTSCRIPT=$$(echo $$FILE | sed 's/.in$$//'); \
+           sed -n '1,/^#INCLUDE_SHELL_LIB#$$/p' <$$FILE \
+             | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >$$MAINTSCRIPT.tmp; \
+           cat debian/xsfbs/xsfbs.sh >>$$MAINTSCRIPT.tmp; \
+           sed -n '/^#INCLUDE_SHELL_LIB#$$/,$$p' <$$FILE \
+             | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >>$$MAINTSCRIPT.tmp; \
+           sed -e 's/@SOURCE_VERSION@/$(SOURCE_VERSION)/' \
+               -e 's/@OFFICIAL_BUILD@/$(OFFICIAL_BUILD)/' \
+             <$$MAINTSCRIPT.tmp >$$MAINTSCRIPT; \
+           rm $$MAINTSCRIPT.tmp; \
+         fi; \
+       done
+       # Validate syntax of generated shell scripts.
+       #sh debian/scripts/validate-posix-sh debian/*.config \
+       #                                    debian/*.postinst \
+       #                                    debian/*.postrm \
+       #                                    debian/*.preinst \
+       #                                    debian/*.prerm
+       >$@
+
+SERVERMINVERS = $(shell cat /usr/share/xserver-xorg/serverminver 2>/dev/null)
+VIDEOABI = $(shell cat /usr/share/xserver-xorg/videoabiver 2>/dev/null)
+INPUTABI = $(shell cat /usr/share/xserver-xorg/inputabiver 2>/dev/null)
+SERVER_DEPENDS = xserver-xorg-core (>= $(SERVERMINVERS))
+VIDDRIVER_PROVIDES = xserver-xorg-video-$(VIDEOABI)
+INPDRIVER_PROVIDES = xserver-xorg-input-$(INPUTABI)
+ifeq ($(PACKAGE),)
+PACKAGE=$(shell awk '/^Package:/ { print $$2; exit }' < debian/control)
+endif
+
+.PHONY: serverabi
+serverabi: install
+ifeq ($(SERVERMINVERS),)
+       @echo error: xserver-xorg-dev needs to be installed
+       @exit 1
+else
+       echo "xserver:Depends=$(SERVER_DEPENDS)" >> debian/$(PACKAGE).substvars
+       echo "xviddriver:Provides=$(VIDDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars
+       echo "xinpdriver:Provides=$(INPDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars
+endif
+
+# vim:set noet ai sts=8 sw=8 tw=0:
diff --git a/debian/xsfbs/xsfbs.sh b/debian/xsfbs/xsfbs.sh
new file mode 100644 (file)
index 0000000..813fd8d
--- /dev/null
@@ -0,0 +1,622 @@
+# This is the X Strike Force shell library for X Window System package
+# maintainer scripts.  It serves to define shell functions commonly used by
+# such packages, and performs some error checking necessary for proper operation
+# of those functions.  By itself, it does not "do" much; the maintainer scripts
+# invoke the functions defined here to accomplish package installation and
+# removal tasks.
+
+# If you are reading this within a Debian package maintainer script (e.g.,
+# /var/lib/dpkg/info/PACKAGE.{config,preinst,postinst,prerm,postrm}), you can
+# skip past this library by scanning forward in this file to the string
+# "GOBSTOPPER".
+
+SOURCE_VERSION=@SOURCE_VERSION@
+OFFICIAL_BUILD=@OFFICIAL_BUILD@
+
+# Use special abnormal exit codes so that problems with this library are more
+# easily tracked down.
+SHELL_LIB_INTERNAL_ERROR=86
+SHELL_LIB_THROWN_ERROR=74
+SHELL_LIB_USAGE_ERROR=99
+
+# old -> new variable names
+if [ -z "$DEBUG_XORG_PACKAGE" ] && [ -n "$DEBUG_XFREE86_PACKAGE" ]; then
+  DEBUG_XORG_PACKAGE="$DEBUG_XFREE86_PACKAGE"
+fi
+if [ -z "$DEBUG_XORG_DEBCONF" ] && [ -n "$DEBUG_XFREE86_DEBCONF" ]; then
+  DEBUG_XORG_DEBCONF="$DEBUG_XFREE86_DEBCONF"
+fi
+
+# initial sanity checks
+if [ -z "$THIS_PACKAGE" ]; then
+  cat >&2 <<EOF
+Error: package maintainer script attempted to use shell library without
+definining \$THIS_PACKAGE shell variable.  Please report the package name,
+version, and the text of this error message to the Debian Bug Tracking System.
+Visit <http://www.debian.org/Bugs/Reporting> on the World Wide Web for
+instructions, read the file /usr/share/doc/debian/bug-reporting.txt from the
+"doc-debian" package, or install the "reportbug" package and use the command of
+the same name to file a report against version $SOURCE_VERSION of this package.
+EOF
+  exit $SHELL_LIB_USAGE_ERROR
+fi
+
+if [ -z "$THIS_SCRIPT" ]; then
+  cat >&2 <<EOF
+Error: package maintainer script attempted to use shell library without
+definining \$THIS_SCRIPT shell variable.  Please report the package name,
+version, and the text of this error message to the Debian Bug Tracking System.
+Visit <http://www.debian.org/Bugs/Reporting> on the World Wide Web for
+instructions, read the file /usr/share/doc/debian/bug-reporting.txt from the
+"doc-debian" package, or install the "reportbug" package and use the command of
+the same name to file a report against version $SOURCE_VERSION of the
+"$THIS_PACKAGE" package.
+EOF
+  exit $SHELL_LIB_USAGE_ERROR
+fi
+
+if [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then
+  RECONFIGURE="true"
+else
+  RECONFIGURE=
+fi
+
+if ([ "$1" = "install" ] || [ "$1" = "configure" ]) && [ -z "$2" ]; then
+  FIRSTINST="yes"
+fi
+
+if [ -z "$RECONFIGURE" ] && [ -z "$FIRSTINST" ]; then
+  UPGRADE="yes"
+fi
+
+trap "message;\
+      message \"Received signal.  Aborting $THIS_PACKAGE package $THIS_SCRIPT script.\";\
+      message;\
+      exit 1" HUP INT QUIT TERM
+
+reject_nondigits () {
+  # syntax: reject_nondigits [ operand ... ]
+  #
+  # scan operands (typically shell variables whose values cannot be trusted) for
+  # characters other than decimal digits and barf if any are found
+  while [ -n "$1" ]; do
+    # does the operand contain anything but digits?
+    if ! expr "$1" : "[[:digit:]]\+$" > /dev/null 2>&1; then
+      # can't use die(), because it wraps message() which wraps this function
+      echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_nondigits() encountered" \
+           "possibly malicious garbage \"$1\"" >&2
+      exit $SHELL_LIB_THROWN_ERROR
+    fi
+    shift
+  done
+}
+
+reject_unlikely_path_chars () {
+  # syntax: reject_unlikely_path_chars [ operand ... ]
+  #
+  # scan operands (typically shell variables whose values cannot be trusted) for
+  # characters unlikely to be seen in a path and which the shell might
+  # interpret and barf if any are found
+  while [ -n "$1" ]; do
+    # does the operand contain any funny characters?
+    if expr "$1" : '.*[!$&()*;<>?|].*' > /dev/null 2>&1; then
+      # can't use die(), because I want to avoid forward references
+      echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_unlikely_path_chars()" \
+           "encountered possibly malicious garbage \"$1\"" >&2
+      exit $SHELL_LIB_THROWN_ERROR
+    fi
+    shift
+  done
+}
+
+# Query the terminal to establish a default number of columns to use for
+# displaying messages to the user.  This is used only as a fallback in the
+# event the COLUMNS variable is not set.  ($COLUMNS can react to SIGWINCH while
+# the script is running, and this cannot, only being calculated once.)
+DEFCOLUMNS=$(stty size 2> /dev/null | awk '{print $2}') || true
+if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" > /dev/null 2>&1; then
+  DEFCOLUMNS=80
+fi
+
+message () {
+  # pretty-print messages of arbitrary length
+  reject_nondigits "$COLUMNS"
+  echo "$*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS} >&2
+}
+
+observe () {
+  # syntax: observe message ...
+  #
+  # issue observational message suitable for logging someday when support for
+  # it exists in dpkg
+  if [ -n "$DEBUG_XORG_PACKAGE" ]; then
+    message "$THIS_PACKAGE $THIS_SCRIPT note: $*"
+  fi
+}
+
+warn () {
+  # syntax: warn message ...
+  #
+  # issue warning message suitable for logging someday when support for
+  # it exists in dpkg; also send to standard error
+  message "$THIS_PACKAGE $THIS_SCRIPT warning: $*"
+}
+
+die () {
+  # syntax: die message ...
+  #
+  # exit script with error message
+  message "$THIS_PACKAGE $THIS_SCRIPT error: $*"
+  exit $SHELL_LIB_THROWN_ERROR
+}
+
+internal_error () {
+  # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message
+  message "internal error: $*"
+  if [ -n "$OFFICIAL_BUILD" ]; then
+    message "Please report a bug in the $THIS_SCRIPT script of the" \
+            "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \
+            "Tracking System.  Include all messages above that mention the" \
+            "$THIS_PACKAGE package.  Visit " \
+            "<http://www.debian.org/Bugs/Reporting> on the World Wide Web for" \
+            "instructions, read the file" \
+            "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \
+            "package, or install the reportbug package and use the command of" \
+            "the same name to file a report."
+  fi
+  exit $SHELL_LIB_INTERNAL_ERROR
+}
+
+usage_error () {
+  message "usage error: $*"
+  message "Please report a bug in the $THIS_SCRIPT script of the" \
+          "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \
+          "Tracking System.  Include all messages above that mention the" \
+          "$THIS_PACKAGE package.  Visit " \
+          "<http://www.debian.org/Bugs/Reporting> on the World Wide Web for" \
+          "instructions, read the file" \
+          "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \
+          "package, or install the reportbug package and use the command of" \
+          "the same name to file a report."
+  exit $SHELL_LIB_USAGE_ERROR
+}
+
+font_update () {
+  # run $UPDATECMDS in $FONTDIRS
+
+  local dir cmd shortcmd x_font_dir_prefix
+
+  x_font_dir_prefix="/usr/share/fonts/X11"
+
+  if [ -z "$UPDATECMDS" ]; then
+    usage_error "font_update() called but \$UPDATECMDS not set"
+  fi
+  if [ -z "$FONTDIRS" ]; then
+    usage_error "font_update() called but \$FONTDIRS not set"
+  fi
+
+  reject_unlikely_path_chars "$UPDATECMDS"
+  reject_unlikely_path_chars "$FONTDIRS"
+
+  for dir in $FONTDIRS; do
+    if [ -d "$x_font_dir_prefix/$dir" ]; then
+      for cmd in $UPDATECMDS; do
+        if which "$cmd" > /dev/null 2>&1; then
+          shortcmd=${cmd##*/}
+          observe "running $shortcmd in $dir font directory"
+         cmd_opts=
+          if [ "$shortcmd" = "update-fonts-alias" ]; then
+            cmd_opts=--x11r7-layout
+          fi
+          if [ "$shortcmd" = "update-fonts-dir" ]; then
+            cmd_opts=--x11r7-layout
+          fi
+          if [ "$shortcmd" = "update-fonts-scale" ]; then
+            cmd_opts=--x11r7-layout
+          fi
+          $cmd $cmd_opts $dir || warn "$cmd $cmd_opts $dir" \
+                              "failed; font directory data may not" \
+                              "be up to date"
+        else
+          warn "$cmd not found; not updating corresponding $dir font" \
+               "directory data"
+        fi
+      done
+    else
+      warn "$dir is not a directory; not updating font directory data"
+    fi
+  done
+}
+
+remove_conffile_prepare () {
+  # syntax: remove_conffile_prepare filename official_md5sum ...
+  #
+  # Check a conffile "filename" against a list of canonical MD5 checksums.
+  # If the file's current MD5 checksum matches one of the "official_md5sum"
+  # operands provided, then prepare the conffile for removal from the system.
+  # We defer actual deletion until the package is configured so that we can
+  # roll this operation back if package installation fails.
+  #
+  # Call this function from a preinst script in the event $1 is "upgrade" or
+  # "install" and verify $2 to ensure the package is being upgraded from a
+  # version (or installed over a version removed-but-not-purged) prior to the
+  # one in which the conffile was obsoleted.
+
+  local conffile current_checksum
+
+  # validate arguments
+  if [ $# -lt 2 ]; then
+    usage_error "remove_conffile_prepare() called with wrong number of" \
+                "arguments; expected at least 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+  shift
+
+  # does the conffile even exist?
+  if [ -e "$conffile" ]; then
+    # calculate its checksum
+    current_checksum=$(md5sum < "$conffile" | sed 's/[[:space:]].*//')
+    # compare it to each supplied checksum
+    while [ -n "$1" ]; do
+      if [ "$current_checksum" = "$1" ]; then
+        # we found a match; move the confffile and stop looking
+        observe "preparing obsolete conffile $conffile for removal"
+        mv "$conffile" "$conffile.$THIS_PACKAGE-tmp"
+        break
+      fi
+      shift
+    done
+  fi
+}
+
+remove_conffile_lookup () {
+  # syntax: remove_conffile_lookup package filename
+  #
+  # Lookup the md5sum of a conffile in dpkg's database, and prepare for removal
+  # if it matches the actual file's md5sum.
+  #
+  # Call this function when you would call remove_conffile_prepare but only
+  # want to check against dpkg's status database instead of known checksums.
+
+  local package conffile old_md5sum
+
+  # validate arguments
+  if [ $# -ne 2 ]; then
+    usage_error "remove_conffile_lookup() called with wrong number of" \
+                "arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  package="$1"
+  conffile="$2"
+
+  if ! [ -e "$conffile" ]; then
+    return
+  fi
+  old_md5sum="$(dpkg-query -W -f='${Conffiles}' "$package" | \
+    awk '{ if (match($0, "^ '"$conffile"' ")) print $2}')"
+  if [ -n "$old_md5sum" ]; then
+    remove_conffile_prepare "$conffile" "$old_md5sum"
+  fi
+}
+
+remove_conffile_commit () {
+  # syntax: remove_conffile_commit filename
+  #
+  # Complete the removal of a conffile "filename" that has become obsolete.
+  #
+  # Call this function from a postinst script after having used
+  # remove_conffile_prepare() in the preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 1 ]; then
+    usage_error "remove_conffile_commit() called with wrong number of" \
+                "arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+
+  # if the temporary file created by remove_conffile_prepare() exists, remove it
+  if [ -e "$conffile.$THIS_PACKAGE-tmp" ]; then
+    observe "committing removal of obsolete conffile $conffile"
+    rm "$conffile.$THIS_PACKAGE-tmp"
+  fi
+}
+
+remove_conffile_rollback () {
+  # syntax: remove_conffile_rollback filename
+  #
+  # Roll back the removal of a conffile "filename".
+  #
+  # Call this function from a postrm script in the event $1 is "abort-upgrade"
+  # or "abort-install" is  after having used remove_conffile_prepare() in the
+  # preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 1 ]; then
+    usage_error "remove_conffile_rollback() called with wrong number of" \
+                "arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+
+  # if the temporary file created by remove_conffile_prepare() exists, move it
+  # back
+  if [ -e "$conffile.$THIS_PACKAGE-tmp" ]; then
+    observe "rolling back removal of obsolete conffile $conffile"
+    mv "$conffile.$THIS_PACKAGE-tmp" "$conffile"
+  fi
+}
+
+replace_conffile_with_symlink_prepare () {
+  # syntax: replace_conffile_with_symlink_prepare oldfilename newfilename \
+  # official_md5sum ...
+  #
+  # Check a conffile "oldfilename" against a list of canonical MD5 checksums.
+  # If the file's current MD5 checksum matches one of the "official_md5sum"
+  # operands provided, then prepare the conffile for removal from the system.
+  # We defer actual deletion until the package is configured so that we can
+  # roll this operation back if package installation fails. Otherwise copy it
+  # to newfilename and let dpkg handle it through conffiles mechanism.
+  #
+  # Call this function from a preinst script in the event $1 is "upgrade" or
+  # "install" and verify $2 to ensure the package is being upgraded from a
+  # version (or installed over a version removed-but-not-purged) prior to the
+  # one in which the conffile was obsoleted.
+
+  local conffile current_checksum
+
+  # validate arguments
+  if [ $# -lt 3 ]; then
+    usage_error "replace_conffile_with_symlink_prepare() called with wrong" \
+                " number of arguments; expected at least 3, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  oldconffile="$1"
+  shift
+  newconffile="$1"
+  shift
+
+  remove_conffile_prepare "$_oldconffile" "$@"
+  # If $oldconffile still exists, then md5sums didn't match.
+  # Copy it to new one.
+  if [ -f "$oldconffile" ]; then
+    cp "$oldconffile" "$newconffile"
+  fi
+
+}
+
+replace_conffile_with_symlink_commit () {
+  # syntax: replace_conffile_with_symlink_commit oldfilename
+  #
+  # Complete the removal of a conffile "oldfilename" that has been
+  # replaced by a symlink.
+  #
+  # Call this function from a postinst script after having used
+  # replace_conffile_with_symlink_prepare() in the preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 1 ]; then
+    usage_error "replace_conffile_with_symlink_commit() called with wrong" \
+                "number of arguments; expected 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  conffile="$1"
+
+  remove_conffile_commit "$conffile"
+}
+
+replace_conffile_with_symlink_rollback () {
+  # syntax: replace_conffile_with_symlink_rollback oldfilename newfilename
+  #
+  # Roll back the replacing of a conffile "oldfilename" with symlink to
+  # "newfilename".
+  #
+  # Call this function from a postrm script in the event $1 is "abort-upgrade"
+  # or "abort-install" and verify $2 to ensure the package failed to upgrade
+  # from a version (or install over a version removed-but-not-purged) prior
+  # to the one in which the conffile was obsoleted.
+  # You should have  used replace_conffile_with_symlink_prepare() in the
+  # preinst.
+
+  local conffile
+
+  # validate arguments
+  if [ $# -ne 2 ]; then
+    usage_error "replace_conffile_with_symlink_rollback() called with wrong" \
+                "number of arguments; expected 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  oldconffile="$1"
+  newconffile="$2"
+
+  remove_conffile_rollback "$_oldconffile"
+  if [ -f "$newconffile" ]; then
+    rm "$newconffile"
+  fi
+}
+
+run () {
+  # syntax: run command [ argument ... ]
+  #
+  # Run specified command with optional arguments and report its exit status.
+  # Useful for commands whose exit status may be nonzero, but still acceptable,
+  # or commands whose failure is not fatal to us.
+  #
+  # NOTE: Do *not* use this function with db_get or db_metaget commands; in
+  # those cases the return value of the debconf command *must* be checked
+  # before the string returned by debconf is used for anything.
+
+  local retval
+
+  # validate arguments
+  if [ $# -lt 1 ]; then
+    usage_error "run() called with wrong number of arguments; expected at" \
+                "least 1, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  "$@" || retval=$?
+
+  if [ ${retval:-0} -ne 0 ]; then
+    observe "command \"$*\" exited with status $retval"
+  fi
+}
+
+make_symlink_sane () {
+  # syntax: make_symlink_sane symlink target
+  #
+  # Ensure that the symbolic link symlink exists, and points to target.
+  #
+  # If symlink does not exist, create it and point it at target.
+  #
+  # If symlink exists but is not a symbolic link, back it up.
+  #
+  # If symlink exists, is a symbolic link, but points to the wrong location, fix
+  # it.
+  #
+  # If symlink exists, is a symbolic link, and already points to target, do
+  # nothing.
+  #
+  # This function wouldn't be needed if ln had an -I, --idempotent option.
+
+  # Validate arguments.
+  if [ $# -ne 2 ]; then
+    usage_error "make_symlink_sane() called with wrong number of arguments;" \
+      "expected 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  # We could just use the positional parameters as-is, but that makes things
+  # harder to follow.
+  local symlink target
+
+  symlink="$1"
+  target="$2"
+
+  if [ -L "$symlink" ] && [ "$(readlink "$symlink")" = "$target" ]; then
+      observe "link from $symlink to $target already exists"
+  else
+    observe "creating symbolic link from $symlink to $target"
+    mkdir -p "${target%/*}" "${symlink%/*}"
+    ln -s -b -S ".dpkg-old" "$target" "$symlink"
+  fi
+}
+
+migrate_dir_to_symlink () {
+  # syntax: migrate_dir_to_symlink old_location new_location
+  #
+  # Per Debian Policy section 6.5.4, "A directory will never be replaced by a
+  # symbolic link to a directory or vice versa; instead, the existing state
+  # (symlink or not) will be left alone and dpkg will follow the symlink if
+  # there is one."
+  #
+  # We have to do it ourselves.
+  #
+  # This function moves the contents of old_location, a directory, into
+  # new_location, a directory, then makes old_location a symbolic link to
+  # new_location.
+  #
+  # old_location need not exist, but if it does, it must be a directory (or a
+  # symlink to a directory).  If it is not, it is backed up.  If new_location
+  # exists already and is not a directory, it is backed up.
+  #
+  # This function should be called from a package's preinst so that other
+  # packages unpacked after this one --- but before this package's postinst runs
+  # --- are unpacked into new_location even if their payloads contain
+  # old_location filespecs.
+
+  # Validate arguments.
+  if [ $# -ne 2 ]; then
+    usage_error "migrate_dir_to_symlink() called with wrong number of"
+                "arguments; expected 2, got $#"
+    exit $SHELL_LIB_USAGE_ERROR
+  fi
+
+  # We could just use the positional parameters as-is, but that makes things
+  # harder to follow.
+  local new old
+
+  old="$1"
+  new="$2"
+
+  # Is old location a symlink?
+  if [ -L "$old" ]; then
+    # Does it already point to new location?
+    if [ "$(readlink "$old")" = "$new" ]; then
+      # Nothing to do; migration has already been done.
+      observe "migration of $old to $new already done"
+      return 0
+    else
+      # Back it up.
+      warn "backing up symbolic link $old as $old.dpkg-old"
+      mv -b "$old" "$old.dpkg-old"
+    fi
+  fi
+
+  # Does old location exist, but is not a directory?
+  if [ -e "$old" ] && ! [ -d "$old" ]; then
+      # Back it up.
+      warn "backing up non-directory $old as $old.dpkg-old"
+      mv -b "$old" "$old.dpkg-old"
+  fi
+
+  observe "migrating $old to $new"
+
+  # Is new location a symlink?
+  if [ -L "$new" ]; then
+    # Does it point the wrong way, i.e., back to where we're migrating from?
+    if [ "$(readlink "$new")" = "$old" ]; then
+      # Get rid of it.
+      observe "removing symbolic link $new which points to $old"
+      rm "$new"
+    else
+      # Back it up.
+      warn "backing up symbolic link $new as $new.dpkg-old"
+      mv -b "$new" "$new.dpkg-old"
+    fi
+  fi
+
+  # Does new location exist, but is not a directory?
+  if [ -e "$new" ] && ! [ -d "$new" ]; then
+    warn "backing up non-directory $new as $new.dpkg-old"
+    mv -b "$new" "$new.dpkg-old"
+  fi
+
+  # Create new directory if it does not yet exist.
+  if ! [ -e "$new" ]; then
+    observe "creating $new"
+    mkdir -p "$new"
+  fi
+
+  # Copy files in old location to new location.  Back up any filenames that
+  # already exist in the new location with the extension ".dpkg-old".
+  observe "copying files from $old to $new"
+  if ! (cd "$old" && cp -a -b -S ".dpkg-old" . "$new"); then
+    die "error(s) encountered while copying files from $old to $new"
+  fi
+
+  # Remove files at old location.
+  observe "removing $old"
+  rm -r "$old"
+
+  # Create symlink from old location to new location.
+  make_symlink_sane "$old" "$new"
+}
+
+# vim:set ai et sw=2 ts=2 tw=80:
+
+# GOBSTOPPER: The X Strike Force shell library ends here.
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100755 (executable)
index 0000000..651b114
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+#
+# 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.
+#
+
+if ENABLE_SPECS
+
+specdir = $(docdir)/$(subdir)
+doc_sources = porting.xml
+dist_spec_DATA = $(doc_sources)
+
+if HAVE_XMLTO
+spec_DATA = $(doc_sources:.xml=.html)
+
+if HAVE_FOP
+spec_DATA += $(doc_sources:.xml=.ps) $(doc_sources:.xml=.pdf)
+endif
+
+if HAVE_XMLTO_TEXT
+spec_DATA += $(doc_sources:.xml=.txt)
+endif
+
+if HAVE_STYLESHEETS
+XMLTO_FLAGS = -m $(XSL_STYLESHEET)
+
+spec_DATA += xorg.css
+xorg.css: $(STYLESHEET_SRCDIR)/xorg.css
+       $(AM_V_GEN)cp -pf $(STYLESHEET_SRCDIR)/xorg.css $@
+endif
+
+CLEANFILES = $(spec_DATA)
+
+SUFFIXES = .xml .ps .pdf .txt .html
+
+%.txt: %.xml $(dist_spec_DATA)
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $<
+
+%.html: %.xml $(dist_spec_DATA)
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
+
+%.pdf: %.xml $(dist_spec_DATA)
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
+
+%.ps: %.xml $(dist_spec_DATA)
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop ps $<
+
+endif HAVE_XMLTO
+endif ENABLE_SPECS
diff --git a/doc/porting.xml b/doc/porting.xml
new file mode 100755 (executable)
index 0000000..1b2f1d7
--- /dev/null
@@ -0,0 +1,1209 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+
+
+<!-- lifted from troff+ms+XMan by doclifter -->
+<book id="porting">
+
+<bookinfo>
+   <title>X11 Input Extension Porting Document</title>
+   <releaseinfo>X Version 11, Release 6.7</releaseinfo>
+   <authorgroup>
+      <author>
+         <firstname>George</firstname><surname>Sachs</surname>
+         <affiliation><orgname>Hewlett-Packard</orgname></affiliation>
+      </author>
+   </authorgroup>
+   <corpname>X Consortium Standard</corpname>
+   <copyright><year>1989</year><holder>Hewlett-Packard Company</holder></copyright>
+   <copyright><year>1990</year><holder>Hewlett-Packard Company</holder></copyright>
+   <copyright><year>1991</year><holder>Hewlett-Packard Company</holder></copyright>
+
+   <copyright><year>1989</year><holder>X Consortium</holder></copyright>
+   <copyright><year>1990</year><holder>X Consortium</holder></copyright>
+   <copyright><year>1991</year><holder>X Consortium</holder></copyright>
+   <affiliation><orgname>X Consortium</orgname></affiliation>
+   <productnumber>X Version 11, Release 6.7</productnumber>
+
+<legalnotice>
+
+
+<para>
+Permission to use, copy, modify, and distribute this documentation for any purpose and without fee is
+hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
+Hewlett-Packard makes no representations about the suitability for any purpose of the information in this
+document. It is provided "as is" without express or implied warranty. This document is only a draft stan-
+dard of the X Consortium and is therefore subject to change.
+</para>
+
+<para>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &ldquo;Software&rdquo;), 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:</para>
+
+<para>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &ldquo;Software&rdquo;), 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:</para>
+
+<para>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</para>
+
+<para>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 X CONSORTIUM 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.</para>
+
+<para>Except as contained in this notice, the name of the X Consortium 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 X Consortium.</para>
+
+<para>X Window System is a trademark of The Open Group.</para>
+</legalnotice>
+
+</bookinfo>
+
+<chapter id="x11_input_extension_porting_document">
+<title>X11 Input Extension Porting Document</title>
+
+<para>
+This document is intended to aid the process of integrating the 
+X11 Input Extension into an X server.
+</para>
+<para>
+<!-- .LP -->
+Most of the functionality provided by the input extension is 
+device- and implementation-independent, and should require no changes.  
+The functionality is implemented by
+routines that typically reside in the server source tree directory 
+extensions/server/xinput.
+This extension includes functions to enable and disable input extension devices,
+select input, grab and focus those device, query and change key 
+and button mappings, and others.  The only input extension requirements 
+for the device-dependent part of X are that the input devices be 
+correctly initialized and input events from those devices be correctly
+generated.  Device-dependent X is responsible for reading input data from 
+the input device hardware and if necessary, reformatting it into X events.
+</para>
+<para>
+<!-- .LP -->
+The process of initializing input extension devices is similar to that used 
+for the core devices, and is described in the following sections.  When
+multiple input devices are attached to X server, the choice of which devices
+to initially use as the core X pointer and keyboard is left 
+implementation-dependent.  It is also up to each implementation to decide
+whether all input devices will be opened by the server during its 
+initialization and kept open for the life of the server.  The alternative is
+to open only the X keyboard and X pointer during server initialization, and
+open other input devices only when requested by a client to do so.  Either
+type of implementation is supported by the input extension.
+</para>
+<para>
+<!-- .LP -->
+Input extension events generated by the X server use the same 32-byte xEvent
+wire event as do core input events.  However, additional information must be
+sent for input extension devices, requiring that multiple xEvents be generated
+each time data is received from an input extension device.  These xEvents are
+combined into a single client XEvent by the input extension library.  A later
+section of this document describes the format and generation of input extension
+events.
+</para>
+<sect1 id="Initializing_Extension_Devices">
+<title>Initializing Extension Devices</title>
+<para>
+<!-- .LP -->
+Extension input devices are initialized in the same manner as the core 
+X input devices.  Device-Independent X provides functions that can be 
+called from DDX to initialize these devices.  Which functions are called
+and when will vary by implementation, and will depend on whether the 
+implementation opens all the input devices available to X when X is initialized,
+or waits until a client requests that a device be opened.
+In the simplest case, DDX will open all input devices as part of its
+initialization, when the InitInput routine is called.
+</para>
+<sect2 id="Summary_of_Calling_Sequence">
+<title>Summary of Calling Sequence</title>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+Device-Independent X       |  Device-Dependent X
+--------------------       |  -------------------             
+                           |                                        
+InitInput --------------&gt;  |  - do device-specific initialization
+                           |                                        
+                           |  - call AddInputDevice  (deviceProc,AutoStart)
+AddInputDevice             |   
+  - creates DeviceIntRec   |
+  - records deviceProc     |
+  - adds new device to     | 
+    list of off_devices.   |
+sets dev-&gt;startup=AutoStart|           
+                           |  - call one of:                       
+                           |    - RegisterPointerDevice (X pointer)
+                           |      - processInputProc = ProcessPointerEvents
+                           |    - RegisterKeyboardDevice (X keyboard)
+                           |      - processInputProc = ProcessKeyboardEvents
+                           |    - RegisterOtherDevice  (extension device)
+                           |      - processInputProc = ProcessOtherEvents
+                           |                                        
+                           |                                        
+InitAndStartDevices -----&gt; |  - calls deviceProc with parameters
+                           |    (DEVICE_INIT, AutoStart)
+sets dev-&gt;inited = return  |
+  value from deviceProc    |    
+                           |                                        
+                           |  - in deviceProc, do one of:                       
+                           |    - call InitPointerDeviceStruct (X pointer)
+                           |    - call InitKeyboardDeviceStruct (X keybd)
+                           |    - init extension device by calling some of:
+                           |      - InitKeyClassDeviceStruct
+                           |      - InitButtonClassDeviceStruct
+                           |      - InitValuatorClassDeviceStruct
+                           |      - InitValuatorAxisStruct
+                           |      - InitFocusClassDeviceStruct
+                           |      - InitProximityClassDeviceStruct
+                           |      - InitKbdFeedbackClassDeviceStruct
+                           |      - InitPtrFeedbackClassDeviceStruct
+                           |      - InitLedFeedbackClassDeviceStruct
+                           |      - InitStringFeedbackClassDeviceStruct
+                           |      - InitIntegerFeedbackClassDeviceStruct
+                           |      - InitBellFeedbackClassDeviceStruct
+                           |    - init device name and type by:
+                           |      - calling MakeAtom with one of the 
+                           |        predefined names
+                           |      - calling AssignTypeAndName
+                           |                                        
+                           |                                        
+for each device added      |                                        
+    by AddInputDevice,     |                                        
+    InitAndStartDevices    |                                        
+    calls EnableDevice if  |  - EnableDevice calls deviceProc with 
+    dev-&gt;startup &amp;         |    (DEVICE_ON, AutoStart)
+    dev-&gt;inited            |  
+                           |                                        
+If deviceProc returns      |  - core devices are now enabled, extension
+    Success, EnableDevice  |    devices are now available to be accessed
+    move the device from   |    through the input extension protocol
+    inputInfo.off_devices  |    requests.                           
+    to inputInfo.devices   |                                        
+</literallayout>
+</para>
+</sect2>
+<sect2 id="Initialization_Called_From_InitInput">
+<title>Initialization Called From InitInput</title>
+<para>
+<!-- .LP -->
+InitInput is the first DDX input entry point called during X server startup.
+This routine is responsible for
+device- and implementation- specific initialization, and for calling
+AddInputDevice to create and initialize the DeviceIntRec structure for each
+input device.  AddInputDevice is passed the address of a procedure to be called
+by the DIX routine InitAndStartDevices when input devices are enabled.
+This procedure is expected to perform X initialization for the input device.
+</para>
+<para>
+<!-- .LP -->
+If the device is to be used as the X pointer, DDX should then call
+RegisterPointerDevice, passing the DeviceIntRec pointer,
+to initialize the device as the X pointer.
+</para>
+<para>
+<!-- .LP -->
+If the device is to be used as the X keyboard, DDX should instead call
+RegisterKeyboardDevice to initialize the device as the X keyboard.
+</para>
+<para>
+<!-- .LP -->
+If the device is to be used as an extension device, DDX should instead
+call RegisterOtherDevice, passing the DeviceIntPtr returned by
+AddInputDevice.
+</para>
+<para>
+<!-- .LP -->
+A sample InitInput implementation is shown below.
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+InitInput(argc,argv)
+    {
+    int i, numdevs, ReadInput();
+    DeviceIntPtr dev;
+    LocalDevice localdevs[LOCAL_MAX_DEVS];
+    DeviceProc kbdproc, ptrproc, extproc;
+
+    /**************************************************************
+     * Open the appropriate input devices, determine which are 
+     * available, and choose an X pointer and X keyboard device
+     * in some implementation-dependent manner.
+     ***************************************************************/
+
+    open_input_devices (&amp;numdevs, localdevs);
+
+    /**************************************************************
+     * Register a WakeupHandler to handle input when it is generated.
+     ***************************************************************/
+
+    RegisterBlockAndWakeupHandlers (NoopDDA, ReadInput, NULL);
+
+    /**************************************************************
+     * Register the input devices with DIX.
+     ***************************************************************/
+
+    for (i=0; i&lt;numdevs; i++)
+        {
+        if (localdevs[i].use == IsXKeyboard)
+            {
+            dev = AddInputDevice (kbdproc, TRUE);
+            RegisterKeyboardDevice (dev);
+            }
+        else if (localdevs[i].use == IsXPointer)
+            {
+            dev = AddInputDevice (ptrproc, TRUE);
+            RegisterPointerDevice (dev);
+            }
+        else 
+            {
+            dev = AddInputDevice (extproc, FALSE);
+            RegisterOtherDevice (dev);
+            }
+        if (dev == NULL)
+            FatalError ("Too many input devices.");
+        dev-&gt;devicePrivate = (pointer) &amp;localdevs[i];
+        }
+</literallayout>
+</para>
+</sect2>
+<sect2 id="Initialization_Called_From_InitAndStartDevices">
+<title>Initialization Called From InitAndStartDevices</title>
+<para>
+<!-- .LP -->
+After InitInput has returned,
+InitAndStartDevices is the DIX routine that is called to enable input devices. 
+It calls the device control routine that was passed to AddInputDevice,
+with a mode value of DEVICE_INIT.  The action taken by the device control
+routine depends on how the device is to be used.  If the device is to be
+the X pointer, the device control routine should call
+InitPointerDeviceStruct to initialize it.  If the device is to be the
+X keyboard, the device control routine should call
+InitKeyboardDeviceStruct.  Since input extension devices may support various
+combinations of keys, buttons, valuators, and feedbacks,
+each class of input that it supports must be initialized.
+Entry points are defined by DIX to initialize each of the supported classes of
+input, and are described in the following sections.
+</para>
+<para>
+<!-- .LP -->
+A sample device control routine called from InitAndStartDevices is 
+shown below.
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+Bool extproc (dev, mode)
+    DeviceIntPtr dev;
+    int mode;
+    {
+    LocalDevice *localdev = (LocalDevice *) dev-&gt;devicePrivate;
+
+    switch (mode)
+        {
+        case DEVICE_INIT:
+            if (strcmp(localdev-&gt;name, XI_TABLET) == 0)
+                {
+                /****************************************************
+                 * This device reports proximity, has buttons,
+                 * reports two axes of motion, and can be focused.
+                 * It also supports the same feedbacks as the X pointer
+                 * (acceleration and threshold can be set).
+                 ****************************************************/
+
+                InitButtonClassDeviceStruct (dev, button_count, button_map);
+                InitValuatorClassDeviceStruct (dev, localdev-&gt;n_axes,);
+                    motionproc, MOTION_BUF_SIZE, Absolute);
+                for (i=0; i&lt;localdev-&gt;n_axes; i++)
+                    InitValuatorAxisStruct (dev, i, min_val, max_val, 
+                        resolution);
+                InitFocusClassDeviceStruct (dev);
+                InitProximityClassDeviceStruct (dev);
+                InitPtrFeedbackClassDeviceStruct (dev, p_controlproc);
+                }
+            else if (strcmp(localdev-&gt;name, XI_BUTTONBOX) == 0)
+                {
+                /****************************************************
+                 * This device has keys and LEDs, and can be focused.
+                 ****************************************************/
+
+                InitKeyClassDeviceStruct (dev, syms, modmap);
+                InitFocusClassDeviceStruct (dev);
+                InitLedFeedbackClassDeviceStruct (dev, ledcontrol);
+                }
+            else if (strcmp(localdev-&gt;name, XI_KNOBBOX) == 0)
+                {
+                /****************************************************
+                 * This device reports motion.
+                 * It can be focused.
+                 ****************************************************/
+
+                InitValuatorClassDeviceStruct (dev, localdev-&gt;n_axes,);
+                    motionproc, MOTION_BUF_SIZE, Absolute);
+                for (i=0; i&lt;localdev-&gt;n_axes; i++)
+                    InitValuatorAxisStruct (dev, i, min_val, max_val, 
+                        resolution);
+                InitFocusClassDeviceStruct (dev);
+                }
+            localdev-&gt;atom = 
+                MakeAtom(localdev-&gt;name, strlen(localdev-&gt;name), FALSE);
+            AssignTypeAndName (dev, localdev-&gt;atom, localdev-&gt;name);
+            break;
+        case DEVICE_ON:
+            AddEnabledDevice (localdev-&gt;file_ds);
+            dev-&gt;on = TRUE;
+            break;
+        case DEVICE_OFF:
+            dev-&gt;on = FALSE;
+            RemoveEnabledDevice (localdev-&gt;file_ds);
+            break;
+        case DEVICE_CLOSE:
+            break;
+        }
+    }
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+The device control routine is called with a mode value of DEVICE_ON
+by the DIX routine EnableDevice, which is called from InitAndStartDevices.  
+When called with this mode, it should call AddEnabledDevice to cause the 
+server to begin checking for available input from this device.
+</para>
+<para>
+<!-- .LP -->
+&gt;From InitAndStartDevices, EnableDevice is called for all devices that have
+the "inited" and "startup" fields in the DeviceIntRec set to TRUE.  The
+"inited" field is set by InitAndStartDevices to the value returned by
+the deviceproc when called with a mode value of DEVICE_INIT.  The "startup"
+field is set by AddInputDevice to value of the second parameter (autoStart).
+</para>
+<para>
+<!-- .LP -->
+When the server is first initialized, it should only be checking for input
+from the core X keyboard and pointer.  One way to accomplish this is to
+call AddInputDevice for the core X keyboard and pointer with an
+autoStart value equal to TRUE, while calling AddInputDevice for 
+input extension devices with an autoStart value equal to FALSE.  If this is 
+done, EnableDevice will skip all input extension devices during server
+initialization.  In this case,
+the OpenInputDevice routine should set the "startup" field to TRUE
+when called for input extension devices.  This will cause ProcXOpenInputDevice
+to call EnableDevice for those devices when a client first does an
+XOpenDevice request.
+</para>
+</sect2>
+<sect2 id="DIX_Input_Class_Initialization_Routines">
+<title>DIX Input Class Initialization Routines</title>
+<para>
+<!-- .LP -->
+DIX routines are defined to initialize each of the defined input classes.
+The defined classes are:
+<!-- .RS -->
+<!-- .in +5n -->
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+KeyClass - the device has keys.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+ButtonClass - the device has buttons.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+ValuatorClass - the device reports motion data or positional data.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Proximitylass - the device reports proximity information.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+FocusClass - the device can be focused.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+FeedbackClass - the device supports some kind of feedback
+<!-- .in -5n -->
+<!-- .RE -->
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+DIX routines are provided to initialize the X pointer and keyboard, as in
+previous releases of X.  During X initialization, InitPointerDeviceStruct 
+is called to initialize the X pointer, and InitKeyboardDeviceStruct is
+called to initialize the X keyboard.  There is no
+corresponding routine for extension input devices, since they do not all
+support the same classes of input.  Instead, DDX is responsible for the 
+initialization of the input classes supported by extension devices.  
+A description of the routines provided by DIX to perform that initialization
+follows.
+</para>
+<sect3 id="InitKeyClassDeviceStruct">
+<title>InitKeyClassDeviceStruct</title>
+<para>
+<!-- .LP -->
+This function is provided to allocate and initialize a KeyClassRec, and 
+should be called for extension devices that have keys.  It is passed a pointer
+to the device, and pointers to arrays of keysyms and modifiers reported by
+the device.  It returns FALSE if the KeyClassRec could not be allocated,
+or if the maps for the keysyms and and modifiers could not be allocated.
+Its parameters are:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+Bool
+InitKeyClassDeviceStruct(dev, pKeySyms, pModifiers)
+    DeviceIntPtr dev;
+    KeySymsPtr pKeySyms;
+    CARD8 pModifiers[];
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+The DIX entry point InitKeyboardDeviceStruct calls this routine for the
+core X keyboard.  It must be called explicitly for extension devices
+that have keys.
+</para>
+</sect3>
+<sect3 id="InitButtonClassDeviceStruct">
+<title>InitButtonClassDeviceStruct</title>
+<para>
+<!-- .LP -->
+This function is provided to allocate and initialize a ButtonClassRec, and 
+should be called for extension devices that have buttons.  It is passed a 
+pointer to the device, the number of buttons supported, and a map of the 
+reported button codes.  It returns FALSE if the ButtonClassRec could not be 
+allocated.  Its parameters are:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+Bool
+InitButtonClassDeviceStruct(dev, numButtons, map)
+    register DeviceIntPtr dev;
+    int numButtons;
+    CARD8 *map;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+The DIX entry point InitPointerDeviceStruct calls this routine for the
+core X pointer.  It must be called explicitly for extension devices that
+have buttons.
+</para>
+</sect3>
+<sect3 id="InitValuatorClassDeviceStruct">
+<title>InitValuatorClassDeviceStruct</title>
+<para>
+<!-- .LP -->
+This function is provided to allocate and initialize a ValuatorClassRec, and 
+should be called for extension devices that have valuators.  It is passed the
+number of axes of motion reported by the device, the address of the motion
+history procedure for the device, the size of the motion history buffer,
+and the mode (Absolute or Relative) of the device.  It returns FALSE if 
+the ValuatorClassRec could not be allocated.  Its parameters are:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+Bool
+InitValuatorClassDeviceStruct(dev, numAxes, motionProc, numMotionEvents, mode)
+    DeviceIntPtr dev;
+    int (*motionProc)();
+    int numAxes;
+    int numMotionEvents;
+    int mode;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+The DIX entry point InitPointerDeviceStruct calls this routine for the
+core X pointer.  It must be called explicitly for extension devices that
+report motion.
+</para>
+</sect3>
+<sect3 id="InitValuatorAxisStruct">
+<title>InitValuatorAxisStruct</title>
+<para>
+<!-- .LP -->
+This function is provided to initialize an XAxisInfoRec, and 
+should be called for core and extension devices that have valuators.  
+The space for the XAxisInfoRec is allocated by 
+the InitValuatorClassDeviceStruct function, but is not initialized.
+</para>
+<para>
+<!-- .LP -->
+InitValuatorAxisStruct should be called once for each axis of motion 
+reported by the device.  Each
+invocation should be passed the axis number (starting with 0), the
+minimum value for that axis, the maximum value for that axis, and the
+resolution of the device in counts per meter.  If the device reports
+relative motion, 0 should be reported as the minimum and maximum values.
+InitValuatorAxisStruct has the following parameters:
+<literallayout class="monospaced">
+InitValuatorAxisStruct(dev, axnum, minval, maxval, resolution)
+    DeviceIntPtr dev;
+    int axnum;
+    int minval;
+    int maxval;
+    int resolution;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+This routine is not called by InitPointerDeviceStruct for the
+core X pointer.  It must be called explicitly for core and extension devices 
+that report motion.
+</para>
+</sect3>
+<sect3 id="InitFocusClassDeviceStruct">
+<title>InitFocusClassDeviceStruct</title>
+<para>
+<!-- .LP -->
+This function is provided to allocate and initialize a FocusClassRec, and 
+should be called for extension devices that can be focused.  It is passed a
+pointer to the device, and returns FALSE if the allocation fails.
+It has the following parameter:
+<literallayout class="monospaced">
+Bool
+InitFocusClassDeviceStruct(dev)
+    DeviceIntPtr dev;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+The DIX entry point InitKeyboardDeviceStruct calls this routine for the
+core X keyboard.  It must be called explicitly for extension devices
+that can be focused.  Whether or not a particular device can be focused
+is left implementation-dependent.
+</para>
+</sect3>
+<sect3 id="InitProximityClassDeviceStruct">
+<title>InitProximityClassDeviceStruct</title>
+<para>
+<!-- .LP -->
+This function is provided to allocate and initialize a ProximityClassRec, and 
+should be called for extension absolute pointing devices that report proximity.
+It is passed a pointer to the device, and returns FALSE if the allocation fails.
+It has the following parameter:
+<literallayout class="monospaced">
+Bool
+InitProximityClassDeviceStruct(dev)
+    DeviceIntPtr dev;
+</literallayout>
+</para>
+</sect3>
+<sect3 id="Initializing_Feedbacks">
+<title>Initializing Feedbacks</title>
+<para>
+<!-- .LP -->
+</para>
+<sect4 id="InitKbdFeedbackClassDeviceStruct">
+<title>InitKbdFeedbackClassDeviceStruct</title>
+<para>
+<!-- .LP -->
+This function is provided to allocate and initialize a KbdFeedbackClassRec, and 
+may be called for extension devices that support some or all of the 
+feedbacks that the core keyboard supports.  It is passed a
+pointer to the device, a pointer to the procedure that sounds the bell,
+and a pointer to the device control procedure.
+It returns FALSE if the allocation fails, and has the following parameters:
+<literallayout class="monospaced">
+Bool
+InitKbdFeedbackClassDeviceStruct(dev, bellProc, controlProc)
+    DeviceIntPtr dev;
+    void (*bellProc)();
+    void (*controlProc)();
+</literallayout>
+The DIX entry point InitKeyboardDeviceStruct calls this routine for the
+core X keyboard.  It must be called explicitly for extension devices
+that have the same feedbacks as a keyboard.  Some feedbacks, such as LEDs and
+bell, can be supported either with a KbdFeedbackClass or with BellFeedbackClass
+and LedFeedbackClass feedbacks.
+</para>
+</sect4>
+<sect4 id="InitPtrFeedbackClassDeviceStruct">
+<title>InitPtrFeedbackClassDeviceStruct</title>
+<para>
+<!-- .LP -->
+This function is provided to allocate and initialize a PtrFeedbackClassRec, and 
+should be called for extension devices that allow the setting of acceleration
+and threshold.  It is passed a pointer to the device,
+and a pointer to the device control procedure.
+It returns FALSE if the allocation fails, and has the following parameters:
+<literallayout class="monospaced">
+Bool
+InitPtrFeedbackClassDeviceStruct(dev, controlProc)
+    DeviceIntPtr dev;
+    void (*controlProc)();
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+The DIX entry point InitPointerDeviceStruct calls this routine for the
+core X pointer.  It must be called explicitly for extension devices
+that support the setting of acceleration and threshold.
+</para>
+</sect4>
+<sect4 id="InitLedFeedbackClassDeviceStruct">
+<title>InitLedFeedbackClassDeviceStruct</title>
+<para>
+<!-- .LP -->
+This function is provided to allocate and initialize a LedFeedbackClassRec, and 
+should be called for extension devices that have LEDs.
+It is passed a pointer to the device,
+and a pointer to the device control procedure.
+It returns FALSE if the allocation fails, and has the following parameters:
+<literallayout class="monospaced">
+Bool
+InitLedFeedbackClassDeviceStruct(dev, controlProc)
+    DeviceIntPtr dev;
+    void (*controlProc)();
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+Up to 32 LEDs per feedback can be supported, and a device may have 
+multiple feedbacks of the same type.
+</para>
+</sect4>
+<sect4 id="InitBellFeedbackClassDeviceStruct">
+<title>InitBellFeedbackClassDeviceStruct</title>
+<para>
+<!-- .LP -->
+This function is provided to allocate and initialize a BellFeedbackClassRec, 
+and should be called for extension devices that have a bell.
+It is passed a pointer to the device,
+and a pointer to the device control procedure.
+It returns FALSE if the allocation fails, and has the following parameters:
+<literallayout class="monospaced">
+Bool
+InitBellFeedbackClassDeviceStruct(dev, bellProc, controlProc)
+    DeviceIntPtr dev;
+    void (*bellProc)();
+    void (*controlProc)();
+</literallayout>
+</para>
+</sect4>
+<sect4 id="InitStringFeedbackClassDeviceStruct">
+<title>InitStringFeedbackClassDeviceStruct</title>
+<para>
+<!-- .LP -->
+This function is provided to allocate and initialize a StringFeedbackClassRec, 
+and should be called for extension devices that have a display upon which a 
+string can be displayed.
+It is passed a pointer to the device,
+and a pointer to the device control procedure.
+It returns FALSE if the allocation fails, and has the following parameters:
+<literallayout class="monospaced">
+Bool
+InitStringFeedbackClassDeviceStruct(dev, controlProc, max_symbols, 
+       num_symbols_supported, symbols)
+    DeviceIntPtr dev;
+    void (*controlProc)();
+    int max_symbols:
+    int num_symbols_supported;
+    KeySym *symbols;
+</literallayout>
+</para>
+</sect4>
+<sect4 id="InitIntegerFeedbackClassDeviceStruct">
+<title>InitIntegerFeedbackClassDeviceStruct</title>
+<para>
+<!-- .LP -->
+This function is provided to allocate and initialize an 
+IntegerFeedbackClassRec, 
+and should be called for extension devices that have a display upon which an
+integer can be displayed.
+It is passed a pointer to the device,
+and a pointer to the device control procedure.
+It returns FALSE if the allocation fails, and has the following parameters:
+<literallayout class="monospaced">
+Bool
+InitIntegerFeedbackClassDeviceStruct(dev, controlProc)
+    DeviceIntPtr dev;
+    void (*controlProc)();
+</literallayout>
+</para>
+</sect4>
+</sect3>
+</sect2>
+<sect2 id="Initializing_The_Device_Name_And_Type">
+<title>Initializing The Device Name And Type</title>
+<para>
+<!-- .LP -->
+The device name and type can be initialized by calling AssignTypeAndName
+with the following parameters:
+<literallayout class="monospaced">
+void
+AssignTypeAndName(dev, type, name)
+    DeviceIntPtr dev;
+    Atom type;
+    char *name;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+This will allocate space for the device name and copy the name that was passed.
+The device type can be obtained by calling MakeAtom with one of the names
+defined for input devices.  MakeAtom has the following parameters:
+<literallayout class="monospaced">
+Atom
+MakeAtom(name, len, makeit)
+    char *name;
+    int len;
+    Bool makeit;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+Since the atom was already made when the input extension was initialized, the
+value of makeit should be FALSE;
+</para>
+</sect2>
+</sect1>
+<sect1 id="Closing_Extension_Devices">
+<title>Closing Extension Devices</title>
+<para>
+<!-- .LP -->
+The DisableDevice entry point is provided by DIX to disable input devices.
+It calls the device control routine for the specified
+device with a mode value of DEVICE_OFF.  The device control routine should
+call RemoveEnabledDevice to stop the server from checking for input from
+that device.
+</para>
+<para>
+<!-- .LP -->
+DisableDevice is not called by any input extension routines.  It can be 
+called from the CloseInputDevice routine, which is called by
+ProcXCloseDevice when a client makes an XCloseDevice request.  If
+DisableDevice is called, it should only be called when the last client
+using the extension device has terminated or called XCloseDevice.
+</para>
+</sect1>
+<sect1 id="Implementation_Dependent_Routines">
+<title>Implementation-Dependent Routines</title>
+<para>
+<!-- .LP -->
+Several input extension protocol requests have 
+implementation-dependent  entry points.  Default routines
+are defined for these entry points and contained in the source
+file extensions/server/xinput/xstubs.c.  Some implementations may
+be able to use the default routines without change.
+The following sections describe each of these routines.
+</para>
+<sect2 id="AddOtherInputDevices">
+<title>AddOtherInputDevices</title>
+<para>
+<!-- .LP -->
+AddOtherInputDevice is called from ProcXListInputDevices as a result of 
+an XListInputDevices protocol request.  It may be needed by
+implementations that do not open extension input devices until requested
+to do so by some client.  These implementations may not initialize
+all devices when the X server starts up, because some of those devices
+may be in use.  Since the XListInputDevices
+function only lists those devices that have been initialized,
+AddOtherInputDevices is called to give DDX a chance to 
+initialize any previously unavailable input devices.
+</para>
+<para>
+<!-- .LP -->
+A sample AddOtherInputDevices routine might look like the following:
+<literallayout class="monospaced">
+void
+AddOtherInputDevices ()
+    {
+    DeviceIntPtr dev;
+    int i;
+
+    for (i=0; i&lt;MAX_DEVICES; i++) 
+        {
+        if (!local_dev[i].initialized &amp;&amp; available(local_dev[i]))
+            {
+            dev = (DeviceIntPtr) AddInputDevice (local_dev[i].deviceProc, TRUE);
+            dev-&gt;public.devicePrivate = local_dev[i];
+            RegisterOtherDevice (dev);
+            dev-&gt;inited = ((*dev-&gt;deviceProc)(dev, DEVICE_INIT) == Success);
+            }
+        }
+    }
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+The default AddOtherInputDevices routine in xstubs.c does nothing.
+If all input extension devices are initialized when the server 
+starts up, it can be left as a null routine.
+</para>
+</sect2>
+<sect2 id="OpenInputDevice">
+<title>OpenInputDevice</title>
+<para>
+<!-- .LP -->
+Some X server implementations open all input devices when the server
+is initialized and never close them.  Other implementations may open only
+the X pointer and keyboard devices during server initialization,
+and open other input devices only when some client makes an
+XOpenDevice request.  This entry point is for the latter type of 
+implementation.
+</para>
+<para>
+<!-- .LP -->
+If the physical device is not already open, it can be done in this routine.  
+In this case, the server must keep track of the fact that one or more clients 
+have the device open, and physically close it when the last client that has
+it open makes an XCloseDevice request.
+</para>
+<para>
+<!-- .LP -->
+The default implementation is to do nothing (assume all input devices
+are opened during X server initialization and kept open).
+</para>
+</sect2>
+<sect2 id="CloseInputDevice">
+<title>CloseInputDevice</title>
+<para>
+<!-- .LP -->
+Some implementations may close an input device when the last client
+using that device requests that it be closed, or terminates.
+CloseInputDevice is called from ProcXCloseDevice when a client
+makes an XCloseDevice protocol request.
+</para>
+<para>
+<!-- .LP -->
+The default implementation is to do nothing (assume all input devices
+are opened during X server initialization and kept open).
+</para>
+</sect2>
+<sect2 id="SetDeviceMode">
+<title>SetDeviceMode</title>
+<para>
+<!-- .LP -->
+Some implementations support input devices that can report 
+either absolute positional data or relative motion.  The XSetDeviceMode
+protocol request is provided to allow DDX to change the current mode of 
+such a device.
+</para>
+<para>
+<!-- .LP -->
+The default implementation is to always return a BadMatch error.  If the
+implementation does not support any input devices that are capable of 
+reporting both relative motion and absolute position information, the
+default implementation may be left unchanged.
+</para>
+</sect2>
+<sect2 id="SetDeviceValuators">
+<title>SetDeviceValuators</title>
+<para>
+<!-- .LP -->
+Some implementations support input devices that allow their valuators to be 
+set to an initial value.  The XSetDeviceValuators 
+protocol request is provided to allow DDX to set the valuators of
+such a device.
+</para>
+<para>
+<!-- .LP -->
+The default implementation is to always return a BadMatch error.  If the
+implementation does not support any input devices that are allow their
+valuators to be set, the default implementation may be left unchanged.
+</para>
+</sect2>
+<sect2 id="ChangePointerDevice">
+<title>ChangePointerDevice</title>
+<para>
+<!-- .LP -->
+The XChangePointerDevice protocol request is provided to change which device is
+used as the X pointer.  Some implementations may maintain information
+specific to the X pointer in the private data structure pointed to by
+the DeviceIntRec.  ChangePointerDevice is called to allow such 
+implementations to move that information to the new pointer device.
+The current location of the X cursor is an example of the type of 
+information that might be affected.
+</para>
+<para>
+<!-- .LP -->
+The DeviceIntRec structure that describes the X pointer device does not 
+contain a FocusRec.  If the device that has been made into the new X pointer 
+was previously a device that could be focused, ProcXChangePointerDevice will 
+free the FocusRec associated with that device.
+</para>
+<para>
+<!-- .LP -->
+If the server implementation desires to allow clients to focus the old pointer 
+device (which is now accessible through the input extension), it should call
+InitFocusClassDeviceStruct for the old pointer device.
+</para>
+<para>
+<!-- .LP -->
+The XChangePointerDevice protocol request also allows the client
+to choose which axes of the new pointer device are used to move 
+the X cursor in the X- and Y- directions.  If the axes are different
+than the default ones, the server implementation should record that fact.
+</para>
+<para>
+<!-- .LP -->
+If the server implementation supports input devices with valuators that 
+are not allowed to be used as the X pointer, they should be screened out
+by this routine and a  BadDevice error returned.
+</para>
+<para>
+<!-- .LP -->
+The default implementation is to do nothing. 
+</para>
+</sect2>
+<sect2 id="ChangeKeyboardDevice">
+<title>ChangeKeyboardDevice</title>
+<para>
+<!-- .LP -->
+The XChangeKeyboardDevice protocol request is provided to change which device is
+used as the X keyboard.  Some implementations may maintain information
+specific to the X keyboard in the private data structure pointed to by
+the DeviceIntRec.  ChangeKeyboardDevice is called to allow such 
+implementations to move that information to the new keyboard device.
+</para>
+<para>
+<!-- .LP -->
+The X keyboard device can be focused, and the DeviceIntRec that describes
+that device has a FocusRec.  If the device that has been made into the new X 
+keyboard did not previously have a FocusRec, 
+ProcXChangeKeyboardDevice will allocate one for it.
+</para>
+<para>
+<!-- .LP -->
+If the implementation does not want clients to be able to focus the old X 
+keyboard (which has now become available as an input extension device)
+it should call DeleteFocusClassDeviceStruct to free the FocusRec.
+</para>
+<para>
+<!-- .LP -->
+If the implementation supports input devices with keys that are not allowed
+to be used as the X keyboard, they should be checked for here, and a
+BadDevice error returned.
+</para>
+<para>
+<!-- .LP -->
+The default implementation is to do nothing. 
+</para>
+</sect2>
+</sect1>
+<sect1 id="Input_Extension_Events">
+<title>Input Extension Events</title>
+<para>
+<!-- .LP -->
+Events accessed through the input extension are analogous to the core input
+events, but have different event types.  They are of types 
+<function>DeviceKeyPress</function>, <function>DeviceKeyRelease</function>, <function>DeviceButtonPress</function>,
+<function>DeviceButtonRelease</function>, <function>DeviceDeviceMotionNotify</function>,
+<function>DeviceProximityIn</function>, <function>DeviceProximityOut</function>, and <function>DeviceValuator</function>.
+These event types are not constants.  Instead, they are external integers 
+defined by the input extension.  Their actual values will depend on which
+extensions are supported by a server, and the order in which they are
+initialized.
+</para>
+<para>
+<!-- .LP -->
+The data structures that define these
+events are defined in the file <function>extensions/include/XIproto.h</function>.  Other
+input extension constants needed by DDX are defined in the file
+<function>extensions/include/XI.h</function>.
+</para>
+<para>
+<!-- .LP -->
+Some events defined by the input extension contain more information than can
+be contained in the 32-byte xEvent data structure.  To send this information
+to clients, DDX must generate two or more 32-byte wire events.  The following
+sections describe the contents of these events. 
+</para>
+<sect2 id="Device_Key_Events">
+<title>Device Key Events</title>
+<para>
+<!-- .LP -->
+<function>DeviceKeyPresss</function> events contain all the information that is contained in
+a core <function>KeyPress</function> event, and also the following additional information:
+</para>
+<para>
+<!-- .LP -->
+<!-- .RS -->
+<!-- .in +5n -->
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+deviceid - the identifier of the device that generated the event.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+device_state - the state of any modifiers on the device that generated the event
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+num_valuators - the number of valuators reported in this event.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+first_valuator - the first valuator reported in this event.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+valuator0 through valuator5 - the values of the valuators.
+<!-- .in -5n -->
+<!-- .RE -->
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+In order to pass this information to the input extension library, two 32-byte
+wire events must be generated by DDX.  The first has an event type of 
+<function>DeviceKeyPress</function>, and the second has an event type of \fPDeviceValuator\fP.
+</para>
+<para>
+<!-- .LP -->
+The following code fragment shows how the two wire events could be initialized:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+    extern int DeviceKeyPress;
+    DeviceIntPtr dev;
+    xEvent xE[2];
+    CARD8 id, num_valuators;
+    INT16 x, y, pointerx, pointery;
+    Time timestamp;
+    deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *) xE;
+    deviceValuator *xv;
+
+    xev-&gt;type = DeviceKeyPress;                /* defined by input extension */
+    xev-&gt;detail = keycode;              /* key pressed on this device */
+    xev-&gt;time = timestamp;              /* same as for core events    */
+    xev-&gt;rootX = pointerx;              /* x location of core pointer */
+    xev-&gt;rootY = pointery;              /* y location of core pointer */
+
+    /******************************************************************/
+    /*                                                                */
+    /* The following field does not exist for core input events.      */
+    /* It contains the device id for the device that generated the    */
+    /* event, and also indicates whether more than one 32-byte wire   */
+    /* event is being sent.                                           */
+    /*                                                                */
+    /******************************************************************/
+
+    xev-&gt;deviceid = dev-&gt;id | MORE_EVENTS;        /* sending more than 1*/
+
+    /******************************************************************/
+    /* Fields in the second 32-byte wire event:                       */
+    /******************************************************************/
+
+    xv = (deviceValuator *) ++xev;
+    xv-&gt;type = DeviceValuator;          /* event type of second event */
+    xv-&gt;deviceid = dev-&gt;id;             /* id of this device          */
+    xv-&gt;num_valuators = 0;              /* no valuators being sent    */
+    xv-&gt;device_state  = 0;              /* will be filled in by DIX   */
+</literallayout>
+</para>
+</sect2>
+<sect2 id="Device_Button_Events">
+<title>Device Button Events</title>
+<para>
+<!-- .LP -->
+<function>DeviceButton</function> events contain all the information that is contained in
+a core button event, and also the same additional information that a 
+<function>DeviceKey</function> event contains.
+</para>
+</sect2>
+<sect2 id="Device_Motion_Events">
+<title>Device Motion Events</title>
+<para>
+<!-- .LP -->
+<function>DeviceMotion</function> events contain all the information that is contained in
+a core motion event, and also additional valuator information.  At least
+two wire events are required to contain this information.
+The following code fragment shows how the two wire events could be initialized:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+    extern int DeviceMotionNotify;
+    DeviceIntPtr dev;
+    xEvent xE[2];
+    CARD8 id, num_valuators;
+    INT16 x, y, pointerx, pointery;
+    Time timestamp;
+    deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *) xE;
+    deviceValuator *xv;
+
+    xev-&gt;type = DeviceMotionNotify;     /* defined by input extension */
+    xev-&gt;detail = keycode;              /* key pressed on this device */
+    xev-&gt;time = timestamp;              /* same as for core events    */
+    xev-&gt;rootX = pointerx;              /* x location of core pointer */
+    xev-&gt;rootY = pointery;              /* y location of core pointer */
+
+    /******************************************************************/
+    /*                                                                */
+    /* The following field does not exist for core input events.      */
+    /* It contains the device id for the device that generated the    */
+    /* event, and also indicates whether more than one 32-byte wire   */
+    /* event is being sent.                                           */
+    /*                                                                */
+    /******************************************************************/
+
+    xev-&gt;deviceid = dev-&gt;id | MORE_EVENTS;        /* sending more than 1*/
+
+    /******************************************************************/
+    /* Fields in the second 32-byte wire event:                       */
+    /******************************************************************/
+
+    xv = (deviceValuator *) ++xev;
+    xv-&gt;type = DeviceValuator;          /* event type of second event */
+    xv-&gt;deviceid = dev-&gt;id;             /* id of this device          */
+    xv-&gt;num_valuators = 2;              /* 2 valuators being sent     */
+    xv-&gt;first_valuator = 0;             /* first valuator being sent  */
+    xv-&gt;device_state  = 0;              /* will be filled in by DIX   */
+    xv-&gt;valuator0 = x;                  /* first axis of this device  */
+    xv-&gt;valuator1 = y;                  /* second axis of this device */
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+Up to six axes can be reported in the deviceValuator event.  If the device
+is reporting more than 6 axes, additional pairs of DeviceMotionNotify and
+DeviceValuator events should be sent,  with the first_valuator field
+set correctly.
+</para>
+</sect2>
+<sect2 id="Device_Proximity_Events">
+<title>Device Proximity Events</title>
+<para>
+<!-- .LP -->
+Some input devices that report absolute positional information, such as 
+graphics tablets and touchscreens, may report proximity events.  
+<function>ProximityIn</function>
+events are generated when a pointing device like a stylus, or in the case
+of a touchscreen, the user's finger, comes into close proximity with the
+surface of the input device.  <function>ProximityOut</function> events are generated when
+the stylus or finger leaves the proximity of the input devices surface.
+</para>
+<para>
+<!-- .LP -->
+<function>Proximity</function> events contain almost the same information as button events.
+The event type is <function>ProximityIn</function> or <function>ProximityOut</function>, and there is no
+detail information.
+<!-- .bp -->
+<!-- .\" .TC -->
+
+</para>
+</sect2>
+</sect1>
+</chapter>
+</book>
diff --git a/include/X11/extensions/XInput.h b/include/X11/extensions/XInput.h
new file mode 100644 (file)
index 0000000..b17f388
--- /dev/null
@@ -0,0 +1,1277 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/* Definitions used by the library and client */
+
+#ifndef _XINPUT_H_
+#define _XINPUT_H_
+
+#include <X11/Xlib.h>
+#include <X11/extensions/XI.h>
+
+#define _deviceKeyPress                0
+#define _deviceKeyRelease      1
+
+#define _deviceButtonPress     0
+#define _deviceButtonRelease   1
+
+#define _deviceMotionNotify    0
+
+#define _deviceFocusIn         0
+#define _deviceFocusOut                1
+
+#define _proximityIn           0
+#define _proximityOut          1
+
+#define _deviceStateNotify     0
+#define _deviceMappingNotify   1
+#define _changeDeviceNotify    2
+/* Space of 3 between is necessary! Reserved for DeviceKeyStateNotify,
+   DeviceButtonStateNotify, DevicePresenceNotify (essentially unused). This
+   code has to be in sync with FixExtensionEvents() in xserver/Xi/extinit.c */
+#define _propertyNotify                6
+
+#define FindTypeAndClass(d,type,_class,classid,offset) \
+    { int _i; XInputClassInfo *_ip; \
+    type = 0; _class = 0; \
+    for (_i=0, _ip= ((XDevice *) d)->classes; \
+        _i< ((XDevice *) d)->num_classes; \
+        _i++, _ip++) \
+       if (_ip->input_class == classid) \
+           {type =  _ip->event_type_base + offset; \
+            _class =  ((XDevice *) d)->device_id << 8 | type;}}
+
+#define DeviceKeyPress(d,type,_class) \
+    FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyPress)
+
+#define DeviceKeyRelease(d,type,_class) \
+    FindTypeAndClass(d, type, _class, KeyClass, _deviceKeyRelease)
+
+#define DeviceButtonPress(d,type,_class) \
+    FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonPress)
+
+#define DeviceButtonRelease(d,type,_class) \
+    FindTypeAndClass(d, type, _class, ButtonClass, _deviceButtonRelease)
+
+#define DeviceMotionNotify(d,type,_class) \
+    FindTypeAndClass(d, type, _class, ValuatorClass, _deviceMotionNotify)
+
+#define DeviceFocusIn(d,type,_class) \
+    FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusIn)
+
+#define DeviceFocusOut(d,type,_class) \
+    FindTypeAndClass(d, type, _class, FocusClass, _deviceFocusOut)
+
+#define ProximityIn(d,type,_class) \
+    FindTypeAndClass(d, type, _class, ProximityClass, _proximityIn)
+
+#define ProximityOut(d,type,_class) \
+    FindTypeAndClass(d, type, _class, ProximityClass, _proximityOut)
+
+#define DeviceStateNotify(d,type,_class) \
+    FindTypeAndClass(d, type, _class, OtherClass, _deviceStateNotify)
+
+#define DeviceMappingNotify(d,type,_class) \
+    FindTypeAndClass(d, type, _class, OtherClass, _deviceMappingNotify)
+
+#define ChangeDeviceNotify(d,type,_class) \
+    FindTypeAndClass(d, type, _class, OtherClass, _changeDeviceNotify)
+
+#define DevicePropertyNotify(d, type, _class) \
+    FindTypeAndClass(d, type, _class, OtherClass, _propertyNotify)
+
+#define DevicePointerMotionHint(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _devicePointerMotionHint;}
+
+#define DeviceButton1Motion(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton1Motion;}
+
+#define DeviceButton2Motion(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton2Motion;}
+
+#define DeviceButton3Motion(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton3Motion;}
+
+#define DeviceButton4Motion(d,type, _class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton4Motion;}
+
+#define DeviceButton5Motion(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceButton5Motion;}
+
+#define DeviceButtonMotion(d,type, _class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceButtonMotion;}
+
+#define DeviceOwnerGrabButton(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceOwnerGrabButton;}
+
+#define DeviceButtonPressGrab(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _deviceButtonGrab;}
+
+#define NoExtensionEvent(d,type,_class) \
+    { _class =  ((XDevice *) d)->device_id << 8 | _noExtensionEvent;}
+
+
+/* We need the declaration for DevicePresence. */
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+    extern int _XiGetDevicePresenceNotifyEvent(Display *);
+    extern void _xibaddevice( Display *dpy, int *error);
+    extern void _xibadclass( Display *dpy, int *error);
+    extern void _xibadevent( Display *dpy, int *error);
+    extern void _xibadmode( Display *dpy, int *error);
+    extern void _xidevicebusy( Display *dpy, int *error);
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#define DevicePresence(dpy, type, _class)                       \
+    {                                                           \
+        type = _XiGetDevicePresenceNotifyEvent(dpy);            \
+        _class =  (0x10000 | _devicePresence);                  \
+    }
+
+/* Errors */
+#define BadDevice(dpy,error) _xibaddevice(dpy, &error)
+
+#define BadClass(dpy,error) _xibadclass(dpy, &error)
+
+#define BadEvent(dpy,error) _xibadevent(dpy, &error)
+
+#define BadMode(dpy,error) _xibadmode(dpy, &error)
+
+#define DeviceBusy(dpy,error) _xidevicebusy(dpy, &error)
+
+typedef struct _XAnyClassinfo *XAnyClassPtr;
+
+/***************************************************************
+ *
+ * DeviceKey events.  These events are sent by input devices that
+ * support input class Keys.
+ * The location of the X pointer is reported in the coordinate
+ * fields of the x,y and x_root,y_root fields.
+ *
+ */
+
+typedef struct 
+    {
+    int            type;         /* of event */
+    unsigned long  serial;       /* # of last request processed */
+    Bool           send_event;   /* true if from SendEvent request */
+    Display        *display;     /* Display the event was read from */
+    Window         window;       /* "event" window reported relative to */
+    XID            deviceid;
+    Window         root;         /* root window event occured on */
+    Window         subwindow;    /* child window */
+    Time           time;         /* milliseconds */
+    int            x, y;         /* x, y coordinates in event window */
+    int            x_root;       /* coordinates relative to root */
+    int            y_root;       /* coordinates relative to root */
+    unsigned int   state;        /* key or button mask */
+    unsigned int   keycode;      /* detail */
+    Bool           same_screen;  /* same screen flag */
+    unsigned int   device_state; /* device key or button mask */
+    unsigned char  axes_count;
+    unsigned char  first_axis;
+    int            axis_data[6];
+    } XDeviceKeyEvent;
+
+typedef XDeviceKeyEvent XDeviceKeyPressedEvent;
+typedef XDeviceKeyEvent XDeviceKeyReleasedEvent;
+
+/*******************************************************************
+ *
+ * DeviceButton events.  These events are sent by extension devices
+ * that support input class Buttons.
+ *
+ */
+
+typedef struct {
+    int           type;         /* of event */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;       /* "event" window reported relative to */
+    XID           deviceid;
+    Window        root;         /* root window that the event occured on */
+    Window        subwindow;    /* child window */
+    Time          time;         /* milliseconds */
+    int           x, y;         /* x, y coordinates in event window */
+    int           x_root;       /* coordinates relative to root */
+    int           y_root;       /* coordinates relative to root */
+    unsigned int  state;        /* key or button mask */
+    unsigned int  button;       /* detail */
+    Bool          same_screen;  /* same screen flag */
+    unsigned int  device_state; /* device key or button mask */
+    unsigned char axes_count;
+    unsigned char first_axis;
+    int           axis_data[6];
+    } XDeviceButtonEvent;
+
+typedef XDeviceButtonEvent XDeviceButtonPressedEvent;
+typedef XDeviceButtonEvent XDeviceButtonReleasedEvent;
+
+/*******************************************************************
+ *
+ * DeviceMotionNotify event.  These events are sent by extension devices
+ * that support input class Valuators.
+ *
+ */
+
+typedef struct 
+    {
+    int           type;        /* of event */
+    unsigned long serial;      /* # of last request processed by server */
+    Bool          send_event;  /* true if from a SendEvent request */
+    Display       *display;    /* Display the event was read from */
+    Window        window;      /* "event" window reported relative to */
+    XID           deviceid;
+    Window        root;        /* root window that the event occured on */
+    Window        subwindow;   /* child window */
+    Time          time;        /* milliseconds */
+    int           x, y;        /* x, y coordinates in event window */
+    int           x_root;      /* coordinates relative to root */
+    int           y_root;      /* coordinates relative to root */
+    unsigned int  state;       /* key or button mask */
+    char          is_hint;     /* detail */
+    Bool          same_screen; /* same screen flag */
+    unsigned int  device_state; /* device key or button mask */
+    unsigned char axes_count;
+    unsigned char first_axis;
+    int           axis_data[6];
+    } XDeviceMotionEvent;
+
+/*******************************************************************
+ *
+ * DeviceFocusChange events.  These events are sent when the focus
+ * of an extension device that can be focused is changed.
+ *
+ */
+
+typedef struct 
+    {
+    int           type;       /* of event */
+    unsigned long serial;     /* # of last request processed by server */
+    Bool          send_event; /* true if from a SendEvent request */
+    Display       *display;   /* Display the event was read from */
+    Window        window;     /* "event" window reported relative to */
+    XID           deviceid;
+    int           mode;       /* NotifyNormal, NotifyGrab, NotifyUngrab */
+    int           detail;
+       /*
+        * NotifyAncestor, NotifyVirtual, NotifyInferior, 
+        * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
+        * NotifyPointerRoot, NotifyDetailNone 
+        */
+    Time                time;
+    } XDeviceFocusChangeEvent;
+
+typedef XDeviceFocusChangeEvent XDeviceFocusInEvent;
+typedef XDeviceFocusChangeEvent XDeviceFocusOutEvent;
+
+/*******************************************************************
+ *
+ * ProximityNotify events.  These events are sent by those absolute
+ * positioning devices that are capable of generating proximity information.
+ *
+ */
+
+typedef struct 
+    {
+    int             type;      /* ProximityIn or ProximityOut */        
+    unsigned long   serial;    /* # of last request processed by server */
+    Bool            send_event; /* true if this came from a SendEvent request */
+    Display         *display;  /* Display the event was read from */
+    Window          window;      
+    XID                    deviceid;
+    Window          root;            
+    Window          subwindow;      
+    Time            time;            
+    int             x, y;            
+    int             x_root, y_root;  
+    unsigned int    state;           
+    Bool            same_screen;     
+    unsigned int    device_state; /* device key or button mask */
+    unsigned char   axes_count;
+    unsigned char   first_axis;
+    int             axis_data[6];
+    } XProximityNotifyEvent;
+typedef XProximityNotifyEvent XProximityInEvent;
+typedef XProximityNotifyEvent XProximityOutEvent;
+
+/*******************************************************************
+ *
+ * DeviceStateNotify events are generated on EnterWindow and FocusIn 
+ * for those clients who have selected DeviceState.
+ *
+ */
+
+typedef struct
+    {
+#if defined(__cplusplus) || defined(c_plusplus)
+    unsigned char      c_class;
+#else
+    unsigned char      class;
+#endif
+    unsigned char      length;
+    } XInputClass;
+
+typedef struct {
+    int           type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;
+    XID           deviceid;
+    Time          time;
+    int           num_classes;
+    char         data[64];
+} XDeviceStateNotifyEvent;     
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    unsigned char      c_class;
+#else
+    unsigned char      class;
+#endif
+    unsigned char      length;
+    unsigned char      num_valuators;
+    unsigned char      mode;
+    int                        valuators[6];
+} XValuatorStatus;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    unsigned char      c_class;
+#else
+    unsigned char      class;
+#endif
+    unsigned char      length;
+    short              num_keys;
+    char               keys[32];
+} XKeyStatus;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    unsigned char      c_class;
+#else
+    unsigned char      class;
+#endif
+    unsigned char      length;
+    short              num_buttons;
+    char               buttons[32];
+} XButtonStatus;
+
+/*******************************************************************
+ *
+ * DeviceMappingNotify event.  This event is sent when the key mapping,
+ * modifier mapping, or button mapping of an extension device is changed.
+ *
+ */
+
+typedef struct {
+    int           type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;       /* unused */
+    XID           deviceid;
+    Time          time;
+    int           request;      /* one of MappingModifier, MappingKeyboard,
+                                    MappingPointer */
+    int           first_keycode;/* first keycode */
+    int           count;        /* defines range of change w. first_keycode*/
+} XDeviceMappingEvent;
+
+/*******************************************************************
+ *
+ * ChangeDeviceNotify event.  This event is sent when an 
+ * XChangeKeyboard or XChangePointer request is made.
+ *
+ */
+
+typedef struct {
+    int           type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;       /* unused */
+    XID           deviceid;
+    Time          time;
+    int           request;      /* NewPointer or NewKeyboard */
+} XChangeDeviceNotifyEvent;
+
+/*******************************************************************
+ *
+ * DevicePresenceNotify event.  This event is sent when the list of
+ * input devices changes, in which case devchange will be false, and
+ * no information about the change will be contained in the event;
+ * the client should use XListInputDevices() to learn what has changed.
+ *
+ * If devchange is true, an attribute that the server believes is
+ * important has changed on a device, and the client should use
+ * XGetDeviceControl to examine the device.  If control is non-zero,
+ * then that control has changed meaningfully.
+ */
+
+typedef struct {
+    int           type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;       /* unused */
+    Time          time;
+    Bool          devchange;
+    XID           deviceid;
+    XID           control;
+} XDevicePresenceNotifyEvent;
+
+/*
+ * Notifies the client that a property on a device has changed value. The
+ * client is expected to query the server for updated value of the property.
+ */
+typedef struct {
+    int           type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;       /* unused */
+    Time          time;
+    XID           deviceid;     /* id of the device that changed */
+    Atom          atom;         /* the property that changed */
+    int           state;        /* PropertyNewValue or PropertyDeleted */
+} XDevicePropertyNotifyEvent;
+
+
+/*******************************************************************
+ *
+ * Control structures for input devices that support input class
+ * Feedback.  These are used by the XGetFeedbackControl and 
+ * XChangeFeedbackControl functions.
+ *
+ */
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+     XID            c_class;
+#else
+     XID            class;
+#endif
+     int            length;
+     XID            id;
+} XFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     click;
+    int     percent;
+    int     pitch;
+    int     duration;
+    int     led_mask;
+    int     global_auto_repeat;
+    char    auto_repeats[32];
+} XKbdFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     accelNum;
+    int     accelDenom;
+    int     threshold;
+} XPtrFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     resolution;
+    int     minVal;
+    int     maxVal;
+} XIntegerFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     max_symbols;
+    int     num_syms_supported;
+    KeySym  *syms_supported;
+} XStringFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     percent;
+    int     pitch;
+    int     duration;
+} XBellFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     led_values;
+    int     led_mask;
+} XLedFeedbackState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+     XID            c_class;
+#else
+     XID            class;
+#endif
+     int            length;
+     XID           id;
+} XFeedbackControl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     accelNum;
+    int     accelDenom;
+    int     threshold;
+} XPtrFeedbackControl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     click;
+    int     percent;
+    int     pitch;
+    int     duration;
+    int     led_mask;
+    int     led_value;
+    int     key;
+    int     auto_repeat_mode;
+} XKbdFeedbackControl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     num_keysyms;
+    KeySym  *syms_to_display;
+} XStringFeedbackControl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     int_to_display;
+} XIntegerFeedbackControl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     percent;
+    int     pitch;
+    int     duration;
+} XBellFeedbackControl;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID     c_class;
+#else
+    XID     class;
+#endif
+    int     length;
+    XID     id;
+    int     led_mask;
+    int     led_values;
+} XLedFeedbackControl;
+
+/*******************************************************************
+ *
+ * Device control structures.
+ *
+ */
+
+typedef struct {
+     XID            control;
+     int            length;
+} XDeviceControl;
+
+typedef struct {
+     XID            control;
+     int            length;
+     int            first_valuator;
+     int            num_valuators;
+     int            *resolutions;
+} XDeviceResolutionControl;
+
+typedef struct {
+     XID            control;
+     int            length;
+     int            num_valuators;
+     int            *resolutions;
+     int            *min_resolutions;
+     int            *max_resolutions;
+} XDeviceResolutionState;
+
+typedef struct {
+    XID             control;
+    int             length;
+    int             min_x;
+    int             max_x;
+    int             min_y;
+    int             max_y;
+    int             flip_x;
+    int             flip_y;
+    int             rotation;
+    int             button_threshold;
+} XDeviceAbsCalibControl, XDeviceAbsCalibState;
+
+typedef struct {
+    XID             control;
+    int             length;
+    int             offset_x;
+    int             offset_y;
+    int             width;
+    int             height;
+    int             screen;
+    XID             following;
+} XDeviceAbsAreaControl, XDeviceAbsAreaState;
+
+typedef struct {
+    XID             control;
+    int             length;
+    int             status;
+} XDeviceCoreControl;
+
+typedef struct {
+    XID             control;
+    int             length;
+    int             status;
+    int             iscore;
+} XDeviceCoreState;
+
+typedef struct {
+    XID             control;
+    int             length;
+    int             enable;
+} XDeviceEnableControl, XDeviceEnableState;
+
+/*******************************************************************
+ *
+ * An array of XDeviceList structures is returned by the 
+ * XListInputDevices function.  Each entry contains information
+ * about one input device.  Among that information is an array of 
+ * pointers to structures that describe the characteristics of 
+ * the input device.
+ *
+ */
+
+typedef struct _XAnyClassinfo {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID        c_class;
+#else
+    XID        class;
+#endif
+    int        length;
+    } XAnyClassInfo;
+
+typedef struct _XDeviceInfo *XDeviceInfoPtr;
+
+typedef struct _XDeviceInfo
+    {
+    XID                 id;        
+    Atom                type;
+    char                *name;
+    int                 num_classes;
+    int                 use;
+    XAnyClassPtr       inputclassinfo;
+    } XDeviceInfo;
+
+typedef struct _XKeyInfo *XKeyInfoPtr;
+
+typedef struct _XKeyInfo
+    {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID                        c_class;
+#else
+    XID                        class;
+#endif
+    int                        length;
+    unsigned short      min_keycode;
+    unsigned short      max_keycode;
+    unsigned short      num_keys;
+    } XKeyInfo;
+
+typedef struct _XButtonInfo *XButtonInfoPtr;
+
+typedef struct _XButtonInfo {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID                c_class;
+#else
+    XID                class;
+#endif
+    int                length;
+    short      num_buttons;
+    } XButtonInfo;
+
+typedef struct _XAxisInfo *XAxisInfoPtr;
+
+typedef struct _XAxisInfo {
+    int        resolution;
+    int        min_value;
+    int        max_value;
+    } XAxisInfo;
+
+typedef struct _XValuatorInfo *XValuatorInfoPtr;
+
+typedef struct _XValuatorInfo
+    {
+#if defined(__cplusplus) || defined(c_plusplus)
+    XID                        c_class;
+#else
+    XID                        class;
+#endif
+    int                        length;
+    unsigned char       num_axes;
+    unsigned char       mode;
+    unsigned long       motion_buffer;
+    XAxisInfoPtr        axes;
+    } XValuatorInfo;
+
+/*******************************************************************
+ *
+ * An XDevice structure is returned by the XOpenDevice function.  
+ * It contains an array of pointers to XInputClassInfo structures.
+ * Each contains information about a class of input supported by the
+ * device, including a pointer to an array of data for each type of event
+ * the device reports.
+ *
+ */
+
+
+typedef struct {
+        unsigned char   input_class;
+        unsigned char   event_type_base;
+} XInputClassInfo;
+
+typedef struct {
+        XID                    device_id;
+        int                    num_classes;
+        XInputClassInfo        *classes;
+} XDevice;
+
+
+/*******************************************************************
+ *
+ * The following structure is used to return information for the 
+ * XGetSelectedExtensionEvents function.
+ *
+ */
+
+typedef struct {
+        XEventClass     event_type;
+        XID             device;
+} XEventList;
+
+/*******************************************************************
+ *
+ * The following structure is used to return motion history data from 
+ * an input device that supports the input class Valuators.
+ * This information is returned by the XGetDeviceMotionEvents function.
+ *
+ */
+
+typedef struct {
+        Time   time;
+        int    *data;
+} XDeviceTimeCoord;
+
+
+/*******************************************************************
+ *
+ * Device state structure.
+ * This is returned by the XQueryDeviceState request.
+ *
+ */
+
+typedef struct {
+        XID            device_id;
+        int            num_classes;
+        XInputClass    *data;
+} XDeviceState;
+
+/*******************************************************************
+ *
+ * Note that the mode field is a bitfield that reports the Proximity
+ * status of the device as well as the mode.  The mode field should
+ * be OR'd with the mask DeviceMode and compared with the values
+ * Absolute and Relative to determine the mode, and should be OR'd
+ * with the mask ProximityState and compared with the values InProximity
+ * and OutOfProximity to determine the proximity state.
+ *
+ */
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    unsigned char      c_class;
+#else
+    unsigned char      class;
+#endif
+    unsigned char      length;
+    unsigned char      num_valuators;
+    unsigned char      mode;
+    int                        *valuators;
+} XValuatorState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    unsigned char      c_class;
+#else
+    unsigned char      class;
+#endif
+    unsigned char      length;
+    short              num_keys;
+    char               keys[32];
+} XKeyState;
+
+typedef struct {
+#if defined(__cplusplus) || defined(c_plusplus)
+    unsigned char      c_class;
+#else
+    unsigned char      class;
+#endif
+    unsigned char      length;
+    short              num_buttons;
+    char               buttons[32];
+} XButtonState;
+
+
+
+/*******************************************************************
+ *
+ * Function definitions.
+ *
+ */
+
+_XFUNCPROTOBEGIN
+
+extern int     XChangeKeyboardDevice(
+    Display*           /* display */,
+    XDevice*           /* device */
+);
+
+extern int     XChangePointerDevice(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    int                        /* xaxis */,
+    int                        /* yaxis */
+);
+
+extern int     XGrabDevice(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    Window             /* grab_window */,
+    Bool               /* ownerEvents */,
+    int                        /* event count */,
+    XEventClass*       /* event_list */,
+    int                        /* this_device_mode */,
+    int                        /* other_devices_mode */,
+    Time               /* time */
+);
+
+extern int     XUngrabDevice(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    Time               /* time */
+);
+
+extern int     XGrabDeviceKey(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    unsigned int       /* key */,
+    unsigned int       /* modifiers */,
+    XDevice*           /* modifier_device */,
+    Window             /* grab_window */,
+    Bool               /* owner_events */,
+    unsigned int       /* event_count */,
+    XEventClass*       /* event_list */,
+    int                        /* this_device_mode */,
+    int                        /* other_devices_mode */
+);
+
+extern int     XUngrabDeviceKey(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    unsigned int       /* key */,
+    unsigned int       /* modifiers */,
+    XDevice*           /* modifier_dev */,
+    Window             /* grab_window */
+);
+
+extern int     XGrabDeviceButton(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    unsigned int       /* button */,
+    unsigned int       /* modifiers */,
+    XDevice*           /* modifier_device */,
+    Window             /* grab_window */,
+    Bool               /* owner_events */,
+    unsigned int       /* event_count */,
+    XEventClass*       /* event_list */,
+    int                        /* this_device_mode */,
+    int                        /* other_devices_mode */
+);
+
+extern int     XUngrabDeviceButton(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    unsigned int       /* button */,
+    unsigned int       /* modifiers */,
+    XDevice*           /* modifier_dev */,
+    Window             /* grab_window */
+);
+
+extern int     XAllowDeviceEvents(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    int                        /* event_mode */,
+    Time               /* time */
+);
+
+extern int     XGetDeviceFocus(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    Window*            /* focus */,
+    int*               /* revert_to */,
+    Time*              /* time */
+);
+
+extern int     XSetDeviceFocus(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    Window             /* focus */,
+    int                        /* revert_to */,
+    Time               /* time */
+);
+
+extern XFeedbackState  *XGetFeedbackControl(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    int*               /* num_feedbacks */
+);
+
+extern void    XFreeFeedbackList(
+    XFeedbackState*    /* list */
+);
+
+extern int     XChangeFeedbackControl(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    unsigned long      /* mask */,
+    XFeedbackControl*  /* f */
+);
+
+extern int     XDeviceBell(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    XID                        /* feedbackclass */,
+    XID                        /* feedbackid */,
+    int                        /* percent */
+);
+
+extern KeySym  *XGetDeviceKeyMapping(
+    Display*           /* display */,
+    XDevice*           /* device */,
+#if NeedWidePrototypes
+    unsigned int       /* first */,
+#else
+    KeyCode            /* first */,
+#endif
+    int                        /* keycount */,
+    int*               /* syms_per_code */
+);
+
+extern int     XChangeDeviceKeyMapping(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    int                        /* first */,
+    int                        /* syms_per_code */,
+    KeySym*            /* keysyms */,
+    int                        /* count */
+);
+
+extern XModifierKeymap *XGetDeviceModifierMapping(
+    Display*           /* display */,
+    XDevice*           /* device */
+);
+
+extern int     XSetDeviceModifierMapping(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    XModifierKeymap*   /* modmap */
+);
+
+extern int     XSetDeviceButtonMapping(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    unsigned char*     /* map[] */,
+    int                        /* nmap */
+);
+
+extern int     XGetDeviceButtonMapping(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    unsigned char*     /* map[] */,
+    unsigned int       /* nmap */
+);
+
+extern XDeviceState    *XQueryDeviceState(
+    Display*           /* display */,
+    XDevice*           /* device */
+);
+
+extern void    XFreeDeviceState(
+    XDeviceState*      /* list */
+);
+
+extern XExtensionVersion       *XGetExtensionVersion(
+    Display*           /* display */,
+    _Xconst char*      /* name */
+);
+
+extern XDeviceInfo     *XListInputDevices(
+    Display*           /* display */,
+    int*               /* ndevices */
+);
+
+extern void    XFreeDeviceList(
+    XDeviceInfo*       /* list */
+);
+
+extern XDevice *XOpenDevice(
+    Display*           /* display */,
+    XID                        /* id */
+);
+
+extern int     XCloseDevice(
+    Display*           /* display */,
+    XDevice*           /* device */
+);
+
+extern int     XSetDeviceMode(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    int                        /* mode */
+);
+
+extern int     XSetDeviceValuators(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    int*               /* valuators */,
+    int                        /* first_valuator */,
+    int                        /* num_valuators */
+);
+
+extern XDeviceControl  *XGetDeviceControl(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    int                        /* control */
+);
+
+extern int     XChangeDeviceControl(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    int                        /* control */,
+    XDeviceControl*    /* d */
+);
+
+extern int     XSelectExtensionEvent(
+    Display*           /* display */,
+    Window             /* w */,
+    XEventClass*       /* event_list */,
+    int                        /* count */
+);
+
+extern int XGetSelectedExtensionEvents(
+    Display*           /* display */,
+    Window             /* w */,
+    int*               /* this_client_count */,
+    XEventClass**      /* this_client_list */,
+    int*               /* all_clients_count */,
+    XEventClass**      /* all_clients_list */
+);
+
+extern int     XChangeDeviceDontPropagateList(
+    Display*           /* display */,
+    Window             /* window */,
+    int                        /* count */,
+    XEventClass*       /* events */,
+    int                        /* mode */
+);
+
+extern XEventClass     *XGetDeviceDontPropagateList(
+    Display*           /* display */,
+    Window             /* window */,
+    int*               /* count */
+);
+
+extern Status  XSendExtensionEvent(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    Window             /* dest */,
+    Bool               /* prop */,
+    int                        /* count */,
+    XEventClass*       /* list */,
+    XEvent*            /* event */
+);
+
+extern XDeviceTimeCoord        *XGetDeviceMotionEvents(
+    Display*           /* display */,
+    XDevice*           /* device */,
+    Time               /* start */,
+    Time               /* stop */,
+    int*               /* nEvents */,
+    int*               /* mode */,
+    int*               /* axis_count */
+);
+
+extern void    XFreeDeviceMotionEvents(
+    XDeviceTimeCoord*  /* events */
+);
+
+extern void    XFreeDeviceControl(
+    XDeviceControl*    /* control */
+);
+
+extern Atom*   XListDeviceProperties(
+    Display*            /* dpy */,
+    XDevice*            /* dev */,
+    int*                /* nprops_return */
+);
+
+extern void XChangeDeviceProperty(
+    Display*            /* dpy */,
+    XDevice*            /* dev */,
+    Atom                /* property */,
+    Atom                /* type */,
+    int                 /* format */,
+    int                 /* mode */,
+    _Xconst unsigned char * /*data */,
+    int                 /* nelements */
+);
+
+extern void
+XDeleteDeviceProperty(
+    Display*            /* dpy */,
+    XDevice*            /* dev */,
+    Atom                /* property */
+);
+
+extern Status
+XGetDeviceProperty(
+     Display*           /* dpy*/,
+     XDevice*           /* dev*/,
+     Atom               /* property*/,
+     long               /* offset*/,
+     long               /* length*/,
+     Bool               /* delete*/,
+     Atom               /* req_type*/,
+     Atom*              /* actual_type*/,
+     int*               /* actual_format*/,
+     unsigned long*     /* nitems*/,
+     unsigned long*     /* bytes_after*/,
+     unsigned char**    /* prop*/
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XINPUT_H_ */
diff --git a/include/X11/extensions/XInput2.h b/include/X11/extensions/XInput2.h
new file mode 100644 (file)
index 0000000..e6c7b30
--- /dev/null
@@ -0,0 +1,548 @@
+/*
+ * 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.
+ *
+ */
+
+/* Definitions used by the library and client */
+
+#ifndef _XINPUT2_H_
+#define _XINPUT2_H_
+
+#include <X11/Xlib.h>
+#include <X11/extensions/XI2.h>
+#include <X11/extensions/Xge.h>
+
+/*******************************************************************
+ *
+ */
+typedef struct {
+    int                 type;
+    char*               name;
+    Bool                send_core;
+    Bool                enable;
+} XIAddMasterInfo;
+
+typedef struct {
+    int                 type;
+    int                 deviceid;
+    int                 return_mode; /* AttachToMaster, Floating */
+    int                 return_pointer;
+    int                 return_keyboard;
+} XIRemoveMasterInfo;
+
+typedef struct {
+    int                 type;
+    int                 deviceid;
+    int                 new_master;
+} XIAttachSlaveInfo;
+
+typedef struct {
+    int                 type;
+    int                 deviceid;
+} XIDetachSlaveInfo;
+
+typedef union {
+    int                   type; /* must be first element */
+    XIAddMasterInfo       add;
+    XIRemoveMasterInfo    remove;
+    XIAttachSlaveInfo     attach;
+    XIDetachSlaveInfo     detach;
+} XIAnyHierarchyChangeInfo;
+
+typedef struct
+{
+    int    base;
+    int    latched;
+    int    locked;
+    int    effective;
+} XIModifierState;
+
+typedef XIModifierState XIGroupState;
+
+typedef struct {
+    int           mask_len;
+    unsigned char *mask;
+} XIButtonState;
+
+typedef struct {
+    int           mask_len;
+    unsigned char *mask;
+    double        *values;
+} XIValuatorState;
+
+
+typedef struct
+{
+    int                 deviceid;
+    int                 mask_len;
+    unsigned char*      mask;
+} XIEventMask;
+
+typedef struct
+{
+    int         type;
+    int         sourceid;
+} XIAnyClassInfo;
+
+typedef struct
+{
+    int         type;
+    int         sourceid;
+    int         num_buttons;
+    Atom        *labels;
+    XIButtonState state;
+} XIButtonClassInfo;
+
+typedef struct
+{
+    int         type;
+    int         sourceid;
+    int         num_keycodes;
+    int         *keycodes;
+} XIKeyClassInfo;
+
+typedef struct
+{
+    int         type;
+    int         sourceid;
+    int         number;
+    Atom        label;
+    double      min;
+    double      max;
+    double      value;
+    int         resolution;
+    int         mode;
+} XIValuatorClassInfo;
+
+typedef struct
+{
+    int                 deviceid;
+    char                *name;
+    int                 use;
+    int                 attachment;
+    Bool                enabled;
+    int                 num_classes;
+    XIAnyClassInfo      **classes;
+} XIDeviceInfo;
+
+typedef struct
+{
+    int                 modifiers;
+    int                 status;
+} XIGrabModifiers;
+
+/**
+ * Generic XI2 event. All XI2 events have the same header.
+ */
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;
+    Time          time;
+} XIEvent;
+
+
+typedef struct {
+    int           deviceid;
+    int           attachment;
+    int           use;
+    Bool          enabled;
+    int           flags;
+} XIHierarchyInfo;
+
+/*
+ * Notifies the client that the device hierarchy has been changed. The client
+ * is expected to re-query the server for the device hierarchy.
+ */
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;       /* XI_HierarchyChanged */
+    Time          time;
+    int           flags;
+    int           num_info;
+    XIHierarchyInfo *info;
+} XIHierarchyEvent;
+
+/*
+ * Notifies the client that the classes have been changed. This happens when
+ * the slave device that sends through the master changes.
+ */
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;       /* XI_DeviceChanged */
+    Time          time;
+    int           deviceid;     /* id of the device that changed */
+    int           sourceid;     /* Source for the new classes. */
+    int           reason;       /* Reason for the change */
+    int           num_classes;
+    XIAnyClassInfo **classes; /* same as in XIDeviceInfo */
+} XIDeviceChangedEvent;
+
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;
+    Time          time;
+    int           deviceid;
+    int           sourceid;
+    int           detail;
+    Window        root;
+    Window        event;
+    Window        child;
+    double        root_x;
+    double        root_y;
+    double        event_x;
+    double        event_y;
+    int           flags;
+    XIButtonState       buttons;
+    XIValuatorState     valuators;
+    XIModifierState     mods;
+    XIGroupState        group;
+} XIDeviceEvent;
+
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;       /* XI_RawKeyPress, XI_RawKeyRelease, etc. */
+    Time          time;
+    int           deviceid;
+    int           sourceid;
+    int           detail;
+    int           flags;
+    XIValuatorState valuators;
+    double        *raw_values;
+} XIRawEvent;
+
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;
+    Time          time;
+    int           deviceid;
+    int           sourceid;
+    int           detail;
+    Window        root;
+    Window        event;
+    Window        child;
+    double        root_x;
+    double        root_y;
+    double        event_x;
+    double        event_y;
+    int           mode;
+    Bool          focus;
+    Bool          same_screen;
+    XIButtonState       buttons;
+    XIModifierState     mods;
+    XIGroupState        group;
+} XIEnterEvent;
+
+typedef XIEnterEvent XILeaveEvent;
+typedef XIEnterEvent XIFocusInEvent;
+typedef XIEnterEvent XIFocusOutEvent;
+
+typedef struct {
+    int           type;         /* GenericEvent */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    int           extension;    /* XI extension offset */
+    int           evtype;       /* XI_PropertyEvent */
+    Time          time;
+    int           deviceid;     /* id of the device that changed */
+    Atom          property;
+    int           what;
+} XIPropertyEvent;
+
+_XFUNCPROTOBEGIN
+
+extern Bool     XIQueryPointer(
+    Display*            display,
+    int                 deviceid,
+    Window              win,
+    Window*             root,
+    Window*             child,
+    double*             root_x,
+    double*             root_y,
+    double*             win_x,
+    double*             win_y,
+    XIButtonState       *buttons,
+    XIModifierState     *mods,
+    XIGroupState        *group
+);
+
+extern Bool     XIWarpPointer(
+    Display*            display,
+    int                 deviceid,
+    Window              src_win,
+    Window              dst_win,
+    double              src_x,
+    double              src_y,
+    unsigned int        src_width,
+    unsigned int        src_height,
+    double              dst_x,
+    double              dst_y
+);
+
+extern Status   XIDefineCursor(
+    Display*            display,
+    int                 deviceid,
+    Window              win,
+    Cursor              cursor
+);
+
+extern Status   XIUndefineCursor(
+    Display*            display,
+    int                 deviceid,
+    Window              win
+);
+
+extern Status   XIChangeHierarchy(
+    Display*            display,
+    XIAnyHierarchyChangeInfo*  changes,
+    int                 num_changes
+);
+
+extern Status   XISetClientPointer(
+    Display*            dpy,
+    Window              win,
+    int                 deviceid
+);
+
+extern Bool     XIGetClientPointer(
+    Display*            dpy,
+    Window              win,
+    int*                deviceid
+);
+
+extern int      XISelectEvents(
+     Display*            dpy,
+     Window              win,
+     XIEventMask         *masks,
+     int                 num_masks
+);
+
+extern XIEventMask *XIGetSelectedEvents(
+     Display*            dpy,
+     Window              win,
+     int                 *num_masks_return
+);
+
+extern Status XIQueryVersion(
+     Display*           dpy,
+     int*               major_version_inout,
+     int*               minor_version_inout
+);
+
+extern XIDeviceInfo* XIQueryDevice(
+     Display*           dpy,
+     int                deviceid,
+     int*               ndevices_return
+);
+
+extern Status XISetFocus(
+     Display*           dpy,
+     int                deviceid,
+     Window             focus,
+     Time               time
+);
+
+extern Status XIGetFocus(
+     Display*           dpy,
+     int                deviceid,
+     Window             *focus_return);
+
+extern Status XIGrabDevice(
+     Display*           dpy,
+     int                deviceid,
+     Window             grab_window,
+     Time               time,
+     Cursor             cursor,
+     int                grab_mode,
+     int                paired_device_mode,
+     Bool               owner_events,
+     XIEventMask        *mask
+);
+
+extern Status XIUngrabDevice(
+     Display*           dpy,
+     int                deviceid,
+     Time               time
+);
+
+extern Status XIAllowEvents(
+    Display*            display,
+    int                 deviceid,
+    int                 event_mode,
+    Time                time
+);
+
+extern int XIGrabButton(
+    Display*            display,
+    int                 deviceid,
+    int                 button,
+    Window              grab_window,
+    Cursor              cursor,
+    int                 grab_mode,
+    int                 paired_device_mode,
+    int                 owner_events,
+    XIEventMask         *mask,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers_inout
+);
+
+extern int XIGrabKeycode(
+    Display*            display,
+    int                 deviceid,
+    int                 keycode,
+    Window              grab_window,
+    int                 grab_mode,
+    int                 paired_device_mode,
+    int                 owner_events,
+    XIEventMask         *mask,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers_inout
+);
+
+extern int XIGrabEnter(
+    Display*            display,
+    int                 deviceid,
+    Window              grab_window,
+    Cursor              cursor,
+    int                 grab_mode,
+    int                 paired_device_mode,
+    int                 owner_events,
+    XIEventMask         *mask,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers_inout
+);
+
+extern int XIGrabFocusIn(
+    Display*            display,
+    int                 deviceid,
+    Window              grab_window,
+    int                 grab_mode,
+    int                 paired_device_mode,
+    int                 owner_events,
+    XIEventMask         *mask,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers_inout
+);
+extern Status XIUngrabButton(
+    Display*            display,
+    int                 deviceid,
+    int                 button,
+    Window              grab_window,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers
+);
+
+extern Status XIUngrabKeycode(
+    Display*            display,
+    int                 deviceid,
+    int                 keycode,
+    Window              grab_window,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers
+);
+
+extern Status XIUngrabEnter(
+    Display*            display,
+    int                 deviceid,
+    Window              grab_window,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers
+);
+
+extern Status XIUngrabFocusIn(
+    Display*            display,
+    int                 deviceid,
+    Window              grab_window,
+    int                 num_modifiers,
+    XIGrabModifiers     *modifiers
+);
+
+
+extern Atom *XIListProperties(
+    Display*            display,
+    int                 deviceid,
+    int                 *num_props_return
+);
+
+extern void XIChangeProperty(
+    Display*            display,
+    int                 deviceid,
+    Atom                property,
+    Atom                type,
+    int                 format,
+    int                 mode,
+    unsigned char       *data,
+    int                 num_items
+);
+
+extern void
+XIDeleteProperty(
+    Display*            display,
+    int                 deviceid,
+    Atom                property
+);
+
+extern Status
+XIGetProperty(
+    Display*            display,
+    int                 deviceid,
+    Atom                property,
+    long                offset,
+    long                length,
+    Bool                delete_property,
+    Atom                type,
+    Atom                *type_return,
+    int                 *format_return,
+    unsigned long       *num_items_return,
+    unsigned long       *bytes_after_return,
+    unsigned char       **data
+);
+
+extern void XIFreeDeviceInfo(XIDeviceInfo       *info);
+
+_XFUNCPROTOEND
+
+#endif /* XINPUT2_H */
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100755 (executable)
index 0000000..c8db111
--- /dev/null
@@ -0,0 +1,178 @@
+#
+# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+#
+# 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.
+#
+
+libmandir = $(LIB_MAN_DIR)
+
+# Source files for X Input v2 man pages
+XI2_txt =                                      \
+       XIChangeHierarchy.txt                   \
+       XIDefineCursor.txt                      \
+       XIGrabButton.txt                        \
+       XIGrabDevice.txt                        \
+       XIGrabEnter.txt                         \
+       XIQueryDevice.txt                       \
+       XIQueryPointer.txt                      \
+       XIQueryVersion.txt                      \
+       XISelectEvents.txt                      \
+       XISetClientPointer.txt                  \
+       XISetFocus.txt                          \
+       XIWarpPointer.txt                       \
+       XIListProperties.txt                    \
+       XIChangeProperty.txt
+
+# Source files for X Input v1 man pages
+libman_txt = \
+       XAllowDeviceEvents.txt                  \
+       XChangeDeviceDontPropagateList.txt      \
+       XChangeKeyboardDevice.txt               \
+       XChangePointerDevice.txt                \
+       XDeviceBell.txt                         \
+       XGetDeviceControl.txt                   \
+       XGetDeviceKeyMapping.txt                \
+       XGetDeviceModifierMapping.txt           \
+       XGetDeviceMotionEvents.txt              \
+       XGetDeviceProperty.txt                  \
+       XGetExtensionVersion.txt                \
+       XGetFeedbackControl.txt                 \
+       XGrabDeviceButton.txt                   \
+       XGrabDeviceKey.txt                      \
+       XGrabDevice.txt                         \
+       XListDeviceProperties.txt               \
+       XListInputDevices.txt                   \
+       XOpenDevice.txt                         \
+       XQueryDeviceState.txt                   \
+       XSelectExtensionEvent.txt               \
+       XSendExtensionEvent.txt                 \
+       XSetDeviceButtonMapping.txt             \
+       XSetDeviceFocus.txt                     \
+       XSetDeviceMode.txt                      \
+       XSetDeviceValuators.txt                 \
+       $(XI2_txt)
+
+# Name of DocBook XML files generated from .txt files by asciidoc
+libman_xml = $(libman_txt:.txt=.xml)
+
+# Shadow man pages are simply links to a main man page.
+# They are created by the xmlto command when generating man pages from DocBook
+# The shadow man page contains a gtroff .so request to include the main man page
+XI2_shadows =                                  \
+       XIUndefineCursor.man                    \
+       XIUngrabButton.man                      \
+       XIGrabKeycode.man                       \
+       XIUngrabKeycode.man                     \
+       XIUngrabDevice.man                      \
+       XIUngrabEnter.man                       \
+       XIGrabFocusIn.man                       \
+       XIUngrabFocusIn.man                     \
+       XIGetClientPointer.man                  \
+       XIGetFocus.man                          \
+       XIGetSelectedEvents.man                 \
+       XIDeleteProperty.man                    \
+       XIGetProperty.man                       \
+       XIFreeDeviceInfo.man
+
+libman_shadows =                               \
+       XGetDeviceDontPropagateList.man         \
+       XChangeDeviceControl.man                \
+       XChangeDeviceKeyMapping.man             \
+       XSetDeviceModifierMapping.man           \
+       XChangeFeedbackControl.man              \
+       XUngrabDeviceButton.man                 \
+       XUngrabDeviceKey.man                    \
+       XUngrabDevice.man                       \
+       XDeviceTimeCoord.man                    \
+       XFreeDeviceList.man                     \
+       XCloseDevice.man                        \
+       XGetSelectedExtensionEvents.man         \
+       XGetDeviceButtonMapping.man             \
+       XGetDeviceFocus.man                     \
+       XChangeDeviceProperty.man               \
+       XDeleteDeviceProperty.man               \
+       $(XI2_shadows)
+
+# Name of man page files generated from DocBook XML files by xmlto
+libman_PRE = $(libman_txt:.txt=.man) $(libman_shadows)
+
+if INSTALL_MANPAGES
+libman_DATA = $(libman_PRE:.man=.$(LIB_MAN_SUFFIX))
+endif
+
+EXTRA_DIST = $(libman_txt) $(libman_PRE)
+CLEANFILES = $(libman_DATA) *.libmansuffix
+MAINTAINERCLEANFILES = $(libman_PRE) *.xml
+
+# Dependencies for X Input v1 shadow pages
+XGetDeviceDontPropagateList.man: XChangeDeviceDontPropagateList.man
+XChangeDeviceControl.man: XGetDeviceControl.man
+XChangeDeviceKeyMapping.man: XGetDeviceKeyMapping.man
+XSetDeviceModifierMapping.man: XGetDeviceModifierMapping.man
+XDeviceTimeCoord.man: XGetDeviceMotionEvents.man
+XChangeFeedbackControl.man: XGetFeedbackControl.man
+XUngrabDeviceButton.man: XGrabDeviceButton.man
+XUngrabDeviceKey.man: XGrabDeviceKey.man
+XUngrabDevice.man: XGrabDevice.man
+XFreeDeviceList.man: XListInputDevices.man
+XCloseDevice.man: XOpenDevice.man
+XGetSelectedExtensionEvents.man: XSelectExtensionEvent.man
+XGetDeviceButtonMapping.man: XSetDeviceButtonMapping.man
+XGetDeviceFocus.man: XSetDeviceFocus.man
+XChangeDeviceProperty.man: XGetDeviceProperty.man
+XDeleteDeviceProperty.man: XGetDeviceProperty.man
+
+# Dependencies for X Input v2 shadow pages
+XIUndefineCursor.man: XIDefineCursor.man
+XIUngrabButton.man XIGrabKeycode.man XIUngrabKeycode.man: XIGrabButton.man
+XIGetClientPointer.man: XISetClientPointer.man
+XIGetFocus.man: XISetFocus.man
+XIUngrabDevice.man: XIGrabDevice.man
+XIGetProperty.man: XIChangeProperty.man
+XIDeleteProperty.man: XIChangeProperty.man
+XIUngrabEnter.man XIGrabFocusIn.man XIUngrabFocusIn.man: XIGrabEnter.man
+XIGetSelectedEvents.man: XISelectEvents.man
+XIFreeDeviceInfo.man: XIQueryDevice.man
+
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+# Unable to use __libmansuffix__ as underscores are lost in txt --> xml conversion
+MAN_SUBSTS += -e 's/libmansuffix/$(LIB_MAN_SUFFIX)/g'
+
+SUFFIXES = .man .$(LIB_MAN_SUFFIX)
+.man.$(LIB_MAN_SUFFIX):
+       $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+
+# Generate man pages and shadow pages from .txt and then from DocBook XML
+if HAVE_DOCTOOLS
+SUFFIXES += .txt .xml
+.txt.xml:
+       $(AM_V_GEN)$(ASCIIDOC) -b docbook -d manpage -o $@ $<
+.xml.man:
+       $(AM_V_GEN)$(XMLTO) man $<
+       $(AM_V_GEN)mv -f $(@:.man=.libmansuffix) $@
+
+# Invoke asciidoc/xmlto main man page generation for shadow pages
+$(libman_shadows):
+       @if test ! -f $(@:.man=.libmansuffix); then \
+         $(AM_V_GEN)rm -f $<; \
+         $(AM_V_GEN)$(MAKE) $(AM_MAKEFLAGS) $< || exit 1; \
+       fi
+       $(AM_V_GEN)mv -f $(@:.man=.libmansuffix) $@
+endif
diff --git a/man/XAllowDeviceEvents.man b/man/XAllowDeviceEvents.man
new file mode 100755 (executable)
index 0000000..37c5657
--- /dev/null
@@ -0,0 +1,169 @@
+'\" t
+.\"     Title: xallowdeviceevents
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 10/20/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XALLOWDEVICEEVENTS" "libmansuffix" "10/20/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XAllowDeviceEvents \- release queued events
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+int XAllowDeviceEvents( Display *display,
+                        XDevice *device,
+                        int event_mode,
+                        Time time);
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device from which events are to be
+       allowed\&.
+.fi
+.sp
+.nf
+event_mode
+       Specifies the event mode\&.You can pass AsyncThisDevice,
+       SyncThisDevice, ReplayThisDevice, AsyncOtherDevices,
+       SyncAll,or AsyncAll\&.
+.fi
+.sp
+.nf
+time
+       Specifies the time\&.You can pass either a timestamp or
+       CurrentTime\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+The XAllowDeviceEvents function releases some queued events if the client has caused a device to freeze\&. It has no effect if the specified time is earlier than the last\-grab time of the most recent active grab for the client and device, or if the specified time is later than the current X server time\&.
+.sp
+The following describes the processing that occurs depending on what constant you pass to the event_mode argument\&.
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+AsyncThisDevice \- If the specified device is frozen by the client, event processing for that device continues as usual\&. If the device is frozen multiple times by the client on behalf of multiple separate grabs, AsyncThisDevice thaws for all\&.AsyncThisDevice has no effect if the specified device is not frozen by the client, but the device need not be grabbed by the client\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+SyncThisDevice \- If the specified device is frozen and actively grabbed by the client, event processing for that device continues normally until the next key or button event is reported to the client\&. At this time, the specified device again appears to freeze\&. However, if the reported event causes the grab to be released, the specified device does not freeze\&. SyncThisDevice has no effect if the specified device is not frozen by the client or is not grabbed by the client\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+ReplayThisDevice \- If the specified device is actively grabbed by the client and is frozen as the result of an event having been sent to the client (either from the activation of a GrabDeviceButton or from a previous AllowDeviceEvents with mode SyncThisDevice, but not from a GrabDevice), the grab is released and that event is completely reprocessed\&. This time, however, the request ignores any passive grabs at or above (toward the root) that the grab\-window of the grab just released\&. The request has no effect if the specified device is not grabbed by the client or if it is not frozen as the result of an event\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+AsyncOtherDevices \- If the remaining devices are frozen by the client, event processing for them continues as usual\&. If the other devices are frozen multiple times by the client on behalf of multiple grabs, AsyncOtherDevices "thaws" for all\&. AsyncOtherDevices has no effect if the devices are not frozen by the client\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+SyncAll \- If all devices are frozen by the client, event processing (for all devices) continues normally until the next button or key event is reported to the client for a grabbed device, at which time all devices again appear to freeze\&. However, if the reported event causes the grab to be released, then the devices do not freeze\&. If any device is still grabbed, then a subsequent event for it will still cause all devices to freeze\&. SyncAll has no effect unless all devices are frozen by the client\&. If any device is frozen twice by the client on behalf of two separate grabs, SyncAll thaws for both\&. A subsequent freeze for SyncAll will only freeze each device once\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+AsyncAll \- If all devices are frozen by the client, event processing for all devices continues normally\&. If any device is frozen multiple times by the client on behalf of multiple separate grabs, AsyncAll thaws for all\&. AsyncAll has no effect unless all devices are frozen by the client\&.
+.RE
+.sp
+AsyncThisDevice, SyncThisDevice, and ReplayThisDevice have no effect on the processing of events from the remaining devices\&.AsyncOtherDevices has no effect on the processing of events from the specified device\&. When the event_mode is SyncAll or AsyncAll, the device parameter is ignored\&.
+.sp
+It is possible for several grabs of different devices by the same or different clients to be active simultaneously\&. If a device is frozen on behalf of any grab, no event processing is performed for the device\&. It is possible for a single device to be frozen because of several grabs\&. In this case, the freeze must be released on behalf of each grab before events can again be processed\&.
+.sp
+XAllowDeviceEvents can generate a BadDevice or BadValue error\&.
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if the
+       specified device is the X keyboard or X pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       An invalid mode was specified on the request\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XGrabDevice(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XAllowDeviceEvents.txt b/man/XAllowDeviceEvents.txt
new file mode 100755 (executable)
index 0000000..ba7fde3
--- /dev/null
@@ -0,0 +1,133 @@
+XALLOWDEVICEEVENTS(libmansuffix)
+================================
+
+NAME
+----
+
+   XAllowDeviceEvents - release queued events
+
+SYNOPSIS
+------
+
+   #include <X11/extensions/XInput.h>
+
+   int XAllowDeviceEvents( Display *display,
+                           XDevice *device,
+                           int event_mode,
+                           Time time);
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device from which events are to be
+          allowed.
+
+   event_mode
+          Specifies the event mode.You can pass AsyncThisDevice,
+          SyncThisDevice, ReplayThisDevice, AsyncOtherDevices,
+          SyncAll,or AsyncAll.
+
+   time
+          Specifies the time.You can pass either a timestamp or
+          CurrentTime.
+
+DESCRIPTION
+-----------
+
+The XAllowDeviceEvents function releases some queued events if
+the client has caused a device to freeze. It has no effect if
+the specified time is earlier than the last-grab time of the
+most recent active grab for the client and device, or if the
+specified time is later than the current X server time.
+
+The following describes the processing that occurs depending on
+what constant you pass to the event_mode argument.
+
+   * AsyncThisDevice - If the specified device is frozen by the
+   client, event processing for that device continues as usual. If
+   the device is frozen multiple times by the client on behalf of
+   multiple separate grabs, AsyncThisDevice thaws for
+   all.AsyncThisDevice has no effect if the specified device is
+   not frozen by the client, but the device need not be grabbed by
+   the client.
+
+   * SyncThisDevice - If the specified device is frozen and actively
+   grabbed by the client, event processing for that device
+   continues normally until the next key or button event is
+   reported to the client. At this time, the specified device
+   again appears to freeze. However, if the reported event causes
+   the grab to be released, the specified device does not freeze.
+   SyncThisDevice has no effect if the specified device is not
+   frozen by the client or is not grabbed by the client.
+
+   * ReplayThisDevice - If the specified device is actively grabbed by
+   the client and is frozen as the result of an event having been
+   sent to the client (either from the activation of a
+   GrabDeviceButton or from a previous AllowDeviceEvents with mode
+   SyncThisDevice, but not from a GrabDevice), the grab is
+   released and that event is completely reprocessed. This time,
+   however, the request ignores any passive grabs at or above
+   (toward the root) that the grab-window of the grab just
+   released. The request has no effect if the specified device is
+   not grabbed by the client or if it is not frozen as the result
+   of an event.
+
+   * AsyncOtherDevices - If the remaining devices are frozen by the
+   client, event processing for them continues as usual. If the
+   other devices are frozen multiple times by the client on behalf
+   of multiple grabs, AsyncOtherDevices "thaws" for all.
+   AsyncOtherDevices has no effect if the devices are not frozen
+   by the client.
+
+   * SyncAll - If all devices are frozen by the client, event
+   processing (for all devices) continues normally until the next
+   button or key event is reported to the client for a grabbed
+   device, at which time all devices again appear to freeze.
+   However, if the reported event causes the grab to be released,
+   then the devices do not freeze. If any device is still grabbed,
+   then a subsequent event for it will still cause all devices to
+   freeze. SyncAll has no effect unless all devices are frozen by
+   the client. If any device is frozen twice by the client on
+   behalf of two separate grabs, SyncAll thaws for both. A
+   subsequent freeze for SyncAll will only freeze each device
+   once.
+
+   * AsyncAll - If all devices are frozen by the client, event
+   processing for all devices continues normally. If any device is
+   frozen multiple times by the client on behalf of multiple
+   separate grabs, AsyncAll thaws for all. AsyncAll has no effect
+   unless all devices are frozen by the client.
+
+AsyncThisDevice, SyncThisDevice, and ReplayThisDevice have no
+effect on the processing of events from the remaining
+devices.AsyncOtherDevices has no effect on the processing of
+events from the specified device. When the event_mode is
+SyncAll or AsyncAll, the device parameter is ignored.
+
+It is possible for several grabs of different devices by the
+same or different clients to be active simultaneously. If a
+device is frozen on behalf of any grab, no event processing is
+performed for the device. It is possible for a single device to
+be frozen because of several grabs. In this case, the freeze
+must be released on behalf of each grab before events can again
+be processed.
+
+XAllowDeviceEvents can generate a BadDevice or BadValue error.
+
+DIAGNOSTICS
+-------------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if the
+          specified device is the X keyboard or X pointer device.
+
+   BadValue
+          An invalid mode was specified on the request.
+
+SEE ALSO
+--------
+
+   XGrabDevice(libmansuffix)
+
diff --git a/man/XChangeDeviceControl.man b/man/XChangeDeviceControl.man
new file mode 100644 (file)
index 0000000..2c385bc
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XGetDeviceControl.libmansuffix
diff --git a/man/XChangeDeviceDontPropagateList.man b/man/XChangeDeviceDontPropagateList.man
new file mode 100755 (executable)
index 0000000..c041acd
--- /dev/null
@@ -0,0 +1,188 @@
+'\" t
+.\"     Title: xchangedevicedontpropagatelist
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XCHANGEDEVICEDONTPRO" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XChangeDeviceDontPropagateList, XGetDeviceDontPropagateList \- query or change the dont\-propagate\-list for extension devices
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+int XChangeDeviceDontPropagateList( Display *display,
+                                    Window window,
+                                    int count,
+                                    XEventClass *event_list,
+                                    int mode);
+.fi
+.sp
+.nf
+XEventClass* XGetDeviceDontPropagateList( Display *display,
+                                          Window window,
+                                          int *count);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+window
+       Specifies the window whose dont\-propagate\-list is to be
+       queried or modified\&.
+.fi
+.sp
+.nf
+event_list
+       Specifies a pointer to a list of event classes\&.
+.fi
+.sp
+.nf
+mode
+       Specifies the mode\&.You can pass AddToList, or
+       DeleteFromList\&.
+.fi
+.sp
+.nf
+count
+       Specifies the number of event classes in the list\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XChangeDeviceDontPropagateList request modifies the list of
+events that should not be propagated to ancestors of the event
+window\&. This request allows extension events to be added to or
+deleted from that list\&. By default, all events are propagated
+to ancestor windows\&. Once modified, the list remains modified
+for the life of the window\&. Events are not removed from the
+list because the client that added them has terminated\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Suppression of event propagation is not allowed for all input
+extension events\&. If a specified event class is one that cannot
+be suppressed, a BadClass error will result\&. Events that can be
+suppressed include DeviceKeyPress, DeviceKeyRelease,
+DeviceButtonPress, DeviceButtonRelease, DeviceMotionNotify,
+ProximityIn, and ProximityOut\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XChangeDeviceDontPropagateList can generate a BadDevice,
+BadClass, or BadValue error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XGetDeviceDontPropagateList request queries the list of
+events that should not be propagated to ancestors of the event
+window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XGetDeviceDontPropagateList can generate a BadClass or
+BadWindow error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if some
+       other client has caused the specified device to become
+       the X keyboard or X pointer device via the
+       XChangeKeyboardDevice or XChangePointerDevice requests\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       Some numeric value falls outside the range of values
+       accepted by the request\&. Unless a specific range is
+       specified for an argument, the full range defined by the
+       argument\'s type is accepted\&. Any argument defined as a
+       set of alternatives can generate this error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       An invalid window id was specified\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadClass
+       An invalid event class was specified\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XChangeDeviceDontPropagateList.txt b/man/XChangeDeviceDontPropagateList.txt
new file mode 100755 (executable)
index 0000000..398ded2
--- /dev/null
@@ -0,0 +1,92 @@
+XCHANGEDEVICEDONTPROPAGATELIST(libmansuffix)
+============================================
+
+NAME
+----
+
+   XChangeDeviceDontPropagateList, XGetDeviceDontPropagateList -
+   query or change the dont-propagate-list for extension devices
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   int XChangeDeviceDontPropagateList( Display *display,
+                                       Window window,
+                                       int count,
+                                       XEventClass *event_list,
+                                       int mode);
+
+   XEventClass* XGetDeviceDontPropagateList( Display *display,
+                                             Window window,
+                                             int *count);
+
+   display
+          Specifies the connection to the X server.
+
+   window
+          Specifies the window whose dont-propagate-list is to be
+          queried or modified.
+
+   event_list
+          Specifies a pointer to a list of event classes.
+
+   mode
+          Specifies the mode.You can pass AddToList, or
+          DeleteFromList.
+
+   count
+          Specifies the number of event classes in the list.
+
+DESCRIPTION
+-----------
+
+   The XChangeDeviceDontPropagateList request modifies the list of
+   events that should not be propagated to ancestors of the event
+   window. This request allows extension events to be added to or
+   deleted from that list. By default, all events are propagated
+   to ancestor windows. Once modified, the list remains modified
+   for the life of the window. Events are not removed from the
+   list because the client that added them has terminated.
+
+   Suppression of event propagation is not allowed for all input
+   extension events. If a specified event class is one that cannot
+   be suppressed, a BadClass error will result. Events that can be
+   suppressed include DeviceKeyPress, DeviceKeyRelease,
+   DeviceButtonPress, DeviceButtonRelease, DeviceMotionNotify,
+   ProximityIn, and ProximityOut.
+
+   XChangeDeviceDontPropagateList can generate a BadDevice,
+   BadClass, or BadValue error.
+
+   The XGetDeviceDontPropagateList request queries the list of
+   events that should not be propagated to ancestors of the event
+   window.
+
+   XGetDeviceDontPropagateList can generate a BadClass or
+   BadWindow error.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if some
+          other client has caused the specified device to become
+          the X keyboard or X pointer device via the
+          XChangeKeyboardDevice or XChangePointerDevice requests.
+
+   BadValue
+          Some numeric value falls outside the range of values
+          accepted by the request. Unless a specific range is
+          specified for an argument, the full range defined by the
+          argument's type is accepted. Any argument defined as a
+          set of alternatives can generate this error.
+
+   BadWindow
+          An invalid window id was specified.
+
+   BadClass
+          An invalid event class was specified.
diff --git a/man/XChangeDeviceKeyMapping.man b/man/XChangeDeviceKeyMapping.man
new file mode 100755 (executable)
index 0000000..4ff457c
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XGetDeviceKeyMapping.libmansuffix
diff --git a/man/XChangeDeviceProperty.man b/man/XChangeDeviceProperty.man
new file mode 100755 (executable)
index 0000000..20c3934
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XGetDeviceProperty.libmansuffix
diff --git a/man/XChangeFeedbackControl.man b/man/XChangeFeedbackControl.man
new file mode 100755 (executable)
index 0000000..1ea22c5
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XGetFeedbackControl.libmansuffix
diff --git a/man/XChangeKeyboardDevice.man b/man/XChangeKeyboardDevice.man
new file mode 100755 (executable)
index 0000000..ed7ea4f
--- /dev/null
@@ -0,0 +1,138 @@
+'\" t
+.\"     Title: xchangekeyboarddevice
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XCHANGEKEYBOARDDEVIC" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XChangeKeyboardDevice \- change which device is used as the X keyboard
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+Status XChangeKeyboardDevice( Display *display,
+                              XDevice *device);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device to be used as the X keyboard\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XChangeKeyboardDevice request causes the server to use the
+specified device as the X keyboard\&. The device must have been
+previously opened by the requesting client via XOpenDevice or a
+BadDevice error will result\&. The device must support input
+class Keys, or a BadMatch error will result\&. If the server
+implementation does not support using the requested device as
+the X keyboard, a BadDevice error will result\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the specified device is grabbed by another client,
+AlreadyGrabbed is returned\&. If the specified device is frozen
+by a grab on another device, GrabFrozen is returned\&. If the
+request is successful, Success is returned\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the request succeeds, a ChangeDeviceNotify event is sent to
+all clients that have selected that event\&. A MappingNotify
+event with request = MappingKeyboard is sent to all clients\&.
+The specified device becomes the X keyboard and the old X
+keyboard becomes accessible through the input extension
+protocol requests\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XChangeKeyboardDevice can generate a BadDevice or a BadMatch
+error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist, has not been opened by this client via
+       XOpenInputDevice, or is already one of the core X device
+       (pointer or keyboard)\&. This error may also occur if the
+       server implementation does not support using the
+       specified device as the X keyboard\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if an XChangeKeyboardDevice request
+       was made specifying a device that has no keys\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XChangePointerDevice(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XChangeKeyboardDevice.txt b/man/XChangeKeyboardDevice.txt
new file mode 100755 (executable)
index 0000000..7ad1a23
--- /dev/null
@@ -0,0 +1,68 @@
+XCHANGEKEYBOARDDEVICE(libmansuffix)
+===================================
+
+NAME
+----
+
+   XChangeKeyboardDevice - change which device is used as the X
+   keyboard
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   Status XChangeKeyboardDevice( Display *display,
+                                 XDevice *device);
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device to be used as the X keyboard.
+
+DESCRIPTION
+-----------
+
+   The XChangeKeyboardDevice request causes the server to use the
+   specified device as the X keyboard. The device must have been
+   previously opened by the requesting client via XOpenDevice or a
+   BadDevice error will result. The device must support input
+   class Keys, or a BadMatch error will result. If the server
+   implementation does not support using the requested device as
+   the X keyboard, a BadDevice error will result.
+
+   If the specified device is grabbed by another client,
+   AlreadyGrabbed is returned. If the specified device is frozen
+   by a grab on another device, GrabFrozen is returned. If the
+   request is successful, Success is returned.
+
+   If the request succeeds, a ChangeDeviceNotify event is sent to
+   all clients that have selected that event. A MappingNotify
+   event with request = MappingKeyboard is sent to all clients.
+   The specified device becomes the X keyboard and the old X
+   keyboard becomes accessible through the input extension
+   protocol requests.
+
+   XChangeKeyboardDevice can generate a BadDevice or a BadMatch
+   error.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist, has not been opened by this client via
+          XOpenInputDevice, or is already one of the core X device
+          (pointer or keyboard). This error may also occur if the
+          server implementation does not support using the
+          specified device as the X keyboard.
+
+   BadMatch
+          This error may occur if an XChangeKeyboardDevice request
+          was made specifying a device that has no keys.
+
+SEE ALSO
+--------
+
+   XChangePointerDevice(libmansuffix)
diff --git a/man/XChangePointerDevice.man b/man/XChangePointerDevice.man
new file mode 100755 (executable)
index 0000000..dd85915
--- /dev/null
@@ -0,0 +1,154 @@
+'\" t
+.\"     Title: xchangepointerdevice
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XCHANGEPOINTERDEVICE" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XChangePointerDevice \- change which device is the X pointer
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+Status XChangePointerDevice( Display *display,
+                             XDevice *device,
+                             int xaxis,
+                             int yaxis);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device to be used as the X pointer\&.
+.fi
+.sp
+.nf
+xaxis
+       Specifies the axis of the device to be used as the X
+       pointer x\-axis\&.
+.fi
+.sp
+.nf
+yaxis
+       Specifies the axis of the device to be used as the X
+       pointer y\-axis\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XChangePointerDevice request causes the server to use the
+specified device as the X pointer\&. The device must have been
+opened by the client via XOpenDevice or a BadDevice error will
+result\&. The device must support input class Valuators or a
+BadMatch error will result\&. If the implementation does not
+support use of the specified device as the X pointer, a
+BadDevice error will result\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the specified device is grabbed by another client,
+AlreadyGrabbed is returned\&. If the specified device is frozen
+by a grab on another device, GrabFrozen is returned\&. If the
+request is successful, Success is returned\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the request succeeds, a ChangeDeviceNotify event is sent to
+all clients that have selected that event\&. A MappingNotify
+event with request = MappingPointer is sent to all clients\&. The
+specified device becomes the X pointer, and the old X pointer
+becomes accessible through the input extension protocol
+requests\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XChangePointerDevice can generate a BadDevice or a BadMatch
+error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist, has not been opened by this client via
+       XOpenInputDevice, or is already one of the core X input
+       devices (pointer or keyboard)\&. This error may also occur
+       if the server implementation does not support using the
+       specified device as the X pointer\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if an XChangePointerDevice request
+       was made specifying a device that has less than two
+       valuators, or specifying a valuator index beyond the
+       range supported by the device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XChangeKeyboardDevice(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XChangePointerDevice.txt b/man/XChangePointerDevice.txt
new file mode 100755 (executable)
index 0000000..606b65e
--- /dev/null
@@ -0,0 +1,79 @@
+XCHANGEPOINTERDEVICE(libmansuffix)
+==================================
+
+NAME
+----
+
+   XChangePointerDevice - change which device is the X pointer
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   Status XChangePointerDevice( Display *display,
+                                XDevice *device,
+                                int xaxis,
+                                int yaxis);
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device to be used as the X pointer.
+
+   xaxis
+          Specifies the axis of the device to be used as the X
+          pointer x-axis.
+
+   yaxis
+          Specifies the axis of the device to be used as the X
+          pointer y-axis.
+
+DESCRIPTION
+-----------
+
+   The XChangePointerDevice request causes the server to use the
+   specified device as the X pointer. The device must have been
+   opened by the client via XOpenDevice or a BadDevice error will
+   result. The device must support input class Valuators or a
+   BadMatch error will result. If the implementation does not
+   support use of the specified device as the X pointer, a
+   BadDevice error will result.
+
+   If the specified device is grabbed by another client,
+   AlreadyGrabbed is returned. If the specified device is frozen
+   by a grab on another device, GrabFrozen is returned. If the
+   request is successful, Success is returned.
+
+   If the request succeeds, a ChangeDeviceNotify event is sent to
+   all clients that have selected that event. A MappingNotify
+   event with request = MappingPointer is sent to all clients. The
+   specified device becomes the X pointer, and the old X pointer
+   becomes accessible through the input extension protocol
+   requests.
+
+   XChangePointerDevice can generate a BadDevice or a BadMatch
+   error.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist, has not been opened by this client via
+          XOpenInputDevice, or is already one of the core X input
+          devices (pointer or keyboard). This error may also occur
+          if the server implementation does not support using the
+          specified device as the X pointer.
+
+   BadMatch
+          This error may occur if an XChangePointerDevice request
+          was made specifying a device that has less than two
+          valuators, or specifying a valuator index beyond the
+          range supported by the device.
+
+SEE ALSO
+--------
+
+   XChangeKeyboardDevice(libmansuffix)
diff --git a/man/XCloseDevice.man b/man/XCloseDevice.man
new file mode 100755 (executable)
index 0000000..ff0ce17
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XOpenDevice.libmansuffix
diff --git a/man/XDeleteDeviceProperty.man b/man/XDeleteDeviceProperty.man
new file mode 100755 (executable)
index 0000000..20c3934
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XGetDeviceProperty.libmansuffix
diff --git a/man/XDeviceBell.man b/man/XDeviceBell.man
new file mode 100755 (executable)
index 0000000..0f907a6
--- /dev/null
@@ -0,0 +1,160 @@
+'\" t
+.\"     Title: xdevicebell
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XDEVICEBELL" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XDeviceBell \- ring a bell on a device supported through the input extension
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+Status XDeviceBell( Display *display,
+                    XDevice *device,
+                    XID feedbackclass,
+                    XID feedbackid,
+                    int percent);
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device with which the bell is associated\&.
+.fi
+.sp
+.nf
+feedbackclass
+       Specifies the class of the feedback with which the bell
+       is associated\&.
+.fi
+.sp
+.nf
+feedbackid
+       Specifies the id of the feedback with which the bell is
+       associated\&.
+.fi
+.sp
+.nf
+percent
+       Specifies the volume in the range \-100 to 100 at which
+       the bell should be rung\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XDeviceBell request causes the server to ring a bell on the
+specified feedback of the specified device, if possible\&. The
+specified volume is relative to the base volume for the bell\&.
+If an invalid device is specified, a BadDevice error will be
+returned\&. The feedbackclass and feedbackid parameters contain
+values returned by an XGetFeedbackControl request and uniquely
+identify the bell to ring\&. If a feedbackclass is specified that
+does not support a bell, or if a nonexistent feedbackid is
+specified, or a percent value is specified that is not in the
+range \-100 to 100, a BadValue error will be returned\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The volume at which the bell is rung when the percent argument
+is nonnegative is: base \- [(base * percent) / 100] + percent
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The volume at which the bell rings when the percent argument is
+negative is: base + [(base * percent) / 100]
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+To change the base volume of the bell, use
+XChangeFeedbackControl\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XDeviceBell can generate a BadDevice or a BadValue error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist, or has not been opened by this client
+       via XOpenInputDevice\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       An invalid feedbackclass, feedbackid, or percent value
+       was specified\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XChangeFeedbackControl(libmansuffix), XBell(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XDeviceBell.txt b/man/XDeviceBell.txt
new file mode 100755 (executable)
index 0000000..75bf652
--- /dev/null
@@ -0,0 +1,78 @@
+XDEVICEBELL(libmansuffix)
+=========================
+
+NAME
+----
+
+   XDeviceBell - ring a bell on a device supported through the
+   input extension
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   Status XDeviceBell( Display *display,
+                       XDevice *device,
+                       XID feedbackclass,
+                       XID feedbackid,
+                       int percent);
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device with which the bell is associated.
+
+   feedbackclass
+          Specifies the class of the feedback with which the bell
+          is associated.
+
+   feedbackid
+          Specifies the id of the feedback with which the bell is
+          associated.
+
+   percent
+          Specifies the volume in the range -100 to 100 at which
+          the bell should be rung.
+
+DESCRIPTION
+-----------
+
+   The XDeviceBell request causes the server to ring a bell on the
+   specified feedback of the specified device, if possible. The
+   specified volume is relative to the base volume for the bell.
+   If an invalid device is specified, a BadDevice error will be
+   returned. The feedbackclass and feedbackid parameters contain
+   values returned by an XGetFeedbackControl request and uniquely
+   identify the bell to ring. If a feedbackclass is specified that
+   does not support a bell, or if a nonexistent feedbackid is
+   specified, or a percent value is specified that is not in the
+   range -100 to 100, a BadValue error will be returned.
+
+   The volume at which the bell is rung when the percent argument
+   is nonnegative is: base - [(base * percent) / 100] + percent
+
+   The volume at which the bell rings when the percent argument is
+   negative is: base + [(base * percent) / 100]
+
+   To change the base volume of the bell, use
+   XChangeFeedbackControl.
+
+   XDeviceBell can generate a BadDevice or a BadValue error.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist, or has not been opened by this client
+          via XOpenInputDevice.
+
+   BadValue
+          An invalid feedbackclass, feedbackid, or percent value
+          was specified.
+
+SEE ALSO
+--------
+
+   XChangeFeedbackControl(libmansuffix), XBell(libmansuffix)
diff --git a/man/XDeviceTimeCoord.man b/man/XDeviceTimeCoord.man
new file mode 100755 (executable)
index 0000000..f9f3afd
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XGetDeviceMotionEvents.libmansuffix
diff --git a/man/XFreeDeviceList.man b/man/XFreeDeviceList.man
new file mode 100755 (executable)
index 0000000..9dd0be8
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XListInputDevices.libmansuffix
diff --git a/man/XGetDeviceButtonMapping.man b/man/XGetDeviceButtonMapping.man
new file mode 100755 (executable)
index 0000000..44b0ff9
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XSetDeviceButtonMapping.libmansuffix
diff --git a/man/XGetDeviceControl.man b/man/XGetDeviceControl.man
new file mode 100755 (executable)
index 0000000..a870f93
--- /dev/null
@@ -0,0 +1,276 @@
+'\" t
+.\"     Title: xgetdevicecontrol
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XGETDEVICECONTROL" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XGetDeviceControl, XChangeDeviceControl \- query and change input device controls
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+XDeviceControl *XGetDeviceControl( Display *display,
+                                   XDevice *device,
+                                   int *controlType);
+.fi
+.sp
+.nf
+int XChangeDeviceControl( Display *display,
+                          XDevice *device,
+                          int controlType,
+                          XDeviceControl *control);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device whose control is to be interrogated
+       or modified\&.
+.fi
+.sp
+.nf
+controlType
+       Specifies the type of control to be interrogated or
+       changed\&.
+.fi
+.sp
+.nf
+control
+       Specifies the address of an XDeviceControl structure
+       that contains the new values for the Device\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+These requests are provided to manipulate those input devices
+that support device control\&. A BadMatch error will be generated
+if the requested device does not support any device controls\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Valid device control types that can be used with these requests
+include the following:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+DEVICE_RESOLUTION Queries or changes the resolution of
+valuators on input devices\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XGetDeviceControl request returns a pointer to an
+XDeviceControl structure\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XGetDeviceControl can generate a BadDevice or BadMatch error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XChangeDeviceControl request modifies the values of one
+control on the specified device\&. The control is identified by
+the id field of the XDeviceControl structure that is passed
+with the request\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XChangeDeviceControl can generate a BadDevice, BadMatch, or
+BadValue error\&.\&.SH STRUCTURES Each control is described by a
+structure specific to that control\&. These structures are
+defined in the file XInput\&.h\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XDeviceControl is a generic structure that contains two fields
+that are at the beginning of each class of control:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    XID class;
+    int length;
+} XDeviceControl;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XDeviceResolutionState structure defines the information
+that is returned for device resolution for devices with
+valuators\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    XID control;
+    int length;
+    int num_valuators;
+    int* resolutions;
+    int* min_resolutions;
+    int* max_resolutions;
+} XDeviceResolutionState;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XDeviceResolutionControl structure defines the attributes
+that can be controlled for keyboard Devices\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    XID control;
+    int length;
+    int first_valuator;
+    int num_valuators;
+    int* resolutions;
+} XDeviceResolutionControl;
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if some
+       other client has caused the specified device to become
+       the X keyboard or X pointer device via the
+       XChangeKeyboardDevice or XChangePointerDevice requests\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if an XGetDeviceControl request was
+       made specifying a device that has no controls or an
+       XChangeDeviceControl request was made with an
+       XDeviceControl structure that contains an invalid Device
+       type\&. It may also occur if an invalid combination of
+       mask bits is specified ( DvKey but no DvAutoRepeatMode
+       for keyboard Devices), or if an invalid KeySym is
+       specified for a string Device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       Some numeric value falls outside the range of values
+       accepted by the XChangeDeviceControl request\&. Unless a
+       specific range is specified for an argument, the full
+       range defined by the argument\'s type is accepted\&. Any
+       argument defined as a set of alternatives can generate
+       this error\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XGetDeviceControl.txt b/man/XGetDeviceControl.txt
new file mode 100755 (executable)
index 0000000..09bf065
--- /dev/null
@@ -0,0 +1,126 @@
+XGETDEVICECONTROL(libmansuffix)
+===============================
+
+NAME
+----
+
+   XGetDeviceControl, XChangeDeviceControl - query and change
+   input device controls
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   XDeviceControl *XGetDeviceControl( Display *display,
+                                      XDevice *device,
+                                      int *controlType);
+
+   int XChangeDeviceControl( Display *display,
+                             XDevice *device,
+                             int controlType,
+                             XDeviceControl *control);
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device whose control is to be interrogated
+          or modified.
+
+   controlType
+          Specifies the type of control to be interrogated or
+          changed.
+
+   control
+          Specifies the address of an XDeviceControl structure
+          that contains the new values for the Device.
+
+DESCRIPTION
+-----------
+
+   These requests are provided to manipulate those input devices
+   that support device control. A BadMatch error will be generated
+   if the requested device does not support any device controls.
+
+   Valid device control types that can be used with these requests
+   include the following:
+
+   DEVICE_RESOLUTION Queries or changes the resolution of
+   valuators on input devices.
+
+   The XGetDeviceControl request returns a pointer to an
+   XDeviceControl structure.
+
+   XGetDeviceControl can generate a BadDevice or BadMatch error.
+
+   The XChangeDeviceControl request modifies the values of one
+   control on the specified device. The control is identified by
+   the id field of the XDeviceControl structure that is passed
+   with the request.
+
+   XChangeDeviceControl can generate a BadDevice, BadMatch, or
+   BadValue error..SH STRUCTURES Each control is described by a
+   structure specific to that control. These structures are
+   defined in the file XInput.h.
+
+   XDeviceControl is a generic structure that contains two fields
+   that are at the beginning of each class of control:
+
+                typedef struct {
+                    XID class;
+                    int length;
+                } XDeviceControl;
+
+   The XDeviceResolutionState structure defines the information
+   that is returned for device resolution for devices with
+   valuators.
+
+                typedef struct {
+                    XID control;
+                    int length;
+                    int num_valuators;
+                    int* resolutions;
+                    int* min_resolutions;
+                    int* max_resolutions;
+                } XDeviceResolutionState;
+
+   The XDeviceResolutionControl structure defines the attributes
+   that can be controlled for keyboard Devices.
+
+                typedef struct {
+                    XID control;
+                    int length;
+                    int first_valuator;
+                    int num_valuators;
+                    int* resolutions;
+                } XDeviceResolutionControl;
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if some
+          other client has caused the specified device to become
+          the X keyboard or X pointer device via the
+          XChangeKeyboardDevice or XChangePointerDevice requests.
+
+   BadMatch
+          This error may occur if an XGetDeviceControl request was
+          made specifying a device that has no controls or an
+          XChangeDeviceControl request was made with an
+          XDeviceControl structure that contains an invalid Device
+          type. It may also occur if an invalid combination of
+          mask bits is specified ( DvKey but no DvAutoRepeatMode
+          for keyboard Devices), or if an invalid KeySym is
+          specified for a string Device.
+
+   BadValue
+          Some numeric value falls outside the range of values
+          accepted by the XChangeDeviceControl request. Unless a
+          specific range is specified for an argument, the full
+          range defined by the argument's type is accepted. Any
+          argument defined as a set of alternatives can generate
+          this error.
diff --git a/man/XGetDeviceDontPropagateList.man b/man/XGetDeviceDontPropagateList.man
new file mode 100755 (executable)
index 0000000..65257da
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XChangeDeviceDontPropagateList.libmansuffix
diff --git a/man/XGetDeviceFocus.man b/man/XGetDeviceFocus.man
new file mode 100755 (executable)
index 0000000..9ce679e
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XSetDeviceFocus.libmansuffix
diff --git a/man/XGetDeviceKeyMapping.man b/man/XGetDeviceKeyMapping.man
new file mode 100755 (executable)
index 0000000..dad0e2b
--- /dev/null
@@ -0,0 +1,352 @@
+'\" t
+.\"     Title: xgetdevicekeymapping
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XGETDEVICEKEYMAPPING" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XGetDeviceKeyMapping, XChangeDeviceKeyMapping \- query or change device key mappings
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+KeySym *XGetDeviceKeyMapping( Display *display,
+                              XDevice *device,
+                              KeyCode first_keycode,
+                              int keycode_count,
+                              int *keysyms_per_keycode_return);
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device whose key mapping is to be queried
+       or modified\&.
+.fi
+.sp
+.nf
+first_keycode
+       Specifies the first KeyCode to be returned\&.
+.fi
+.sp
+.nf
+keycode_count
+       Specifies the number of KeyCodes to be returned or
+       modified\&.
+.fi
+.sp
+.nf
+keysyms_per_keycode
+       Specifies the number of KeySyms per KeyCode\&.
+.fi
+.sp
+.nf
+keysyms_per_keycode_return
+       Specifies the address of a variable into which the
+       number of KeySyms per KeyCodewill be returned\&.
+.fi
+.sp
+.nf
+keysyms
+       Specifies the address of an array of KeySyms\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+For the specified device, the XGetDeviceKeyMapping request
+returns the symbols for the specified number of KeyCodes
+starting with first_keycode\&. The value specified in
+first_keycode must be greater than or equal to min_keycode as
+returned by XListInputDevices, or a BadValue error results\&. In
+addition, the following expression must be less than or equal
+to max_keycode as returned by XListInputDevices:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+first_keycode + keycode_count \- 1
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If this is not the case, a BadValue error results\&. The number
+of elements in the KeySyms list is:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+keycode_count * keysyms_per_keycode_return
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+KeySym number N, counting from zero, for KeyCode K has the
+following index in the list, counting from zero: (K \-
+first_code) * keysyms_per_code_return + N
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The X server arbitrarily chooses the keysyms_per_keycode_return
+value to be large enough to report all requested symbols\&. A
+special KeySym value of NoSymbol is used to fill in unused
+elements for individual KeyCodes\&. To free the storage returned
+by XGetDeviceKeyMapping, use XFree\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the specified device does not support input class keys, a
+BadMatch error will result\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XGetDeviceKeyMapping can generate a BadDevice, BadMatch, or
+BadValue error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+For the specified device, the XChangeDeviceKeyMapping request
+defines the symbols for the specified number of KeyCodes
+starting with first_keycode\&. The symbols for KeyCodes outside
+this range remain unchanged\&. The number of elements in keysyms
+must be:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+num_codes * keysyms_per_keycode
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The specified first_keycode must be greater than or equal to
+min_keycode returned by XListInputDevices, or a BadValue error
+results\&. In addition, the following expression must be less
+than or equal to max_keycode as returned by XListInputDevices,
+or a BadValue error results:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+first_keycode + num_codes \- 1
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+KeySym number N, counting from zero, for KeyCode K has the
+following index in keysyms, counting from zero:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+(K \- first_keycode) * keysyms_per_keycode + N
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The specified keysyms_per_keycode can be chosen arbitrarily by
+the client to be large enough to hold all desired symbols\&. A
+special KeySym value of NoSymbol should be used to fill in
+unused elements for individual KeyCodes\&. It is legal for
+NoSymbol to appear in nontrailing positions of the effective
+list for a KeyCode\&.XChangeDeviceKeyMapping generates a
+DeviceMappingNotify event that is sent to all clients that have
+selected that type of event\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+There is no requirement that the X server interpret this
+mapping\&. It is merely stored for reading and writing by
+clients\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the specified device does not support input class keys, a
+BadMatch error results\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XChangeDeviceKeyMapping can generate a BadDevice, BadMatch,
+BadAlloc, or BadValue error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if the
+       specified device is the X keyboard or X pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if an XGetDeviceKeyMapping or
+       XChangeDeviceKeyMapping request was made specifying a
+       device that has no keys\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       Some numeric value falls outside the range of values
+       accepted by the request\&. Unless a specific range is
+       specified for an argument, the full range defined by the
+       argument\'s type is accepted\&. Any argument defined as a
+       set of alternatives can generate this error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadAlloc
+       The server failed to allocate the requested resource or
+       server memory\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XSetDeviceButtonMapping(libmansuffix), XSetDeviceModifierMapping(__libmansuffix_)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XGetDeviceKeyMapping.txt b/man/XGetDeviceKeyMapping.txt
new file mode 100755 (executable)
index 0000000..0c68412
--- /dev/null
@@ -0,0 +1,146 @@
+XGETDEVICEKEYMAPPING(libmansuffix)
+==================================
+
+NAME
+----
+
+   XGetDeviceKeyMapping, XChangeDeviceKeyMapping - query or change
+   device key mappings
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   KeySym *XGetDeviceKeyMapping( Display *display,
+                                 XDevice *device,
+                                 KeyCode first_keycode,
+                                 int keycode_count,
+                                 int *keysyms_per_keycode_return);
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device whose key mapping is to be queried
+          or modified.
+
+   first_keycode
+          Specifies the first KeyCode to be returned.
+
+   keycode_count
+          Specifies the number of KeyCodes to be returned or
+          modified.
+
+   keysyms_per_keycode
+          Specifies the number of KeySyms per KeyCode.
+
+   keysyms_per_keycode_return
+          Specifies the address of a variable into which the
+          number of KeySyms per KeyCodewill be returned.
+
+   keysyms
+          Specifies the address of an array of KeySyms.
+
+DESCRIPTION
+-----------
+
+   For the specified device, the XGetDeviceKeyMapping request
+   returns the symbols for the specified number of KeyCodes
+   starting with first_keycode. The value specified in
+   first_keycode must be greater than or equal to min_keycode as
+   returned by XListInputDevices, or a BadValue error results. In
+   addition, the following expression must be less than or equal
+   to max_keycode as returned by XListInputDevices:
+
+   first_keycode + keycode_count - 1
+
+   If this is not the case, a BadValue error results. The number
+   of elements in the KeySyms list is:
+
+   keycode_count * keysyms_per_keycode_return
+
+   KeySym number N, counting from zero, for KeyCode K has the
+   following index in the list, counting from zero: (K -
+   first_code) * keysyms_per_code_return + N
+
+   The X server arbitrarily chooses the keysyms_per_keycode_return
+   value to be large enough to report all requested symbols. A
+   special KeySym value of NoSymbol is used to fill in unused
+   elements for individual KeyCodes. To free the storage returned
+   by XGetDeviceKeyMapping, use XFree.
+
+   If the specified device does not support input class keys, a
+   BadMatch error will result.
+
+   XGetDeviceKeyMapping can generate a BadDevice, BadMatch, or
+   BadValue error.
+
+   For the specified device, the XChangeDeviceKeyMapping request
+   defines the symbols for the specified number of KeyCodes
+   starting with first_keycode. The symbols for KeyCodes outside
+   this range remain unchanged. The number of elements in keysyms
+   must be:
+
+   num_codes * keysyms_per_keycode
+
+   The specified first_keycode must be greater than or equal to
+   min_keycode returned by XListInputDevices, or a BadValue error
+   results. In addition, the following expression must be less
+   than or equal to max_keycode as returned by XListInputDevices,
+   or a BadValue error results:
+
+   first_keycode + num_codes - 1
+
+   KeySym number N, counting from zero, for KeyCode K has the
+   following index in keysyms, counting from zero:
+
+   (K - first_keycode) * keysyms_per_keycode + N
+
+   The specified keysyms_per_keycode can be chosen arbitrarily by
+   the client to be large enough to hold all desired symbols. A
+   special KeySym value of NoSymbol should be used to fill in
+   unused elements for individual KeyCodes. It is legal for
+   NoSymbol to appear in nontrailing positions of the effective
+   list for a KeyCode.XChangeDeviceKeyMapping generates a
+   DeviceMappingNotify event that is sent to all clients that have
+   selected that type of event.
+
+   There is no requirement that the X server interpret this
+   mapping. It is merely stored for reading and writing by
+   clients.
+
+   If the specified device does not support input class keys, a
+   BadMatch error results.
+
+   XChangeDeviceKeyMapping can generate a BadDevice, BadMatch,
+   BadAlloc, or BadValue error.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if the
+          specified device is the X keyboard or X pointer device.
+
+   BadMatch
+          This error may occur if an XGetDeviceKeyMapping or
+          XChangeDeviceKeyMapping request was made specifying a
+          device that has no keys.
+
+   BadValue
+          Some numeric value falls outside the range of values
+          accepted by the request. Unless a specific range is
+          specified for an argument, the full range defined by the
+          argument's type is accepted. Any argument defined as a
+          set of alternatives can generate this error.
+
+   BadAlloc
+          The server failed to allocate the requested resource or
+          server memory.
+
+SEE ALSO
+--------
+
+   XSetDeviceButtonMapping(libmansuffix), XSetDeviceModifierMapping(__libmansuffix_)
diff --git a/man/XGetDeviceModifierMapping.man b/man/XGetDeviceModifierMapping.man
new file mode 100755 (executable)
index 0000000..223fa37
--- /dev/null
@@ -0,0 +1,248 @@
+'\" t
+.\"     Title: xgetdevicemodifiermapping
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XGETDEVICEMODIFIERMA" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XGetDeviceModifierMapping, XSetDeviceModifierMapping \- query or change device modifier mappings
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+int XSetDeviceModifierMapping( Display *display,
+                               XDevice *device,
+                               XModifierKeymap *modmap);
+.fi
+.sp
+.nf
+XModifierKeymap *XGetDeviceModifierMapping( Display *display,
+                                            XDevice *device);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device whose modifier mapping is to be
+       queried or modified\&.
+.fi
+.sp
+.nf
+modmap
+       Specifies a pointer to the XModifierKeymap structure\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XSetDeviceModifierMapping request specifies the KeyCodes of
+the keys (if any) that are to be used as modifiers for the
+specified device\&. If it succeeds, the X server generates a
+DeviceMappingNotify event, and XSetDeviceModifierMapping
+returns MappingSuccess\&. X permits at most eight modifier keys\&.
+If more than eight are specified in the XModifierKeymap
+structure, a BadLength error results\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The modifiermap member of the XModifierKeymap structure
+contains eight sets of max_keypermod KeyCodes, one for each
+modifier in the order Shift, Lock, Control, Mod1, Mod2, Mod3,
+Mod4, and Mod5\&. Only nonzero KeyCodes have meaning in each set,
+and zero KeyCodes are ignored\&. In addition, all of the nonzero
+KeyCodes must be in the range specified by min_keycode and
+max_keycode as returned by XListInputDevices, or a BadValue
+error results\&. No KeyCode may appear twice in the entire map,
+or a BadValue error results\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+An X server can impose restrictions on how modifiers can be
+changed, for example, if certain keys do not generate up
+transitions in hardware, if auto\-repeat cannot be disabled on
+certain keys, or if multiple modifier keys are not supported\&.
+If some such restriction is violated, the status reply is
+MappingFailed, and none of the modifiers are changed\&. If the
+new KeyCodes specified for a modifier differ from those
+currently defined and any (current or new) keys for that
+modifier are in the logically down state,
+XSetDeviceModifierMapping returns MappingBusy, and none of the
+modifiers is changed\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XSetDeviceModifierMapping can generate BadLength, BadDevice,
+BadMatch, BadAlloc, and BadValue errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XGetDeviceModifierMapping request returns a pointer to a
+newly created XModifierKeymap structure that contains the keys
+being used as modifiers\&. The structure should be freed after
+use by calling XFreeModifierMapping \&. If only zero values
+appear in the set for any modifier, that modifier is disabled\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XGetDeviceModifierMapping can generate BadDevice and BadMatch
+errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Structures
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XModifierKeymap structure contains:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+int max_keypermod;
+KeyCode *modifiermap;
+} XModifierKeymap;
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadLength
+       More than eight keys were specified in the
+       XModifierKeymap structure\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadAlloc
+       The server failed to allocate the requested resource or
+       server memory\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if the
+       specified device is the X keyboard or X pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if an XGetDeviceModifierMapping or
+       XChangeDeviceModifierMapping request was made specifying
+       a device that has no keys\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       Some numeric value falls outside the range of values
+       accepted by the request\&. Unless a specific range is
+       specified for an argument, the full range defined by the
+       argument\'s type is accepted\&. Any argument defined as a
+       set of alternatives can generate this error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XSetDeviceKeyMapping(libmansuffix), XSetDeviceButtonMapping(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XGetDeviceModifierMapping.txt b/man/XGetDeviceModifierMapping.txt
new file mode 100755 (executable)
index 0000000..240f93f
--- /dev/null
@@ -0,0 +1,118 @@
+XGETDEVICEMODIFIERMAPPING(libmansuffix)
+=======================================
+
+NAME
+----
+
+   XGetDeviceModifierMapping, XSetDeviceModifierMapping - query or
+   change device modifier mappings
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   int XSetDeviceModifierMapping( Display *display,
+                                  XDevice *device,
+                                  XModifierKeymap *modmap);
+
+   XModifierKeymap *XGetDeviceModifierMapping( Display *display,
+                                               XDevice *device);
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device whose modifier mapping is to be
+          queried or modified.
+
+   modmap
+          Specifies a pointer to the XModifierKeymap structure.
+
+DESCRIPTION
+-----------
+
+   The XSetDeviceModifierMapping request specifies the KeyCodes of
+   the keys (if any) that are to be used as modifiers for the
+   specified device. If it succeeds, the X server generates a
+   DeviceMappingNotify event, and XSetDeviceModifierMapping
+   returns MappingSuccess. X permits at most eight modifier keys.
+   If more than eight are specified in the XModifierKeymap
+   structure, a BadLength error results.
+
+   The modifiermap member of the XModifierKeymap structure
+   contains eight sets of max_keypermod KeyCodes, one for each
+   modifier in the order Shift, Lock, Control, Mod1, Mod2, Mod3,
+   Mod4, and Mod5. Only nonzero KeyCodes have meaning in each set,
+   and zero KeyCodes are ignored. In addition, all of the nonzero
+   KeyCodes must be in the range specified by min_keycode and
+   max_keycode as returned by XListInputDevices, or a BadValue
+   error results. No KeyCode may appear twice in the entire map,
+   or a BadValue error results.
+
+   An X server can impose restrictions on how modifiers can be
+   changed, for example, if certain keys do not generate up
+   transitions in hardware, if auto-repeat cannot be disabled on
+   certain keys, or if multiple modifier keys are not supported.
+   If some such restriction is violated, the status reply is
+   MappingFailed, and none of the modifiers are changed. If the
+   new KeyCodes specified for a modifier differ from those
+   currently defined and any (current or new) keys for that
+   modifier are in the logically down state,
+   XSetDeviceModifierMapping returns MappingBusy, and none of the
+   modifiers is changed.
+
+   XSetDeviceModifierMapping can generate BadLength, BadDevice,
+   BadMatch, BadAlloc, and BadValue errors.
+
+   The XGetDeviceModifierMapping request returns a pointer to a
+   newly created XModifierKeymap structure that contains the keys
+   being used as modifiers. The structure should be freed after
+   use by calling XFreeModifierMapping . If only zero values
+   appear in the set for any modifier, that modifier is disabled.
+
+   XGetDeviceModifierMapping can generate BadDevice and BadMatch
+   errors.
+
+Structures
+
+   The XModifierKeymap structure contains:
+
+                typedef struct {
+                int max_keypermod;
+                KeyCode *modifiermap;
+                } XModifierKeymap;
+
+DIAGNOSTICS
+-----------
+
+   BadLength
+          More than eight keys were specified in the
+          XModifierKeymap structure.
+
+   BadAlloc
+          The server failed to allocate the requested resource or
+          server memory.
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if the
+          specified device is the X keyboard or X pointer device.
+
+   BadMatch
+          This error may occur if an XGetDeviceModifierMapping or
+          XChangeDeviceModifierMapping request was made specifying
+          a device that has no keys.
+
+   BadValue
+          Some numeric value falls outside the range of values
+          accepted by the request. Unless a specific range is
+          specified for an argument, the full range defined by the
+          argument's type is accepted. Any argument defined as a
+          set of alternatives can generate this error.
+
+SEE ALSO
+--------
+
+   XSetDeviceKeyMapping(libmansuffix), XSetDeviceButtonMapping(libmansuffix)
diff --git a/man/XGetDeviceMotionEvents.man b/man/XGetDeviceMotionEvents.man
new file mode 100755 (executable)
index 0000000..8dde172
--- /dev/null
@@ -0,0 +1,221 @@
+'\" t
+.\"     Title: xgetdevicemotionevents
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XGETDEVICEMOTIONEVEN" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XGetDeviceMotionEvents, XDeviceTimeCoord \- get device motion history
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+XDeviceTimeCoord *XGetDeviceMotionEvents( Display *display,
+                                          XDevice *device,
+                                          Time start,
+                                          Time stop,
+                                          int *nevents_return,
+                                          int *mode_return,
+                                          int *axis_count_return);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device whose motion history is to be
+       queried\&.
+.fi
+.sp
+.nf
+start, stop
+       Specify the time interval in which the events are
+       returned from the motionhistory buffer\&.You can pass a
+       timestamp or CurrentTime\&.
+.fi
+.sp
+.nf
+nevents_return
+       Returns the number of events from the motion history
+       buffer\&.
+.fi
+.sp
+.nf
+mode_return
+       Returns the mode of the device (Absolute or Relative)\&.
+.fi
+.sp
+.nf
+axis_count_return
+       Returns the count of axes being reported\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The server may retain the recent history of the device motion
+and do so to a finer granularity than is reported by
+DeviceMotionNotify events\&. The XGetDeviceMotionEvents request
+makes this history available\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XGetDeviceMotionEvents request returns all events in the
+motion history buffer that fall between the specified start and
+stop times, inclusive\&. If the start time is later than the stop
+time or if the start time is in the future, no events are
+returned\&. If the stop time is in the future, it is equivalent
+to specifying CurrentTime\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The mode indicates whether the device is reporting absolute
+positional data (mode = Absolute ) or relative motion data
+(mode = Relative )\&. Some devices allow their mode to be changed
+via the XSetDeviceMode request\&. These constants are defined in
+the file XI\&.h\&. The axis_count returns the number of axes or
+valuators being reported by the device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XGetDeviceMotionEvents can generate a BadDevice, or BadMatch
+error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Structures
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XDeviceTimeCoord structure contains:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    Time time;
+    int *data;
+} XDeviceTimeCoord;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The time member is set to the time, in milliseconds\&. The data
+member is a pointer to an array of integers\&. These integers are
+set to the values of each valuator or axis reported by the
+device\&. There is one element in the array per axis of motion
+reported by the device\&. The value of the array elements depends
+on the mode of the device\&. If the mode is Absolute, the values
+are the raw values generated by the device\&. These may be scaled
+by client programs using the maximum values that the device can
+generate\&. The maximum value for each axis of the device is
+reported in the max_val field of the XAxisInfo returned by the
+XListInputDevices request\&. If the mode is Relative, the data
+values are the relative values generated by the device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+You should use XFreeDeviceMotionEvents to free the data
+returned by this request\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Errors returned by this request: BadDevice, BadMatch\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if the
+       specified device is the X keyboard or X pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if an XGetDeviceMotionEvents
+       request is made specifying a device that has no
+       valuators and reports no axes of motion\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XGetDeviceMotionEvents.txt b/man/XGetDeviceMotionEvents.txt
new file mode 100755 (executable)
index 0000000..9dfcfed
--- /dev/null
@@ -0,0 +1,109 @@
+XGETDEVICEMOTIONEVENTS(libmansuffix)
+====================================
+
+NAME
+----
+
+   XGetDeviceMotionEvents, XDeviceTimeCoord - get device motion
+   history
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   XDeviceTimeCoord *XGetDeviceMotionEvents( Display *display,
+                                             XDevice *device,
+                                             Time start,
+                                             Time stop,
+                                             int *nevents_return,
+                                             int *mode_return,
+                                             int *axis_count_return);
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device whose motion history is to be
+          queried.
+
+   start, stop
+          Specify the time interval in which the events are
+          returned from the motionhistory buffer.You can pass a
+          timestamp or CurrentTime.
+
+   nevents_return
+          Returns the number of events from the motion history
+          buffer.
+
+   mode_return
+          Returns the mode of the device (Absolute or Relative).
+
+   axis_count_return
+          Returns the count of axes being reported.
+
+DESCRIPTION
+-----------
+
+   The server may retain the recent history of the device motion
+   and do so to a finer granularity than is reported by
+   DeviceMotionNotify events. The XGetDeviceMotionEvents request
+   makes this history available.
+
+   The XGetDeviceMotionEvents request returns all events in the
+   motion history buffer that fall between the specified start and
+   stop times, inclusive. If the start time is later than the stop
+   time or if the start time is in the future, no events are
+   returned. If the stop time is in the future, it is equivalent
+   to specifying CurrentTime.
+
+   The mode indicates whether the device is reporting absolute
+   positional data (mode = Absolute ) or relative motion data
+   (mode = Relative ). Some devices allow their mode to be changed
+   via the XSetDeviceMode request. These constants are defined in
+   the file XI.h. The axis_count returns the number of axes or
+   valuators being reported by the device.
+
+   XGetDeviceMotionEvents can generate a BadDevice, or BadMatch
+   error.
+
+Structures
+
+   The XDeviceTimeCoord structure contains:
+
+                typedef struct {
+                    Time time;
+                    int *data;
+                } XDeviceTimeCoord;
+
+   The time member is set to the time, in milliseconds. The data
+   member is a pointer to an array of integers. These integers are
+   set to the values of each valuator or axis reported by the
+   device. There is one element in the array per axis of motion
+   reported by the device. The value of the array elements depends
+   on the mode of the device. If the mode is Absolute, the values
+   are the raw values generated by the device. These may be scaled
+   by client programs using the maximum values that the device can
+   generate. The maximum value for each axis of the device is
+   reported in the max_val field of the XAxisInfo returned by the
+   XListInputDevices request. If the mode is Relative, the data
+   values are the relative values generated by the device.
+
+   You should use XFreeDeviceMotionEvents to free the data
+   returned by this request.
+
+   Errors returned by this request: BadDevice, BadMatch.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if the
+          specified device is the X keyboard or X pointer device.
+
+   BadMatch
+          This error may occur if an XGetDeviceMotionEvents
+          request is made specifying a device that has no
+          valuators and reports no axes of motion.
diff --git a/man/XGetDeviceProperty.man b/man/XGetDeviceProperty.man
new file mode 100755 (executable)
index 0000000..d018cd8
--- /dev/null
@@ -0,0 +1,216 @@
+'\" t
+.\"     Title: xgetdeviceproperty
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 11/03/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XGETDEVICEPROPERTY" "libmansuffix" "11/03/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XGetDeviceProperty, XChangeDeviceProperty, XDeleteDeviceProperty \- Get, change or delete a device\'s property\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+int XGetDeviceProperty( Display *display,
+                        XDevice *device,
+                        Atom property,
+                        long offset,
+                        long length,
+                        Bool delete,
+                        Atom req_type,
+                        Atom *actual_type_return,
+                        int *actual_format_return,
+                        unsigned long *nitems_return,
+                        unsigned long *bytes_after_return,
+                        unsigned char **prop_return)
+.fi
+.sp
+.nf
+void XChangeDeviceProperty( Display *display,
+                            XDevice *device,
+                            Atom property,
+                            Atom type,
+                            int format,
+                            int mode,
+                            const char *data,
+                            int nelements)
+.fi
+.sp
+.nf
+void XDeleteDeviceProperty( Display *display,
+                            XDevice *device,
+                            Atom property)
+.fi
+.sp
+.nf
+actual_type_return
+       Returns an atom identifier that defines the actual type
+       of the property\&.
+.fi
+.sp
+.nf
+actual_format_return
+       Returns the actual format of the property\&.
+.fi
+.sp
+.nf
+bytes_after_return
+       Returns the number of bytes remaining to be read in the
+       property if a partial read was performed\&.
+.fi
+.sp
+.nf
+data
+       Specifies the property data\&.
+.fi
+.sp
+.nf
+delete
+       Specifies a Boolean value that determines whether the
+       property is deleted\&.
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       The device to grab\&.
+.fi
+.sp
+.nf
+format
+       Specifies whether the data should be viewed as a list of
+       8\-bit, 16\-bit, or 32\-bit quantities\&. Possible values are
+       8, 16, and 32\&. This information allows the X server to
+       correctly perform byte\-swap operations as necessary\&. If
+       the format is 16\-bit or 32\-bit, you must explicitly cast
+       the data pointer to an (unsigned char*) in the call to
+       XChangeDeviceProperty\&.
+.fi
+.sp
+.nf
+length
+       Specifies the length in 32\-bit multiplies of the data to
+       be retrieved\&.
+.fi
+.sp
+.nf
+mode
+       Specifies the mode of operation\&. You can pass
+       PropModeReplace, PropModePrepend, or PropModeAppend\&.
+.fi
+.sp
+.nf
+nelements
+       Specifies the number of elements in data\&.
+.fi
+.sp
+.nf
+nitems_return
+       Returns the actual number of 8\-bit, 16\-bit, or 32\-bit
+       items stored in the prop_return array\&.
+.fi
+.sp
+.nf
+num_values
+       Specifies the number of elements in the values list\&.
+.fi
+.sp
+.nf
+offset
+       Specifies the offset in the specified property (in
+       32\-bit quantities) where the data is to be retrieved\&.
+.fi
+.sp
+.nf
+property
+       Specifies the property to modify or query\&.
+.fi
+.sp
+.nf
+prop_return
+       Returns the data in the specified format\&. If the
+       returned format is 8, the returned data is represented
+       as a char array\&. If the returned format is 16, the
+       returned data is represented as an array of short int
+       type and should be cast to that type to obtain the
+       elements\&. If the returned format is 32, the property
+       data will be stored as an array of longs (which in a
+       64\-bit application will be 64\-bit values that are padded
+       in the upper 4 bytes)\&.
+.fi
+.sp
+.nf
+req_type
+       Specifies the atom identifier associated with the
+       property type or AnyPropertyType\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+The XGetDeviceProperty function returns the actual type of the property; the actual format of the property; the number of 8\-bit, 16\-bit, or 32\-bit items transferred; the number of bytes remaining to be read in the property; and a pointer to the data actually returned\&. For a detailed description of this function, see the man page to XGetWindowProperty\&.
+.sp
+The XChangeDeviceProperty function alters the property for the specified device and causes the server to generate a XPropertyNotifyEvent event on that device\&. For a detailed description of this function, see the man page to XChangeProperty\&.
+.sp
+The XDeleteDeviceProperty function deletes the specified device property\&. Note that a client cannot delete a property created by a driver or the server\&. Attempting to do so will result in a BadAtom error\&.
+.sp
+XGetDeviceProperty can generate a BadAtom, BadDevice error\&.
+.sp
+XChangeDeviceProperty can generate a BadDevice, a BadMatch, a BadAtom, and a BadValue error\&.
+.sp
+XDeleteDeviceProperty can generate a BadDevice, and a BadAtom error\&.
+.SH "DIAGNOSIS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadAtom
+       A value does not describe a valid named identifier or
+       the client attempted to remove a driver\-allocated
+       property\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The device does not
+       exist\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XListDeviceProperties(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XGetDeviceProperty.txt b/man/XGetDeviceProperty.txt
new file mode 100755 (executable)
index 0000000..403aa96
--- /dev/null
@@ -0,0 +1,160 @@
+XGETDEVICEPROPERTY(libmansuffix)
+================================
+
+NAME
+----
+
+   XGetDeviceProperty, XChangeDeviceProperty,
+   XDeleteDeviceProperty - Get, change or delete a device's
+   property.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+   int XGetDeviceProperty( Display *display,
+                           XDevice *device,
+                           Atom property,
+                           long offset,
+                           long length,
+                           Bool delete,
+                           Atom req_type,
+                           Atom *actual_type_return,
+                           int *actual_format_return,
+                           unsigned long *nitems_return,
+                           unsigned long *bytes_after_return,
+                           unsigned char **prop_return)
+
+   void XChangeDeviceProperty( Display *display,
+                               XDevice *device,
+                               Atom property,
+                               Atom type,
+                               int format,
+                               int mode,
+                               const char *data,
+                               int nelements)
+
+   void XDeleteDeviceProperty( Display *display,
+                               XDevice *device,
+                               Atom property)
+
+
+   actual_type_return
+          Returns an atom identifier that defines the actual type
+          of the property.
+
+   actual_format_return
+          Returns the actual format of the property.
+
+   bytes_after_return
+          Returns the number of bytes remaining to be read in the
+          property if a partial read was performed.
+
+   data
+          Specifies the property data.
+
+   delete
+          Specifies a Boolean value that determines whether the
+          property is deleted.
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          The device to grab.
+
+   format
+          Specifies whether the data should be viewed as a list of
+          8-bit, 16-bit, or 32-bit quantities. Possible values are
+          8, 16, and 32. This information allows the X server to
+          correctly perform byte-swap operations as necessary. If
+          the format is 16-bit or 32-bit, you must explicitly cast
+          the data pointer to an (unsigned char*) in the call to
+          XChangeDeviceProperty.
+
+   length
+          Specifies the length in 32-bit multiplies of the data to
+          be retrieved.
+
+   mode
+          Specifies the mode of operation. You can pass
+          PropModeReplace, PropModePrepend, or PropModeAppend.
+
+   nelements
+          Specifies the number of elements in data.
+
+   nitems_return
+          Returns the actual number of 8-bit, 16-bit, or 32-bit
+          items stored in the prop_return array.
+
+   num_values
+          Specifies the number of elements in the values list.
+
+   offset
+          Specifies the offset in the specified property (in
+          32-bit quantities) where the data is to be retrieved.
+
+   property
+          Specifies the property to modify or query.
+
+   prop_return
+          Returns the data in the specified format. If the
+          returned format is 8, the returned data is represented
+          as a char array. If the returned format is 16, the
+          returned data is represented as an array of short int
+          type and should be cast to that type to obtain the
+          elements. If the returned format is 32, the property
+          data will be stored as an array of longs (which in a
+          64-bit application will be 64-bit values that are padded
+          in the upper 4 bytes).
+
+   req_type
+          Specifies the atom identifier associated with the
+          property type or AnyPropertyType.
+
+DESCRIPTION
+-----------
+
+The XGetDeviceProperty function returns the actual type of the
+property; the actual format of the property; the number of
+8-bit, 16-bit, or 32-bit items transferred; the number of bytes
+remaining to be read in the property; and a pointer to the data
+actually returned. For a detailed description of this function,
+see the man page to XGetWindowProperty.
+
+The XChangeDeviceProperty function alters the property for the
+specified device and causes the server to generate a
+XPropertyNotifyEvent event on that device. For a detailed
+description of this function, see the man page to
+XChangeProperty.
+
+The XDeleteDeviceProperty function deletes the specified device
+property. Note that a client cannot delete a property created
+by a driver or the server. Attempting to do so will result in a
+BadAtom error.
+
+XGetDeviceProperty can generate a BadAtom, BadDevice error.
+
+XChangeDeviceProperty can generate a BadDevice, a BadMatch, a
+BadAtom, and a BadValue error.
+
+XDeleteDeviceProperty can generate a BadDevice, and a BadAtom
+error.
+
+DIAGNOSIS
+---------
+
+   BadAtom
+          A value does not describe a valid named identifier or
+          the client attempted to remove a driver-allocated
+          property.
+
+   BadDevice
+          An invalid device was specified. The device does not
+          exist.
+
+SEE ALSO
+--------
+
+   XListDeviceProperties(libmansuffix)
diff --git a/man/XGetExtensionVersion.man b/man/XGetExtensionVersion.man
new file mode 100755 (executable)
index 0000000..e1ac87a
--- /dev/null
@@ -0,0 +1,99 @@
+'\" t
+.\"     Title: xgetextensionversion
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XGETEXTENSIONVERSION" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XGetExtensionVersion \- query the version of the input extension\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+XExtensionVersion *XGetExtensionVersion( Display *display,
+                                         char *name);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+name
+       Specifies the extension to be queried\&. The input
+       extension name is definedin the header file XI\&.h\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XGetExtensionVersion request is deprecated and should not
+be used\&. Clients issuing a XgetExtensionVersion request will
+not be able to use MPX features\&. The XGetExtensionVersion
+request queries the version of the input extension, and returns
+an XExtensionVersion structure\&. This structure contains a
+major_version and minor_version number which can be compared
+with constants defined in XI\&.h\&. Support for additional protocol
+requests added to the input extension after its initial release
+is indicated by a version number corresponding to the added
+requests\&. Each version contains all the protocol requests
+contained by previous versions\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+You should use XFree to free the XExtensionVersion structure\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "STRUCTURES"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+This request returns an XExtensionVersion structure\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    int present;
+    short major_version;
+    short minor_version;
+} XExtensionVersion;
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XGetExtensionVersion.txt b/man/XGetExtensionVersion.txt
new file mode 100755 (executable)
index 0000000..3e24fc7
--- /dev/null
@@ -0,0 +1,50 @@
+XGETEXTENSIONVERSION(libmansuffix)
+==================================
+
+NAME
+----
+
+   XGetExtensionVersion - query the version of the input extension.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   XExtensionVersion *XGetExtensionVersion( Display *display,
+                                            char *name);
+
+   display
+          Specifies the connection to the X server.
+
+   name
+          Specifies the extension to be queried. The input
+          extension name is definedin the header file XI.h.
+
+DESCRIPTION
+-----------
+
+   The XGetExtensionVersion request is deprecated and should not
+   be used. Clients issuing a XgetExtensionVersion request will
+   not be able to use MPX features. The XGetExtensionVersion
+   request queries the version of the input extension, and returns
+   an XExtensionVersion structure. This structure contains a
+   major_version and minor_version number which can be compared
+   with constants defined in XI.h. Support for additional protocol
+   requests added to the input extension after its initial release
+   is indicated by a version number corresponding to the added
+   requests. Each version contains all the protocol requests
+   contained by previous versions.
+
+   You should use XFree to free the XExtensionVersion structure.
+
+STRUCTURES
+----------
+
+   This request returns an XExtensionVersion structure.
+
+                typedef struct {
+                    int present;
+                    short major_version;
+                    short minor_version;
+                } XExtensionVersion;
diff --git a/man/XGetFeedbackControl.man b/man/XGetFeedbackControl.man
new file mode 100755 (executable)
index 0000000..e037e6b
--- /dev/null
@@ -0,0 +1,576 @@
+'\" t
+.\"     Title: xgetfeedbackcontrol
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XGETFEEDBACKCONTROL" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XGetFeedbackControl, XChangeFeedbackControl \- query and change input device feedbacks
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+XFeedbackState *XGetFeedbackControl( Display *display,
+                                     XDevice *device,
+                                     int *num_feedbacks);
+.fi
+.sp
+.nf
+int XChangeFeedbackControl( Display *display,
+                            XDevice *device,
+                            Mask mask,
+                            XFeedbackControl *control);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device whose feedbacks are to be queried
+       or modified\&.
+.fi
+.sp
+.nf
+num_feedbacks
+       Specifies an address into which the number of feedbacks
+       supported by thedevice is to be returned\&.
+.fi
+.sp
+.nf
+mask
+       Specifies a mask specific to each type of feedback that
+       describes howthe feedback is to be modified\&.
+.fi
+.sp
+.nf
+control
+       Specifies the address of an XFeedbackControl structure
+       that containsthe new values for the feedback\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+These requests are provided to manipulate those input devices
+that support feedbacks\&. A BadMatch error will be generated if
+the requested device does not support feedbacks\&. Whether or not
+a given device supports feedbacks can be determined by
+examining the information returned by the XOpenDevice request\&.
+For those devices that support feedbacks, XOpenDevice will
+return an XInputClassInfo structure with the input_class field
+equal to the constant FeedbackClass (defined in the file XI\&.h)\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XGetFeedbackControl request returns a pointer to a list of
+XFeedbackState structures\&. Each item in this list describes one
+of the feedbacks supported by the device\&. The items are
+variable length, so each contains its length to allow traversal
+to the next item in the list\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The feedback classes that are currently defined are:
+KbdFeedbackClass, PtrFeedbackClass, StringFeedbackClass,
+IntegerFeedbackClass, LedFeedbackClass, and BellFeedbackClass\&.
+These constants are defined in the file XI\&.h\&. An input device
+may support zero or more classes of feedback, and may support
+multiple feedbacks of the same class\&. Each feedback contains a
+class identifier and an id that is unique within that class for
+that input device\&. The id is used to identify the feedback when
+making an XChangeFeedbackControl request\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XGetFeedbackControl can generate a BadDevice or BadMatch error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XChangeFeedbackControl request modifies the values of one
+feedback on the specified device\&. The feedback is identified by
+the id field of the XFeedbackControl structure that is passed
+with the request\&. The fields of the feedback that are to be
+modified are identified by the bits of the mask that is passed
+with the request\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XChangeFeedbackControl can generate a BadDevice, BadMatch, or
+BadValue error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Structures
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Each class of feedback is described by a structure specific to
+that class\&. These structures are defined in the file XInput\&.h\&.
+XFeedbackState and XFeedbackControl are generic structures that
+contain three fields that are at the beginning of each class of
+feedback:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+XID class;
+int length;
+XID id;
+} XFeedbackState,
+XFeedbackControl;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XKbdFeedbackState structure defines the attributes that are
+returned for feedbacks equivalent to those on the X keyboard\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+XID class;
+int length;
+XID id;
+int click;
+int percent;
+int pitch;
+int duration;
+int led_mask;
+int global_auto_repeat;
+char auto_repeats[32];
+} XKbdFeedbackState;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XPtrFeedbackState structure defines the attributes that are
+returned for feedbacks equivalent to those on the the X
+pointer\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+XID class;
+int length;
+XID id;
+int accelNum;
+int accelDenom;
+int threshold;
+} XPtrFeedbackState;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XIntegerFeedbackState structure defines attributes that are
+returned for integer feedbacks\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+XID class;
+int length;
+XID id;
+int resolution;
+int minVal;
+int maxVal;
+} XIntegerFeedbackState;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XStringFeedbackState structure defines the attributes that
+are returned for string feedbacks\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+XID class;
+int length;
+XID id;
+int max_symbols;
+int num_syms_supported;
+KeySym *syms_supported;
+} XStringFeedbackState;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XBellFeedbackState structure defines the attributes that
+are returned for bell feedbacks\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+XID class;
+int length;
+XID id;
+int percent;
+int pitch;
+int duration;
+} XBellFeedbackState;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XLedFeedbackState structure defines the attributes that are
+returned for LED feedbacks\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct { XID class;
+int length;
+XID id;
+int led_values;
+} XLedFeedbackState;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XPrtFeedbackControl structure defines the attributes that
+can be controlled for pointer feedbacks\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+XID class;
+int length;
+XID id;
+int accelNum;
+int accelDenom;
+int threshold;
+} XPtrFeedbackControl;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XKbdFeedbackControl structure defines the attributes that
+can be controlled for keyboard feedbacks\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+XID class;
+int length;
+XID id;
+int click;
+int percent;
+int pitch;
+int duration;
+int led_mask;
+int led_value;
+int key;
+int auto_repeat_mode;
+} XKbdFeedbackControl;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XStringFeedbackControl structure defines the attributes
+that can be controlled for string feedbacks\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+XID class;
+int length;
+XID id;
+int num_keysyms;
+KeySym  *syms_to_display;
+} XStringFeedbackControl;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XIntegerFeedbackControl structure defines the attributes
+that can be controlled for integer feedbacks\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+XID class;
+int length;
+XID id;
+int int_to_display;
+} XIntegerFeedbackControl;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XBellFeedbackControl structure defines the attributes that
+can be controlled for bell feedbacks\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+XID     class;
+int     length;
+XID     id;
+int     percent;
+int     pitch;
+int     duration;
+} XBellFeedbackControl;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XLedFeedbackControl structure defines the attributes that
+can be controlled for LED feedbacks\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+XID     class;
+int     length;
+XID     id;
+int     led_mask;
+int     led_values;
+} XLedFeedbackControl;
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if some
+       other client has caused the specified device to become
+       the X keyboard or X pointer device via the
+       XChangeKeyboardDevice or XChangePointerDevice requests\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if an XGetFeedbackControl request
+       was made specifying a device that has no feedbacks, or
+       an XChangeFeedbackControl request was made with an
+       XFeedbackControl structure that contains an invalid
+       feedback type\&. It may also occur if an invalid
+       combination of mask bits is specified ( DvKey but no
+       DvAutoRepeatMode for keyboard feedbacks), or if an
+       invalid KeySym is specified for a string feedback\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       Some numeric value falls outside the range of values
+       accepted by the XChangeFeedbackControl request\&. Unless a
+       specific range is specified for an argument, the full
+       range defined by the argument\'s type is accepted\&. Any
+       argument defined as a set of alternatives can generate
+       this error\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XGetFeedbackControl.txt b/man/XGetFeedbackControl.txt
new file mode 100755 (executable)
index 0000000..316f141
--- /dev/null
@@ -0,0 +1,272 @@
+XGETFEEDBACKCONTROL(libmansuffix)
+=================================
+
+NAME
+----
+
+   XGetFeedbackControl, XChangeFeedbackControl - query and change
+   input device feedbacks
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   XFeedbackState *XGetFeedbackControl( Display *display,
+                                        XDevice *device,
+                                        int *num_feedbacks);
+
+   int XChangeFeedbackControl( Display *display,
+                               XDevice *device,
+                               Mask mask,
+                               XFeedbackControl *control);
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device whose feedbacks are to be queried
+          or modified.
+
+   num_feedbacks
+          Specifies an address into which the number of feedbacks
+          supported by thedevice is to be returned.
+
+   mask
+          Specifies a mask specific to each type of feedback that
+          describes howthe feedback is to be modified.
+
+   control
+          Specifies the address of an XFeedbackControl structure
+          that containsthe new values for the feedback.
+
+DESCRIPTION
+-----------
+
+   These requests are provided to manipulate those input devices
+   that support feedbacks. A BadMatch error will be generated if
+   the requested device does not support feedbacks. Whether or not
+   a given device supports feedbacks can be determined by
+   examining the information returned by the XOpenDevice request.
+   For those devices that support feedbacks, XOpenDevice will
+   return an XInputClassInfo structure with the input_class field
+   equal to the constant FeedbackClass (defined in the file XI.h).
+
+   The XGetFeedbackControl request returns a pointer to a list of
+   XFeedbackState structures. Each item in this list describes one
+   of the feedbacks supported by the device. The items are
+   variable length, so each contains its length to allow traversal
+   to the next item in the list.
+
+   The feedback classes that are currently defined are:
+   KbdFeedbackClass, PtrFeedbackClass, StringFeedbackClass,
+   IntegerFeedbackClass, LedFeedbackClass, and BellFeedbackClass.
+   These constants are defined in the file XI.h. An input device
+   may support zero or more classes of feedback, and may support
+   multiple feedbacks of the same class. Each feedback contains a
+   class identifier and an id that is unique within that class for
+   that input device. The id is used to identify the feedback when
+   making an XChangeFeedbackControl request.
+
+   XGetFeedbackControl can generate a BadDevice or BadMatch error.
+
+   The XChangeFeedbackControl request modifies the values of one
+   feedback on the specified device. The feedback is identified by
+   the id field of the XFeedbackControl structure that is passed
+   with the request. The fields of the feedback that are to be
+   modified are identified by the bits of the mask that is passed
+   with the request.
+
+   XChangeFeedbackControl can generate a BadDevice, BadMatch, or
+   BadValue error.
+
+Structures
+
+   Each class of feedback is described by a structure specific to
+   that class. These structures are defined in the file XInput.h.
+   XFeedbackState and XFeedbackControl are generic structures that
+   contain three fields that are at the beginning of each class of
+   feedback:
+
+                typedef struct {
+                XID class;
+                int length;
+                XID id;
+                } XFeedbackState,
+                XFeedbackControl;
+
+   The XKbdFeedbackState structure defines the attributes that are
+   returned for feedbacks equivalent to those on the X keyboard.
+
+                typedef struct {
+                XID class;
+                int length;
+                XID id;
+                int click;
+                int percent;
+                int pitch;
+                int duration;
+                int led_mask;
+                int global_auto_repeat;
+                char auto_repeats[32];
+                } XKbdFeedbackState;
+
+   The XPtrFeedbackState structure defines the attributes that are
+   returned for feedbacks equivalent to those on the the X
+   pointer.
+
+                typedef struct {
+                XID class;
+                int length;
+                XID id;
+                int accelNum;
+                int accelDenom;
+                int threshold;
+                } XPtrFeedbackState;
+
+   The XIntegerFeedbackState structure defines attributes that are
+   returned for integer feedbacks.
+
+                typedef struct {
+                XID class;
+                int length;
+                XID id;
+                int resolution;
+                int minVal;
+                int maxVal;
+                } XIntegerFeedbackState;
+
+   The XStringFeedbackState structure defines the attributes that
+   are returned for string feedbacks.
+
+                typedef struct {
+                XID class;
+                int length;
+                XID id;
+                int max_symbols;
+                int num_syms_supported;
+                KeySym *syms_supported;
+                } XStringFeedbackState;
+
+   The XBellFeedbackState structure defines the attributes that
+   are returned for bell feedbacks.
+
+                typedef struct {
+                XID class;
+                int length;
+                XID id;
+                int percent;
+                int pitch;
+                int duration;
+                } XBellFeedbackState;
+
+   The XLedFeedbackState structure defines the attributes that are
+   returned for LED feedbacks.
+
+                typedef struct { XID class;
+                int length;
+                XID id;
+                int led_values;
+                } XLedFeedbackState;
+
+   The XPrtFeedbackControl structure defines the attributes that
+   can be controlled for pointer feedbacks.
+
+                typedef struct {
+                XID class;
+                int length;
+                XID id;
+                int accelNum;
+                int accelDenom;
+                int threshold;
+                } XPtrFeedbackControl;
+
+   The XKbdFeedbackControl structure defines the attributes that
+   can be controlled for keyboard feedbacks.
+
+                typedef struct {
+                XID class;
+                int length;
+                XID id;
+                int click;
+                int percent;
+                int pitch;
+                int duration;
+                int led_mask;
+                int led_value;
+                int key;
+                int auto_repeat_mode;
+                } XKbdFeedbackControl;
+
+   The XStringFeedbackControl structure defines the attributes
+   that can be controlled for string feedbacks.
+
+                typedef struct {
+                XID class;
+                int length;
+                XID id;
+                int num_keysyms;
+                KeySym  *syms_to_display;
+                } XStringFeedbackControl;
+
+   The XIntegerFeedbackControl structure defines the attributes
+   that can be controlled for integer feedbacks.
+
+                typedef struct {
+                XID class;
+                int length;
+                XID id;
+                int int_to_display;
+                } XIntegerFeedbackControl;
+
+   The XBellFeedbackControl structure defines the attributes that
+   can be controlled for bell feedbacks.
+
+                typedef struct {
+                XID     class;
+                int     length;
+                XID     id;
+                int     percent;
+                int     pitch;
+                int     duration;
+                } XBellFeedbackControl;
+
+   The XLedFeedbackControl structure defines the attributes that
+   can be controlled for LED feedbacks.
+
+                typedef struct {
+                XID     class;
+                int     length;
+                XID     id;
+                int     led_mask;
+                int     led_values;
+                } XLedFeedbackControl;
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if some
+          other client has caused the specified device to become
+          the X keyboard or X pointer device via the
+          XChangeKeyboardDevice or XChangePointerDevice requests.
+
+   BadMatch
+          This error may occur if an XGetFeedbackControl request
+          was made specifying a device that has no feedbacks, or
+          an XChangeFeedbackControl request was made with an
+          XFeedbackControl structure that contains an invalid
+          feedback type. It may also occur if an invalid
+          combination of mask bits is specified ( DvKey but no
+          DvAutoRepeatMode for keyboard feedbacks), or if an
+          invalid KeySym is specified for a string feedback.
+
+   BadValue
+          Some numeric value falls outside the range of values
+          accepted by the XChangeFeedbackControl request. Unless a
+          specific range is specified for an argument, the full
+          range defined by the argument's type is accepted. Any
+          argument defined as a set of alternatives can generate
+          this error.
diff --git a/man/XGetSelectedExtensionEvents.man b/man/XGetSelectedExtensionEvents.man
new file mode 100755 (executable)
index 0000000..4adbaa6
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XSelectExtensionEvent.libmansuffix
diff --git a/man/XGrabDevice.man b/man/XGrabDevice.man
new file mode 100755 (executable)
index 0000000..135684d
--- /dev/null
@@ -0,0 +1,285 @@
+'\" t
+.\"     Title: xgrabdevice
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XGRABDEVICE" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XGrabDevice, XUngrabDevice \- grab/release the specified extension device
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+int XGrabDevice( Display *display,
+                 XDevice* device,
+                 Window grab_window,
+                 Bool owner_events,
+                 int event_count,
+                 XEventClass *event_list,
+                 int this_device_mode,
+                 int other_devices_mode,
+                 Time time);
+.fi
+.sp
+.nf
+int XUngrabDevice( Display *display,
+                   XDevice *device,
+                   Time time);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device to be grabbed or released\&.
+.fi
+.sp
+.nf
+grab_window
+       Specifies the id of a window to be associated with the
+       device\&.
+.fi
+.sp
+.nf
+owner_events
+       Specifies a Boolean value that indicates whether
+       theevents from the deviceare to be reported as usual or
+       reported with respect to the grab windowif selected by
+       the event list\&.
+.fi
+.sp
+.nf
+event_count
+       Specifies the number of elements in the event_list
+       array\&.
+.fi
+.sp
+.nf
+event_list
+       Specifies a pointer to a list of event classes that
+       indicates which eventsthe client wishes to receive\&.
+       These event classes must have beenobtained specifying
+       the device being grabbed\&.
+.fi
+.sp
+.nf
+this_device_mode
+       Specifies further processing of events from this
+       device\&.You can pass GrabModeSyncor GrabModeAsync\&.
+.fi
+.sp
+.nf
+other_devices_mode
+       Specifies further processing of events from other
+       devices\&.You can pass GrabModeSyncor GrabModeAsync\&.
+.fi
+.sp
+.nf
+time
+       Specifies the time\&.You can pass either a timestamp or
+       CurrentTime\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XGrabDevice request actively grabs control of the device
+and generates DeviceFocusIn and DeviceFocusOut events\&. Further
+device events are reported only to the grabbing
+client\&.XGrabDevice overrides any active device grab by this
+client\&. event_list is a pointer to a list of event classes\&.
+This list indicates which events the client wishes to receive
+while the grab is active\&. If owner_events is False, all
+generated device events are reported with respect to
+grab_window if selected\&. If owner_events is True and if a
+generated device event would normally be reported to this
+client, it is reported normally; otherwise, the event is
+reported with respect to the grab_window, and is only reported
+if specified in the event_list\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the this_device_mode argument is GrabModeAsync, device event
+processing continues as usual\&. If the device is currently
+frozen by this client, then processing of device events is
+resumed\&. If the this_device_mode argument is GrabModeSync, the
+state of the device (as seen by client applications) appears to
+freeze, and the X server generates no further device events
+until the grabbing client issues a releasing XAllowDeviceEvents
+call or until the device grab is released\&. Actual device
+changes are not lost while the device is frozen; they are
+simply queued in the server for later processing\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If other_devices_mode is GrabModeAsync, processing of events
+from other devices is unaffected by activation of the grab\&. If
+other_devices_mode is GrabModeSync, the state of all devices
+except the grabbed device (as seen by client applications)
+appears to freeze, and the X server generates no further events
+from those devices until the grabbing client issues a releasing
+XAllowDeviceEvents call or until the device grab is released\&.
+Actual events are not lost while the devices are frozen; they
+are simply queued in the server for later processing\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the device is actively grabbed by some other client,
+XGrabDevice fails and returns AlreadyGrabbed\&. If grab_window is
+not viewable, it fails and returns GrabNotViewable\&. If the
+device is frozen by an active grab of another client, it fails
+and returns GrabFrozen\&. If the specified time is earlier than
+the last\-device\-grab time or later than the current X server
+time, it fails and returns GrabInvalidTime\&. Otherwise, the
+last\-device\-grab time is set to the specified time (
+CurrentTime is replaced by the current X server time)\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If a grabbed device is closed by a client while an active grab
+by that client is in effect, the active grab is released\&. If
+the device is frozen only by an active grab of the requesting
+client, it is thawed\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XGrabDevice can generate BadClass, BadDevice, BadValue, and
+BadWindow errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XUngrabDevice request releases the device and any queued
+events if this client has it actively grabbed from either
+XGrabDevice or XGrabDeviceKey\&. If other devices are frozen by
+the grab, XUngrabDevice thaws them\&.XUngrabDevice does not
+release the device and any queued events if the specified time
+is earlier than the last\-device\-grab time or is later than the
+current X server time\&. It also generates DeviceFocusIn and
+DeviceFocusOut events\&. The X server automatically performs an
+UngrabDevice request if the event window for an active device
+grab becomes not viewable\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XUngrabDevice can generate a BadDevice error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if the
+       specified device is the X keyboard or X pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       Some numeric value falls outside the range of values
+       accepted by the request\&. Unless a specific range is
+       specified for an argument, the full range defined by the
+       argument\'s type is accepted\&. Any argument defined as a
+       set of alternatives can generate this error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       Window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XAllowDeviceEvents(libmansuffix), XGrabDeviceButton(libmansuffix), XGrabDeviceKey(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XGrabDevice.txt b/man/XGrabDevice.txt
new file mode 100755 (executable)
index 0000000..443e6ac
--- /dev/null
@@ -0,0 +1,159 @@
+XGRABDEVICE(libmansuffix)
+=========================
+
+NAME
+----
+
+   XGrabDevice, XUngrabDevice - grab/release the specified
+   extension device
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   int XGrabDevice( Display *display,
+                    XDevice* device,
+                    Window grab_window,
+                    Bool owner_events,
+                    int event_count,
+                    XEventClass *event_list,
+                    int this_device_mode,
+                    int other_devices_mode,
+                    Time time);
+
+   int XUngrabDevice( Display *display,
+                      XDevice *device,
+                      Time time);
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device to be grabbed or released.
+
+   grab_window
+          Specifies the id of a window to be associated with the
+          device.
+
+   owner_events
+          Specifies a Boolean value that indicates whether
+          theevents from the deviceare to be reported as usual or
+          reported with respect to the grab windowif selected by
+          the event list.
+
+   event_count
+          Specifies the number of elements in the event_list
+          array.
+
+   event_list
+          Specifies a pointer to a list of event classes that
+          indicates which eventsthe client wishes to receive.
+          These event classes must have beenobtained specifying
+          the device being grabbed.
+
+   this_device_mode
+          Specifies further processing of events from this
+          device.You can pass GrabModeSyncor GrabModeAsync.
+
+   other_devices_mode
+          Specifies further processing of events from other
+          devices.You can pass GrabModeSyncor GrabModeAsync.
+
+   time
+          Specifies the time.You can pass either a timestamp or
+          CurrentTime.
+
+DESCRIPTION
+-----------
+
+   The XGrabDevice request actively grabs control of the device
+   and generates DeviceFocusIn and DeviceFocusOut events. Further
+   device events are reported only to the grabbing
+   client.XGrabDevice overrides any active device grab by this
+   client. event_list is a pointer to a list of event classes.
+   This list indicates which events the client wishes to receive
+   while the grab is active. If owner_events is False, all
+   generated device events are reported with respect to
+   grab_window if selected. If owner_events is True and if a
+   generated device event would normally be reported to this
+   client, it is reported normally; otherwise, the event is
+   reported with respect to the grab_window, and is only reported
+   if specified in the event_list.
+
+   If the this_device_mode argument is GrabModeAsync, device event
+   processing continues as usual. If the device is currently
+   frozen by this client, then processing of device events is
+   resumed. If the this_device_mode argument is GrabModeSync, the
+   state of the device (as seen by client applications) appears to
+   freeze, and the X server generates no further device events
+   until the grabbing client issues a releasing XAllowDeviceEvents
+   call or until the device grab is released. Actual device
+   changes are not lost while the device is frozen; they are
+   simply queued in the server for later processing.
+
+   If other_devices_mode is GrabModeAsync, processing of events
+   from other devices is unaffected by activation of the grab. If
+   other_devices_mode is GrabModeSync, the state of all devices
+   except the grabbed device (as seen by client applications)
+   appears to freeze, and the X server generates no further events
+   from those devices until the grabbing client issues a releasing
+   XAllowDeviceEvents call or until the device grab is released.
+   Actual events are not lost while the devices are frozen; they
+   are simply queued in the server for later processing.
+
+   If the device is actively grabbed by some other client,
+   XGrabDevice fails and returns AlreadyGrabbed. If grab_window is
+   not viewable, it fails and returns GrabNotViewable. If the
+   device is frozen by an active grab of another client, it fails
+   and returns GrabFrozen. If the specified time is earlier than
+   the last-device-grab time or later than the current X server
+   time, it fails and returns GrabInvalidTime. Otherwise, the
+   last-device-grab time is set to the specified time (
+   CurrentTime is replaced by the current X server time).
+
+   If a grabbed device is closed by a client while an active grab
+   by that client is in effect, the active grab is released. If
+   the device is frozen only by an active grab of the requesting
+   client, it is thawed.
+
+   XGrabDevice can generate BadClass, BadDevice, BadValue, and
+   BadWindow errors.
+
+   The XUngrabDevice request releases the device and any queued
+   events if this client has it actively grabbed from either
+   XGrabDevice or XGrabDeviceKey. If other devices are frozen by
+   the grab, XUngrabDevice thaws them.XUngrabDevice does not
+   release the device and any queued events if the specified time
+   is earlier than the last-device-grab time or is later than the
+   current X server time. It also generates DeviceFocusIn and
+   DeviceFocusOut events. The X server automatically performs an
+   UngrabDevice request if the event window for an active device
+   grab becomes not viewable.
+
+   XUngrabDevice can generate a BadDevice error.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if the
+          specified device is the X keyboard or X pointer device.
+
+   BadValue
+          Some numeric value falls outside the range of values
+          accepted by the request. Unless a specific range is
+          specified for an argument, the full range defined by the
+          argument's type is accepted. Any argument defined as a
+          set of alternatives can generate this error.
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          Window.
+
+SEE ALSO
+--------
+
+   XAllowDeviceEvents(libmansuffix), XGrabDeviceButton(libmansuffix), XGrabDeviceKey(libmansuffix)
diff --git a/man/XGrabDeviceButton.man b/man/XGrabDeviceButton.man
new file mode 100755 (executable)
index 0000000..30b7ffb
--- /dev/null
@@ -0,0 +1,316 @@
+'\" t
+.\"     Title: xgrabdevicebutton
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XGRABDEVICEBUTTON" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XGrabDeviceButton, XUngrabDeviceButton \- grab/ungrab extension input device buttons
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+int XGrabDeviceButton( Display *display,
+                       XDevice *device,
+                       unsigned int button,
+                       unsigned int modifiers,
+                       XDevice* modifier_device,
+                       Window grab_window,
+                       Bool owner_events,
+                       unsigned int event_count,
+                       XEventClass *event_list,
+                       int this_device_mode,
+                       int other_devices_mode);
+.fi
+.sp
+.nf
+int XUngrabDeviceButton( Display *display,
+                         XDevice *device,
+                         unsigned int button,
+                         unsigned int modifiers,
+                         XDevice* modifier_device,
+                         Window grab_window);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device that is to be grabbed or released
+.fi
+.sp
+.nf
+button
+       Specifies the device button that is to be grabbed or
+       released or AnyButton\&.
+.fi
+.sp
+.nf
+modifiers
+       Specifies the set of keymasks or AnyModifier\&.The mask is
+       the bitwise inclusive OR of the valid keymask bits\&.
+       Valid bits are: Shiftmask, LockMask, ControlMask,
+       Mod1Mask, Mod2Mask,Mod3Mask, Mod4Mask, Mod5Mask\&.
+.fi
+.sp
+.nf
+modifier_device
+       specifies the device whose modifiers are to be used\&. If
+       the modifier_devicespecified is NULL, the X keyboard
+       will be used as the modifier_device\&.
+.fi
+.sp
+.nf
+grab_window
+       Specifies the grab window\&.
+.fi
+.sp
+.nf
+owner_events
+       Specifies a Boolean value that indicates whether the
+       deviceevents are to be reported as usual or reported
+       with respect to the grab windowif selected by the event
+       list\&.
+.fi
+.sp
+.nf
+event_count
+       Specifies the number of event classes in the event list\&.
+.fi
+.sp
+.nf
+event_list
+       Specifies which events are reported to the client\&.
+.fi
+.sp
+.nf
+this_device_mode
+       Specifies further processing of events from this
+       device\&.You can pass GrabModeSync or GrabModeAsync\&.
+.fi
+.sp
+.nf
+other_devices_mode
+       Specifies further processing of events from all other
+       devices\&.You can pass GrabModeSync or GrabModeAsync\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XGrabDeviceButton request establishes a passive grab\&. In
+the future, the device is actively grabbed (as for XGrabDevice,
+the last\-grab time is set to the time at which the button was
+pressed (as transmitted in the DeviceButtonPress event), and
+the DeviceButtonPress event is reported if all of the following
+conditions are true:
+  * The device is not grabbed, and the specified button is
+    logically pressed when the specified modifier keys are
+    logically down on the specified modifier device and no
+    other buttons or modifier keys are logically down\&.
+  * Either the grab window is an ancestor of (or is) the focus
+    window, OR the grab window is a descendent of the focus
+    window and contains the device\&.
+  * A passive grab on the same button/modifier combination does
+    not exist on any ancestor of grab_window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The interpretation of the remaining arguments is as for
+XGrabDevice\&. The active grab is terminated automatically when
+the logical state of the device has all buttons released
+(independent of the logical state of the modifier keys)\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Note that the logical state of a device (as seen by client
+applications) may lag the physical state if device event
+processing is frozen\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+This request overrides all previous grabs by the same client on
+the same button/modifier combinations on the same window\&. A
+modifiers of AnyModifier is equivalent to issuing the grab
+request for all possible modifier combinations (including the
+combination of no modifiers)\&. It is not required that all
+modifiers specified have currently assigned KeyCodes\&. A button
+of AnyButton is equivalent to issuing the request for all
+possible buttons\&. Otherwise, it is not required that the
+specified button currently be assigned to a physical button\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+A modifier_device of NULL indicates that the X keyboard is to
+be used as the modifier_device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If some other client has already issued a XGrabDeviceButton
+with the same button/modifier combination on the same window, a
+BadAccess error results\&. When using AnyModifier or AnyButton ,
+the request fails completely, and a BadAccess error results (no
+grabs are established) if there is a conflicting grab for any
+combination\&. XGrabDeviceButton has no effect on an active grab\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XGrabDeviceButton can generate BadClass, BadDevice, BadMatch,
+BadValue, and BadWindow errors\&.\&.P The XUngrabDeviceButton
+request releases the passive grab for a button/modifier
+combination on the specified window if it was grabbed by this
+client\&. A modifier of AnyModifier is equivalent to issuing the
+ungrab request for all possible modifier combinations,
+including the combination of no modifiers\&. A button of
+AnyButton is equivalent to issuing the request for all possible
+buttons\&. XUngrabDeviceButton has no effect on an active grab\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+A modifier_device of NULL indicates that the X keyboard should
+be used as the modifier_device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XUngrabDeviceButton can generate BadDevice, BadMatch, BadValue
+and BadWindow errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if the
+       specified device is the X keyboard or X pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if an XGrabDeviceButton request was
+       made specifying a device that has no buttons, or
+       specifying a modifier device that has no keys\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       Some numeric value falls outside the range of values
+       accepted by the request\&. Unless a specific range is
+       specified for an argument, the full range defined by the
+       argument\'s type is accepted\&. Any argument defined as a
+       set of alternatives can generate this error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       Window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XAllowDeviceEvents(libmansuffix), XGrabDevice(libmansuffix), XGrabDeviceKey(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XGrabDeviceButton.txt b/man/XGrabDeviceButton.txt
new file mode 100755 (executable)
index 0000000..aae0245
--- /dev/null
@@ -0,0 +1,170 @@
+XGRABDEVICEBUTTON(libmansuffix)
+===============================
+
+NAME
+----
+
+   XGrabDeviceButton, XUngrabDeviceButton - grab/ungrab extension
+   input device buttons
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   int XGrabDeviceButton( Display *display,
+                          XDevice *device,
+                          unsigned int button,
+                          unsigned int modifiers,
+                          XDevice* modifier_device,
+                          Window grab_window,
+                          Bool owner_events,
+                          unsigned int event_count,
+                          XEventClass *event_list,
+                          int this_device_mode,
+                          int other_devices_mode);
+
+   int XUngrabDeviceButton( Display *display,
+                            XDevice *device,
+                            unsigned int button,
+                            unsigned int modifiers,
+                            XDevice* modifier_device,
+                            Window grab_window);
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device that is to be grabbed or released
+
+   button
+          Specifies the device button that is to be grabbed or
+          released or AnyButton.
+
+   modifiers
+          Specifies the set of keymasks or AnyModifier.The mask is
+          the bitwise inclusive OR of the valid keymask bits.
+          Valid bits are: Shiftmask, LockMask, ControlMask,
+          Mod1Mask, Mod2Mask,Mod3Mask, Mod4Mask, Mod5Mask.
+
+   modifier_device
+          specifies the device whose modifiers are to be used. If
+          the modifier_devicespecified is NULL, the X keyboard
+          will be used as the modifier_device.
+
+   grab_window
+          Specifies the grab window.
+
+   owner_events
+          Specifies a Boolean value that indicates whether the
+          deviceevents are to be reported as usual or reported
+          with respect to the grab windowif selected by the event
+          list.
+
+   event_count
+          Specifies the number of event classes in the event list.
+
+   event_list
+          Specifies which events are reported to the client.
+
+   this_device_mode
+          Specifies further processing of events from this
+          device.You can pass GrabModeSync or GrabModeAsync.
+
+   other_devices_mode
+          Specifies further processing of events from all other
+          devices.You can pass GrabModeSync or GrabModeAsync.
+
+DESCRIPTION
+-----------
+
+   The XGrabDeviceButton request establishes a passive grab. In
+   the future, the device is actively grabbed (as for XGrabDevice,
+   the last-grab time is set to the time at which the button was
+   pressed (as transmitted in the DeviceButtonPress event), and
+   the DeviceButtonPress event is reported if all of the following
+   conditions are true:
+     * The device is not grabbed, and the specified button is
+       logically pressed when the specified modifier keys are
+       logically down on the specified modifier device and no
+       other buttons or modifier keys are logically down.
+     * Either the grab window is an ancestor of (or is) the focus
+       window, OR the grab window is a descendent of the focus
+       window and contains the device.
+     * A passive grab on the same button/modifier combination does
+       not exist on any ancestor of grab_window.
+
+   The interpretation of the remaining arguments is as for
+   XGrabDevice. The active grab is terminated automatically when
+   the logical state of the device has all buttons released
+   (independent of the logical state of the modifier keys).
+
+   Note that the logical state of a device (as seen by client
+   applications) may lag the physical state if device event
+   processing is frozen.
+
+   This request overrides all previous grabs by the same client on
+   the same button/modifier combinations on the same window. A
+   modifiers of AnyModifier is equivalent to issuing the grab
+   request for all possible modifier combinations (including the
+   combination of no modifiers). It is not required that all
+   modifiers specified have currently assigned KeyCodes. A button
+   of AnyButton is equivalent to issuing the request for all
+   possible buttons. Otherwise, it is not required that the
+   specified button currently be assigned to a physical button.
+
+   A modifier_device of NULL indicates that the X keyboard is to
+   be used as the modifier_device.
+
+   If some other client has already issued a XGrabDeviceButton
+   with the same button/modifier combination on the same window, a
+   BadAccess error results. When using AnyModifier or AnyButton ,
+   the request fails completely, and a BadAccess error results (no
+   grabs are established) if there is a conflicting grab for any
+   combination. XGrabDeviceButton has no effect on an active grab.
+
+   XGrabDeviceButton can generate BadClass, BadDevice, BadMatch,
+   BadValue, and BadWindow errors..P The XUngrabDeviceButton
+   request releases the passive grab for a button/modifier
+   combination on the specified window if it was grabbed by this
+   client. A modifier of AnyModifier is equivalent to issuing the
+   ungrab request for all possible modifier combinations,
+   including the combination of no modifiers. A button of
+   AnyButton is equivalent to issuing the request for all possible
+   buttons. XUngrabDeviceButton has no effect on an active grab.
+
+   A modifier_device of NULL indicates that the X keyboard should
+   be used as the modifier_device.
+
+   XUngrabDeviceButton can generate BadDevice, BadMatch, BadValue
+   and BadWindow errors.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if the
+          specified device is the X keyboard or X pointer device.
+
+   BadMatch
+          This error may occur if an XGrabDeviceButton request was
+          made specifying a device that has no buttons, or
+          specifying a modifier device that has no keys.
+
+   BadValue
+          Some numeric value falls outside the range of values
+          accepted by the request. Unless a specific range is
+          specified for an argument, the full range defined by the
+          argument's type is accepted. Any argument defined as a
+          set of alternatives can generate this error.
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          Window.
+
+SEE ALSO
+--------
+
+   XAllowDeviceEvents(libmansuffix), XGrabDevice(libmansuffix), XGrabDeviceKey(libmansuffix)
diff --git a/man/XGrabDeviceKey.man b/man/XGrabDeviceKey.man
new file mode 100755 (executable)
index 0000000..113f8e8
--- /dev/null
@@ -0,0 +1,339 @@
+'\" t
+.\"     Title: xgrabdevicekey
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XGRABDEVICEKEY" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XGrabDeviceKey, XUngrabDeviceKey \- grab/ungrab extension input device Keys
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+int XGrabDeviceKey( Display *display,
+                    XDevice *device,
+                    unsigned int key,
+                    unsigned int modifiers,
+                    XDevice *modifier_device,
+                    Window grab_window,
+                    Bool owner_events,
+                    unsigned int event_count,
+                    XEventClass *event_list,
+                    int this_device_mode,
+                    int other_devices_mode);
+.fi
+.sp
+.nf
+int XUngrabDeviceKey( Display *display,
+                      XDevice *device,
+                      unsigned int key,
+                      unsigned int modifiers,
+                      XDevice *modifier_device,
+                      Window grab_window);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device that is to be grabbed or released\&.
+.fi
+.sp
+.nf
+Key
+       Specifies the device Key that is to be grabbed released
+       or AnyKey\&.
+.fi
+.sp
+.nf
+modifiers
+       Specifies the set of keymasks or AnyModifier\&.The mask is
+       the bitwise inclusive OR of the valid keymask bits\&.Valid
+       bits are: ShiftMask, LockMask, ControlMask, Mod1Mask,
+       Mod2Mask,Mod3Mask, Mod4Mask, Mod5Mask\&.
+.fi
+.sp
+.nf
+modifier_device
+       Specifies the device whose modifiers are to be used\&. If
+       a modifier_device ofNULL is specified, the X keyboard
+       will be used as the modifier_device\&.
+.fi
+.sp
+.nf
+grab_window
+       Specifies the grab window\&.
+.fi
+.sp
+.nf
+owner_events
+       Specifies a Boolean value that indicates whether the
+       deviceevents are to be reported as usual or reported
+       with respect to the grab windowif selected by the event
+       list\&.
+.fi
+.sp
+.nf
+event_count
+       Specifies the number of event classes in the event list\&.
+.fi
+.sp
+.nf
+event_list
+       Specifies which device events are reported to the
+       client\&.
+.fi
+.sp
+.nf
+this_device_mode
+       Specifies further processing of events from this
+       device\&.You can pass GrabModeSync or GrabModeAsync\&.
+.fi
+.sp
+.nf
+other_devices_mode
+       Specifies further processing of events from other
+       devices\&.You can pass GrabModeSyncor GrabModeAsync\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XGrabDeviceKey request establishes a passive grab\&. In the
+future, the device is actively grabbed (as for XGrabDevice, the
+last\-device\-grab time is set to the time at which the Key was
+pressed (as transmitted in the DeviceKeyPress event), and the
+DeviceKeyPress event is reported if all of the following
+conditions are true:
+  * The device is not grabbed, and the specified key is
+    logically pressed when the specified modifier keys are
+    logically down, and no other keys or modifier keys are
+    logically down\&.
+  * The grab_window is an ancestor (or is) the focus window OR
+    the grab window is a descendant of the focus window and
+    contains the device\&.
+  * The confine_to window (if any) is viewable\&.
+  * A passive grab on the same key/modifier combination does
+    not exist on any ancestor of grab_window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The interpretation of the remaining arguments is as for
+XGrabDevice\&. The active grab is terminated automatically when
+the logical state of the device has the specified key released\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Note that the logical state of a device (as seen by means of
+the X protocol ) may lag the physical state if device event
+processing is frozen\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the key is not AnyKey, it must be in the range specified by
+min_keycode and max_keycode as returned by the
+XListInputDevices request\&. Otherwise, a BadValue error results\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+This request overrides all previous grabs by the same client on
+the same Key/modifier combinations on the same window\&. A
+modifier of AnyModifier is equivalent to issuing the grab
+request for all possible modifier combinations (including the
+combination of no modifiers)\&. It is not required that all
+modifiers specified have currently assigned KeyCodes\&. A key of
+AnyKey is equivalent to issuing the request for all possible
+keys\&. Otherwise, it is not required that the specified key
+currently be assigned to a physical Key\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If a modifier_device of NULL is specified, the X keyboard will
+be used as the modifier_device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If some other client has already issued a XGrabDeviceKey with
+the same Key/modifier combination on the same window, a
+BadAccess error results\&. When using AnyModifier or AnyKey, the
+request fails completely, and a BadAccess error results (no
+grabs are established) if there is a conflicting grab for any
+combination\&.XGrabDeviceKey has no effect on an active grab\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XGrabDeviceKey can generate BadAccess, BadClass, BadDevice,
+BadMatch, BadValue, and BadWindow errors\&. It returns Success on
+successful completion of the request\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XUngrabDeviceKey request releases the passive grab for a
+key/modifier combination on the specified window if it was
+grabbed by this client\&. A modifier of AnyModifier is equivalent
+to issuing the ungrab request for all possible modifier
+combinations, including the combination of no modifiers\&. A Key
+of AnyKey is equivalent to issuing the request for all possible
+Keys\&.XUngrabDeviceKey has no effect on an active grab\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If a modifier_device of NULL is specified, the X keyboard will
+be used as the modifier_device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XUngrabDeviceKey can generate BadDevice, BadMatch, BadValue and
+BadWindow errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if the
+       specified device is the X keyboard or X pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if an XGrabDeviceKey request was
+       made specifying a device that has no keys, or a modifier
+       device that has no keys\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       Some numeric value falls outside the range of values
+       accepted by the request\&. Unless a specific range is
+       specified for an argument, the full range defined by the
+       argument\'s type is accepted\&. Any argument defined as a
+       set of alternatives can generate this error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       Window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XAllowDeviceEvents(libmansuffix), XGrabDevice(libmansuffix), XGrabDeviceButton(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XGrabDeviceKey.txt b/man/XGrabDeviceKey.txt
new file mode 100755 (executable)
index 0000000..bee4c47
--- /dev/null
@@ -0,0 +1,177 @@
+XGRABDEVICEKEY(libmansuffix)
+============================
+
+NAME
+----
+
+   XGrabDeviceKey, XUngrabDeviceKey - grab/ungrab extension input
+   device Keys
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   int XGrabDeviceKey( Display *display,
+                       XDevice *device,
+                       unsigned int key,
+                       unsigned int modifiers,
+                       XDevice *modifier_device,
+                       Window grab_window,
+                       Bool owner_events,
+                       unsigned int event_count,
+                       XEventClass *event_list,
+                       int this_device_mode,
+                       int other_devices_mode);
+
+   int XUngrabDeviceKey( Display *display,
+                         XDevice *device,
+                         unsigned int key,
+                         unsigned int modifiers,
+                         XDevice *modifier_device,
+                         Window grab_window);
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device that is to be grabbed or released.
+
+   Key
+          Specifies the device Key that is to be grabbed released
+          or AnyKey.
+
+   modifiers
+          Specifies the set of keymasks or AnyModifier.The mask is
+          the bitwise inclusive OR of the valid keymask bits.Valid
+          bits are: ShiftMask, LockMask, ControlMask, Mod1Mask,
+          Mod2Mask,Mod3Mask, Mod4Mask, Mod5Mask.
+
+   modifier_device
+          Specifies the device whose modifiers are to be used. If
+          a modifier_device ofNULL is specified, the X keyboard
+          will be used as the modifier_device.
+
+   grab_window
+          Specifies the grab window.
+
+   owner_events
+          Specifies a Boolean value that indicates whether the
+          deviceevents are to be reported as usual or reported
+          with respect to the grab windowif selected by the event
+          list.
+
+   event_count
+          Specifies the number of event classes in the event list.
+
+   event_list
+          Specifies which device events are reported to the
+          client.
+
+   this_device_mode
+          Specifies further processing of events from this
+          device.You can pass GrabModeSync or GrabModeAsync.
+
+   other_devices_mode
+          Specifies further processing of events from other
+          devices.You can pass GrabModeSyncor GrabModeAsync.
+
+DESCRIPTION
+-----------
+
+   The XGrabDeviceKey request establishes a passive grab. In the
+   future, the device is actively grabbed (as for XGrabDevice, the
+   last-device-grab time is set to the time at which the Key was
+   pressed (as transmitted in the DeviceKeyPress event), and the
+   DeviceKeyPress event is reported if all of the following
+   conditions are true:
+     * The device is not grabbed, and the specified key is
+       logically pressed when the specified modifier keys are
+       logically down, and no other keys or modifier keys are
+       logically down.
+     * The grab_window is an ancestor (or is) the focus window OR
+       the grab window is a descendant of the focus window and
+       contains the device.
+     * The confine_to window (if any) is viewable.
+     * A passive grab on the same key/modifier combination does
+       not exist on any ancestor of grab_window.
+
+   The interpretation of the remaining arguments is as for
+   XGrabDevice. The active grab is terminated automatically when
+   the logical state of the device has the specified key released.
+
+   Note that the logical state of a device (as seen by means of
+   the X protocol ) may lag the physical state if device event
+   processing is frozen.
+
+   If the key is not AnyKey, it must be in the range specified by
+   min_keycode and max_keycode as returned by the
+   XListInputDevices request. Otherwise, a BadValue error results.
+
+   This request overrides all previous grabs by the same client on
+   the same Key/modifier combinations on the same window. A
+   modifier of AnyModifier is equivalent to issuing the grab
+   request for all possible modifier combinations (including the
+   combination of no modifiers). It is not required that all
+   modifiers specified have currently assigned KeyCodes. A key of
+   AnyKey is equivalent to issuing the request for all possible
+   keys. Otherwise, it is not required that the specified key
+   currently be assigned to a physical Key.
+
+   If a modifier_device of NULL is specified, the X keyboard will
+   be used as the modifier_device.
+
+   If some other client has already issued a XGrabDeviceKey with
+   the same Key/modifier combination on the same window, a
+   BadAccess error results. When using AnyModifier or AnyKey, the
+   request fails completely, and a BadAccess error results (no
+   grabs are established) if there is a conflicting grab for any
+   combination.XGrabDeviceKey has no effect on an active grab.
+
+   XGrabDeviceKey can generate BadAccess, BadClass, BadDevice,
+   BadMatch, BadValue, and BadWindow errors. It returns Success on
+   successful completion of the request.
+
+   The XUngrabDeviceKey request releases the passive grab for a
+   key/modifier combination on the specified window if it was
+   grabbed by this client. A modifier of AnyModifier is equivalent
+   to issuing the ungrab request for all possible modifier
+   combinations, including the combination of no modifiers. A Key
+   of AnyKey is equivalent to issuing the request for all possible
+   Keys.XUngrabDeviceKey has no effect on an active grab.
+
+   If a modifier_device of NULL is specified, the X keyboard will
+   be used as the modifier_device.
+
+   XUngrabDeviceKey can generate BadDevice, BadMatch, BadValue and
+   BadWindow errors.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if the
+          specified device is the X keyboard or X pointer device.
+
+   BadMatch
+          This error may occur if an XGrabDeviceKey request was
+          made specifying a device that has no keys, or a modifier
+          device that has no keys.
+
+   BadValue
+          Some numeric value falls outside the range of values
+          accepted by the request. Unless a specific range is
+          specified for an argument, the full range defined by the
+          argument's type is accepted. Any argument defined as a
+          set of alternatives can generate this error.
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          Window.
+
+SEE ALSO
+--------
+
+   XAllowDeviceEvents(libmansuffix), XGrabDevice(libmansuffix), XGrabDeviceButton(libmansuffix)
diff --git a/man/XIChangeHierarchy.man b/man/XIChangeHierarchy.man
new file mode 100755 (executable)
index 0000000..7722037
--- /dev/null
@@ -0,0 +1,289 @@
+'\" t
+.\"     Title: xichangehierarchy
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XICHANGEHIERARCHY" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XIChangeHierarchy \- change the device hierarchy\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput2\&.h>
+.fi
+.sp
+.nf
+Status XIChangeHierarchy( Display *display,
+                          XIAnyHierarchyChangeInfo *changes,
+                          int num_changes);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+num_changes
+       Specifies the number of elements in changes\&.
+.fi
+.sp
+.nf
+changes
+       Specifies the changes to be made\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIChangeHierarchy modifies the device hierarchy by creating or
+removing master devices or changing the attachment of slave
+devices\&. If num_changes is non\-zero, changes is an array of
+XIAnyHierarchyChangeInfo structures\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIChangeHierarchy processes changes in order, effective
+immediately\&. If an error occurs, processing is aborted and the
+error is reported to the client\&. Changes already made remain
+effective\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The list of changes is any combination of
+XIAnyHierarchyChangeInfo\&. The type of a hierarchy change can be
+XIAddMaster, XIRemoveMaster, XIAttachSlave or XIDetachSlave\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef union {
+    int type;
+    XIAddMasterInfo add;
+    XIRemoveMasterInfo remove;
+    XIAttachSlave attach;
+    XIDetachSlave detach;
+} XIAnyHierarchyChangeInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    int type; /* XIAddMaster */
+    char* name;
+    Bool send_core;
+    Bool enable;
+} XIAddMasterInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    int type; /* XIRemoveMaster */
+    int deviceid;
+    int return_mode;
+    int return_pointer;
+    int return_keyboard;
+} XIRemoveMasterInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    int type; /* XIAttachSlave */
+    int deviceid;
+    int new_master;
+} XIAttachSlaveInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    int type; /* XIDetachSlave */
+    int deviceid;
+} XIDetachSlaveInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIAddMasterInfo creates a new master pointer and a new
+master keyboard labelled "name pointer" and "name keyboard"
+respectively\&. If sendCore is True, the devices will send core
+events\&. If enable is True, the device is enabled immediately\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIAddMasterInfo can generate a BadValue error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIRemoveMasterInfo removes device and its paired master device\&.
+If returnMode is XIAttachToMaster, all pointers attached to
+device or its paired master device are attached to
+returnPointer\&. Likewise, all keyboards are attached to
+returnKeyboard\&. If returnMode is XIFloating, all attached
+devices are set to floating\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIRemoveMasterInfo can generate a BadValue and a BadDevice
+error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIAttachSlaveInfo attaches device to newMaster\&. If the device
+is currently attached to a master device, it is detached from
+the master device and attached to the new master device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIAttachSlaveInfo can generate a BadDevice error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIDettachSlaveInfo deattaches device from the current master
+device and sets it floating\&. If the device is already floating,
+no changes are made\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIDetachSlaveInfo can generate a BadDevice error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIChangeHierarchy generates an XIHierarchyEvent if any
+modifications were successful\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The device does not
+       exist or is not a appropriate for the type of change\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       Some numeric value falls out of the allowed range\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XIChangeHierarchy.txt b/man/XIChangeHierarchy.txt
new file mode 100755 (executable)
index 0000000..ac667bc
--- /dev/null
@@ -0,0 +1,119 @@
+XICHANGEHIERARCHY(libmansuffix)
+===============================
+
+NAME
+----
+
+   XIChangeHierarchy - change the device hierarchy.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput2.h>
+
+   Status XIChangeHierarchy( Display *display,
+                             XIAnyHierarchyChangeInfo *changes,
+                             int num_changes);
+
+   display
+          Specifies the connection to the X server.
+
+   num_changes
+          Specifies the number of elements in changes.
+
+   changes
+          Specifies the changes to be made.
+
+DESCRIPTION
+-----------
+
+   XIChangeHierarchy modifies the device hierarchy by creating or
+   removing master devices or changing the attachment of slave
+   devices. If num_changes is non-zero, changes is an array of
+   XIAnyHierarchyChangeInfo structures.
+
+   XIChangeHierarchy processes changes in order, effective
+   immediately. If an error occurs, processing is aborted and the
+   error is reported to the client. Changes already made remain
+   effective.
+
+   The list of changes is any combination of
+   XIAnyHierarchyChangeInfo. The type of a hierarchy change can be
+   XIAddMaster, XIRemoveMaster, XIAttachSlave or XIDetachSlave.
+
+                typedef union {
+                    int type;
+                    XIAddMasterInfo add;
+                    XIRemoveMasterInfo remove;
+                    XIAttachSlave attach;
+                    XIDetachSlave detach;
+                } XIAnyHierarchyChangeInfo;
+
+                typedef struct {
+                    int type; /* XIAddMaster */
+                    char* name;
+                    Bool send_core;
+                    Bool enable;
+                } XIAddMasterInfo;
+
+                typedef struct {
+                    int type; /* XIRemoveMaster */
+                    int deviceid;
+                    int return_mode;
+                    int return_pointer;
+                    int return_keyboard;
+                } XIRemoveMasterInfo;
+
+                typedef struct {
+                    int type; /* XIAttachSlave */
+                    int deviceid;
+                    int new_master;
+                } XIAttachSlaveInfo;
+
+                typedef struct {
+                    int type; /* XIDetachSlave */
+                    int deviceid;
+                } XIDetachSlaveInfo;
+
+   XIAddMasterInfo creates a new master pointer and a new
+   master keyboard labelled "name pointer" and "name keyboard"
+   respectively. If sendCore is True, the devices will send core
+   events. If enable is True, the device is enabled immediately.
+
+   XIAddMasterInfo can generate a BadValue error.
+
+   XIRemoveMasterInfo removes device and its paired master device.
+   If returnMode is XIAttachToMaster, all pointers attached to
+   device or its paired master device are attached to
+   returnPointer. Likewise, all keyboards are attached to
+   returnKeyboard. If returnMode is XIFloating, all attached
+   devices are set to floating.
+
+   XIRemoveMasterInfo can generate a BadValue and a BadDevice
+   error.
+
+   XIAttachSlaveInfo attaches device to newMaster. If the device
+   is currently attached to a master device, it is detached from
+   the master device and attached to the new master device.
+
+   XIAttachSlaveInfo can generate a BadDevice error.
+
+   XIDettachSlaveInfo deattaches device from the current master
+   device and sets it floating. If the device is already floating,
+   no changes are made.
+
+   XIDetachSlaveInfo can generate a BadDevice error.
+
+   XIChangeHierarchy generates an XIHierarchyEvent if any
+   modifications were successful.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The device does not
+          exist or is not a appropriate for the type of change.
+
+   BadValue
+          Some numeric value falls out of the allowed range.
+
diff --git a/man/XIChangeProperty.man b/man/XIChangeProperty.man
new file mode 100755 (executable)
index 0000000..907c593
--- /dev/null
@@ -0,0 +1,258 @@
+'\" t
+.\"     Title: xichangeproperty
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XICHANGEPROPERTY" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XIChangeProperty, XIGetProperty, XIDeleteProperty \- change, retrieve or delete a device\'s property\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput2\&.h>
+.fi
+.sp
+.nf
+void XIChangeProperty( Display* dpy,
+                       int deviceid,
+                       Atom property,
+                       Atom type,
+                       int format,
+                       int mode,
+                       unsigned char *data,
+                       int num_items)
+.fi
+.sp
+.nf
+void XIDeleteProperty( Display *dpy,
+                       int deviceid,
+                       Atom property)
+.fi
+.sp
+.nf
+Status XIGetProperty( Display *dpy,
+                      int deviceid,
+                      Atom property,
+                      long offset,
+                      long length,
+                      Bool delete_property,
+                      Atom type,
+                      Atom *type_return,
+                      int *format_return,
+                      unsigned long *num_items_return,
+                      unsigned long *bytes_after_return,
+                      unsigned char **data)
+.fi
+.sp
+.nf
+bytes_after_return
+       Returns the number of bytes remaining to be read in the prop\-
+       erty if a partial read was performed\&.
+.fi
+.sp
+.nf
+data
+       Specifies the property data\&.
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+delete_property
+       Specifies a Boolean value that determines whether the property
+       is to be deleted\&.
+.fi
+.sp
+.nf
+deviceid
+       The device to list the properties for\&.
+.fi
+.sp
+.nf
+format
+       Specifies whether the data should be viewed as a list of
+       8\-bit, 16\-bit, or 32\-bit quantities\&.  Possible values are 8,
+       16, and 32\&.  This information allows the X server to correctly
+       perform byte\-swap operations as necessary\&. If the
+       format is 16\-bit or 32\-bit, you must explicitly cast your
+       data pointer to an (unsigned char *) in the call to
+       XIChangeProperty\&.
+.fi
+.sp
+.nf
+format_return
+       Returns the actual format of the property\&.
+.fi
+.sp
+.nf
+length
+       Specifies the length in 32\-bit multiples of the data to be
+       retrieved\&.
+.fi
+.sp
+.nf
+offset
+       Specifies the offset in the specified property (in 32\-bit
+       quantities) where the data is to be retrieved\&.
+.fi
+.sp
+.nf
+mode
+       One of PropModeAppend, PropModePrepend or PropModeReplace\&.
+.fi
+.sp
+.nf
+num_items
+       Number of items in data in the format specified\&.
+.fi
+.sp
+.nf
+nitems_return
+       Returns the actual number of 8\-bit, 16\-bit, or 32\-bit items
+       stored in data\&.
+.fi
+.sp
+.nf
+property
+       Specifies the property name\&.
+.fi
+.sp
+.nf
+type
+       Specifies the type of the property\&.  The X server does not
+       interpret the type but simply passes it back to an application
+       that later calls XIGetProperty\&.
+.fi
+.sp
+.nf
+type_return
+       Returns the atom identifier that defines the actual type of
+       the property\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+The XIGetProperty function returns the actual type of the property; the actual format of the property; the number of 8\-bit, 16\-bit, or 32\-bit items transferred; the number of bytes remaining to be read in the property; and a pointer to the data actually returned\&. XIGetProperty sets the return arguments as follows:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+If the specified property does not exist for the specified device, XIGetProperty returns None to actual_type_return and the value zero to actual_format_return and bytes_after_return\&. The nitems_return argument is empty\&. In this case, the delete argument is ignored\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+If the specified property exists but its type does not match the specified type, XIGetProperty returns the actual property type to actual_type_return, the actual property format (never zero) to actual_format_return, and the property length in bytes (even if the actual_format_return is 16 or 32) to bytes_after_return\&. It also ignores the delete argument\&. The nitems_return argument is empty\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+If the specified property exists and either you assign AnyPropertyType to the req_type argument or the specified type matches the actual property type, XIGetProperty returns the actual property type to actual_type_return and the actual property format (never zero) to actual_format_return\&. It also returns a value to bytes_after_return and nitems_return, by defining the following values:
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+N = length of the stored property in bytes
+I = 4 * offset
+T = N \- I
+L = MINIMUM(T, 4 * length)
+A = N \- (I + L)
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.sp
+The returned value starts at byte index I in the property (indexing from zero), and its length in bytes is L\&. If the value for long_offset causes L to be negative, a BadValue error results\&. The value of bytes_after_return is A, giving the number of trailing unread bytes in the stored property\&.
+.sp
+If the returned format is 8, the returned data is represented as a char array\&. If the returned format is 16, the returned data is represented as a uint16_t array and should be cast to that type to obtain the ele\- ments\&. If the returned format is 32, the returned data is represented as a uint32_t array and should be cast to that type to obtain the elements\&.
+.sp
+XIGetProperty always allocates one extra byte in prop_return (even if the property is zero length) and sets it to zero so that simple properties consisting of characters do not have to be copied into yet another string before use\&.
+.sp
+If delete is True and bytes_after_return is zero, XIGetProperty deletes the property from the window and generates an XIPropertyNotify event on the window\&.
+.sp
+The function returns Success if it executes successfully\&. To free the resulting data, use XFree\&.
+.sp
+XIGetProperty can generate BadAtom, BadValue, and BadWindow errors\&.
+.sp
+The XIChangeProperty function alters the property for the specified device and causes the X server to generate a XIPropertyNotify event for that device\&. XIChangeProperty performs the following:
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+If mode is PropModeReplace, XIChangeProperty discards the previous property value and stores the new data\&.
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+If mode is PropModePrepend or PropModeAppend, XChangeProperty inserts the specified data before the beginning of the existing data or onto the end of the existing data, respectively\&. The type and format must match the existing property value, or a BadMatch error results\&. If the property is undefined, it is treated as defined with the correct type and format with zero\-length data\&.
+.RE
+.sp
+If the specified format is 8, the property data must be a char array\&. If the specified format is 16, the property data must be a uint16_t array\&. If the specified format is 32, the property data must be a uint32_t array\&.
+.sp
+The lifetime of a property is not tied to the storing client\&. Properties remain until explicitly deleted, until the device is removed, or until the server resets\&. The maximum size of a property is server dependent and can vary dynamically depending on the amount of memory the server has available\&. (If there is insufficient space, a BadAlloc error results\&.)
+.sp
+XIChangeProperty can generate BadAlloc, BadAtom, BadMatch, BadValue, and BadDevice errors\&.
+.sp
+The XIDeleteProperty function deletes the specified property only if the property was defined on the specified device and causes the X server to generate a XIPropertyNotify event for the device unless the property does not exist\&.
+.sp
+XIDeleteProperty can generate BadAtom and BadDevice errors\&.
+.SH "DIAGNOSTICS"
+.sp
+BadAlloc The server failed to allocate the requested resource or server memory\&.
+.sp
+BadAtom A value for an Atom argument does not name a defined Atom\&.
+.sp
+BadValue Some numeric value falls outside the range of values accepted by the request\&. Unless a specific range is specified for an argument, the full range defined by the argument\(cqs type is accepted\&. Any argument defined as a set of alternatives can generate this error\&.
+.sp
+BadDevice An invalid device was specified\&. The device does not exist\&.
+.sp
+BadAtom An invalid property was specified\&. The property does not exist\&.
+.SH "SEE ALSO"
+.sp
+XIListProperties(libmansuffix)
diff --git a/man/XIChangeProperty.txt b/man/XIChangeProperty.txt
new file mode 100755 (executable)
index 0000000..76a0e8b
--- /dev/null
@@ -0,0 +1,227 @@
+XICHANGEPROPERTY(libmansuffix)
+==============================
+
+NAME
+----
+
+   XIChangeProperty, XIGetProperty, XIDeleteProperty - change, retrieve
+   or delete a device's property.
+
+SYNOPSIS
+--------
+
+    #include <X11/extensions/XInput2.h>
+
+    void XIChangeProperty( Display* dpy,
+                           int deviceid,
+                           Atom property,
+                           Atom type,
+                           int format,
+                           int mode,
+                           unsigned char *data,
+                           int num_items)
+
+   void XIDeleteProperty( Display *dpy,
+                          int deviceid,
+                          Atom property)
+
+   Status XIGetProperty( Display *dpy,
+                         int deviceid,
+                         Atom property,
+                         long offset,
+                         long length,
+                         Bool delete_property,
+                         Atom type,
+                         Atom *type_return,
+                         int *format_return,
+                         unsigned long *num_items_return,
+                         unsigned long *bytes_after_return,
+                         unsigned char **data)
+
+   bytes_after_return
+          Returns the number of bytes remaining to be read in the prop-
+          erty if a partial read was performed.
+
+   data
+          Specifies the property data.
+
+   display
+          Specifies the connection to the X server.
+    
+   delete_property
+          Specifies a Boolean value that determines whether the property
+          is to be deleted.
+
+   deviceid
+          The device to list the properties for.
+
+   format
+          Specifies whether the data should be viewed as a list of
+          8-bit, 16-bit, or 32-bit quantities.  Possible values are 8,
+          16, and 32.  This information allows the X server to correctly
+          perform byte-swap operations as necessary. If the
+          format is 16-bit or 32-bit, you must explicitly cast your
+          data pointer to an (unsigned char *) in the call to 
+          XIChangeProperty.
+
+   format_return
+          Returns the actual format of the property.
+
+   length 
+          Specifies the length in 32-bit multiples of the data to be
+          retrieved.
+
+   offset
+          Specifies the offset in the specified property (in 32-bit
+          quantities) where the data is to be retrieved.
+
+   mode
+          One of PropModeAppend, PropModePrepend or PropModeReplace.
+
+   num_items
+          Number of items in data in the format specified.
+
+   nitems_return
+          Returns the actual number of 8-bit, 16-bit, or 32-bit items
+          stored in data.
+
+   property
+          Specifies the property name.
+
+   type
+          Specifies the type of the property.  The X server does not
+          interpret the type but simply passes it back to an application
+          that later calls XIGetProperty.
+
+   type_return
+          Returns the atom identifier that defines the actual type of
+          the property.
+
+DESCRIPTION
+-----------
+
+The XIGetProperty function returns the actual type of the property; 
+the actual format of the property; the number of 8-bit, 16-bit,
+or 32-bit items transferred; the number of bytes remaining to be read
+in the property; and a pointer to the data actually returned.
+XIGetProperty sets the return arguments as follows:
+
+   - If the specified property does not exist for the specified device,
+   XIGetProperty returns None to actual_type_return and the
+   value zero to actual_format_return and bytes_after_return.  The
+   nitems_return argument is empty.  In this case, the delete argument 
+   is ignored.
+
+   - If the specified property exists but its type does not match the
+   specified type, XIGetProperty returns the actual property
+   type to actual_type_return, the actual property format (never
+   zero) to actual_format_return, and the property length in bytes
+   (even if the actual_format_return is 16 or 32) to
+   bytes_after_return.  It also ignores the delete argument.  The
+   nitems_return argument is empty.
+
+   - If the specified property exists and either you assign 
+   AnyPropertyType to the req_type argument or the specified type 
+   matches the actual property type, XIGetProperty returns the 
+   actual property type to actual_type_return and the actual property 
+   format (never zero) to actual_format_return.  It also returns a value 
+   to bytes_after_return and nitems_return, by defining the following
+   values:
+
+   N = length of the stored property in bytes
+   I = 4 * offset
+   T = N - I
+   L = MINIMUM(T, 4 * length)
+   A = N - (I + L)
+
+The returned value starts at byte index I in the property 
+(indexing from zero), and its length in bytes is L.  If the value 
+for long_offset causes L to be negative, a BadValue error results.
+The value of bytes_after_return is A, giving the number of trailing 
+unread bytes in the stored property.
+
+If the returned format is 8, the returned data is represented as a char
+array.  If the returned format is 16, the returned data is represented
+as a uint16_t array and should be cast to that type to obtain the ele-
+ments.  If the returned format is 32, the returned data is represented
+as a uint32_t array and should be cast to that type to obtain the elements.
+
+XIGetProperty always allocates one extra byte in prop_return (even
+if the property is zero length) and sets it to zero so that simple
+properties consisting of characters do not have to be copied into yet
+another string before use.
+
+If delete is True and bytes_after_return is zero, XIGetProperty
+deletes the property from the window and generates an XIPropertyNotify
+event on the window.
+
+The function returns Success if it executes successfully.  To free the
+resulting data, use XFree.
+
+XIGetProperty can generate BadAtom, BadValue, and BadWindow
+errors.
+
+The XIChangeProperty function alters the property for the specified device
+and causes the X server to generate a XIPropertyNotify event for that
+device.  XIChangeProperty performs the following:
+
+- If mode is PropModeReplace, XIChangeProperty discards the previous
+  property value and stores the new data.
+
+- If mode is PropModePrepend or PropModeAppend, XChangeProperty
+  inserts the specified data before the beginning of the existing
+  data or onto the end of the existing data, respectively.  The type
+  and format must match the existing property value, or a BadMatch
+  error results.  If the property is undefined, it is treated as
+  defined with the correct type and format with zero-length data.
+
+If the specified format is 8, the property data must be a char array.
+If the specified format is 16, the property data must be a uint16_t array.
+If the specified format is 32, the property data must be a uint32_t array.
+
+The lifetime of a property is not tied to the storing client. 
+Properties remain until explicitly deleted, until the device is removed, 
+or until the server resets.  The maximum size of a property is server 
+dependent and can vary dynamically depending on the amount of memory 
+the server has available.  (If there is insufficient space, a BadAlloc 
+error results.)
+
+XIChangeProperty can generate BadAlloc, BadAtom, BadMatch, BadValue, and
+BadDevice errors.
+
+The XIDeleteProperty function deletes the specified property only if the
+property was defined on the specified device and causes the X server to
+generate a XIPropertyNotify event for the device unless the property does
+not exist.
+
+XIDeleteProperty can generate BadAtom and BadDevice errors.
+
+
+DIAGNOSTICS
+-----------
+BadAlloc
+        The server failed to allocate the requested resource or
+        server memory.
+
+BadAtom
+        A value for an Atom argument does not name a defined Atom.
+
+BadValue
+        Some numeric value falls outside the range of values accepted
+        by the request.  Unless a specific range is specified for an
+        argument, the full range defined by the argument’s type is
+        accepted.  Any argument defined as a set of alternatives can
+        generate this error.
+
+BadDevice
+       An invalid device was specified. The device does not
+       exist.
+
+BadAtom
+       An invalid property was specified. The property does not
+       exist.
+
+SEE ALSO
+--------
+
+XIListProperties(libmansuffix)
diff --git a/man/XIDefineCursor.man b/man/XIDefineCursor.man
new file mode 100755 (executable)
index 0000000..9553156
--- /dev/null
@@ -0,0 +1,181 @@
+'\" t
+.\"     Title: xidefinecursor
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 10/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XIDEFINECURSOR" "libmansuffix" "10/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XIDefineCursor, XIUndefineCursor \- define device cursors\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput2\&.h>
+.fi
+.sp
+.nf
+int XIDefineCursor( Display *display,
+                    int deviceid,
+                    Window win,
+                    Cursor cursor);
+.fi
+.sp
+.nf
+int XIUndefineCursor( Display *display,
+                      int deviceid,
+                      Window win);
+.fi
+.sp
+.nf
+cursor
+       Specifies the cursor that is to be displayed or None\&.
+.fi
+.sp
+.nf
+deviceid
+       Specifies the device whose cursor is to change\&.
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+win
+       Specifies the window\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If a cursor is set, it will be used when the device\'s pointer
+is in the window\&. If the cursor is None, it is equivalent to
+XIUndefineCursor\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The deviceid must be a master pointer device or a BadDevice error is
+returned\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIDefineCursor can generate BadDevice, BadCursor and BadWindow\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XIUndefineCursor function undoes the effect of a previous
+XIDefineCursor for this window\&. When the pointer is in the
+window, the window\'s default cursor will now be used\&. If no
+default cursor is defined, the parent\'s cursor for this device
+will be used (if defined) or the parent\'s default cursor will
+be used\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIDefineCursor and XIUndefineCursor are identical to
+XDefineCursor and XUndefineCursor but specify the device
+explicitly\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIUndefineCursor can generate a BadDevice and a BadWindow
+error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadCursor
+       A value for a cursor argument does not name a defined
+       cursor\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The device does not
+       exist or is not a pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+See also
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XDefineCursor, XUndefineCursor
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XIDefineCursor.txt b/man/XIDefineCursor.txt
new file mode 100755 (executable)
index 0000000..992aeaa
--- /dev/null
@@ -0,0 +1,79 @@
+XIDEFINECURSOR(libmansuffix)
+============================
+
+NAME
+----
+
+   XIDefineCursor, XIUndefineCursor - define device cursors.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput2.h>
+
+   int XIDefineCursor( Display *display,
+                       int deviceid,
+                       Window win,
+                       Cursor cursor);
+
+   int XIUndefineCursor( Display *display,
+                         int deviceid,
+                         Window win);
+
+   cursor
+          Specifies the cursor that is to be displayed or None.
+
+   deviceid
+          Specifies the device whose cursor is to change.
+
+   display
+          Specifies the connection to the X server.
+
+   win
+          Specifies the window.
+
+DESCRIPTION
+-----------
+
+   If a cursor is set, it will be used when the device's pointer
+   is in the window. If the cursor is None, it is equivalent to
+   XIUndefineCursor.
+
+   The deviceid must be a master pointer device or a BadDevice error is
+   returned.
+
+   XIDefineCursor can generate BadDevice, BadCursor and BadWindow.
+
+   The XIUndefineCursor function undoes the effect of a previous
+   XIDefineCursor for this window. When the pointer is in the
+   window, the window's default cursor will now be used. If no
+   default cursor is defined, the parent's cursor for this device
+   will be used (if defined) or the parent's default cursor will
+   be used.
+
+   XIDefineCursor and XIUndefineCursor are identical to
+   XDefineCursor and XUndefineCursor but specify the device
+   explicitly.
+
+   XIUndefineCursor can generate a BadDevice and a BadWindow
+   error.
+
+DIAGNOSTICS
+-----------
+
+   BadCursor
+          A value for a cursor argument does not name a defined
+          cursor.
+
+   BadDevice
+          An invalid device was specified. The device does not
+          exist or is not a pointer device.
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          window.
+
+See also
+
+   XDefineCursor, XUndefineCursor
+
diff --git a/man/XIDeleteProperty.man b/man/XIDeleteProperty.man
new file mode 100755 (executable)
index 0000000..42e9441
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XIChangeProperty.libmansuffix
diff --git a/man/XIFreeDeviceInfo.man b/man/XIFreeDeviceInfo.man
new file mode 100755 (executable)
index 0000000..314c6de
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XIQueryDevice.libmansuffix
diff --git a/man/XIGetClientPointer.man b/man/XIGetClientPointer.man
new file mode 100755 (executable)
index 0000000..6cd9325
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XISetClientPointer.libmansuffix
diff --git a/man/XIGetFocus.man b/man/XIGetFocus.man
new file mode 100755 (executable)
index 0000000..c119282
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XISetFocus.libmansuffix
diff --git a/man/XIGetProperty.man b/man/XIGetProperty.man
new file mode 100755 (executable)
index 0000000..42e9441
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XIChangeProperty.libmansuffix
diff --git a/man/XIGetSelectedEvents.man b/man/XIGetSelectedEvents.man
new file mode 100755 (executable)
index 0000000..fbad756
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XISelectEvents.libmansuffix
diff --git a/man/XIGrabButton.man b/man/XIGrabButton.man
new file mode 100755 (executable)
index 0000000..799f3a9
--- /dev/null
@@ -0,0 +1,352 @@
+'\" t
+.\"     Title: xigrabbutton
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 10/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XIGRABBUTTON" "libmansuffix" "10/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XIGrabButton, XIUngrabButton, XIGrabKeycode, XIUngrabKeycode \- grab/ungrab buttons or keys
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+int XIGrabButton( Display *display,
+                  int deviceid,
+                  int button,
+                  Window grab_window,
+                  Cursor cursor,
+                  int grab_mode,
+                  int paired_device_mode,
+                  Bool owner_events,
+                  XIEventMask *mask,
+                  int num_modifiers,
+                  XIGrabModifiers *modifiers_inout);
+.fi
+.sp
+.nf
+int XIUngrabButton( Display *display,
+                    int deviceid,
+                    int button,
+                    Window grab_window,
+                    int num_modifiers,
+                    XIGrabModifiers *modifiers);
+.fi
+.sp
+.nf
+int XIGrabKeycode( Display *display,
+                  int deviceid,
+                  int keycode,
+                  Window grab_window,
+                  int grab_mode,
+                  int paired_device_mode,
+                  Bool owner_events,
+                  XIEventMask *mask,
+                  int num_modifiers,
+                  XIGrabModifiers *modifiers_inout);
+.fi
+.sp
+.nf
+int XIUngrabKeycode( Display *display,
+                    int deviceid,
+                    int keycode,
+                    Window grab_window,
+                    int num_modifiers,
+                    XIGrabModifiers *modifiers);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device that is to be grabbed or released
+.fi
+.sp
+.nf
+button
+       Specifies the device button that is to be grabbed or
+       released or XIAnyButton\&.
+.fi
+.sp
+.nf
+keycode
+       Specifies the keycode that is to be grabbed or released
+       or XIAnyKeycode\&.
+.fi
+.sp
+.nf
+num_modifiers
+       Number of elements in modifiers or modifiers_return
+.fi
+.sp
+.nf
+modifiers
+       Specifies the set of latched and base modifiers or
+       XIAnyModifier to ungrab\&. The data type is for
+       consistency with the respective grab request and the
+       status code of the XIGrabModifiers struct is ignored\&.
+.fi
+.sp
+.nf
+modifiers_inout
+       Specifies the set of latched and base modifiers or
+       XIAnyModifier to grab\&. Returns the modifiers that could
+       not be grabbed and their status code\&.
+.fi
+.sp
+.nf
+grab_window
+       Specifies the grab window\&.
+.fi
+.sp
+.nf
+owner_events
+       Specifies a Boolean value that indicates whether the are
+       to be reported as usual or reported with respect to the
+       grab window\&.
+.fi
+.sp
+.nf
+mask
+       Specifies the event mask\&.
+.fi
+.sp
+.nf
+grab_mode
+       Specifies further processing of events from this device\&.
+       You can pass GrabModeSync or GrabModeAsync\&.
+.fi
+.sp
+.nf
+paired_device_mode
+       Specifies further processing of events from the paired
+       master device\&. You can pass GrabModeSync or
+       GrabModeAsync\&. If deviceid specifies a floating slave
+       device, this parameter is ignored\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIGrabButton and XIGrabKeycode establishes a passive grab\&. The
+modifier device for a button grab is the paired master device
+if deviceid specifies a master pointer\&. Otherwise, the modifier
+device is the device specified with deviceid\&. In the future,
+the device is actively grabbed (as for XIGrabDevice, the
+last\-grab time is set to the time at which the button or keycode
+was pressed and the X_XIButtonPress or X_XIKeyPress event is
+reported if all of the following conditions are true:
+  * The device is not grabbed, and the specified button or
+    keycode is logically pressed when the specified modifier
+    keys are logically down on the modifier device and no other
+    buttons or modifier keys are logically down\&.
+  * Either the grab window is an ancestor of (or is) the focus
+    window, OR the grab window is a descendent of the focus
+    window and contains the device\&.
+  * A passive grab on the same button/modifier combination does
+    not exist on any ancestor of grab_window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The interpretation of the remaining arguments is as for
+XIGrabDevice\&. The active grab is terminated automatically when
+the logical state of the device has all buttons or keys
+released (independent of the logical state of the modifier
+keys)\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the device is an attached slave device, the device is
+automatically detached from the master device when the grab
+activates and reattached to the same master device when the
+grab deactivates\&. If the master device is removed while the
+device is floating as a result of a grab, the device remains
+floating once the grab deactivates\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Note that the logical state of a device (as seen by client
+applications) may lag the physical state if device event
+processing is frozen\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+This request overrides all previous grabs by the same client on
+the same button/modifier or keycode/modifier combinations on the
+same window\&. A modifiers of XIAnyModifier is equivalent to
+issuing the grab request for all possible modifier combinations
+(including the combination of no modifiers)\&. It is not required
+that all modifiers specified have currently assigned KeyCodes\&.
+A button of XIAnyButton is equivalent to issuing the request
+for all possible buttons\&. Otherwise, it is not required that
+the specified button currently be assigned to a physical
+button\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If some other client has already issued a XIGrabButton or
+XIGrabKeycode with the same button/modifier or keycode/modifier
+combination on the same window, a BadAccess error results\&. When
+using XIAnyModifier or XIAnyButton , the request fails
+completely, and a XIBadAccess error results (no grabs are
+established) if there is a conflicting grab for any
+combination\&. XIGrabButton and XIGrabKeycode have no effect on an
+active grab\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIGrabButton and XIGrabKeycode can generate BadClass, BadDevice,
+BadMatch, BadValue, and BadWindow errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIUngrabButton and XIUngrabKeycode releases the passive grab for
+a button/modifier or keycode/modifier combination on the
+specified window if it was grabbed by this client\&. A modifier
+of XIAnyModifier is equivalent to issuing the ungrab request
+for all possible modifier combinations, including the
+combination of no modifiers\&. A button of XIAnyButton is
+equivalent to issuing the request for all possible buttons\&.
+XIUngrabButton and XIUngrabKeycode have no effect on an active
+grab\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIUngrabButton and XIUngrabKeycode can generate BadDevice,
+BadMatch, BadValue and BadWindow errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid deviceid was specified\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if XIGrabButton specified a device
+       that has no buttons, or XIGrabKeycode specified a device
+       that has no keys\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       Some numeric value falls outside the range of values
+       accepted by the request\&. Unless a specific range is
+       specified for an argument, the full range defined by the
+       argument\'s type is accepted\&. Any argument defined as a
+       set of alternatives can generate this error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       Window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIAllowEvents(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XIGrabButton.txt b/man/XIGrabButton.txt
new file mode 100755 (executable)
index 0000000..70a3505
--- /dev/null
@@ -0,0 +1,201 @@
+XIGRABBUTTON(libmansuffix)
+==========================
+
+NAME
+----
+
+   XIGrabButton, XIUngrabButton, XIGrabKeycode, XIUngrabKeycode -
+   grab/ungrab buttons or keys
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   int XIGrabButton( Display *display,
+                     int deviceid,
+                     int button,
+                     Window grab_window,
+                     Cursor cursor,
+                     int grab_mode,
+                     int paired_device_mode,
+                     Bool owner_events,
+                     XIEventMask *mask,
+                     int num_modifiers,
+                     XIGrabModifiers *modifiers_inout);
+
+   int XIUngrabButton( Display *display,
+                       int deviceid,
+                       int button,
+                       Window grab_window,
+                       int num_modifiers,
+                       XIGrabModifiers *modifiers);
+
+   int XIGrabKeycode( Display *display,
+                     int deviceid,
+                     int keycode,
+                     Window grab_window,
+                     int grab_mode,
+                     int paired_device_mode,
+                     Bool owner_events,
+                     XIEventMask *mask,
+                     int num_modifiers,
+                     XIGrabModifiers *modifiers_inout);
+   
+   int XIUngrabKeycode( Display *display,
+                       int deviceid,
+                       int keycode,
+                       Window grab_window,
+                       int num_modifiers,
+                       XIGrabModifiers *modifiers);
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device that is to be grabbed or released
+
+   button
+          Specifies the device button that is to be grabbed or
+          released or XIAnyButton.
+
+   keycode
+          Specifies the keycode that is to be grabbed or released
+          or XIAnyKeycode.
+
+   num_modifiers
+          Number of elements in modifiers or modifiers_return
+
+   modifiers
+          Specifies the set of latched and base modifiers or
+          XIAnyModifier to ungrab. The data type is for
+          consistency with the respective grab request and the
+          status code of the XIGrabModifiers struct is ignored.
+
+   modifiers_inout
+          Specifies the set of latched and base modifiers or
+          XIAnyModifier to grab. Returns the modifiers that could
+          not be grabbed and their status code.
+
+   grab_window
+          Specifies the grab window.
+
+   owner_events
+          Specifies a Boolean value that indicates whether the are
+          to be reported as usual or reported with respect to the
+          grab window.
+
+   mask
+          Specifies the event mask.
+
+   grab_mode
+          Specifies further processing of events from this device.
+          You can pass GrabModeSync or GrabModeAsync.
+
+   paired_device_mode
+          Specifies further processing of events from the paired
+          master device. You can pass GrabModeSync or
+          GrabModeAsync. If deviceid specifies a floating slave
+          device, this parameter is ignored.
+
+DESCRIPTION
+-----------
+
+   XIGrabButton and XIGrabKeycode establishes a passive grab. The
+   modifier device for a button grab is the paired master device
+   if deviceid specifies a master pointer. Otherwise, the modifier
+   device is the device specified with deviceid. In the future,
+   the device is actively grabbed (as for XIGrabDevice, the
+   last-grab time is set to the time at which the button or keycode
+   was pressed and the X_XIButtonPress or X_XIKeyPress event is
+   reported if all of the following conditions are true:
+     * The device is not grabbed, and the specified button or
+       keycode is logically pressed when the specified modifier
+       keys are logically down on the modifier device and no other
+       buttons or modifier keys are logically down.
+     * Either the grab window is an ancestor of (or is) the focus
+       window, OR the grab window is a descendent of the focus
+       window and contains the device.
+     * A passive grab on the same button/modifier combination does
+       not exist on any ancestor of grab_window.
+
+   The interpretation of the remaining arguments is as for
+   XIGrabDevice. The active grab is terminated automatically when
+   the logical state of the device has all buttons or keys
+   released (independent of the logical state of the modifier
+   keys).
+
+   If the device is an attached slave device, the device is
+   automatically detached from the master device when the grab
+   activates and reattached to the same master device when the
+   grab deactivates. If the master device is removed while the
+   device is floating as a result of a grab, the device remains
+   floating once the grab deactivates.
+
+   Note that the logical state of a device (as seen by client
+   applications) may lag the physical state if device event
+   processing is frozen.
+
+   This request overrides all previous grabs by the same client on
+   the same button/modifier or keycode/modifier combinations on the
+   same window. A modifiers of XIAnyModifier is equivalent to
+   issuing the grab request for all possible modifier combinations
+   (including the combination of no modifiers). It is not required
+   that all modifiers specified have currently assigned KeyCodes.
+   A button of XIAnyButton is equivalent to issuing the request
+   for all possible buttons. Otherwise, it is not required that
+   the specified button currently be assigned to a physical
+   button.
+
+   If some other client has already issued a XIGrabButton or
+   XIGrabKeycode with the same button/modifier or keycode/modifier
+   combination on the same window, a BadAccess error results. When
+   using XIAnyModifier or XIAnyButton , the request fails
+   completely, and a XIBadAccess error results (no grabs are
+   established) if there is a conflicting grab for any
+   combination. XIGrabButton and XIGrabKeycode have no effect on an
+   active grab.
+
+   XIGrabButton and XIGrabKeycode can generate BadClass, BadDevice,
+   BadMatch, BadValue, and BadWindow errors.
+
+   XIUngrabButton and XIUngrabKeycode releases the passive grab for
+   a button/modifier or keycode/modifier combination on the
+   specified window if it was grabbed by this client. A modifier
+   of XIAnyModifier is equivalent to issuing the ungrab request
+   for all possible modifier combinations, including the
+   combination of no modifiers. A button of XIAnyButton is
+   equivalent to issuing the request for all possible buttons.
+   XIUngrabButton and XIUngrabKeycode have no effect on an active
+   grab.
+
+   XIUngrabButton and XIUngrabKeycode can generate BadDevice,
+   BadMatch, BadValue and BadWindow errors.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid deviceid was specified.
+
+   BadMatch
+          This error may occur if XIGrabButton specified a device
+          that has no buttons, or XIGrabKeycode specified a device
+          that has no keys.
+
+   BadValue
+          Some numeric value falls outside the range of values
+          accepted by the request. Unless a specific range is
+          specified for an argument, the full range defined by the
+          argument's type is accepted. Any argument defined as a
+          set of alternatives can generate this error.
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          Window.
+
+SEE ALSO
+--------
+
+   XIAllowEvents(libmansuffix)
+
diff --git a/man/XIGrabDevice.man b/man/XIGrabDevice.man
new file mode 100755 (executable)
index 0000000..591fce0
--- /dev/null
@@ -0,0 +1,296 @@
+'\" t
+.\"     Title: xigrabdevice
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 10/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XIGRABDEVICE" "libmansuffix" "10/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XIGrabDevice, XIUngrabDevice \- grab or ungrab the device\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput2\&.h>
+.fi
+.sp
+.nf
+Status XIGrabDevice( Display *display,
+                     int deviceid,
+                     Window grab_window,
+                     Time time,
+                     Cursor cursor,
+                     int grab_mode,
+                     int paired_device_mode,
+                     Bool owner_events,
+                     XIEventMask *mask);
+.fi
+.sp
+.nf
+Status XIUngrabDevice( Display *display,
+                       int deviceid,
+                       Time time);
+.fi
+.sp
+.nf
+cursor
+       Specifies the cursor image to display for the duration
+       of the grab\&.
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+deviceid
+       Specifies the device that should be grabbed or
+       ungrabbed\&.
+.fi
+.sp
+.nf
+grab_mode, paired_device_mode
+       The grab mode for this device and (if applicable) the
+       paired device\&.
+.fi
+.sp
+.nf
+grab_window
+       The grab window\&.
+.fi
+.sp
+.nf
+mask
+       Event mask\&.
+.fi
+.sp
+.nf
+owner_events
+       True if events are to be reported normally\&.
+.fi
+.sp
+.nf
+time
+       A valid timestamp or CurrentTime\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIGrabDevice actively grabs control of the device\&. Further
+device events are reported only to the grabbing client\&.
+XIGrabDevice overrides any active device grab by this client\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the device is an attached slave device, the device is
+automatically detached from the master device and reattached to
+the same master device when client ungrabs the device\&. If the
+master device is removed while the device is floating as a
+result of a grab, the device remains floating once the grab
+deactivates\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If owner_events is False, all generated device events are
+reported with respect to grab_window if selected\&. If
+owner_events is True and if a generated device event would
+normally be reported to this client, it is reported normally;
+otherwise, the event is reported with respect to the
+grab_window, and is only reported if specified in the event
+mask\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the grab_mode argument is GrabModeAsync, device event
+processing continues as usual\&. If the device is currently
+frozen by this client, then processing of device events is
+resumed\&. If the grab_mode argument is GrabModeSync, the state
+of the device (as seen by client applications) appears to
+freeze, and the X server generates no further device events
+until the grabbing client issues a releasing XIAllowEvents call
+or until the device grab is released\&. Actual device changes are
+not lost while the device is frozen; they are simply queued in
+the server for later processing\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If paired_device_mode is GrabModeAsync, processing of events
+from the paired master device is unaffected by activation of
+the grab\&. If paired_device_mode is GrabModeSync, the state of
+the paired master device (as seen by client applications)
+appears to freeze, and the X server generates no further events
+from this device until the grabbing client issues a releasing
+XIAllowEvents call or until the device grab is released\&. Actual
+events are not lost while the devices are frozen; they are
+simply queued in the server for later processing\&. If the device
+is a slave device paired_device_mode is ignored\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the device is actively grabbed by some other client,
+XIGrabDevice fails and returns AlreadyGrabbed\&. If grab_window
+is not viewable, it fails and returns GrabNotViewable\&. If the
+device is frozen by an active grab of another client, it fails
+and returns GrabFrozen\&. If the specified time is earlier than
+the last\-device\-grab time or later than the current X server
+time, it fails and returns GrabInvalidTime\&. Otherwise, the
+last\-device\-grab time is set to the specified time\&. CurrentTime
+is replaced by the current X server time\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If cursor is not None this cursor is displayed until the client
+calls XIUngrabDevice\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIGrabDevice can generate BadDevice, BadValue, and BadWindow
+errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XIUngrabDevice request releases the device and any queued
+events if this client has it actively grabbed from either
+XIGrabDevice or XIGrabKey or XIGrabButton\&. If other devices are
+frozen by the grab, XUngrabDevice thaws them\&. XUngrabDevice
+does not release the device and any queued events if the
+specified time is earlier than the last\-device\-grab time or is
+later than the current X server time\&. The X server
+automatically performs an XIUngrabDevice request if the event
+window for an active device grab becomes not viewable\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIUngrabDevice can generate a BadDevice error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       A value is outside of the permitted range\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The device does not
+       exist or is not a appropriate for the type of change\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       The window is not viewable\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       Window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIAllowEvents(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XIGrabDevice.txt b/man/XIGrabDevice.txt
new file mode 100755 (executable)
index 0000000..bd749b7
--- /dev/null
@@ -0,0 +1,147 @@
+XIGRABDEVICE(libmansuffix)
+==========================
+
+NAME
+----
+
+   XIGrabDevice, XIUngrabDevice - grab or ungrab the device.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput2.h>
+
+   Status XIGrabDevice( Display *display,
+                        int deviceid,
+                        Window grab_window,
+                        Time time,
+                        Cursor cursor,
+                        int grab_mode,
+                        int paired_device_mode,
+                        Bool owner_events,
+                        XIEventMask *mask);
+   
+   Status XIUngrabDevice( Display *display,
+                          int deviceid,
+                          Time time);
+
+   cursor
+          Specifies the cursor image to display for the duration
+          of the grab.
+
+   display
+          Specifies the connection to the X server.
+
+   deviceid
+          Specifies the device that should be grabbed or
+          ungrabbed.
+
+   grab_mode, paired_device_mode
+          The grab mode for this device and (if applicable) the
+          paired device.
+
+   grab_window
+          The grab window.
+
+   mask
+          Event mask.
+
+   owner_events
+          True if events are to be reported normally.
+
+   time
+          A valid timestamp or CurrentTime.
+
+DESCRIPTION
+-----------
+
+   XIGrabDevice actively grabs control of the device. Further
+   device events are reported only to the grabbing client.
+   XIGrabDevice overrides any active device grab by this client.
+
+   If the device is an attached slave device, the device is
+   automatically detached from the master device and reattached to
+   the same master device when client ungrabs the device. If the
+   master device is removed while the device is floating as a
+   result of a grab, the device remains floating once the grab
+   deactivates.
+
+   If owner_events is False, all generated device events are
+   reported with respect to grab_window if selected. If
+   owner_events is True and if a generated device event would
+   normally be reported to this client, it is reported normally;
+   otherwise, the event is reported with respect to the
+   grab_window, and is only reported if specified in the event
+   mask.
+
+   If the grab_mode argument is GrabModeAsync, device event
+   processing continues as usual. If the device is currently
+   frozen by this client, then processing of device events is
+   resumed. If the grab_mode argument is GrabModeSync, the state
+   of the device (as seen by client applications) appears to
+   freeze, and the X server generates no further device events
+   until the grabbing client issues a releasing XIAllowEvents call
+   or until the device grab is released. Actual device changes are
+   not lost while the device is frozen; they are simply queued in
+   the server for later processing.
+
+   If paired_device_mode is GrabModeAsync, processing of events
+   from the paired master device is unaffected by activation of
+   the grab. If paired_device_mode is GrabModeSync, the state of
+   the paired master device (as seen by client applications)
+   appears to freeze, and the X server generates no further events
+   from this device until the grabbing client issues a releasing
+   XIAllowEvents call or until the device grab is released. Actual
+   events are not lost while the devices are frozen; they are
+   simply queued in the server for later processing. If the device
+   is a slave device paired_device_mode is ignored.
+
+   If the device is actively grabbed by some other client,
+   XIGrabDevice fails and returns AlreadyGrabbed. If grab_window
+   is not viewable, it fails and returns GrabNotViewable. If the
+   device is frozen by an active grab of another client, it fails
+   and returns GrabFrozen. If the specified time is earlier than
+   the last-device-grab time or later than the current X server
+   time, it fails and returns GrabInvalidTime. Otherwise, the
+   last-device-grab time is set to the specified time. CurrentTime
+   is replaced by the current X server time.
+
+   If cursor is not None this cursor is displayed until the client
+   calls XIUngrabDevice.
+
+   XIGrabDevice can generate BadDevice, BadValue, and BadWindow
+   errors.
+
+   The XIUngrabDevice request releases the device and any queued
+   events if this client has it actively grabbed from either
+   XIGrabDevice or XIGrabKey or XIGrabButton. If other devices are
+   frozen by the grab, XUngrabDevice thaws them. XUngrabDevice
+   does not release the device and any queued events if the
+   specified time is earlier than the last-device-grab time or is
+   later than the current X server time. The X server
+   automatically performs an XIUngrabDevice request if the event
+   window for an active device grab becomes not viewable.
+
+   XIUngrabDevice can generate a BadDevice error.
+
+DIAGNOSTICS
+-----------
+
+   BadValue
+          A value is outside of the permitted range.
+
+   BadDevice
+          An invalid device was specified. The device does not
+          exist or is not a appropriate for the type of change.
+
+   BadMatch
+          The window is not viewable.
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          Window.
+
+SEE ALSO
+--------
+   XIAllowEvents(libmansuffix)
+
diff --git a/man/XIGrabEnter.man b/man/XIGrabEnter.man
new file mode 100755 (executable)
index 0000000..4f68d86
--- /dev/null
@@ -0,0 +1,328 @@
+'\" t
+.\"     Title: xigrabenter
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 10/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XIGRABENTER" "libmansuffix" "10/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XIGrabEnter, XIUngrabEnter, XIGrabFocusIn, XIUngrabFocusIn \- grab/ungrab enter or focus in events\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+int XIGrabEnter( Display *display,
+                 int deviceid,
+                 Window grab_window
+                 Cursor cursor,
+                 int grab_mode,
+                 int paired_device_mode,
+                 Bool owner_events,
+                 XIEventMask *mask,
+                 int num_modifiers,
+                 XIGrabModifiers *modifiers_inout);
+.fi
+.sp
+.nf
+int XIUngrabEnter( Display *display,
+                   int deviceid,
+                   Window grab_window
+                   int num_modifiers,
+                   XIGrabModifiers *modifiers);
+.fi
+.sp
+.nf
+int XIGrabFocusIn ( Display *display,
+                    int deviceid,
+                    Window grab_window
+                    int grab_mode,
+                    int paired_device_mode,
+                    Bool owner_events,
+                    XIEventMask *mask,
+                    int num_modifiers,
+                    XIGrabModifiers *modifiers_inout);
+.fi
+.sp
+.nf
+int XIUngrabFocusIn( Display *display,
+                     int deviceid,
+                     Window grab_window
+                     int num_modifiers,
+                     XIGrabModifiers *modifiers);
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device that is to be grabbed or released
+.fi
+.sp
+.nf
+num_modifiers
+       Number of elements in modifiers or modifiers_return
+.fi
+.sp
+.nf
+modifiers
+       Specifies the set of latched and base modifiers or
+       XIAnyModifier to ungrab\&. The data type is for
+       consistency with the respective grab request and the
+       status code of the XIGrabModifiers struct is ignored\&.
+.fi
+.sp
+.nf
+modifiers_inout
+       Specifies the set of latched and base modifiers or
+       XIAnyModifier to grab\&. Returns the modifiers that could
+       not be grabbed and their status code\&.
+.fi
+.sp
+.nf
+grab_window
+       Specifies the grab window\&.
+.fi
+.sp
+.nf
+owner_events
+       Specifies a Boolean value that indicates whether the are
+       to be reported as usual or reported with respect to the
+       grab window\&.
+.fi
+.sp
+.nf
+mask
+       Specifies the event mask\&.
+.fi
+.sp
+.nf
+grab_mode
+       Specifies further processing of events from this device\&.
+       You can pass GrabModeSync or GrabModeAsync\&.
+.fi
+.sp
+.nf
+paired_device_mode
+       Specifies further processing of events from the paired
+       master device\&. You can pass GrabModeSync or
+       GrabModeAsync\&. If deviceid specifies a floating slave
+       device, this parameter is ignored\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIGrabEnter and XIGrabFocusIn establish a passive grab\&. The
+modifier device for a enter grab is the paired master device if
+deviceid specifies a master pointer\&. Otherwise, the modifier
+device is the device specified with deviceid\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+For XIGrabEnter and XIGrabFocusIn, in the future, the device is
+actively grabbed (as for XIGrabDevice, the last\-grab time is
+set to the time at which the pointer/focus entered window) if
+the device is not grabbed and the pointer has entered the
+grab_window or the focus has been set to the grab_window when
+the specified modifier keys are logically down on the modifier
+device and no other buttons or modifier keys are logically
+down\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The interpretation of the remaining arguments is as for
+XIGrabDevice\&. The active grab is terminated automatically when
+the pointer leaves the window or the focus is set to a
+different window (independent of the logical state of the
+modifier keys)\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the device is an attached slave device, the device is
+automatically detached from the master device when the grab
+activates and reattached to the same master device when the
+grab deactivates\&. If the master device is removed while the
+device is floating as a result of a grab, the device remains
+floating once the grab deactivates\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Note that the logical state of a device (as seen by client
+applications) may lag the physical state if device event
+processing is frozen\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+This request overrides all previous grabs by the same client of
+the same type and modifier combinations on the same window\&. A
+modifiers of XIAnyModifier is equivalent to issuing the grab
+request for all possible modifier combinations (including the
+combination of no modifiers)\&. It is not required that all
+modifiers specified have currently assigned KeyCodes\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If some other client has already issued a XIGrabEnter or
+XIGrabFocusIn  on the same window, a BadAccess error results\&.
+When using XIAnyModifier, the request fails completely, and a
+XIBadAccess error results (no grabs are established) if there
+is a conflicting grab for any combination\&. XIGrabEnter and
+XIGrabFocusin have no effect on an active grab\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIGrabEnter and XIGrabFocusIn can generate BadDevice,
+BadMatch, BadValue, and BadWindow errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIUngrabEnter and XIUngrabFocusIn releases the passive grab on
+the specified window if it was grabbed by this client\&. A
+modifier of XIAnyModifier is equivalent to issuing the ungrab
+request for all possible modifier combinations, including the
+combination of no modifiers\&. XIUngrabEnter and XIUngrabFocusIn
+have no effect on an active grab\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIUngrabEnter and XIUngrabFocusIn can generate BadDevice,
+BadMatch, BadValue and BadWindow errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid deviceid was specified\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if XIGrabEnter specified a device
+       that has no valuators, or XIGrabFocusIn specified a device
+       that has no keys\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       Some numeric value falls outside the range of values
+       accepted by the request\&. Unless a specific range is
+       specified for an argument, the full range defined by the
+       argument\'s type is accepted\&. Any argument defined as a
+       set of alternatives can generate this error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       Window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIAllowEvents(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XIGrabEnter.txt b/man/XIGrabEnter.txt
new file mode 100755 (executable)
index 0000000..005a72b
--- /dev/null
@@ -0,0 +1,176 @@
+XIGRABENTER(libmansuffix)
+=========================
+
+NAME
+----
+
+   XIGrabEnter, XIUngrabEnter, XIGrabFocusIn, XIUngrabFocusIn -
+   grab/ungrab enter or focus in events.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   int XIGrabEnter( Display *display,
+                    int deviceid,
+                    Window grab_window
+                    Cursor cursor,
+                    int grab_mode,
+                    int paired_device_mode,
+                    Bool owner_events,
+                    XIEventMask *mask,
+                    int num_modifiers,
+                    XIGrabModifiers *modifiers_inout);
+
+   int XIUngrabEnter( Display *display,
+                      int deviceid,
+                      Window grab_window
+                      int num_modifiers,
+                      XIGrabModifiers *modifiers);
+
+   int XIGrabFocusIn ( Display *display,
+                       int deviceid,
+                       Window grab_window
+                       int grab_mode,
+                       int paired_device_mode,
+                       Bool owner_events,
+                       XIEventMask *mask,
+                       int num_modifiers,
+                       XIGrabModifiers *modifiers_inout);
+
+   int XIUngrabFocusIn( Display *display,
+                        int deviceid,
+                        Window grab_window
+                        int num_modifiers,
+                        XIGrabModifiers *modifiers);
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device that is to be grabbed or released
+
+   num_modifiers
+          Number of elements in modifiers or modifiers_return
+
+   modifiers
+          Specifies the set of latched and base modifiers or
+          XIAnyModifier to ungrab. The data type is for
+          consistency with the respective grab request and the
+          status code of the XIGrabModifiers struct is ignored.
+
+   modifiers_inout
+          Specifies the set of latched and base modifiers or
+          XIAnyModifier to grab. Returns the modifiers that could
+          not be grabbed and their status code.
+
+   grab_window
+          Specifies the grab window.
+
+   owner_events
+          Specifies a Boolean value that indicates whether the are
+          to be reported as usual or reported with respect to the
+          grab window.
+
+   mask
+          Specifies the event mask.
+
+   grab_mode
+          Specifies further processing of events from this device.
+          You can pass GrabModeSync or GrabModeAsync.
+
+   paired_device_mode
+          Specifies further processing of events from the paired
+          master device. You can pass GrabModeSync or
+          GrabModeAsync. If deviceid specifies a floating slave
+          device, this parameter is ignored.
+
+DESCRIPTION
+-----------
+
+   XIGrabEnter and XIGrabFocusIn establish a passive grab. The
+   modifier device for a enter grab is the paired master device if
+   deviceid specifies a master pointer. Otherwise, the modifier
+   device is the device specified with deviceid.
+
+   For XIGrabEnter and XIGrabFocusIn, in the future, the device is
+   actively grabbed (as for XIGrabDevice, the last-grab time is
+   set to the time at which the pointer/focus entered window) if
+   the device is not grabbed and the pointer has entered the
+   grab_window or the focus has been set to the grab_window when
+   the specified modifier keys are logically down on the modifier
+   device and no other buttons or modifier keys are logically
+   down.
+
+   The interpretation of the remaining arguments is as for
+   XIGrabDevice. The active grab is terminated automatically when
+   the pointer leaves the window or the focus is set to a
+   different window (independent of the logical state of the
+   modifier keys).
+
+   If the device is an attached slave device, the device is
+   automatically detached from the master device when the grab
+   activates and reattached to the same master device when the
+   grab deactivates. If the master device is removed while the
+   device is floating as a result of a grab, the device remains
+   floating once the grab deactivates.
+
+   Note that the logical state of a device (as seen by client
+   applications) may lag the physical state if device event
+   processing is frozen.
+
+   This request overrides all previous grabs by the same client of
+   the same type and modifier combinations on the same window. A
+   modifiers of XIAnyModifier is equivalent to issuing the grab
+   request for all possible modifier combinations (including the
+   combination of no modifiers). It is not required that all
+   modifiers specified have currently assigned KeyCodes.
+
+   If some other client has already issued a XIGrabEnter or
+   XIGrabFocusIn  on the same window, a BadAccess error results.
+   When using XIAnyModifier, the request fails completely, and a
+   XIBadAccess error results (no grabs are established) if there
+   is a conflicting grab for any combination. XIGrabEnter and
+   XIGrabFocusin have no effect on an active grab.
+
+   XIGrabEnter and XIGrabFocusIn can generate BadDevice,
+   BadMatch, BadValue, and BadWindow errors.
+
+   XIUngrabEnter and XIUngrabFocusIn releases the passive grab on
+   the specified window if it was grabbed by this client. A
+   modifier of XIAnyModifier is equivalent to issuing the ungrab
+   request for all possible modifier combinations, including the
+   combination of no modifiers. XIUngrabEnter and XIUngrabFocusIn
+   have no effect on an active grab.
+
+   XIUngrabEnter and XIUngrabFocusIn can generate BadDevice,
+   BadMatch, BadValue and BadWindow errors.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid deviceid was specified.
+
+   BadMatch
+          This error may occur if XIGrabEnter specified a device
+          that has no valuators, or XIGrabFocusIn specified a device
+          that has no keys.
+
+   BadValue
+          Some numeric value falls outside the range of values
+          accepted by the request. Unless a specific range is
+          specified for an argument, the full range defined by the
+          argument's type is accepted. Any argument defined as a
+          set of alternatives can generate this error.
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          Window.
+
+SEE ALSO
+--------
+
+   XIAllowEvents(libmansuffix)
+
+
diff --git a/man/XIGrabFocusIn.man b/man/XIGrabFocusIn.man
new file mode 100755 (executable)
index 0000000..ebd8b17
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XIGrabEnter.libmansuffix
diff --git a/man/XIGrabKeycode.man b/man/XIGrabKeycode.man
new file mode 100755 (executable)
index 0000000..beed4f1
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XIGrabButton.libmansuffix
diff --git a/man/XIListProperties.man b/man/XIListProperties.man
new file mode 100755 (executable)
index 0000000..411b6dc
--- /dev/null
@@ -0,0 +1,61 @@
+'\" t
+.\"     Title: xilistproperties
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XILISTPROPERTIES" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XIListProperties \- List a device\'s properties\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput2\&.h>
+.fi
+.sp
+.nf
+Atom* XListProperties( Display *display,
+                       int deviceid,
+                       int *nprops_return);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+deviceid
+       The device to list the properties for\&.
+.fi
+.sp
+.nf
+nprops_return
+       Specifies the number of Atoms returned\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+The XIListProperties function returns a list of the properties associated with the input device specified with deviceid\&. Each device may have an arbitrary number of properties attached, some of which were created by the driver and/or server, others created by clients at runtime\&.
+.sp
+The client is expected to free the list of properties using XFree\&.
+.sp
+XIListProperties can generate a BadDevice error\&.
+.SH "DIAGNOSTICS"
+.sp
+BadDevice An invalid device was specified\&. The device does not exist\&.
+.SH "SEE ALSO"
+.sp
+XIChangeProperty(libmansuffix), XIGetProperty(libmansuffix), XIDeleteProperty(libmansuffix)
diff --git a/man/XIListProperties.txt b/man/XIListProperties.txt
new file mode 100755 (executable)
index 0000000..de374cb
--- /dev/null
@@ -0,0 +1,54 @@
+XILISTPROPERTIES(libmansuffix)
+=============================
+
+NAME
+----
+
+   XIListProperties - List a device's properties.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput2.h>
+
+   Atom* XListProperties( Display *display,
+                          int deviceid,
+                          int *nprops_return);
+
+   display
+          Specifies the connection to the X server.
+
+   deviceid
+          The device to list the properties for.
+
+   nprops_return
+          Specifies the number of Atoms returned.
+
+
+DESCRIPTION
+-----------
+
+The XIListProperties function returns a list of the
+properties associated with the input device specified with 
+deviceid. Each device may have an arbitrary number of properties
+attached, some of which were created by the driver and/or
+server, others created by clients at runtime.
+
+The client is expected to free the list of properties using
+XFree.
+
+XIListProperties can generate a BadDevice error.
+
+DIAGNOSTICS
+-----------
+
+BadDevice
+        An invalid device was specified. The device does not
+        exist.
+
+SEE ALSO
+--------
+
+XIChangeProperty(libmansuffix),
+XIGetProperty(libmansuffix),
+XIDeleteProperty(libmansuffix)
diff --git a/man/XIQueryDevice.man b/man/XIQueryDevice.man
new file mode 100755 (executable)
index 0000000..179b357
--- /dev/null
@@ -0,0 +1,493 @@
+'\" t
+.\"     Title: xiquerydevice
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 10/20/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XIQUERYDEVICE" "libmansuffix" "10/20/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XIQueryDevice, XIFreeDeviceInfo \- get information about devices\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput2\&.h>
+.fi
+.sp
+.nf
+XIDeviceInfo* XIQueryDevice( Display *display,
+                             int deviceid,
+                             int *ndevices_return);
+.fi
+.sp
+.nf
+XIFreeDeviceInfo( XIDeviceInfo *info);
+.fi
+.sp
+.nf
+deviceid
+       Specifies the device to query or XIAllDevices or
+       XIAllMasterDevices\&.
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+ndevices_return
+       Returns the number of devices returned\&.
+.fi
+.sp
+.nf
+info
+       A list of device XIDeviceInfo structs to be freed\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XIQueryDevice returns information about one or more input
+devices\&. If the deviceid specifies a device, ndevices_return is
+1 and the returned information describes only the requested
+device\&. If deviceid is XIAllDevices or XIAllMasterDevices,
+ndevices_return is the number of devices or master devices,
+respectively, and the returned information represents all
+devices or all master devices, respectively\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+To free the XIDeviceInfo array returned by XIQueryDevice, use
+XIFreeDeviceInfo\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+For each input device requested, the XIQueryDevice returns an
+XIDeviceInfo structure\&. Each structure contains information
+about the capabilities of one input device available to the
+server\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct
+{
+    int                 deviceid;
+    char                *name;
+    int                 use;
+    int                 attachment;
+    Bool                enabled;
+    int                 num_classes;
+    XIAnyClassInfo      **classes;
+} XIDeviceInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The deviceid is the numeric unique id of the device\&. A deviceid
+is unique for the life\-time of a device but a server may re\-use
+the id once a device has been removed\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The name points to a null\-terminated string specifying the
+identifier of the device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The use and attachment fields specify the type of the device
+and the current attachment or pairing\&.
+\- If use is XIMasterPointer, the device is a master pointer and
+  attachment specifies the deviceid of the paired master
+  keyboard\&.
+\- If use is XIMasterKeyboard, the device is a master keyboard,
+  and the attachment field specifies the paired master pointer\&.
+\- If use is XISlavePointer, the device is a slave device and
+  currently attached to the master pointer specified in
+  attachement\&.
+\- If use is XISlaveKeyboard, the device is a slave device an
+  currently attached to the master keyboard specified in
+  attachment\&.
+\- If use is XIFloatingSlave, the device is a slave device
+  currently not attached to any master device\&. The value of the
+  attachment field for floating slave devices is undefined\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The enabled field specifies if the device is currently enabled
+and can send events\&. Disabled devices will not send events\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The num_classes field specifies the number of input classes
+pointed to by classes\&. The first two fields of all input
+classes are identical\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct
+{
+    int         type;
+    int         sourceid;
+} XIAnyClassInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The type field specifies the type of the input class\&.
+Currently, the following types are defined:
+    XIKeyClass, XIButtonClass, XIValuatorClass
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+In the future, additional types may be added\&. Clients are
+required to ignore unknown input classes\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The sourceid is the deviceid this class originated from\&. For
+master devices, the sourceid is typically the id of the slave
+device currently sending events\&. For slave devices, the
+sourceid is typically the device\'s id\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+A device may have zero or one XIButtonClass, denoting the
+device\'s capability to send button events\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    int           mask_len;
+    unsigned char *mask;
+} XIButtonState;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct
+{
+    int         type;
+    int         sourceid;
+    int         num_buttons;
+    Atom        *labels;
+    XIButtonState state;
+} XIButtonClassInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The num_buttons field specifies the number of buttons available
+on this device\&. A device that has an XIButtonClass must have at
+least one button\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+labels is a list of num_buttons Atoms specifying the button
+labels for this device\&. If the label is not None, then the
+label specifies the type of button in physical device order
+(i\&.e\&. as the buttons are numbered on the physical input
+device)\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The state is the current button state as seen by clients (i\&.e\&.
+after button mapping is applied)\&. The mask_len field specifies
+the length of mask in bytes\&. For each button on the device, the
+respective bit in mask is set if the button is currently
+logically down\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+A device may have zero or one XIKeyClass, denoting the device\'s
+capability to send key events\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct
+{
+    int         type;
+    int         sourceid;
+    int         num_keycodes;
+    int         *keycodes;
+} XIKeyClassInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The num_keycodes field specifies the number of keycodes
+available on this device\&. A device that has an XIKeyClass must
+have at least one keycode\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+keycodes is a list of num_keycodes keycodes the device may
+send\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+A device may have zero or more XIValuatorClass, denoting the
+device\'s capability to send coordinates\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct
+{
+    int         type;
+    int         sourceid;
+    int         number;
+    Atom        label;
+    double      min;
+    double      max;
+    double      value;
+    int         resolution;
+    int         mode;
+} XIValuatorInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The number field specifies the number of the axis on the
+physical device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the label field is not None, the value of label is an Atom
+describing the axis\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+min and max are the minimum and maximum values allowed on this
+axis\&. If both are zero, no minumum or maximum values are set on
+this device\&. value is the current value of this axis\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The resolution field specifies the resolution of the device in
+units/m\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The mode specifies the mode of this axis\&. If the mode is
+XIModeAbsolute this axis sends absolute coordinates\&. If the
+mode is XIModeRelative, this device sends relative coordinates\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIQueryDevice can generate a BadDevice error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIFreeDeviceInfo frees the information returned by
+XIQueryDevice\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The device does not
+       exist or is not a pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XIQueryDevice.txt b/man/XIQueryDevice.txt
new file mode 100755 (executable)
index 0000000..2b1f76f
--- /dev/null
@@ -0,0 +1,208 @@
+XIQUERYDEVICE(libmansuffix)
+============================
+
+NAME
+----
+
+   XIQueryDevice, XIFreeDeviceInfo - get information about devices.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput2.h>
+
+   XIDeviceInfo* XIQueryDevice( Display *display,
+                                int deviceid,
+                                int *ndevices_return);
+
+   XIFreeDeviceInfo( XIDeviceInfo *info);
+
+   deviceid
+          Specifies the device to query or XIAllDevices or
+          XIAllMasterDevices.
+
+   display
+          Specifies the connection to the X server.
+
+   ndevices_return
+          Returns the number of devices returned.
+
+   info
+          A list of device XIDeviceInfo structs to be freed.
+
+
+DESCRIPTION
+-----------
+
+   The XIQueryDevice returns information about one or more input
+   devices. If the deviceid specifies a device, ndevices_return is
+   1 and the returned information describes only the requested
+   device. If deviceid is XIAllDevices or XIAllMasterDevices,
+   ndevices_return is the number of devices or master devices,
+   respectively, and the returned information represents all
+   devices or all master devices, respectively.
+
+   To free the XIDeviceInfo array returned by XIQueryDevice, use
+   XIFreeDeviceInfo.
+
+   For each input device requested, the XIQueryDevice returns an
+   XIDeviceInfo structure. Each structure contains information
+   about the capabilities of one input device available to the
+   server.
+
+                typedef struct
+                {
+                    int                 deviceid;
+                    char                *name;
+                    int                 use;
+                    int                 attachment;
+                    Bool                enabled;
+                    int                 num_classes;
+                    XIAnyClassInfo      **classes;
+                } XIDeviceInfo;
+
+   The deviceid is the numeric unique id of the device. A deviceid
+   is unique for the life-time of a device but a server may re-use
+   the id once a device has been removed.
+
+   The name points to a null-terminated string specifying the
+   identifier of the device.
+
+   The use and attachment fields specify the type of the device
+   and the current attachment or pairing.
+   - If use is XIMasterPointer, the device is a master pointer and
+     attachment specifies the deviceid of the paired master
+     keyboard.
+   - If use is XIMasterKeyboard, the device is a master keyboard,
+     and the attachment field specifies the paired master pointer.
+   - If use is XISlavePointer, the device is a slave device and
+     currently attached to the master pointer specified in
+     attachement.
+   - If use is XISlaveKeyboard, the device is a slave device an
+     currently attached to the master keyboard specified in
+     attachment.
+   - If use is XIFloatingSlave, the device is a slave device
+     currently not attached to any master device. The value of the
+     attachment field for floating slave devices is undefined.
+
+   The enabled field specifies if the device is currently enabled
+   and can send events. Disabled devices will not send events.
+
+   The num_classes field specifies the number of input classes
+   pointed to by classes. The first two fields of all input
+   classes are identical.
+
+                typedef struct
+                {
+                    int         type;
+                    int         sourceid;
+                } XIAnyClassInfo;
+
+   The type field specifies the type of the input class.
+   Currently, the following types are defined:
+       XIKeyClass, XIButtonClass, XIValuatorClass
+
+   In the future, additional types may be added. Clients are
+   required to ignore unknown input classes.
+
+   The sourceid is the deviceid this class originated from. For
+   master devices, the sourceid is typically the id of the slave
+   device currently sending events. For slave devices, the
+   sourceid is typically the device's id.
+
+   A device may have zero or one XIButtonClass, denoting the
+   device's capability to send button events.
+
+               typedef struct {
+                   int           mask_len;
+                   unsigned char *mask;
+               } XIButtonState;
+
+               typedef struct
+               {
+                   int         type;
+                   int         sourceid;
+                   int         num_buttons;
+                   Atom        *labels;
+                   XIButtonState state;
+               } XIButtonClassInfo;
+
+   The num_buttons field specifies the number of buttons available
+   on this device. A device that has an XIButtonClass must have at
+   least one button.
+
+   labels is a list of num_buttons Atoms specifying the button
+   labels for this device. If the label is not None, then the
+   label specifies the type of button in physical device order
+   (i.e. as the buttons are numbered on the physical input
+   device).
+
+   The state is the current button state as seen by clients (i.e.
+   after button mapping is applied). The mask_len field specifies
+   the length of mask in bytes. For each button on the device, the
+   respective bit in mask is set if the button is currently
+   logically down.
+
+   A device may have zero or one XIKeyClass, denoting the device's
+   capability to send key events.
+
+               typedef struct
+               {
+                   int         type;
+                   int         sourceid;
+                   int         num_keycodes;
+                   int         *keycodes;
+               } XIKeyClassInfo;
+
+   The num_keycodes field specifies the number of keycodes
+   available on this device. A device that has an XIKeyClass must
+   have at least one keycode.
+
+   keycodes is a list of num_keycodes keycodes the device may
+   send.
+
+   A device may have zero or more XIValuatorClass, denoting the
+   device's capability to send coordinates.
+
+               typedef struct
+               {
+                   int         type;
+                   int         sourceid;
+                   int         number;
+                   Atom        label;
+                   double      min;
+                   double      max;
+                   double      value;
+                   int         resolution;
+                   int         mode;
+               } XIValuatorInfo;
+
+   The number field specifies the number of the axis on the
+   physical device.
+
+   If the label field is not None, the value of label is an Atom
+   describing the axis.
+
+   min and max are the minimum and maximum values allowed on this
+   axis. If both are zero, no minumum or maximum values are set on
+   this device. value is the current value of this axis.
+
+   The resolution field specifies the resolution of the device in
+   units/m.
+
+   The mode specifies the mode of this axis. If the mode is
+   XIModeAbsolute this axis sends absolute coordinates. If the
+   mode is XIModeRelative, this device sends relative coordinates.
+
+   XIQueryDevice can generate a BadDevice error.
+
+   XIFreeDeviceInfo frees the information returned by
+   XIQueryDevice.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The device does not
+          exist or is not a pointer device.
+
diff --git a/man/XIQueryPointer.man b/man/XIQueryPointer.man
new file mode 100755 (executable)
index 0000000..278f21e
--- /dev/null
@@ -0,0 +1,185 @@
+'\" t
+.\"     Title: xiquerypointer
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 10/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XIQUERYPOINTER" "libmansuffix" "10/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XIQueryPointer \- get device pointer coordinates\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput2\&.h>
+.fi
+.sp
+.nf
+Bool XIQueryPointer( Display *display,
+                     int deviceid,
+                     Window win,
+                     Window *root_return,
+                     Window *child_return,
+                     double *root_x_return,
+                     double *root_y_return,
+                     double *win_x_return,
+                     double *win_y_return,
+                     XIButtonState *buttons_return,
+                     XIModifierState *modifiers_return,
+                     XIGroupState *group_return);
+.fi
+.sp
+.nf
+buttons_return
+       Returns the current button state\&.
+.fi
+.sp
+.nf
+child_return
+       Returns the child window that the pointer is located in,
+       if any\&.
+.fi
+.sp
+.nf
+deviceid
+       Specifies the device to query\&.
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+group_return
+       Returns the current group state\&.
+.fi
+.sp
+.nf
+modifiers_return
+       Returns the current state of the modifier keys\&.
+.fi
+.sp
+.nf
+root_return
+       Returns the root window that the pointer is in\&.
+.fi
+.sp
+.nf
+root_x_return, root_y_return
+       Return the pointer coordinates relative to the root
+       window\'s origin\&.
+.fi
+.sp
+.nf
+win
+       Specifies the window\&.
+.fi
+.sp
+.nf
+win_x_return, win_y_return
+       Return the pointer coordinates relative to the specified
+       window\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XIQueryPointer function returns the root window the
+device\'s pointer is logically on and the pointer coordinates
+relative to the root window\'s origin\&. If XIQueryPointer returns
+False, the pointer is not on the same screen as the specified
+window, and XIQueryPointer returns None to child_return and
+zero to win_x_return and win_y_return\&. If XIQueryPointer
+returns True, the pointer coordinates returned to win_x_return
+and win_y_return are relative to the origin of the specified
+window\&. In this case, XIQueryPointer returns the child that
+contains the pointer, if any, or else None to child_return\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIQueryPointer returns the current logical state of the buttons
+buttons_return\&. The keyboard paired with the master pointer is
+selected to obtain the data for modifiers_return and
+group_return\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIQueryPointer is identical to XQueryPointer but specifies the
+device explicitly\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIQueryPointer can generate a BadDevice and a BadWindow error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The device does not
+       exist or is not a pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XQueryPointer(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XIQueryPointer.txt b/man/XIQueryPointer.txt
new file mode 100755 (executable)
index 0000000..445f8b5
--- /dev/null
@@ -0,0 +1,99 @@
+XIQUERYPOINTER(libmansuffix)
+============================
+
+NAME
+----
+
+   XIQueryPointer - get device pointer coordinates.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput2.h>
+
+   Bool XIQueryPointer( Display *display,
+                        int deviceid,
+                        Window win,
+                        Window *root_return,
+                        Window *child_return,
+                        double *root_x_return,
+                        double *root_y_return,
+                        double *win_x_return,
+                        double *win_y_return,
+                        XIButtonState *buttons_return,
+                        XIModifierState *modifiers_return,
+                        XIGroupState *group_return);
+
+   buttons_return
+          Returns the current button state.
+
+   child_return
+          Returns the child window that the pointer is located in,
+          if any.
+
+   deviceid
+          Specifies the device to query.
+
+   display
+          Specifies the connection to the X server.
+
+   group_return
+          Returns the current group state.
+
+   modifiers_return
+          Returns the current state of the modifier keys.
+
+   root_return
+          Returns the root window that the pointer is in.
+
+   root_x_return, root_y_return
+          Return the pointer coordinates relative to the root
+          window's origin.
+
+   win
+          Specifies the window.
+
+   win_x_return, win_y_return
+          Return the pointer coordinates relative to the specified
+          window.
+
+DESCRIPTION
+-----------
+
+   The XIQueryPointer function returns the root window the
+   device's pointer is logically on and the pointer coordinates
+   relative to the root window's origin. If XIQueryPointer returns
+   False, the pointer is not on the same screen as the specified
+   window, and XIQueryPointer returns None to child_return and
+   zero to win_x_return and win_y_return. If XIQueryPointer
+   returns True, the pointer coordinates returned to win_x_return
+   and win_y_return are relative to the origin of the specified
+   window. In this case, XIQueryPointer returns the child that
+   contains the pointer, if any, or else None to child_return.
+
+   XIQueryPointer returns the current logical state of the buttons
+   buttons_return. The keyboard paired with the master pointer is
+   selected to obtain the data for modifiers_return and
+   group_return.
+
+   XIQueryPointer is identical to XQueryPointer but specifies the
+   device explicitly.
+
+   XIQueryPointer can generate a BadDevice and a BadWindow error.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The device does not
+          exist or is not a pointer device.
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          window.
+
+SEE ALSO
+--------
+
+   XQueryPointer(libmansuffix)
+
diff --git a/man/XIQueryVersion.man b/man/XIQueryVersion.man
new file mode 100755 (executable)
index 0000000..fa79605
--- /dev/null
@@ -0,0 +1,131 @@
+'\" t
+.\"     Title: xiqueryversion
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XIQUERYVERSION" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XIQueryVersion \- announce and query the support XI2 version\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput2\&.h>
+.fi
+.sp
+.nf
+Status XIQueryVersion( Display *display,
+                       int *major_version_inout,
+                       int *minor_version_inout);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+major_version_inout
+       Specifies the client\'s supported XI2 version, and
+       returns the server\'s supported version\&.
+.fi
+.sp
+.nf
+minor_version_inout
+       Specifies the client\'s supported XI2 version, and
+       returns the server\'s supported version\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIQueryVersion announces the client\'s supported XI2 version to
+the server and returns server\'s supported X Input version\&. Clients
+are required to use XIQueryVersion instead of XGetExtensionVersion
+if they use XI2 calls\&. The server may treat a client differently
+depending on the supported version announced by the client\&.
+The major_version_inout must be 2 or greater, otherwise a BadValue
+error occurs\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the server does not support XI2, XIQueryVersion returns BadRequest
+to the client\&. Otherwise, XIQueryVersion returns Success\&. In both
+cases major_version_inout and minor_version_inout are set to the
+server\'s supported version\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIQueryVersion can generate a BadValue error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "EXAMPLES"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+int rc;
+int major = 2;
+int minor = 0;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+rc = XIQueryVersion(dpy, &major, &minor);
+if (rc == Success)
+    printf("XI2 supported\&. (%d\&.%d)\en", major, minor);
+else if (rc == BadRequest)
+    printf("No XI2 support\&. (%d\&.%d only)\en", major, minor);
+else
+    printf("Internal error\en");
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       A value is outside of the permitted range\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XIQueryVersion.txt b/man/XIQueryVersion.txt
new file mode 100755 (executable)
index 0000000..53118ed
--- /dev/null
@@ -0,0 +1,68 @@
+XIQUERYVERSION(libmansuffix)
+============================
+
+NAME
+----
+
+   XIQueryVersion - announce and query the support XI2 version.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput2.h>
+
+   Status XIQueryVersion( Display *display,
+                          int *major_version_inout,
+                          int *minor_version_inout);
+   
+   display
+          Specifies the connection to the X server.
+
+   major_version_inout
+          Specifies the client's supported XI2 version, and
+          returns the server's supported version.
+
+   minor_version_inout
+          Specifies the client's supported XI2 version, and
+          returns the server's supported version.
+
+DESCRIPTION
+-----------
+
+   XIQueryVersion announces the client's supported XI2 version to
+   the server and returns server's supported X Input version. Clients 
+   are required to use XIQueryVersion instead of XGetExtensionVersion 
+   if they use XI2 calls. The server may treat a client differently 
+   depending on the supported version announced by the client.
+   The major_version_inout must be 2 or greater, otherwise a BadValue 
+   error occurs.
+
+   If the server does not support XI2, XIQueryVersion returns BadRequest 
+   to the client. Otherwise, XIQueryVersion returns Success. In both 
+   cases major_version_inout and minor_version_inout are set to the 
+   server's supported version.
+
+   XIQueryVersion can generate a BadValue error.
+
+
+EXAMPLES
+--------
+
+        int rc;
+        int major = 2;
+        int minor = 0;
+
+        rc = XIQueryVersion(dpy, &major, &minor);
+        if (rc == Success)
+            printf("XI2 supported. (%d.%d)\n", major, minor);
+        else if (rc == BadRequest)
+            printf("No XI2 support. (%d.%d only)\n", major, minor);
+        else
+            printf("Internal error\n");
+
+DIAGNOSTICS
+-----------
+
+   BadValue
+          A value is outside of the permitted range.
+
diff --git a/man/XISelectEvents.man b/man/XISelectEvents.man
new file mode 100755 (executable)
index 0000000..2296707
--- /dev/null
@@ -0,0 +1,214 @@
+'\" t
+.\"     Title: xiselectevents
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XISELECTEVENTS" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XISelectEvents, XIGetSelectedEvents \- select for or get selected XI2 events on the window\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput2\&.h>
+.fi
+.sp
+.nf
+Status XISelectEvents( Display *display,
+                       Window win,
+                       XIEventMask *masks,
+                       int num_masks);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+masks
+       Device event mask\&.
+.fi
+.sp
+.nf
+num_masks
+       Number of masks in masks\&.
+.fi
+.sp
+.nf
+win
+       Specifies the window\&.
+.fi
+.sp
+.nf
+XIEventMask *XIGetSelectedEvents( Display *display,
+                                  Window win,
+                                  int *num_masks_return);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+num_masks_return
+       Number of masks in the return value\&.
+.fi
+.sp
+.nf
+win
+       Specifies the window\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XI2 events must be selected using XISelectEvents\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XISelectEvents sets the event mask for this client on win\&.
+Further events are only reported to this client if the event
+type matches the selected event mask\&. The masks overrides the
+previously selected event mask for the given device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If deviceid is a valid device, the event mask is selected only
+for this device\&. If deviceid is XIAllDevices or
+XIAllMasterDevices, the event mask is selected for all devices
+or all master devices, respectively\&. The effective event mask
+is the bit\-wise OR of the XIAllDevices, XIAllMasterDevices and
+the respective device\'s event mask\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    int deviceid;
+    int mask_len;
+    unsigned char* mask;
+} XIEventMask;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The mask_len specifies the length of mask in bytes\&. mask is a
+binary mask in the form of (1 << event type)\&. deviceid must be
+either a device or XIAllDevices or XIAllMasterDevices\&. A client
+may submit several masks with the same deviceid in one request
+but only the last mask will be effective\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XISelectEvents can generate a BadValue, a BadDevice, and a
+BadWindow error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIGetSelectedEvents returns the events selected by this client on the given
+window\&. If no events were selected on this window, XIGetSelectedEvents
+returns NULL and num_masks_return is set to 0\&. If an internal error occurs,
+XIGetSelectedEvents returns NULL and num_masks_return is set to \-1\&.
+Otherwise, XIGetSelectedEvent returns the selected event masks for all
+devices including the masks for XIAllDevices and XIAllMasterDevices
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The caller must free the returned data using XFree()\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       A value is outside of the permitted range\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The device does not
+       exist\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XISelectEvents.txt b/man/XISelectEvents.txt
new file mode 100755 (executable)
index 0000000..07b3c8e
--- /dev/null
@@ -0,0 +1,98 @@
+XISELECTEVENTS(libmansuffix)
+============================
+
+NAME
+----
+
+   XISelectEvents, XIGetSelectedEvents - select for or get selected XI2 events on the window.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput2.h>
+
+   Status XISelectEvents( Display *display,
+                          Window win,
+                          XIEventMask *masks,
+                          int num_masks);
+
+   display
+          Specifies the connection to the X server.
+
+   masks
+          Device event mask.
+
+   num_masks
+          Number of masks in masks.
+
+   win
+          Specifies the window.
+
+   XIEventMask *XIGetSelectedEvents( Display *display,
+                                     Window win,
+                                     int *num_masks_return);
+   display
+          Specifies the connection to the X server.
+
+   num_masks_return
+          Number of masks in the return value.
+
+   win
+          Specifies the window.
+
+DESCRIPTION
+-----------
+
+   XI2 events must be selected using XISelectEvents.
+
+   XISelectEvents sets the event mask for this client on win.
+   Further events are only reported to this client if the event
+   type matches the selected event mask. The masks overrides the
+   previously selected event mask for the given device.
+
+   If deviceid is a valid device, the event mask is selected only
+   for this device. If deviceid is XIAllDevices or
+   XIAllMasterDevices, the event mask is selected for all devices
+   or all master devices, respectively. The effective event mask
+   is the bit-wise OR of the XIAllDevices, XIAllMasterDevices and
+   the respective device's event mask.
+
+            typedef struct {
+                int deviceid;
+                int mask_len;
+                unsigned char* mask;
+            } XIEventMask;
+
+   The mask_len specifies the length of mask in bytes. mask is a
+   binary mask in the form of (1 << event type). deviceid must be
+   either a device or XIAllDevices or XIAllMasterDevices. A client
+   may submit several masks with the same deviceid in one request
+   but only the last mask will be effective.
+
+   XISelectEvents can generate a BadValue, a BadDevice, and a
+   BadWindow error.
+
+   XIGetSelectedEvents returns the events selected by this client on the given
+   window. If no events were selected on this window, XIGetSelectedEvents
+   returns NULL and num_masks_return is set to 0. If an internal error occurs,
+   XIGetSelectedEvents returns NULL and num_masks_return is set to -1.
+   Otherwise, XIGetSelectedEvent returns the selected event masks for all
+   devices including the masks for XIAllDevices and XIAllMasterDevices
+
+   The caller must free the returned data using XFree().
+
+
+DIAGNOSTICS
+-----------
+
+   BadValue
+          A value is outside of the permitted range.
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          window.
+
+   BadDevice
+          An invalid device was specified. The device does not
+          exist.
diff --git a/man/XISetClientPointer.man b/man/XISetClientPointer.man
new file mode 100755 (executable)
index 0000000..f9cd102
--- /dev/null
@@ -0,0 +1,152 @@
+'\" t
+.\"     Title: xisetclientpointer
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XISETCLIENTPOINTER" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XISetClientPointer, XIGetClientPointer \- set or get the ClientPointer device\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput2\&.h>
+.fi
+.sp
+.nf
+XISetClientPointer( Display *display,
+                    Window win,
+                    int deviceid);
+.fi
+.sp
+.nf
+Bool XIGetClientPointer( Display *display,
+                         Window win,
+                         int *device);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+win
+       Specifies a window belonging to the client\&. May be None\&.
+.fi
+.sp
+.nf
+deviceid
+       Specifies the ClientPointer device\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The ClientPointer is the device that is percieved to be the
+core pointer for non\-XI protocol requests and replies\&. Each
+time a protocol message needs device\-dependent data and the
+device is not explicitly given, the ClientPointer device is
+used to obtain the data\&. For example, a XQueryPointer request
+will return the coordinates of the ClientPointer\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XISetClientPointer request sets the ClientPointer device for
+the client that owns the given window\&. If win is None, the
+requesting client\'s ClientPointer is set to the device
+specified with deviceid\&. Only master pointer devices can be set
+as ClientPointer\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XISetClientPointer and can generate a BadDevice and a BadWindow
+error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XIGetClientPointer request returns the ClientPointer\'s
+device ID for the client that owns the given window\&. If win is
+None, the requesting client\'s ClientPointer is returned\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+win may be a client ID instead of a window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIGetClientPointer can generate a BadWindow error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The device does not
+       exist or is not a master pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       window\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XISetClientPointer.txt b/man/XISetClientPointer.txt
new file mode 100755 (executable)
index 0000000..bb45cdc
--- /dev/null
@@ -0,0 +1,69 @@
+XISETCLIENTPOINTER(libmansuffix)
+================================
+
+NAME
+----
+
+   XISetClientPointer, XIGetClientPointer - set or get the
+   ClientPointer device.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput2.h>
+
+   XISetClientPointer( Display *display,
+                       Window win,
+                       int deviceid);
+   
+   Bool XIGetClientPointer( Display *display,
+                            Window win,
+                            int *device);
+
+   display
+          Specifies the connection to the X server.
+
+   win
+          Specifies a window belonging to the client. May be None.
+
+   deviceid
+          Specifies the ClientPointer device.
+
+DESCRIPTION
+-----------
+
+   The ClientPointer is the device that is percieved to be the
+   core pointer for non-XI protocol requests and replies. Each
+   time a protocol message needs device-dependent data and the
+   device is not explicitly given, the ClientPointer device is
+   used to obtain the data. For example, a XQueryPointer request
+   will return the coordinates of the ClientPointer.
+
+   XISetClientPointer request sets the ClientPointer device for
+   the client that owns the given window. If win is None, the
+   requesting client's ClientPointer is set to the device
+   specified with deviceid. Only master pointer devices can be set
+   as ClientPointer.
+
+   XISetClientPointer and can generate a BadDevice and a BadWindow
+   error.
+
+   The XIGetClientPointer request returns the ClientPointer's
+   device ID for the client that owns the given window. If win is
+   None, the requesting client's ClientPointer is returned.
+
+   win may be a client ID instead of a window.
+
+   XIGetClientPointer can generate a BadWindow error.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The device does not
+          exist or is not a master pointer device.
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          window.
+
diff --git a/man/XISetFocus.man b/man/XISetFocus.man
new file mode 100755 (executable)
index 0000000..afc9f7f
--- /dev/null
@@ -0,0 +1,182 @@
+'\" t
+.\"     Title: xisetfocus
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XISETFOCUS" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XISetFocus, XIGetFocus \- set or get the device\'s focus\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput2\&.h>
+.fi
+.sp
+.nf
+Status XISetFocus( Display *display,
+                   int deviceid,
+                   Window focus,
+                   Time time);
+.fi
+.sp
+.nf
+Status XIGetFocus( Display *display,
+                   Window *focus_return);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+deviceid
+       Specifies the device whose focus is to be queried or
+       changed\&.
+.fi
+.sp
+.nf
+focus
+       The new focus window\&.
+.fi
+.sp
+.nf
+focus_return
+       Returns the current focus window\&.
+.fi
+.sp
+.nf
+time
+       A valid timestamp or CurrentTime\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XISetFocus changes the focus of the specified device ans its
+last\-focus\-change time\&. It has no effect if the specified time
+is earlier than the current last\-focus\-change time or is later
+than the current X server time\&. Otherwise, the
+last\-focus\-change time is set to the specified time\&.
+CurrentTime is replaced by the current X server time)\&.
+XISetFocus causes the X server to generate core, XI and XI2
+focus events\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the focus window is None all keyboard events by this device
+are discarded until a new focus window is set\&. Otherwise, if
+focus is a window, it becomes the device\'s focus window\&. If a
+generated device event would normally be reported to this
+window or one of its inferiors, the event is reported as usual\&.
+Otherwise, the event is reported relative to the focus window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The specified focus window must be viewable at the time
+XISetFocus is called, or a BadMatch error results\&. If the focus
+window later becomes not viewable, the focus reverts to the
+parent (or the closest viewable ancestor\&. When the focus
+reverts, the X server generates core, XI and XI2 focus events
+but the last\-focus\-change time is not affected\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Attempting to set the focus on a master pointer device or an
+attached slave device will result in a BadDevice error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XISetFocus can generate BadDevice, BadMatch, BadValue, and
+BadWindow errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       A value is outside of the permitted range\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The device does not
+       exist or is not a appropriate for the type of change\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       The window is not viewable\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       Window\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XISetFocus.txt b/man/XISetFocus.txt
new file mode 100755 (executable)
index 0000000..dbfed70
--- /dev/null
@@ -0,0 +1,86 @@
+XISETFOCUS(libmansuffix)
+========================
+
+NAME
+----
+
+   XISetFocus, XIGetFocus - set or get the device's focus.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput2.h>
+
+   Status XISetFocus( Display *display,
+                      int deviceid,
+                      Window focus,
+                      Time time);
+
+   Status XIGetFocus( Display *display,
+                      Window *focus_return);
+
+   display
+          Specifies the connection to the X server.
+
+   deviceid
+          Specifies the device whose focus is to be queried or
+          changed.
+
+   focus
+          The new focus window.
+
+   focus_return
+          Returns the current focus window.
+
+   time
+          A valid timestamp or CurrentTime.
+
+DESCRIPTION
+-----------
+
+   XISetFocus changes the focus of the specified device ans its
+   last-focus-change time. It has no effect if the specified time
+   is earlier than the current last-focus-change time or is later
+   than the current X server time. Otherwise, the
+   last-focus-change time is set to the specified time.
+   CurrentTime is replaced by the current X server time).
+   XISetFocus causes the X server to generate core, XI and XI2
+   focus events.
+
+   If the focus window is None all keyboard events by this device
+   are discarded until a new focus window is set. Otherwise, if
+   focus is a window, it becomes the device's focus window. If a
+   generated device event would normally be reported to this
+   window or one of its inferiors, the event is reported as usual.
+   Otherwise, the event is reported relative to the focus window.
+
+   The specified focus window must be viewable at the time
+   XISetFocus is called, or a BadMatch error results. If the focus
+   window later becomes not viewable, the focus reverts to the
+   parent (or the closest viewable ancestor. When the focus
+   reverts, the X server generates core, XI and XI2 focus events
+   but the last-focus-change time is not affected.
+
+   Attempting to set the focus on a master pointer device or an
+   attached slave device will result in a BadDevice error.
+
+   XISetFocus can generate BadDevice, BadMatch, BadValue, and
+   BadWindow errors.
+
+DIAGNOSTICS
+-----------
+
+   BadValue
+          A value is outside of the permitted range.
+
+   BadDevice
+          An invalid device was specified. The device does not
+          exist or is not a appropriate for the type of change.
+
+   BadMatch
+          The window is not viewable.
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          Window.
+
diff --git a/man/XIUndefineCursor.man b/man/XIUndefineCursor.man
new file mode 100755 (executable)
index 0000000..fbbbdeb
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XIDefineCursor.libmansuffix
diff --git a/man/XIUngrabButton.man b/man/XIUngrabButton.man
new file mode 100755 (executable)
index 0000000..beed4f1
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XIGrabButton.libmansuffix
diff --git a/man/XIUngrabDevice.man b/man/XIUngrabDevice.man
new file mode 100755 (executable)
index 0000000..784a862
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XIGrabDevice.libmansuffix
diff --git a/man/XIUngrabEnter.man b/man/XIUngrabEnter.man
new file mode 100755 (executable)
index 0000000..ebd8b17
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XIGrabEnter.libmansuffix
diff --git a/man/XIUngrabFocusIn.man b/man/XIUngrabFocusIn.man
new file mode 100755 (executable)
index 0000000..ebd8b17
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XIGrabEnter.libmansuffix
diff --git a/man/XIUngrabKeycode.man b/man/XIUngrabKeycode.man
new file mode 100755 (executable)
index 0000000..beed4f1
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XIGrabButton.libmansuffix
diff --git a/man/XIWarpPointer.man b/man/XIWarpPointer.man
new file mode 100755 (executable)
index 0000000..73a2d49
--- /dev/null
@@ -0,0 +1,176 @@
+'\" t
+.\"     Title: xiwarppointer
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 10/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XIWARPPOINTER" "libmansuffix" "10/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XIWarpPointer \- move a device\'s pointer\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput2\&.h>
+.fi
+.sp
+.nf
+Bool XIWarpPointer( Display *display,
+                    int deviceid,
+                    Window src_w,
+                    Window dest_w,
+                    double src_x,
+                    double src_y,
+                    int src_width,
+                    int src_height,
+                    double dest_x,
+                    double dest_y);
+.fi
+.sp
+.nf
+dest_w
+       Specifies the destination window or None\&.
+.fi
+.sp
+.nf
+dest_x, dest_y
+       Specify the x and y coordinates within the destination
+       window\&.
+.fi
+.sp
+.nf
+deviceid
+       Specifies the master pointer device or floating slave
+       device to move\&.
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+src_x, src_y, src_width, src_height
+       Specify a rectangle in the source window\&.
+.fi
+.sp
+.nf
+src_w
+       Specifies the source window or None\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If dest_w is None, XIWarpPointer moves the pointer by the
+offsets (dest_x, dest_y) relative to the current position of
+the pointer\&. If dest_w is a window, XIWarpPointer moves the
+pointer to the offsets (dest_x, dest_y) relative to the origin
+of dest_w\&. However, if src_w is a window, the move only takes
+place if the window src_w contains the pointer and if the
+specified rectangle of src_w contains the pointer\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The src_x and src_y coordinates are relative to the origin of
+src_w\&. If src_height is zero, it is replaced with the current
+height of src_w minus src_y\&. If src_width is zero, it is
+replaced with the current width of src_w minus src_x\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+There is seldom any reason for calling this function\&. The
+pointer should normally be left to the user\&. If you do use this
+function, however, it generates events just as if the user had
+instantaneously moved the pointer from one position to another\&.
+Note that you cannot use XIWarpPointer to move the pointer
+outside the confine_to window of an active pointer grab\&. An
+attempt to do so will only move the pointer as far as the
+closest edge of the confine_to window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIWarpPointer is identical to XWarpPointer but specifies the
+device explicitly\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XIWarpPointer can generate a BadDevice and a BadWindow error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The device does not
+       exist or is not a pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XWarpPointer(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XIWarpPointer.txt b/man/XIWarpPointer.txt
new file mode 100755 (executable)
index 0000000..fcf9e69
--- /dev/null
@@ -0,0 +1,89 @@
+XIWARPPOINTER(libmansuffix)
+===========================
+
+NAME
+----
+
+   XIWarpPointer - move a device's pointer.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput2.h>
+
+   Bool XIWarpPointer( Display *display,
+                       int deviceid,
+                       Window src_w,
+                       Window dest_w,
+                       double src_x,
+                       double src_y,
+                       int src_width,
+                       int src_height,
+                       double dest_x,
+                       double dest_y);
+   
+   dest_w
+          Specifies the destination window or None.
+
+   dest_x, dest_y
+          Specify the x and y coordinates within the destination
+          window.
+
+   deviceid
+          Specifies the master pointer device or floating slave
+          device to move.
+
+   display
+          Specifies the connection to the X server.
+
+   src_x, src_y, src_width, src_height
+          Specify a rectangle in the source window.
+
+   src_w
+          Specifies the source window or None.
+
+DESCRIPTION
+-----------
+
+   If dest_w is None, XIWarpPointer moves the pointer by the
+   offsets (dest_x, dest_y) relative to the current position of
+   the pointer. If dest_w is a window, XIWarpPointer moves the
+   pointer to the offsets (dest_x, dest_y) relative to the origin
+   of dest_w. However, if src_w is a window, the move only takes
+   place if the window src_w contains the pointer and if the
+   specified rectangle of src_w contains the pointer.
+
+   The src_x and src_y coordinates are relative to the origin of
+   src_w. If src_height is zero, it is replaced with the current
+   height of src_w minus src_y. If src_width is zero, it is
+   replaced with the current width of src_w minus src_x.
+
+   There is seldom any reason for calling this function. The
+   pointer should normally be left to the user. If you do use this
+   function, however, it generates events just as if the user had
+   instantaneously moved the pointer from one position to another.
+   Note that you cannot use XIWarpPointer to move the pointer
+   outside the confine_to window of an active pointer grab. An
+   attempt to do so will only move the pointer as far as the
+   closest edge of the confine_to window.
+
+   XIWarpPointer is identical to XWarpPointer but specifies the
+   device explicitly.
+
+   XIWarpPointer can generate a BadDevice and a BadWindow error.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The device does not
+          exist or is not a pointer device.
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          window.
+
+SEE ALSO
+--------
+
+   XWarpPointer(libmansuffix)
diff --git a/man/XListDeviceProperties.man b/man/XListDeviceProperties.man
new file mode 100755 (executable)
index 0000000..24c93c7
--- /dev/null
@@ -0,0 +1,110 @@
+'\" t
+.\"     Title: xlistdeviceproperties
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XLISTDEVICEPROPERTIE" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XListDeviceProperties \- List a device\'s properties\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+Atom* XListDeviceProperties( Display *display,
+                             XDevice *device,
+                             int *nprops_return);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       The device to list the properties for\&.
+.fi
+.sp
+.nf
+nprops_return
+       Specifies the number of Atoms returned\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XListDeviceProperties function returns a list of the
+properties associated with the input device specified in
+device\&. Each device may have an arbitrary number of properties
+attached, some of which were created by the driver and/or
+server, others created by clients at runtime\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The client is expected to free the list of properties using
+XFree\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XListDeviceProperties can generate a BadDevice error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The device does not
+       exist\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XChangeDeviceProperty(libmansuffix),
+XGetDeviceProperty(libmansuffix),
+XDeleteDeviceProperty(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XListDeviceProperties.txt b/man/XListDeviceProperties.txt
new file mode 100755 (executable)
index 0000000..3a53c89
--- /dev/null
@@ -0,0 +1,53 @@
+XLISTDEVICEPROPERTIES(libmansuffix)
+===================================
+
+NAME
+----
+
+   XListDeviceProperties - List a device's properties.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   Atom* XListDeviceProperties( Display *display,
+                                XDevice *device,
+                                int *nprops_return);
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          The device to list the properties for.
+
+   nprops_return
+          Specifies the number of Atoms returned.
+
+DESCRIPTION
+-----------
+
+   The XListDeviceProperties function returns a list of the
+   properties associated with the input device specified in
+   device. Each device may have an arbitrary number of properties
+   attached, some of which were created by the driver and/or
+   server, others created by clients at runtime.
+
+   The client is expected to free the list of properties using
+   XFree.
+
+   XListDeviceProperties can generate a BadDevice error.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The device does not
+          exist.
+
+SEE ALSO
+--------
+
+   XChangeDeviceProperty(libmansuffix),
+   XGetDeviceProperty(libmansuffix),
+   XDeleteDeviceProperty(libmansuffix)
diff --git a/man/XListInputDevices.man b/man/XListInputDevices.man
new file mode 100755 (executable)
index 0000000..44e145f
--- /dev/null
@@ -0,0 +1,557 @@
+'\" t
+.\"     Title: xlistinputdevices
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 10/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XLISTINPUTDEVICES" "libmansuffix" "10/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XListInputDevices, XFreeDeviceList \- list available input devices
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+XDeviceInfo *XListInputDevices( Display *display,
+                                int *ndevices_return);
+.fi
+.sp
+.nf
+int XFreeDeviceList( XDeviceInfo *list);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+ndevices_return
+       Specifies a pointer to a variable where the number of
+       available devices canbe returned\&.
+.fi
+.sp
+.nf
+list
+       Specifies the list of devices to free\&. The
+       XFreeDeviceList functionfrees the list of available
+       extension input devices\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XListInputDevices request lists the available input
+devices\&. This list includes the core keyboard and any physical
+input device currently accessible through the X server, and any
+input devices that are not currently accessible through the X
+server but could be accessed if requested\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+A master pointer is a virtual pointer device that does not
+represent a physical device\&. It is visually represented through
+a cursor\&. A master keyboard is a virtual keyboard device that
+does not represent a physical device\&. It is virtually
+representd through a keyboard focus\&. A master pointer and a
+master keyboard are always paired (i\&.e\&. if shift is pressed on
+the master keyboard, a pointer click would be a shift\-click)\&.
+Multiple master pointer/keyboard pairs can exist\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+X servers supporting the X Input Extension version 2,
+XListInputDevices only returns the first master pointer, the
+first master keyboard and all slave devices\&. Additional master
+devices are not listed\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Physical devices (so\-called slave devices) are attached to
+either a master pointer or a master keyboard, depending on
+their capabilities\&. If a slave device generates an event, the
+event is also generated by the respective master device\&.
+Multiple slave devices can be attached to a single master
+device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Some server implementations may make all physical input devices
+available at the time the server is initialized\&. Others may
+wait until requested by a client to access an input device\&. In
+the latter case, it is possible that an input device will be
+listed as available at one time but not at another\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+For each input device available to the server, the
+XListInputDevices request returns an XDeviceInfo structure\&.
+That structure contains a pointer to a list of structures, each
+of which contains information about one class of input
+supported by the device\&. The XDeviceInfo structure is defined
+as follows:
+             typedef struct _XDeviceInfo {
+             XID     id;
+             Atom    type;
+             char    *name;
+             int         num_classes;
+             int         use;
+             XAnyClassPtr inputclassinfo;
+             } XDeviceInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The id is a number in the range 0\-128 that uniquely identifies
+the device\&. It is assigned to the device when it is initialized
+by the server\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The type field is of type Atom and indicates the nature of the
+device\&. The type will correspond to one of the following strings
+(defined in the header file XI\&.h):
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XI_MOUSE XI_TABLET XI_KEYBOARD XI_TOUCHSCREEN XI_TOUCHPAD
+XI_BUTTONBOX XI_BARCODE XI_TRACKBALL XI_QUADRATURE XI_ID_MODULE
+XI_ONE_KNOB XI_NINE_KNOB XI_KNOB_BOX XI_SPACEBALL XI_DATAGLOVE
+XI_EYETRACKER XI_CURSORKEYS XI_FOOTMOUSE XI_JOYSTICK
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+These strings may be used in an XInternAtom request to return
+an atom that can be compared with the type field of the
+XDeviceInfo structure\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The name field contains a pointer to a null\-terminated string
+that serves as identifier of the device\&. This identifier may be
+user\-configured or automatically assigned by the server\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The num_classes field is a number in the range 0\-255 that
+specifies the number of input classes supported by the device
+for which information is returned by ListInputDevices\&. Some
+input classes, such as class Focus and class Proximity do not
+have any information to be returned by ListInputDevices\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+All devices provide an AttachClass\&. This class specifies the
+master device a given slave device is attached to\&. For master
+devices, the class specifies the respective paired master
+device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The use field specifies how the device is currently being used\&.
+If the value is IsXKeyboard, the device is a master keyboard\&.
+If the value is IsXPointer, the device is a master pointer\&. If
+the value is IsXExtensionPointer, the device is a slave
+pointer\&. If the value is IsXExtensionKeyboard, the device is a
+slave keyboard\&. If the value is IsXExtensionDevice, the device
+is available for use as an extension device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The inputclassinfo field contains a pointer to the first
+input\-class specific data\&. The first two fields are common to
+all classes\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The class field is a number in the range 0\-255\&. It uniquely
+identifies the class of input for which information is
+returned\&. Currently defined classes are KeyClass, ButtonClass,
+and ValuatorClass\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The length field is a number in the range 0\- 255\&. It specifies
+the number of bytes of data that are contained in this input
+class\&. The length includes the class and length fields\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XKeyInfo structure describes the characteristics of the
+keys on the device\&. It is defined as follows:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct _XKeyInfo {
+XID class;
+int length;
+unsigned short min_keycode;
+unsigned short max_keycode;
+unsigned short num_keys;
+} XKeyInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+min_keycode is of type KEYCODE\&. It specifies the minimum
+keycode that the device will report\&. The minimum keycode will
+not be smaller than 8\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+max_keycode is of type KEYCODE\&. It specifies the maximum
+keycode that the device will report\&. The maximum keycode will
+not be larger than 255\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+num_keys specifies the number of keys that the device has\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XButtonInfo structure defines the characteristics of the
+buttons on the device\&. It is defined as follows:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct _XButtonInfo {
+XID class;
+int length;
+short num_buttons;
+} XButtonInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+num_buttons specifies the number of buttons that the device
+has\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XValuatorInfo structure defines the characteristics of the
+valuators on the device\&. It is defined as follows:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct  _XValuatorInfo {
+XID class;
+int length;
+unsigned char num_axes;
+unsigned char mode;
+unsigned long motion_buffer;
+XAxisInfoPtr axes;
+} XValuatorInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+num_axes contains the number of axes the device supports\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+mode is a constant that has one of the following values:
+Absolute or Relative\&. Some devices allow the mode to be changed
+dynamically via the SetDeviceMode request\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+motion_buffer_size is a cardinal number that specifies the
+number of elements that can be contained in the motion history
+buffer for the device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The axes field contains a pointer to an XAxisInfo structure\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XAxisInfo structure is defined as follows:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct _XAxisInfo {
+int resolution;
+int min_value;
+int max_value;
+} XAxisInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The resolution contains a number in counts/meter\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The min_val field contains a number that specifies the minimum
+value the device reports for this axis\&. For devices whose mode
+is Relative, the min_val field will contain 0\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The max_val field contains a number that specifies the maximum
+value the device reports for this axis\&. For devices whose mode
+is Relative, the max_val field will contain 0\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XAttachInfo structure is defined as follows:
+             typedef struct _XAttachInfo {
+             int     attached;
+             } XAttachInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the device is a slave device, attached specifies the device
+ID of the master device this device is attached to\&. If the
+device is not attached to a master device, attached is
+Floating\&. If the device is a master device, attached specifies
+the device ID of the master device this device is paired with\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+To free the XDeviceInfo array created by XListInputDevices, use
+XFreeDeviceList\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XListInputDevices.txt b/man/XListInputDevices.txt
new file mode 100755 (executable)
index 0000000..276660d
--- /dev/null
@@ -0,0 +1,224 @@
+XLISTINPUTDEVICES(libmansuffix)
+===============================
+
+NAME
+----
+
+   XListInputDevices, XFreeDeviceList - list available input
+   devices
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   XDeviceInfo *XListInputDevices( Display *display,
+                                   int *ndevices_return);
+
+   int XFreeDeviceList( XDeviceInfo *list);
+
+   display
+          Specifies the connection to the X server.
+
+   ndevices_return
+          Specifies a pointer to a variable where the number of
+          available devices canbe returned.
+
+   list
+          Specifies the list of devices to free. The
+          XFreeDeviceList functionfrees the list of available
+          extension input devices.
+
+DESCRIPTION
+-----------
+
+   The XListInputDevices request lists the available input
+   devices. This list includes the core keyboard and any physical
+   input device currently accessible through the X server, and any
+   input devices that are not currently accessible through the X
+   server but could be accessed if requested.
+
+   A master pointer is a virtual pointer device that does not
+   represent a physical device. It is visually represented through
+   a cursor. A master keyboard is a virtual keyboard device that
+   does not represent a physical device. It is virtually
+   representd through a keyboard focus. A master pointer and a
+   master keyboard are always paired (i.e. if shift is pressed on
+   the master keyboard, a pointer click would be a shift-click).
+   Multiple master pointer/keyboard pairs can exist.
+
+   X servers supporting the X Input Extension version 2,
+   XListInputDevices only returns the first master pointer, the
+   first master keyboard and all slave devices. Additional master
+   devices are not listed.
+
+   Physical devices (so-called slave devices) are attached to
+   either a master pointer or a master keyboard, depending on
+   their capabilities. If a slave device generates an event, the
+   event is also generated by the respective master device.
+   Multiple slave devices can be attached to a single master
+   device.
+
+   Some server implementations may make all physical input devices
+   available at the time the server is initialized. Others may
+   wait until requested by a client to access an input device. In
+   the latter case, it is possible that an input device will be
+   listed as available at one time but not at another.
+
+   For each input device available to the server, the
+   XListInputDevices request returns an XDeviceInfo structure.
+   That structure contains a pointer to a list of structures, each
+   of which contains information about one class of input
+   supported by the device. The XDeviceInfo structure is defined
+   as follows:
+                typedef struct _XDeviceInfo {
+                XID     id;
+                Atom    type;
+                char    *name;
+                int         num_classes;
+                int         use;
+                XAnyClassPtr inputclassinfo;
+                } XDeviceInfo;
+
+   The id is a number in the range 0-128 that uniquely identifies
+   the device. It is assigned to the device when it is initialized
+   by the server.
+
+   The type field is of type Atom and indicates the nature of the
+   device. The type will correspond to one of the following strings
+   (defined in the header file XI.h):
+
+   XI_MOUSE XI_TABLET XI_KEYBOARD XI_TOUCHSCREEN XI_TOUCHPAD
+   XI_BUTTONBOX XI_BARCODE XI_TRACKBALL XI_QUADRATURE XI_ID_MODULE
+   XI_ONE_KNOB XI_NINE_KNOB XI_KNOB_BOX XI_SPACEBALL XI_DATAGLOVE
+   XI_EYETRACKER XI_CURSORKEYS XI_FOOTMOUSE XI_JOYSTICK
+
+   These strings may be used in an XInternAtom request to return
+   an atom that can be compared with the type field of the
+   XDeviceInfo structure.
+
+   The name field contains a pointer to a null-terminated string
+   that serves as identifier of the device. This identifier may be
+   user-configured or automatically assigned by the server.
+
+   The num_classes field is a number in the range 0-255 that
+   specifies the number of input classes supported by the device
+   for which information is returned by ListInputDevices. Some
+   input classes, such as class Focus and class Proximity do not
+   have any information to be returned by ListInputDevices.
+
+   All devices provide an AttachClass. This class specifies the
+   master device a given slave device is attached to. For master
+   devices, the class specifies the respective paired master
+   device.
+
+   The use field specifies how the device is currently being used.
+   If the value is IsXKeyboard, the device is a master keyboard.
+   If the value is IsXPointer, the device is a master pointer. If
+   the value is IsXExtensionPointer, the device is a slave
+   pointer. If the value is IsXExtensionKeyboard, the device is a
+   slave keyboard. If the value is IsXExtensionDevice, the device
+   is available for use as an extension device.
+
+   The inputclassinfo field contains a pointer to the first
+   input-class specific data. The first two fields are common to
+   all classes.
+
+   The class field is a number in the range 0-255. It uniquely
+   identifies the class of input for which information is
+   returned. Currently defined classes are KeyClass, ButtonClass,
+   and ValuatorClass.
+
+   The length field is a number in the range 0- 255. It specifies
+   the number of bytes of data that are contained in this input
+   class. The length includes the class and length fields.
+
+   The XKeyInfo structure describes the characteristics of the
+   keys on the device. It is defined as follows:
+
+                typedef struct _XKeyInfo {
+                XID class;
+                int length;
+                unsigned short min_keycode;
+                unsigned short max_keycode;
+                unsigned short num_keys;
+                } XKeyInfo;
+
+
+   min_keycode is of type KEYCODE. It specifies the minimum
+   keycode that the device will report. The minimum keycode will
+   not be smaller than 8.
+
+   max_keycode is of type KEYCODE. It specifies the maximum
+   keycode that the device will report. The maximum keycode will
+   not be larger than 255.
+
+   num_keys specifies the number of keys that the device has.
+
+   The XButtonInfo structure defines the characteristics of the
+   buttons on the device. It is defined as follows:
+
+                typedef struct _XButtonInfo {
+                XID class;
+                int length;
+                short num_buttons;
+                } XButtonInfo;
+
+   num_buttons specifies the number of buttons that the device
+   has.
+
+   The XValuatorInfo structure defines the characteristics of the
+   valuators on the device. It is defined as follows:
+
+                typedef struct  _XValuatorInfo {
+                XID class;
+                int length;
+                unsigned char num_axes;
+                unsigned char mode;
+                unsigned long motion_buffer;
+                XAxisInfoPtr axes;
+                } XValuatorInfo;
+
+   num_axes contains the number of axes the device supports.
+
+   mode is a constant that has one of the following values:
+   Absolute or Relative. Some devices allow the mode to be changed
+   dynamically via the SetDeviceMode request.
+
+   motion_buffer_size is a cardinal number that specifies the
+   number of elements that can be contained in the motion history
+   buffer for the device.
+
+   The axes field contains a pointer to an XAxisInfo structure.
+
+   The XAxisInfo structure is defined as follows:
+
+                typedef struct _XAxisInfo {
+                int resolution;
+                int min_value;
+                int max_value;
+                } XAxisInfo;
+
+   The resolution contains a number in counts/meter.
+
+   The min_val field contains a number that specifies the minimum
+   value the device reports for this axis. For devices whose mode
+   is Relative, the min_val field will contain 0.
+
+   The max_val field contains a number that specifies the maximum
+   value the device reports for this axis. For devices whose mode
+   is Relative, the max_val field will contain 0.
+
+   The XAttachInfo structure is defined as follows:
+                typedef struct _XAttachInfo {
+                int     attached;
+                } XAttachInfo;
+
+   If the device is a slave device, attached specifies the device
+   ID of the master device this device is attached to. If the
+   device is not attached to a master device, attached is
+   Floating. If the device is a master device, attached specifies
+   the device ID of the master device this device is paired with.
+
+   To free the XDeviceInfo array created by XListInputDevices, use
+   XFreeDeviceList.
diff --git a/man/XOpenDevice.man b/man/XOpenDevice.man
new file mode 100755 (executable)
index 0000000..8aa8e65
--- /dev/null
@@ -0,0 +1,245 @@
+'\" t
+.\"     Title: xopendevice
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XOPENDEVICE" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XOpenDevice, XCloseDevice \- open or close an extension input device
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+XDevice *XOpenDevice( Display *display,
+                      XID device_id);
+.fi
+.sp
+.nf
+XCloseDevice( Display *display,
+              XDevice *device);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device_id
+       Specifies the id of the device to be opened
+.fi
+.sp
+.nf
+device
+       Specifies the device to be closed
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XOpenDevice request makes an input device accessible to a
+client through input extension protocol requests\&. If
+successful, it returns a pointer to an XDevice structure\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XCloseDevice request makes an input device inaccessible to
+a client through input extension protocol requests\&. Before
+terminating, and client that has opened input devices through
+the input extension should close them via CloseDevice\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+When a client makes an XCloseDevice request, any active grabs
+that the client has on the device are released\&. Any event
+selections that the client has are deleted, as well as any
+passive grabs\&. If the requesting client is the last client
+accessing the device, the server may disable all access by X to
+the device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XOpenDevice and XCloseDevice can generate a BadDevice error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Structures
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XDevice structure returned by XOpenDevice contains:
+             typedef struct {
+             XID device_id;
+             int num_classes;
+             XInputClassInfo *classes;
+             } XDevice;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The classes field is a pointer to an array of XInputClassInfo
+structures\&. Each element of this array contains an event type
+base for a class of input supported by the specified device\&.
+The num_classes field indicates the number of elements in the
+classes array\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XInputClassInfo structure contains:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    unsigned char input_class;
+    unsigned char event_type_base;
+} XInputClassInfo;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The input_class field identifies one class of input supported
+by the device\&. Defined types include KeyClass, ButtonClass,
+ValuatorClass, ProximityClass, FeedbackClass, FocusClass, and
+OtherClass\&. The event_type_base identifies the event type of
+the first event in that class\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The information contained in the XInputClassInfo structure is
+used by macros to obtain the event classes that clients use in
+making XSelectExtensionEvent requests\&. Currently defined macros
+include DeviceKeyPress, DeviceKeyRelease, DeviceButtonPress,
+DeviceButtonRelese, DeviceMotionNotify, DeviceFocusIn,
+DeviceFocusOut, ProximityIn, ProximityOut, DeviceStateNotify,
+DeviceMappingNotify, ChangeDeviceNotify,
+DevicePointerMotionHint, DeviceButton1Motion,
+DeviceButton2Motion, DeviceButton3Motion, DeviceButton4Motion,
+DeviceButton5Motion, DeviceButtonMotion, DeviceOwnerGrabButton,
+DeviceButtonPressGrab, and NoExtensionEvent\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+To obtain the proper event class for a particular device, one
+of the above macros is invoked using the XDevice structure for
+that device\&. For example,
+             DeviceKeyPress (*device, type, eventclass);
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+returns the DeviceKeyPress event type and the eventclass for
+DeviceKeyPress events from the specified device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+This eventclass can then be used in an XSelectExtensionEvent
+request to ask the server to send DeviceKeyPress events from
+this device\&. When a selected event is received via XNextEvent,
+the type can be used for comparison with the type in the event\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist, or is the X keyboard or X pointer\&. This
+       error may also occur if some other client has caused the
+       specified device to become the X keyboard or X pointer
+       device via the XChangeKeyboardDevice or
+       XChangePointerDevice requests\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XOpenDevice.txt b/man/XOpenDevice.txt
new file mode 100755 (executable)
index 0000000..fbeb5e7
--- /dev/null
@@ -0,0 +1,113 @@
+XOPENDEVICE(libmansuffix)
+=========================
+
+NAME
+----
+
+   XOpenDevice, XCloseDevice - open or close an extension input
+   device
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   XDevice *XOpenDevice( Display *display,
+                         XID device_id);
+
+   XCloseDevice( Display *display,
+                 XDevice *device);
+
+   display
+          Specifies the connection to the X server.
+
+   device_id
+          Specifies the id of the device to be opened
+
+   device
+          Specifies the device to be closed
+
+DESCRIPTION
+-----------
+
+   The XOpenDevice request makes an input device accessible to a
+   client through input extension protocol requests. If
+   successful, it returns a pointer to an XDevice structure.
+
+   The XCloseDevice request makes an input device inaccessible to
+   a client through input extension protocol requests. Before
+   terminating, and client that has opened input devices through
+   the input extension should close them via CloseDevice.
+
+   When a client makes an XCloseDevice request, any active grabs
+   that the client has on the device are released. Any event
+   selections that the client has are deleted, as well as any
+   passive grabs. If the requesting client is the last client
+   accessing the device, the server may disable all access by X to
+   the device.
+
+   XOpenDevice and XCloseDevice can generate a BadDevice error.
+
+Structures
+
+   The XDevice structure returned by XOpenDevice contains:
+                typedef struct {
+                XID device_id;
+                int num_classes;
+                XInputClassInfo *classes;
+                } XDevice;
+
+   The classes field is a pointer to an array of XInputClassInfo
+   structures. Each element of this array contains an event type
+   base for a class of input supported by the specified device.
+   The num_classes field indicates the number of elements in the
+   classes array.
+
+   The XInputClassInfo structure contains:
+
+                typedef struct {
+                    unsigned char input_class;
+                    unsigned char event_type_base;
+                } XInputClassInfo;
+
+   The input_class field identifies one class of input supported
+   by the device. Defined types include KeyClass, ButtonClass,
+   ValuatorClass, ProximityClass, FeedbackClass, FocusClass, and
+   OtherClass. The event_type_base identifies the event type of
+   the first event in that class.
+
+   The information contained in the XInputClassInfo structure is
+   used by macros to obtain the event classes that clients use in
+   making XSelectExtensionEvent requests. Currently defined macros
+   include DeviceKeyPress, DeviceKeyRelease, DeviceButtonPress,
+   DeviceButtonRelese, DeviceMotionNotify, DeviceFocusIn,
+   DeviceFocusOut, ProximityIn, ProximityOut, DeviceStateNotify,
+   DeviceMappingNotify, ChangeDeviceNotify,
+   DevicePointerMotionHint, DeviceButton1Motion,
+   DeviceButton2Motion, DeviceButton3Motion, DeviceButton4Motion,
+   DeviceButton5Motion, DeviceButtonMotion, DeviceOwnerGrabButton,
+   DeviceButtonPressGrab, and NoExtensionEvent.
+
+   To obtain the proper event class for a particular device, one
+   of the above macros is invoked using the XDevice structure for
+   that device. For example,
+                DeviceKeyPress (*device, type, eventclass);
+
+   returns the DeviceKeyPress event type and the eventclass for
+   DeviceKeyPress events from the specified device.
+
+   This eventclass can then be used in an XSelectExtensionEvent
+   request to ask the server to send DeviceKeyPress events from
+   this device. When a selected event is received via XNextEvent,
+   the type can be used for comparison with the type in the event.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist, or is the X keyboard or X pointer. This
+          error may also occur if some other client has caused the
+          specified device to become the X keyboard or X pointer
+          device via the XChangeKeyboardDevice or
+          XChangePointerDevice requests.
diff --git a/man/XQueryDeviceState.man b/man/XQueryDeviceState.man
new file mode 100755 (executable)
index 0000000..f55f0ce
--- /dev/null
@@ -0,0 +1,196 @@
+'\" t
+.\"     Title: xquerydevicestate
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 10/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XQUERYDEVICESTATE" "libmansuffix" "10/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XQueryDeviceState \- query the state of an extension input device\&.
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+XDeviceState* XQueryDeviceState( Display *display,
+                                 XDevice *device);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device whose state is to be queried\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XQueryDeviceState request queries the state of an input
+device\&. The current state of keys and buttons (up or down), and
+valuators (current value) on the device is reported by this
+request\&. Each key or button is represented by a bit in the
+XDeviceState structure that is returned\&. Valuators on the
+device report 0 if they are reporting relative information, and
+the current value if they are reporting absolute information\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XQueryDeviceState can generate a BadDevice error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Structures:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XDeviceState structure contains:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    XID device_id;
+    int num_classes;
+    XInputClass *data;
+} XDeviceState;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XValuatorState structure contains:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    unsigned char class;
+    unsigned char length;
+    unsigned char num_valuators;
+    unsigned char mode;
+    int *valuators;
+} XValuatorState;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XKeyState structure contains:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    unsigned char class;
+    unsigned char length;
+    short     num_keys;
+    char keys[32];
+} XKeyState;
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XButtonState structure contains:
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+typedef struct {
+    unsigned char class;
+    unsigned char length;
+    short     num_buttons;
+    char buttons[32];
+} XButtonState;
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if some
+       other client has caused the specified device to become
+       the X keyboard or X pointer device via the
+       XChangeKeyboardDevice or XChangePointerDevice requests\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XQueryDeviceState.txt b/man/XQueryDeviceState.txt
new file mode 100755 (executable)
index 0000000..41cdd2c
--- /dev/null
@@ -0,0 +1,84 @@
+XQUERYDEVICESTATE(libmansuffix)
+===============================
+
+NAME
+----
+
+   XQueryDeviceState - query the state of an extension input
+   device.
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   XDeviceState* XQueryDeviceState( Display *display,
+                                    XDevice *device);
+   
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device whose state is to be queried.
+
+DESCRIPTION
+-----------
+
+   The XQueryDeviceState request queries the state of an input
+   device. The current state of keys and buttons (up or down), and
+   valuators (current value) on the device is reported by this
+   request. Each key or button is represented by a bit in the
+   XDeviceState structure that is returned. Valuators on the
+   device report 0 if they are reporting relative information, and
+   the current value if they are reporting absolute information.
+
+   XQueryDeviceState can generate a BadDevice error.
+
+   Structures:
+
+   The XDeviceState structure contains:
+
+                typedef struct {
+                    XID device_id;
+                    int num_classes;
+                    XInputClass *data;
+                } XDeviceState;
+
+   The XValuatorState structure contains:
+
+                typedef struct {
+                    unsigned char class;
+                    unsigned char length;
+                    unsigned char num_valuators;
+                    unsigned char mode;
+                    int *valuators;
+                } XValuatorState;
+
+   The XKeyState structure contains:
+
+                typedef struct {
+                    unsigned char class;
+                    unsigned char length;
+                    short     num_keys;
+                    char keys[32];
+                } XKeyState;
+
+   The XButtonState structure contains:
+
+                typedef struct {
+                    unsigned char class;
+                    unsigned char length;
+                    short     num_buttons;
+                    char buttons[32];
+                } XButtonState;
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if some
+          other client has caused the specified device to become
+          the X keyboard or X pointer device via the
+          XChangeKeyboardDevice or XChangePointerDevice requests.
diff --git a/man/XSelectExtensionEvent.man b/man/XSelectExtensionEvent.man
new file mode 100755 (executable)
index 0000000..07eecb6
--- /dev/null
@@ -0,0 +1,232 @@
+'\" t
+.\"     Title: xselectextensionevent
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 10/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XSELECTEXTENSIONEVEN" "libmansuffix" "10/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XSelectExtensionEvent, XGetSelectedExtensionEvents \- select extension events, get the list of currently selected extension events
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+XSelectExtensionEvent( Display *display,
+                       Window w,
+                       XEventClass *event_list,
+                       int event_count);
+.fi
+.sp
+.nf
+XGetSelectedExtensionEvents( Display *display,
+                             Window w,
+                             int *this_client_event_count_return,
+                             XEventClass **this_client_event_list_return,
+                             int *all_clients_event_count_return,
+                             XEventClass **all_clients_event_list_return);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+w
+       Specifies the window whose events you are interested in\&.
+.fi
+.sp
+.nf
+event_list
+       Specifies the list of event classes that describe the
+       events you are interested in\&.
+.fi
+.sp
+.nf
+event_count
+       Specifies the count of event classes in the event list\&.
+.fi
+.sp
+.nf
+this_client_event_count_return
+       Returns the count of event classes selected by this
+       client\&.
+.fi
+.sp
+.nf
+this_client_event_list_return
+       Returns a pointer to the list of event classes selected
+       by this client\&.
+.fi
+.sp
+.nf
+all_clients_event_count_return
+       Returns the count of event classes selected by all
+       clients\&.
+.fi
+.sp
+.nf
+all_clients_event_list_return
+       Returns a pointer to the list of event classes selected
+       by all clients\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XSelectExtensionEvent request causes the X server to report
+the events associated with the specified list of event classes\&.
+Initially, X will not report any of these events\&. Events are
+reported relative to a window\&. If a window is not interested in
+a device event, it usually propagates to the closest ancestor
+that is interested, unless the do_not_propagate mask prohibits
+it\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Multiple clients can select for the same events on the same
+window with the following restrictions:
+  * Multiple clients can select events on the same window
+    because their event masks are disjoint\&. When the X server
+    generates an event, it reports it to all interested
+    clients\&.
+  * Only one client at a time can select a DeviceButtonPress
+    event with automatic passive grabbing enabled, which is
+    associated with the event class DeviceButtonPressGrab\&. To
+    receive DeviceButtonPress events without automatic passive
+    grabbing, use event class DeviceButtonPress but do not
+    specify event class DeviceButtonPressGrab\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The server reports the event to all interested clients\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Information contained in the XDevice structure returned by
+XOpenDevice is used by macros to obtain the event classes that
+clients use in making XSelectExtensionEvent requests\&. Currently
+defined macros include DeviceKeyPress, DeviceKeyRelease,
+DeviceButtonPress, DeviceButtonRelese, DeviceMotionNotify,
+DeviceFocusIn, DeviceFocusOut, ProximityIn, ProximityOut,
+DeviceStateNotify, DeviceMappiingNotify, ChangeDeviceNotify,
+DevicePointerMotionHint, DeviceButton1Motion,
+DeviceButton2Motion, DeviceButton3Motion, DeviceButton4Motion,
+DeviceButton5Motion, DeviceButtonMotion, DeviceOwnerGrabButton,
+DeviceButtonPressGrab, and NoExtensionEvent\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+To obtain the proper event class for a particular device, one
+of the above macros is invoked using the XDevice structure for
+that device\&. For example,
+             DeviceKeyPress (*device, type, eventclass);
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+returns the DeviceKeyPress event type and the eventclass for
+selecting DeviceKeyPress events from this device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XSelectExtensionEvent can generate a BadWindow or BadClass
+error\&. The XGetSelectedExtensionEvents request reports the
+extension events selected by this client and all clients for
+the specified window\&. This request returns pointers to two
+XEventClass arrays\&. One lists the input extension events
+selected by this client from the specified window\&. The other
+lists the event classes selected by all clients from the
+specified window\&. You should use XFree to free these two
+arrays\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XGetSelectedExtensionEvents can generate a BadWindow error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadClass
+       A value for an XEventClass is invalid\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XSelectExtensionEvent.txt b/man/XSelectExtensionEvent.txt
new file mode 100755 (executable)
index 0000000..cbcfffe
--- /dev/null
@@ -0,0 +1,123 @@
+XSELECTEXTENSIONEVENT(libmansuffix)
+===================================
+
+NAME
+----
+
+   XSelectExtensionEvent, XGetSelectedExtensionEvents - select
+   extension events, get the list of currently selected extension
+   events
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   XSelectExtensionEvent( Display *display,
+                          Window w,
+                          XEventClass *event_list,
+                          int event_count);
+
+   XGetSelectedExtensionEvents( Display *display,
+                                Window w,
+                                int *this_client_event_count_return,
+                                XEventClass **this_client_event_list_return,
+                                int *all_clients_event_count_return,
+                                XEventClass **all_clients_event_list_return);
+
+   display
+          Specifies the connection to the X server.
+
+   w
+          Specifies the window whose events you are interested in.
+
+   event_list
+          Specifies the list of event classes that describe the
+          events you are interested in.
+
+   event_count
+          Specifies the count of event classes in the event list.
+
+   this_client_event_count_return
+          Returns the count of event classes selected by this
+          client.
+
+   this_client_event_list_return
+          Returns a pointer to the list of event classes selected
+          by this client.
+
+   all_clients_event_count_return
+          Returns the count of event classes selected by all
+          clients.
+
+   all_clients_event_list_return
+          Returns a pointer to the list of event classes selected
+          by all clients.
+
+DESCRIPTION
+-----------
+
+   The XSelectExtensionEvent request causes the X server to report
+   the events associated with the specified list of event classes.
+   Initially, X will not report any of these events. Events are
+   reported relative to a window. If a window is not interested in
+   a device event, it usually propagates to the closest ancestor
+   that is interested, unless the do_not_propagate mask prohibits
+   it.
+
+   Multiple clients can select for the same events on the same
+   window with the following restrictions:
+     * Multiple clients can select events on the same window
+       because their event masks are disjoint. When the X server
+       generates an event, it reports it to all interested
+       clients.
+     * Only one client at a time can select a DeviceButtonPress
+       event with automatic passive grabbing enabled, which is
+       associated with the event class DeviceButtonPressGrab. To
+       receive DeviceButtonPress events without automatic passive
+       grabbing, use event class DeviceButtonPress but do not
+       specify event class DeviceButtonPressGrab.
+
+   The server reports the event to all interested clients.
+
+   Information contained in the XDevice structure returned by
+   XOpenDevice is used by macros to obtain the event classes that
+   clients use in making XSelectExtensionEvent requests. Currently
+   defined macros include DeviceKeyPress, DeviceKeyRelease,
+   DeviceButtonPress, DeviceButtonRelese, DeviceMotionNotify,
+   DeviceFocusIn, DeviceFocusOut, ProximityIn, ProximityOut,
+   DeviceStateNotify, DeviceMappiingNotify, ChangeDeviceNotify,
+   DevicePointerMotionHint, DeviceButton1Motion,
+   DeviceButton2Motion, DeviceButton3Motion, DeviceButton4Motion,
+   DeviceButton5Motion, DeviceButtonMotion, DeviceOwnerGrabButton,
+   DeviceButtonPressGrab, and NoExtensionEvent.
+
+   To obtain the proper event class for a particular device, one
+   of the above macros is invoked using the XDevice structure for
+   that device. For example,
+                DeviceKeyPress (*device, type, eventclass);
+
+   returns the DeviceKeyPress event type and the eventclass for
+   selecting DeviceKeyPress events from this device.
+
+   XSelectExtensionEvent can generate a BadWindow or BadClass
+   error. The XGetSelectedExtensionEvents request reports the
+   extension events selected by this client and all clients for
+   the specified window. This request returns pointers to two
+   XEventClass arrays. One lists the input extension events
+   selected by this client from the specified window. The other
+   lists the event classes selected by all clients from the
+   specified window. You should use XFree to free these two
+   arrays.
+
+   XGetSelectedExtensionEvents can generate a BadWindow error.
+
+DIAGNOSTICS
+-----------
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          window.
+
+   BadClass
+          A value for an XEventClass is invalid.
diff --git a/man/XSendExtensionEvent.man b/man/XSendExtensionEvent.man
new file mode 100755 (executable)
index 0000000..a23b539
--- /dev/null
@@ -0,0 +1,197 @@
+'\" t
+.\"     Title: xsendextensionevent
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XSENDEXTENSIONEVENT" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XSendExtensionEvent \- send input extension events to a client
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+Status XSendExtensionEvent( Display *display,
+                            XDevice *device,
+                            Window destination,
+                            Bool propagate,
+                            int event_count,
+                            XEventClass *event_list,
+                            XEvent *event_send);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device from which the events are to be
+       sent\&.
+.fi
+.sp
+.nf
+destination
+       Specifies the window the event is to be sent to\&. You can
+       pass window id, PointerWindow,or InputFocus\&.
+.fi
+.sp
+.nf
+propagate
+       Specifies a Boolean value that is either True or False\&.
+.fi
+.sp
+.nf
+event_count
+       Specifies the count of XEventClasses in event_list\&.
+.fi
+.sp
+.nf
+event_list
+       Specifies the list of event selections to be used\&.
+.fi
+.sp
+.nf
+event_send
+       Specifies a pointer to the event that is to be sent\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XSendExtensionEvent request identifies the destination
+window, determines which clients should receive the specified
+events, and ignores any active grabs\&. This request requires you
+to pass an event class list\&. For a discussion of the valid
+event class names, see XOpenDevice(libmansuffix) This
+request uses the w argument to identify the destination window
+as follows:
+  * If w is PointerWindow,the destination window is the window
+    that contains the pointer\&.
+  * If w is InputFocusand if the focus window contains the
+    pointer,the destination window is the window that contains
+    the pointer; otherwise, the destination window is the focus
+    window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+To determine which clients should receive the specified events,
+XSendExtensionEventuses the propagate argument as follows:
+  * If event_list is the empty set,the event is sent to the
+    client that created the destination window\&. If that client
+    no longer exists,no event is sent\&.
+  * If propagate is False,the event is sent to every client
+    selecting on destination any of the eventtypes specified by
+    the event_list array\&.
+  * If propagate is Trueand no clients have selected on
+    destination any ofthe events specified by the event_list
+    array,the destination is replaced with theclosest ancestor
+    of destination for which some client has selected atype
+    specified by the event\-list array and for which no
+    interveningwindow has that type in
+    itsdo\-not\-propagate\-mask\&. If no such window exists or if
+    the window isan ancestor of the focus window and
+    InputFocuswas originally specifiedas the destination, the
+    event is not sent to any clients\&. Otherwise, the event is
+    reported to every client selecting on the finaldestination
+    any of the events specified in the event_list array\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The event in the XEventstructure must be one of the events
+defined by the input extension (or a BadValueerror results) so
+that the X server can correctly byte\-swapthe contents as
+necessary\&. The contents of the event areotherwise unaltered and
+unchecked by the X server except to force send_event to Truein
+the forwarded event and to set the serial number in the event
+correctly\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XSendExtensionEventreturns zero if the conversion to wire
+protocol format failedand returns nonzero
+otherwise\&.XSendExtensionEventcan generate BadClass, BadDevice,
+BadValue, and BadWindow errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if the
+       specified device is the X keyboard or X pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       Some numeric value falls outside the range of values
+       accepted by the request\&. Unless a specific range is
+       specified for an argument, the full range defined by the
+       argument\'s type is accepted\&. Any argument defined as a
+       set of alternatives can generate this error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       window\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XSendExtensionEvent.txt b/man/XSendExtensionEvent.txt
new file mode 100755 (executable)
index 0000000..77051a5
--- /dev/null
@@ -0,0 +1,114 @@
+XSENDEXTENSIONEVENT(libmansuffix)
+=================================
+
+NAME
+----
+
+   XSendExtensionEvent - send input extension events to a client
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   Status XSendExtensionEvent( Display *display,
+                               XDevice *device,
+                               Window destination,
+                               Bool propagate,
+                               int event_count,
+                               XEventClass *event_list,
+                               XEvent *event_send);
+   
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device from which the events are to be
+          sent.
+
+   destination
+          Specifies the window the event is to be sent to. You can
+          pass window id, PointerWindow,or InputFocus.
+
+   propagate
+          Specifies a Boolean value that is either True or False.
+
+   event_count
+          Specifies the count of XEventClasses in event_list.
+
+   event_list
+          Specifies the list of event selections to be used.
+
+   event_send
+          Specifies a pointer to the event that is to be sent.
+
+DESCRIPTION
+-----------
+
+   The XSendExtensionEvent request identifies the destination
+   window, determines which clients should receive the specified
+   events, and ignores any active grabs. This request requires you
+   to pass an event class list. For a discussion of the valid
+   event class names, see XOpenDevice(libmansuffix) This
+   request uses the w argument to identify the destination window
+   as follows:
+     * If w is PointerWindow,the destination window is the window
+       that contains the pointer.
+     * If w is InputFocusand if the focus window contains the
+       pointer,the destination window is the window that contains
+       the pointer; otherwise, the destination window is the focus
+       window.
+
+   To determine which clients should receive the specified events,
+   XSendExtensionEventuses the propagate argument as follows:
+     * If event_list is the empty set,the event is sent to the
+       client that created the destination window. If that client
+       no longer exists,no event is sent.
+     * If propagate is False,the event is sent to every client
+       selecting on destination any of the eventtypes specified by
+       the event_list array.
+     * If propagate is Trueand no clients have selected on
+       destination any ofthe events specified by the event_list
+       array,the destination is replaced with theclosest ancestor
+       of destination for which some client has selected atype
+       specified by the event-list array and for which no
+       interveningwindow has that type in
+       itsdo-not-propagate-mask. If no such window exists or if
+       the window isan ancestor of the focus window and
+       InputFocuswas originally specifiedas the destination, the
+       event is not sent to any clients. Otherwise, the event is
+       reported to every client selecting on the finaldestination
+       any of the events specified in the event_list array.
+
+   The event in the XEventstructure must be one of the events
+   defined by the input extension (or a BadValueerror results) so
+   that the X server can correctly byte-swapthe contents as
+   necessary. The contents of the event areotherwise unaltered and
+   unchecked by the X server except to force send_event to Truein
+   the forwarded event and to set the serial number in the event
+   correctly.
+
+   XSendExtensionEventreturns zero if the conversion to wire
+   protocol format failedand returns nonzero
+   otherwise.XSendExtensionEventcan generate BadClass, BadDevice,
+   BadValue, and BadWindow errors.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if the
+          specified device is the X keyboard or X pointer device.
+
+   BadValue
+          Some numeric value falls outside the range of values
+          accepted by the request. Unless a specific range is
+          specified for an argument, the full range defined by the
+          argument's type is accepted. Any argument defined as a
+          set of alternatives can generate this error.
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          window.
diff --git a/man/XSetDeviceButtonMapping.man b/man/XSetDeviceButtonMapping.man
new file mode 100755 (executable)
index 0000000..1489459
--- /dev/null
@@ -0,0 +1,183 @@
+'\" t
+.\"     Title: xsetdevicebuttonmapping
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XSETDEVICEBUTTONMAPP" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XSetDeviceButtonMapping, XGetDeviceButtonMapping \- query or change device button mappings
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+int XSetDeviceButtonMapping( Display *display,
+                             XDevice *device,
+                             unsigned char map[],
+                             int nmap);
+.fi
+.sp
+.nf
+int XGetDeviceButtonMapping( Display *display,
+                             XDevice *device,
+                             unsigned char map_return[],
+                             int nmap);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device whose button mapping is to be
+       queried or changed\&.
+.fi
+.sp
+.nf
+map
+       Specifies the mapping list\&.
+.fi
+.sp
+.nf
+map_return
+       Returns the mapping list\&.
+.fi
+.sp
+.nf
+nmap
+       Specifies the number of items in the mapping list\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XSetDeviceButtonMapping request sets the mapping of the
+specified device\&. If it succeeds, the X server generates a
+DeviceMappingNotify event, and XSetDeviceButtonMapping returns
+MappingSuccess\&. Element map[i] defines the logical button
+number for the physical button i+1\&. The length of the list must
+be the same as XGetDeviceButtonMapping would return, or a
+BadValue error results\&. A zero element disables a button, and
+elements are not restricted in value by the number of physical
+buttons\&. However, no two elements can have the same nonzero
+value, or a BadValue error results\&. If any of the buttons to be
+altered are logically in the down state,
+XSetDeviceButtonMapping returns MappingBusy, and the mapping is
+not changed\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XSetDeviceButtonMapping can generate BadDevice, BadMatch, and
+BadValue errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XGetDeviceButtonMapping request returns the current mapping
+of the specified device\&. Buttons are numbered starting from
+one\&.XGetDeviceButtonMapping returns the number of physical
+buttons actually on the device\&. The nominal mapping for a
+device is map[i]=i+1\&. The nmap argument specifies the length of
+the array where the device mapping is returned, and only the
+first nmap elements are returned in map_return\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XGetDeviceButtonMapping can generate BadDevice or BadMatch
+errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if the
+       specified device is the X keyboard or X pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if an XGetDeviceButtonMapping or
+       XSetDeviceButtonMapping request was made specifying a
+       device that has no buttons\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       Some numeric value falls outside the range of values
+       accepted by the request\&. Unless a specific range is
+       specified for an argument, the full range defined by the
+       argument\'s type is accepted\&. Any argument defined as a
+       set of alternatives can generate this error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "SEE ALSO"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XChangeDeviceKeyboardControl(libmansuffix), XChangeDeviceKeyMapping(libmansuffix),
+XChangeDeviceModifierMapping(libmansuffix)
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XSetDeviceButtonMapping.txt b/man/XSetDeviceButtonMapping.txt
new file mode 100755 (executable)
index 0000000..4c1251c
--- /dev/null
@@ -0,0 +1,97 @@
+XSETDEVICEBUTTONMAPPING(libmansuffix)
+=====================================
+
+NAME
+----
+
+   XSetDeviceButtonMapping, XGetDeviceButtonMapping - query or
+   change device button mappings
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   int XSetDeviceButtonMapping( Display *display,
+                                XDevice *device,
+                                unsigned char map[],
+                                int nmap);
+
+   int XGetDeviceButtonMapping( Display *display,
+                                XDevice *device,
+                                unsigned char map_return[],
+                                int nmap);
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device whose button mapping is to be
+          queried or changed.
+
+   map
+          Specifies the mapping list.
+
+   map_return
+          Returns the mapping list.
+
+   nmap
+          Specifies the number of items in the mapping list.
+
+DESCRIPTION
+-----------
+
+   The XSetDeviceButtonMapping request sets the mapping of the
+   specified device. If it succeeds, the X server generates a
+   DeviceMappingNotify event, and XSetDeviceButtonMapping returns
+   MappingSuccess. Element map[i] defines the logical button
+   number for the physical button i+1. The length of the list must
+   be the same as XGetDeviceButtonMapping would return, or a
+   BadValue error results. A zero element disables a button, and
+   elements are not restricted in value by the number of physical
+   buttons. However, no two elements can have the same nonzero
+   value, or a BadValue error results. If any of the buttons to be
+   altered are logically in the down state,
+   XSetDeviceButtonMapping returns MappingBusy, and the mapping is
+   not changed.
+
+   XSetDeviceButtonMapping can generate BadDevice, BadMatch, and
+   BadValue errors.
+
+   The XGetDeviceButtonMapping request returns the current mapping
+   of the specified device. Buttons are numbered starting from
+   one.XGetDeviceButtonMapping returns the number of physical
+   buttons actually on the device. The nominal mapping for a
+   device is map[i]=i+1. The nmap argument specifies the length of
+   the array where the device mapping is returned, and only the
+   first nmap elements are returned in map_return.
+
+   XGetDeviceButtonMapping can generate BadDevice or BadMatch
+   errors.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if the
+          specified device is the X keyboard or X pointer device.
+
+   BadMatch
+          This error may occur if an XGetDeviceButtonMapping or
+          XSetDeviceButtonMapping request was made specifying a
+          device that has no buttons.
+
+   BadValue
+          Some numeric value falls outside the range of values
+          accepted by the request. Unless a specific range is
+          specified for an argument, the full range defined by the
+          argument's type is accepted. Any argument defined as a
+          set of alternatives can generate this error.
+
+SEE ALSO
+--------
+
+   XChangeDeviceKeyboardControl(libmansuffix), XChangeDeviceKeyMapping(libmansuffix),
+   XChangeDeviceModifierMapping(libmansuffix)
diff --git a/man/XSetDeviceFocus.man b/man/XSetDeviceFocus.man
new file mode 100755 (executable)
index 0000000..95f0a00
--- /dev/null
@@ -0,0 +1,288 @@
+'\" t
+.\"     Title: xsetdevicefocus
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XSETDEVICEFOCUS" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XSetDeviceFocus, XGetDeviceFocus \- control extension input device focus
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+XSetDeviceFocus( Display *display,
+                 XDevice *device,
+                 Window focus,
+                 int revert_to,
+                 Time time);
+.fi
+.sp
+.nf
+XGetDeviceFocus( Display *display,
+                 XDevice *device,
+                 Window *focus_return,
+                 int *revert_to_return,
+                 int * time_return);
+.fi
+.sp
+Arguments
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device whose focus is to be queried or
+       changed\&.
+.fi
+.sp
+.nf
+focus
+       Specifies the window, PointerRoot, FollowKeyboard,or
+       None\&.
+.fi
+.sp
+.nf
+focus_return
+       Returns the focus window, PointerRoot, FollowKeyboard,or
+       None\&.
+.fi
+.sp
+.nf
+revert_to
+       Specifies where the input focus reverts to if the window
+       becomes notviewable\&.You can pass RevertToParent,
+       RevertToPointerRoot, RevertToFollowKeyboard,or
+       RevertToNone\&.
+.fi
+.sp
+.nf
+revert_to_return
+       Returns the current focus state RevertToParent,
+       RevertToPointerRoot, RevertToFollowKeyboard,or
+       RevertToNone\&.
+.fi
+.sp
+.nf
+time_return
+       Returns the last_focus_time for the device\&.
+.fi
+.sp
+.nf
+time
+       Specifies the time\&.You can pass either a timestamp or
+       CurrentTime\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XSetDeviceFocus request changes the focus of the specified
+device and its last\-focus\-change time\&. It has no effect if the
+specified time is earlier than the current last\-focus\-change
+time or is later than the current X server time\&. Otherwise, the
+last\-focus\-change time is set to the specified time CurrentTime
+is replaced by the current X server time)\&. XSetDeviceFocus
+causes the X server to generate DeviceFocusIn and
+DeviceFocusOut events\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Depending on the focus argument, the following occurs:
+  * If focus is None , all device events are discarded until a
+    new focus window is set, and the revert_to argument is
+    ignored\&.
+  * If focus is a window, it becomes the device\'s focus window\&.
+    If a generated device event would normally be reported to
+    this window or one of its inferiors, the event is reported
+    as usual\&. Otherwise, the event is reported relative to the
+    focus window\&.
+  * If focus is PointerRoot, the focus window is dynamically
+    taken to be the root window of whatever screen the pointer
+    is on at each event from the specified device\&. In this
+    case, the revert_to argument is ignored\&.
+  * If focus is FollowKeyboard, the focus window is dynamically
+    taken to be the window to which the X keyboard focus is set
+    at each input event\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The specified focus window must be viewable at the time
+XSetDeviceFocus is called, or a BadMatch error results\&. If the
+focus window later becomes not viewable, the X server evaluates
+the revert_to argument to determine the new focus window as
+follows:
+  * If revert_to is RevertToParent, the focus reverts to the
+    parent (or the closest viewable ancestor), and the new
+    revert_to value is taken to be RevertToNone\&.
+  * If revert_to is RevertToPointerRoot,
+    RevertToFollowKeyboard, or RevertToNone, the focus reverts
+    to PointerRoot, FollowKeyboard, or None, respectively\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+When the focus reverts, the X server generates DeviceFocusIn
+and DeviceFocusOut events, but the last\-focus\-change time is
+not affected\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Input extension devices are not required to support the ability
+to be focused\&. Attempting to set the focus of a device that
+does not support this request will result in a BadMatch error\&.
+Whether or not given device can support this request can be
+determined by the information returned by XOpenDevice\&. For
+those devices that support focus, XOpenDevice will return an
+XInputClassInfo structure with the input_class field equal to
+the constant FocusClass (defined in the file XI\&.h)\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XSetDeviceFocus can generate BadDevice, BadMatch, BadValue, and
+BadWindow errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XGetDeviceFocus request returns the focus window and the
+current focus state\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+Not all input extension devices can be focused\&. Attempting to
+query the focus state of a device that can\'t be focused results
+in a BadMatch error\&. A device that can be focused returns
+information for input Class Focus when an XOpenDevice request
+is made\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XGetDeviceFocus can generate BadDevice, and BadMatch errors\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if the
+       specified device is the X keyboard or X pointer device\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       Some numeric value falls outside the range of values
+       accepted by the request\&. Unless a specific range is
+       specified for an argument, the full range defined by the
+       argument\'s type is accepted\&. Any argument defined as a
+       set of alternatives can generate this error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadWindow
+       A value for a Window argument does not name a defined
+       Window\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if an XGetDeviceFocus or
+       XSetDeviceFocus request was made specifying a device
+       that the server implementation does not allow to be
+       focused\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XSetDeviceFocus.txt b/man/XSetDeviceFocus.txt
new file mode 100755 (executable)
index 0000000..2d92a9f
--- /dev/null
@@ -0,0 +1,154 @@
+XSETDEVICEFOCUS(libmansuffix)
+=============================
+
+NAME
+----
+
+   XSetDeviceFocus, XGetDeviceFocus - control extension input
+   device focus
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   XSetDeviceFocus( Display *display,
+                    XDevice *device,
+                    Window focus,
+                    int revert_to,
+                    Time time);
+   
+   XGetDeviceFocus( Display *display,
+                    XDevice *device,
+                    Window *focus_return,
+                    int *revert_to_return,
+                    int * time_return);
+
+Arguments
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device whose focus is to be queried or
+          changed.
+
+   focus
+          Specifies the window, PointerRoot, FollowKeyboard,or
+          None.
+
+   focus_return
+          Returns the focus window, PointerRoot, FollowKeyboard,or
+          None.
+
+   revert_to
+          Specifies where the input focus reverts to if the window
+          becomes notviewable.You can pass RevertToParent,
+          RevertToPointerRoot, RevertToFollowKeyboard,or
+          RevertToNone.
+
+   revert_to_return
+          Returns the current focus state RevertToParent,
+          RevertToPointerRoot, RevertToFollowKeyboard,or
+          RevertToNone.
+
+   time_return
+          Returns the last_focus_time for the device.
+
+   time
+          Specifies the time.You can pass either a timestamp or
+          CurrentTime.
+
+DESCRIPTION
+-----------
+
+   The XSetDeviceFocus request changes the focus of the specified
+   device and its last-focus-change time. It has no effect if the
+   specified time is earlier than the current last-focus-change
+   time or is later than the current X server time. Otherwise, the
+   last-focus-change time is set to the specified time CurrentTime
+   is replaced by the current X server time). XSetDeviceFocus
+   causes the X server to generate DeviceFocusIn and
+   DeviceFocusOut events.
+
+   Depending on the focus argument, the following occurs:
+     * If focus is None , all device events are discarded until a
+       new focus window is set, and the revert_to argument is
+       ignored.
+     * If focus is a window, it becomes the device's focus window.
+       If a generated device event would normally be reported to
+       this window or one of its inferiors, the event is reported
+       as usual. Otherwise, the event is reported relative to the
+       focus window.
+     * If focus is PointerRoot, the focus window is dynamically
+       taken to be the root window of whatever screen the pointer
+       is on at each event from the specified device. In this
+       case, the revert_to argument is ignored.
+     * If focus is FollowKeyboard, the focus window is dynamically
+       taken to be the window to which the X keyboard focus is set
+       at each input event.
+
+   The specified focus window must be viewable at the time
+   XSetDeviceFocus is called, or a BadMatch error results. If the
+   focus window later becomes not viewable, the X server evaluates
+   the revert_to argument to determine the new focus window as
+   follows:
+     * If revert_to is RevertToParent, the focus reverts to the
+       parent (or the closest viewable ancestor), and the new
+       revert_to value is taken to be RevertToNone.
+     * If revert_to is RevertToPointerRoot,
+       RevertToFollowKeyboard, or RevertToNone, the focus reverts
+       to PointerRoot, FollowKeyboard, or None, respectively.
+
+   When the focus reverts, the X server generates DeviceFocusIn
+   and DeviceFocusOut events, but the last-focus-change time is
+   not affected.
+
+   Input extension devices are not required to support the ability
+   to be focused. Attempting to set the focus of a device that
+   does not support this request will result in a BadMatch error.
+   Whether or not given device can support this request can be
+   determined by the information returned by XOpenDevice. For
+   those devices that support focus, XOpenDevice will return an
+   XInputClassInfo structure with the input_class field equal to
+   the constant FocusClass (defined in the file XI.h).
+
+   XSetDeviceFocus can generate BadDevice, BadMatch, BadValue, and
+   BadWindow errors.
+
+   The XGetDeviceFocus request returns the focus window and the
+   current focus state.
+
+   Not all input extension devices can be focused. Attempting to
+   query the focus state of a device that can't be focused results
+   in a BadMatch error. A device that can be focused returns
+   information for input Class Focus when an XOpenDevice request
+   is made.
+
+   XGetDeviceFocus can generate BadDevice, and BadMatch errors.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if the
+          specified device is the X keyboard or X pointer device.
+
+   BadValue
+          Some numeric value falls outside the range of values
+          accepted by the request. Unless a specific range is
+          specified for an argument, the full range defined by the
+          argument's type is accepted. Any argument defined as a
+          set of alternatives can generate this error.
+
+   BadWindow
+          A value for a Window argument does not name a defined
+          Window.
+
+   BadMatch
+          This error may occur if an XGetDeviceFocus or
+          XSetDeviceFocus request was made specifying a device
+          that the server implementation does not allow to be
+          focused.
diff --git a/man/XSetDeviceMode.man b/man/XSetDeviceMode.man
new file mode 100755 (executable)
index 0000000..07f6106
--- /dev/null
@@ -0,0 +1,116 @@
+'\" t
+.\"     Title: xsetdevicemode
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XSETDEVICEMODE" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XSetDeviceMode \- change the mode of a device
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+XSetDeviceMode( Display *display,
+                XDevice *device,
+                int mode);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device whose mode is to be changed\&.
+.fi
+.sp
+.nf
+mode
+       Specifies the mode\&.You can pass Absolute,or Relative\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XSetDeviceMode request changes the mode of an input device
+that is capable of reporting either absolute positional
+information or relative motion information\&. Not all input
+devices are capable of reporting motion data, and not all are
+capable of changing modes from Absolute to Relative\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XSetDeviceMode can generate a BadDevice or BadMode error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&. This error may also occur if some
+       other client has caused the specified device to become
+       the X keyboard or X pointer device via the
+       XChangeKeyboardDevice or XChangePointerDevice requests\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if an XSetDeviceMode request is
+       made specifying a device that has no valuators and
+       reports no axes of motion\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMode
+       An invalid mode was specified\&. This error will also be
+       returned if the specified device is not capable of
+       supporting the XSetDeviceMode request\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XSetDeviceMode.txt b/man/XSetDeviceMode.txt
new file mode 100755 (executable)
index 0000000..947ccfc
--- /dev/null
@@ -0,0 +1,57 @@
+XSETDEVICEMODE(libmansuffix)
+============================
+
+NAME
+----
+
+   XSetDeviceMode - change the mode of a device
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   XSetDeviceMode( Display *display,
+                   XDevice *device,
+                   int mode);
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device whose mode is to be changed.
+
+   mode
+          Specifies the mode.You can pass Absolute,or Relative.
+
+DESCRIPTION
+-----------
+
+   The XSetDeviceMode request changes the mode of an input device
+   that is capable of reporting either absolute positional
+   information or relative motion information. Not all input
+   devices are capable of reporting motion data, and not all are
+   capable of changing modes from Absolute to Relative.
+
+   XSetDeviceMode can generate a BadDevice or BadMode error.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice. This error may also occur if some
+          other client has caused the specified device to become
+          the X keyboard or X pointer device via the
+          XChangeKeyboardDevice or XChangePointerDevice requests.
+
+   BadMatch
+          This error may occur if an XSetDeviceMode request is
+          made specifying a device that has no valuators and
+          reports no axes of motion.
+
+   BadMode
+          An invalid mode was specified. This error will also be
+          returned if the specified device is not capable of
+          supporting the XSetDeviceMode request.
diff --git a/man/XSetDeviceModifierMapping.man b/man/XSetDeviceModifierMapping.man
new file mode 100755 (executable)
index 0000000..1f3aa2d
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XGetDeviceModifierMapping.libmansuffix
diff --git a/man/XSetDeviceValuators.man b/man/XSetDeviceValuators.man
new file mode 100755 (executable)
index 0000000..ceddda4
--- /dev/null
@@ -0,0 +1,144 @@
+'\" t
+.\"     Title: xsetdevicevaluators
+.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\"      Date: 09/07/2010
+.\"    Manual: [FIXME: manual]
+.\"    Source: [FIXME: source]
+.\"  Language: English
+.\"
+.TH "XSETDEVICEVALUATORS" "libmansuffix" "09/07/2010" "[FIXME: source]" "[FIXME: manual]"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+XSetDeviceValuators \- initialize the valuators on an extension input device
+.SH "SYNOPSIS"
+.sp
+.nf
+#include <X11/extensions/XInput\&.h>
+.fi
+.sp
+.nf
+XSetDeviceValuators( Display *display,
+                     XDevice *device,
+                     int *valuators,
+                     int first_valuator,
+                     int num_valuators);
+.fi
+.sp
+.nf
+display
+       Specifies the connection to the X server\&.
+.fi
+.sp
+.nf
+device
+       Specifies the device whose valuators are to be
+       initialized\&.
+.fi
+.sp
+.nf
+valuators
+       Specifies a pointer to an array of integer values to be
+       used to initialize thedevice valuators\&.
+.fi
+.sp
+.nf
+first_valuator
+       Specifies the first valuator to be set\&. Valuators are
+       numbered beginning withzero\&.
+.fi
+.sp
+.nf
+num_valuators
+       Specifies the number of valuators to be set\&.
+.fi
+.SH "DESCRIPTION"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+The XSetDeviceValuators request sets the current values of the
+valuators of an input device\&. The valuators in the range
+first_valuator to (first_valuator + num_valuators) are set to
+the specified values\&. Valuators are numbered beginning with 0\&.
+Not all input devices support initialization of valuator
+values\&. If this request is made to a device that does not
+support valuators initialization, a BadMatch error will occur\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+If the request succeeds, a status of Success is returned\&. If
+another client has the device grabbed, a status of
+AlreadyGrabbed is returned\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+XSetDeviceValuators can generate a BadLength, BadDevice,
+BadMatch, or BadValue error\&.
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DIAGNOSTICS"
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadDevice
+       An invalid device was specified\&. The specified device
+       does not exist or has not been opened by this client via
+       XOpenInputDevice\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadMatch
+       This error may occur if an XSetDeviceValuators request
+       is made specifying a device that has no valuators and
+       reports no axes of motion, or if such a request is made
+       specifying a device that does not support valuator
+       initialization\&.
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+BadValue
+       An invalid first_valuator or num_valuators values was
+       specified\&.
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/XSetDeviceValuators.txt b/man/XSetDeviceValuators.txt
new file mode 100755 (executable)
index 0000000..1116cea
--- /dev/null
@@ -0,0 +1,74 @@
+XSETDEVICEVALUATORS(libmansuffix)
+=================================
+
+NAME
+----
+
+   XSetDeviceValuators - initialize the valuators on an extension input device
+
+SYNOPSIS
+--------
+
+   #include <X11/extensions/XInput.h>
+
+   XSetDeviceValuators( Display *display,
+                        XDevice *device,
+                        int *valuators,
+                        int first_valuator,
+                        int num_valuators);
+
+   display
+          Specifies the connection to the X server.
+
+   device
+          Specifies the device whose valuators are to be
+          initialized.
+
+   valuators
+          Specifies a pointer to an array of integer values to be
+          used to initialize thedevice valuators.
+
+   first_valuator
+          Specifies the first valuator to be set. Valuators are
+          numbered beginning withzero.
+
+   num_valuators
+          Specifies the number of valuators to be set.
+
+DESCRIPTION
+-----------
+
+   The XSetDeviceValuators request sets the current values of the
+   valuators of an input device. The valuators in the range
+   first_valuator to (first_valuator + num_valuators) are set to
+   the specified values. Valuators are numbered beginning with 0.
+   Not all input devices support initialization of valuator
+   values. If this request is made to a device that does not
+   support valuators initialization, a BadMatch error will occur.
+
+   If the request succeeds, a status of Success is returned. If
+   another client has the device grabbed, a status of
+   AlreadyGrabbed is returned.
+
+   XSetDeviceValuators can generate a BadLength, BadDevice,
+   BadMatch, or BadValue error.
+
+DIAGNOSTICS
+-----------
+
+   BadDevice
+          An invalid device was specified. The specified device
+          does not exist or has not been opened by this client via
+          XOpenInputDevice.
+
+   BadMatch
+          This error may occur if an XSetDeviceValuators request
+          is made specifying a device that has no valuators and
+          reports no axes of motion, or if such a request is made
+          specifying a device that does not support valuator
+          initialization.
+
+   BadValue
+          An invalid first_valuator or num_valuators values was
+          specified.
+
diff --git a/man/XUngrabDevice.man b/man/XUngrabDevice.man
new file mode 100755 (executable)
index 0000000..f7925d1
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XGrabDevice.libmansuffix
diff --git a/man/XUngrabDeviceButton.man b/man/XUngrabDeviceButton.man
new file mode 100755 (executable)
index 0000000..aed816d
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XGrabDeviceButton.libmansuffix
diff --git a/man/XUngrabDeviceKey.man b/man/XUngrabDeviceKey.man
new file mode 100755 (executable)
index 0000000..19849bb
--- /dev/null
@@ -0,0 +1 @@
+.so manlibmansuffix/XGrabDeviceKey.libmansuffix
diff --git a/packaging/libXi.spec b/packaging/libXi.spec
new file mode 100644 (file)
index 0000000..186987a
--- /dev/null
@@ -0,0 +1,75 @@
+
+Name:       libXi
+Summary:    X.Org X11 libXi runtime library
+Version:    1.4.0
+Release:    1
+Group:      System/Libraries
+License:    MIT
+URL:        http://www.x.org/
+Source0:    http://xorg.freedesktop.org/releases/individual/lib/%{name}-%{version}.tar.gz
+Requires(post):  /sbin/ldconfig
+Requires(postun):  /sbin/ldconfig
+BuildRequires:  pkgconfig(xorg-macros)
+BuildRequires:  pkgconfig(xproto)
+BuildRequires:  pkgconfig(x11)
+BuildRequires:  pkgconfig(xextproto)
+BuildRequires:  pkgconfig(xext)
+BuildRequires:  pkgconfig(inputproto)
+
+
+%description
+Description: %{summary}
+
+
+%package devel
+Summary:    Development components for the libXi library
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+Description: %{summary}
+
+
+%prep
+%setup -q -n %{name}-%{version}
+
+
+%build
+
+%reconfigure \
+       CFLAGS="-D_F_ENABLE_XI2_SENDEVENT_" \
+       LDFLAGS="-Wl,--hash-style=both -Wl,--as-needed"
+
+# Call make instruction with smp support
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+
+%clean
+rm -rf %{buildroot}
+
+
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/libXi.so.6
+%{_libdir}/libXi.so.6.1.0
+%doc COPYING
+
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/X11/extensions/XInput.h
+%{_includedir}/X11/extensions/XInput2.h
+%{_libdir}/libXi.so
+%{_libdir}/pkgconfig/xi.pc
+
diff --git a/specs/Makefile.am b/specs/Makefile.am
new file mode 100755 (executable)
index 0000000..93e8e85
--- /dev/null
@@ -0,0 +1,68 @@
+#
+# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+#
+# 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.
+#
+
+if ENABLE_SPECS
+
+specdir = $(docdir)/$(subdir)
+doc_sources = inputlib.xml
+dist_spec_DATA = $(doc_sources)        \
+       library.xml             \
+       encoding.xml
+
+if HAVE_XMLTO
+spec_DATA = $(doc_sources:.xml=.html)
+
+if HAVE_FOP
+spec_DATA += $(doc_sources:.xml=.ps) $(doc_sources:.xml=.pdf)
+endif
+
+if HAVE_XMLTO_TEXT
+spec_DATA += $(doc_sources:.xml=.txt)
+endif
+
+if HAVE_STYLESHEETS
+XMLTO_FLAGS = -m $(XSL_STYLESHEET)
+
+spec_DATA += xorg.css
+xorg.css: $(STYLESHEET_SRCDIR)/xorg.css
+       $(AM_V_GEN)cp -pf $(STYLESHEET_SRCDIR)/xorg.css $@
+endif
+
+CLEANFILES = $(spec_DATA)
+
+SUFFIXES = .xml .ps .pdf .txt .html
+
+%.txt: %.xml $(dist_spec_DATA)
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $<
+
+%.html: %.xml $(dist_spec_DATA)
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
+
+%.pdf: %.xml $(dist_spec_DATA)
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
+
+%.ps: %.xml $(dist_spec_DATA)
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop ps $<
+
+endif HAVE_XMLTO
+endif ENABLE_SPECS
diff --git a/specs/encoding.xml b/specs/encoding.xml
new file mode 100755 (executable)
index 0000000..7b4bceb
--- /dev/null
@@ -0,0 +1,2312 @@
+<appendix id="input_extension_protocol_encoding">
+<title>Input Extension Protocol Encoding</title>
+<para>
+<function>Syntactic Conventions</function>
+</para>
+<para>
+<!-- .LP -->
+All numbers are in decimal, 
+unless prefixed with #x, in which case they are in hexadecimal (base 16).
+</para>
+<para>
+<!-- .LP -->
+The general syntax used to describe requests, replies, errors, events, and
+compound types is:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<function>NameofThing</function>
+  encode-form
+  ...
+  encode-form
+</literallayout>
+Each encode-form describes a single component.
+</para>
+<para>
+<!-- .LP -->
+For components described in the protocol as:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+name: TYPE
+</literallayout>
+the encode-form is:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i 2.5i -->
+<!-- .ta 1i 1.5i 2.5i -->
+N      TYPE    name
+</literallayout>
+N is the number of bytes occupied in the data stream, 
+and TYPE is the interpretation of those bytes.
+For example,
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i -->
+<!-- .ta 1i 1.5i -->
+depth: CARD8
+</literallayout>
+becomes:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i 2.5i  -->
+<!-- .ta 1i 1.5i 2.5i -->
+1      CARD8   depth
+</literallayout>
+For components with a static numeric value the encode-form is:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i 2.5i -->
+<!-- .ta 1i 1.5i 2.5i -->
+N      value   name
+</literallayout>
+The value is always interpreted as an N-byte unsigned integer.
+For example, 
+the first two bytes of a Window error are always zero (indicating an
+error in general) and three (indicating the Window error in particular):
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i 2.5i -->
+<!-- .ta 1i 1.5i 2.5i -->
+1      0       Error
+1      3       code
+</literallayout>
+For components described in the protocol as:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+name: <function>{Name1, ..., NameI}</function>
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+the encode-form is:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i 2.5i -->
+<!-- .ta 1i 1.5i 2.5i -->
+N              name
+       value1 Name1
+       ...
+       valueI NameI
+</literallayout>
+The value is always interpreted as an N-byte unsigned integer.
+Note that the size of N is sometimes larger than that strictly required 
+to encode the values.
+For example:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+class: <function>{InputOutput, InputOnly, CopyFromParent}</function>
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+becomes:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i 2.5i 3i -->
+<!-- .ta 1i 1.5i 2.5i 3i -->
+2                      class
+       0       CopyFromParent
+       1       InputOutput
+       2       InputOnly
+</literallayout>
+For components described in the protocol as:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+NAME: TYPE or <function>Alternative1 ... or AlternativeI</function>
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+the encode-form is:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i 2i 2.5i 3i -->
+<!-- .ta 1i 1.5i 2i 2.5i 3i -->
+N      TYPE                    NAME
+       value1  Alternative1
+       ...
+       valueI  AlternativeI
+</literallayout>
+The alternative values are guaranteed not to conflict with the encoding
+of TYPE.  
+For example:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+destination: WINDOW or <function>PointerWindow</function> or <function>InputFocus</function>
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+becomes:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i 2.5i -->
+<!-- .ta 1i 1.5i 2.5i -->
+4      WINDOW          destination
+       0       PointerWindow
+       1       InputFocus
+</literallayout>
+For components described in the protocol as:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i -->
+<!-- .ta 1i 1.5i -->
+value-mask: BITMASK
+</literallayout>
+the encode-form is:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i 2i 2.5i  -->
+<!-- .ta 1i 1.5i 2i 2.5i -->
+N      BITMASK                 value-mask
+       mask1   mask-name1
+       ...
+       maskI   mask-nameI
+</literallayout>
+The individual bits in the mask are specified and named, 
+and N is 2 or 4.
+The most-significant bit in a BITMASK is reserved for use in defining
+chained (multiword) bitmasks, as extensions augment existing core requests.
+The precise interpretation of this bit is not yet defined here, 
+although a probable mechanism is that a 1-bit indicates that another N bytes 
+of bitmask follows, with bits within the overall mask still interpreted 
+from least-significant to most-significant with an N-byte unit, with N-byte units 
+interpreted in stream order, and with the overall mask being byte-swapped 
+in individual N-byte units.
+</para>
+<para>
+<!-- .LP -->
+For LISTofVALUE encodings, the request is followed by a section of the form:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i -->
+<!-- .ta 1i 1.5i -->
+VALUEs
+ encode-form
+ ...
+ encode-form
+</literallayout>
+listing an encode-form for each VALUE.
+The NAME in each encode-form keys to the corresponding BITMASK bit.
+The encoding of a VALUE always occupies four bytes, 
+but the number of bytes specified in the encoding-form indicates how
+many of the least-significant bytes are actually used; 
+the remaining bytes are unused and their values do not matter.
+</para>
+<para>
+<!-- .LP -->
+In various cases, the number of bytes occupied by a component will be specified
+by a lowercase single-letter variable name instead of a specific numeric
+value, and often some other component will have its value specified as a
+simple numeric expression involving these variables.
+Components specified with such expressions are always interpreted 
+as unsigned integers.
+The scope of such variables is always just the enclosing request, reply, 
+error, event, or compound type structure.
+For example:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i 2i 2.5i -->
+<!-- .ta 1i 1.5i 2i 2.5i -->
+2      3+n                     request length
+4n     LISTofPOINT             points
+</literallayout>
+For unused bytes (the values of the bytes are undefined and do not matter),
+the encode-form is:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i 2i 2.5i -->
+<!-- .ta 1i 1.5i 2i 2.5i -->
+N                      unused
+</literallayout>
+If the number of unused bytes is variable, the encode-form typically is:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i 2i 2.5i -->
+<!-- .ta 1i 1.5i 2i 2.5i -->
+p                      unused, p=pad(E)
+</literallayout>
+where E is some expression,
+and pad(E) is the number of bytes needed to round E up to a multiple of four.
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA 1i 1.5i 2i 2.5i -->
+<!-- .ta 1i 1.5i 2i 2.5i -->
+pad(E) = (4 - (E mod 4)) mod 4
+</literallayout>
+<!-- .ps +2 -->
+<function>Common Types</function>
+<!-- .ps -->
+</para>
+<para>
+<!-- .LP -->
+LISTofFOO
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+In this document the LISTof notation strictly means some number of repetitions
+of the FOO encoding; 
+the actual length of the list is encoded elsewhere.
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+SETofFOO
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+A set is always represented by a bitmask, with a 1-bit indicating presence in
+the set.
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+BITMASK: CARD32
+</para>
+<para>
+<!-- .LP -->
+WINDOW: CARD32
+</para>
+<para>
+<!-- .LP -->
+BYTE: 8-bit value
+</para>
+<para>
+<!-- .LP -->
+INT8: 8-bit signed integer
+</para>
+<para>
+<!-- .LP -->
+INT16: 16-bit signed integer
+</para>
+<para>
+<!-- .LP -->
+INT32: 32-bit signed integer
+</para>
+<para>
+<!-- .LP -->
+CARD8: 8-bit unsigned integer
+</para>
+<para>
+<!-- .LP -->
+CARD16: 16-bit unsigned integer
+</para>
+<para>
+<!-- .LP -->
+CARD32: 32-bit unsigned integer
+</para>
+<para>
+<!-- .LP -->
+TIMESTAMP: CARD32
+</para>
+<para>
+<!-- .LP -->
+EVENTCLASS: CARD32
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .75i 1.75i -->
+<!-- .ta .75i 1.75i -->
+INPUTCLASS
+       0       KeyClass
+       1       ButtonClass
+       2       ValuatorClass
+       3       FeedbackClass
+       4       ProximityClass
+       5       FocusClass
+       6       OtherClass
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .75i 1.75i -->
+<!-- .ta .75i 1.75i -->
+INPUTCLASS
+       0       KbdFeedbackClass
+       1       PtrFeedbackClass
+       2       StringFeedbackClass
+       3       IntegerFeedbackClass
+       4       LedFeedbackClass
+       5       BellFeedbackClass
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .75i 1.75i -->
+<!-- .ta .75i 1.75i -->
+INPUTINFO
+       0       KEYINFO
+       1       BUTTONINFO
+       2       VALUATORINFO
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .75i 1.75i -->
+<!-- .ta .75i 1.75i -->
+DEVICEMODE
+       0       Relative
+       1       Absolute
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .75i 1.75i -->
+<!-- .ta .75i 1.75i -->
+PROXIMITYSTATE
+       0       InProximity
+       1       OutOfProximity
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .75i 1.75i -->
+<!-- .ta .75i 1.75i -->
+BOOL
+       0       False
+       1       True
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+KEYSYM: CARD32
+</para>
+<para>
+<!-- .LP -->
+KEYCODE: CARD8
+</para>
+<para>
+<!-- .LP -->
+BUTTON: CARD8
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .75i 1.75i -->
+<!-- .ta .75i 1.75i -->
+SETofKEYBUTMASK
+       #x0001  Shift
+       #x0002  Lock
+       #x0004  Control
+       #x0008  Mod1
+       #x0010  Mod2
+       #x0020  Mod3
+       #x0040  Mod4
+       #x0080  Mod5
+       #x0100  Button1
+       #x0200  Button2
+       #x0400  Button3
+       #x0800  Button4
+       #x1000  Button5
+       #xe000  unused but must be zero
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .75i 1.75i -->
+<!-- .ta .75i 1.75i -->
+SETofKEYMASK
+       encodings are the same as for SETofKEYBUTMASK, except with
+       #xff00          unused but must be zero
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+STRING8: LISTofCARD8
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+STR
+       1       n               length of name in bytes
+       n       STRING8         name
+</literallayout>
+<!-- .ps +2 -->
+<function>Errors</function>
+<!-- .ps -->
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+Request
+       1       0               Error
+       1       1               code
+       2       CARD16          sequence number
+       4                       unused
+       2       CARD16          minor opcode
+       1       CARD8           major opcode
+       21                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+Value
+       1       0               Error
+       1       2               code
+       2       CARD16          sequence number
+       4       &lt;32-bits&gt;         bad value
+       2       CARD16          minor opcode
+       1       CARD8           major opcode
+       21                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+Window
+       1       0               Error
+       1       3               code
+       2       CARD16          sequence number
+       4       CARD32          bad resource id
+       2       CARD16          minor opcode
+       1       CARD8           major opcode
+       21                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+Match
+       1       0               Error
+       1       8               code
+       2       CARD16          sequence number
+       4                       unused
+       2       CARD16          minor opcode
+       1       CARD8           major opcode
+       21                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+Access
+       1       0               Error
+       1       10              code
+       2       CARD16          sequence number
+       4                       unused
+       2       CARD16          minor opcode
+       1       CARD8           major opcode
+       21                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+Alloc
+       1       0               Error
+       1       11              code
+       2       CARD16          sequence number
+       4                       unused
+       2       CARD16          minor opcode
+       1       CARD8           major opcode
+       21                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+Name
+       1       0               Error
+       1       15              code
+       2       CARD16          sequence number
+       4                       unused
+       2       CARD16          minor opcode
+       1       CARD8           major opcode
+       21                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+Device
+       1       0               Error
+       1       CARD8           code
+       2       CARD16          sequence number
+       4                       unused
+       2       CARD16          minor opcode
+       1       CARD8           major opcode
+       21                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+Event
+       1       0               Error
+       1       CARD8           code
+       2       CARD16          sequence number
+       4                       unused
+       2       CARD16          minor opcode
+       1       CARD8           major opcode
+       21                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+Mode
+       1       0               Error
+       1       CARD8           code
+       2       CARD16          sequence number
+       4                       unused
+       2       CARD16          minor opcode
+       1       CARD8           major opcode
+       21                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+Class
+       1       0               Error
+       1       CARD8           code
+       2       CARD16          sequence number
+       4                       unused
+       2       CARD16          minor opcode
+       1       CARD8           major opcode
+       21                      unused
+</literallayout>
+<!-- .ps +2 -->
+Keyboards
+<!-- .ps -->
+</para>
+<para>
+<!-- .LP -->
+KEYCODE values are always greater than 7 (and less than 256).
+</para>
+<para>
+<!-- .LP -->
+KEYSYM values with the bit #x10000000 set are reserved as vendor-specific.
+</para>
+<para>
+<!-- .LP -->
+The names and encodings of the standard KEYSYM values are contained in 
+<!-- .\"Appendix B, Keysym Encoding. -->
+appendix F.
+</para>
+<para>
+<!-- .LP -->
+<!-- .ps +2 -->
+Pointers
+<!-- .ps -->
+</para>
+<para>
+<!-- .LP -->
+BUTTON values are numbered starting with one.
+</para>
+<para>
+<!-- .LP -->
+<!-- .ps +2 -->
+Requests
+<!-- .ps -->
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+GetExtensionVersion
+       1       CARD8           input extension opcode
+       1       1               GetExtensionVersion opcode
+       2       2+(n+p)/4               request length
+       2       n               length of name
+       2                       unused
+       n       STRING8         name
+       p                       unused, p=pad(n)
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ =&gt;
+       1       1               Reply
+       1       1               GetExtensionVersion opcode
+       2       CARD16          sequence number
+       4       0               reply length
+       2       CARD16          major version
+       2       CARD16          minor version
+       1       BOOL            present
+       19                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ListInputDevices
+       1       CARD8           input extension opcode
+       1       2               ListInputDevices opcode
+       2       1               request length
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ =&gt;
+       1       1                       Reply
+       1       2                       ListInputDevices opcode
+       2       CARD16                  sequence number
+       4       (n+p)/4                 reply length
+       1       CARD8                   number of input devices
+       23                              unused
+       n       LISTofDEVICEINFO        info for each input device
+       p                               unused, p=pad(n)
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  DEVICEINFO
+       4       CARD32          device type
+       1       CARD8           device id
+       1       CARD8           number of input classes this device reports
+       1       CARD8           device use
+                       0       IsXPointer
+                       1       IsXKeyboard
+                       2       IsXExtensionDevice
+       1                       unused
+       n       LISTofINPUTINFO                 input info for each input class
+       m       STR                     name
+       p                               unused, p=pad(m)
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  INPUTINFO    KEYINFO or BUTTONINFO or VALUATORINFO
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  KEYINFO
+       1       0               class id
+       1       8               length
+       1       KEYCODE         minimum keycode
+       1       KEYCODE         maximum keycode
+       2       CARD16          number of keys
+       2                       unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+BUTTONINFO
+       1       1               class id
+       1       4               length
+       2       CARD16          number of buttons
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .75i 2.0i 3.0i -->
+<!-- .ta .2i .75i 2.0i 3.0i -->
+VALUATORINFO
+       1       2               class id
+       1       8+12n           length
+       1       n               number of axes
+       1       SETofDEVICEMODE                 mode
+       4       CARD32          size of motion buffer
+       12n     LISTofAXISINFO          valuator limits
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+AXISINFO
+       4       CARD32          resolution
+       4       CARD32          minimum value
+       4       CARD32          maximum value
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+OpenDevice
+       1       CARD8           input extension opcode
+       1       3               OpenDevice opcode
+       2       2               request length
+       1       CARD8           device id
+       3                       unused
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 3.5i -->
+<!-- .ta .2i .5i 1.5i 3.5i -->
+ =&gt;
+       1       1                       Reply
+       1       3                       OpenDevice opcode
+       2       CARD16                  sequence number
+       4       (n+p)/4                 reply length
+       1       CARD8                   number of input classes
+       23                              unused
+       n       LISTofINPUTCLASSINFO    input class information
+       p                               unused, p=pad(n)
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  INPUTCLASSINFO
+       1       CARD8           input class id
+               0       KEY
+               1       BUTTON
+               2       VALUATOR
+               3       FEEDBACK
+               4       PROXIMITY
+               5       FOCUS
+               6       OTHER
+       1       CARD8           event type base code for this class
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+CloseDevice
+       1       CARD8           input extension opcode
+       1       4               CloseDevice opcode
+       2       2               request length
+       1       CARD8           device id
+       3                       unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+SetDeviceMode
+       1       CARD8           input extension opcode
+       1       5               SetDeviceMode opcode
+       2       2               request length
+       1       CARD8           device id
+       1       CARD8           mode
+       2                       unused
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 3.5i -->
+<!-- .ta .2i .5i 1.5i 3.5i -->
+ =&gt;
+       1       1                       Reply
+       1       5                       SetDeviceMode opcode
+       2       CARD16                  sequence number
+       4       0                       reply length
+       1       CARD8                   status
+               0               Success
+                       1       AlreadyGrabbed
+               3 + first_error DeviceBusy
+       23                              unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+SelectExtensionEvent
+       1       CARD8                   input extension opcode
+       1       6                       SelectExtensionEvent opcode
+       2       3+n                             request length
+       4       Window                  event window
+       2       CARD16                  count
+       2                               unused
+       4n      LISTofEVENTCLASS        desired events
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+GetSelectedExtensionEvents
+       1       CARD8           input extension opcode
+       1       7               GetSelectedExtensionEvents opcode
+       2       2               request length
+       4       Window          event window
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ =&gt;
+       1       1               Reply
+       1       7               GetSelecteExtensionEvents opcode
+       2       CARD16          sequence number
+       4       n + m           reply length
+       2       n               this client count
+       2       m               all clients count
+       20                      unused
+       4n      LISTofEVENTCLASS        this client list
+       4m      LISTofEVENTCLASS        all clients list
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ChangeDeviceDontPropagateList
+       1       CARD8                   input extension opcode
+       1       8                       ChangeDeviceDontPropagateList opcode
+       2       3+n                             request length
+       4       Window                  event window
+       2       n                       count of events
+       1       mode
+               0       AddToList
+               1       DeleteFromList
+       1                               unused
+       4n      LISTofEVENTCLASS        desired events
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+GetDeviceDontPropagateList
+       1       CARD8           input extension opcode
+       1       9               GetDeviceDontPropagateList opcode
+       2       2               request length
+       4       Window          event window
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ =&gt;
+       1       1                       Reply
+       1       9                       GetDeviceDontPropagateList opcode
+       2       CARD16                  sequence number
+       4       n                       reply length
+       2       n                       count of events
+       22                              unused
+       4n      LISTofEVENTCLASS        don't propagate list
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+GetDeviceMotionEvents
+       1       CARD8           input extension opcode
+       1       10              GetDeviceMotionEvents opcode
+       2       4               request length
+       4       TIMESTAMP               start
+               0       CurrentTime
+       4       TIMESTAMP               stop
+               0       CurrentTime
+       1       CARD8           device id
+       3                       unused
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 3.5i -->
+<!-- .ta .2i .5i 1.5i 3.5i -->
+ =&gt;
+       1               1               Reply
+       1               10      GetDeviceMotionEvents opcode
+       2               CARD16  sequence number
+       4               (m+1)n  reply length
+       4               n               number of DEVICETIMECOORDs in events
+       1               m               number of valuators per event
+       1               CARD8           mode of the device
+                       0       Absolute
+                       1       Relative
+       18                              unused
+       (4m+4)n LISTofDEVICETIMECOORD   events
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  DEVICETIMECOORD
+       4       TIMESTAMP               time
+       4m      LISTofINT32             valuators
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ChangeKeyboardDevice
+       1       CARD8           input extension opcode
+       1       11              ChangeKeyboardDevice opcode
+       2       2               request length
+       1       CARD8           device id
+       3                       unused
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ =&gt;
+       1       1               Reply
+       1       11              ChangeKeyboardDevice opcode
+       2       CARD16          sequence number
+       4       0               reply length
+       1                       status
+               0       Success
+               1       AlreadyGrabbed
+               2       DeviceFrozen
+       23                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ChangePointerDevice
+       1       CARD8           input extension opcode
+       1       12              ChangePointerDevice opcode
+       2       2               request length
+       1       CARD8           x-axis
+       1       CARD8           y-axis
+       1       CARD8           device id
+       1                       unused
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ =&gt;
+       1       1               Reply
+       1       12              ChangePointerDevice opcode
+       2       CARD16          sequence number
+       4       0               reply length
+       1                       status
+               0       Success
+               1       AlreadyGrabbed
+               2       DeviceFrozen
+       23                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+GrabDevice
+       1       CARD8           input extension opcode
+       1       13              GrabDevice opcode
+       2       5+n                     request length
+       4       WINDOW          grab-window
+       4       TIMESTAMP               time
+               0       CurrentTime
+       2       n               count of events
+       1                       this-device-mode
+               0       Synchronous
+               1       Asynchronous
+       1                       other-devices-mode
+               0       Synchronous
+               1       Asynchronous
+       1       BOOL            owner-events
+       1       CARD8           device id
+       2                       unused
+       4n      LISTofEVENTCLASS        event list
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ =&gt;
+       1       1               Reply
+       1       13              GrabDevice opcode
+       2       CARD16          sequence number
+       4       0               reply length
+       1                       status
+               0       Success
+               1       AlreadyGrabbed
+               2       InvalidTime
+               3       NotViewable
+               4       Frozen
+       23                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+UngrabDevice
+       1       CARD8           input extension opcode
+       1       14              UngrabDevice opcode
+       2       3               request length
+       4       TIMESTAMP               time
+               0       CurrentTime
+       1       CARD8           device id
+       3                       unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+GrabDeviceKey
+       1       CARD8           input extension opcode
+       1       15              GrabDeviceKey opcode
+       2       5+n             request length
+       4       WINDOW          grab-window
+       2       n               count of events
+       2       SETofKEYMASK            modifiers
+               #x8000  AnyModifier
+       1       CARD8           modifier device
+               #x0FF   UseXKeyboard
+       1       CARD8           grabbed device
+       1       KEYCODE                 key
+               0       AnyKey
+       1                       this-device-mode
+               0       Synchronous
+               1       Asynchronous
+       1                       other-devices-mode
+               0       Synchronous
+               1       Asynchronous
+       1       BOOL            owner-events
+       2                       unused
+       4n      LISTofEVENTCLASS        event list
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+UngrabDeviceKey
+       1       CARD8           input extension opcode
+       1       16              UngrabDeviceKey opcode
+       2       4               request length
+       4       WINDOW          grab-window
+       2       SETofKEYMASK            modifiers
+               #x8000  AnyModifier
+       1       CARD8           modifier device
+               #x0FF   UseXKeyboard
+       1       KEYCODE                 key
+               0       AnyKey
+       1       CARD8           grabbed device
+       3                       unused
+
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+GrabDeviceButton
+       1       CARD8           input extension opcode
+       1       17              GrabDeviceButton opcode
+       2       5+n             request length
+       4       WINDOW          grab-window
+       1       CARD8           grabbed device
+       1       CARD8           modifier device
+               #x0FF   UseXKeyboard
+       2       n               count of desired events
+       2       SETofKEYMASK            modifiers
+       1                       this-device-mode
+               0       Synchronous
+               1       Asynchronous
+       1                       other-device-mode
+               0       Synchronous
+               1       Asynchronous
+       1       BUTTON          button
+               0       AnyButton
+       1       BOOL            owner-events
+               #x8000  AnyModifier
+       2                       unused
+       4n      LISTofEVENTCLASS        event list
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+UngrabDeviceButton
+       1       CARD8           input extension opcode
+       1       18              UngrabDeviceButton opcode
+       2       4               request length
+       4       WINDOW          grab-window
+       2       SETofKEYMASK            modifiers
+               #x8000  AnyModifier
+       1       CARD8           modifier device
+               #x0FF   UseXKeyboard
+       1       BUTTON          button
+               0       AnyButton
+       1       CARD8           grabbed device
+       3                       unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+AllowDeviceEvents
+       1       CARD8           input extension opcode
+       1       19              AllowDeviceEvents opcode
+       2       3               request length
+       4       TIMESTAMP               time
+               0       CurrentTime
+       1                       mode
+               0       AsyncThisDevice
+               1       SyncThisDevice
+               2       ReplayThisDevice
+               3       AsyncOtherDevices
+               4       AsyncAll
+               5       SyncAll
+       1       CARD8           device id
+       2                       unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+GetDeviceFocus
+       1       CARD8           input extension opcode
+       1       20              GetDeviceFocus opcode
+       2       2               request length
+       1       CARD8           device
+       3                       unused
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ =&gt;
+       1       1               Reply
+       1       20              GetDeviceFocus opcode
+       2       CARD16          sequence number
+       4       0               reply length
+       4       WINDOW          focus
+               0       None
+               1       PointerRoot
+               3       FollowKeyboard
+       4       TIMESTAMP       focus time
+       1                       revert-to
+               0       None
+               1       PointerRoot
+               2       Parent
+               3       FollowKeyboard
+       15                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+SetDeviceFocus
+       1       CARD8           input extension opcode
+       1       21              SetDeviceFocus opcode
+       2       4               request length
+       4       WINDOW          focus
+               0       None
+               1       PointerRoot
+               3       FollowKeyboard
+       4       TIMESTAMP               time
+               0       CurrentTime
+       1                       revert-to
+               0       None
+               1       PointerRoot
+               2       Parent
+               3       FollowKeyboard
+       1       CARD8           device
+       2                       unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+GetFeedbackControl
+       1       CARD8           input extension opcode
+       1       22              GetFeedbackControl opcode
+       2       2               request length
+       1       CARD8           device id
+       3                       unused
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ =&gt;
+       1       1               Reply
+       1       22              GetFeedbackControl opcode
+       2       CARD16          sequence number
+       4       m/4                     reply length
+       2       n               number of feedbacks supported
+       22                      unused
+       m       LISTofFEEDBACKSTATE     feedbacks
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  FEEDBACKSTATE        KBDFEEDBACKSTATE, PTRFEEDBACKSTATE, INTEGERFEEDBACKSTATE, 
+  STRINGFEEDBACKSTATE, BELLFEEDBACKSTATE, or LEDFEEDBACKSTATE
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  KBDFEEDBACKSTATE
+       1       0               feedback class id
+       1       CARD8           id of this feedback
+       2       20              length
+       2       CARD16          pitch
+       2       CARD16          duration
+       4       CARD32          led_mask
+       4       CARD32          led_values
+       1                       global_auto_repeat
+               0       Off
+               1       On
+       1       CARD8           click
+       1       CARD8           percent
+       1                       unused
+       32      LISTofCARD8     auto_repeats
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  PTRFEEDBACKSTATE
+       1       0               feedback class id
+       1       CARD8           id of this feedback
+       2       12              length
+       2                       unused
+       2       CARD16          acceleration-numerator
+       2       CARD16          acceleration-denominator
+       2       CARD16          threshold
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  INTEGERFEEDBACKSTATE
+       1       0               feedback class id
+       1       CARD8           id of this feedback
+       2       16              length
+       4       CARD32          resolution
+       4       INT32           minimum value
+       4       INT32           maximum value
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  STRINGFEEDBACKSTATE
+       1       1               feedback class id
+       1       CARD8           id of this feedback
+       2       4n+8            length
+       2       CARD16          max_symbols
+       2       n               number of keysyms supported
+       4n      LISTofKEYSYM            key symbols supported
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  BELLFEEDBACKSTATE
+       1       1               feedback class id
+       1       CARD8           id of this feedback
+       2       12              length
+       1       CARD8           percent
+       3                       unused
+       2       CARD16          pitch
+       2       CARD16          duration
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  LEDFEEDBACKSTATE
+       1       1               feedback class id
+       1       CARD8           id of this feedback
+       2       12              length
+       4       CARD32          led_mask
+       4       BITMASK         led_values
+               #x0001  On
+               #x0002  Off
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ChangeFeedbackControl
+       1       CARD8           input extension opcode
+       1       23              ChangeFeedbackControl opcode
+       2       3+n/4           request length
+       4       BITMASK         value-mask (has n bits set to 1)
+               #x0001  keyclick-percent
+               #x0002  bell-percent
+               #x0004  bell-pitch
+               #x0008  bell-duration
+               #x0010  led
+               #x0020  led-mode
+               #x0040  key
+               #x0080  auto-repeat-mode
+               #x0001  string
+               #x0001  integer
+               #x0001  acceleration-numerator
+               #x0002  acceleration-denominator
+               #x0004  acceleration-threshold
+       1       CARD8           device id
+       1       CARD8           feedback class id
+       2                       unused
+       n       FEEDBACKCLASS
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  FEEDBACKCLASS        KBDFEEDBACKCTL, PTRFEEDBACKCTL, INTEGERFEEDBACKCTL, 
+  STRINGFEEDBACKCTL, BELLFEEDBACKCTL, or LEDFEEDBACKCTL 
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  KBDFEEDBACKCTL
+       1       0               feedback class id
+       1       CARD8           id of this feedback
+       2       20              length
+       1       KEYCODE         key
+       1                       auto-repeat-mode
+               0       Off
+               1       On
+               2       Default
+       1       INT8            key-click-percent
+       1       INT8            bell-percent
+       2       INT16           bell-pitch
+       2       INT16           bell-duration
+       4       CARD32          led_mask
+       4       CARD32          led_values
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  PTRFEEDBACKCTL
+       1       1               feedback class id
+       1       CARD8           id of this feedback
+       2       12              length
+       2                       unused
+       2       INT16           numerator
+       2       INT16           denominator
+       2       INT16           threshold
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  STRINGCTL
+       1       2               feedback class id
+       1       CARD8           id of this feedback
+       2       4n+8            length
+       2                       unused
+       2       n               number of keysyms to display
+       4n      LISTofKEYSYM            list of key symbols to display
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  INTEGERCTL
+       1       3               feedback class id
+       1       CARD8           id of this feedback
+       2       8               length
+       4       INT32           integer to display
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  LEDCTL
+       1       4               feedback class id
+       1       CARD8           id of this feedback
+       2       12              length
+       4       CARD32          led_mask
+       4       BITMASK         led_values
+               #x0001  On
+               #x0002  Off
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  BELLCTL
+       1       5               feedback class id
+       1       CARD8           id of this feedback
+       2       8               length
+       1       INT8            percent
+       3                       unused
+       2       INT16           pitch
+       2       INT16           duration
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+GetDeviceKeyMapping
+       1       CARD8           input extension opcode
+       1       24              GetDeviceKeyMapping opcode
+       2       2               request length
+       1       CARD8           device
+       1       KEYCODE         first-keycode
+       1       CARD8           count
+       1                       unused
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .75i 2.0i 3.0i -->
+<!-- .ta .2i .75i 2.0i 3.0i -->
+ =&gt;
+       1       1               Reply
+       1       24              GetDeviceKeyMapping opcode
+       2       CARD16          sequence number
+       4       nm              reply length (m = count field from the request)
+       1       n               keysyms-per-keycode
+       23                      unused
+       4nm     LISTofKEYSYM            keysyms
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .75i 2.0i 3.0i -->
+<!-- .ta .2i .75i 2.0i 3.0i -->
+ChangeDeviceKeyMapping
+       1       CARD8           input extension opcode
+       1       25              ChangeDeviceKeyMapping opcode
+       2       2+nm            request length
+       1       CARD8           device
+       1       KEYCODE         first-keycode
+       1       m               keysyms-per-keycode
+       1       n               keycode-count
+       4nm     LISTofKEYSYM            keysyms
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+GetDeviceModifierMapping
+       1       CARD8           input extension opcode
+       1       26              GetDeviceModifierMapping opcode
+       2       2               request length
+       1       CARD8           device
+       3                       unused
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ =&gt;
+       1       1               Reply
+       1       26              GetDeviceModifierMapping opcode
+       2       CARD16          sequence number
+       4       2n              reply length
+       1       n               keycodes-per-modifier
+       23                      unused
+       8n      LISTofKEYCODE           keycodes
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+SetDeviceModifierMapping
+       1       CARD8           input extension opcode
+       1       27              SetDeviceModifier opcode
+       2       2+2n            request length
+       1       CARD8           device
+       1       n               keycodes-per-modifier
+       2                       unused
+       8n      LISTofKEYCODE           keycodes
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ =&gt;
+       1       1               Reply
+       1       27              SetDeviceModifierMapping opcode
+       2       CARD16          sequence number
+       4       0               reply length
+       1                       status
+               0       Success
+               1       Busy
+               2       Failed
+       23                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+GetDeviceButtonMapping
+       1       CARD8           input extension opcode
+       1       28              GetDeviceButtonMapping opcode
+       2       2               request length
+       1       CARD8           device
+       3                       unused
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ =&gt;
+       1       1               Reply
+       1       28              GetDeviceButtonMapping opcode
+       2       CARD16          sequence number
+       4       (n+p)/4         reply length
+       1       n               number of elements in map list
+       23                      unused
+       n       LISTofCARD8                     map
+       p                       unused, p=pad(n)
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+SetDeviceButtonMapping
+       1       CARD8           input extension opcode
+       1       29              SetDeviceButtonMapping opcode
+       2       2+(n+p)/4               request length
+       1       CARD8           device
+       1       n               length of map
+       2                       unused
+       n       LISTofCARD8                     map
+       p                       unused, p=pad(n)
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ =&gt;
+       1       1               Reply
+       1       29              SetDeviceButtonMapping opcode
+       2       CARD16          sequence number
+       4       0               reply length
+       1                       status
+               0       Success
+               1       Busy
+       23                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+QueryDeviceState
+       1       CARD8           input extension opcode
+       1       30              QueryDeviceState opcode
+       2       2               request length
+       1       CARD8           device
+       3                       unused
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ =&gt;
+       1       1                       Reply
+       1       30                      QueryDeviceState opcode
+       2       CARD16                  sequence number
+       4       m/4                     reply length
+       1       n                       number of input classes
+       23                              unused
+       m       LISTofINPUTSTATE
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  INPUTSTATE   KEYSTATE or BUTTONSTATE or VALUATORSTATE
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  KEYSTATE
+       1       CARD8           key input class id
+       1       36              length
+       1       CARD8           num_keys
+       1                       unused
+       32      LISTofCARD8             status of keys
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  BUTTONSTATE
+       1       CARD8           button input class id
+       1       36              length
+       1       CARD8           num_buttons
+       1                       unused
+       32      LISTofCARD8                     status of buttons
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+  VALUATORSTATE
+       1       CARD8           valuator input class id
+       1       4n + 4          length
+       1       n               number of valuators
+       1                       mode
+               #x01    DeviceMode (0 = Relative, 1 = Absolute)
+               #x02    ProximityState (0 = InProximity, 1 = OutOfProximity)
+       4n      LISTofCARD32            status of valuators
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+SendExtensionEvent
+       1       CARD8                   input extension opcode
+       1       31                      SendExtensionEvent opcode
+       2       4 + 8n + m              request length
+       4       WINDOW                  destination
+       1       CARD8                   device
+       1       BOOL                    propagate
+       2       CARD16                  eventclass count
+       1       CARD8                   num_events
+       3                               unused
+       32n     LISTofEVENTS            events to send
+       4m      LISTofEVENTCLASS        desired events
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DeviceBell
+       1       CARD8           input extension opcode
+       1       32              DeviceBell opcode
+       2       2               request length
+       1       CARD8           device id
+       1       CARD8           feedback id
+       1       CARD8           feedback class
+       1       INT8            percent
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+SetDeviceValuators
+       1       CARD8           input extension opcode
+       1       33              SetDeviceValuators opcode
+       2       2 + n           request length
+       1       CARD8           device id
+       1       CARD8           first valuator
+       1       n               number of valuators
+       1                       unused
+       4n      LISTofINT32     valuator values to set
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 3.5i -->
+<!-- .ta .2i .5i 1.5i 3.5i -->
+ =&gt;
+       1       1                       Reply
+       1       33                      SetDeviceValuators opcode
+       2       CARD16                  sequence number
+       4       0                       reply length
+       1       CARD8                   status
+               0       Success
+               1       AlreadyGrabbed
+       23                              unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+GetDeviceControl
+       1       CARD8           input extension opcode
+       1       34              GetDeviceControl opcode
+       2       2               request length
+       2       CARD16          device control type
+       1       CARD8           device id
+       1                       unused
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 3.5i -->
+<!-- .ta .2i .5i 1.5i 3.5i -->
+ =&gt;
+       1       1                       Reply
+       1       34                      GetDeviceControl opcode
+       2       CARD16                  sequence number
+       4       n/4                     reply length
+       1       CARD8                   status
+               0                       Success
+               1                       AlreadyGrabbed
+               3 + first_error         DeviceBusy
+       23                              unused
+       n                               DEVICESTATE
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DEVICESTATE                    DEVICERESOLUTIONSTATE
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DEVICERESOLUTIONSTATE
+       2       0               control type
+       2       8 + 12n         length
+       4       n               num_valuators
+       4n      LISTOfCARD32    resolution values
+       4n      LISTOfCARD32    resolution min_values
+       4n      LISTOfCARD32    resolution max_values
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ChangeDeviceControl
+       1       CARD8           input extension opcode
+       1       35              ChangeDeviceControl opcode
+       2       2+n/4           request length
+       2       CARD16          control type
+       1       CARD8           device id
+       1                       unused
+       n                       DEVICECONTROL
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DEVICECONTROL          DEVICERESOLUTIONCTL
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DEVICERESOLUTIONCTL
+       2       1               control type
+       2       8 + 4n          length
+       1       CARD8           first_valuator
+       1       n               num_valuators
+       2                       unused
+       4n      LISTOfCARD32    resolution values
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 3.5i -->
+<!-- .ta .2i .5i 1.5i 3.5i -->
+ =&gt;
+       1       1                       Reply
+       1       35                      ChangeDeviceControl opcode
+       2       CARD16                  sequence number
+       4       0                       reply length
+       1       CARD8                   status
+               0                       Success
+               1                       AlreadyGrabbed
+               3 + first_error         DeviceBusy
+       23                              unused
+</literallayout>
+<!-- .ps +2 -->
+Events
+<!-- .ps -->
+</para>
+<para>
+<!-- .LP -->
+DeviceKeyPress, DeviceKeyRelease, DeviceButtonPress, DeviceButtonRelease,
+ProximityIn, ProximityOut, and DeviceStateNotify  events may be followed by 
+zero or more DeviceValuator events.  DeviceMotionNotify events will be 
+followed by one or more DeviceValuator events.
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DeviceValuator
+       1       CARD8           code
+       1       CARD8           device id
+       2       CARD16          sequence number
+       2       SETofKEYBUTMASK         state
+       1       n               number of valuators this device reports
+       1       m               number of first valuator in this event
+       24      LISTofINT32     valuators
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DeviceKeyPress
+       1       CARD8           code
+       1       KEYCODE         detail
+       2       CARD16          sequence number
+       4       TIMESTAMP               time
+       4       WINDOW          root
+       4       WINDOW          event
+       4       WINDOW          child
+               0       None
+       2       INT16           root-x
+       2       INT16           root-y
+       2       INT16           event-x
+       2       INT16           event-y
+       2       SETofKEYBUTMASK         state
+       1       BOOL            same-screen
+       1       CARD8           device id
+               #x80            MORE_EVENTS follow
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DeviceKeyRelease
+       1       CARD8           code
+       1       KEYCODE         detail
+       2       CARD16          sequence number
+       4       TIMESTAMP               time
+       4       WINDOW          root
+       4       WINDOW          event
+       4       WINDOW          child
+               0       None
+       2       INT16           root-x
+       2       INT16           root-y
+       2       INT16           event-x
+       2       INT16           event-y
+       2       SETofKEYBUTMASK                 state
+       1       BOOL            same-screen
+       1       CARD8           device id
+               #x80            MORE_EVENTS follow
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DeviceButtonPress
+       1       CARD8           code
+       1       BUTTON          detail
+       2       CARD16          sequence number
+       4       TIMESTAMP               time
+       4       WINDOW          root
+       4       WINDOW          event
+       4       WINDOW          child
+               0       None
+       2       INT16           root-x
+       2       INT16           root-y
+       2       INT16           event-x
+       2       INT16           event-y
+       2       SETofKEYBUTMASK         state
+       1       BOOL            same-screen
+       1       CARD8           device id
+               #x80            MORE_EVENTS follow
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DeviceButtonRelease
+       1       CARD8           code
+       1       BUTTON          detail
+       2       CARD16          sequence number
+       4       TIMESTAMP               time
+       4       WINDOW          root
+       4       WINDOW          event
+       4       WINDOW          child
+               0       None
+       2       INT16           root-x
+       2       INT16           root-y
+       2       INT16           event-x
+       2       INT16           event-y
+       2       SETofKEYBUTMASK         state
+       1       BOOL            same-screen
+       1       CARD8           device id
+               #x80            MORE_EVENTS follow
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DeviceMotionNotify
+       1       CARD8           code
+       1                       detail
+               0       Normal
+               1       Hint
+       2       CARD16          sequence number
+       4       TIMESTAMP               time
+       4       WINDOW          root
+       4       WINDOW          event
+       4       WINDOW          child
+               0       None
+       2       INT16           root-x
+       2       INT16           root-y
+       2       INT16           event-x
+       2       INT16           event-y
+       2       SETofKEYBUTMASK         state
+       1       BOOL            same-screen
+       1       CARD8           device id
+               #x80            MORE_EVENTS follow
+</literallayout>
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DeviceFocusIn
+       1       CARD8           code
+       1                       detail
+               0       Ancestor
+               1       Virtual
+               2       Inferior
+               3       Nonlinear
+               4       NonlinearVirtual
+               5       Pointer
+               6       PointerRoot
+               7       None
+       2       CARD16          sequence number
+       4       TIMESTAMP               time
+       4       WINDOW          event
+       1                       mode
+               0       Normal
+               1       Grab
+               2       Ungrab
+               3       WhileGrabbed
+       1       CARD8           device id
+       18                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DeviceFocusOut
+       1       CARD8           code
+       1                       detail
+               0       Ancestor
+               1       Virtual
+               2       Inferior
+               3       Nonlinear
+               4       NonlinearVirtual
+               5       Pointer
+               6       PointerRoot
+               7       None
+       2       CARD16          sequence number
+       4       TIMESTAMP               time
+       4       WINDOW          event
+       1                       mode
+               0       Normal
+               1       Grab
+               2       Ungrab
+               3       WhileGrabbed
+       1       CARD8           device id
+       18                      unused
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ProximityIn
+       1       CARD8           code
+       1                       unused
+       2       CARD16          sequence number
+       4       TIMESTAMP               time
+       4       WINDOW          root
+       4       WINDOW          event
+       4       WINDOW          child
+               0       None
+       2       INT16           root-x
+       2       INT16           root-y
+       2       INT16           event-x
+       2       INT16           event-y
+       2       SETofKEYBUTMASK                 state
+       1       BOOL            same-screen
+       1       CARD8           device id
+               #x80            MORE_EVENTS follow
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ProximityOut
+       1       CARD8           code
+       1                       unused
+       2       CARD16          sequence number
+       4       TIMESTAMP               time
+       4       WINDOW          root
+       4       WINDOW          event
+       4       WINDOW          child
+               0       None
+       2       INT16           root-x
+       2       INT16           root-y
+       2       INT16           event-x
+       2       INT16           event-y
+       2       SETofKEYBUTMASK                 state
+       1       BOOL            same-screen
+       1       CARD8           device id
+               #x80            MORE_EVENTS follow
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+DeviceStateNotify events may be immediately followed by zero or one
+DeviceKeyStateNotify and/ or zero or more DeviceValuator events.
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DeviceStateNotify
+       1       CARD8           code
+       1       CARD8           device id
+               #x80            MORE_EVENTS follow
+       2       CARD16          sequence number
+       4       TIMESTAMP               time
+       1       CARD8           num_keys
+       1       CARD8           num_buttons
+       1       CARD8           num_valuators
+       1       CARD8           valuator mode and input classes reported
+               #x01    reporting keys
+               #x02    reporting buttons
+               #x04    reporting valuators
+               #x40    device mode (0 = Relative, 1 = Absolute)
+               #x80    proximity state (0 = InProximity, 1 = OutOfProximity)
+       4       LISTofCARD8             first 32 keys (if reported)
+       4       LISTofCARD8             first 32 buttons (if reported)
+       12      LISTofCARD32            first 3 valuators (if reported)
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DeviceKeyStateNotify
+       1       CARD8           code
+       1       CARD8           device id
+               #x80            MORE_EVENTS follow
+       2       CARD16          sequence number
+       28      LISTofCARD8             state of keys 33-255
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DeviceButtonStateNotify
+       1       CARD8           code
+       1       CARD8           device id
+               #x80            MORE_EVENTS follow
+       2       CARD16          sequence number
+       28      LISTofCARD8             state of buttons 33-255
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DeviceValuator
+       1       CARD8           code
+       1       CARD8           device id
+       2       CARD16          sequence number
+       2       SETofKEYBUTMASK         state
+       1       n               number of valuators this device reports
+       1       n               number of first valuator in this event
+       24      LISTofINT32     valuators
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+DeviceMappingNotify
+       1       CARD8           code
+       1       CARD8           device id
+       2       CARD16          sequence number
+       1                       request
+               0       MappingModifier
+               1       MappingKeyboard
+               2       MappingPointer
+       1       KEYCODE         first-keycode
+       1       CARD8           count
+       1                       unused
+       4       TIMESTAMP               time
+       20                      unused
+</literallayout>
+</para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .2i .5i 1.5i 2.5i -->
+<!-- .ta .2i .5i 1.5i 2.5i -->
+ChangeDeviceNotify
+       1       CARD8           code
+       1       CARD8           id of device specified on change request
+       2       CARD16          sequence number
+       4       TIMESTAMP               time
+       1                       request
+               0       NewPointer
+               1       NewKeyboard
+       23                      unused
+</literallayout>
+<!-- .\" print Table of Contents -->
+<!-- .if o .bp \" blank page to make count even -->
+<!-- .bp 1 -->
+<!-- .af PN i -->
+<!-- .PX -->
+
+</appendix>
diff --git a/specs/inputlib.xml b/specs/inputlib.xml
new file mode 100755 (executable)
index 0000000..526fede
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+
+<book id="inputlib">
+
+<bookinfo>
+   <title>X11 Input Extension Protocol Specification</title>
+   <releaseinfo>X Version 11, Release 6.4</releaseinfo>
+   <authorgroup>
+      <author>
+         <firstname>Mark</firstname><surname>Patrick</surname>
+         <affiliation><orgname>Ardent Computer</orgname></affiliation>
+      </author>
+      <othercredit>
+         <firstname>George</firstname><surname>Sachs</surname>
+         <affiliation><orgname>Hewlett-Packard</orgname></affiliation>
+      </othercredit>
+   </authorgroup>
+   <copyright><year>1989</year><holder>Hewlett-Packard Company and Ardent Computer</holder></copyright>
+   <copyright><year>1990</year><holder>Hewlett-Packard Company and Ardent Computer</holder></copyright>
+   <copyright><year>1991</year><holder>Hewlett-Packard Company and Ardent Computer</holder></copyright>
+
+   <copyright><year>1989</year><holder>X Consortium</holder></copyright>
+   <copyright><year>1990</year><holder>X Consortium</holder></copyright>
+   <copyright><year>1991</year><holder>X Consortium</holder></copyright>
+   <copyright><year>1992</year><holder>X Consortium</holder></copyright>
+
+   <releaseinfo>1.0</releaseinfo>
+   <productnumber>X Version 11, Release 6.4</productnumber>
+
+<legalnotice>
+
+<para>
+Permission to use, copy, modify, and distribute this documentation for any purpose and without
+fee is hereby granted, provided that the above copyright notice and this permission notice appear
+in all copies. Ardent and Hewlett-Packard make no representations about the suitability for any
+purpose of the information in this document. It is provided "as is" without express or implied
+warranty.
+</para>
+
+<para>
+The above copyright notice and this permission notice shall be included in all 
+copies or substantial portions of the Software.
+</para>
+
+<para>
+THE SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo;, 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 X CONSORTIUM 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.
+</para>
+
+<para>
+Except as contained in this notice, the name of The Open Group 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 X Consortium.
+</para>
+
+<para>X Window System is a trademark of X Consortium, Inc.</para>
+
+</legalnotice>
+</bookinfo>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"  href="library.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"  href="encoding.xml"/>
+</book>
+
diff --git a/specs/library.xml b/specs/library.xml
new file mode 100755 (executable)
index 0000000..f399800
--- /dev/null
@@ -0,0 +1,8559 @@
+<chapter><title>Input Extension</title>
+<sect1 id="Input_Extension_Overview">
+<title>Overview</title>
+<!-- .XS -->
+<!-- (SN Input Extension Overview -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+This document describes an extension to
+the X11 server.  The purpose of this extension is to support the use
+of additional input devices beyond the pointer and keyboard devices
+defined by the core X protocol.  This first section gives an overview
+of the input extension.  The following sections correspond to 
+chapters 9, 10, and 11, ``Window and Session Manager Functions'',
+``Events'', and ``Event Handling Functions'' of the
+``Xlib - C Language Interface'' manual
+and describe how to use the input device extension.
+</para>
+<sect2 id="Design_Approach">
+<title>Design Approach</title>
+<!-- .XS -->
+<!-- (SN Design Approach -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+The design approach of the extension is to define functions
+and events analogous to the core functions and events.
+This allows extension input devices and events to be individually
+distinguishable from each other and from the core input devices and events.
+These functions and events make use of a device identifier and support the
+reporting of <emphasis remap='I'>n</emphasis>-dimensional motion data as well as other data that
+is not currently reportable via the core input events.
+</para>
+</sect2>
+<sect2 id="Core_Input_Devices">
+<title>Core Input Devices</title>
+<!-- .XS -->
+<!-- (SN Core Input Devices -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+The X server core protocol supports two input devices:  a pointer and a
+keyboard.  The pointer device has two major functions. 
+First, it may be used to generate motion information
+that client programs can detect. Second, it may also be used to indicate the
+current location and focus of the X keyboard.  To accomplish this, the server 
+echoes a cursor at the current position of the X pointer.  Unless the X
+keyboard has been explicitly focused, this cursor also shows the current
+location and focus of the X keyboard.
+</para>
+<para>
+<!-- .LP -->
+The X keyboard is used to generate input that client programs can detect.
+</para>
+<para>
+<!-- .LP -->
+The X keyboard and X pointer are referred to in this document as 
+the <emphasis remap='I'>core devices</emphasis>, and the input
+events they generate 
+<function>( KeyPress ,</function>
+<function>KeyRelease ,</function>
+<function>ButtonPress ,</function>
+<function>ButtonRelease ,</function>
+and
+<function>MotionNotify )</function>
+are known as the <emphasis remap='I'>core input events</emphasis>.  All other
+input devices are referred to as <emphasis remap='I'>extension input devices</emphasis>, and the 
+input events they generate are referred to as <emphasis remap='I'>extension input events</emphasis>.
+<!-- .NT -->
+This input extension does not change the behavior or functionality of the
+core input devices, core events, or core protocol requests, with the
+exception of the core grab requests.  These requests may affect the
+synchronization of events from extension devices.  See the explanation
+in the section titled ``Event Synchronization and Core Grabs.''
+<!-- .NE -->
+</para>
+<para>
+<!-- .LP -->
+Selection of the physical devices to be initially used by the server as the 
+core devices is left implementation dependent.  Functions are defined that
+allow client programs to change which physical devices are used as the
+core devices.
+</para>
+</sect2>
+<sect2 id="Extension_Input_Devices">
+<title>Extension Input Devices</title>
+<!-- .XS -->
+<!-- (SN Extension Input Devices -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+The input extension controls access to input devices other than the X keyboard
+and X pointer.  It allows client programs to select input from these devices 
+independently
+from each other and independently from the core devices.  Input events from
+these devices are of extension types 
+<function>( DeviceKeyPress ,</function>
+<function>DeviceKeyRelease ,</function>
+<function>DeviceButtonPress ,</function>
+<function>DeviceButtonRelease ,</function>
+<function>DeviceMotionNotify ,</function>
+and so on) and contain
+a device identifier so that events of the same type coming from different
+input devices can be distinguished.
+</para>
+<para>
+<!-- .LP -->
+Extension input events are not limited in size by the size of the server
+32-byte wire events.  Extension input events
+may be constructed by the server sending as many
+wire-sized events as necessary to return the information required for
+that event.
+The library event reformatting routines
+are responsible for combining these into one or more client XEvents.
+</para>
+<para>
+<!-- .LP -->
+Any input device that generates key, button, or motion data may be used as
+an extension input device.
+Extension input devices may have zero or more keys, zero or more buttons,
+and may report zero or more axes of motion.  Motion may be reported 
+as relative movements from a previous position or as an absolute
+position.  All valuators reporting motion information for a given
+extension input device must report the same kind of motion information
+(absolute or relative).
+</para>
+<para>
+<!-- .LP -->
+This extension is designed to accommodate new types of input devices that
+may be added in the future.  The protocol requests that refer to
+specific characteristics of input devices organize that information
+by <emphasis remap='I'>input device classes</emphasis>.  Server implementors may add new
+classes of input devices without changing the protocol requests.
+</para>
+<para>
+<!-- .LP -->
+All extension input
+devices are treated like the core X keyboard in determining their location
+and focus.  The server does not track the location of these devices on an
+individual basis and, therefore,
+does not echo a cursor to indicate their current location.
+Instead, their location is determined by the location of the core X pointer.
+Like the core X keyboard, some may be explicitly focused. If they are
+not explicitly focused,  their focus
+is determined by the location of the core X pointer.
+</para>
+<sect3 id="Input_Device_Classes">
+<title>Input Device Classes</title>
+<!-- .XS -->
+<!-- (SN Input Device Classes -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Some of the input extension requests divide input devices into classes
+based on their functionality.  This is intended to allow new classes of input
+devices to be defined at a later time without changing the semantics of 
+these functions.  The following input device classes are currently
+defined:
+<variablelist>
+  <varlistentry>
+    <term>KEY</term>
+    <listitem>
+      <para>
+The device reports key events.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>BUTTON</term>
+    <listitem>
+      <para>
+The device reports button events.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>VALUATOR</term>
+    <listitem>
+      <para>
+The device reports valuator data in motion events.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>PROXIMITY</term>
+    <listitem>
+      <para>
+The device reports proximity events.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>FOCUS</term>
+    <listitem>
+      <para>
+The device can be focused.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>FEEDBACK</term>
+    <listitem>
+      <para>
+The device supports feedbacks.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+Additional classes may be added in the future.
+Functions that support multiple input classes, such as the 
+<function>XListInputDevices</function>
+function that lists all available input devices,
+organize the data they return by input class.  Client programs that
+use these functions should not access data unless it matches a 
+class defined at the time those clients were compiled.  In this way,
+new classes can be added without forcing existing clients that use
+these functions to be recompiled.
+</para>
+</sect3>
+</sect2>
+<sect2 id="Using_Extension_Input_Devices">
+<title>Using Extension Input Devices</title>
+<!-- .XS -->
+<!-- (SN Using Extension Input Devices -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+A client that wishes to access an input device does so through the library
+functions defined in the following sections.  A typical sequence of requests
+that a client would make is as follows:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+<function>XListInputDevices</function>
+- lists all of the available input devices.  From the 
+information returned by this request, determine whether the desired input
+device is attached to the server.  For a description of the 
+<function>XListInputDevices</function>
+request, see the section entitled ``Listing Available Devices.''
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+<function>XOpenDevice</function>
+- requests that the server open the device for access by this client.
+This request returns an 
+<function>XDevice</function>
+structure that is used
+by most other input extension requests to identify the specified device.
+For a description of the 
+<function>XOpenDevice</function>
+request, see the section entitled ``Enabling and Disabling Extension Devices.''
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Determine the event types and event classes needed to select the desired
+input extension events, and identify them when they are received.
+This is done via macros whose name corresponds to the desired event, for
+example,
+<function>DeviceKeyPress .</function>
+For a description of these macros,
+see the section entitled ``Selecting Extension Device Events.''
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+<function>XSelectExtensionEvent</function>
+- selects the desired events from the server.
+For a description of the 
+<function>XSelextExtensionEvent</function>
+request, see the section entitled ``Selecting Extension Device Events.''
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+<function>XNextEvent</function>
+- receives the next available event.  This is the core
+<function>XNextEvent</function>
+function provided by the standard X libarary.
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+Other requests are defined to grab and focus extension devices, to
+change their key, button, or modifier mappings, to control the
+propagation of input extension events, to get motion history from an
+extension device, and to send input extension events to another client.
+These functions are described in the following sections.
+</para>
+</sect2>
+</sect1>
+<sect1 id="Library_Extension_Requests">
+<title>Library Extension Requests</title>
+<!-- .XS -->
+<!-- (SN Library Extension Requests -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Extension input devices are accessed by client programs through the 
+use of new protocol requests.
+The following requests are provided as extensions to Xlib.  Constants
+and structures referenced by these functions may be found in the 
+files <function>&lt;X11/extensions/XI.h&gt;</function> and <function>&lt;X11/extensions/XInput.h&gt;</function>,
+which are attached to this document as 
+Appendix A.<!-- xref -->
+</para>
+<para>
+<!-- .LP -->
+The library will return <function>NoSuchExtension</function> if an extension request
+is made to a server that does not support the input extension.
+</para>
+<para>
+<!-- .LP -->
+Input extension requests cannot be used to access the X keyboard and
+X pointer devices.
+</para>
+<sect2 id="Window_Manager_Functions">
+<title>Window Manager Functions</title>
+<!-- .XS -->
+<!-- (SN Window Manager Functions -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+This section discusses the following X Input Extension Window Manager topics:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+Changing the core devices
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Event synchronization and core grabs
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Extension active grabs
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Passively grabbing a key
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Passively grabbing a button
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Thawing a device
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Controlling device focus
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Controlling device feedback
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Ringing a bell on an input device
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Controlling device encoding
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Controlling button mapping
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Obtaining the state of a device
+    </para>
+  </listitem>
+</itemizedlist>
+<sect3 id="Changing_the_Core_Devices">
+<title>Changing the Core Devices</title>
+<!-- .XS -->
+<!-- (SN Changing the Core Devices -->
+<!-- .XE -->
+
+<para>
+<!-- .LP -->
+These functions are provided to change which physical device is used
+as the X pointer or X keyboard.
+</para>
+<!-- .NT -->
+<note><para>
+Using these functions may change the characteristics of the core devices.
+The new pointer device may have a different number of buttons from the 
+old one, or the new keyboard device may have a different number of
+keys or report a different range of keycodes.  Client programs may be
+running that depend on those characteristics.  For example, a client
+program could allocate an array based on the number of buttons on the
+pointer device and then use the button numbers received in button events
+as indices into that array.  Changing the core devices could cause
+such client programs to behave improperly or to terminate abnormally
+if they ignore the 
+<function>ChangeDeviceNotify</function>
+event generated by these requests.
+</para></note>
+<!-- .NE -->
+
+<para>
+<!-- .LP -->
+These functions change the X keyboard or X pointer device and generate an
+<function>XChangeDeviceNotify</function>
+event and a
+<function>MappingNotify</function>
+event.  
+The specified device becomes the
+new X keyboard or X pointer device.  The location of the core device
+does not change as a result of this request.
+</para>
+<para>
+<!-- .LP -->
+These requests fail and return 
+<function>AlreadyGrabbed</function>
+if either the specified
+device or the core device it would replace are grabbed by some other client.
+They fail and return 
+<function>GrabFrozen</function>
+if either device is frozen by the active grab of another client.
+</para>
+<para>
+<!-- .LP -->
+These requests fail with a
+<function>BadDevice</function>
+error if the specified device is invalid, has not previously been opened via
+<function>XOpenDevice ,</function>
+or is
+not supported as a core device by the server implementation.
+</para>
+<para>
+<!-- .LP -->
+Once the device has successfully replaced one of the core devices, it
+is treated as a core device until it is in turn replaced by another
+<function>ChangeDevice</function>
+request or until the server terminates.  The termination
+of the client that changed the device will not cause it to change back.
+Attempts to use the
+<function>XCloseDevice</function>
+request to close the new core device will fail with a
+<function>BadDevice</function>
+error.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To change which physical device is used as the X keyboard, use the 
+<function>XChangeKeyboardDevice</function>
+function.
+The specified device must support input class 
+<function>Keys</function>
+(as reported in the
+<function>ListInputDevices</function>
+request) or the request will fail with a 
+<function>BadMatch</function>
+error.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XChangeKeyboardDevice</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+If no error occurs, 
+<function>XChangeKeyboardDevice</function>
+returns 
+<function>Success .</function>
+A 
+<function>ChangeDeviceNotify</function>
+event with the request field set to 
+<function>NewKeyboard</function>
+is sent to all clients selecting that event.
+A 
+<function>MappingNotify</function>
+event with the request field set to
+<function>MappingKeyboard</function>
+is sent to all clients.
+The requested device becomes the X keyboard, and the old keyboard becomes 
+available as an extension input device.
+The focus state of the new keyboard is the same as
+the focus state of the old X keyboard.
+</para>
+<para>
+<!-- .LP -->
+<function>XChangeKeyboardDevice</function>
+can generate
+<function>AlreadyGrabbed ,</function>
+<function>BadDevice ,</function>
+<function>BadMatch ,</function>
+and 
+<function>GrabFrozen</function>
+errors.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To change which physical device is used as the X pointer,
+use the
+<function>XChangePointerDevice</function>
+function.
+The specified device must support input class 
+<function>Valuators</function>
+(as reported in the
+<function>XListInputDevices</function>
+request) and report at least two axes of motion,
+or the request will fail with a 
+<function>BadMatch</function>
+error.
+If the specified device reports more than two axes, the two specified in
+the xaxis and yaxis arguments will be used.  Data from other
+valuators on the device will be ignored.
+</para>
+<para>
+<!-- .LP -->
+If the specified device reports absolute positional information, and the 
+server implementation does not allow such a device to be used as the 
+X pointer, the request will fail with a 
+<function>BadDevice</function>
+error.
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XChangePointerDevice</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>int<parameter> xaxis</parameter></paramdef>
+  <paramdef>int<parameter> yaxis</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>xaxis</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the zero-based index of the axis to be used as the x-axis of the 
+pointer device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>yaxis</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the zero-based index of the axis to be used as the y-axis of the 
+pointer device.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+If no error occurs, 
+<function>XChangePointerDevice</function>
+returns 
+<function>Success .</function>
+A 
+<function>ChangeDeviceNotify</function>
+event with the request field set to 
+<function>NewPointer</function>
+is sent to all clients selecting that event.
+A
+<function>MappingNotify</function>
+event with the request field set to
+<function>MappingPointer</function>
+is sent to all clients.
+The requested device becomes the X pointer, and the old pointer becomes 
+available as an extension input device.
+</para>
+<para>
+<!-- .LP -->
+<function>XChangePointerDevice</function>
+can generate
+<function>AlreadyGrabbed ,</function>
+<function>BadDevice ,</function>
+<function>BadMatch ,</function>
+and 
+<function>GrabFrozen</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Event_Synchronization_and_Core_Grabs">
+<title>Event Synchronization and Core Grabs</title>
+<!-- .XS -->
+<!-- (SN Event Synchronization and Core Grabs -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Implementation of the input extension requires an extension of the
+meaning of event synchronization for the core grab requests.  This is
+necessary in order to allow window managers to freeze all input devices
+with a single request.
+</para>
+<para>
+<!-- .LP -->
+The core grab requests require a pointer_mode and keyboard_mode
+argument.  The meaning of these modes is changed by the input extension.
+For the
+<function>XGrabPointer</function>
+and 
+<function>XGrabButton</function>
+requests, pointer_mode controls synchronization of the pointer device, 
+and keyboard_mode controls the synchronization of all other input devices.  
+For the 
+<function>XGrabKeyboard</function>
+and
+<function>XGrabKey</function>
+requests, pointer_mode controls the synchronization
+of all input devices, except the X keyboard, while keyboard_mode controls
+the synchronization of the keyboard.  When using one of the core grab
+requests, the synchronization of extension devices
+is controlled by the mode specified for the device not being grabbed.
+</para>
+</sect3>
+<sect3 id="Extension_Active_Grabs">
+<title>Extension Active Grabs</title>
+<!-- .XS -->
+<!-- (SN Extension Active Grabs -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Active grabs of
+extension devices are supported via the 
+<function>XGrabDevice</function>
+function in the same way that core devices are grabbed using the core 
+<function>XGrabKeyboard</function>
+function, except that an extension input device
+is passed as a function parameter.  
+The 
+<function>XUngrabDevice</function>
+function allows a previous active grab for an extension device to be released.
+</para>
+<para>
+<!-- .LP -->
+Passive grabs of buttons and keys on extension devices are supported
+via the 
+<function>XGrabDeviceButton</function>
+and 
+<function>XGrabDeviceKey</function>
+functions.
+These passive grabs are released via the
+<function>XUngrabDeviceKey</function>
+and
+<function>XUngrabDeviceButton</function>
+functions.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To grab an extension device, use the
+<function>XGrabDevice</function>
+function.
+The device must have previously been opened using the
+<function>XOpenDevice</function>
+function.
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XGrabDevice</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>Window<parameter> grab_window</parameter></paramdef>
+  <paramdef>Bool<parameter> owner_events</parameter></paramdef>
+  <paramdef>int<parameter> event_count</parameter></paramdef>
+  <paramdef>XEventClass<parameter> *event_list</parameter></paramdef>
+  <paramdef>int<parameter> this_device_mode</parameter></paramdef>
+  <paramdef>int<parameter> other_device_mode</parameter></paramdef>
+  <paramdef>Time<parameter> time</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      "<emphasis remap='I'>display</emphasis>"
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>grab_window</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the ID of a window associated with the device specified above.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>owner_events</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a boolean value of either 
+<function>True</function>
+or 
+<function>False .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>event_count</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the number of elements in the event_list array.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>event_list</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a pointer to a list of event classes that indicate which events
+the client wishes to receive.  
+These event classes must have been obtained
+using the device being grabbed.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>this_device_mode</emphasis>
+    </term>
+    <listitem>
+      <para>
+Controls further processing of events from this device.  You can pass one
+of these constants: 
+<function>GrabModeSync</function>
+or 
+<function>GrabModeAsync .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>other_device_mode</emphasis>
+    </term>
+    <listitem>
+      <para>
+Controls further processing of events from all other devices.  You can pass one
+of these constants:
+<function>GrabModeSync</function>
+or 
+<function>GrabModeAsync .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>time</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the time.  This may be either a timestamp expressed in
+milliseconds or
+<function>CurrentTime .</function>
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XGrabDevice</function>
+actively grabs an extension input device and generates 
+<function>DeviceFocusIn</function>
+and 
+<function>DeviceFocusOut</function>
+events.
+Further input events from this device are reported only to the grabbing client.
+This function overrides any previous active grab by this client for this device.
+</para>
+<para>
+<!-- .LP -->
+The event_list parameter is a pointer to a list of event classes.  This list
+indicates which events the client wishes to receive while the grab is active.
+If owner_events is 
+<function>False ,</function>
+input events from this device are reported with respect to 
+grab_window and are reported only if specified in event_list.
+If owner_events is
+<function>True ,</function>
+then if a generated event would normally be reported to this client,
+it is reported normally.
+Otherwise, the event is reported with respect to the grab_window and is only
+reported if specified in event_list.
+</para>
+<para>
+<!-- .LP -->
+The this_device_mode argument controls the further processing 
+of events from this device, and the other_device_mode argument controls
+the further processing of input events from all other devices.
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+If the this_device_mode argument is 
+<function>GrabModeAsync ,</function>
+device event processing continues
+normally; if the device is currently frozen by this client, then
+processing of device events is resumed.
+If the this_device_mode  argument is
+<function>GrabModeSync ,</function>
+the state of the grabbed device
+(as seen by client applications) appears to freeze,
+and no further device events are generated by the server until the
+grabbing client issues a releasing 
+<function>XAllowDeviceEvents</function>
+call or until the device grab is released.
+Actual device input events are not lost while the device is frozen; they are
+simply queued for later processing.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If the other_device_mode is 
+<function>GrabModeAsync ,</function>
+event processing from other input devices is unaffected
+by activation of the grab.  
+If other_device_mode is 
+<function>GrabModeSync ,</function>
+the state of all devices except the grabbed device
+(as seen by client applications) appears to freeze, and no further
+events are generated by the server until the grabbing client issues a
+releasing 
+<function>XAllowEvents</function>
+or 
+<function>XAllowDeviceEvents</function>
+call or until the device grab is released.
+Actual events are not lost
+while the other devices are frozen; they are simply queued for later
+processing.
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+<function>XGrabDevice</function>
+fails on the following conditions:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+If the device is actively grabbed by some other client, it returns
+<function>AlreadyGrabbed .</function>
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If grab_window is not viewable, it returns
+<function>GrabNotViewable .</function>
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If the specified time is earlier
+than the last-grab-time for the specified device
+or later than the current X server time, it returns
+<function>GrabInvalidTime .</function>
+Otherwise,
+the last-grab-time for the specified device is set
+to the specified time and 
+<function>CurrentTime</function>
+is replaced by the current X server time.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If the device is frozen by an active grab of another client, it returns
+<function>GrabFrozen .</function>
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+If a grabbed device is closed by a client while an active grab by that 
+client is in effect, that active grab will be released. 
+Any passive grabs established by that client will be released.
+If the device is frozen only by an active grab
+of the requesting client, it is thawed.
+</para>
+<para>
+<!-- .LP -->
+<function>XGrabDevice</function>
+can generate
+<function>BadClass ,</function>
+<function>BadDevice ,</function>
+<function>BadValue ,</function>
+and
+<function>BadWindow</function>
+errors.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To release a grab of an extension device, use the
+<function>XUngrabDevice</function>
+function.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XUngrabDevice</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>Time<parameter> time</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>time</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the time.  This may be either a timestamp expressed in
+milliseconds, or 
+<function>CurrentTime .</function>
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XUngrabDevice</function>
+allows a client to release an extension input device and any
+queued events if this client has it grabbed from either
+<function>XGrabDevice</function>
+or
+<function>XGrabDeviceKey .</function>
+If any other devices are frozen by the grab,
+<function>XUngrabDevice</function>
+thaws them. 
+This function does not release the device and any
+queued events if the specified time is earlier than the last-device-grab
+time or is later than the current X server time.  It also generates 
+<function>DeviceFocusIn</function>
+and 
+<function>DeviceFocusOut</function>
+events.  The X server automatically performs an
+<function>XUngrabDevice</function>
+if the event window for an active device grab becomes not viewable
+or if the client terminates without releasing the grab.
+</para>
+<para>
+<!-- .LP -->
+<function>XUngrabDevice</function>
+can generate
+<function>BadDevice</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Passively_Grabbing_a_Key">
+<title>Passively Grabbing a Key</title>
+<!-- .XS -->
+<!-- (SN Passively Grabbing a Key -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To passively grab a single key on an extension device, use
+<function>XGrabDeviceKey .</function>
+That device must have previously been opened using the
+<function>XOpenDevice</function>
+function, or the request will fail with a
+<function>BadDevice</function>
+error.  
+If the specified device does not support input class
+<function>Keys ,</function>
+the request will fail with a
+<function>BadMatch</function>
+error.
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XGrabDeviceKey</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>int<parameter> keycode</parameter></paramdef>
+  <paramdef>unsignedint<parameter> modifiers</parameter></paramdef>
+  <paramdef>XDevice<parameter> *modifier_device</parameter></paramdef>
+  <paramdef>Window<parameter> grab_window</parameter></paramdef>
+  <paramdef>Bool<parameter> owner_events</parameter></paramdef>
+  <paramdef>int<parameter> event_count</parameter></paramdef>
+  <paramdef>XEventClass<parameter> *event_list</parameter></paramdef>
+  <paramdef>int<parameter> this_device_mode</parameter></paramdef>
+  <paramdef>int<parameter> other_device_mode</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>keycode</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the keycode of the key that is to be grabbed.  You can pass
+either the keycode or 
+<function>AnyKey .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>modifiers</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the set of keymasks.  This mask is the bitwise inclusive OR
+of these keymask bits:  
+<function>ShiftMask ,</function>
+<function>LockMask ,</function>
+<function>ControlMask ,</function>
+<function>Mod1Mask ,</function>
+<function>Mod2Mask ,</function>
+<function>Mod3Mask ,</function>
+<function>Mod4Mask ,</function>
+and
+<function>Mod5Mask .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      
+    </term>
+    <listitem>
+      <para>
+You can also pass 
+<function>AnyModifier ,</function>
+which is equivalent to issuing the grab key request 
+for all possible modifier combinations (including the combination
+of no modifiers).
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>modifier_device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the device whose modifiers are to be used.  If NULL is 
+specified, the core X keyboard is used as the modifier_device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>grab_window</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the ID of a window associated with the device specified above.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>owner_events</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a boolean value of either
+<function>True</function>
+or
+<function>False .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>event_count</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the number of elements in the event_list array.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>event_list</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a pointer to a list of event classes that indicate which events
+the client wishes to receive.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>this_device_mode</emphasis>
+    </term>
+    <listitem>
+      <para>
+Controls further processing of events from this device.
+You can pass one of these constants:
+<function>GrabModeSync</function>
+or
+<function>GrabModeAsync .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>other_device_mode</emphasis>
+    </term>
+    <listitem>
+      <para>
+Controls further processing of events from all other devices.
+You can pass one of these constants: 
+<function>GrabModeSync</function>
+or
+<function>GrabModeAsync .</function>
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XGrabDeviceKey</function>
+is analogous to the core 
+<function>XGrabKey</function>
+function.  It creates an
+explicit passive grab for a key on an extension device.
+The 
+<function>XGrabDeviceKey</function>
+function establishes a passive grab on a device.
+Consequently, in the future, 
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+IF the device is not grabbed and the specified key, 
+which itself can be a modifier key, is logically pressed
+when the specified modifier keys logically are down on the specified
+modifier device (and no other keys are down),
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+AND no other modifier keys logically are down,
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+AND EITHER the grab window is an ancestor of (or is) the focus window
+or the grab window is a descendent of the focus window and contains the pointer,
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+AND a passive grab on the same device and key combination does not exist on any
+ancestor of the grab window,
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+THEN the device is actively grabbed, as for
+<function>XGrabDevice ,</function>
+the last-device-grab time is set to the time at which the key was pressed
+(as transmitted in the 
+<function>DeviceKeyPress</function>
+event), and the 
+<function>DeviceKeyPress</function>
+event is reported.
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+The interpretation of the remaining arguments is as for
+<function>XGrabDevice .</function>
+The active grab is terminated automatically when the logical state of the
+device has the specified key released
+(independent of the logical state of the modifier keys).
+</para>
+<para>
+<!-- .LP -->
+Note that the logical state of a device (as seen by means of the X protocol)
+may lag the physical state if device event processing is frozen.
+</para>
+<para>
+<!-- .LP -->
+A modifier of 
+<function>AnyModifier</function>
+is equivalent to issuing the request for all
+possible modifier combinations (including the combination of no modifiers).  
+It is not required that all modifiers specified have
+currently assigned keycodes.
+A key of 
+<function>AnyKey</function>
+is equivalent to issuing
+the request for all possible keycodes.  Otherwise, the key must be in
+the range specified by min_keycode and max_keycode in the 
+information returned by the
+<function>XListInputDevices</function>
+function.
+If it is not within that range, 
+<function>XGrabDeviceKey</function>
+generates a
+<function>BadValue</function>
+error.
+</para>
+<para>
+<!-- .LP -->
+<function>XGrabDeviceKey</function>
+generates a
+<function>BadAccess</function>
+error if some other client has issued a 
+<function>XGrabDeviceKey</function>
+with the same device and key combination on the same window.
+When using
+<function>AnyModifier</function>
+or
+<function>AnyKey ,</function>
+the request fails completely and the X server generates a
+<function>BadAccess</function>
+error, and no grabs are established if there is a conflicting grab
+for any combination.
+</para>
+<para>
+<!-- .LP -->
+<function>XGrabDeviceKey</function>
+returns
+<function>Success</function>
+upon successful completion of the request.
+</para>
+<para>
+<!-- .LP -->
+<function>XGrabDeviceKey</function>
+can generate
+<function>BadAccess ,</function>
+<function>BadClass ,</function>
+<function>BadDevice ,</function>
+<function>BadMatch ,</function>
+<function>BadValue ,</function>
+and
+<function>BadWindow</function>
+errors.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To release a passive grab of a single key on an extension device, use
+<function>XUngrabDeviceKey .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XUngrabDeviceKey</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>int<parameter> keycode</parameter></paramdef>
+  <paramdef>unsignedint<parameter> modifiers</parameter></paramdef>
+  <paramdef>XDevice<parameter> *modifier_device</parameter></paramdef>
+  <paramdef>Window<parameter> ungrab_window</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>keycode</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the keycode of the key that is to be ungrabbed.  You can pass
+either the keycode or
+<function>AnyKey .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>modifiers</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the set of keymasks.  This mask is the bitwise inclusive OR
+of these keymask bits:
+<function>ShiftMask ,</function>
+<function>LockMask ,</function>
+<function>ControlMask , </function>
+<function>Mod1Mask ,</function>
+<function>Mod2Mask ,</function>
+<function>Mod3Mask ,</function>
+<function>Mod4Mask ,</function>
+and
+<function>Mod5Mask .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      
+    </term>
+    <listitem>
+      <para>
+You can also pass
+<function>AnyModifier ,</function>
+which is equivalent to issuing the ungrab key 
+request for all possible modifier combinations (including the combination
+of no modifiers).
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>modifier_device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the device whose modifiers are to be used.  If NULL is 
+specified, the core X keyboard is used as the modifier_device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>ungrab_window</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the ID of a window associated with the device specified above.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XUngrabDeviceKey</function>
+is analogous to the core
+<function>XUngrabKey</function>
+function.  It releases an explicit passive grab for a key 
+on an extension input device.
+</para>
+<para>
+<!-- .LP -->
+<function>XUngrabDeviceKey</function>
+can generate
+<function>BadAlloc ,</function>
+<function>BadDevice ,</function>
+<function>BadMatch ,</function>
+<function>BadValue ,</function>
+and 
+<function>BadWindow</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Passively_Grabbing_a_Button">
+<title>Passively Grabbing a Button</title>
+<!-- .XS -->
+<!-- (SN Passively Grabbing a Button -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To establish a passive grab for a single button on an extension device, use
+<function>XGrabDeviceButton .</function>
+The specified device must have previously been opened using the
+<function>XOpenDevice</function>
+function, or the request will fail with a 
+<function>BadDevice</function>
+error.  If the specified device does not support input class
+<function>Buttons ,</function>
+the request will fail with a 
+<function>BadMatch</function>
+error.
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XGrabDeviceButton</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>unsignedint<parameter> button</parameter></paramdef>
+  <paramdef>unsignedint<parameter> modifiers</parameter></paramdef>
+  <paramdef>XDevice*modifier_device<parameter> </parameter></paramdef>
+  <paramdef>Window<parameter> grab_window</parameter></paramdef>
+  <paramdef>Bool<parameter> owner_events</parameter></paramdef>
+  <paramdef>int<parameter> event_count</parameter></paramdef>
+  <paramdef>XEventClass<parameter> *event_list</parameter></paramdef>
+  <paramdef>int<parameter> this_device_mode</parameter></paramdef>
+  <paramdef>int<parameter> other_device_mode</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>button</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the code of the button that is to be grabbed.  You can pass
+either the button or
+<function>AnyButton .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>modifiers</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the set of keymasks.  This mask is the bitwise inclusive OR
+of these keymask bits:
+<function>ShiftMask ,</function>
+<function>LockMask ,</function>
+<function>ControlMask , </function>
+<function>Mod1Mask ,</function>
+<function>Mod2Mask ,</function>
+<function>Mod3Mask ,</function>
+<function>Mod4Mask ,</function>
+and
+<function>Mod5Mask .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      
+    </term>
+    <listitem>
+      <para>
+You can also pass 
+<function>AnyModifier ,</function>
+which is equivalent to issuing the grab request 
+for all possible modifier combinations (including the combination
+of no modifiers).
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>modifier_device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the device whose modifiers are to be used.  If NULL is 
+specified, the core X keyboard is used as the modifier_device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>grab_window</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the ID of a window associated with the device specified above.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>owner_events</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a boolean value of either
+<function>True</function>
+or
+<function>False .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>event_count</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the number of elements in the event_list array.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>event_list</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a list of event classes that indicates which device events are to be 
+reported to the client.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>this_device_mode</emphasis>
+    </term>
+    <listitem>
+      <para>
+Controls further processing of events from this device.  You can pass one
+of these constants:
+<function>GrabModeSync</function>
+or
+<function>GrabModeAsync .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>other_device_mode</emphasis>
+    </term>
+    <listitem>
+      <para>
+Controls further processing of events from all other devices.  You can pass one
+of these constants:
+<function>GrabModeSync</function>
+or
+<function>GrabModeAsync .</function>
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XGrabDeviceButton </function>
+is analogous to the core
+<function>XGrabButton</function>
+function.  
+It creates an explicit passive grab for a button on an extension input device.
+Because the server does not track extension devices,
+no cursor is specified with this request.
+For the same reason, there is no confine_to parameter.
+The device must have previously been opened using the
+<function>XOpenDevice</function>
+function.
+</para>
+<para>
+<!-- .LP -->
+The
+<function>XGrabDeviceButton</function>
+function establishes a passive grab on a device.
+Consequently, in the future, 
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+IF the device is not grabbed and the specified button is logically pressed
+when the specified modifier keys logically are down 
+(and no other buttons or modifier keys are down),
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+AND EITHER the grab window is an ancestor of (or is) the focus window
+OR the grab window is a descendent of the focus window and contains the pointer,
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+AND a passive grab on the same device and button/key combination does not 
+exist on any ancestor of the grab window,
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+THEN the device is actively grabbed, as for
+<function>XGrabDevice ,</function>
+the last-grab time is set to the time at which the button was pressed
+(as transmitted in the
+<function>DeviceButtonPress</function>
+event), and the 
+<function>DeviceButtonPress</function>
+event is reported.
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+The interpretation of the remaining arguments is as for 
+<function>XGrabDevice .</function>
+The active grab is terminated automatically when logical state of the
+device has all buttons released (independent of the logical state of 
+the modifier keys).
+</para>
+<para>
+<!-- .LP -->
+Note that the logical state of a device (as seen by means of the X protocol)
+may lag the physical state if device event processing is frozen.
+</para>
+<para>
+<!-- .LP -->
+A modifier of
+<function>AnyModifier</function>
+is equivalent to issuing the request for all
+possible modifier combinations (including the combination of no
+modifiers).  
+It is not required that all modifiers specified have
+currently assigned keycodes.
+A button of
+<function>AnyButton</function>
+is equivalent to issuing
+the request for all possible buttons.
+Otherwise, it is not required that the 
+specified button be assigned to a physical button.
+</para>
+<para>
+<!-- .LP -->
+<function>XGrabDeviceButton</function>
+generates a
+<function>BadAccess</function>
+error if some other client has issued a 
+<function>XGrabDeviceButton</function>
+with the same device and button combination on the same window.  
+When using
+<function>AnyModifier</function>
+or
+<function>AnyButton ,</function>
+the request fails completely and the X server generates a
+<function>BadAccess</function>
+error and no grabs are
+established if there is a conflicting grab for any combination.
+</para>
+<para>
+<!-- .LP -->
+<function>XGrabDeviceButton</function>
+can generate
+<function>BadAccess , </function>
+<function>BadClass ,</function>
+<function>BadDevice ,</function>
+<function>BadMatch ,</function>
+<function>BadValue ,</function>
+and
+<function>BadWindow</function>
+errors.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To release a passive grab of a button on an extension device, use 
+<function>XUngrabDeviceButton .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XUngrabDeviceButton</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>unsignedint<parameter> button</parameter></paramdef>
+  <paramdef>unsignedint<parameter> modifiers</parameter></paramdef>
+  <paramdef>XDevice<parameter> *modifier_device</parameter></paramdef>
+  <paramdef>Window<parameter> ungrab_window</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>button</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the code of the button that is to be ungrabbed.  You can pass
+either a button or
+<function>AnyButton .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>modifiers</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the set of keymasks.  This mask is the bitwise inclusive OR
+of these keymask bits:
+<function>ShiftMask ,</function>
+<function>LockMask ,</function>
+<function>ControlMask , </function>
+<function>Mod1Mask ,</function>
+<function>Mod2Mask ,</function>
+<function>Mod3Mask ,</function>
+<function>Mod4Mask ,</function>
+and
+<function>Mod5Mask .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      
+    </term>
+    <listitem>
+      <para>
+You can also pass
+<function>AnyModifier ,</function>
+which is equivalent to issuing the ungrab key 
+request for all possible modifier combinations (including the combination
+of no modifiers).
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>modifier_device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the device whose modifiers are to be used.  If NULL is 
+specified, the core X keyboard is used as the modifier_device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>ungrab_window</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the ID of a window associated with the device specified above.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XUngrabDeviceButton </function>
+is analogous to the core
+<function>XUngrabButton</function>
+function.  It releases an explicit passive grab for a button
+on an extension device.
+That device must have previously been opened using the
+<function>XOpenDevice</function>
+function, or a
+<function>BadDevice</function>
+error will result.
+</para>
+<para>
+<!-- .LP -->
+A modifier of
+<function>AnyModifier</function>
+is equivalent to issuing the request for all
+possible modifier combinations (including the combination of no
+modifiers).  
+</para>
+<para>
+<!-- .LP -->
+<function>XUngrabDeviceButton </function>
+can generate
+<function>BadAlloc , </function>
+<function>BadDevice ,</function>
+<function>BadMatch ,</function>
+<function>BadValue ,</function>
+and
+<function>BadWindow</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Thawing_a_Device">
+<title>Thawing a Device</title>
+<!-- .XS -->
+<!-- (SN Thawing a Device -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To allow further events to be processed when a device has been frozen, use
+<function>XAllowDeviceEvents .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XAllowDeviceEvents</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>int<parameter> event_mode</parameter></paramdef>
+  <paramdef>Time<parameter> time</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>event_mode</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the event mode.  You can pass one of these constants:
+<function>AsyncThisDevice ,</function>
+<function>SyncThisDevice ,</function>
+<function>AsyncOtherDevices ,</function>
+<function>ReplayThisDevice ,</function>
+<function>AsyncAll ,</function>
+or
+<function>SyncAll .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>time</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the time.  This may be either a timestamp expressed in
+milliseconds, or
+<function>CurrentTime .</function>
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XAllowDeviceEvents</function>
+releases some queued events if the client has caused a device to freeze.
+It has no effect if the specified time is earlier than the last-grab 
+time of the most recent active grab for the client and device, 
+or if the specified time is later than the current X server time.
+The following describes the processing that occurs depending on what constant
+you pass to the event_mode argument:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+<function>AsyncThisDevice</function>
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If the specified device is frozen by the client, event processing for that 
+continues as usual.  If the device is frozen multiple times by the client on 
+behalf of multiple separate grabs, 
+<function>AsyncThisDevice</function>
+thaws for all.
+<function>AsyncThisDevice</function>
+has no effect if the specified device is not frozen by the 
+client, but the device need not be grabbed by the client.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+<function>SyncThisDevice</function>
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If the specified device is frozen and actively grabbed by the client,
+event processing for that device continues normally until the next 
+key or button event is reported to the client.
+At this time, 
+the specified device again appears to freeze.
+However, if the reported event causes the grab to be released,
+the specified device does not freeze.
+<function>SyncThisDevice</function>
+has no effect if the specified device is not frozen by the client
+or is not grabbed by the client.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+<function>ReplayThisDevice</function>
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If the specified device is actively grabbed by the client
+and is frozen as the result of an event having been sent to the client
+(either from the activation of a 
+<function>GrabDeviceButton</function>
+or from a previous
+<function>AllowDeviceEvents</function>
+with mode 
+<function>SyncThisDevice , </function>
+but not from a
+<function>Grab ),</function>
+the grab is released and that event is completely reprocessed.
+This time, however, the request ignores any passive grabs at or above 
+(toward the root) the grab-window of the grab just released.
+The request has no effect if the specified device is not grabbed by the client
+or if it is not frozen as the result of an event.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+<function>AsyncOtherDevices</function>
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If the remaining devices are frozen by the client,
+event processing for them continues as usual.
+If the other devices are frozen multiple times  by the client on behalf of 
+multiple separate grabs,
+<function>AsyncOtherDevices</function>
+``thaws'' for all.
+<function>AsyncOtherDevices</function>
+has no effect if the devices are not frozen by the client,
+but those devices need not be grabbed by the client.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+<function>SyncAll</function>
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If all devices are frozen by the client,
+event processing (for all devices) continues normally until the next
+button or key event is reported
+to the client for a grabbed device,
+at which time the devices again appear to
+freeze.  However, if the reported event causes the grab to be released,
+then the devices do not freeze (but if any device is still
+grabbed, then a subsequent event for it will still cause all devices
+to freeze).  
+<function>SyncAll</function>
+has no effect unless all devices are frozen by the client.
+If any device is frozen twice
+by the client on behalf of two separate grabs, 
+<function>SyncAll</function>
+"thaws" for both (but a subsequent freeze for 
+<function>SyncAll</function>
+will freeze each device only once).
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+<function>AsyncAll</function>
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If all devices are frozen by the
+client, event processing (for all devices) continues normally.
+If any device is frozen multiple times by the client on behalf of multiple
+separate grabs, 
+<function>AsyncAll</function>
+``thaws ''for all.
+If any device is frozen twice by the client on behalf of two separate grabs,
+<function>AsyncAll</function>
+``thaws'' for both.
+<function>AsyncAll</function>
+has no effect unless all devices are frozen by the client.
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+<function>AsyncThisDevice ,</function>
+<function>SyncThisDevice ,</function>
+and
+<function>ReplayThisDevice </function>
+have no effect on the processing of events from the remaining devices.
+<function>AsyncOtherDevices</function>
+has no effect on the processing of events from the specified device.
+When the event_mode is
+<function>SyncAll</function>
+or
+<function>AsyncAll ,</function>
+the device parameter is ignored.
+</para>
+<para>
+<!-- .LP -->
+It is possible for several grabs of different devices (by the same 
+or different clients) to be active simultaneously.
+If a device is frozen on behalf of any grab,
+no event processing is performed for the device.
+It is possible for a single device to be frozen because of several grabs.
+In this case,
+the freeze must be released on behalf of each grab before events can 
+again be processed.
+</para>
+<para>
+<!-- .LP -->
+<function>XAllowDeviceEvents</function>
+can generate
+<function>BadDevice</function>
+and 
+<function>BadValue</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Controlling_Device_Focus">
+<title>Controlling Device Focus</title>
+<!-- .XS -->
+<!-- (SN Controlling Device Focus -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+The current focus window for an extension input device can be 
+determined using the
+<function>XGetDeviceFocus</function>
+function.
+Extension devices are focused using the
+<function>XSetDeviceFocus</function>
+function in the same way that the keyboard is focused using the core
+<function>XSetInputFocus</function>
+function, except that a device ID is passed as
+a function parameter.  One additional focus state,
+<function>FollowKeyboard ,</function>
+is provided for extension devices.
+</para>
+<para>
+<!-- .LP -->
+To get the current focus state, revert state,
+and focus time of an extension device, use
+<function>XGetDeviceFocus .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XGetDeviceFocus</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>Window<parameter> *focus_return</parameter></paramdef>
+  <paramdef>int<parameter> *revert_to_return</parameter></paramdef>
+  <paramdef>Time<parameter> *focus_time_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>focus_return</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the address of a variable into which the server can return the ID of
+the window that contains the device focus or one of the constants
+<function>None ,</function>
+<function>PointerRoot ,</function>
+or
+<function>FollowKeyboard .  </function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>revert_to_return</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the address of a variable into which the server can
+return the current revert_to status for the device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>focus_time_return</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the address of a variable into which the server can
+return the focus time last set for the device.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XGetDeviceFocus</function>
+returns the focus state, the revert-to state,
+and the last-focus-time for an extension input device.
+</para>
+<para>
+<!-- .LP -->
+<function>XGetDeviceFocus</function>
+can generate
+<function>BadDevice</function>
+and
+<function>BadMatch</function>
+errors.
+<!-- .sp  -->
+</para>
+<para>
+<!-- .LP -->
+To set the focus of an extension device, use
+<function>XSetDeviceFocus .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XSetDeviceFocus</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>Window<parameter> focus</parameter></paramdef>
+  <paramdef>int<parameter> revert_to</parameter></paramdef>
+  <paramdef>Time<parameter> time</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>focus</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the ID of the window to which the device's focus should be set.
+This may be a window ID, or
+<function>PointerRoot ,</function>
+<function>FollowKeyboard ,</function>
+or
+<function>None .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>revert_to</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies to which window the focus of the device should revert
+if the focus window becomes not viewable.  One of the following
+constants may be passed:
+<function>RevertToParent ,</function>
+<function>RevertToPointerRoot ,</function>
+<function>RevertToNone ,</function>
+or
+<function>RevertToFollowKeyboard .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>time</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the time.  You can pass either a timestamp, expressed in
+milliseconds, or
+<function>CurrentTime .</function>
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XSetDeviceFocus</function>
+changes the focus for an extension input device and the 
+last-focus-change-time.  It has no effect if the specified 
+time is earlier than the last-focus-change-time or is later than the
+current X server time.  Otherwise, the last-focus-change-time is set to the
+specified time.
+This function causes the X server to generate
+<function>DeviceFocusIn</function>
+and 
+<function>DeviceFocusOut</function>
+events.
+</para>
+<para>
+<!-- .LP -->
+The action taken by the server when this function is requested depends
+on the value of the focus argument:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+If the focus argument is
+<function>None ,</function>
+all input events from this device will be discarded until a new focus window
+is set.  In this case, the revert_to argument is ignored.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If the focus argument is a window ID, it becomes the focus
+window of the device.  If an input event from the device would normally
+be reported to this window or to one of its inferiors, the event is 
+reported normally.  Otherwise, the event is reported relative to the focus 
+window.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If the focus argument is
+<function>PointerRoot ,</function>
+the focus window is dynamically taken to be the root window 
+of whatever screen the pointer is on at each input event.
+In this case, the revert_to argument is ignored.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If the focus argument is
+<function>FollowKeyboard ,   </function>
+the focus window is dynamically taken to be the same as the focus
+of the X keyboard at each input event.
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+The specified focus window must be viewable at the time
+<function>XSetDeviceFocus</function>
+is called.  Otherwise, it generates a
+<function>BadMatch</function>
+error.
+If the focus window later becomes not viewable,
+the X server evaluates the revert_to argument
+to determine the new focus window.
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+If the revert_to argument is
+<function>RevertToParent ,</function>
+the focus reverts to the parent (or the closest viewable ancestor),
+and the new revert_to value is taken to be
+<function>RevertToNone .  </function>
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If the revert_to argument is
+<function>RevertToPointerRoot ,</function>
+<function>RevertToFollowKeyboard ,</function>
+or
+<function>RevertToNone ,</function>
+the focus reverts to that value.
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+When the focus reverts,
+the X server generates
+<function>DeviceFocusIn</function>
+and
+<function>DeviceFocusOut</function>
+events, but the last-focus-change time is not affected.
+</para>
+<para>
+<!-- .LP -->
+<function>XSetDeviceFocus</function>
+can generate
+<function>BadDevice ,</function>
+<function>BadMatch , </function>
+<function>BadValue ,</function>
+and
+<function>BadWindow</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Controlling_Device_Feedback">
+<title>Controlling Device Feedback</title>
+<!-- .XS -->
+<!-- (SN Controlling Device Feedback -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To determine the current feedback settings of an extension input device, use
+<function>XGetFeedbackControl .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XFeedbackState * <function> XGetFeedbackControl</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>int<parameter> *num_feedbacks_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>num_feedbacks_return</emphasis>
+    </term>
+    <listitem>
+      <para>
+Returns the number of feedbacks supported by the device.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XGetFeedbackControl</function>
+returns a list of
+<function>FeedbackState</function>
+structures that describe the feedbacks supported by the specified device.
+There is an
+<function>XFeedbackState</function>
+structure for each class of feedback.  These are of 
+variable length, but the first three members are common to all.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID class;
+     int length;
+     XID id;
+} XFeedbackState;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The common members are as follows:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+The class member identifies the class of feedback.
+It may be compared to constants defined in the file
+<function>&lt; X11/extensions/XI.h &gt;.</function>
+Currently defined feedback constants include:
+<function>KbdFeedbackClass , </function>
+<function>PtrFeedbackClass ,</function>
+<function>StringFeedbackClass ,</function>
+<function>IntegerFeedbackClass , </function>
+<function>LedFeedbackClass ,</function>
+and
+<function>BellFeedbackClass .</function>
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The length member specifies the length of the
+<function>FeedbackState</function>
+structure and can be used by clients to traverse the list.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The id member uniquely identifies a feedback for a given device and class.
+This allows a device to support more than one feedback of the same class.
+Other feedbacks of other classes or devices may have the same ID.
+<!-- .sp -->
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+Those feedbacks equivalent to those
+supported by the core keyboard are reported in class
+<function>KbdFeedback</function>
+using the
+<function>XKbdFeedbackState</function>
+structure, which is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID class;
+     int length;
+     XID id;
+     int click;
+     int percent;
+     int pitch;
+     int duration;
+     int led_mask;
+     int global_auto_repeat;
+     char auto_repeats[32];
+} XKbdFeedbackState;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The additional members of the
+<function>XKbdFeedbackState</function>
+structure report the current state of the feedback:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+The click member specifies the key-click volume and has a value in the range
+0 (off) to 100 (loud).
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The percent member specifies the bell volume and has a value in the range
+0 (off) to 100 (loud).
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The pitch member specifies the bell pitch in Hz. The range of the value is 
+implementation-dependent.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The duration member specifies the duration in milliseconds of the bell.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The led_mask member is a bit mask that describes the current state of up to 
+32 LEDs.  A value of 1 in a bit indicates that the corresponding LED is on.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The global_auto_repeat member has a value of
+<function>AutoRepeatModeOn</function>
+or
+<function>AutoRepeatModeOff .</function>
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The auto_repeats member is a bit vector.  Each bit set to 1 indicates
+that auto-repeat is enabled for the corresponding key.  The vector is
+represented as 32 bytes.  Byte N (from 0) contains the bits for keys
+8N to 8N + 7, with the least significant bit in the byte representing
+key 8N.
+<!-- .sp -->
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+Those feedbacks equivalent to those
+supported by the core pointer are reported in class
+<function>PtrFeedback</function>
+using the
+<function>XPtrFeedbackState</function>
+structure, which is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID class;
+     int length;
+     XID id;
+     int accelNum;
+     int accelDenom;
+     int threshold;
+} XPtrFeedbackState;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The additional members of the
+<function>XPtrFeedbackState</function>
+structure report the current state of the feedback:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+The accelNum member returns the numerator for the acceleration multiplier.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The accelDenom member returns the denominator for the acceleration multiplier.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The accelDenom member returns the threshold for the acceleration.
+<!-- .sp -->
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+Integer feedbacks are those capable of displaying integer numbers
+and reported via the
+<function>XIntegerFeedbackState</function>
+structure.
+The minimum and maximum values that they can display are reported.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID class;
+     int length;
+     XID id;
+     int resolution;
+     int minVal;
+     int maxVal;
+} XIntegerFeedbackState;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The additional members of the
+<function>XIntegerFeedbackState</function>
+structure report the capabilities of the feedback:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+The resolution member specifies the number of digits that the feedback
+can display.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The minVal member specifies the minimum value that the feedback can display.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The maxVal specifies the maximum value that the feedback can display.
+<!-- .sp -->
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+String feedbacks are those that can display character information
+and are reported via the
+<function>XStringFeedbackState</function>
+structure.
+Clients set these feedbacks by passing a list of 
+<function>KeySyms</function>
+to be displayed.
+The 
+<function>XGetFeedbackControl</function>
+function returns the
+set of key symbols that the feedback can display, as well as the 
+maximum number of symbols that can be displayed.
+The
+<function>XStringFeedbackState</function>
+structure is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID class;
+     int length;
+     XID id;
+     int max_symbols;
+     int  num_syms_supported;
+     KeySym *syms_supported;
+} XStringFeedbackState;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The additional members of the
+<function>XStringFeedbackState</function>
+structure report the capabilities of the feedback:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+The max_symbols member specifies the maximum number of symbols
+that can be displayed.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The syms_supported member is a pointer to the list of supported symbols.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+The num_syms_supported member specifies the length of the list of supported symbols.
+<!-- .sp -->
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+Bell feedbacks are those that can generate a sound
+and are reported via the
+<function>XBellFeedbackState</function>
+structure.
+Some implementations may support a bell as part of a
+<function>KbdFeedback</function>
+feedback.  Class
+<function>BellFeedback</function>
+is provided for implementations that do not choose to do
+so and for devices that support multiple feedbacks that can produce sound.
+The meaning of the members is the same as that of the corresponding fields in
+the 
+<function>XKbdFeedbackState</function>
+structure.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID class;
+     int length;
+     XID id;
+     int percent;
+     int pitch;
+     int duration;
+} XBellFeedbackState;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+Led feedbacks are those that can generate a light and are reported via the
+<function>XLedFeedbackState</function>
+structure.
+Up to 32 lights per feedback are supported.  
+Each bit in led_mask
+corresponds to one supported light, and the corresponding bit in led_values
+indicates whether that light is currently on (1) or off (0).
+Some implementations may support leds as part of a
+<function>KbdFeedback</function>
+feedback.
+Class 
+<function>LedFeedback</function>
+is provided for implementations that do not choose to do
+so and for devices that support multiple led feedbacks.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID class;
+     int length;
+     XID id;
+     Mask led_values;
+     Mask led_mask;
+} XLedFeedbackState;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XGetFeedbackControl</function>
+can generate
+<function>BadDevice</function>
+and
+<function>BadMatch</function>
+errors.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To free the information returned by the
+<function>XGetFeedbackControl</function>
+function, use 
+<function>XFreeFeedbackList .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function> XFreeFeedbackList</function></funcdef>
+  <paramdef>XFeedbackState<parameter> *list</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>list</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the pointer to the 
+<function>XFeedbackState</function>
+structure returned by
+a previous call to
+<function>XGetFeedbackControl .</function>
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XFreeFeedbackList</function>
+frees the list of feedback control information.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To change the settings of a feedback on an extension device, use
+<function>XChangeFeedbackControl .</function>
+This function modifies the current control values of the specified feedback
+using information passed in the appropriate
+<function>XFeedbackControl</function>
+structure for the feedback.
+Which values are modified depends on the valuemask passed.
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XChangeFeedbackControl</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>unsignedlong<parameter> valuemask</parameter></paramdef>
+  <paramdef>XFeedbackControl<parameter> *value</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>valuemask</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies one value for each bit in the mask (least to most significant
+bit).  The values are associated with the feedbacks for the specified
+device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>value</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a pointer to the
+<function>XFeedbackControl</function>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XChangeFeedbackControl</function>
+controls the device characteristics described by the
+<function>XFeedbackControl</function>
+structure. 
+There is an
+<function>XFeedbackControl</function>
+structure for each class of feedback.  
+These are of variable length, but the first 
+three members are common to all and are as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID class;
+     int length;
+     XID id;
+} XFeedbackControl;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+Feedback class 
+<function>KbdFeedback</function>
+controls feedbacks equivalent to those provided by the core keyboard using the
+<function>KbdFeedbackControl</function>
+structure, which is defined as follows:.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID class;
+     int length;
+     XID id;
+     int click;
+     int percent;
+     int pitch;
+     int duration;
+     int led_mask;
+     int led_value;
+     int key;
+     int auto_repeat_mode;
+} XKbdFeedbackControl;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+This class controls the device characteristics described by the
+<function>XKbdFeedbackControl</function>
+structure.  These include the key_click_percent,
+global_auto_repeat, and individual key auto-repeat.  Valid modes
+are
+<function>AutoRepeatModeOn ,</function>
+<function>AutoRepeatModeOff ,</function>
+and
+<function>AutoRepeatModeDefault .</function>
+</para>
+<para>
+<!-- .LP -->
+Valid masks are as follows:
+<!-- .sM -->
+</para>
+
+<literallayout class="monospaced">
+
+#define   DvKeyClickPercent           (1>&lt;&lt;0)
+#define   DvPercent                   (1>&lt;&lt;0)
+#define   DvPitch                     (1>&lt;&lt;0)
+#define   DvDuration                  (1>&lt;&lt;0)
+#define   DvLed                       (1>&lt;&lt;0)
+#define   DvLedMode                   (1>&lt;&lt;0)
+#define   DvKey                       (1>&lt;&lt;0)
+#define   DvAutoRepeatMode            (1>&lt;&lt;0)
+</literallayout>
+
+<para>
+<!-- .LP -->
+Feedback class
+<function>PtrFeedback</function>
+controls feedbacks equivalent to those provided by the core pointer using the
+<function>PtrFeedbackControl</function>
+structure, which is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID class;
+     int length;
+     XID id;
+     int accelNum;
+     int accelDenom;
+     int threshold;
+} XPtrFeedbackControl;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+Which values are modified depends on the valuemask passed.
+</para>
+<para>
+<!-- .LP -->
+Valid masks are as follows:
+<!-- .sM -->
+</para>
+
+<literallayout class="monospaced">
+#define    DvAccelnum        (1L&lt;&lt;0)
+#define    DvAccelDenom      (1L&lt;&lt;1)
+#define    DvThreshold       (1L&lt;&lt;2)
+</literallayout>
+
+
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The acceleration, expressed as a fraction, is a multiplier for movement. 
+For example,
+specifying 3/1 means that the device moves three times as fast as normal.
+The fraction may be rounded arbitrarily by the X server.  
+Acceleration takes effect only if the device moves more than threshold pixels at
+once and applies only to the amount beyond the value in the threshold argument.
+Setting a value to -1 restores the default.
+The values of the accelNumerator and threshold fields must be nonzero for
+the pointer values to be set.
+Otherwise, the parameters will be unchanged.
+Negative values generate a
+<function>BadValue</function>
+error, as does a zero value
+for the accelDenominator field.
+</para>
+<para>
+<!-- .LP -->
+This request fails with a
+<function>BadMatch</function>
+error if the specified device is not currently reporting relative motion.
+If a device that is capable of reporting both relative and absolute motion
+has its mode changed from
+<function>Relative</function>
+to
+<function>Absolute</function>
+by an
+<function>XSetDeviceMode</function>
+request, valuator control values
+will be ignored by the server while the device is in that mode.
+</para>
+<para>
+<!-- .LP -->
+Feedback class
+<function>IntegerFeedback</function>
+controls integer feedbacks displayed on input devices and are
+reported via the
+<function>IntegerFeedbackControl</function>
+structure, which is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID class;
+     int length;
+     XID id;
+     int int_to_display;
+} XIntegerFeedbackControl;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+Valid masks are as follows:
+<!-- .sM -->
+</para>
+
+<literallayout class="monospaced">
+
+#define   DvInteger           (1L&lt;&lt;0)
+</literallayout>
+
+<para>
+<!-- .LP -->
+<!-- .eM -->
+Feedback class
+<function>StringFeedback</function>
+controls string feedbacks displayed on input devices
+and reported via the
+<function>StringFeedbackControl</function>
+structure, which is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID class;
+     int length;
+     XID id;
+     int num_keysyms;
+     KeySym *syms_to_display;
+} XStringFeedbackControl;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+Valid masks are as follows:
+<!-- .sM -->
+</para>
+<literallayout class="monospaced">
+
+#define   DvString           (1L&lt;&lt;0)
+</literallayout>
+
+<para>
+<!-- .LP -->
+<!-- .eM -->
+Feedback class
+<function>BellFeedback</function>
+controls a bell on an input device and is reported via the
+<function>BellFeedbackControl</function>
+structure, which is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID class;
+     int length;
+     XID id;
+     int percent;
+     int pitch;
+     int duration;
+} XBellFeedbackControl;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+Valid masks are as follows:
+<!-- .sM -->
+</para>
+
+
+<literallayout class="monospaced">
+
+#define   DvPercent                   (1L&lt;&lt;1)
+#define   DvPitch                     (1L&lt;&lt;2)
+#define   DvDuration                  (1L&lt;&lt;3)
+</literallayout>
+
+<para>
+<!-- .LP -->
+<!-- .eM -->
+Feedback class
+<function>LedFeedback</function>
+controls lights on an input device and are reported via the
+<function>LedFeedbackControl</function>
+structure, which is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID class;
+     int length;
+     XID id;
+     int led_mask;
+     int led_values;
+} XLedFeedbackControl;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+Valid masks are as follows:
+<!-- .sM -->
+</para>
+
+<literallayout class="monospaced">
+
+#define   DvLed                       (1L&lt;&lt;4)
+#define   DvLedMode                   (1L&lt;&lt;5)
+</literallayout>
+
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XChangeFeedbackControl</function>
+can generate
+<function>BadDevice ,</function>
+<function>BadFeedBack ,</function>
+<function>BadMatch ,</function>
+and
+<function>BadValue</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Ringing_a_Bell_on_an_Input_Device">
+<title>Ringing a Bell on an Input Device</title>
+<!-- .XS -->
+<!-- (SN Ringing a Bell on an Input Device -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To ring a bell on an extension input device, use
+<function>XDeviceBell .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XDeviceBell</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>XIDfeedbackclass,<parameter> feedbackid</parameter></paramdef>
+  <paramdef>int<parameter> percent</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>feedbackclass</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the feedbackclass.  Valid values are
+<function>KbdFeedbackClass</function>
+and
+<function>BellFeedbackClass .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>feedbackid</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the ID of the feedback that has the bell.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>percent</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the volume in the range -100 (quiet) to 100 percent (loud).
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XDeviceBell</function>
+is analogous to the core 
+<function>XBell</function>
+function.  It rings the specified bell on the specified input device feedback,
+using the specified volume.
+The specified volume is relative to the base volume for the feedback.
+If the value for the percent argument is not in the range -100 to 100
+inclusive, a
+<function>BadValue</function>
+error results.
+The volume at which the bell rings when the percent argument is nonnegative is:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+       base - [(base * percent) / 100] + percent
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+The volume at which the bell rings
+when the percent argument is negative is:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+       base + [(base * percent) / 100]
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+To change the base volume of the bell, use
+<function>XChangeFeedbackControl .</function>
+</para>
+<para>
+<!-- .LP -->
+<function>XDeviceBell</function>
+can generate
+<function>BadDevice</function>
+and
+<function>BadValue</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Controlling_Device_Encoding">
+<title>Controlling Device Encoding</title>
+<!-- .XS -->
+<!-- (SN Controlling Device Encoding -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To get the key mapping of an extension device that supports input class 
+<function>Keys ,</function>
+use 
+<function>XGetDeviceKeyMapping .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>KeySym * <function> XGetDeviceKeyMapping</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>KeyCode<parameter> first_keycode_wanted</parameter></paramdef>
+  <paramdef>int<parameter> keycode_count</parameter></paramdef>
+  <paramdef>int<parameter> *keysyms_per_keycode_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>first_keycode_wanted</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the first keycode that is to be returned.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>keycode_count</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the number of keycodes that are to be returned.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>keysyms_per_keycode_return</emphasis>
+    </term>
+    <listitem>
+      <para>
+Returns the number of keysyms per keycode.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XGetDeviceKeyMapping </function>
+is analogous to the core
+<function>XGetKeyboardMapping</function>
+function.  
+It returns the symbols for the specified number of keycodes for the 
+specified extension device.
+</para>
+<para>
+<!-- .LP -->
+<function>XGetDeviceKeyMapping </function>
+returns the symbols for the 
+specified number of keycodes for the 
+specified extension device, starting with the specified keycode.
+The first_keycode_wanted must be greater than or equal to
+min-keycode as returned 
+by the
+<function>XListInputDevices</function>
+request (else a 
+<function>BadValue</function>
+error results). The following value:
+<literallayout class="monospaced">
+first_keycode_wanted + keycode_count - 1
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+must be less than or equal to max-keycode as returned 
+by the 
+<function>XListInputDevices</function>
+request (else a 
+<function>BadValue</function>
+error results).
+</para>
+<para>
+<!-- .LP -->
+The number of elements in the keysyms list is as follows:
+<literallayout class="monospaced">
+keycode_count * keysyms_per_keycode_return
+</literallayout>
+And KEYSYM number N (counting from zero) for keycode K has an index
+(counting from zero), in keysyms, of the following:
+<literallayout class="monospaced">
+(K - first_keycode_wanted) * keysyms_per_keycode_return + N
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+The keysyms_per_keycode_return value is chosen arbitrarily by the server
+to be large enough to report all requested symbols.
+A special KEYSYM value of
+<function>NoSymbol</function>
+is used to fill in unused elements for individual keycodes.
+</para>
+<para>
+<!-- .LP -->
+To free the data returned by this function, use
+<function>XFree .</function>
+</para>
+<para>
+<!-- .LP -->
+If the specified device has not first been opened by this client via
+<function>XOpenDevice ,</function>
+this request will fail with a
+<function>BadDevice</function>
+error.
+If that device does not support input class
+<function>Keys ,</function>
+this request will fail with a 
+<function>BadMatch</function>
+error.
+</para>
+<para>
+<!-- .LP -->
+<function>XGetDeviceKeyMapping </function>
+can generate
+<function>BadDevice ,</function>
+<function>BadMatch ,</function>
+and
+<function>BadValue</function>
+errors.
+<!-- .sp  -->
+</para>
+<para>
+<!-- .LP -->
+To change the keyboard mapping of an extension device that supports input class 
+<function>Keys ,</function>
+use 
+<function>XChangeDeviceKeyMapping .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XChangeDeviceKeyMapping</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>int<parameter> first_keycode</parameter></paramdef>
+  <paramdef>int<parameter> keysyms_per_keycode</parameter></paramdef>
+  <paramdef>KeySym<parameter> *keysyms</parameter></paramdef>
+  <paramdef>int<parameter> num_codes</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>first_keycode</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the first keycode that is to be changed.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>keysyms_per_keycode</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the keysyms that are to be used.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>keysyms</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a pointer to an array of keysyms.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>num_codes</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the number of keycodes that are to be changed.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XChangeDeviceKeyMapping</function>
+is analogous to the core
+<function>XChangeKeyboardMapping</function>
+function.  
+It defines the symbols for the specified number of keycodes for the 
+specified extension keyboard device.
+</para>
+<para>
+<!-- .LP -->
+If the specified device has not first been opened by this client via
+<function>XOpenDevice ,</function>
+this request will fail with a
+<function>BadDevice</function>
+error.
+If the specified device does not support input class
+<function>Keys ,</function>
+this request will fail with a
+<function>BadMatch</function>
+error.
+</para>
+<para>
+<!-- .LP -->
+The number of elements in the keysyms list must be a multiple of
+keysyms_per_keycode.  Otherwise,
+<function>XChangeDeviceKeyMapping</function>
+generates a
+<function>BadLength</function>
+error.
+The specified first_keycode must be greater than or equal to
+the min_keycode value returned by the
+<function>ListInputDevices</function>
+request, or this request will fail with a
+<function>BadValue</function>
+error.  In addition, if the following expression is not less than
+the max_keycode value returned by the
+<function>ListInputDevices</function>
+request, the request will fail with a
+<function>BadValue</function>
+error:
+<literallayout class="monospaced">
+       first_keycode + (num_codes / keysyms_per_keycode) - 1
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<function>XChangeDeviceKeyMapping</function>
+can generate
+<function>BadAlloc ,</function>
+<function>BadDevice ,</function>
+<function>BadMatch ,</function>
+and
+<function>BadValue</function>
+errors.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To obtain the keycodes that are used as modifiers on an 
+extension device that supports input class
+<function>Keys ,</function>
+use
+<function>XGetDeviceModifierMapping .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XModifierKeymap * <function> XGetDeviceModifierMapping</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XGetDeviceModifierMapping</function>
+is analogous to the core
+<function>XGetModifierMapping</function>
+function.  
+The
+<function>XGetDeviceModifierMapping</function>
+function returns a newly created
+<function>XModifierKeymap</function>
+structure that contains the keys being used as
+modifiers for the specified device.
+The structure should be freed after use with
+<function>XFreeModifierMapping .</function>
+If only zero values appear in the set for any modifier,
+that modifier is disabled.
+</para>
+<para>
+<!-- .LP -->
+<function>XGetDeviceModifierMapping</function>
+can generate
+<function>BadDevice</function>
+and
+<function>BadMatch</function>
+errors.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To set which keycodes are to be used as modifiers for an extension device, use
+<function>XSetDeviceModifierMapping .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XSetDeviceModifierMapping</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>XModifierKeymap<parameter> *modmap</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>modmap</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a pointer to the
+<function>XModifierKeymap</function>
+structure.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XSetDeviceModifierMapping</function>
+is analogous to the core
+<function>XSetModifierMapping</function>
+function.  
+The 
+<function>XSetDeviceModifierMapping</function>
+function specifies the keycodes of the keys, if any, 
+that are to be used as modifiers.  A zero value means
+that no key should be used.  No two arguments can have the same nonzero
+keycode value.  Otherwise,
+<function>XSetDeviceModifierMapping</function>
+generates a
+<function>BadValue</function>
+error.
+There are eight modifiers, and the modifiermap member of the 
+<function>XModifierKeymap</function>
+structure contains eight sets of max_keypermod 
+keycodes, one for each modifier in the order 
+<function>Shift ,</function>
+<function>Lock ,</function>
+<function>Control ,</function>
+<function>Mod1 ,</function>
+<function>Mod2 ,</function>
+<function>Mod3 ,</function>
+<function>Mod4 ,</function>
+and
+<function>Mod5 .</function>
+Only nonzero keycodes have meaning in each set, and zero keycodes
+are ignored.
+In addition, all of the nonzero keycodes must be in the range specified by 
+min_keycode and max_keycode reported by the
+<function>XListInputDevices</function>
+function.
+Otherwise,
+<function>XSetModifierMapping</function>
+generates a
+<function>BadValue</function>
+error.
+No keycode may appear twice in the entire map. 
+Otherwise, it generates a
+<function>BadValue</function>
+error.
+</para>
+<para>
+<!-- .LP -->
+A X server can impose restrictions on how modifiers can be changed, 
+for example,
+if certain keys do not generate up transitions in hardware or if multiple
+modifier keys are not supported.  
+If some such restriction is violated, 
+the status reply is
+<function>MappingFailed ,</function>
+and none of the modifiers are changed.
+If the new keycodes specified for a modifier differ from those
+currently defined and any (current or new) keys for that modifier are
+in the logically down state, 
+the status reply is
+<function>MappingBusy , </function>
+and none of the modifiers are changed.
+<function>XSetModifierMapping</function>
+generates a
+<function>DeviceMappingNotify</function>
+event on a
+<function>MappingSuccess</function>
+status.
+</para>
+<para>
+<!-- .LP -->
+<function>XSetDeviceModifierMapping</function>
+can generate
+<function>BadAlloc ,</function>
+<function>BadDevice ,</function>
+<function>BadMatch ,</function>
+and
+<function>BadValue</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Controlling_Button_Mapping">
+<title>Controlling Button Mapping</title>
+<!-- .XS -->
+<!-- (SN Controlling Button Mapping -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To set the mapping of the buttons on an extension device, use
+<function>XSetDeviceButtonMapping .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XSetDeviceButtonMapping</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>unsignedchar<parameter> map[]</parameter></paramdef>
+  <paramdef>int<parameter> nmap</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>map</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the mapping list.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>nmap</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the number of items in the mapping list.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XSetDeviceButtonMapping</function>
+sets the mapping of the buttons on an extension device.
+If it succeeds, the X server generates a
+<function>DeviceMappingNotify</function>
+event, and
+<function>XSetDeviceButtonMapping</function>
+returns
+<function>MappingSuccess .</function>
+Elements of the list are indexed starting from one.
+The length of the list must be the same as
+<function>XGetDeviceButtonMapping</function>
+would return, or a 
+<function>BadValue</function>
+error results.
+The index is a button number, and the element of the list
+defines the effective number.
+A zero element disables a button, and elements are not restricted in
+value by the number of physical buttons.
+However, no two elements can have the same nonzero value, or a
+<function>BadValue</function>
+error results.
+If any of the buttons to be altered are logically in the down state,
+<function>XSetDeviceButtonMapping</function>
+returns
+<function>MappingBusy ,</function>
+and the mapping is not changed.
+</para>
+<para>
+<!-- .LP -->
+<function>XSetDeviceButtonMapping</function>
+can generate
+<function>BadDevice ,</function>
+<function>BadMatch ,</function>
+and
+<function>BadValue</function>
+errors.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To get the button mapping, use
+<function>XGetDeviceButtonMapping .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XGetDeviceButtonMapping</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>unsignedchar<parameter> map_return[]</parameter></paramdef>
+  <paramdef>int<parameter> nmap</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>map_return</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the mapping list.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>nmap</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the number of items in the mapping list.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XGetDeviceButtonMapping</function>
+returns the current mapping of the specified extension device.
+Elements of the list are indexed starting from one.
+<function>XGetDeviceButtonMapping</function>
+returns the number of physical buttons actually on the pointer.
+The nominal mapping for the buttons is the identity mapping: map[i]=i.
+The nmap argument specifies the length of the array where the button
+mapping is returned, and only the first nmap elements are returned 
+in map_return.
+</para>
+<para>
+<!-- .LP -->
+<function>XGetDeviceButtonMapping</function>
+can generate
+<function>BadDevice</function>
+and
+<function>BadMatch</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Obtaining_the_State_of_a_Device">
+<title>Obtaining the State of a Device</title>
+<!-- .XS -->
+<!-- (SN Obtaining the State of a Device -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To obtain information that describes the state of the keys, buttons, and 
+valuators of an extension device, use
+<function>XQueryDeviceState .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XDeviceState * <function> XQueryDeviceState</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XQueryDeviceState</function>
+returns a pointer to an
+<function>XDeviceState</function>
+structure, which points to a list of
+structures that describe the state of the keys, buttons, and valuators 
+on the device:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID device_id;
+     int num_classes;
+     XInputClass *data;
+} XDeviceState;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The structures are of variable length, but the first 
+two members are common to all and are as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     unsigned char class;
+     unsigned char length;
+} XInputClass;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The class member contains a class identifier.  This identifier can be
+compared with constants defined in the file 
+<function>&lt; X11/extensions/XI.h &gt;.</function>
+Currently defined constants are:
+<function>KeyClass ,</function>
+<function>ButtonClass ,</function>
+and
+<function>ValuatorClass .</function>
+</para>
+<para>
+<!-- .LP -->
+The length member contains the length of the structure and can be used
+by clients to traverse the list.
+</para>
+<para>
+<!-- .LP -->
+The 
+<function>XValuatorState</function>
+structure describes the current state of the valuators
+on the device.
+The num_valuators member contains the number of valuators
+on the device.
+The mode member is a mask whose bits report the data mode
+and other state information for the device.
+The following bits are currently defined:
+<literallayout class="monospaced">
+<!-- .TA .5i 1.5i 2.5i -->
+<!-- .ta .5i 1.5i 2.5i -->
+     DeviceMode     1 &lt;&lt; 0     Relative = 0, Absolute = 1
+     ProximityState     1 &lt;&lt; 1     InProximity = 0, OutOfProximity = 1
+</literallayout>
+The valuators member contains a pointer to an array of integers that
+describe the current value of the valuators.
+If the mode is 
+<function>Relative ,</function>
+these values are undefined.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     unsigned char class;
+     unsigned char length;
+     unsigned char num_valuators;
+     unsigned char mode;
+     int *valuators;
+} XValuatorState;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XKeyState</function>
+structure describes the current state of the keys
+on the device.  Byte N (from 0) contains the
+bits for key 8N to 8N + 7 with the least significant bit in the
+byte representing key 8N.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     unsigned char class;
+     unsigned char length;
+     short num_keys;
+     char keys[32];
+} XKeyState;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XButtonState</function>
+structure describes the current state of the buttons
+on the device.  Byte N (from 0) contains the bits for button 8N to 8N + 7
+with the least significant bit in the
+byte representing button 8N.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     unsigned char class;
+     unsigned char length;
+     short num_buttons;
+     char buttons[32];
+} XButtonState;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XQueryDeviceState</function>
+can generate
+<function>BadDevice</function>
+errors.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To free the data returned by this function, use
+<function>XFreeDeviceState .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function> XFreeDeviceState</function></funcdef>
+  <paramdef>XDeviceState<parameter> *state</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>state</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the pointer to the
+<function>XDeviceState</function>
+data returned by a previous call to
+<function>XQueryDeviceState .</function>
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XFreeDeviceState</function>
+frees the device state data.
+</para>
+</sect3>
+</sect2>
+<sect2 id="Events">
+<title>Events</title>
+<!-- .XS -->
+<!-- (SN Events -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+The input extension creates input events analogous to the core input events.
+These extension input events are generated by manipulating one of the
+extension input devices.
+The remainder of this section discusses the following X Input Extension
+event topics:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+Event types
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Event classes
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Event structures
+    </para>
+  </listitem>
+</itemizedlist>
+<sect3 id="Event_Types">
+<title>Event Types</title>
+<!-- .XS -->
+<!-- (SN Event Types -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Event types are integer numbers that a client can use to determine what
+kind of event it has received.  The client compares the type field of 
+the event structure with known event types to make this determination.
+</para>
+<para>
+<!-- .LP -->
+The core input event types are constants and are defined in the header file
+<function>&lt; X11/X.h &gt;.</function>
+Extension event types are not constants.  Instead, they
+are dynamically allocated by the extension's request to the X server
+when the extension is initialized.  Because of this, extension event
+types must be obtained by the client from the server.
+</para>
+<para>
+<!-- .LP -->
+The client program determines the event type for an extension event by using
+the information returned by the
+<function>XOpenDevice</function>
+request.
+This type can then be used for comparison with the type field
+of events received by the client.
+</para>
+<para>
+<!-- .LP -->
+Extension events propagate up the window hierarchy in the same manner
+as core events.  If a window is not interested in an extension event, 
+it usually propagates to the closest ancestor that is interested,
+unless the dont_propagate list prohibits it.
+Grabs of extension devices may alter the set of windows that receive a particular
+extension event.
+</para>
+<para>
+<!-- .LP -->
+The following table lists the event category and its associated event
+type or types.
+</para>
+
+<informaltable>
+  <tgroup cols='2' align='center'>
+  <colspec colname='c1'/>
+  <colspec colname='c2'/>
+  <thead>
+    <row>
+      <entry>Event Category</entry>
+      <entry>Event Type</entry>
+    </row>
+  </thead>
+  <tbody>
+    <row>
+      <entry>Device key</entry>
+      <entry><function>DeviceKeyPress</function></entry>
+    </row>
+    <row>
+      <entry></entry>
+      <entry><function>DeviceKeyRelease</function></entry>
+    </row>
+    <row>
+      <entry>Device motion</entry>
+      <entry><function>DeviceButtonPress</function></entry>
+    </row>
+    <row>
+      <entry></entry>
+      <entry><function>DeviceButtonRelease</function></entry>
+    </row>
+    <row>
+      <entry></entry>
+      <entry><function>DeviceMotionNotify</function></entry>
+    </row>
+    <row>
+      <entry>Device input focus</entry>
+      <entry><function>DeviceFocusIn</function></entry>
+    </row>
+    <row>
+      <entry></entry>
+      <entry><function>DeviceFocusOut</function></entry>
+    </row>
+    <row>
+      <entry>Device state notification</entry>
+      <entry><function>DeviceStateNotify</function></entry>
+    </row>
+    <row>
+      <entry>Device proximity</entry>
+      <entry><function>ProximityIn</function></entry>
+    </row>
+    <row>
+      <entry></entry>
+      <entry><function>ProximityOut</function></entry>
+    </row>
+    <row>
+      <entry>Device mapping</entry>
+      <entry><function>DeviceMappingNotify</function></entry>
+    </row>
+    <row>
+      <entry>Device change</entry>
+      <entry><function>ChangeDeviceNotify</function></entry>
+    </row>
+  </tbody>
+  </tgroup>
+</informaltable>
+
+</sect3>
+<sect3 id="Event_Classes">
+<title>Event Classes</title>
+<!-- .XS -->
+<!-- (SN Event Classes -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Event classes are integer numbers that are used in the same way as the
+core event masks.  They are used by a client program to indicate to the
+server which events that client program wishes to receive.
+</para>
+<para>
+<!-- .LP -->
+The core input event masks are constants and are defined in the header file
+<function>&lt; X11/X.h &gt;.</function>
+Extension event classes are not constants.  Instead, they are dynamically
+allocated by the extension's request to the X server
+when the extension is initialized.  Because of this, extension event
+classes must be obtained by the client from the server.
+</para>
+<para>
+<!-- .LP -->
+The event class for an extension event and device is obtained from
+information returned by the 
+<function>XOpenDevice</function>
+function. 
+This class can then be used in an
+<function>XSelectExtensionEvent</function>
+request to ask that events of that type from that device be sent to
+the client program.
+</para>
+<para>
+<!-- .LP -->
+For
+<function>DeviceButtonPress</function>
+events, the client may specify whether
+or not an implicit passive grab should be done when the button is
+pressed.  If the client wants to guarantee that it will receive a
+<function>DeviceButtonRelease</function>
+event for each
+<function>DeviceButtonPress</function>
+event it receives, it should specify the
+<function>DeviceButtonPressGrab</function>
+class in addition to the
+<function>DeviceButtonPress</function>
+class.
+This restricts the client in that only one client at a time
+may request
+<function>DeviceButtonPress</function>
+events from the same device and
+window if any client specifies this class.
+</para>
+<para>
+<!-- .LP -->
+If any client has specified the
+<function>DeviceButtonPressGrab</function>
+class, any requests by any other client that specify the same device
+and window and specify either
+<function>DeviceButtonPress</function>
+or
+<function>DeviceButtonPressGrab</function>
+will cause an
+<function>Access</function>
+error to be generated.
+</para>
+<para>
+<!-- .LP -->
+If only the
+<function>DeviceButtonPress</function>
+class is specified, no implicit passive grab will be done when a button
+is pressed on the device.
+Multiple clients may use this class to specify the same device and
+window combination.
+</para>
+<para>
+<!-- .LP -->
+The client may also select
+<function>DeviceMotion</function>
+events only when a button is down.
+It does this by specifying the event classes 
+<function>DeviceButton1Motion</function>
+through
+<function>DeviceButton5Motion .  </function>
+An input device will support only
+as many button motion classes as it has buttons.
+</para>
+</sect3>
+<sect3 id="Event_Structures">
+<title>Event Structures</title>
+<!-- .XS -->
+<!-- (SN Event Structures -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Each extension event type has a corresponding structure declared in
+<function>&lt; X11/extensions/XInput.h &gt;.</function>
+All event structures have the following common members:
+<variablelist>
+  <varlistentry>
+    <term>
+      type
+    </term>
+    <listitem>
+      <para>
+Set to the event type number that uniquely identifies it.  For example,
+when the X server reports a
+<function>DeviceKeyPress</function>
+event to a client application, it sends an
+<function>XDeviceKeyPressEvent</function>
+structure.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      serial
+    </term>
+    <listitem>
+      <para>
+Set from the serial number reported in the protocol but expanded from the
+16-bit least significant bits to a full 32-bit value.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      send_event
+    </term>
+    <listitem>
+      <para>
+Set to 
+<function>True</function>
+if the event came from an
+<function>XSendEvent</function>
+request.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      display
+    </term>
+    <listitem>
+      <para>
+Set to a pointer to a structure that defines the display 
+on which the event was read.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+Extension event structures report the current position of the X pointer.
+In addition, if the device reports motion data and is reporting absolute data,
+the current value of any valuators the device contains is also reported.
+</para>
+<sect4 id="Device_Key_Events">
+<title>Device Key Events</title>
+<!-- .XS -->
+<!-- (SN Device Key Events -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Key events from extension devices contain all the information that is
+contained in a key event from the X keyboard.  In addition, they contain
+a device ID and report the current value of any valuators on the device,
+if that device is reporting absolute data.
+If data for more than six valuators is being reported, more than one
+key event will be sent.
+The axes_count member contains the number of axes that are being
+reported.  The server sends as many of these events as are
+needed to report the device data.  Each event contains the total number
+of axes reported in the axes_count member and the first axis reported
+in the current event in the first_axis member.
+If the device supports input class
+<function>Valuators , </function>
+but is not reporting absolute mode data,
+the axes_count member  contains zero (0).
+</para>
+<para>
+<!-- .LP -->
+The location reported in 
+the x, y and x_root, y_root members is the location of the core X pointer.
+</para>
+<para>
+<!-- .LP -->
+The
+<function>XDeviceKeyEvent</function>
+structure is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i 3i -->
+<!-- .ta .5i 3i -->
+typedef struct {
+     int type;                      /* of event */
+     unsigned long serial;          /* # of last request processed */
+     Bool send_event;               /* true if from SendEvent request */
+     Display *display;              /* Display the event was read from */
+     Window window;                 /* "event" window reported relative to */
+     XID deviceid;
+     Window root;                   /* root window event occurred on */
+     Window subwindow;              /* child window */
+     Time time;                     /* milliseconds */
+     int x, y;                      /* x, y coordinates in event window */
+     int x_root;                    /* coordinates relative to root */
+     int y_root;                    /* coordinates relative to root */
+     unsigned int state;            /* key or button mask */
+     unsigned int keycode;          /* detail */
+     Bool same_screen;              /* same screen flag */
+     unsigned int device_state;     /* device key or button mask */
+     unsigned char axes_count;
+     unsigned char first_axis;
+     int axis_data[6];
+} XDeviceKeyEvent;
+
+typedef XDeviceKeyEvent XDeviceKeyPressedEvent;
+typedef XDeviceKeyEvent XDeviceKeyReleasedEvent;
+</literallayout>
+<!-- .eM -->
+</para>
+</sect4>
+<sect4 id="Device_Button_Events">
+<title>Device Button Events</title>
+<!-- .XS -->
+<!-- (SN Device Button Events -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Button events from extension devices contain all the information that is
+contained in a button event from the X pointer.  In addition, they contain
+a device ID and report the current value of any valuators on the device
+if that device is reporting absolute data.
+If data for more than six valuators is being reported, more than one
+button event may be sent.
+The axes_count member contains the number of axes that are being
+reported.  The server sends as many of these events as are
+needed to report the device data.  Each event contains the total number
+of axes reported in the axes_count member and the first axis reported
+in the current event in the first_axis member.
+If the device supports input class
+<function>Valuators , </function>
+but is not reporting absolute mode data,
+the axes_count member contains zero (0).
+</para>
+<para>
+<!-- .LP -->
+The location reported in 
+the x, y and x_root, y_root members is the location of the core X pointer.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i 3i -->
+<!-- .ta .5i 3i -->
+typedef struct {
+     int type;                      /* of event */
+     unsigned long serial;          /* # of last request processed by server */
+     Bool send_event;               /* true if from a SendEvent request */
+     Display *display;              /* Display the event was read from */
+     Window window;                 /* "event" window reported relative to */
+     XID deviceid;
+     Window root;                   /* root window that the event occurred on */
+     Window subwindow;              /* child window */
+     Time time;                     /* milliseconds */
+     int x, y;                      /* x, y coordinates in event window */
+     int x_root;                    /* coordinates relative to root */
+     int y_root;                    /* coordinates relative to root */
+     unsigned int state;            /* key or button mask */
+     unsigned int button;           /* detail */
+     Bool same_screen;              /* same screen flag */
+     unsigned int device_state;     /* device key or button mask */
+     unsigned char axes_count;
+     unsigned char first_axis;
+     int axis_data[6];
+} XDeviceButtonEvent;
+
+typedef XDeviceButtonEvent XDeviceButtonPressedEvent;
+typedef XDeviceButtonEvent XDeviceButtonReleasedEvent;
+</literallayout>
+<!-- .eM -->
+</para>
+</sect4>
+<sect4 id="Device_Motion_Events">
+<title>Device Motion Events</title>
+<!-- .XS -->
+<!-- (SN Device Motion Events -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Motion events from extension devices contain all the information that is
+contained in a motion event from the X pointer.  In addition, they contain
+a device ID and report the current value of any valuators on the device.
+</para>
+<para>
+<!-- .LP -->
+The location reported in 
+the x, y and x_root, y_root members is the location of the core X pointer, 
+and so is 2-dimensional.
+</para>
+<para>
+<!-- .LP -->
+Extension motion devices may report motion data for a variable number of 
+axes.  
+The axes_count member contains the number of axes that are being
+reported.  The server sends as many of these events as are
+needed to report the device data.  Each event contains the total number
+of axes reported in the axes_count member and the first axis reported
+in the current event in the first_axis member.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i 3i -->
+<!-- .ta .5i 3i -->
+typedef struct {
+     int type;                          /* of event */
+     unsigned long serial;              /* # of last request processed by server */
+     Bool send_event;                   /* true if from a SendEvent request */
+     Display *display;                  /* Display the event was read from */
+     Window window;                     /* "event" window reported relative to */
+     XID deviceid;
+     Window root;                       /* root window that the event occurred on */
+     Window subwindow;                  /* child window */
+     Time time;                         /* milliseconds */
+     int x, y;                          /* x, y coordinates in event window */
+     int x_root;                        /* coordinates relative to root */
+     int y_root;                        /* coordinates relative to root */
+     unsigned int state;                /* key or button mask */
+     char is_hint;                      /* detail */
+     Bool same_screen;                  /* same screen flag */
+     unsigned int device_state;         /* device key or button mask */
+     unsigned char axes_count;
+     unsigned char first_axis;
+     int axis_data[6];
+} XDeviceMotionEvent;
+</literallayout>
+<!-- .eM -->
+</para>
+</sect4>
+<sect4 id="Device_Focus_Events">
+<title>Device Focus Events</title>
+<!-- .XS -->
+<!-- (SN Device Focus Events -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+These events are equivalent to the core focus events.
+They contain the same information, with the addition
+of a device ID to identify which device has had a focus change,
+and a timestamp.
+</para>
+<para>
+<!-- .LP -->
+<function>DeviceFocusIn</function>
+and
+<function>DeviceFocusOut</function>
+events are generated for
+focus changes of extension devices in the same manner as core focus
+events are generated.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i 2.5i -->
+<!-- .ta .5i 2.5i -->
+typedef struct {
+     int type;                      /* of event */
+     unsigned long serial;          /* # of last request processed by server */
+     Bool send_event;               /* true if this came from a SendEvent request */
+     Display *display;              /* Display the event was read from */
+     Window window;                 /* "event" window it is reported relative to */
+     XID deviceid;
+     int mode;                      /* NotifyNormal, NotifyGrab, NotifyUngrab */
+     int detail;
+                                    /*
+                                     * NotifyAncestor, NotifyVirtual, NotifyInferior, 
+                                     * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
+                                     * NotifyPointerRoot, NotifyDetailNone 
+                                     */
+     Time time;
+} XDeviceFocusChangeEvent;
+
+typedef XDeviceFocusChangeEvent XDeviceFocusInEvent;
+typedef XDeviceFocusChangeEvent XDeviceFocusOutEvent;
+</literallayout>
+<!-- .eM -->
+</para>
+</sect4>
+<sect4 id="Device_StateNotify_Event">
+<title>Device StateNotify Event</title>
+<!-- .XS -->
+<!-- (SN Device StateNotify Event -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+This event is analogous to the core keymap event but
+reports the current state of the device for each
+input class that it supports.
+It is generated after every
+<function>DeviceFocusIn</function>
+event and
+<function>EnterNotify</function>
+event and is delivered to clients who have selected
+<function>XDeviceStateNotify</function>
+events.
+</para>
+<para>
+<!-- .LP -->
+If the device supports input class
+<function>Valuators ,</function>
+the mode member in the
+<function>XValuatorStatus</function>
+structure is a bitmask that reports the device mode,
+proximity state, and other state information.
+The following bits are currently defined:
+<literallayout class="monospaced">
+<!-- .TA .5i 1.5i -->
+<!-- .ta .5i 1.5i -->
+     0x01     Relative = 0, Absolute = 1
+     0x02     InProximity = 0, OutOfProximity = 1
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+If the device supports more valuators than can be reported in a single
+<function>XEvent ,</function>
+multiple
+<function>XDeviceStateNotify</function>
+events will be generated.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i 3i -->
+<!-- .ta .5i 3i -->
+typedef struct {
+     unsigned char class;
+     unsigned char length;
+} XInputClass;
+
+typedef struct {
+     int type;
+     unsigned long serial;     /* # of last request processed by server */
+     Bool send_event;          /* true if this came from a SendEvent request */
+     Display *display;         /* Display the event was read from */
+     Window window;
+     XID deviceid;
+     Time time;
+     int num_classes;
+     char data[64];
+} XDeviceStateNotifyEvent;     
+
+typedef struct {
+     unsigned char class;
+     unsigned char length;
+     unsigned char num_valuators;
+     unsigned char mode;
+     int valuators[6];
+} XValuatorStatus;
+
+typedef struct {
+     unsigned char class;
+     unsigned char length;
+     short num_keys;
+     char keys[32];
+} XKeyStatus;
+
+typedef struct {
+     unsigned char class;
+     unsigned char length;
+     short num_buttons;
+     char buttons[32];
+} XButtonStatus;
+</literallayout>
+<!-- .eM -->
+</para>
+</sect4>
+<sect4 id="Device_Mapping_Event">
+<title>Device Mapping Event</title>
+<!-- .XS -->
+<!-- (SN Device Mapping Event -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+This event is equivalent to the core
+<function>MappingNotify</function>
+event.
+It notifies client programs when the mapping of keys,
+modifiers, or buttons on an extension device has changed.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i 3i -->
+<!-- .ta .5i 3i -->
+typedef struct {
+     int type;
+     unsigned long serial;     
+     Bool send_event;
+     Display *display;
+     Window window;
+     XID deviceid;
+     Time time;
+     int request;
+     int first_keycode;
+     int count;
+} XDeviceMappingEvent;
+</literallayout>
+<!-- .eM -->
+</para>
+</sect4>
+<sect4 id="ChangeDeviceNotify_Event">
+<title>ChangeDeviceNotify Event</title>
+<!-- .XS -->
+<!-- (SN ChangeDeviceNotify Event -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+This event has no equivalent in the core protocol.  It notifies client
+programs when one of the core devices has been changed.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i 3i -->
+<!-- .ta .5i 3i -->
+typedef struct {
+     int type;
+     unsigned long serial;
+     Bool send_event;
+     Display *display;
+     Window window;
+     XID deviceid;
+     Time time;
+     int request;
+} XChangeDeviceNotifyEvent;
+</literallayout>
+<!-- .eM -->
+</para>
+</sect4>
+<sect4 id="Proximity_Events">
+<title>Proximity Events</title>
+<!-- .XS -->
+<!-- (SN Proximity Events -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+These events have no equivalent in the core protocol.  Some input
+devices such as graphics tablets or touchscreens may send these
+events to indicate that a stylus has moved into or out of contact
+with a positional sensing surface.
+</para>
+<para>
+<!-- .LP -->
+The event contains the current value of any valuators on the device
+if that device is reporting absolute data.
+If data for more than six valuators is being reported, more than one
+proximity event may be sent.
+The axes_count member contains the number of axes that are being
+reported.  The server sends as many of these events as are
+needed to report the device data.  Each event contains the total number
+of axes reported in the axes_count member and the first axis reported
+in the current event in the first_axis member.
+If the device supports input class
+<function>Valuators , </function>
+but is not reporting absolute mode data,
+the axes_count member contains zero (0).
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i 3i -->
+<!-- .ta .5i 3i -->
+typedef struct {
+     int type;                 /* ProximityIn or ProximityOut */        
+     unsigned long serial;     /* # of last request processed by server */
+     Bool send_event;          /* true if this came from a SendEvent request */
+     Display *display;         /* Display the event was read from */
+     Window window;      
+     XID deviceid;
+     Window root;            
+     Window subwindow;      
+     Time time;            
+     int x, y;            
+     int x_root, y_root;  
+     unsigned int state;           
+     Bool same_screen;     
+     unsigned int device_state;   /* device key or button mask */
+     unsigned char axes_count;
+     unsigned char first_axis;
+     int axis_data[6];
+} XProximityNotifyEvent;
+
+typedef XProximityNotifyEvent XProximityInEvent;
+typedef XProximityNotifyEvent XProximityOutEvent;
+</literallayout>
+<!-- .eM -->
+</para>
+</sect4>
+</sect3>
+</sect2>
+<sect2 id="Event_Handling_Functions">
+<title>Event Handling Functions</title>
+<!-- .XS -->
+<!-- (SN Event Handling Functions -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+This section discusses the X Input Extension
+event handling functions that allow you to:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+Determine the extension version
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+List the available devices
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Enable and disable extension devices
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Change the mode of a device
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Initialize valuators on an input device
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Get input device controls
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Change input device controls
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Select extension device events
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Determine selected device events
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Control event propogation
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Send an event
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Get motion history
+    </para>
+  </listitem>
+</itemizedlist>
+<sect3 id="Determining_the_Extension_Version">
+<title>Determining the Extension Version</title>
+<!-- .XS -->
+<!-- (SN Determining the Extension Version -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XExtensionVersion * <function> XGetExtensionVersion</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>char<parameter> *name</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>name</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the name of the desired extension.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XGetExtensionVersion</function>
+allows a client to determine whether a server supports
+the desired version of the input extension.
+</para>
+<para>
+<!-- .LP -->
+The 
+<function>XExtensionVersion</function>
+structure returns information about the version of the extension
+supported by the server and is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     Bool present;   
+     short major_version;
+     short minor_version;
+} XExtensionVersion;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The major and minor versions can be compared with constants defined in
+the header file 
+<function>&lt; X11/extensions/XI.h &gt;.</function>
+Each version is a superset of the previous versions.
+</para>
+<para>
+<!-- .LP -->
+You should use 
+<function>XFree</function>
+to free the data returned by this function.
+</para>
+</sect3>
+<sect3 id="Listing_Available_Devices">
+<title>Listing Available Devices</title>
+<!-- .XS -->
+<!-- (SN Listing Available Devices -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+A client program that wishes to access a specific device
+must first determine whether that device is connected to the X server.  This
+is done through the
+<function>XListInputDevices</function>
+function, which will return a list of all devices that can be opened
+by the X server.  The client program can use one
+of the names defined in the
+<function>&lt; X11/extensions/XI.h &gt;</function>
+header file in an
+<function>XInternAtom </function>
+request to determine the device type of the desired device.  This type 
+can then be compared with the device types returned by the 
+<function>XListInputDevices</function>
+request.
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XDeviceInfo * <function> XListInputDevices</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>int<parameter> *ndevices</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>ndevices</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the address of a variable into which the server
+can return the number of input devices available to the X server.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XListInputDevices</function>
+allows a client to determine which devices 
+are available for X input and information about those devices.
+An array of
+<function>XDeviceInfo</function>
+structures is returned, with one element in the array for each device.
+The number of devices is returned in the ndevices argument.
+</para>
+<para>
+<!-- .LP -->
+The X pointer device and X keyboard device are reported, as well as
+all available extension input devices.  The use member of the 
+<function>XDeviceInfo</function>
+structure specifies the current use of the device.
+If the value of this member is 
+<function>IsXPointer ,</function>
+the device is the X pointer device.  If the value is
+<function>IsXKeyboard ,</function>
+the device is the X keyboard device.  If the value is
+<function>IsXExtensionDevice ,</function>
+the device is available for use as an extension input device.
+</para>
+<para>
+<!-- .LP -->
+Each
+<function>XDeviceInfo</function>
+entry contains a pointer to a list of structures 
+that describe the characteristics of each class
+of input supported by that device.  The num_classes member
+contains the number of entries in that list.
+</para>
+<para>
+<!-- .LP -->
+If the device supports input class
+<function>Valuators ,</function>
+one of the structures pointed to by the
+<function>XDeviceInfo</function>
+structure will be an
+<function>XValuatorInfo</function>
+structure.  The axes member of that structure
+contains the address of an array of
+<function>XAxisInfo</function>
+structures.
+There is one element in this array for each axis of motion
+reported by the device.  The number of elements in this 
+array is contained in the num_axes element of the 
+<function>XValuatorInfo</function>
+structure.
+The size of the motion buffer for the device is
+reported in the motion_buffer member of the
+<function>XValuatorInfo</function>
+structure.
+</para>
+<para>
+<!-- .LP -->
+The
+<function>XDeviceInfo</function>
+structure is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct _XDeviceInfo {
+     XID id;        
+     Atom type;
+     char *name;
+     int num_classes;
+     int use;
+     XAnyClassPtr inputclassinfo;
+} XDeviceInfo;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The structures pointed to by the
+<function>XDeviceInfo</function>
+structure are defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct _XKeyInfo {
+     XID class;
+     int length;
+     unsigned short min_keycode;
+     unsigned short max_keycode;
+     unsigned short num_keys;
+} XKeyInfo;
+
+typedef struct _XButtonInfo {
+     XID class;
+     int length;
+     short num_buttons;
+} XButtonInfo;
+
+typedef struct _XValuatorInfo {
+     XID class;
+     int length;
+     unsigned char num_axes;
+     unsigned char mode;
+     unsigned long motion_buffer;
+     XAxisInfoPtr axes;
+} XValuatorInfo;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XAxisInfo</function>
+structure pointed to by the
+<function>XValuatorInfo</function>
+structure is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct _XAxisInfo {
+     int resolution;
+     int min_value;
+     int max_value;
+} XAxisInfo;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The following atom names are defined in the 
+<function>&lt; X11/extensions/XI.h &gt;</function>
+header file.
+<literallayout class="monospaced">
+<!-- .TA 2i -->
+<!-- .ta 2i -->
+MOUSE     QUADRATURE
+TABLET     SPACEBALL
+KEYBOARD     DATAGLOVE
+TOUCHSCREEN     EYETRACKER
+TOUCHPAD     CURSORKEYS
+BUTTONBOX     FOOTMOUSE
+BARCODE     ID_MODULE
+KNOB_BOX     ONE_KNOB
+TRACKBALL     NINE_KNOB\s+1
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+These names can be used in an
+<function>XInternAtom</function>
+request to return an atom that can be used for comparison
+with the type member of the 
+<function>XDeviceInfo</function>
+structure.
+</para>
+<para>
+<!-- .LP -->
+<function>XListInputDevices</function>
+returns NULL if there are no input devices to list.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To free the data returned by 
+<function>XListInputDevices ,</function>
+use
+<function>XFreeDeviceList .</function>
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function> XFreeDeviceList</function></funcdef>
+  <paramdef>XDeviceInfo<parameter> *list</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>list</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the pointer to the
+<function>XDeviceInfo</function>
+array returned by a previous call to
+<function>XListInputDevices .</function>
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XFreeDeviceList</function>
+frees the list of input device information.
+</para>
+</sect3>
+<sect3 id="Enabling_and_Disabling_Extension_Devices">
+<title>Enabling and Disabling Extension Devices</title>
+<!-- .XS -->
+<!-- (SN Enabling and Disabling Extension Devices -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Each client program that wishes to access an extension device must request
+that the server open that device by calling the
+<function>XOpenDevice</function>
+function.
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XDevice * <function> XOpenDevice</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XID<parameter> device_id</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device_id</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the ID that uniquely identifies the device to be opened.
+This ID is obtained from the
+<function>XListInputDevices</function>
+request.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XOpenDevice</function>
+opens the device for the requesting client and, on success, returns an
+<function>XDevice</function>
+structure, which is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID device_id;
+     int num_classes;
+     XInputClassInfo *classes;
+} XDevice;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The
+<function>XDevice</function>
+structure contains a pointer to an array of
+<function>XInputClassInfo</function>
+structures.  Each element in that array
+contains information about events of a particular input class supported
+by the input device.
+</para>
+<para>
+<!-- .LP -->
+The
+<function>XInputClassInfo</function>
+structure is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     unsigned char input_class;
+     unsigned char event_type_base;
+} XInputClassInfo;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+A client program can determine the event
+type and event class for a given event by using macros defined by the 
+input extension.  The name of the macro corresponds to the desired event,
+and the macro is passed the structure that describes the device from which
+input is desired, for example:
+</para>
+<para>
+<!-- .LP -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+     DeviceKeyPress(XDevice *device, event_type, event_class)
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+The macro will fill in the values of the event class to be used in an
+<function>XSelectExtensionEvent</function>
+request to select the event and the event type to be used in comparing
+with the event types of events received via
+<function>XNextEvent .</function>
+</para>
+<para>
+<!-- .LP -->
+<function>XOpenDevice</function>
+can generate
+<function>BadDevice</function>
+errors.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+Before terminating, the client program should request that the server close
+the device by calling the
+<function>XCloseDevice</function>
+function.
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XCloseDevice</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the device to be closed.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XCloseDevice</function>
+closes the device for the requesting client and frees the associated
+<function>XDevice</function>
+structure.
+</para>
+<para>
+<!-- .LP -->
+A client may open the same extension device more than once.  Requests
+after the first successful one return an additional
+<function>XDevice</function>
+structure
+with the same information as the first, but otherwise have no effect.
+A single
+<function>XCloseDevice</function>
+request will terminate that client's access to the device.
+</para>
+<para>
+<!-- .LP -->
+Closing a device releases any active or passive grabs the requesting client
+has established.  If the device is frozen only by an active grab of the
+requesting client, any queued events are released.
+</para>
+<para>
+<!-- .LP -->
+If a client program terminates without closing a device, the server will
+automatically close that device on behalf of the client.  This does not
+affect any other clients that may be accessing that device.
+</para>
+<para>
+<!-- .LP -->
+<function>XCloseDevice</function>
+can generate
+<function>BadDevice</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Changing_the_Mode_of_a_Device">
+<title>Changing the Mode of a Device</title>
+<!-- .XS -->
+<!-- (SN Changing the Mode of a Device -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Some devices are capable of reporting either relative or absolute motion
+data. 
+To change the mode of a device from relative to absolute, use
+<function>XSetDeviceMode .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XSetDeviceMode</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>int<parameter> mode</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the device whose mode should be changed.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>mode</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the mode.  You can pass
+<function>Absolute</function>
+or
+<function>Relative .</function>
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XSetDeviceMode</function>
+allows a client to request the server to change the mode of a 
+device that is capable of reporting either absolute positional data or relative
+motion data.  If the device is invalid or if the client has not previously 
+requested that the server open the device via an
+<function>XOpenDevice</function>
+request, this request will fail with a
+<function>BadDevice</function>
+error.
+If the device does not support input class
+<function>Valuators</function>
+or if it is not capable of reporting the specified mode,
+the request will fail with a 
+<function>BadMatch</function>
+error.
+</para>
+<para>
+<!-- .LP -->
+This request will fail and return
+<function>DeviceBusy</function>
+if another client has already opened the device and requested a different mode.
+</para>
+<para>
+<!-- .LP -->
+<function>XSetDeviceMode</function>
+can generate
+<function>BadDevice ,</function>
+<function>BadMatch ,</function>
+<function>BadMode ,</function>
+and
+<function>DeviceBusy</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Initializing_Valuators_on_an_Input_Device">
+<title>Initializing Valuators on an Input Device</title>
+<!-- .XS -->
+<!-- (SN Initializing Valuators on an Input Device -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Some devices that report absolute positional data can be initialized to a 
+starting value.  Devices that are capable of reporting relative motion or
+absolute positional data may require that their valuators be initialized 
+to a starting value after the mode of the device is changed to
+<function>Absolute .</function>
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To initialize the valuators on such a device, use 
+<function>XSetDeviceValuators .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function> XSetDeviceValuators</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>int*valuators,first_valuator,<parameter> num_valuators</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the device whose valuators should be initialized.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>valuators</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the values to which each valuator should be set.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>first_valuator</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the first valuator to be set.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>num_valuators</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the number of valuators to be set.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XSetDeviceValuators</function>
+initializes the specified valuators on the specified extension
+input device.  Valuators are numbered beginning with zero.  Only the valuators
+in the range specified by first_valuator and num_valuators are set.  
+A
+<function>BadValue</function>
+error results if the number of valuators supported by the device 
+is less than the following expression:
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+     first_valuator + num_valuators
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+If the request succeeds,
+<function>Success</function>
+is returned.  If the specified device is grabbed by some other client,
+the request will fail and a status of
+<function>AlreadyGrabbed</function>
+will be returned.
+</para>
+<para>
+<!-- .LP -->
+<function>XSetDeviceValuators</function>
+can generate
+<function>BadDevice ,</function>
+<function>BadLength ,</function>
+<function>BadMatch ,</function>
+and 
+<function>BadValue</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Getting_Input_Device_Controls">
+<title>Getting Input Device Controls</title>
+<!-- .XS -->
+<!-- (SN Getting Input Device Controls -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Some input devices support various configuration controls
+that can be queried or changed by clients.  The set of supported
+controls will vary from one input device to another.  Requests
+to manipulate these controls will fail if either the target
+X server or the target input device does not support the 
+requested device control.
+</para>
+<para>
+<!-- .LP -->
+Each device control has a unique identifier.  Information
+passed with each device control varies in length and is mapped
+by data structures unique to that device control.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To query a device control, use
+<function>XGetDeviceControl .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XDeviceControl * <function> XGetDeviceControl</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>int<parameter> control</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the device whose configuration control status is to be returned.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>control</emphasis>
+    </term>
+    <listitem>
+      <para>
+Identifies the specific device control to be queried.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XGetDeviceControl</function>
+returns the current state of the specified device control.
+If the target X server does not support that device control, a
+<function>BadValue</function>
+error is returned.
+If the specified device does not support that device control, a
+<function>BadMatch</function>
+error
+is returned.
+</para>
+<para>
+<!-- .LP -->
+If the request is successful, a pointer to a generic 
+<function>XDeviceState</function>
+structure is returned.  The information returned varies according
+to the specified control and is mapped by a structure appropriate
+for that control.
+The first two members are common to all device controls
+and are defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID control;
+     int length;
+} XDeviceState;
+\fP
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The control may be compared to constants defined in the file
+<function>&lt; X11/extensions/XI.h &gt;.</function>
+Currently defined device controls include DEVICE_RESOLUTION.
+</para>
+<para>
+<!-- .LP -->
+The information returned for the DEVICE_RESOLUTION control is
+defined in the 
+<function>XDeviceResolutionState</function>
+structure, which is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID control;
+     int length;
+     int num_valuators;
+     int *resolutions;
+     int *min_resolutions;
+     int *max_resolutions;
+} XDeviceResolutionState;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+This device control returns a list of valuators and the range of 
+valid resolutions allowed for each.  Valuators are numbered 
+beginning with zero (0).  Resolutions for all valuators on the device are 
+returned.  For each valuator i on the device, resolutions[i] returns 
+the current setting of the resolution, min_resolutions[i] returns 
+the minimum valid setting, and max_resolutions[i] returns the 
+maximum valid setting.
+</para>
+<para>
+<!-- .LP -->
+When this control is specified,
+<function>XGetDeviceControl</function>
+fails with a
+<function>BadMatch</function>
+error if the specified device has no valuators.
+</para>
+<para>
+<!-- .LP -->
+<function>XGetDeviceControl</function>
+can generate
+<function>BadMatch</function>
+and
+<function>BadValue</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Changing_Input_Device_Controls">
+<title>Changing Input Device Controls</title>
+<!-- .XS -->
+<!-- (SN Changing Input Device Controls -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Some input devices support various configuration controls
+that can be changed by clients.  Typically, this would be
+done to initialize the device to a known state or configuration.
+The set of supported controls will vary from one input device 
+to another.  Requests to manipulate these controls will fail if 
+either the target X server or the target input device does not 
+support the requested device control.  Setting the device control 
+will also fail if the target input device is grabbed by another 
+client or is open by another client and has been set to a conflicting
+state.
+</para>
+<para>
+<!-- .LP -->
+Each device control has a unique identifier.  Information
+passed with each device control varies in length and is mapped
+by data structures unique to that device control.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To change a device control, use
+<function>XChangeDeviceControl .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function> XChangeDeviceControl</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>int<parameter> control</parameter></paramdef>
+  <paramdef>XDeviceControl<parameter> *value</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the device whose configuration control status is to be modified.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>control</emphasis>
+    </term>
+    <listitem>
+      <para>
+Identifies the specific device control to be changed.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>value</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a pointer to an
+<function>XDeviceControl</function>
+structure that describes which control is to be changed
+and how it is to be changed.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XChangeDeviceControl</function>
+changes the current state of the specified device control.
+If the target X server does not support that device control, a
+<function>BadValue</function>
+error is returned.
+If the specified device does not support that device control, a
+<function>BadMatch</function>
+error is returned.
+If another client has the target device grabbed, a status of
+<function>AlreadyGrabbed</function>
+is returned.
+If another client has the device open and has set it to a 
+conflicting state, a status of
+<function>DeviceBusy</function>
+is returned.
+If the request fails for any reason, the device control will not
+be changed.
+</para>
+<para>
+<!-- .LP -->
+If the request is successful, the device control will be changed
+and a status of
+<function>Success</function>
+is returned.
+The information passed varies according to the specified control
+and is mapped by a structure appropriate for that control.
+The first two members are common to all device controls:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID control;
+     int length;
+} XDeviceControl;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The control may be set using constants defined in the 
+<function>&lt; X11/extensions/XI.h &gt;</function>
+header file.
+Currently defined device controls include DEVICE_RESOLUTION.
+</para>
+<para>
+<!-- .LP -->
+The information that can be changed by the DEVICE_RESOLUTION 
+control is defined in the 
+<function>XDeviceResolutionControl</function>
+structure, which is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     XID control;
+     int length;
+     int first_valuator;
+     int num_valuators;
+     int *resolutions;
+} XDeviceResolutionControl;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+This device control changes the resolution of the specified 
+valuators on the specified extension input device.  Valuators 
+are numbered beginning with zero.  Only the valuators in the range 
+specified by first_valuator and num_valuators are set.  A value 
+of -1 in the resolutions list indicates that the resolution for 
+this valuator is not to be changed.  The num_valuators member
+specifies the number of valuators in the resolutions list.
+</para>
+<para>
+<!-- .LP -->
+When this control is specified,
+<function>XChangeDeviceControl</function>
+fails with a
+<function>BadMatch</function>
+error if the specified device has no valuators.
+If a resolution is specified that is not within the range of valid values 
+(as returned by
+<function>XGetDeviceControl ),</function>
+<function>XChangeDeviceControl</function>
+fails with a
+<function>BadValue</function>
+error.
+A
+<function>BadValue</function>
+error results if the number of valuators supported by the device 
+is less than the following expression:
+</para>
+<para>
+<!-- .LP    -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+     first_valuator + num_valuators, 
+</literallayout>
+</para>
+<para>
+<!-- .LP   -->
+<function>XChangeDeviceControl</function>
+can generate
+<function>BadMatch</function>
+and
+<function>BadValue</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Selecting_Extension_Device_Events">
+<title>Selecting Extension Device Events</title>
+<!-- .XS -->
+<!-- (SN Selecting Extension Device Events -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To select device input events, use
+<function>XSelectExtensionEvent .</function>
+The parameters passed are a pointer to 
+a list of classes that define the desired event types and devices, a count
+of the number of elements in the list, and the ID of the window from which 
+events are desired.
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XSelectExtensionEvent</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>Window<parameter> window</parameter></paramdef>
+  <paramdef>XEventClass<parameter> *event_list</parameter></paramdef>
+  <paramdef>int<parameter> event_count</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>window</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the ID of the window from which the client wishes to receive events.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>event_list</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a pointer to an array of event classes
+that specify which events are desired.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>event_count</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the number of elements in the event_list.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XSelectExtensionEvent</function>
+requests the server to send events that match the events and
+devices described by the event list and that come from the requested 
+window.  
+The elements of the
+<function>XEventClass</function>
+array are the event_class values
+obtained by invoking a macro with the pointer to an
+<function>XDevice</function>
+structure returned by the
+<function>XOpenDevice</function>
+request.
+For example, the
+<function>DeviceKeyPress</function>
+macro would return the
+<function>XEventClass</function>
+for
+<function>DeviceKeyPress</function>
+events from the specified device if it were invoked in the following form:
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+     DeviceKeyPress (XDevice *device, event_type, event_class)
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+Macros are defined for the following event classes: 
+<literallayout class="monospaced">
+<function>DeviceKeyPress</function>
+<function>DeviceKeyRelease</function>
+<function>DeviceButtonPress</function>
+<function>DeviceButtonRelease</function>
+<function>DeviceMotionNotify</function>
+<function>DeviceFocusIn</function>
+<function>DeviceFocusOut</function>
+<function>ProximityIn</function>
+<function>ProximityOut</function>
+<function>DeviceStateNotify</function>
+<function>DeviceMappingNotify</function>
+<function>ChangeDeviceNotify</function>
+<function>DevicePointerMotionHint</function>
+<function>DeviceButton1Motion </function>
+<function>DeviceButton2Motion</function>
+<function>DeviceButton3Motion, </function>
+<function>DeviceButton4Motion</function>
+<function>DeviceButton5Motion</function>
+<function>DeviceButtonMotion,</function>
+<function>DeviceOwnerGrabButton</function>
+<function>DeviceButtonPressGrab</function>
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+To get the next available event from within a client program, use the core
+<function>XNextEvent</function>
+function.  This returns the next event whether it
+came from a core device or an extension device.
+</para>
+<para>
+<!-- .LP -->
+Succeeding
+<function>XSelectExtensionEvent</function>
+requests using event classes
+for the same device as was specified on a previous request will replace
+the previous set of selected events from that device with the new set.
+</para>
+<para>
+<!-- .LP -->
+<function>XSelectExtensionEvent</function>
+can generate
+<function>BadAccess , </function>
+<function>BadClass ,</function>
+<function>BadLength ,</function>
+and
+<function>BadWindow</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Determining_Selected_Device_Events">
+<title>Determining Selected Device Events</title>
+<!-- .XS -->
+<!-- (SN Determining Selected Device Events -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To determine which extension events are currently selected from a given
+window, use
+<function>XGetSelectedExtensionEvents .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XGetSelectedExtensionEvents</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>Window<parameter> window</parameter></paramdef>
+  <paramdef>int<parameter> *this_client_count</parameter></paramdef>
+  <paramdef>XEventClass<parameter> **this_client</parameter></paramdef>
+  <paramdef>int<parameter> *all_clients_count</parameter></paramdef>
+  <paramdef>XEventClass<parameter> **all_clients</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>window</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the ID of the window from which the client wishes to receive events.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>this_client_count</emphasis>
+    </term>
+    <listitem>
+      <para>
+Returns the number of elements in the this_client list.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>this_client</emphasis>
+    </term>
+    <listitem>
+      <para>
+Returns a list of
+<function>XEventClasses</function>
+that specify which events are
+selected by this client.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>all_clients_count</emphasis>
+    </term>
+    <listitem>
+      <para>
+Returns the number of elements in the all_clients list.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>all_clients</emphasis>
+    </term>
+    <listitem>
+      <para>
+Returns a list of
+<function>XEventClasses</function>
+that specify which events are
+selected by all clients.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XGetSelectedExtensionEvents</function>
+returns pointers to two event class arrays.  
+One lists the extension events selected by this client from
+the specified window.  The other lists the extension events selected by
+all clients from the specified window.  This information is analogous
+to that returned in your_event_mask and all_event_masks of the
+<function>XWindowAttributes</function>
+structure when an 
+<function>XGetWindowAttributes</function>
+request is made.
+To free the two arrays returned by this function, use
+<function>XFree .</function>
+</para>
+<para>
+<!-- .LP -->
+<function>XGetSelectedExtensionEvents</function>
+can generate
+<function>BadWindow</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Controlling_Event_Propagation">
+<title>Controlling Event Propagation</title>
+<!-- .XS -->
+<!-- (SN Controlling Event Propagation -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+Extension events propagate up the window hierarchy in the same manner
+as core events.  If a window is not interested in an extension event, 
+it usually propagates to the closest ancestor that is interested,
+unless the dont_propagate list prohibits it.
+Grabs of extension devices may alter the set of windows that receive a 
+particular extension event.
+</para>
+<para>
+<!-- .LP -->
+Client programs may control event propagation through the use
+of the following two functions:
+<function>XChangeDeviceDontPropagateList</function>
+and
+<function>XGetDeviceDontPropagateList .  </function>
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XChangeDeviceDontPropagateList</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>Window<parameter> window</parameter></paramdef>
+  <paramdef>int<parameter> event_count</parameter></paramdef>
+  <paramdef>XEventClass<parameter> *events</parameter></paramdef>
+  <paramdef>int<parameter> mode</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>window</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired window.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>event_count</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the number of elements in the events list.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>events</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a pointer to the list of XEventClasses.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>mode</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the mode.  You can pass
+<function>AddToList</function>
+or
+<function>DeleteFromList .</function>
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XChangeDeviceDontPropagateList</function>
+adds an event to or deletes an event from the do_not_propagate list 
+of extension events for the specified window.
+There is one list per window, and the list remains for the life of the window.
+The list is not altered if a client that changed the list terminates.
+</para>
+<para>
+<!-- .LP -->
+Suppression of event propagation is not allowed for all events.  If a
+specified
+<function>XEventClass</function>
+is invalid because suppression of that event is not allowed, a
+<function>BadClass</function>
+error results.
+</para>
+<para>
+<!-- .LP -->
+<function>XChangeDeviceDontPropagateList</function>
+can generate
+<function>BadClass ,</function>
+<function>BadMode ,</function>
+and
+<function>BadWindow</function>
+errors.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XEventClass * <function> XGetDeviceDontPropagateList</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>Window<parameter> window</parameter></paramdef>
+  <paramdef>int<parameter> *event_count</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>window</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired window.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>event_count</emphasis>
+    </term>
+    <listitem>
+      <para>
+Returns the number of elements in the array returned by this function.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XGetDeviceDontPropagateList</function>
+allows a client to determine the do_not_propagate list of extension events
+for the specified window.
+It returns an array of
+<function>XEventClass ,</function>
+each
+<function>XEventClass</function>
+representing a device/event type pair.
+To free the data returned by this function, use
+<function>XFree .</function>
+</para>
+<para>
+<!-- .LP -->
+<function>XGetDeviceDontPropagateList</function>
+can generate
+<function>BadWindow</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Sending_an_Event">
+<title>Sending an Event</title>
+<!-- .XS -->
+<!-- (SN Sending an Event -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+To send an extension event to another client, use
+<function>XSendExtensionEvent .</function>
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>int <function> XSendExtensionEvent</function></funcdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>Window<parameter> window</parameter></paramdef>
+  <paramdef>Bool<parameter> propagate</parameter></paramdef>
+  <paramdef>int<parameter> event_count</parameter></paramdef>
+  <paramdef>XEventClass<parameter> *event_list</parameter></paramdef>
+  <paramdef>XEvent<parameter> *event</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the device whose ID is recorded in the event.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>window</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the destination window ID.  You can pass a window ID,
+<function>PointerWindow</function>
+or
+<function>InputFocus .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>propagate</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a boolean value that is either
+<function>True</function>
+or 
+<function>False .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>event_count</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the number of elements in the event_list array.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>event_list</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a pointer to an array of
+<function>XEventClass .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>event</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies a pointer to the event that is to be sent.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XSendExtensionEvent</function>
+identifies the destination window, determines which clients should receive
+the specified event, and ignores any active grabs.
+It requires a list of
+<function>XEventClass</function>
+to be specified.
+These are obtained by opening an input device with the
+<function>XOpenDevice</function>
+request.
+</para>
+<para>
+<!-- .LP -->
+<function>XSendExtensionEvent</function>
+uses the window argument to identify the destination window as follows:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+If you pass
+<function>PointerWindow ,</function>
+the destination window is the window that contains the pointer.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If you pass
+<function>InputFocus</function>
+and if the focus window contains the pointer,
+the destination window is the window that contains the pointer.
+If the focus window does not contain the pointer,
+the destination window is the focus window.
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+To determine which clients should receive the specified events, 
+<function>XSendExtensionEvent</function>
+uses the propagate argument as follows:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+If propagate is
+<function>False ,</function>
+the event is sent to every client selecting
+from the destination window
+any of the events specified in the event_list array.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If propagate is
+<function>True </function>
+and no clients have selected from the destination window
+any of the events specified in the event_list array, the destination is 
+replaced with the closest ancestor of destination for which some client
+has selected one of the specified events and for which no intervening
+window has that event in its do_not_propagate mask.
+If no such window exists,
+or if the window is an ancestor of the focus window, and 
+<function>InputFocus</function>
+was originally specified as the destination,
+the event is not sent to any clients.  Otherwise, the event is reported to every
+client selecting on the final destination any of the events specified
+in event_list.
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+<!-- .LP -->
+The event in the
+<function>XEvent</function>
+structure must be one of the events defined
+by the input extension, so that the X server can correctly byte swap the
+contents as necessary.  The contents of the event are otherwise unaltered
+and unchecked by the X server except to force send_event to
+<function>True</function>
+in the forwarded event and to set the sequence number in the event correctly.
+</para>
+<para>
+<!-- .LP -->
+<function>XSendExtensionEvent</function>
+returns zero if the conversion-to-wire protocol failed;
+otherwise, it returns nonzero.
+</para>
+<para>
+<!-- .LP -->
+<function>XSendExtensionEvent</function>
+can generate
+<function>BadClass ,</function>
+<function>BadDevice ,</function>
+<function>BadValue ,</function>
+and
+<function>BadWindow</function>
+errors.
+</para>
+</sect3>
+<sect3 id="Getting_Motion_History">
+<title>Getting Motion History</title>
+<!-- .XS -->
+<!-- (SN Getting Motion History -->
+<!-- .XE -->
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XDeviceTimeCoord * <function> XGetDeviceMotionEvents</function></funcdef>
+  <paramdef><parameter> axis_count_return)</parameter></paramdef>
+  <paramdef>Display<parameter> *display</parameter></paramdef>
+  <paramdef>XDevice<parameter> *device</parameter></paramdef>
+  <paramdef>Timestart,<parameter> stop</parameter></paramdef>
+  <paramdef>int<parameter> *nevents_return</parameter></paramdef>
+  <paramdef>int<parameter> *mode_return</parameter></paramdef>
+  <paramdef>int<parameter> *axis_count_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>display</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the connection to the X server.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>device</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the desired device.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>start</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the start time.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>stop</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the stop time.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>nevents_return</emphasis>
+    </term>
+    <listitem>
+      <para>
+Returns the number of positions in the motion buffer returned
+for this request.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>mode_return</emphasis>
+    </term>
+    <listitem>
+      <para>
+Returns the mode of the nevents information.
+The mode will be one of the following:
+<function>Absolute</function>
+or
+<function>Relative .</function>
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>axis_count_return</emphasis>
+    </term>
+    <listitem>
+      <para>
+Returns the number of axes reported in each of the positions returned.
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XGetDeviceMotionEvents</function>
+returns all positions in the device's motion history buffer
+that fall between the specified start and stop times inclusive.
+If the start time is in the future or is later than the stop time,
+no positions are returned.
+</para>
+<para>
+<!-- .LP -->
+The return type for this function is an
+<function>XDeviceTimeCoord</function>
+structure, which is defined as follows:
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<literallayout class="monospaced">
+<!-- .TA .5i -->
+<!-- .ta .5i -->
+typedef struct {
+     Time time;
+     unsigned int *data;
+} XDeviceTimeCoord;
+</literallayout>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+The data member is a pointer to an array of data items.
+Each item is of type int, and there is one data item
+per axis of motion reported by the device.
+The number of axes reported by the device is returned in the axis_count variable.
+</para>
+<para>
+<!-- .LP -->
+The value of the data items depends on the mode of the device. 
+The mode is returned in the mode variable.  If the 
+mode is
+<function>Absolute ,</function>
+the data items are the raw values generated by the device.
+These may be scaled by the client program using the
+maximum values that the device can generate for each axis of motion
+that it reports.  The maximum value for each axis is reported in
+the max_val member of the
+<function>XAxisInfo</function>
+structure, which is part of the information returned by the
+<function>XListInputDevices</function>
+request.
+</para>
+<para>
+<!-- .LP -->
+If the mode is
+<function>Relative ,</function>
+the data items are the relative values generated by the device.
+The client program must choose an initial
+position for the device and maintain a current position by 
+accumulating these relative values.
+</para>
+<para>
+<!-- .LP -->
+Consecutive calls to
+<function>XGetDeviceMotionEvents</function>
+can return data of different modes, that is, if
+some client program has changed the mode of the device via an
+<function>XSetDeviceMode</function>
+request.
+</para>
+<para>
+<!-- .LP -->
+<function>XGetDeviceMotionEvents</function>
+can generate
+<function>BadDevice</function>
+and
+<function>BadMatch</function>
+errors.
+<!-- .sp -->
+</para>
+<para>
+<!-- .LP -->
+To free the data returned by
+<function>XGetDeviceMotionEvents ,</function>
+use
+<function>XFreeDeviceMotionEvents .</function>
+</para>
+<para>
+<!-- .LP -->
+<!-- .sM -->
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function> XFreeDeviceMotionEvents</function></funcdef>
+  <paramdef>XDeviceTimeCoord<parameter> *events</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<!-- .FN -->
+<variablelist>
+  <varlistentry>
+    <term>
+      <emphasis remap='I'>events</emphasis>
+    </term>
+    <listitem>
+      <para>
+Specifies the pointer to the
+<function>XDeviceTimeCoord</function>
+array returned by a previous call to
+<function>XGetDeviceMotionEvents .</function>
+    </para>
+  </listitem>
+  </varlistentry>
+</variablelist>
+</para>
+<para>
+<!-- .LP -->
+<!-- .eM -->
+<function>XFreeDeviceMotionEvents</function>
+frees the specified array of motion information.
+<!-- .\" -->
+<!-- .\" -->
+<!-- .\"  Appendicies -->
+<!-- .\" -->
+<!-- .\" -->
+<!-- .bp -->
+<!-- .ds Ch ~ -->
+<!-- .sp 1 -->
+<!-- .ce 3 -->
+<function>Appendix A</function>
+<!-- .XS -->
+<!-- (SN Appendix A -->
+<!-- .XE -->
+</para>
+<para>
+<!-- .LP -->
+The following information is contained in the <function>&lt;X11/extensions/XInput.h&gt;</function>
+and <function>&lt;X11/extensions/XI.h&gt;</function> header files:
+<literallayout class="monospaced">
+<!-- .cs CW 20 -->
+
+<!-- .ps 8 -->
+/* Definitions used by the library and client */
+
+#ifndef _XINPUT_H_
+#define _XINPUT_H_
+
+#ifndef _XLIB_H_
+#include &lt;X11/Xlib.h&gt;
+#endif
+
+#ifndef _XI_H_
+#include "XI.h"
+#endif
+
+#define _deviceKeyPress          0
+#define _deviceKeyRelease     1
+
+#define _deviceButtonPress     0
+#define _deviceButtonRelease     1
+
+#define _deviceMotionNotify     0
+
+#define _deviceFocusIn          0
+#define _deviceFocusOut          1
+
+#define _proximityIn          0
+#define _proximityOut          1
+
+#define _deviceStateNotify     0
+#define _deviceMappingNotify     1
+#define _changeDeviceNotify     2
+
+#define FindTypeAndClass(d, type, class, classid, offset) \
+    { int i; XInputClassInfo *ip; \
+    type = 0; class = 0; \
+    for (i=0, ip= ((XDevice *) d)-&gt;classes; \
+      i&lt; ((XDevice *) d)-&gt;num_classes; \
+      i++, ip++) \
+     if (ip-&gt;input_class == classid) \
+         {type =  ip-&gt;event_type_base + offset; \
+          class =  ((XDevice *) d)-&gt;device_id &lt;&lt; 8 | type;}}
+
+#define DeviceKeyPress(d, type, class) \
+    FindTypeAndClass(d, type, class, KeyClass, _deviceKeyPress)
+
+#define DeviceKeyRelease(d, type, class) \
+    FindTypeAndClass(d, type, class, KeyClass, _deviceKeyRelease)
+
+#define DeviceButtonPress(d, type, class) \
+    FindTypeAndClass(d, type, class, ButtonClass, _deviceButtonPress)
+
+#define DeviceButtonRelease(d, type, class) \
+    FindTypeAndClass(d, type, class, ButtonClass, _deviceButtonRelease)
+
+#define DeviceMotionNotify(d, type, class) \
+    FindTypeAndClass(d, type, class, ValuatorClass, _deviceMotionNotify)
+
+#define DeviceFocusIn(d, type, class) \
+    FindTypeAndClass(d, type, class, FocusClass, _deviceFocusIn)
+
+#define DeviceFocusOut(d, type, class) \
+    FindTypeAndClass(d, type, class, FocusClass, _deviceFocusOut)
+
+#define ProximityIn(d, type, class) \
+    FindTypeAndClass(d, type, class, ProximityClass, _proximityIn)
+
+#define ProximityOut(d, type, class) \
+    FindTypeAndClass(d, type, class, ProximityClass, _proximityOut)
+
+#define DeviceStateNotify(d, type, class) \
+    FindTypeAndClass(d, type, class, OtherClass, _deviceStateNotify)
+
+#define DeviceMappingNotify(d, type, class) \
+    FindTypeAndClass(d, type, class, OtherClass, _deviceMappingNotify)
+
+#define ChangeDeviceNotify(d, type, class) \
+    FindTypeAndClass(d, type, class, OtherClass, _changeDeviceNotify)
+
+#define DevicePointerMotionHint(d, type, class) \
+    { class =  ((XDevice *) d)-&gt;device_id &lt;&lt; 8 | _devicePointerMotionHint;}
+
+#define DeviceButton1Motion(d, type, class) \
+    { class =  ((XDevice *) d)-&gt;device_id &lt;&lt; 8 | _deviceButton1Motion;}
+
+#define DeviceButton2Motion(d, type, class) \
+    { class =  ((XDevice *) d)-&gt;device_id &lt;&lt; 8 | _deviceButton2Motion;}
+
+#define DeviceButton3Motion(d, type, class) \
+    { class =  ((XDevice *) d)-&gt;device_id &lt;&lt; 8 | _deviceButton3Motion;}
+
+#define DeviceButton4Motion(d, type, class) \
+    { class =  ((XDevice *) d)-&gt;device_id &lt;&lt; 8 | _deviceButton4Motion;}
+
+#define DeviceButton5Motion(d, type, class) \
+    { class =  ((XDevice *) d)-&gt;device_id &lt;&lt; 8 | _deviceButton5Motion;}
+
+#define DeviceButtonMotion(d, type, class) \
+    { class =  ((XDevice *) d)-&gt;device_id &lt;&lt; 8 | _deviceButtonMotion;}
+
+#define DeviceOwnerGrabButton(d, type, class) \
+    { class =  ((XDevice *) d)-&gt;device_id &lt;&lt; 8 | _deviceOwnerGrabButton;}
+
+#define DeviceButtonPressGrab(d, type, class) \
+    { class =  ((XDevice *) d)-&gt;device_id &lt;&lt; 8 | _deviceButtonGrab;}
+
+#define NoExtensionEvent(d, type, class) \
+    { class =  ((XDevice *) d)-&gt;device_id &lt;&lt; 8 | _noExtensionEvent;}
+
+#define BadDevice(dpy, error) _xibaddevice(dpy, &amp;error)
+
+#define BadClass(dpy, error) _xibadclass(dpy, &amp;error)
+
+#define BadEvent(dpy, error) _xibadevent(dpy, &amp;error)
+
+#define BadMode(dpy, error) _xibadmode(dpy, &amp;error)
+
+#define DeviceBusy(dpy, error) _xidevicebusy(dpy, &amp;error)
+
+/***************************************************************
+ *
+ * DeviceKey events.  These events are sent by input devices that
+ * support input class Keys.
+ * The location of the X pointer is reported in the coordinate
+ * fields of the x,y and x_root,y_root fields.
+ *
+ */
+
+typedef struct 
+    {
+    int            type;         /* of event */
+    unsigned long  serial;       /* # of last request processed */
+    Bool           send_event;   /* true if from SendEvent request */
+    Display        *display;     /* Display the event was read from */
+    Window         window;       /* "event" window reported relative to */
+    XID            deviceid;
+    Window         root;         /* root window event occured on */
+    Window         subwindow;    /* child window */
+    Time           time;         /* milliseconds */
+    int            x, y;         /* x, y coordinates in event window */
+    int            x_root;       /* coordinates relative to root */
+    int            y_root;       /* coordinates relative to root */
+    unsigned int   state;        /* key or button mask */
+    unsigned int   keycode;      /* detail */
+    Bool           same_screen;  /* same screen flag */
+    unsigned int   device_state; /* device key or button mask */
+    unsigned char  axes_count;
+    unsigned char  first_axis;
+    int            axis_data[6];
+    } XDeviceKeyEvent;
+
+typedef XDeviceKeyEvent XDeviceKeyPressedEvent;
+typedef XDeviceKeyEvent XDeviceKeyReleasedEvent;
+
+/*******************************************************************
+ *
+ * DeviceButton events.  These events are sent by extension devices
+ * that support input class Buttons.
+ *
+ */
+
+typedef struct {
+    int           type;         /* of event */
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;       /* "event" window reported relative to */
+    XID           deviceid;
+    Window        root;         /* root window that the event occured on */
+    Window        subwindow;    /* child window */
+    Time          time;         /* milliseconds */
+    int           x, y;         /* x, y coordinates in event window */
+    int           x_root;       /* coordinates relative to root */
+    int           y_root;       /* coordinates relative to root */
+    unsigned int  state;        /* key or button mask */
+    unsigned int  button;       /* detail */
+    Bool          same_screen;  /* same screen flag */
+    unsigned int  device_state; /* device key or button mask */
+    unsigned char axes_count;
+    unsigned char first_axis;
+    int           axis_data[6];
+    } XDeviceButtonEvent;
+
+typedef XDeviceButtonEvent XDeviceButtonPressedEvent;
+typedef XDeviceButtonEvent XDeviceButtonReleasedEvent;
+
+/*******************************************************************
+ *
+ * DeviceMotionNotify event.  These events are sent by extension devices
+ * that support input class Valuators.
+ *
+ */
+
+typedef struct 
+    {
+    int           type;        /* of event */
+    unsigned long serial;      /* # of last request processed by server */
+    Bool          send_event;  /* true if from a SendEvent request */
+    Display       *display;    /* Display the event was read from */
+    Window        window;      /* "event" window reported relative to */
+    XID           deviceid;
+    Window        root;        /* root window that the event occured on */
+    Window        subwindow;   /* child window */
+    Time          time;        /* milliseconds */
+    int           x, y;        /* x, y coordinates in event window */
+    int           x_root;      /* coordinates relative to root */
+    int           y_root;      /* coordinates relative to root */
+    unsigned int  state;       /* key or button mask */
+    char          is_hint;     /* detail */
+    Bool          same_screen; /* same screen flag */
+    unsigned int  device_state; /* device key or button mask */
+    unsigned char axes_count;
+    unsigned char first_axis;
+    int           axis_data[6];
+    } XDeviceMotionEvent;
+
+/*******************************************************************
+ *
+ * DeviceFocusChange events.  These events are sent when the focus
+ * of an extension device that can be focused is changed.
+ *
+ */
+
+typedef struct 
+    {
+    int           type;       /* of event */
+    unsigned long serial;     /* # of last request processed by server */
+    Bool          send_event; /* true if from a SendEvent request */
+    Display       *display;   /* Display the event was read from */
+    Window        window;     /* "event" window reported relative to */
+    XID           deviceid;
+    int           mode;       /* NotifyNormal, NotifyGrab, NotifyUngrab */
+    int           detail;
+     /*
+      * NotifyAncestor, NotifyVirtual, NotifyInferior, 
+      * NotifyNonLinear,NotifyNonLinearVirtual, NotifyPointer,
+      * NotifyPointerRoot, NotifyDetailNone 
+      */
+    Time                time;
+    } XDeviceFocusChangeEvent;
+
+typedef XDeviceFocusChangeEvent XDeviceFocusInEvent;
+typedef XDeviceFocusChangeEvent XDeviceFocusOutEvent;
+
+/*******************************************************************
+ *
+ * ProximityNotify events.  These events are sent by those absolute
+ * positioning devices that are capable of generating proximity information.
+ *
+ */
+
+typedef struct 
+    {
+    int             type;      /* ProximityIn or ProximityOut */        
+    unsigned long   serial;    /* # of last request processed by server */
+    Bool            send_event; /* true if this came from a SendEvent request */
+    Display         *display;  /* Display the event was read from */
+    Window          window;      
+    XID                 deviceid;
+    Window          root;            
+    Window          subwindow;      
+    Time            time;            
+    int             x, y;            
+    int             x_root, y_root;  
+    unsigned int    state;           
+    Bool            same_screen;     
+    unsigned int    device_state; /* device key or button mask */
+    unsigned char   axes_count;
+    unsigned char   first_axis;
+    int             axis_data[6];
+    } XProximityNotifyEvent;
+typedef XProximityNotifyEvent XProximityInEvent;
+typedef XProximityNotifyEvent XProximityOutEvent;
+
+/*******************************************************************
+ *
+ * DeviceStateNotify events are generated on EnterWindow and FocusIn 
+ * for those clients who have selected DeviceState.
+ *
+ */
+
+typedef struct
+    {
+    unsigned char     class;
+    unsigned char     length;
+    } XInputClass;
+
+typedef struct {
+    int           type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;
+    XID           deviceid;
+    Time          time;
+    int           num_classes;
+    char       data[64];
+} XDeviceStateNotifyEvent;     
+
+typedef struct {
+    unsigned char     class;
+    unsigned char     length;
+    unsigned char     num_valuators;
+    unsigned char     mode;
+    int                  valuators[6];
+} XValuatorStatus;
+
+typedef struct {
+    unsigned char     class;
+    unsigned char     length;
+    short          num_keys;
+    char             keys[32];
+} XKeyStatus;
+
+typedef struct {
+    unsigned char     class;
+    unsigned char     length;
+    short          num_buttons;
+    char             buttons[32];
+} XButtonStatus;
+
+/*******************************************************************
+ *
+ * DeviceMappingNotify event.  This event is sent when the key mapping,
+ * modifier mapping, or button mapping of an extension device is changed.
+ *
+ */
+
+typedef struct {
+    int           type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;       /* unused */
+    XID           deviceid;
+    Time          time;
+    int           request;      /* one of MappingModifier, MappingKeyboard,
+                                    MappingPointer */
+    int           first_keycode;/* first keycode */
+    int           count;        /* defines range of change w. first_keycode*/
+} XDeviceMappingEvent;
+
+/*******************************************************************
+ *
+ * ChangeDeviceNotify event.  This event is sent when an 
+ * XChangeKeyboard or XChangePointer request is made.
+ *
+ */
+
+typedef struct {
+    int           type;
+    unsigned long serial;       /* # of last request processed by server */
+    Bool          send_event;   /* true if this came from a SendEvent request */
+    Display       *display;     /* Display the event was read from */
+    Window        window;       /* unused */
+    XID           deviceid;
+    Time          time;
+    int           request;      /* NewPointer or NewKeyboard */
+} XChangeDeviceNotifyEvent;
+
+/*******************************************************************
+ *
+ * Control structures for input devices that support input class
+ * Feedback.  These are used by the XGetFeedbackControl and 
+ * XChangeFeedbackControl functions.
+ *
+ */
+
+typedef struct {
+     XID            class;
+     int            length;
+     XID            id;
+} XFeedbackState;
+
+typedef struct {
+    XID     class;
+    int     length;
+    XID     id;
+    int     click;
+    int     percent;
+    int     pitch;
+    int     duration;
+    int     led_mask;
+    int     global_auto_repeat;
+    char    auto_repeats[32];
+} XKbdFeedbackState;
+
+typedef struct {
+    XID     class;
+    int     length;
+    XID     id;
+    int     accelNum;
+    int     accelDenom;
+    int     threshold;
+} XPtrFeedbackState;
+
+typedef struct {
+    XID     class;
+    int     length;
+    XID     id;
+    int     resolution;
+    int     minVal;
+    int     maxVal;
+} XIntegerFeedbackState;
+
+typedef struct {
+    XID     class;
+    int     length;
+    XID     id;
+    int     max_symbols;
+    int     num_syms_supported;
+    KeySym  *syms_supported;
+} XStringFeedbackState;
+
+typedef struct {
+    XID     class;
+    int     length;
+    XID     id;
+    int     percent;
+    int     pitch;
+    int     duration;
+} XBellFeedbackState;
+
+typedef struct {
+    XID     class;
+    int     length;
+    XID     id;
+    int     led_values;
+    int     led_mask;
+} XLedFeedbackState;
+
+typedef struct {
+     XID            class;
+     int            length;
+     XID         id;
+} XFeedbackControl;
+
+typedef struct {
+    XID     class;
+    int     length;
+    XID     id;
+    int     accelNum;
+    int     accelDenom;
+    int     threshold;
+} XPtrFeedbackControl;
+
+typedef struct {
+    XID     class;
+    int     length;
+    XID     id;
+    int     click;
+    int     percent;
+    int     pitch;
+    int     duration;
+    int     led_mask;
+    int     led_value;
+    int     key;
+    int     auto_repeat_mode;
+} XKbdFeedbackControl;
+
+typedef struct {
+    XID     class;
+    int     length;
+    XID     id;
+    int     num_keysyms;
+    KeySym  *syms_to_display;
+} XStringFeedbackControl;
+
+typedef struct {
+    XID     class;
+    int     length;
+    XID     id;
+    int     int_to_display;
+} XIntegerFeedbackControl;
+
+typedef struct {
+    XID     class;
+    int     length;
+    XID     id;
+    int     percent;
+    int     pitch;
+    int     duration;
+} XBellFeedbackControl;
+
+typedef struct {
+    XID     class;
+    int     length;
+    XID     id;
+    int     led_mask;
+    int     led_values;
+} XLedFeedbackControl;
+
+/*******************************************************************
+ *
+ * Device control structures.
+ *
+ */
+
+typedef struct {
+     XID            control;
+     int            length;
+} XDeviceControl;
+
+typedef struct {
+     XID            control;
+     int            length;
+     int            first_valuator;
+     int            num_valuators;
+     int            *resolutions;
+} XDeviceResolutionControl;
+
+typedef struct {
+     XID            control;
+     int            length;
+     int            num_valuators;
+     int            *resolutions;
+     int            *min_resolutions;
+     int            *max_resolutions;
+} XDeviceResolutionState;
+
+/*******************************************************************
+ *
+ * An array of XDeviceList structures is returned by the 
+ * XListInputDevices function.  Each entry contains information
+ * about one input device.  Among that information is an array of 
+ * pointers to structures that describe the characteristics of 
+ * the input device.
+ *
+ */
+
+typedef struct _XAnyClassinfo *XAnyClassPtr;
+
+typedef struct _XAnyClassinfo {
+    XID      class;
+    int      length;
+    } XAnyClassInfo;
+
+typedef struct _XDeviceInfo *XDeviceInfoPtr;
+
+typedef struct _XDeviceInfo
+    {
+    XID                 id;        
+    Atom                type;
+    char                *name;
+    int                 num_classes;
+    int                 use;
+    XAnyClassPtr      inputclassinfo;
+    } XDeviceInfo;
+
+typedef struct _XKeyInfo *XKeyInfoPtr;
+
+typedef struct _XKeyInfo
+    {
+    XID               class;
+    int               length;
+    unsigned short      min_keycode;
+    unsigned short      max_keycode;
+    unsigned short      num_keys;
+    } XKeyInfo;
+
+typedef struct _XButtonInfo *XButtonInfoPtr;
+
+typedef struct _XButtonInfo {
+    XID          class;
+    int          length;
+    short      num_buttons;
+    } XButtonInfo;
+
+typedef struct _XAxisInfo *XAxisInfoPtr;
+
+typedef struct _XAxisInfo {
+    int      resolution;
+    int      min_value;
+    int      max_value;
+    } XAxisInfo;
+
+typedef struct _XValuatorInfo *XValuatorInfoPtr;
+
+typedef struct     _XValuatorInfo
+    {
+    XID               class;
+    int               length;
+    unsigned char       num_axes;
+    unsigned char       mode;
+    unsigned long       motion_buffer;
+    XAxisInfoPtr        axes;
+    } XValuatorInfo;
+
+
+/*******************************************************************
+ *
+ * An XDevice structure is returned by the XOpenDevice function.  
+ * It contains an array of pointers to XInputClassInfo structures.
+ * Each contains information about a class of input supported by the
+ * device, including a pointer to an array of data for each type of event
+ * the device reports.
+ *
+ */
+
+
+typedef struct {
+        unsigned char   input_class;
+        unsigned char   event_type_base;
+} XInputClassInfo;
+
+typedef struct {
+        XID                    device_id;
+        int                    num_classes;
+        XInputClassInfo        *classes;
+} XDevice;
+
+
+/*******************************************************************
+ *
+ * The following structure is used to return information for the 
+ * XGetSelectedExtensionEvents function.
+ *
+ */
+
+typedef struct {
+        XEventClass     event_type;
+        XID             device;
+} XEventList;
+
+/*******************************************************************
+ *
+ * The following structure is used to return motion history data from 
+ * an input device that supports the input class Valuators.
+ * This information is returned by the XGetDeviceMotionEvents function.
+ *
+ */
+
+typedef struct {
+        Time   time;
+        int    *data;
+} XDeviceTimeCoord;
+
+
+/*******************************************************************
+ *
+ * Device state structure.
+ * This is returned by the XQueryDeviceState request.
+ *
+ */
+
+typedef struct {
+        XID          device_id;
+        int          num_classes;
+        XInputClass     *data;
+} XDeviceState;
+
+/*******************************************************************
+ *
+ * Note that the mode field is a bitfield that reports the Proximity
+ * status of the device as well as the mode.  The mode field should
+ * be OR'd with the mask DeviceMode and compared with the values
+ * Absolute and Relative to determine the mode, and should be OR'd
+ * with the mask ProximityState and compared with the values InProximity
+ * and OutOfProximity to determine the proximity state.
+ *
+ */
+
+typedef struct {
+    unsigned char     class;
+    unsigned char     length;
+    unsigned char     num_valuators;
+    unsigned char     mode;
+    int                  *valuators;
+} XValuatorState;
+
+typedef struct {
+    unsigned char     class;
+    unsigned char     length;
+    short          num_keys;
+    char             keys[32];
+} XKeyState;
+
+typedef struct {
+    unsigned char     class;
+    unsigned char     length;
+    short          num_buttons;
+    char             buttons[32];
+} XButtonState;
+
+/*******************************************************************
+ *
+ * Function definitions.
+ *
+ */
+
+_XFUNCPROTOBEGIN
+
+extern int     XChangeKeyboardDevice(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */
+#endif
+);
+
+extern int     XChangePointerDevice(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    int               /* xaxis */,
+    int               /* yaxis */
+#endif
+);
+
+extern int     XGrabDevice(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    Window          /* grab_window */,
+    Bool          /* ownerEvents */,
+    int               /* event count */,
+    XEventClass*     /* event_list */,
+    int               /* this_device_mode */,
+    int               /* other_devices_mode */,
+    Time          /* time */
+#endif
+);
+
+extern int     XUngrabDevice(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    Time           /* time */
+#endif
+);
+
+extern int     XGrabDeviceKey(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    unsigned int     /* key */,
+    unsigned int     /* modifiers */,
+    XDevice*          /* modifier_device */,
+    Window          /* grab_window */,
+    Bool          /* owner_events */,
+    unsigned int     /* event_count */,
+    XEventClass*     /* event_list */,
+    int               /* this_device_mode */,
+    int               /* other_devices_mode */
+#endif
+);
+
+extern int     XUngrabDeviceKey(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    unsigned int     /* key */,
+    unsigned int     /* modifiers */,
+    XDevice*          /* modifier_dev */,
+    Window          /* grab_window */
+#endif
+);
+
+extern int     XGrabDeviceButton(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    unsigned int     /* button */,
+    unsigned int     /* modifiers */,
+    XDevice*          /* modifier_device */,
+    Window          /* grab_window */,
+    Bool          /* owner_events */,
+    unsigned int     /* event_count */,
+    XEventClass*     /* event_list */,
+    int               /* this_device_mode */,
+    int               /* other_devices_mode */
+#endif
+);
+
+extern int     XUngrabDeviceButton(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    unsigned int     /* button */,
+    unsigned int     /* modifiers */,
+    XDevice*          /* modifier_dev */,
+    Window          /* grab_window */
+#endif
+);
+
+extern int     XAllowDeviceEvents(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    int               /* event_mode */,
+    Time          /* time */
+#endif
+);
+
+extern int     XGetDeviceFocus(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    Window*          /* focus */,
+    int*          /* revert_to */,
+    Time*          /* time */
+#endif
+);
+
+extern int     XSetDeviceFocus(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    Window          /* focus */,
+    int               /* revert_to */,
+    Time          /* time */
+#endif
+);
+
+extern XFeedbackState     *XGetFeedbackControl(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    int*          /* num_feedbacks */
+#endif
+);
+
+extern int     XFreeFeedbackList(
+#if NeedFunctionPrototypes
+    XFeedbackState*     /* list */
+#endif
+);
+
+extern int     XChangeFeedbackControl(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    unsigned long     /* mask */,
+    XFeedbackControl*     /* f */
+#endif
+);
+
+extern int     XDeviceBell(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    XID               /* feedbackclass */,
+    XID               /* feedbackid */,
+    int               /* percent */
+#endif
+);
+
+extern KeySym     *XGetDeviceKeyMapping(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+#if NeedWidePrototypes
+    unsigned int     /* first */,
+#else
+    KeyCode          /* first */,
+#endif
+    int               /* keycount */,
+    int*          /* syms_per_code */
+#endif
+);
+
+extern int     XChangeDeviceKeyMapping(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    int               /* first */,
+    int               /* syms_per_code */,
+    KeySym*          /* keysyms */,
+    int               /* count */
+#endif
+);
+
+extern XModifierKeymap     *XGetDeviceModifierMapping(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */
+#endif
+);
+
+extern int     XSetDeviceModifierMapping(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    XModifierKeymap*     /* modmap */
+#endif
+);
+
+extern int     XSetDeviceButtonMapping(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    unsigned char*     /* map[] */,
+    int               /* nmap */
+#endif
+);
+
+extern int     XGetDeviceButtonMapping(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    unsigned char*     /* map[] */,
+    unsigned int     /* nmap */
+#endif
+);
+
+extern XDeviceState     *XQueryDeviceState(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */
+#endif
+);
+
+extern int     XFreeDeviceState(
+#if NeedFunctionPrototypes
+    XDeviceState*     /* list */
+#endif
+);
+
+extern XExtensionVersion *XGetExtensionVersion(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    _Xconst char*     /* name */
+#endif
+);
+
+extern XDeviceInfo     *XListInputDevices(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    int*          /* ndevices */
+#endif
+);
+
+extern int     XFreeDeviceList(
+#if NeedFunctionPrototypes
+    XDeviceInfo*     /* list */
+#endif
+);
+
+extern XDevice     *XOpenDevice(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XID               /* id */
+#endif
+);
+
+extern int     XCloseDevice(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */
+#endif
+);
+
+extern int     XSetDeviceMode(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    int               /* mode */
+#endif
+);
+
+extern int     XSetDeviceValuators(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    int*          /* valuators */,
+    int               /* first_valuator */,
+    int               /* num_valuators */
+#endif
+);
+
+extern XDeviceControl     *XGetDeviceControl(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    int               /* control */
+#endif
+);
+
+extern int     XChangeDeviceControl(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    int               /* control */,
+    XDeviceControl*     /* d */
+#endif
+);
+
+extern int     XSelectExtensionEvent(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    Window          /* w */,
+    XEventClass*     /* event_list */,
+    int               /* count */
+#endif
+);
+
+extern int     XGetSelectedExtensionEvents(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    Window          /* w */,
+    int*          /* this_client_count */,
+    XEventClass**     /* this_client_list */,
+    int*          /* all_clients_count */,
+    XEventClass**     /* all_clients_list */
+#endif
+);
+
+extern int     XChangeDeviceDontPropagateList(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    Window          /* window */,
+    int               /* count */,
+    XEventClass*     /* events */,
+    int               /* mode */
+#endif
+);
+
+extern XEventClass     *XGetDeviceDontPropagateList(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    Window          /* window */,
+    int*          /* count */
+#endif
+);
+
+extern Status     XSendExtensionEvent(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    Window          /* dest */,
+    Bool          /* prop */,
+    int               /* count */,
+    XEventClass*     /* list */,
+    XEvent*          /* event */
+#endif
+);
+
+extern XDeviceTimeCoord     *XGetDeviceMotionEvents(
+#if NeedFunctionPrototypes
+    Display*          /* display */,
+    XDevice*          /* device */,
+    Time          /* start */,
+    Time          /* stop */,
+    int*          /* nEvents */,
+    int*          /* mode */,
+    int*          /* axis_count */
+#endif
+);
+
+extern int     XFreeDeviceMotionEvents(
+#if NeedFunctionPrototypes
+    XDeviceTimeCoord*     /* events */
+#endif
+);
+
+extern int     XFreeDeviceControl(
+#if NeedFunctionPrototypes
+    XDeviceControl*     /* control */
+#endif
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XINPUT_H_ */
+
+/* Definitions used by the server, library and client */
+
+#ifndef _XI_H_
+
+#define _XI_H_
+
+#define sz_xGetExtensionVersionReq          8
+#define sz_xGetExtensionVersionReply          32
+#define sz_xListInputDevicesReq               4
+#define sz_xListInputDevicesReply          32
+#define sz_xOpenDeviceReq               8
+#define sz_xOpenDeviceReply               32
+#define sz_xCloseDeviceReq               8
+#define sz_xSetDeviceModeReq               8
+#define sz_xSetDeviceModeReply               32
+#define sz_xSelectExtensionEventReq          12
+#define sz_xGetSelectedExtensionEventsReq     8
+#define sz_xGetSelectedExtensionEventsReply     32
+#define sz_xChangeDeviceDontPropagateListReq     12
+#define sz_xGetDeviceDontPropagateListReq     8
+#define sz_xGetDeviceDontPropagateListReply     32
+#define sz_xGetDeviceMotionEventsReq          16
+#define sz_xGetDeviceMotionEventsReply          32
+#define sz_xChangeKeyboardDeviceReq          8
+#define sz_xChangeKeyboardDeviceReply          32
+#define sz_xChangePointerDeviceReq          8
+#define sz_xChangePointerDeviceReply          32
+#define sz_xGrabDeviceReq               20
+#define sz_xGrabDeviceReply               32
+#define sz_xUngrabDeviceReq               12
+#define sz_xGrabDeviceKeyReq               20
+#define sz_xGrabDeviceKeyReply               32
+#define sz_xUngrabDeviceKeyReq               16
+#define sz_xGrabDeviceButtonReq               20
+#define sz_xGrabDeviceButtonReply          32
+#define sz_xUngrabDeviceButtonReq          16
+#define sz_xAllowDeviceEventsReq          12
+#define sz_xGetDeviceFocusReq               8
+#define sz_xGetDeviceFocusReply               32
+#define sz_xSetDeviceFocusReq               16
+#define sz_xGetFeedbackControlReq          8
+#define sz_xGetFeedbackControlReply          32
+#define sz_xChangeFeedbackControlReq          12
+#define sz_xGetDeviceKeyMappingReq          8
+#define sz_xGetDeviceKeyMappingReply          32
+#define sz_xChangeDeviceKeyMappingReq          8
+#define sz_xGetDeviceModifierMappingReq          8
+#define sz_xSetDeviceModifierMappingReq          8
+#define sz_xSetDeviceModifierMappingReply     32
+#define sz_xGetDeviceButtonMappingReq          8
+#define sz_xGetDeviceButtonMappingReply          32
+#define sz_xSetDeviceButtonMappingReq          8
+#define sz_xSetDeviceButtonMappingReply          32
+#define sz_xQueryDeviceStateReq               8
+#define sz_xQueryDeviceStateReply          32
+#define sz_xSendExtensionEventReq          16
+#define sz_xDeviceBellReq               8
+#define sz_xSetDeviceValuatorsReq          8
+#define sz_xSetDeviceValuatorsReply          32
+#define sz_xGetDeviceControlReq               8
+#define sz_xGetDeviceControlReply          32
+#define sz_xChangeDeviceControlReq          8
+#define sz_xChangeDeviceControlReply          32
+
+#define INAME                "XInputExtension"
+
+#define XI_KEYBOARD     "KEYBOARD"
+#define XI_MOUSE     "MOUSE"
+#define XI_TABLET     "TABLET"
+#define XI_TOUCHSCREEN     "TOUCHSCREEN"
+#define XI_TOUCHPAD     "TOUCHPAD"
+#define XI_BARCODE     "BARCODE"
+#define XI_BUTTONBOX     "BUTTONBOX"
+#define XI_KNOB_BOX     "KNOB_BOX"
+#define XI_ONE_KNOB     "ONE_KNOB"
+#define XI_NINE_KNOB     "NINE_KNOB"
+#define XI_TRACKBALL     "TRACKBALL"
+#define XI_QUADRATURE     "QUADRATURE"
+#define XI_ID_MODULE     "ID_MODULE"
+#define XI_SPACEBALL     "SPACEBALL"
+#define XI_DATAGLOVE     "DATAGLOVE"
+#define XI_EYETRACKER     "EYETRACKER"
+#define XI_CURSORKEYS     "CURSORKEYS"
+#define XI_FOOTMOUSE     "FOOTMOUSE"
+
+#define Dont_Check               0
+#define XInput_Initial_Release          1
+#define XInput_Add_XDeviceBell          2
+#define XInput_Add_XSetDeviceValuators     3
+#define XInput_Add_XChangeDeviceControl     4
+
+#define XI_Absent          0
+#define XI_Present          1
+
+#define XI_Initial_Release_Major          1
+#define XI_Initial_Release_Minor          0
+
+#define XI_Add_XDeviceBell_Major          1
+#define XI_Add_XDeviceBell_Minor          1
+
+#define XI_Add_XSetDeviceValuators_Major     1
+#define XI_Add_XSetDeviceValuators_Minor     2
+
+#define XI_Add_XChangeDeviceControl_Major     1
+#define XI_Add_XChangeDeviceControl_Minor     3
+
+#define DEVICE_RESOLUTION     1
+
+#define NoSuchExtension          1
+
+#define COUNT               0
+#define CREATE               1
+
+#define NewPointer          0
+#define NewKeyboard          1
+
+#define XPOINTER          0
+#define XKEYBOARD          1
+
+#define UseXKeyboard          0xFF
+
+#define IsXPointer          0
+#define IsXKeyboard          1
+#define IsXExtensionDevice     2
+
+#define AsyncThisDevice          0
+#define SyncThisDevice          1
+#define ReplayThisDevice     2
+#define AsyncOtherDevices     3
+#define AsyncAll          4
+#define SyncAll               5
+
+#define FollowKeyboard           3
+#define RevertToFollowKeyboard      3
+
+#define DvAccelNum              (1L &lt;&lt; 0)
+#define DvAccelDenom            (1L &lt;&lt; 1)
+#define DvThreshold             (1L &lt;&lt; 2)
+
+#define DvKeyClickPercent     (1L&lt;&lt;0)
+#define DvPercent          (1L&lt;&lt;1)
+#define DvPitch               (1L&lt;&lt;2)
+#define DvDuration          (1L&lt;&lt;3)
+#define DvLed               (1L&lt;&lt;4)
+#define DvLedMode          (1L&lt;&lt;5)
+#define DvKey               (1L&lt;&lt;6)
+#define DvAutoRepeatMode     (1L&lt;&lt;7)
+
+#define DvString                (1L &lt;&lt; 0)
+
+#define DvInteger               (1L &lt;&lt; 0)
+
+#define DeviceMode              (1L &lt;&lt; 0)
+#define Relative                0
+#define Absolute                1
+
+#define ProximityState          (1L &lt;&lt; 1)
+#define InProximity             (0L &lt;&lt; 1)
+#define OutOfProximity          (1L &lt;&lt; 1)
+
+#define AddToList               0
+#define DeleteFromList          1
+
+#define KeyClass            0
+#define ButtonClass            1
+#define ValuatorClass            2
+#define FeedbackClass            3
+#define ProximityClass       4
+#define FocusClass            5
+#define OtherClass            6
+
+#define KbdFeedbackClass       0
+#define PtrFeedbackClass       1
+#define StringFeedbackClass       2
+#define IntegerFeedbackClass       3
+#define LedFeedbackClass       4
+#define BellFeedbackClass       5
+
+#define _devicePointerMotionHint 0
+#define _deviceButton1Motion      1
+#define _deviceButton2Motion      2
+#define _deviceButton3Motion      3
+#define _deviceButton4Motion      4
+#define _deviceButton5Motion      5
+#define _deviceButtonMotion      6
+#define _deviceButtonGrab      7
+#define _deviceOwnerGrabButton      8
+#define _noExtensionEvent      9
+
+#define XI_BadDevice     0
+#define XI_BadEvent     1
+#define XI_BadMode     2
+#define XI_DeviceBusy     3
+#define XI_BadClass     4
+
+typedef     unsigned long     XEventClass;
+
+/*******************************************************************
+ *
+ * Extension version structure.
+ *
+ */
+
+typedef struct {
+        int        present;
+        short     major_version;
+        short     minor_version;
+} XExtensionVersion;
+
+#endif /* _XI_H_ */
+
+</literallayout>
+<!-- .\" print Table of Contents -->
+<!-- .if o .bp \" blank page to make count even -->
+<!-- .bp 1 -->
+<!-- .af PN i -->
+<!-- .PX -->
+
+
+</para>
+</sect3>
+</sect2>
+</sect1>
+</chapter>
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100755 (executable)
index 0000000..76b10e2
--- /dev/null
@@ -0,0 +1,81 @@
+lib_LTLIBRARIES = libXi.la
+
+XI2_sources = XIAllowEvents.c \
+                 XIGrabDevice.c \
+                 XIQueryVersion.c \
+                 XIQueryDevice.c \
+                 XISetDevFocus.c \
+                 XIGetDevFocus.c \
+                 XIPassiveGrab.c \
+                 XIProperties.c \
+                 XISelEv.c \
+                 XIWarpPointer.c \
+                 XIHierarchy.c \
+                 XIDefineCursor.c \
+                 XIQueryPointer.c
+
+libXi_la_SOURCES = \
+                 XAllowDv.c \
+                 XChDProp.c \
+                 XChgDCtl.c \
+                 XChgFCtl.c \
+                 XChgKbd.c \
+                 XChgKMap.c \
+                 XChgPnt.c \
+                 XChgProp.c \
+                 XCloseDev.c \
+                 XDelDProp.c \
+                 XDevBell.c \
+                 XExtToWire.c \
+                 XGetBMap.c \
+                 XGetCPtr.c \
+                 XGetDCtl.c \
+                 XGetDProp.c \
+                 XGetFCtl.c \
+                 XGetKMap.c \
+                 XGetMMap.c \
+                 XGetProp.c \
+                 XGetVers.c \
+                 XGMotion.c \
+                 XGrabDev.c \
+                 XGrDvBut.c \
+                 XGrDvKey.c \
+                 XGtFocus.c \
+                 XGtSelect.c \
+                 XListDev.c \
+                 XListDProp.c \
+                 XOpenDev.c \
+                 XQueryDv.c \
+                 XSelect.c \
+                 XSetBMap.c \
+                 XSetCPtr.c \
+                 XSetDVal.c \
+                 XSetMMap.c \
+                 XSetMode.c \
+                 XSndExEv.c \
+                 XStFocus.c \
+                 XUngrDev.c \
+                 XUngrDvB.c \
+                 XUngrDvK.c \
+                 XExtInt.c  \
+                 XIint.h \
+                 $(XI2_sources)
+
+
+libXi_la_LIBADD = $(XI_LIBS)
+
+AM_CFLAGS = -I$(top_srcdir)/include \
+            -I$(top_srcdir)/include/X11 \
+            -I$(top_srcdir)/include/X11/extensions \
+            $(XI_CFLAGS) \
+            $(MALLOC_ZERO_CFLAGS) \
+            $(CWARNFLAGS)
+
+
+libXi_la_LDFLAGS = -version-number 6:1:0 -no-undefined
+
+libXiincludedir = $(includedir)/X11/extensions
+libXiinclude_HEADERS = $(top_srcdir)/include/X11/extensions/XInput.h \
+                      $(top_srcdir)/include/X11/extensions/XInput2.h
+
+EXTRA_DIST = XFreeLst.c
diff --git a/src/XAllowDv.c b/src/XAllowDv.c
new file mode 100644 (file)
index 0000000..d19443d
--- /dev/null
@@ -0,0 +1,84 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XAllowDeviceEvents - Thaw a frozen extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XAllowDeviceEvents(
+    register Display   *dpy,
+    XDevice             *dev,
+    int                         event_mode,
+    Time                time)
+{
+    xAllowDeviceEventsReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(AllowDeviceEvents, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_AllowDeviceEvents;
+    req->deviceid = dev->device_id;
+    req->mode = event_mode;
+    req->time = time;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XChDProp.c b/src/XChDProp.c
new file mode 100644 (file)
index 0000000..c863cdb
--- /dev/null
@@ -0,0 +1,106 @@
+/************************************************************
+
+Copyright 2008 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.
+
+*/
+
+/***********************************************************************
+ * XChangeDeviceProperties - change an input device's properties.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <X11/Xlibint.h>
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+void
+XChangeDeviceProperty(Display* dpy, XDevice* dev,
+                      Atom property, Atom type,
+                      int format, int mode,
+                      _Xconst unsigned char *data, int nelements)
+{
+    xChangeDevicePropertyReq   *req;
+    int                         len;
+
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return;
+
+    GetReq(ChangeDeviceProperty, req);
+    req->reqType    = info->codes->major_opcode;
+    req->ReqType    = X_ChangeDeviceProperty;
+    req->deviceid   = dev->device_id;
+    req->property   = property;
+    req->type       = type;
+    req->mode       = mode;
+    if (nelements < 0) {
+       req->nUnits = 0;
+       req->format = 0; /* ask for garbage, get garbage */
+    } else {
+       req->nUnits = nelements;
+       req->format = format;
+    }
+
+    switch (req->format) {
+    case 8:
+       len = ((long)nelements + 3) >> 2;
+       if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
+           SetReqLen(req, len, len);
+           Data (dpy, (char *)data, nelements);
+       } /* else force BadLength */
+       break;
+
+    case 16:
+       len = ((long)nelements + 1) >> 1;
+       if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
+           SetReqLen(req, len, len);
+           len = (long)nelements << 1;
+           Data16 (dpy, (short *) data, len);
+       } /* else force BadLength */
+       break;
+
+    case 32:
+       len = nelements;
+       if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) {
+           SetReqLen(req, len, len);
+           len = (long)nelements << 2;
+           Data32 (dpy, (long *) data, len);
+       } /* else force BadLength */
+       break;
+
+    default:
+       /* BadValue will be generated */ ;
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
diff --git a/src/XChgDCtl.c b/src/XChgDCtl.c
new file mode 100644 (file)
index 0000000..172cb5e
--- /dev/null
@@ -0,0 +1,230 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XChangeDeviceControl - Change the control attributes of an extension
+ * input device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XChangeDeviceControl(
+    register Display   *dpy,
+    XDevice            *dev,
+    int                         control,
+    XDeviceControl     *d)
+{
+    int length;
+    xChangeDeviceControlReq *req;
+    xChangeDeviceControlReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(ChangeDeviceControl, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_ChangeDeviceControl;
+    req->deviceid = dev->device_id;
+    req->control = control;
+
+    switch (control) {
+    case DEVICE_RESOLUTION:
+    {
+       XDeviceResolutionControl *R;
+       xDeviceResolutionCtl r;
+
+       R = (XDeviceResolutionControl *) d;
+       r.control = DEVICE_RESOLUTION;
+       r.length = sizeof(xDeviceResolutionCtl) +
+        R->num_valuators * sizeof(int);
+       r.first_valuator = R->first_valuator;
+       r.num_valuators = R->num_valuators;
+       req->length += ((unsigned)(r.length + 3) >> 2);
+       length = sizeof(xDeviceResolutionCtl);
+       Data(dpy, (char *)&r, length);
+       length = r.num_valuators * sizeof(int);
+       Data(dpy, (char *)R->resolutions, length);
+       if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) {
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return (NoSuchExtension);
+       } else {
+            UnlockDisplay(dpy);
+            SyncHandle();
+           return (rep.status);
+        }
+    }
+    case DEVICE_ABS_CALIB:
+    {
+        XDeviceAbsCalibControl *C = (XDeviceAbsCalibControl *) d;
+        xDeviceAbsCalibCtl c;
+
+        c.control = DEVICE_ABS_CALIB;
+        c.length = sizeof(c);
+        c.min_x = C->min_x;
+        c.max_x = C->max_x;
+        c.min_y = C->min_y;
+        c.max_y = C->max_y;
+        c.flip_x = C->flip_x;
+        c.flip_y = C->flip_y;
+        c.rotation = C->rotation;
+        c.button_threshold = C->button_threshold;
+
+        req->length += (sizeof(c) + 3) >> 2;
+        Data(dpy, (char *) &c, sizeof(c));
+
+        if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) {
+            UnlockDisplay(dpy);
+            SyncHandle();
+            return NoSuchExtension;
+        }
+        else {
+            UnlockDisplay(dpy);
+            SyncHandle();
+            return rep.status;
+        }
+    }
+    case DEVICE_ABS_AREA:
+    {
+        XDeviceAbsAreaControl *A = (XDeviceAbsAreaControl *) d;
+        xDeviceAbsAreaCtl a;
+
+        a.control = DEVICE_ABS_AREA;
+        a.length = sizeof(a);
+        a.offset_x = A->offset_x;
+        a.offset_y = A->offset_y;
+        a.width = A->width;
+        a.height = A->height;
+        a.screen = A->screen;
+        a.following = A->following;
+
+        req->length += (sizeof(a) + 3) >> 2;
+        Data(dpy, (char *) &a, sizeof(a));
+
+        if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) {
+            UnlockDisplay(dpy);
+            SyncHandle();
+            return NoSuchExtension;
+        }
+        else {
+            UnlockDisplay(dpy);
+            SyncHandle();
+            return rep.status;
+        }
+    }
+    case DEVICE_CORE:
+    {
+        XDeviceCoreControl *C = (XDeviceCoreControl *) d;
+        xDeviceCoreCtl c;
+
+        c.control = DEVICE_CORE;
+        c.length = sizeof(c);
+        c.status = C->status;
+
+        req->length += (sizeof(c) + 3) >> 2;
+        Data (dpy, (char *) &c, sizeof(c));
+
+        if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) {
+            UnlockDisplay(dpy);
+            SyncHandle();
+            return NoSuchExtension;
+        }
+        else {
+            UnlockDisplay(dpy);
+            SyncHandle();
+            return rep.status;
+        }
+    }
+    case DEVICE_ENABLE:
+    {
+        XDeviceEnableControl *E = (XDeviceEnableControl *) d;
+        xDeviceEnableCtl e;
+
+        e.control = DEVICE_ENABLE;
+        e.length = sizeof(e);
+        e.enable = E->enable;
+
+        req->length += (sizeof(e) + 3) >> 2;
+        Data (dpy, (char *) &e, sizeof(e));
+
+        if (!_XReply(dpy, (xReply *) &rep, 0, xTrue)) {
+            UnlockDisplay(dpy);
+            SyncHandle();
+            return NoSuchExtension;
+        }
+        else {
+            UnlockDisplay(dpy);
+            SyncHandle();
+            return rep.status;
+        }
+    }
+    default:
+    {
+       xDeviceCtl u;
+
+       u.control = d->control;
+       u.length = d->length - sizeof(int);
+       length = ((unsigned)(u.length + 3) >> 2);
+       req->length += length;
+       length <<= 2;
+       Data(dpy, (char *)&u, length);
+    }
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XChgFCtl.c b/src/XChgFCtl.c
new file mode 100644 (file)
index 0000000..df703a2
--- /dev/null
@@ -0,0 +1,190 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XChangeFeedbackControl - Change the control attributes of feedbacks on
+ * an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XChangeFeedbackControl(
+    register Display   *dpy,
+    XDevice            *dev,
+    unsigned long       mask,
+    XFeedbackControl   *f)
+{
+    int length;
+    xChangeFeedbackControlReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(ChangeFeedbackControl, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_ChangeFeedbackControl;
+    req->deviceid = dev->device_id;
+    req->mask = mask;
+    req->feedbackid = f->class;
+
+    if (f->class == KbdFeedbackClass) {
+       XKbdFeedbackControl *K;
+       xKbdFeedbackCtl k;
+
+       K = (XKbdFeedbackControl *) f;
+       k.class = KbdFeedbackClass;
+       k.length = sizeof(xKbdFeedbackCtl);
+       k.id = K->id;
+       k.click = K->click;
+       k.percent = K->percent;
+       k.pitch = K->pitch;
+       k.duration = K->duration;
+       k.led_mask = K->led_mask;
+       k.led_values = K->led_value;
+       k.key = K->key;
+       k.auto_repeat_mode = K->auto_repeat_mode;
+       length = ((unsigned)(k.length + 3) >> 2);
+       req->length += length;
+       length <<= 2;
+       Data(dpy, (char *)&k, length);
+    } else if (f->class == PtrFeedbackClass) {
+       XPtrFeedbackControl *P;
+       xPtrFeedbackCtl p;
+
+       P = (XPtrFeedbackControl *) f;
+       p.class = PtrFeedbackClass;
+       p.length = sizeof(xPtrFeedbackCtl);
+       p.id = P->id;
+       p.num = P->accelNum;
+       p.denom = P->accelDenom;
+       p.thresh = P->threshold;
+       length = ((unsigned)(p.length + 3) >> 2);
+       req->length += length;
+       length <<= 2;
+       Data(dpy, (char *)&p, length);
+    } else if (f->class == IntegerFeedbackClass) {
+       XIntegerFeedbackControl *I;
+       xIntegerFeedbackCtl i;
+
+       I = (XIntegerFeedbackControl *) f;
+       i.class = IntegerFeedbackClass;
+       i.length = sizeof(xIntegerFeedbackCtl);
+       i.id = I->id;
+       i.int_to_display = I->int_to_display;
+       length = ((unsigned)(i.length + 3) >> 2);
+       req->length += length;
+       length <<= 2;
+       Data(dpy, (char *)&i, length);
+    } else if (f->class == StringFeedbackClass) {
+       XStringFeedbackControl *S;
+       xStringFeedbackCtl s;
+
+       S = (XStringFeedbackControl *) f;
+       s.class = StringFeedbackClass;
+       s.length = sizeof(xStringFeedbackCtl) +
+           (S->num_keysyms * sizeof(KeySym));
+       s.id = S->id;
+       s.num_keysyms = S->num_keysyms;
+       req->length += ((unsigned)(s.length + 3) >> 2);
+       length = sizeof(xStringFeedbackCtl);
+       Data(dpy, (char *)&s, length);
+       length = (s.num_keysyms * sizeof(KeySym));
+       Data(dpy, (char *)S->syms_to_display, length);
+    } else if (f->class == BellFeedbackClass) {
+       XBellFeedbackControl *B;
+       xBellFeedbackCtl b;
+
+       B = (XBellFeedbackControl *) f;
+       b.class = BellFeedbackClass;
+       b.length = sizeof(xBellFeedbackCtl);
+       b.id = B->id;
+       b.percent = B->percent;
+       b.pitch = B->pitch;
+       b.duration = B->duration;
+       length = ((unsigned)(b.length + 3) >> 2);
+       req->length += length;
+       length <<= 2;
+       Data(dpy, (char *)&b, length);
+    } else if (f->class == LedFeedbackClass) {
+       XLedFeedbackControl *L;
+       xLedFeedbackCtl l;
+
+       L = (XLedFeedbackControl *) f;
+       l.class = LedFeedbackClass;
+       l.length = sizeof(xLedFeedbackCtl);
+       l.id = L->id;
+       l.led_mask = L->led_mask;
+       l.led_values = L->led_values;
+       length = ((unsigned)(l.length + 3) >> 2);
+       req->length += length;
+       length <<= 2;
+       Data(dpy, (char *)&l, length);
+    } else {
+       xFeedbackCtl u;
+
+       u.class = f->class;
+       u.length = f->length - sizeof(int);
+       u.id = f->id;
+       length = ((unsigned)(u.length + 3) >> 2);
+       req->length += length;
+       length <<= 2;
+       Data(dpy, (char *)&u, length);
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XChgKMap.c b/src/XChgKMap.c
new file mode 100644 (file)
index 0000000..e88b71d
--- /dev/null
@@ -0,0 +1,91 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XChangeDeviceKeyMapping - change the keymap of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XChangeDeviceKeyMapping(
+    register Display   *dpy,
+    XDevice            *dev,
+    int                         first,
+    int                         syms_per_code,
+    KeySym             *keysyms,
+    int                         count)
+{
+    register long nbytes;
+    xChangeDeviceKeyMappingReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(ChangeDeviceKeyMapping, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_ChangeDeviceKeyMapping;
+    req->deviceid = dev->device_id;
+    req->firstKeyCode = first;
+    req->keyCodes = count;
+    req->keySymsPerKeyCode = syms_per_code;
+    req->length += count * syms_per_code;
+    nbytes = syms_per_code * count * sizeof(CARD32);
+    Data(dpy, (char *)keysyms, nbytes);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XChgKbd.c b/src/XChgKbd.c
new file mode 100644 (file)
index 0000000..ab9a936
--- /dev/null
@@ -0,0 +1,84 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XChangeKeyboardDevice - Change the device used as the X keyboard.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XChangeKeyboardDevice(
+    register Display   *dpy,
+    XDevice            *dev)
+{
+    xChangeKeyboardDeviceReq *req;
+    xChangeKeyboardDeviceReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(ChangeKeyboardDevice, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_ChangeKeyboardDevice;
+    req->deviceid = dev->device_id;
+    rep.status = Success;
+
+    (void)_XReply(dpy, (xReply *) & rep, 0, xTrue);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (rep.status);
+}
diff --git a/src/XChgPnt.c b/src/XChgPnt.c
new file mode 100644 (file)
index 0000000..9caeabf
--- /dev/null
@@ -0,0 +1,88 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XChangePointerDevice - Change the device used as the X Pointer.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XChangePointerDevice(
+    register Display   *dpy,
+    XDevice            *dev,
+    int                         xaxis,
+    int                         yaxis)
+{
+    xChangePointerDeviceReq *req;
+    xChangePointerDeviceReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(ChangePointerDevice, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_ChangePointerDevice;
+    req->deviceid = dev->device_id;
+    req->xaxis = xaxis;
+    req->yaxis = yaxis;
+    rep.status = Success;
+
+    (void)_XReply(dpy, (xReply *) & rep, 0, xTrue);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (rep.status);
+}
diff --git a/src/XChgProp.c b/src/XChgProp.c
new file mode 100644 (file)
index 0000000..6d35e06
--- /dev/null
@@ -0,0 +1,94 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XChangeDeviceDontPropagateList - Get the dont_propagate_list for a
+ * window.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XChangeDeviceDontPropagateList(
+    register Display   *dpy,
+    Window              window,
+    int                         count,
+    XEventClass                *events,
+    int                         mode)
+{
+    xChangeDeviceDontPropagateListReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(ChangeDeviceDontPropagateList, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_ChangeDeviceDontPropagateList;
+    req->window = window;
+    req->count = count;
+    req->mode = mode;
+    req->length += count;
+
+    /* note: Data is a macro that uses its arguments multiple
+     * times, so "nvalues" is changed in a separate assignment
+     * statement */
+
+    count <<= 2;
+    Data32(dpy, (long *)events, count);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XCloseDev.c b/src/XCloseDev.c
new file mode 100644 (file)
index 0000000..b5f3dfc
--- /dev/null
@@ -0,0 +1,81 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XCloseDevice - Request the server to close an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XCloseDevice(
+    register Display   *dpy,
+    register XDevice   *dev)
+{
+    xCloseDeviceReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(CloseDevice, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_CloseDevice;
+    req->deviceid = dev->device_id;
+
+    XFree((char *)dev);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XDelDProp.c b/src/XDelDProp.c
new file mode 100644 (file)
index 0000000..d6594c4
--- /dev/null
@@ -0,0 +1,64 @@
+/************************************************************
+
+Copyright 2008 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.
+
+*/
+
+/***********************************************************************
+ * XDeleteDeviceProperties - delete an input device's properties.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <X11/Xlibint.h>
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+void
+XDeleteDeviceProperty(Display* dpy, XDevice* dev, Atom property)
+{
+    xDeleteDevicePropertyReq   *req;
+
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return;
+
+    GetReq(DeleteDeviceProperty, req);
+    req->reqType    = info->codes->major_opcode;
+    req->ReqType    = X_DeleteDeviceProperty;
+    req->deviceid   = dev->device_id;
+    req->property   = property;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return;
+}
+
diff --git a/src/XDevBell.c b/src/XDevBell.c
new file mode 100644 (file)
index 0000000..3792f8a
--- /dev/null
@@ -0,0 +1,86 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XDeviceBell - Ring a bell on an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XDeviceBell(
+    register Display   *dpy,
+    XDevice            *dev,
+    XID                         feedbackclass,
+    XID                         feedbackid,
+    int                         percent)
+{
+    xDeviceBellReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Add_XDeviceBell, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(DeviceBell, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_DeviceBell;
+    req->deviceid = dev->device_id;
+    req->feedbackclass = feedbackclass;
+    req->feedbackid = feedbackid;
+    req->percent = percent;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XExtInt.c b/src/XExtInt.c
new file mode 100755 (executable)
index 0000000..d4b3b69
--- /dev/null
@@ -0,0 +1,1898 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * Input Extension library internal functions.
+ *
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XI2.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/geproto.h>
+#include <X11/extensions/ge.h>
+#include <X11/extensions/Xge.h>
+#include "XIint.h"
+
+#define ENQUEUE_EVENT  True
+#define DONT_ENQUEUE   False
+#define FP1616toDBL(x) ((x) * 1.0 / (1 << 16))
+#ifdef _F_ENABLE_XI2_SENDEVENT_
+#define DBLtoFP1616(x) ((FP1616) ((x) * ((1 << 16) + 0.5)))
+#define DBLtoFP3232(x) ((int64_t) ((x) * (1 << 16) * (1 << 16) + 0.5))
+#define DBLtoFP3232frac(x) (DBLtoFP3232(x) & 0xffffffff);
+#define DBLtoFP3232integral(x) (DBLtoFP3232(x) >> 32);
+#endif//_F_ENABLE_XI2_SENDEVENT_
+
+extern void _xibaddevice(
+    Display *          /* dpy */,
+    int *              /* error */
+);
+
+extern void _xibadclass(
+    Display *          /* dpy */,
+    int *              /* error */
+);
+
+extern void _xibadevent(
+    Display *          /* dpy */,
+    int *              /* error */
+);
+
+extern void _xibadmode(
+    Display *          /* dpy */,
+    int *              /* error */
+);
+
+extern void _xidevicebusy(
+    Display *          /* dpy */,
+    int *              /* error */
+);
+
+extern int _XiGetDevicePresenceNotifyEvent(
+    Display *          /* dpy */
+);
+
+int copy_classes(XIDeviceInfo *to, xXIAnyInfo* from, int nclasses);
+int size_classes(xXIAnyInfo* from, int nclasses);
+
+static XExtensionInfo *xinput_info;
+static /* const */ char *xinput_extension_name = INAME;
+
+static int XInputClose(
+    Display *          /* dpy */,
+    XExtCodes *                /* codes */
+);
+
+static char *XInputError(
+    Display *          /* dpy */,
+    int                        /* code */,
+    XExtCodes *                /* codes */,
+    char *             /* buf */,
+    int                        /* n */
+);
+
+static Bool XInputWireToEvent(
+    Display *          /* dpy */,
+    XEvent *           /* re */,
+    xEvent *           /* event */
+);
+static Bool XInputWireToCookie(
+    Display*           /* display */,
+    XGenericEventCookie*       /* re */,
+    xEvent*            /* event */
+);
+
+#ifdef _F_ENABLE_XI2_SENDEVENT_
+static Bool XInputCookieToWire(
+    Display*           /* display */,
+    XGenericEventCookie*       /* re */,
+    xGenericEvent**            /* event */
+);
+#endif//_F_ENABLE_XI2_SENDEVENT_
+
+static Bool XInputCopyCookie(
+    Display*           /* display */,
+    XGenericEventCookie*       /* in */,
+    XGenericEventCookie*       /* out */
+);
+
+static int
+wireToDeviceEvent(xXIDeviceEvent *in, XGenericEventCookie* out);
+static int
+wireToDeviceChangedEvent(xXIDeviceChangedEvent *in, XGenericEventCookie *cookie);
+static int
+wireToHierarchyChangedEvent(xXIHierarchyEvent *in, XGenericEventCookie *cookie);
+static int
+wireToRawEvent(xXIRawEvent *in, XGenericEventCookie *cookie);
+static int
+wireToEnterLeave(xXIEnterEvent *in, XGenericEventCookie *cookie);
+static int
+wireToPropertyEvent(xXIPropertyEvent *in, XGenericEventCookie *cookie);
+
+static /* const */ XEvent emptyevent;
+
+static /* const */ XExtensionHooks xinput_extension_hooks = {
+    NULL,      /* create_gc */
+    NULL,      /* copy_gc */
+    NULL,      /* flush_gc */
+    NULL,      /* free_gc */
+    NULL,      /* create_font */
+    NULL,      /* free_font */
+    XInputClose,       /* close_display */
+    XInputWireToEvent, /* wire_to_event */
+    _XiEventToWire,    /* event_to_wire */
+    NULL,      /* error */
+    XInputError,       /* error_string */
+};
+
+static char *XInputErrorList[] = {
+    "BadDevice, invalid or uninitialized input device",        /* BadDevice */
+    "BadEvent, invalid event type",    /* BadEvent */
+    "BadMode, invalid mode parameter", /* BadMode  */
+    "DeviceBusy, device is busy",      /* DeviceBusy */
+    "BadClass, invalid event class",   /* BadClass */
+};
+
+/* Get the version supported by the server to know which number of
+* events are support. Otherwise, a wrong number of events may smash
+* the Xlib-internal event processing vector.
+*
+* Since the extension hasn't been initialized yet, we need to
+* manually get the opcode, then the version.
+*/
+static int
+_XiFindEventsSupported(Display *dpy)
+{
+    XExtCodes codes;
+    XExtensionVersion *extversion = NULL;
+    int nevents = 0;
+
+    if (!XQueryExtension(dpy, INAME, &codes.major_opcode,
+                         &codes.first_event, &codes.first_error))
+        goto out;
+
+    LockDisplay(dpy);
+    extversion = _XiGetExtensionVersionRequest(dpy, INAME, codes.major_opcode);
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    if (!extversion || !extversion->present)
+        goto out;
+
+    if (extversion->major_version >= 2)
+        nevents = IEVENTS; /* number is fixed, XI2 adds GenericEvents only */
+    else if (extversion->major_version <= 0)
+    {
+        printf("XInput_find_display: invalid extension version %d.%d\n",
+                extversion->major_version, extversion->minor_version);
+        goto out;
+    }
+    else
+    {
+        switch(extversion->minor_version)
+        {
+            case XI_Add_DeviceProperties_Minor:
+                nevents = XI_DevicePropertyNotify + 1;
+                break;
+            case  XI_Add_DevicePresenceNotify_Minor:
+                nevents = XI_DevicePresenceNotify + 1;
+                break;
+            default:
+                nevents = XI_DeviceButtonstateNotify + 1;
+                break;
+        }
+    }
+
+out:
+    if (extversion)
+        XFree(extversion);
+    return nevents;
+}
+
+
+_X_HIDDEN
+XExtDisplayInfo *XInput_find_display (Display *dpy)
+{
+    XExtDisplayInfo *dpyinfo;
+    if (!xinput_info) { if (!(xinput_info = XextCreateExtension())) return NULL; }
+    if (!(dpyinfo = XextFindDisplay (xinput_info, dpy)))
+    {
+      int nevents = _XiFindEventsSupported(dpy);
+
+      dpyinfo = XextAddDisplay (xinput_info, dpy,
+                                xinput_extension_name,
+                                &xinput_extension_hooks,
+                                nevents, NULL);
+      if (dpyinfo->codes) /* NULL if XI doesn't exist on the server */
+      {
+          XESetWireToEventCookie(dpy, dpyinfo->codes->major_opcode, XInputWireToCookie);
+#ifdef _F_ENABLE_XI2_SENDEVENT_
+          XESetEventCookieToWire(dpy, dpyinfo->codes->major_opcode, XInputCookieToWire);
+#endif//_F_ENABLE_XI2_SENDEVENT_
+          XESetCopyEventCookie(dpy, dpyinfo->codes->major_opcode, XInputCopyCookie);
+      }
+    }
+    return dpyinfo;
+}
+
+static XEXT_GENERATE_ERROR_STRING(XInputError, xinput_extension_name,
+                                  IERRORS, XInputErrorList)
+/*******************************************************************
+*
+* Input extension versions.
+*
+*/
+static XExtensionVersion versions[] = { {XI_Absent, 0, 0},
+{XI_Present, XI_Initial_Release_Major, XI_Initial_Release_Minor},
+{XI_Present, XI_Add_XDeviceBell_Major, XI_Add_XDeviceBell_Minor},
+{XI_Present, XI_Add_XSetDeviceValuators_Major,
+ XI_Add_XSetDeviceValuators_Minor},
+{XI_Present, XI_Add_XChangeDeviceControl_Major,
+ XI_Add_XChangeDeviceControl_Minor},
+{XI_Present, XI_Add_DevicePresenceNotify_Major,
+ XI_Add_DevicePresenceNotify_Minor},
+{XI_Present, XI_Add_DeviceProperties_Major,
+ XI_Add_DeviceProperties_Minor},
+{XI_Present, XI_2_Major, XI_2_Minor}
+};
+
+/***********************************************************************
+ *
+ * Return errors reported by this extension.
+ *
+ */
+
+void
+_xibaddevice(
+    Display    *dpy,
+    int                *error)
+{
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    *error = info->codes->first_error + XI_BadDevice;
+}
+
+void
+_xibadclass(
+    Display    *dpy,
+    int                *error)
+{
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    *error = info->codes->first_error + XI_BadClass;
+}
+
+void
+_xibadevent(
+    Display    *dpy,
+    int                *error)
+{
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    *error = info->codes->first_error + XI_BadEvent;
+}
+
+void
+_xibadmode(
+    Display    *dpy,
+    int                *error)
+{
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    *error = info->codes->first_error + XI_BadMode;
+}
+
+void
+_xidevicebusy(
+    Display    *dpy,
+    int                *error)
+{
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    *error = info->codes->first_error + XI_DeviceBusy;
+}
+
+static int XInputCheckExtension(Display *dpy, XExtDisplayInfo *info)
+{
+    XextCheckExtension (dpy, info, xinput_extension_name, 0);
+    return 1;
+}
+
+/***********************************************************************
+ *
+ * Check to see if the input extension is installed in the server.
+ * Also check to see if the version is >= the requested version.
+ *
+ */
+
+_X_HIDDEN int
+_XiCheckExtInit(
+    register Display   *dpy,
+    register int        version_index,
+    XExtDisplayInfo    *info)
+{
+    XExtensionVersion *ext;
+
+    if (!XInputCheckExtension(dpy, info)) {
+       UnlockDisplay(dpy);
+       return (-1);
+    }
+
+    if (info->data == NULL) {
+       info->data = (XPointer) Xmalloc(sizeof(XInputData));
+       if (!info->data) {
+           UnlockDisplay(dpy);
+           return (-1);
+       }
+       ((XInputData *) info->data)->vers =
+           _XiGetExtensionVersion(dpy, "XInputExtension", info);
+    }
+
+    if (versions[version_index].major_version > Dont_Check) {
+       ext = ((XInputData *) info->data)->vers;
+       if ((ext->major_version < versions[version_index].major_version) ||
+           ((ext->major_version == versions[version_index].major_version) &&
+            (ext->minor_version < versions[version_index].minor_version))) {
+           UnlockDisplay(dpy);
+           return (-1);
+       }
+    }
+    return (0);
+}
+
+/***********************************************************************
+ *
+ * Close display routine.
+ *
+ */
+
+static int
+XInputClose(
+    Display    *dpy,
+    XExtCodes  *codes)
+{
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    if (info->data != NULL) {
+       XFree((char *)((XInputData *) info->data)->vers);
+       XFree((char *)info->data);
+    }
+    return XextRemoveDisplay(xinput_info, dpy);
+}
+
+static int
+Ones(Mask mask)
+{
+    register Mask y;
+
+    y = (mask >> 1) & 033333333333;
+    y = mask - y - ((y >> 1) & 033333333333);
+    return (((y + (y >> 3)) & 030707070707) % 077);
+}
+
+static int count_bits(unsigned char* ptr, int len)
+{
+    int bits = 0;
+    unsigned int i;
+    unsigned char x;
+
+    for (i = 0; i < len; i++)
+    {
+        x = ptr[i];
+        while(x > 0)
+        {
+            bits += (x & 0x1);
+            x >>= 1;
+        }
+    }
+    return bits;
+}
+
+int
+_XiGetDevicePresenceNotifyEvent(Display * dpy)
+{
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    return info->codes->first_event + XI_DevicePresenceNotify;
+}
+
+/***********************************************************************
+ *
+ * Handle Input extension events.
+ * Reformat a wire event into an XEvent structure of the right type.
+ *
+ */
+
+static Bool
+XInputWireToEvent(
+    Display    *dpy,
+    XEvent     *re,
+    xEvent     *event)
+{
+    unsigned int type, reltype;
+    unsigned int i, j;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+    XEvent *save = (XEvent *) info->data;
+
+    type = event->u.u.type & 0x7f;
+    reltype = (type - info->codes->first_event);
+
+    if (type == GenericEvent || 
+        (reltype != XI_DeviceValuator &&
+       reltype != XI_DeviceKeystateNotify &&
+       reltype != XI_DeviceButtonstateNotify)) {
+       *save = emptyevent;
+       save->type = type;
+       ((XAnyEvent *) save)->serial = _XSetLastRequestRead(dpy,
+                                                           (xGenericReply *)
+                                                           event);
+       ((XAnyEvent *) save)->send_event = ((event->u.u.type & 0x80) != 0);
+       ((XAnyEvent *) save)->display = dpy;
+    }
+
+    /* Process traditional events */
+    if (type != GenericEvent)
+    {
+        switch (reltype) {
+            case XI_DeviceMotionNotify:
+                {
+                    register XDeviceMotionEvent *ev = (XDeviceMotionEvent *) save;
+                    deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
+
+                    ev->root = ev2->root;
+                    ev->window = ev2->event;
+                    ev->subwindow = ev2->child;
+                    ev->time = ev2->time;
+                    ev->x_root = ev2->root_x;
+                    ev->y_root = ev2->root_y;
+                    ev->x = ev2->event_x;
+                    ev->y = ev2->event_y;
+                    ev->state = ev2->state;
+                    ev->same_screen = ev2->same_screen;
+                    ev->is_hint = ev2->detail;
+                    ev->deviceid = ev2->deviceid & DEVICE_BITS;
+                    return (DONT_ENQUEUE);
+                }
+                break;
+            case XI_DeviceKeyPress:
+            case XI_DeviceKeyRelease:
+                {
+                    register XDeviceKeyEvent *ev = (XDeviceKeyEvent *) save;
+                    deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
+
+                    ev->root = ev2->root;
+                    ev->window = ev2->event;
+                    ev->subwindow = ev2->child;
+                    ev->time = ev2->time;
+                    ev->x_root = ev2->root_x;
+                    ev->y_root = ev2->root_y;
+                    ev->x = ev2->event_x;
+                    ev->y = ev2->event_y;
+                    ev->state = ev2->state;
+                    ev->same_screen = ev2->same_screen;
+                    ev->keycode = ev2->detail;
+                    ev->deviceid = ev2->deviceid & DEVICE_BITS;
+                    if (ev2->deviceid & MORE_EVENTS)
+                        return (DONT_ENQUEUE);
+                    else {
+                        *re = *save;
+                        return (ENQUEUE_EVENT);
+                    }
+                }
+                break;
+            case XI_DeviceButtonPress:
+            case XI_DeviceButtonRelease:
+                {
+                    register XDeviceButtonEvent *ev = (XDeviceButtonEvent *) save;
+                    deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
+
+                    ev->root = ev2->root;
+                    ev->window = ev2->event;
+                    ev->subwindow = ev2->child;
+                    ev->time = ev2->time;
+                    ev->x_root = ev2->root_x;
+                    ev->y_root = ev2->root_y;
+                    ev->x = ev2->event_x;
+                    ev->y = ev2->event_y;
+                    ev->state = ev2->state;
+                    ev->same_screen = ev2->same_screen;
+                    ev->button = ev2->detail;
+                    ev->deviceid = ev2->deviceid & DEVICE_BITS;
+                    if (ev2->deviceid & MORE_EVENTS)
+                        return (DONT_ENQUEUE);
+                    else {
+                        *re = *save;
+                        return (ENQUEUE_EVENT);
+                    }
+                }
+                break;
+            case XI_ProximityIn:
+            case XI_ProximityOut:
+                {
+                    register XProximityNotifyEvent *ev = (XProximityNotifyEvent *) save;
+                    deviceKeyButtonPointer *ev2 = (deviceKeyButtonPointer *) event;
+
+                    ev->root = ev2->root;
+                    ev->window = ev2->event;
+                    ev->subwindow = ev2->child;
+                    ev->time = ev2->time;
+                    ev->x_root = ev2->root_x;
+                    ev->y_root = ev2->root_y;
+                    ev->x = ev2->event_x;
+                    ev->y = ev2->event_y;
+                    ev->state = ev2->state;
+                    ev->same_screen = ev2->same_screen;
+                    ev->deviceid = ev2->deviceid & DEVICE_BITS;
+                    if (ev2->deviceid & MORE_EVENTS)
+                        return (DONT_ENQUEUE);
+                    else {
+                        *re = *save;
+                        return (ENQUEUE_EVENT);
+                    }
+                }
+                break;
+            case XI_DeviceValuator:
+                {
+                    deviceValuator *xev = (deviceValuator *) event;
+                    int save_type = save->type - info->codes->first_event;
+
+                    if (save_type == XI_DeviceKeyPress || save_type == XI_DeviceKeyRelease) {
+                        XDeviceKeyEvent *kev = (XDeviceKeyEvent *) save;
+
+                        kev->device_state = xev->device_state;
+                        kev->axes_count = xev->num_valuators;
+                        kev->first_axis = xev->first_valuator;
+                        i = xev->num_valuators;
+                        if (i > 6)
+                            i = 6;
+                        switch (i) {
+                            case 6:
+                                kev->axis_data[5] = xev->valuator5;
+                            case 5:
+                                kev->axis_data[4] = xev->valuator4;
+                            case 4:
+                                kev->axis_data[3] = xev->valuator3;
+                            case 3:
+                                kev->axis_data[2] = xev->valuator2;
+                            case 2:
+                                kev->axis_data[1] = xev->valuator1;
+                            case 1:
+                                kev->axis_data[0] = xev->valuator0;
+                        }
+                    } else if (save_type == XI_DeviceButtonPress ||
+                            save_type == XI_DeviceButtonRelease) {
+                        XDeviceButtonEvent *bev = (XDeviceButtonEvent *) save;
+
+                        bev->device_state = xev->device_state;
+                        bev->axes_count = xev->num_valuators;
+                        bev->first_axis = xev->first_valuator;
+                        i = xev->num_valuators;
+                        if (i > 6)
+                            i = 6;
+                        switch (i) {
+                            case 6:
+                                bev->axis_data[5] = xev->valuator5;
+                            case 5:
+                                bev->axis_data[4] = xev->valuator4;
+                            case 4:
+                                bev->axis_data[3] = xev->valuator3;
+                            case 3:
+                                bev->axis_data[2] = xev->valuator2;
+                            case 2:
+                                bev->axis_data[1] = xev->valuator1;
+                            case 1:
+                                bev->axis_data[0] = xev->valuator0;
+                        }
+                    } else if (save_type == XI_DeviceMotionNotify) {
+                        XDeviceMotionEvent *mev = (XDeviceMotionEvent *) save;
+
+                        mev->device_state = xev->device_state;
+                        mev->axes_count = xev->num_valuators;
+                        mev->first_axis = xev->first_valuator;
+                        i = xev->num_valuators;
+                        if (i > 6)
+                            i = 6;
+                        switch (i) {
+                            case 6:
+                                mev->axis_data[5] = xev->valuator5;
+                            case 5:
+                                mev->axis_data[4] = xev->valuator4;
+                            case 4:
+                                mev->axis_data[3] = xev->valuator3;
+                            case 3:
+                                mev->axis_data[2] = xev->valuator2;
+                            case 2:
+                                mev->axis_data[1] = xev->valuator1;
+                            case 1:
+                                mev->axis_data[0] = xev->valuator0;
+                        }
+                    } else if (save_type == XI_ProximityIn || save_type == XI_ProximityOut) {
+                        XProximityNotifyEvent *pev = (XProximityNotifyEvent *) save;
+
+                        pev->device_state = xev->device_state;
+                        pev->axes_count = xev->num_valuators;
+                        pev->first_axis = xev->first_valuator;
+                        i = xev->num_valuators;
+                        if (i > 6)
+                            i = 6;
+                        switch (i) {
+                            case 6:
+                                pev->axis_data[5] = xev->valuator5;
+                            case 5:
+                                pev->axis_data[4] = xev->valuator4;
+                            case 4:
+                                pev->axis_data[3] = xev->valuator3;
+                            case 3:
+                                pev->axis_data[2] = xev->valuator2;
+                            case 2:
+                                pev->axis_data[1] = xev->valuator1;
+                            case 1:
+                                pev->axis_data[0] = xev->valuator0;
+                        }
+                    } else if (save_type == XI_DeviceStateNotify) {
+                        XDeviceStateNotifyEvent *sev = (XDeviceStateNotifyEvent *) save;
+                        XInputClass *any = (XInputClass *) & sev->data[0];
+                        XValuatorStatus *v;
+
+                        for (i = 0; i < sev->num_classes; i++)
+                            if (any->class != ValuatorClass)
+                                any = (XInputClass *) ((char *)any + any->length);
+                        v = (XValuatorStatus *) any;
+                        i = v->num_valuators;
+                        j = xev->num_valuators;
+                        if (j > 3)
+                            j = 3;
+                        switch (j) {
+                            case 3:
+                                v->valuators[i + 2] = xev->valuator2;
+                            case 2:
+                                v->valuators[i + 1] = xev->valuator1;
+                            case 1:
+                                v->valuators[i + 0] = xev->valuator0;
+                        }
+                        v->num_valuators += j;
+
+                    }
+                    *re = *save;
+                    return (ENQUEUE_EVENT);
+                }
+                break;
+            case XI_DeviceFocusIn:
+            case XI_DeviceFocusOut:
+                {
+                    register XDeviceFocusChangeEvent *ev = (XDeviceFocusChangeEvent *) re;
+                    deviceFocus *fev = (deviceFocus *) event;
+
+                    *ev = *((XDeviceFocusChangeEvent *) save);
+                    ev->window = fev->window;
+                    ev->time = fev->time;
+                    ev->mode = fev->mode;
+                    ev->detail = fev->detail;
+                    ev->deviceid = fev->deviceid & DEVICE_BITS;
+                    return (ENQUEUE_EVENT);
+                }
+                break;
+            case XI_DeviceStateNotify:
+                {
+                    XDeviceStateNotifyEvent *stev = (XDeviceStateNotifyEvent *) save;
+                    deviceStateNotify *sev = (deviceStateNotify *) event;
+                    char *data;
+
+                    stev->window = None;
+                    stev->deviceid = sev->deviceid & DEVICE_BITS;
+                    stev->time = sev->time;
+                    stev->num_classes = Ones((Mask) sev->classes_reported & InputClassBits);
+                    data = (char *)&stev->data[0];
+                    if (sev->classes_reported & (1 << KeyClass)) {
+                        register XKeyStatus *kstev = (XKeyStatus *) data;
+
+                        kstev->class = KeyClass;
+                        kstev->length = sizeof(XKeyStatus);
+                        kstev->num_keys = sev->num_keys;
+                        memcpy((char *)&kstev->keys[0], (char *)&sev->keys[0], 4);
+                        data += sizeof(XKeyStatus);
+                    }
+                    if (sev->classes_reported & (1 << ButtonClass)) {
+                        register XButtonStatus *bev = (XButtonStatus *) data;
+
+                        bev->class = ButtonClass;
+                        bev->length = sizeof(XButtonStatus);
+                        bev->num_buttons = sev->num_buttons;
+                        memcpy((char *)bev->buttons, (char *)sev->buttons, 4);
+                        data += sizeof(XButtonStatus);
+                    }
+                    if (sev->classes_reported & (1 << ValuatorClass)) {
+                        register XValuatorStatus *vev = (XValuatorStatus *) data;
+
+                        vev->class = ValuatorClass;
+                        vev->length = sizeof(XValuatorStatus);
+                        vev->num_valuators = sev->num_valuators;
+                        vev->mode = sev->classes_reported >> ModeBitsShift;
+                        j = sev->num_valuators;
+                        if (j > 3)
+                            j = 3;
+                        switch (j) {
+                            case 3:
+                                vev->valuators[2] = sev->valuator2;
+                            case 2:
+                                vev->valuators[1] = sev->valuator1;
+                            case 1:
+                                vev->valuators[0] = sev->valuator0;
+                        }
+                        data += sizeof(XValuatorStatus);
+                    }
+                    if (sev->deviceid & MORE_EVENTS)
+                        return (DONT_ENQUEUE);
+                    else {
+                        *re = *save;
+                        stev = (XDeviceStateNotifyEvent *) re;
+                        return (ENQUEUE_EVENT);
+                    }
+                }
+                break;
+            case XI_DeviceKeystateNotify:
+                {
+                    int i;
+                    XInputClass *anyclass;
+                    register XKeyStatus *kv;
+                    deviceKeyStateNotify *ksev = (deviceKeyStateNotify *) event;
+                    XDeviceStateNotifyEvent *kstev = (XDeviceStateNotifyEvent *) save;
+
+                    anyclass = (XInputClass *) & kstev->data[0];
+                    for (i = 0; i < kstev->num_classes; i++)
+                        if (anyclass->class == KeyClass)
+                            break;
+                        else
+                            anyclass = (XInputClass *) ((char *)anyclass +
+                                    anyclass->length);
+
+                    kv = (XKeyStatus *) anyclass;
+                    kv->num_keys = 256;
+                    memcpy((char *)&kv->keys[4], (char *)ksev->keys, 28);
+                    if (ksev->deviceid & MORE_EVENTS)
+                        return (DONT_ENQUEUE);
+                    else {
+                        *re = *save;
+                        kstev = (XDeviceStateNotifyEvent *) re;
+                        return (ENQUEUE_EVENT);
+                    }
+                }
+                break;
+            case XI_DeviceButtonstateNotify:
+                {
+                    int i;
+                    XInputClass *anyclass;
+                    register XButtonStatus *bv;
+                    deviceButtonStateNotify *bsev = (deviceButtonStateNotify *) event;
+                    XDeviceStateNotifyEvent *bstev = (XDeviceStateNotifyEvent *) save;
+
+                    anyclass = (XInputClass *) & bstev->data[0];
+                    for (i = 0; i < bstev->num_classes; i++)
+                        if (anyclass->class == ButtonClass)
+                            break;
+                        else
+                            anyclass = (XInputClass *) ((char *)anyclass +
+                                    anyclass->length);
+
+                    bv = (XButtonStatus *) anyclass;
+                    bv->num_buttons = 256;
+                    memcpy((char *)&bv->buttons[4], (char *)bsev->buttons, 28);
+                    if (bsev->deviceid & MORE_EVENTS)
+                        return (DONT_ENQUEUE);
+                    else {
+                        *re = *save;
+                        bstev = (XDeviceStateNotifyEvent *) re;
+                        return (ENQUEUE_EVENT);
+                    }
+                }
+                break;
+            case XI_DeviceMappingNotify:
+                {
+                    register XDeviceMappingEvent *ev = (XDeviceMappingEvent *) re;
+                    deviceMappingNotify *ev2 = (deviceMappingNotify *) event;
+
+                    *ev = *((XDeviceMappingEvent *) save);
+                    ev->window = 0;
+                    ev->first_keycode = ev2->firstKeyCode;
+                    ev->request = ev2->request;
+                    ev->count = ev2->count;
+                    ev->time = ev2->time;
+                    ev->deviceid = ev2->deviceid & DEVICE_BITS;
+                    return (ENQUEUE_EVENT);
+                }
+                break;
+            case XI_ChangeDeviceNotify:
+                {
+                    register XChangeDeviceNotifyEvent *ev = (XChangeDeviceNotifyEvent *) re;
+                    changeDeviceNotify *ev2 = (changeDeviceNotify *) event;
+
+                    *ev = *((XChangeDeviceNotifyEvent *) save);
+                    ev->window = 0;
+                    ev->request = ev2->request;
+                    ev->time = ev2->time;
+                    ev->deviceid = ev2->deviceid & DEVICE_BITS;
+                    return (ENQUEUE_EVENT);
+                }
+                break;
+
+            case XI_DevicePresenceNotify:
+                {
+                    XDevicePresenceNotifyEvent *ev = (XDevicePresenceNotifyEvent *) re;
+                    devicePresenceNotify *ev2 = (devicePresenceNotify *) event;
+
+                    *ev = *(XDevicePresenceNotifyEvent *) save;
+                    ev->window = 0;
+                    ev->time = ev2->time;
+                    ev->devchange = ev2->devchange;
+                    ev->deviceid = ev2->deviceid;
+                    ev->control = ev2->control;
+                    return (ENQUEUE_EVENT);
+                }
+                break;
+            case XI_DevicePropertyNotify:
+                {
+                    XDevicePropertyNotifyEvent* ev = (XDevicePropertyNotifyEvent*)re;
+                    devicePropertyNotify *ev2 = (devicePropertyNotify*)event;
+
+                    *ev = *(XDevicePropertyNotifyEvent*)save;
+                    ev->time = ev2->time;
+                    ev->deviceid = ev2->deviceid;
+                    ev->atom = ev2->atom;
+                    ev->state = ev2->state;
+                    return ENQUEUE_EVENT;
+                }
+                break;
+            default:
+                printf("XInputWireToEvent: UNKNOWN WIRE EVENT! type=%d\n", type);
+                break;
+        }
+    }
+    return (DONT_ENQUEUE);
+}
+
+static void xge_copy_to_cookie(xGenericEvent* ev,
+                               XGenericEventCookie *cookie)
+{
+#ifndef _F_ENABLE_XI2_SENDEVENT_
+    cookie->type = ev->type;
+#else//_F_ENABLE_XI2_SENDEVENT_
+    cookie->type = ev->type & 0x7f;
+#endif//_F_ENABLE_XI2_SENDEVENT_
+    cookie->evtype = ev->evtype;
+    cookie->extension = ev->extension;
+}
+
+static Bool
+XInputWireToCookie(
+    Display    *dpy,
+    XGenericEventCookie *cookie,
+    xEvent     *event)
+{
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+    XEvent *save = (XEvent *) info->data;
+    xGenericEvent* ge = (xGenericEvent*)event;
+
+    if (ge->extension != info->codes->major_opcode)
+    {
+        printf("XInputWireToCookie: wrong extension opcode %d\n",
+                ge->extension);
+        return DONT_ENQUEUE;
+    }
+
+    *save = emptyevent;
+#ifndef _F_ENABLE_XI2_SENDEVENT_
+    save->type = event->u.u.type;
+#else//_F_ENABLE_XI2_SENDEVENT_
+    xge_copy_to_cookie((xGenericEvent*)event, (XGenericEventCookie*)save);
+#endif//_F_ENABLE_XI2_SENDEVENT_
+    ((XAnyEvent*)save)->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event);
+    ((XAnyEvent*)save)->send_event = ((event->u.u.type & 0x80) != 0);
+    ((XAnyEvent*)save)->display = dpy;
+
+#ifndef _F_ENABLE_XI2_SENDEVENT_
+    xge_copy_to_cookie((xGenericEvent*)event, (XGenericEventCookie*)save);
+#endif//_F_ENABLE_XI2_SENDEVENT_
+    switch(ge->evtype)
+    {
+        case XI_Motion:
+        case XI_ButtonPress:
+        case XI_ButtonRelease:
+        case XI_KeyPress:
+        case XI_KeyRelease:
+            *cookie = *(XGenericEventCookie*)save;
+            if (!wireToDeviceEvent((xXIDeviceEvent*)event, cookie))
+            {
+                printf("XInputWireToCookie: CONVERSION FAILURE!  evtype=%d\n",
+                        ge->evtype);
+                break;
+            }
+            return ENQUEUE_EVENT;
+        case XI_DeviceChanged:
+            *cookie = *(XGenericEventCookie*)save;
+            if (!wireToDeviceChangedEvent((xXIDeviceChangedEvent*)event, cookie))
+            {
+                printf("XInputWireToCookie: CONVERSION FAILURE!  evtype=%d\n",
+                        ge->evtype);
+                break;
+            }
+            return ENQUEUE_EVENT;
+        case XI_HierarchyChanged:
+            *cookie = *(XGenericEventCookie*)save;
+            if (!wireToHierarchyChangedEvent((xXIHierarchyEvent*)event, cookie))
+            {
+                printf("XInputWireToCookie: CONVERSION FAILURE!  evtype=%d\n",
+                        ge->evtype);
+                break;
+            }
+            return ENQUEUE_EVENT;
+
+        case XI_RawKeyPress:
+        case XI_RawKeyRelease:
+        case XI_RawButtonPress:
+        case XI_RawButtonRelease:
+        case XI_RawMotion:
+            *cookie = *(XGenericEventCookie*)save;
+            if (!wireToRawEvent((xXIRawEvent*)event, cookie))
+            {
+                printf("XInputWireToCookie: CONVERSION FAILURE!  evtype=%d\n",
+                        ge->evtype);
+                break;
+            }
+            return ENQUEUE_EVENT;
+        case XI_Enter:
+        case XI_Leave:
+        case XI_FocusIn:
+        case XI_FocusOut:
+            *cookie = *(XGenericEventCookie*)save;
+            if (!wireToEnterLeave((xXIEnterEvent*)event, cookie))
+            {
+                printf("XInputWireToCookie: CONVERSION FAILURE!  evtype=%d\n",
+                        ge->evtype);
+                break;
+            }
+            return ENQUEUE_EVENT;
+        case XI_PropertyEvent:
+            *cookie = *(XGenericEventCookie*)save;
+            if (!wireToPropertyEvent((xXIPropertyEvent*)event, cookie))
+            {
+                printf("XInputWireToCookie: CONVERSION FAILURE!  evtype=%d\n",
+                        ge->evtype);
+                break;
+            }
+            return ENQUEUE_EVENT;
+        default:
+            printf("XInputWireToCookie: Unknown generic event. type %d\n", ge->evtype);
+
+    }
+    return DONT_ENQUEUE;
+}
+
+#ifdef _F_ENABLE_XI2_SENDEVENT_
+static Bool
+XInputCookieToWire(
+    Display    *dpy,
+    XGenericEventCookie *re,
+    xGenericEvent **event)
+{
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+    XGenericEventCookie *xcookie = (XGenericEventCookie *) re;
+
+    switch (((XGenericEvent*)re)->evtype)
+    {
+    case XI_Motion:
+    case XI_ButtonPress:
+    case XI_ButtonRelease:
+    case XI_KeyPress:
+    case XI_KeyRelease: {
+        register XIDeviceEvent *xev = (XIDeviceEvent *) xcookie->data;
+        register xXIDeviceEvent *wev = (xXIDeviceEvent *) event;
+        int buttons_len = (xev->buttons.mask_len + 3) >> 2;
+        int valuators_len = (xev->valuators.mask_len + 3) >> 2;
+        int i, n_valuators, len;
+        unsigned char *ptr;
+        FP3232 *values;
+
+        n_valuators = count_bits (xev->valuators.mask, xev->valuators.mask_len);
+
+        len = sizeof (xXIDeviceEvent);
+        len += buttons_len << 2;
+        len += valuators_len << 2;
+        len += n_valuators * sizeof (FP3232);
+
+        wev = (xXIDeviceEvent *) Xmalloc(len);
+
+        if (!wev)
+            return (_XUnknownEventCookie(dpy, re, event));
+
+        *event = (xGenericEvent *) wev;
+
+        wev->type = GenericEvent;
+        wev->extension = info->codes->major_opcode;
+        wev->sequenceNumber = xev->serial & 0xFFFF;
+        wev->length = (len - sizeof (xEvent) + 3) >> 2;
+        wev->evtype = xev->evtype;
+        wev->deviceid = xev->deviceid;
+        wev->time = xev->time;
+        wev->detail = xev->detail;
+        wev->root = xev->root;
+        wev->event = xev->event;
+        wev->child = xev->child;
+
+        if (xev->sourceid != 0)
+            wev->sourceid = xev->sourceid;
+        else
+            wev->sourceid = xev->deviceid;
+
+        wev->flags = xev->flags;
+
+        wev->root_x = DBLtoFP1616(xev->root_x);
+        wev->root_y = DBLtoFP1616(xev->root_y);
+        wev->event_x = DBLtoFP1616(xev->event_x);
+        wev->event_y = DBLtoFP1616(xev->event_y);
+
+        wev->mods.base_mods = xev->mods.base;
+        wev->mods.latched_mods = xev->mods.latched;
+        wev->mods.locked_mods = xev->mods.locked;
+        wev->mods.effective_mods = xev->mods.effective;
+
+        wev->group.base_group = xev->group.base;
+        wev->group.latched_group = xev->group.latched;
+        wev->group.locked_group = xev->group.locked;
+        wev->group.effective_group = xev->group.effective;
+
+        wev->buttons_len = (xev->buttons.mask_len + 3) >> 2;
+        wev->valuators_len = (xev->valuators.mask_len + 3) >> 2;
+
+        /* Fill in trailing button mask */
+        ptr = (unsigned char *) &wev[1];
+        memcpy (ptr, xev->buttons.mask, xev->buttons.mask_len);
+        ptr += wev->buttons_len << 2;
+
+        /* Fill in valuator mask and values */
+        memcpy (ptr, xev->valuators.mask, xev->valuators.mask_len);
+        ptr += wev->valuators_len << 2;
+
+        values = (FP3232 *) ptr;
+
+        for (i = 0; i < n_valuators; i++, values++) {
+            values->frac = DBLtoFP3232frac(xev->valuators.values[i]);
+            values->integral = DBLtoFP3232integral(xev->valuators.values[i]);
+        }
+
+        return True;
+    }
+    case XI_RawKeyPress:
+    case XI_RawKeyRelease:
+    case XI_RawButtonPress:
+    case XI_RawButtonRelease:
+    case XI_RawMotion: {
+        register XIRawEvent *rev = (XIRawEvent *) xcookie->data;
+        register xXIRawEvent *wev = (xXIRawEvent *) event;
+        int valuators_len = (rev->valuators.mask_len + 3) >> 2;
+        int i, n_valuators, len;
+        unsigned char *ptr;
+        FP3232 *values;
+
+        n_valuators = count_bits (rev->valuators.mask, rev->valuators.mask_len);
+
+        len = sizeof (xXIRawEvent);
+        len += valuators_len << 2;
+        len += n_valuators * sizeof (FP3232) * 2; /* raw + normal */
+
+        wev = (xXIRawEvent *) Xmalloc(len);
+
+        if (!wev)
+            return (_XUnknownEventCookie(dpy, re, event));
+
+        *event = (xGenericEvent *) wev;
+
+        wev->type = GenericEvent;
+        wev->extension = info->codes->major_opcode;
+        wev->sequenceNumber = rev->serial & 0xFFFF;
+        wev->length = (len - sizeof (xEvent) + 3) >> 2;
+        wev->evtype = rev->evtype;
+        wev->deviceid = rev->deviceid;
+        wev->time = rev->time;
+        wev->detail = rev->detail;
+        wev->flags = rev->flags;
+
+        wev->valuators_len = (rev->valuators.mask_len + 3) >> 2;
+
+        /* Fill in trailing valuator mask and values */
+        ptr = (unsigned char *) &wev[1];
+        memcpy (ptr, rev->valuators.mask, rev->valuators.mask_len);
+        ptr += wev->valuators_len << 2;
+
+        values = (FP3232 *) ptr;
+
+        /* Normal values */
+        for (i = 0; i < n_valuators; i++, values++) {
+            values->frac = DBLtoFP3232frac(rev->valuators.values[i]);
+            values->integral = DBLtoFP3232integral(rev->valuators.values[i]);
+        }
+
+        /* Raw values */
+        for (i = 0; i < n_valuators; i++, values++) {
+            values->frac = DBLtoFP3232frac(rev->raw_values[i]);
+            values->integral = DBLtoFP3232integral(rev->raw_values[i]);
+        }
+
+        return True;
+    }
+    }
+
+    return False;
+}
+#endif//_F_ENABLE_XI2_SENDEVENT_
+
+/**
+ * Calculate length in bytes needed for the device event with the given
+ * button mask length, valuator mask length + valuator mask. All parameters
+ * in bytes.
+ */
+static inline int
+sizeDeviceEvent(int buttons_len, int valuators_len,
+                unsigned char *valuators_mask)
+{
+    int len;
+
+    len = sizeof(XIDeviceEvent);
+    len += sizeof(XIButtonState) + buttons_len;
+    len += sizeof(XIValuatorState) + valuators_len;
+    len += count_bits(valuators_mask, valuators_len) * sizeof(double);
+    len += sizeof(XIModifierState) + sizeof(XIGroupState);
+
+    return len;
+}
+
+/**
+ * Return the size in bytes required to store the matching class type
+ * num_elements is num_buttons for XIButtonClass or num_keycodes for
+ * XIKeyClass.
+ *
+ * Also used from copy_classes in XIQueryDevice.c
+ */
+static int
+sizeDeviceClassType(int type, int num_elements)
+{
+    int l = 0;
+    switch(type)
+    {
+        case XIButtonClass:
+            l = sizeof(XIButtonClassInfo);
+            l += num_elements * sizeof(Atom);
+            l += ((((num_elements + 7)/8) + 3)/4) * 4;
+            break;
+        case XIKeyClass:
+            l = sizeof(XIKeyClassInfo);
+            l += num_elements * sizeof(int);
+            break;
+        case XIValuatorClass:
+            l = sizeof(XIValuatorClassInfo);
+            break;
+        default:
+            printf("sizeDeviceClassType: unknown type %d\n", type);
+            break;
+    }
+    return l;
+}
+
+static Bool
+copyHierarchyEvent(XGenericEventCookie *cookie_in,
+                   XGenericEventCookie *cookie_out)
+{
+    XIHierarchyEvent *in, *out;
+    void *ptr;
+
+    in = cookie_in->data;
+
+    ptr = cookie_out->data = malloc(sizeof(XIHierarchyEvent) +
+                                    in->num_info * sizeof(XIHierarchyInfo));
+    if (!ptr)
+        return False;
+
+    out = next_block(&ptr, sizeof(XIHierarchyEvent));
+    *out = *in;
+    out->info = next_block(&ptr, in->num_info * sizeof(XIHierarchyInfo));
+    memcpy(out->info, in->info, in->num_info * sizeof(XIHierarchyInfo));
+
+    return True;
+}
+
+static Bool
+copyDeviceChangedEvent(XGenericEventCookie *in_cookie,
+                       XGenericEventCookie *out_cookie)
+{
+    int len, i;
+    XIDeviceChangedEvent *in, *out;
+    XIAnyClassInfo *any;
+    void *ptr;
+
+    in = in_cookie->data;
+
+    len = sizeof(XIDeviceChangedEvent);
+    len += in->num_classes * sizeof(XIAnyClassInfo*);
+
+    for (i = 0; i < in->num_classes; i++)
+    {
+        any = in->classes[i];
+        switch(any->type)
+        {
+            case XIButtonClass:
+                len += sizeDeviceClassType(XIButtonClass,
+                        ((XIButtonClassInfo*)any)->num_buttons);
+                break;
+            case XIKeyClass:
+                len += sizeDeviceClassType(XIKeyClass,
+                        ((XIKeyClassInfo*)any)->num_keycodes);
+                break;
+            case XIValuatorClass:
+                len += sizeDeviceClassType(XIValuatorClass, 0);
+                break;
+            default:
+                printf("copyDeviceChangedEvent: unknown type %d\n",
+                        any->type);
+                break;
+        }
+
+    }
+
+    ptr = out_cookie->data = malloc(len);
+    if (!ptr)
+        return False;
+    out = next_block(&ptr, sizeof(XIDeviceChangedEvent));
+    *out = *in;
+
+    out->classes = next_block(&ptr,
+                              out->num_classes * sizeof(XIAnyClassInfo*));
+
+    for (i = 0; i < in->num_classes; i++)
+    {
+        any = in->classes[i];
+
+        switch(any->type)
+        {
+            case XIButtonClass:
+                {
+                    XIButtonClassInfo *bin, *bout;
+                    bin = (XIButtonClassInfo*)any;
+                    bout = next_block(&ptr, sizeof(XIButtonClass));
+
+                    *bout = *bin;
+                    bout->state.mask = next_block(&ptr, bout->state.mask_len);
+                    memcpy(bout->state.mask, bin->state.mask,
+                            bout->state.mask_len);
+
+                    bout->labels = next_block(&ptr, bout->num_buttons * sizeof(Atom));
+                    memcpy(bout->labels, bin->labels, bout->num_buttons * sizeof(Atom));
+                    out->classes[i] = (XIAnyClassInfo*)bout;
+                    break;
+                }
+            case XIKeyClass:
+                {
+                    XIKeyClassInfo *kin, *kout;
+                    kin = (XIKeyClassInfo*)any;
+
+                    kout = next_block(&ptr, sizeof(XIKeyClass));
+                    *kout = *kin;
+                    kout->keycodes = next_block(&ptr, kout->num_keycodes * sizeof(int));
+                    memcpy(kout->keycodes, kin->keycodes, kout->num_keycodes * sizeof(int));
+                    out->classes[i] = (XIAnyClassInfo*)kout;
+                    break;
+                }
+            case XIValuatorClass:
+                {
+                    XIValuatorClassInfo *vin, *vout;
+                    vin = (XIValuatorClassInfo*)any;
+                    vout = next_block(&ptr, sizeof(XIValuatorClass));
+                    *vout = *vin;
+                    out->classes[i] = (XIAnyClassInfo*)vout;
+                    break;
+                }
+        }
+    }
+
+    return True;
+}
+
+static Bool
+copyDeviceEvent(XGenericEventCookie *cookie_in,
+                XGenericEventCookie *cookie_out)
+{
+    int len;
+    XIDeviceEvent *in, *out;
+    int bits; /* valuator bits */
+    void *ptr;
+
+    in = cookie_in->data;
+    bits = count_bits(in->valuators.mask, in->valuators.mask_len);
+
+    len = sizeDeviceEvent(in->buttons.mask_len, in->valuators.mask_len,
+                          in->valuators.mask);
+
+    ptr = cookie_out->data = malloc(len);
+    if (!ptr)
+        return False;
+
+    out = next_block(&ptr, sizeof(XIDeviceEvent));
+    *out = *in;
+
+    out->buttons.mask = next_block(&ptr, in->buttons.mask_len);
+    memcpy(out->buttons.mask, in->buttons.mask,
+           out->buttons.mask_len);
+    out->valuators.mask = next_block(&ptr, in->valuators.mask_len);
+    memcpy(out->valuators.mask, in->valuators.mask,
+           out->valuators.mask_len);
+    out->valuators.values = next_block(&ptr, bits * sizeof(double));
+    memcpy(out->valuators.values, in->valuators.values,
+           bits * sizeof(double));
+
+    return True;
+}
+
+static Bool
+copyEnterEvent(XGenericEventCookie *cookie_in,
+               XGenericEventCookie *cookie_out)
+{
+    int len;
+    XIEnterEvent *in, *out;
+    void *ptr;
+
+    in = cookie_in->data;
+
+    len = sizeof(XIEnterEvent) + in->buttons.mask_len;
+
+    ptr = cookie_out->data = malloc(len);
+    if (!ptr)
+        return False;
+
+    out = next_block(&ptr, sizeof(XIEnterEvent));
+    *out = *in;
+
+    out->buttons.mask = next_block(&ptr, in->buttons.mask_len);
+    memcpy(out->buttons.mask, in->buttons.mask, out->buttons.mask_len);
+
+    return True;
+}
+
+static Bool
+copyPropertyEvent(XGenericEventCookie *cookie_in,
+                  XGenericEventCookie *cookie_out)
+{
+    XIPropertyEvent *in, *out;
+
+    in = cookie_in->data;
+
+    out = cookie_out->data = malloc(sizeof(XIPropertyEvent));
+    if (!out)
+        return False;
+
+    *out = *in;
+    return True;
+}
+
+static Bool
+copyRawEvent(XGenericEventCookie *cookie_in,
+             XGenericEventCookie *cookie_out)
+{
+    XIRawEvent *in, *out;
+    void *ptr;
+    int len;
+    int bits;
+
+    in = cookie_in->data;
+
+    bits = count_bits(in->valuators.mask, in->valuators.mask_len);
+    len = sizeof(XIRawEvent) + in->valuators.mask_len;
+    len += bits * sizeof(double) * 2;
+
+    ptr = cookie_out->data = malloc(sizeof(XIRawEvent));
+    if (!ptr)
+        return False;
+
+    out = next_block(&ptr, sizeof(XIRawEvent));
+    *out = *in;
+    out->valuators.mask = next_block(&ptr, out->valuators.mask_len);
+    memcpy(out->valuators.mask, in->valuators.mask, out->valuators.mask_len);
+
+    out->valuators.values = next_block(&ptr, bits * sizeof(double));
+    memcpy(out->valuators.values, in->valuators.values, bits * sizeof(double));
+
+    out->raw_values = next_block(&ptr, bits * sizeof(double));
+    memcpy(out->raw_values, in->raw_values, bits * sizeof(double));
+
+    return True;
+}
+
+
+
+static Bool
+XInputCopyCookie(Display *dpy, XGenericEventCookie *in, XGenericEventCookie *out)
+{
+    int ret = True;
+
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    if (in->extension != info->codes->major_opcode)
+    {
+        printf("XInputCopyCookie: wrong extension opcode %d\n",
+                in->extension);
+        return False;
+    }
+
+    *out = *in;
+    out->data = NULL;
+    out->cookie = 0;
+
+    switch(in->evtype) {
+        case XI_Motion:
+        case XI_ButtonPress:
+        case XI_ButtonRelease:
+        case XI_KeyPress:
+        case XI_KeyRelease:
+            ret = copyDeviceEvent(in, out);
+            break;
+        case XI_DeviceChanged:
+            ret = copyDeviceChangedEvent(in, out);
+            break;
+        case XI_HierarchyChanged:
+            ret = copyHierarchyEvent(in, out);
+            break;
+        case XI_Enter:
+        case XI_Leave:
+        case XI_FocusIn:
+        case XI_FocusOut:
+            ret = copyEnterEvent(in, out);
+            break;
+        case XI_PropertyEvent:
+            ret = copyPropertyEvent(in, out);
+            break;
+        case XI_RawKeyPress:
+        case XI_RawKeyRelease:
+        case XI_RawButtonPress:
+        case XI_RawButtonRelease:
+        case XI_RawMotion:
+            ret = copyRawEvent(in, out);
+            break;
+        default:
+            printf("XInputCopyCookie: unknown evtype %d\n", in->evtype);
+            ret = False;
+    }
+
+    if (!ret)
+        printf("XInputCopyCookie: Failed to copy evtype %d", in->evtype);
+    return ret;
+}
+
+static int
+wireToDeviceEvent(xXIDeviceEvent *in, XGenericEventCookie* cookie)
+{
+    int len, i;
+    unsigned char *ptr;
+    void *ptr_lib;
+    FP3232 *values;
+    XIDeviceEvent *out;
+
+    ptr = (unsigned char*)&in[1] + in->buttons_len * 4;
+
+    len = sizeDeviceEvent(in->buttons_len * 4, in->valuators_len * 4, ptr);
+
+    cookie->data = ptr_lib = malloc(len);
+
+    out = next_block(&ptr_lib, sizeof(XIDeviceEvent));
+    out->type = in->type;
+    out->extension = in->extension;
+    out->evtype = in->evtype;
+    out->send_event = ((in->type & 0x80) != 0);
+    out->time = in->time;
+    out->deviceid = in->deviceid;
+    out->sourceid = in->sourceid;
+    out->detail = in->detail;
+    out->root = in->root;
+    out->event = in->event;
+    out->child = in->child;
+    out->root_x = FP1616toDBL(in->root_x);
+    out->root_y = FP1616toDBL(in->root_y);
+    out->event_x = FP1616toDBL(in->event_x);
+    out->event_y = FP1616toDBL(in->event_y);
+    out->flags = in->flags;
+    out->mods.base = in->mods.base_mods;
+    out->mods.locked = in->mods.locked_mods;
+    out->mods.latched = in->mods.latched_mods;
+    out->mods.effective = in->mods.effective_mods;
+    out->group.base = in->group.base_group;
+    out->group.locked = in->group.locked_group;
+    out->group.latched = in->group.latched_group;
+    out->group.effective = in->group.effective_group;
+    out->buttons.mask_len = in->buttons_len * 4;
+    out->valuators.mask_len = in->valuators_len * 4;
+
+    out->buttons.mask = next_block(&ptr_lib, out->buttons.mask_len);
+
+    /* buttons */
+    ptr = (unsigned char*)&in[1];
+    memcpy(out->buttons.mask, ptr, out->buttons.mask_len);
+    ptr += in->buttons_len * 4;
+
+    /* valuators */
+    out->valuators.mask = next_block(&ptr_lib, out->valuators.mask_len);
+    memcpy(out->valuators.mask, ptr, out->valuators.mask_len);
+    ptr += in->valuators_len * 4;
+
+    len = count_bits(out->valuators.mask, out->valuators.mask_len);
+    out->valuators.values = next_block(&ptr_lib, len * sizeof(double));
+
+    values = (FP3232*)ptr;
+    for (i = 0; i < len; i++, values++)
+    {
+        out->valuators.values[i] = values->integral;
+        out->valuators.values[i] += ((double)values->frac / (1 << 16) / (1 << 16));
+    }
+
+
+    return 1;
+}
+
+_X_HIDDEN int
+size_classes(xXIAnyInfo* from, int nclasses)
+{
+    int len, i;
+    xXIAnyInfo *any_wire;
+    char *ptr_wire;
+
+    len = nclasses * sizeof(XIAnyClassInfo*); /* len for to->classes */
+    ptr_wire = (char*)from;
+    for (i = 0; i < nclasses; i++)
+    {
+        int l = 0;
+        any_wire = (xXIAnyInfo*)ptr_wire;
+        switch(any_wire->type)
+        {
+            case XIButtonClass:
+                l = sizeDeviceClassType(XIButtonClass,
+                        ((xXIButtonInfo*)any_wire)->num_buttons);
+                break;
+            case XIKeyClass:
+                l = sizeDeviceClassType(XIKeyClass,
+                        ((xXIKeyInfo*)any_wire)->num_keycodes);
+                break;
+            case XIValuatorClass:
+                l = sizeDeviceClassType(XIValuatorClass, 0);
+                break;
+        }
+
+        len += l;
+        ptr_wire += any_wire->length * 4;
+    }
+
+    return len;
+}
+
+/* Copy classes from any into to->classes and return the number of bytes
+ * copied. Memory layout of to->classes is
+ * [clsptr][clsptr][clsptr][classinfo][classinfo]...
+ *    |________|___________^
+ *             |______________________^
+ */
+_X_HIDDEN int
+copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses)
+{
+    XIAnyClassInfo *any_lib;
+    xXIAnyInfo *any_wire;
+    void *ptr_lib;
+    char *ptr_wire;
+    int i, len;
+
+    if (!to->classes)
+        return -1;
+
+    ptr_wire = (char*)from;
+    ptr_lib = to->classes;
+    to->classes = next_block(&ptr_lib, nclasses * sizeof(XIAnyClassInfo*));
+    len = 0; /* count wire length */
+
+    for (i = 0; i < nclasses; i++)
+    {
+        any_lib = (XIAnyClassInfo*)ptr_lib;
+        any_wire = (xXIAnyInfo*)ptr_wire;
+
+        to->classes[i] = any_lib;
+        any_lib->type = any_wire->type;
+        any_lib->sourceid = any_wire->sourceid;
+        switch(any_wire->type)
+        {
+            case XIButtonClass:
+                {
+                    XIButtonClassInfo *cls_lib;
+                    xXIButtonInfo *cls_wire;
+                    uint32_t *atoms;
+                    int j;
+
+                    cls_lib = next_block(&ptr_lib, sizeof(XIButtonClassInfo));
+                    cls_wire = (xXIButtonInfo*)any_wire;
+
+                    cls_lib->num_buttons = cls_wire->num_buttons;
+                    cls_lib->state.mask_len = ((((cls_wire->num_buttons + 7)/8) + 3)/4) * 4;
+                    cls_lib->state.mask = next_block(&ptr_lib, cls_lib->state.mask_len);
+                    memcpy(cls_lib->state.mask, &cls_wire[1],
+                           cls_lib->state.mask_len);
+
+                    cls_lib->labels = next_block(&ptr_lib, cls_lib->num_buttons * sizeof(Atom));
+                    atoms =(uint32_t*)((char*)&cls_wire[1] + cls_lib->state.mask_len);
+                    for (j = 0; j < cls_lib->num_buttons; j++)
+                        cls_lib->labels[j] = *atoms++;
+
+                    break;
+                }
+            case XIKeyClass:
+                {
+                    XIKeyClassInfo *cls_lib;
+                    xXIKeyInfo *cls_wire;
+
+                    cls_lib = next_block(&ptr_lib, sizeof(XIKeyClassInfo));
+                    cls_wire = (xXIKeyInfo*)any_wire;
+
+                    cls_lib->num_keycodes = cls_wire->num_keycodes;
+                    cls_lib->keycodes = next_block(&ptr_lib,
+                            cls_lib->num_keycodes * sizeof(int));
+                    memcpy(cls_lib->keycodes, &cls_wire[1],
+                            cls_lib->num_keycodes);
+
+                    break;
+                }
+            case XIValuatorClass:
+                {
+                    XIValuatorClassInfo *cls_lib;
+                    xXIValuatorInfo *cls_wire;
+
+                    cls_lib = next_block(&ptr_lib, sizeof(XIValuatorClassInfo));
+                    cls_wire = (xXIValuatorInfo*)any_wire;
+
+                    cls_lib->number = cls_wire->number;
+                    cls_lib->label  = cls_wire->label;
+                    cls_lib->resolution = cls_wire->resolution;
+                    cls_lib->min        = cls_wire->min.integral;
+                    cls_lib->max        = cls_wire->max.integral;
+                    cls_lib->value      = cls_wire->value.integral;
+                    /* FIXME: fractional parts */
+                    cls_lib->mode       = cls_wire->mode;
+
+                }
+                break;
+        }
+        len += any_wire->length * 4;
+        ptr_wire += any_wire->length * 4;
+    }
+    return len;
+}
+
+
+static int
+wireToDeviceChangedEvent(xXIDeviceChangedEvent *in, XGenericEventCookie *cookie)
+{
+    XIDeviceChangedEvent *out;
+    XIDeviceInfo info;
+    int len;
+
+    len = size_classes((xXIAnyInfo*)&in[1], in->num_classes);
+
+    cookie->data = out = malloc(sizeof(XIDeviceChangedEvent) + len);
+
+    out->type = in->type;
+    out->extension = in->extension;
+    out->evtype = in->evtype;
+    out->send_event = ((in->type & 0x80) != 0);
+    out->time = in->time;
+    out->deviceid = in->deviceid;
+    out->sourceid = in->sourceid;
+    out->reason = in->reason;
+    out->num_classes = in->num_classes;
+
+    out->classes = (XIAnyClassInfo**)&out[1];
+
+    info.classes = out->classes;
+
+    copy_classes(&info, (xXIAnyInfo*)&in[1], in->num_classes);
+
+    return 1;
+}
+
+static int
+wireToHierarchyChangedEvent(xXIHierarchyEvent *in, XGenericEventCookie *cookie)
+{
+    int i;
+    XIHierarchyInfo *info_out;
+    xXIHierarchyInfo *info_in;
+    XIHierarchyEvent *out;
+
+    cookie->data = out = malloc(sizeof(XIHierarchyEvent) + in->num_info * sizeof(XIHierarchyInfo));;
+
+    out->info           = (XIHierarchyInfo*)&out[1];
+    out->type           = in->type;
+    out->extension      = in->extension;
+    out->evtype         = in->evtype;
+    out->send_event = ((in->type & 0x80) != 0);
+    out->time           = in->time;
+    out->flags          = in->flags;
+    out->num_info       = in->num_info;
+
+    info_out            = out->info;
+    info_in             = (xXIHierarchyInfo*)&in[1];
+
+    for (i = 0; i < out->num_info; i++, info_out++, info_in++)
+    {
+        info_out->deviceid      = info_in->deviceid;
+        info_out->attachment    = info_in->attachment;
+        info_out->use           = info_in->use;
+        info_out->enabled       = info_in->enabled;
+        info_out->flags         = info_in->flags;
+    }
+
+    return 1;
+}
+
+static int
+wireToRawEvent(xXIRawEvent *in, XGenericEventCookie *cookie)
+{
+    int len, i, bits;
+    FP3232 *values;
+    XIRawEvent *out;
+    void *ptr;
+
+
+    len = sizeof(XIRawEvent) + in->valuators_len * 4;
+    bits = count_bits((unsigned char*)&in[1], in->valuators_len * 4);
+    len += bits * sizeof(double) * 2; /* raw + normal */
+
+    cookie->data = ptr = calloc(1, len);
+    if (!ptr)
+        return 0;
+
+    out = next_block(&ptr, sizeof(XIRawEvent));
+    out->type           = in->type;
+    out->extension      = in->extension;
+    out->evtype         = in->evtype;
+    out->send_event = ((in->type & 0x80) != 0);
+    out->time           = in->time;
+    out->detail         = in->detail;
+    out->deviceid       = in->deviceid;
+    out->flags          = in->flags;
+
+    out->valuators.mask_len = in->valuators_len * 4;
+    out->valuators.mask = next_block(&ptr, out->valuators.mask_len);
+    memcpy(out->valuators.mask, &in[1], out->valuators.mask_len);
+
+    out->valuators.values = next_block(&ptr, bits * sizeof(double));
+    out->raw_values = next_block(&ptr, bits * sizeof(double));
+
+    values = (FP3232*)(((char*)&in[1]) + in->valuators_len * 4);
+    for (i = 0; i < bits; i++)
+    {
+        out->valuators.values[i] = values->integral;
+        out->valuators.values[i] += ((double)values->frac / (1 << 16) / (1 << 16));
+        out->raw_values[i] = (values + bits)->integral;
+        out->raw_values[i] += ((double)(values + bits)->frac / (1 << 16) / (1 << 16));
+        values++;
+    }
+
+    return 1;
+}
+
+/* Memory layout of XIEnterEvents:
+   [event][modifiers][group][button]
+ */
+static int
+wireToEnterLeave(xXIEnterEvent *in, XGenericEventCookie *cookie)
+{
+    int len;
+    XIEnterEvent *out;
+
+    len = sizeof(XIEnterEvent) + in->buttons_len * 4;
+
+    cookie->data = out = malloc(len);
+    out->buttons.mask = (unsigned char*)&out[1];
+
+    out->type           = in->type;
+    out->extension      = in->extension;
+    out->evtype         = in->evtype;
+    out->send_event = ((in->type & 0x80) != 0);
+    out->time           = in->time;
+    out->detail         = in->detail;
+    out->deviceid       = in->deviceid;
+    out->root           = in->root;
+    out->event          = in->event;
+    out->child          = in->child;
+    out->sourceid       = in->sourceid;
+    out->root_x         = FP1616toDBL(in->root_x);
+    out->root_y         = FP1616toDBL(in->root_y);
+    out->event_x        = FP1616toDBL(in->event_x);
+    out->event_y        = FP1616toDBL(in->event_y);
+    out->mode           = in->mode;
+    out->focus          = in->focus;
+    out->same_screen    = in->same_screen;
+
+    out->mods.base = in->mods.base_mods;
+    out->mods.locked = in->mods.locked_mods;
+    out->mods.latched = in->mods.latched_mods;
+    out->mods.effective = in->mods.effective_mods;
+    out->group.base = in->group.base_group;
+    out->group.locked = in->group.locked_group;
+    out->group.latched = in->group.latched_group;
+    out->group.effective = in->group.effective_group;
+
+    out->buttons.mask_len = in->buttons_len * 4;
+    memcpy(out->buttons.mask, &in[1], out->buttons.mask_len);
+
+    return 1;
+}
+
+static int
+wireToPropertyEvent(xXIPropertyEvent *in, XGenericEventCookie *cookie)
+{
+    XIPropertyEvent *out = malloc(sizeof(XIPropertyEvent));
+
+    cookie->data = out;
+
+    out->type           = in->type;
+    out->extension      = in->extension;
+    out->evtype         = in->evtype;
+    out->send_event = ((in->type & 0x80) != 0);
+    out->time           = in->time;
+    out->property       = in->property;
+    out->what           = in->what;
+    out->deviceid       = in->deviceid;
+
+    return 1;
+}
diff --git a/src/XExtToWire.c b/src/XExtToWire.c
new file mode 100755 (executable)
index 0000000..674781f
--- /dev/null
@@ -0,0 +1,483 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/****************************************************************
+ *
+ *     XExtToWire.c - reformat an XEvent into a wire event.
+ */
+
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/Xge.h>
+#include <X11/extensions/geproto.h>
+#include "XIint.h"
+
+_X_HIDDEN Status
+_XiEventToWire(
+    register Display    *dpy,          /* pointer to display structure */
+    register XEvent     *re,           /* pointer to client event */
+    register xEvent    **event,        /* wire protocol event */
+    register int        *count)
+{
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+    int i;
+
+    if ((re->type & 0x7f) != GenericEvent) {
+        switch ((re->type & 0x7f) - info->codes->first_event) {
+            case XI_DeviceKeyPress:
+            case XI_DeviceKeyRelease:
+                {
+                    register XDeviceKeyEvent *ev = (XDeviceKeyEvent *) re;
+                    register deviceKeyButtonPointer *kev;
+                    register deviceValuator *vev;
+
+                    *count = 2;
+                    kev = (deviceKeyButtonPointer *) Xmalloc(*count * sizeof(xEvent));
+                    if (!kev)
+                        return (_XUnknownNativeEvent(dpy, re, *event));
+                    *event = (xEvent *) kev;
+
+                    kev->type = ev->type;
+                    kev->root = ev->root;
+                    kev->event = ev->window;
+                    kev->child = ev->subwindow;
+                    kev->time = ev->time;
+                    kev->event_x = ev->x;
+                    kev->event_y = ev->y;
+                    kev->root_x = ev->x_root;
+                    kev->root_y = ev->y_root;
+                    kev->state = ev->state;
+                    kev->same_screen = ev->same_screen;
+                    kev->detail = ev->keycode;
+                    kev->deviceid = ev->deviceid | MORE_EVENTS;
+
+                    vev = (deviceValuator *)++ kev;
+                    vev->type = info->codes->first_event + XI_DeviceValuator;
+                    vev->deviceid = ev->deviceid;
+                    vev->device_state = ev->device_state;
+                    vev->first_valuator = ev->first_axis;
+                    vev->num_valuators = ev->axes_count;
+                    i = vev->num_valuators;
+                    if (i > 6)
+                        i = 6;
+                    switch (i) {
+                        case 6:
+                            vev->valuator5 = ev->axis_data[5];
+                        case 5:
+                            vev->valuator4 = ev->axis_data[4];
+                        case 4:
+                            vev->valuator3 = ev->axis_data[3];
+                        case 3:
+                            vev->valuator2 = ev->axis_data[2];
+                        case 2:
+                            vev->valuator1 = ev->axis_data[1];
+                        case 1:
+                            vev->valuator0 = ev->axis_data[0];
+                    }
+                    break;
+                }
+            case XI_ProximityIn:
+            case XI_ProximityOut:
+                {
+                    register XProximityNotifyEvent *ev = (XProximityNotifyEvent *) re;
+                    register deviceKeyButtonPointer *pev;
+                    register deviceValuator *vev;
+
+                    *count = 2;
+                    pev = (deviceKeyButtonPointer *) Xmalloc(*count * sizeof(xEvent));
+                    if (!pev)
+                        return (_XUnknownNativeEvent(dpy, re, *event));
+                    *event = (xEvent *) pev;
+
+                    pev->type = ev->type;
+                    pev->root = ev->root;
+                    pev->event = ev->window;
+                    pev->child = ev->subwindow;
+                    pev->time = ev->time;
+                    pev->event_x = ev->x;
+                    pev->event_y = ev->y;
+                    pev->root_x = ev->x_root;
+                    pev->root_y = ev->y_root;
+                    pev->state = ev->state;
+                    pev->same_screen = ev->same_screen;
+                    pev->deviceid = ev->deviceid | MORE_EVENTS;
+
+                    vev = (deviceValuator *)++ pev;
+                    vev->type = info->codes->first_event + XI_DeviceValuator;
+                    vev->deviceid = ev->deviceid;
+                    vev->device_state = ev->device_state;
+                    vev->first_valuator = ev->first_axis;
+                    vev->num_valuators = ev->axes_count;
+
+                    i = vev->num_valuators;
+                    if (i > 6)
+                        i = 6;
+                    switch (i) {
+                        case 6:
+                            vev->valuator5 = ev->axis_data[5];
+                        case 5:
+                            vev->valuator4 = ev->axis_data[4];
+                        case 4:
+                            vev->valuator3 = ev->axis_data[3];
+                        case 3:
+                            vev->valuator2 = ev->axis_data[2];
+                        case 2:
+                            vev->valuator1 = ev->axis_data[1];
+                        case 1:
+                            vev->valuator0 = ev->axis_data[0];
+                    }
+                    break;
+                }
+            case XI_DeviceButtonPress:
+            case XI_DeviceButtonRelease:
+                {
+                    register XDeviceButtonEvent *ev = (XDeviceButtonEvent *) re;
+                    register deviceKeyButtonPointer *bev;
+                    register deviceValuator *vev;
+
+                    *count = 2;
+                    bev = (deviceKeyButtonPointer *) Xmalloc(*count * sizeof(xEvent));
+                    if (!bev)
+                        return (_XUnknownNativeEvent(dpy, re, *event));
+                    *event = (xEvent *) bev;
+
+                    bev->type = ev->type;
+                    bev->root = ev->root;
+                    bev->event = ev->window;
+                    bev->child = ev->subwindow;
+                    bev->time = ev->time;
+                    bev->event_x = ev->x;
+                    bev->event_y = ev->y;
+                    bev->root_x = ev->x_root;
+                    bev->root_y = ev->y_root;
+                    bev->state = ev->state;
+                    bev->same_screen = ev->same_screen;
+                    bev->detail = ev->button;
+                    bev->deviceid = ev->deviceid | MORE_EVENTS;
+
+                    vev = (deviceValuator *)++ bev;
+                    vev->type = info->codes->first_event + XI_DeviceValuator;
+                    vev->deviceid = ev->deviceid;
+                    vev->device_state = ev->device_state;
+                    vev->first_valuator = ev->first_axis;
+                    vev->num_valuators = ev->axes_count;
+
+                    i = vev->num_valuators;
+                    if (i > 6)
+                        i = 6;
+                    switch (i) {
+                        case 6:
+                            vev->valuator5 = ev->axis_data[5];
+                        case 5:
+                            vev->valuator4 = ev->axis_data[4];
+                        case 4:
+                            vev->valuator3 = ev->axis_data[3];
+                        case 3:
+                            vev->valuator2 = ev->axis_data[2];
+                        case 2:
+                            vev->valuator1 = ev->axis_data[1];
+                        case 1:
+                            vev->valuator0 = ev->axis_data[0];
+                    }
+                    break;
+                }
+            case XI_DeviceMotionNotify:
+                {
+                    register XDeviceMotionEvent *ev = (XDeviceMotionEvent *) re;
+                    register deviceKeyButtonPointer *mev;
+                    register deviceValuator *vev;
+
+                    *count = 2;
+                    mev = (deviceKeyButtonPointer *) Xmalloc(*count * sizeof(xEvent));
+                    if (!mev)
+                        return (_XUnknownNativeEvent(dpy, re, *event));
+                    *event = (xEvent *) mev;
+
+                    mev->type = ev->type;
+                    mev->root = ev->root;
+                    mev->event = ev->window;
+                    mev->child = ev->subwindow;
+                    mev->time = ev->time;
+                    mev->event_x = ev->x;
+                    mev->event_y = ev->y;
+                    mev->root_x = ev->x_root;
+                    mev->root_y = ev->y_root;
+                    mev->state = ev->state;
+                    mev->same_screen = ev->same_screen;
+                    mev->detail = ev->is_hint;
+                    mev->deviceid = ev->deviceid | MORE_EVENTS;
+
+                    vev = (deviceValuator *)++ mev;
+                    vev->type = info->codes->first_event + XI_DeviceValuator;
+                    vev->deviceid = ev->deviceid;
+                    vev->device_state = ev->device_state;
+                    vev->first_valuator = ev->first_axis;
+                    vev->num_valuators = ev->axes_count;
+
+                    i = vev->num_valuators;
+                    if (i > 6)
+                        i = 6;
+                    switch (i) {
+                        case 6:
+                            vev->valuator5 = ev->axis_data[5];
+                        case 5:
+                            vev->valuator4 = ev->axis_data[4];
+                        case 4:
+                            vev->valuator3 = ev->axis_data[3];
+                        case 3:
+                            vev->valuator2 = ev->axis_data[2];
+                        case 2:
+                            vev->valuator1 = ev->axis_data[1];
+                        case 1:
+                            vev->valuator0 = ev->axis_data[0];
+                    }
+                    break;
+                }
+            case XI_DeviceFocusIn:
+            case XI_DeviceFocusOut:
+                {
+                    register XDeviceFocusChangeEvent *ev = (XDeviceFocusChangeEvent *) re;
+                    register deviceFocus *fev;
+
+                    *count = 1;
+                    fev = (deviceFocus *) Xmalloc(*count * sizeof(xEvent));
+                    if (!fev)
+                        return (_XUnknownNativeEvent(dpy, re, *event));
+                    *event = (xEvent *) fev;
+
+                    fev->type = ev->type;
+                    fev->window = ev->window;
+                    fev->mode = ev->mode;
+                    fev->detail = ev->detail;
+                    fev->time = ev->time;
+                    fev->deviceid = ev->deviceid;
+                    break;
+                }
+            case XI_DeviceMappingNotify:
+                {
+                    register XDeviceMappingEvent *ev = (XDeviceMappingEvent *) re;
+                    register deviceMappingNotify *mev;
+
+                    *count = 1;
+                    mev = (deviceMappingNotify *) Xmalloc(*count * sizeof(xEvent));
+                    if (!mev)
+                        return (_XUnknownNativeEvent(dpy, re, *event));
+                    *event = (xEvent *) mev;
+
+                    mev->type = ev->type;
+                    mev->firstKeyCode = ev->first_keycode;
+                    mev->request = ev->request;
+                    mev->count = ev->count;
+                    mev->time = ev->time;
+                    mev->deviceid = ev->deviceid;
+                    break;
+                }
+            case XI_DeviceStateNotify:
+                {
+                    register XDeviceStateNotifyEvent *ev = (XDeviceStateNotifyEvent *) re;
+                    register deviceStateNotify *sev;
+                    register xEvent *tev;
+                    XInputClass *any = (XInputClass *) & ev->data[0];
+                    unsigned char *sav_id;
+
+                    *count = 1;
+
+                    for (i = 0; i < ev->num_classes; i++) {
+                        if (any->class == KeyClass) {
+                            XKeyStatus *k = (XKeyStatus *) any;
+
+                            if (k->num_keys > 32)
+                                (*count)++;
+                        } else if (any->class == ButtonClass) {
+                            XButtonStatus *b = (XButtonStatus *) any;
+
+                            if (b->num_buttons > 32)
+                                (*count)++;
+                        } else if (any->class == ValuatorClass) {
+                            XValuatorStatus *v = (XValuatorStatus *) any;
+
+                            if (v->num_valuators > 3)
+                                (*count)++;
+                        }
+                        any = (XInputClass *) ((char *)any + any->length);
+                    }
+
+                    sev = (deviceStateNotify *) Xmalloc(*count * sizeof(xEvent));
+                    if (!sev)
+                        return (_XUnknownNativeEvent(dpy, re, *event));
+                    *event = (xEvent *) sev;
+                    tev = (xEvent *) (sev + 1);
+
+                    sev->type = ev->type;
+                    sev->deviceid = ev->deviceid;
+                    sav_id = &(sev->deviceid);
+                    sev->time = ev->time;
+                    sev->classes_reported = 0;
+
+                    any = (XInputClass *) & ev->data[0];
+                    for (i = 0; i < ev->num_classes; i++) {
+                        if (any->class == KeyClass) {
+                            XKeyStatus *k = (XKeyStatus *) any;
+                            register deviceKeyStateNotify *kev;
+
+                            sev->classes_reported |= (1 << KeyClass);
+                            sev->num_keys = k->num_keys;
+                            memcpy((char *)(sev->keys), (char *)(k->keys), 4);
+                            if (k->num_keys > 32) {
+                                kev = (deviceKeyStateNotify *) tev++;
+                                kev->type = info->codes->first_event +
+                                    XI_DeviceKeystateNotify;
+                                kev->deviceid = ev->deviceid;
+                                *sav_id |= MORE_EVENTS;
+                                sav_id = &(kev->deviceid);
+                                memcpy((char *)(kev->keys), (char *)(&k->keys[4]), 28);
+                            }
+                        } else if (any->class == ButtonClass) {
+                            XButtonStatus *b = (XButtonStatus *) any;
+                            register deviceButtonStateNotify *bev;
+
+                            sev->classes_reported |= (1 << ButtonClass);
+                            sev->num_buttons = b->num_buttons;
+                            memcpy((char *)(sev->buttons), (char *)(b->buttons), 4);
+                            if (b->num_buttons > 32) {
+                                bev = (deviceButtonStateNotify *) tev++;
+                                bev->type = info->codes->first_event +
+                                    XI_DeviceButtonstateNotify;
+                                bev->deviceid = ev->deviceid;
+                                *sav_id |= MORE_EVENTS;
+                                sav_id = &(bev->deviceid);
+                                memcpy((char *)(bev->buttons), (char *)(&b->buttons[4]),
+                                        28);
+                            }
+                        } else if (any->class == ValuatorClass) {
+                            XValuatorStatus *val = (XValuatorStatus *) any;
+                            register deviceValuator *vev;
+
+                            sev->classes_reported |= (1 << ValuatorClass);
+                            sev->num_valuators = val->num_valuators < 3 ?
+                                val->num_valuators : 3;
+                            switch (sev->num_valuators) {
+                                case 3:
+                                    sev->valuator2 = val->valuators[2];
+                                case 2:
+                                    sev->valuator1 = val->valuators[1];
+                                case 1:
+                                    sev->valuator0 = val->valuators[0];
+                            }
+                            if (val->num_valuators > 3) {
+                                vev = (deviceValuator *) tev++;
+                                vev->type = info->codes->first_event + XI_DeviceValuator;
+                                vev->deviceid = ev->deviceid;
+                                vev->first_valuator = 3;
+                                vev->num_valuators = val->num_valuators - 3;
+                                *sav_id |= MORE_EVENTS;
+                                sav_id = &(vev->deviceid);
+                                i = val->num_valuators;
+                                if (i > 6)
+                                    i = 6;
+                                switch (i) {
+                                    case 6:
+                                        vev->valuator2 = val->valuators[5];
+                                    case 5:
+                                        vev->valuator1 = val->valuators[4];
+                                    case 4:
+                                        vev->valuator0 = val->valuators[3];
+                                }
+                            }
+                        }
+                        any = (XInputClass *) ((char *)any + any->length);
+                    }
+                    break;
+                }
+            case XI_ChangeDeviceNotify:
+                {
+                    register XChangeDeviceNotifyEvent *ev = (XChangeDeviceNotifyEvent *) re;
+                    register changeDeviceNotify *cev;
+
+                    *count = 1;
+                    cev = (changeDeviceNotify *) Xmalloc(*count * sizeof(xEvent));
+                    if (!cev)
+                        return (_XUnknownNativeEvent(dpy, re, *event));
+                    *event = (xEvent *) cev;
+
+                    cev->type = ev->type;
+                    cev->request = ev->request;
+                    cev->time = ev->time;
+                    cev->deviceid = ev->deviceid;
+                    break;
+                }
+            default:
+                return (_XUnknownNativeEvent(dpy, re, *event));
+        } /* switch */
+    } else /* if type != GenericEvent */
+    {
+#if 0
+        switch (((XGenericEvent*)re)->evtype)
+        {
+            case XI_HierarchyChangedNotify:
+                {
+                    XDeviceHierarchyChangedEvent *ev =
+                        (XDeviceHierarchyChangedEvent*)re;
+                    XIDeviceHierarchyEvent *dhcev;
+                    *count = 1;
+                    dhcev = (XIDeviceHierarchyEvent *)Xmalloc(*count * sizeof(xEvent));
+                    if (!dhcev)
+                        return (_XUnknownNativeEvent(dpy, re, *event));
+
+                    *event = (xEvent *) dhcev;
+                    dhcev->type = ev->type;
+                    dhcev->time = ev->time;
+                    break;
+                }
+            default:
+                return (_XUnknownNativeEvent(dpy, re, *event));
+        }
+#endif
+    }
+    return (1);
+}
diff --git a/src/XFreeLst.c b/src/XFreeLst.c
new file mode 100644 (file)
index 0000000..1b7693f
--- /dev/null
@@ -0,0 +1,68 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XFreeDeviceList - free the input device list.
+ *
+ */
+
+#include <stdio.h>
+#include <X11/Xlib.h>
+
+/***********************************************************************
+ *
+ * Free the list of input devices.
+ *
+ */
+
+XFreeDeviceList(XDeviceList *list)
+{
+    if (list != NULL) {
+       XFree((list->name) - sizeof(XDeviceList));
+       XFree((XDeviceList *) list);
+    }
+}
diff --git a/src/XGMotion.c b/src/XGMotion.c
new file mode 100644 (file)
index 0000000..aee6671
--- /dev/null
@@ -0,0 +1,137 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XGetDeviceMotionEvents - Get the motion history of an input device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XDeviceTimeCoord *
+XGetDeviceMotionEvents(
+    register Display   *dpy,
+    XDevice            *dev,
+    Time                start,
+    Time                stop,
+    int                        *nEvents,
+    int                        *mode,
+    int                        *axis_count)
+{
+    xGetDeviceMotionEventsReq *req;
+    xGetDeviceMotionEventsReply rep;
+    XDeviceTimeCoord *tc;
+    int *data, *bufp, *readp, *savp;
+    long size, size2;
+    int i, j;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return ((XDeviceTimeCoord *) NoSuchExtension);
+
+    GetReq(GetDeviceMotionEvents, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_GetDeviceMotionEvents;
+    req->start = start;
+    req->stop = stop;
+    req->deviceid = dev->device_id;
+
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       *nEvents = 0;
+       return (NULL);
+    }
+
+    *mode = rep.mode;
+    *axis_count = rep.axes;
+    *nEvents = rep.nEvents;
+    if (!rep.nEvents) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return (NULL);
+    }
+    size = rep.length << 2;
+    size2 = rep.nEvents * (sizeof(XDeviceTimeCoord) + (rep.axes * sizeof(int)));
+    savp = readp = (int *)Xmalloc(size);
+    bufp = (int *)Xmalloc(size2);
+    if (!bufp || !savp) {
+       Xfree(bufp);
+       Xfree(savp);
+       *nEvents = 0;
+       _XEatData(dpy, (unsigned long)size);
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return (NULL);
+    }
+    _XRead(dpy, (char *)readp, size);
+
+    tc = (XDeviceTimeCoord *) bufp;
+    data = (int *)(tc + rep.nEvents);
+    for (i = 0; i < *nEvents; i++, tc++) {
+       tc->time = *readp++;
+       tc->data = data;
+       for (j = 0; j < *axis_count; j++)
+           *data++ = *readp++;
+    }
+    XFree((char *)savp);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return ((XDeviceTimeCoord *) bufp);
+}
+
+void
+XFreeDeviceMotionEvents(XDeviceTimeCoord *events)
+{
+    XFree((char *)events);
+}
diff --git a/src/XGetBMap.c b/src/XGetBMap.c
new file mode 100644 (file)
index 0000000..610795b
--- /dev/null
@@ -0,0 +1,103 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XGetDeviceButtonMapping - Get the button mapping of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+#ifdef MIN     /* some systems define this in <sys/param.h> */
+#undef MIN
+#endif
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+
+int
+XGetDeviceButtonMapping(
+    register Display   *dpy,
+    XDevice            *device,
+    unsigned char       map[],
+    unsigned int        nmap)
+{
+    int status = 0;
+    unsigned char mapping[256];        /* known fixed size */
+    long nbytes;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    register xGetDeviceButtonMappingReq *req;
+    xGetDeviceButtonMappingReply rep;
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+    GetReq(GetDeviceButtonMapping, req);
+
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_GetDeviceButtonMapping;
+    req->deviceid = device->device_id;
+
+    status = _XReply(dpy, (xReply *) & rep, 0, xFalse);
+    if (status == 1) {
+       nbytes = (long)rep.length << 2;
+       _XRead(dpy, (char *)mapping, nbytes);
+
+       /* don't return more data than the user asked for. */
+       if (rep.nElts)
+           memcpy((char *)map, (char *)mapping, MIN((int)rep.nElts, nmap));
+       status = rep.nElts;
+    } else
+       status = 0;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (status);
+}
diff --git a/src/XGetCPtr.c b/src/XGetCPtr.c
new file mode 100644 (file)
index 0000000..4517b6a
--- /dev/null
@@ -0,0 +1,67 @@
+/************************************************************
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+*/
+
+/***********************************************************************
+ *
+ * XIGetClientPointer - Get the clientPointer setting for a client.
+ *
+ */
+
+#include <stdint.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+Bool
+XIGetClientPointer(Display* dpy, Window win, int *deviceid)
+{
+    xXIGetClientPointerReq *req;
+    xXIGetClientPointerReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(XIGetClientPointer, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_XIGetClientPointer;
+    req->win = win;
+
+    if (!_XReply(dpy, (xReply*) &rep, 0, xFalse)) {
+        UnlockDisplay(dpy);
+        SyncHandle();
+        return False;
+    }
+
+    *deviceid = rep.deviceid;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return rep.set;
+}
diff --git a/src/XGetDCtl.c b/src/XGetDCtl.c
new file mode 100755 (executable)
index 0000000..729b0a0
--- /dev/null
@@ -0,0 +1,238 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XGetDeviceControl - get the Device control state of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XDeviceControl *
+XGetDeviceControl(
+    register Display   *dpy,
+    XDevice            *dev,
+    int                         control)
+{
+    int size = 0;
+    int nbytes, i;
+    XDeviceControl *Device = NULL;
+    XDeviceControl *Sav = NULL;
+    xDeviceState *d = NULL;
+    xDeviceState *sav = NULL;
+    xGetDeviceControlReq *req;
+    xGetDeviceControlReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Add_XChangeDeviceControl, info) == -1)
+       return ((XDeviceControl *) NoSuchExtension);
+
+    GetReq(GetDeviceControl, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_GetDeviceControl;
+    req->deviceid = dev->device_id;
+    req->control = control;
+
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
+       goto out;
+
+    if (rep.length > 0) {
+       nbytes = (long)rep.length << 2;
+       d = (xDeviceState *) Xmalloc((unsigned)nbytes);
+       if (!d) {
+           _XEatData(dpy, (unsigned long)nbytes);
+           goto out;
+       }
+       sav = d;
+       _XRead(dpy, (char *)d, nbytes);
+
+        /* In theory, we should just be able to use d->length to get the size.
+         * Turns out that a number of X servers (up to and including server
+         * 1.4) sent the wrong length value down the wire. So to not break
+         * apps that run against older servers, we have to calculate the size
+         * manually.
+         */
+       switch (d->control) {
+       case DEVICE_RESOLUTION:
+       {
+           xDeviceResolutionState *r;
+
+           r = (xDeviceResolutionState *) d;
+           size += sizeof(XDeviceResolutionState) +
+               (3 * sizeof(int) * r->num_valuators);
+           break;
+       }
+        case DEVICE_ABS_CALIB:
+        {
+            size += sizeof(XDeviceAbsCalibState);
+            break;
+        }
+        case DEVICE_ABS_AREA:
+        {
+            size += sizeof(XDeviceAbsAreaState);
+            break;
+        }
+        case DEVICE_CORE:
+        {
+            size += sizeof(XDeviceCoreState);
+            break;
+        }
+       default:
+           size += d->length;
+           break;
+       }
+
+       Device = (XDeviceControl *) Xmalloc((unsigned)size);
+       if (!Device)
+           goto out;
+
+       Sav = Device;
+
+       d = sav;
+       switch (control) {
+       case DEVICE_RESOLUTION:
+       {
+           int *iptr, *iptr2;
+           xDeviceResolutionState *r;
+           XDeviceResolutionState *R;
+
+           r = (xDeviceResolutionState *) d;
+           R = (XDeviceResolutionState *) Device;
+
+           R->control = DEVICE_RESOLUTION;
+           R->length = sizeof(XDeviceResolutionState);
+           R->num_valuators = r->num_valuators;
+           iptr = (int *)(R + 1);
+           iptr2 = (int *)(r + 1);
+           R->resolutions = iptr;
+           R->min_resolutions = iptr + R->num_valuators;
+           R->max_resolutions = iptr + (2 * R->num_valuators);
+           for (i = 0; i < (3 * R->num_valuators); i++)
+               *iptr++ = *iptr2++;
+           break;
+       }
+        case DEVICE_ABS_CALIB:
+        {
+            xDeviceAbsCalibState *c = (xDeviceAbsCalibState *) d;
+            XDeviceAbsCalibState *C = (XDeviceAbsCalibState *) Device;
+
+            C->control = DEVICE_ABS_CALIB;
+            C->length = sizeof(XDeviceAbsCalibState);
+            C->min_x = c->min_x;
+            C->max_x = c->max_x;
+            C->min_y = c->min_y;
+            C->max_y = c->max_y;
+            C->flip_x = c->flip_x;
+            C->flip_y = c->flip_y;
+            C->rotation = c->rotation;
+            C->button_threshold = c->button_threshold;
+
+            break;
+        }
+        case DEVICE_ABS_AREA:
+        {
+            xDeviceAbsAreaState *a = (xDeviceAbsAreaState *) d;
+            XDeviceAbsAreaState *A = (XDeviceAbsAreaState *) Device;
+
+            A->control = DEVICE_ABS_AREA;
+            A->length = sizeof(XDeviceAbsAreaState);
+            A->offset_x = a->offset_x;
+            A->offset_y = a->offset_y;
+            A->width = a->width;
+            A->height = a->height;
+            A->screen = a->screen;
+            A->following = a->following;
+
+            break;
+        }
+        case DEVICE_CORE:
+        {
+            xDeviceCoreState *c = (xDeviceCoreState *) d;
+            XDeviceCoreState *C = (XDeviceCoreState *) Device;
+
+            C->control = DEVICE_CORE;
+            C->length = sizeof(XDeviceCoreState);
+            C->status = c->status;
+            C->iscore = c->iscore;
+
+            break;
+        }
+        case DEVICE_ENABLE:
+        {
+            xDeviceEnableState *e = (xDeviceEnableState *) d;
+            XDeviceEnableState *E = (XDeviceEnableState *) Device;
+
+            E->control = DEVICE_ENABLE;
+            E->length = sizeof(E);
+            E->enable = e->enable;
+
+            break;
+        }
+       default:
+           break;
+       }
+    }
+out:
+    XFree(sav);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Sav);
+}
+
+void
+XFreeDeviceControl(XDeviceControl *control)
+{
+    XFree(control);
+}
diff --git a/src/XGetDProp.c b/src/XGetDProp.c
new file mode 100644 (file)
index 0000000..5d44f91
--- /dev/null
@@ -0,0 +1,139 @@
+/************************************************************
+
+Copyright 2008 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.
+
+*/
+
+/***********************************************************************
+ * XGetDeviceProperties - get an input device's properties.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <X11/Xlibint.h>
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XGetDeviceProperty(Display* dpy, XDevice* dev,
+                        Atom property, long offset, long length, Bool delete,
+                         Atom req_type, Atom *actual_type, int *actual_format,
+                         unsigned long *nitems, unsigned long *bytes_after,
+                         unsigned char **prop)
+{
+    xGetDevicePropertyReq   *req;
+    xGetDevicePropertyReply rep;
+    long                    nbytes, rbytes;
+
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return 1;
+
+    GetReq(GetDeviceProperty, req);
+    req->reqType    = info->codes->major_opcode;
+    req->ReqType    = X_GetDeviceProperty;
+    req->deviceid   = dev->device_id;
+    req->property   = property;
+    req->type       = req_type;
+    req->longOffset = offset;
+    req->longLength = length;
+    req->delete     = delete;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+    {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return 1;
+    }
+
+    *prop = (unsigned char *) NULL;
+
+    if (rep.propertyType != None) {
+       /*
+        * One extra byte is malloced than is needed to contain the property
+        * data, but this last byte is null terminated and convenient for
+        * returning string properties, so the client doesn't then have to
+        * recopy the string to make it null terminated.
+        */
+       switch (rep.format) {
+       case 8:
+           nbytes = rep.nItems;
+           rbytes = rep.nItems + 1;
+           if (rbytes > 0 &&
+               (*prop = (unsigned char *) Xmalloc ((unsigned)rbytes)))
+               _XReadPad (dpy, (char *) *prop, nbytes);
+           break;
+
+       case 16:
+           nbytes = rep.nItems << 1;
+           rbytes = rep.nItems * sizeof (short) + 1;
+           if (rbytes > 0 &&
+               (*prop = (unsigned char *) Xmalloc ((unsigned)rbytes)))
+               _XRead16Pad (dpy, (short *) *prop, nbytes);
+           break;
+
+       case 32:
+           nbytes = rep.nItems << 2;
+           rbytes = rep.nItems * sizeof (long) + 1;
+           if (rbytes > 0 &&
+               (*prop = (unsigned char *) Xmalloc ((unsigned)rbytes)))
+               _XRead32 (dpy, (long *) *prop, nbytes);
+           break;
+
+       default:
+           /*
+            * This part of the code should never be reached.  If it is,
+            * the server sent back a property with an invalid format.
+            */
+           nbytes = rep.length << 2;
+           _XEatData(dpy, (unsigned long) nbytes);
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return(BadImplementation);
+       }
+       if (! *prop) {
+           _XEatData(dpy, (unsigned long) nbytes);
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return(BadAlloc);
+       }
+       (*prop)[rbytes - 1] = '\0';
+    }
+
+    *actual_type = rep.propertyType;
+    *actual_format = rep.format;
+    *nitems = rep.nItems;
+    *bytes_after = rep.bytesAfter;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+
+    return Success;
+}
+
diff --git a/src/XGetFCtl.c b/src/XGetFCtl.c
new file mode 100755 (executable)
index 0000000..3d64404
--- /dev/null
@@ -0,0 +1,263 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XGetFeedbackControl - get the feedback attributes of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XFeedbackState *
+XGetFeedbackControl(
+    register Display   *dpy,
+    XDevice            *dev,
+    int                        *num_feedbacks)
+{
+    int size = 0;
+    int nbytes, i;
+    XFeedbackState *Feedback = NULL;
+    XFeedbackState *Sav = NULL;
+    xFeedbackState *f = NULL;
+    xFeedbackState *sav = NULL;
+    xGetFeedbackControlReq *req;
+    xGetFeedbackControlReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return ((XFeedbackState *) NoSuchExtension);
+
+    GetReq(GetFeedbackControl, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_GetFeedbackControl;
+    req->deviceid = dev->device_id;
+
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
+       goto out;
+
+    if (rep.length > 0) {
+       *num_feedbacks = rep.num_feedbacks;
+       nbytes = (long)rep.length << 2;
+       f = (xFeedbackState *) Xmalloc((unsigned)nbytes);
+       if (!f) {
+           _XEatData(dpy, (unsigned long)nbytes);
+           goto out;
+       }
+       sav = f;
+       _XRead(dpy, (char *)f, nbytes);
+
+       for (i = 0; i < *num_feedbacks; i++) {
+           switch (f->class) {
+           case KbdFeedbackClass:
+               size += sizeof(XKbdFeedbackState);
+               break;
+           case PtrFeedbackClass:
+               size += sizeof(XPtrFeedbackState);
+               break;
+           case IntegerFeedbackClass:
+               size += sizeof(XIntegerFeedbackState);
+               break;
+           case StringFeedbackClass:
+           {
+               xStringFeedbackState *strf = (xStringFeedbackState *) f;
+
+               size += sizeof(XStringFeedbackState) +
+                   (strf->num_syms_supported * sizeof(KeySym));
+           }
+               break;
+           case LedFeedbackClass:
+               size += sizeof(XLedFeedbackState);
+               break;
+           case BellFeedbackClass:
+               size += sizeof(XBellFeedbackState);
+               break;
+           default:
+               size += f->length;
+               break;
+           }
+           f = (xFeedbackState *) ((char *)f + f->length);
+       }
+
+       Feedback = (XFeedbackState *) Xmalloc((unsigned)size);
+       if (!Feedback)
+           goto out;
+
+       Sav = Feedback;
+
+       f = sav;
+       for (i = 0; i < *num_feedbacks; i++) {
+           switch (f->class) {
+           case KbdFeedbackClass:
+           {
+               xKbdFeedbackState *k;
+               XKbdFeedbackState *K;
+
+               k = (xKbdFeedbackState *) f;
+               K = (XKbdFeedbackState *) Feedback;
+
+               K->class = k->class;
+               K->length = sizeof(XKbdFeedbackState);
+               K->id = k->id;
+               K->click = k->click;
+               K->percent = k->percent;
+               K->pitch = k->pitch;
+               K->duration = k->duration;
+               K->led_mask = k->led_mask;
+               K->global_auto_repeat = k->global_auto_repeat;
+               memcpy((char *)&K->auto_repeats[0],
+                      (char *)&k->auto_repeats[0], 32);
+               break;
+           }
+           case PtrFeedbackClass:
+           {
+               xPtrFeedbackState *p;
+               XPtrFeedbackState *P;
+
+               p = (xPtrFeedbackState *) f;
+               P = (XPtrFeedbackState *) Feedback;
+
+               P->class = p->class;
+               P->length = sizeof(XPtrFeedbackState);
+               P->id = p->id;
+               P->accelNum = p->accelNum;
+               P->accelDenom = p->accelDenom;
+               P->threshold = p->threshold;
+               break;
+           }
+           case IntegerFeedbackClass:
+           {
+               xIntegerFeedbackState *i;
+               XIntegerFeedbackState *I;
+
+               i = (xIntegerFeedbackState *) f;
+               I = (XIntegerFeedbackState *) Feedback;
+
+               I->class = i->class;
+               I->length = sizeof(XIntegerFeedbackState);
+               I->id = i->id;
+               I->resolution = i->resolution;
+               I->minVal = i->min_value;
+               I->maxVal = i->max_value;
+               break;
+           }
+           case StringFeedbackClass:
+           {
+               xStringFeedbackState *s;
+               XStringFeedbackState *S;
+
+               s = (xStringFeedbackState *) f;
+               S = (XStringFeedbackState *) Feedback;
+
+               S->class = s->class;
+               S->length = sizeof(XStringFeedbackState) +
+                   (s->num_syms_supported * sizeof(KeySym));
+               S->id = s->id;
+               S->max_symbols = s->max_symbols;
+               S->num_syms_supported = s->num_syms_supported;
+               S->syms_supported = (KeySym *) (S + 1);
+               memcpy((char *)S->syms_supported, (char *)(s + 1),
+                      (S->num_syms_supported * sizeof(KeySym)));
+               break;
+           }
+           case LedFeedbackClass:
+           {
+               xLedFeedbackState *l;
+               XLedFeedbackState *L;
+
+               l = (xLedFeedbackState *) f;
+               L = (XLedFeedbackState *) Feedback;
+
+               L->class = l->class;
+               L->length = sizeof(XLedFeedbackState);
+               L->id = l->id;
+               L->led_values = l->led_values;
+               L->led_mask = l->led_mask;
+               break;
+           }
+           case BellFeedbackClass:
+           {
+               xBellFeedbackState *b;
+               XBellFeedbackState *B;
+
+               b = (xBellFeedbackState *) f;
+               B = (XBellFeedbackState *) Feedback;
+
+               B->class = b->class;
+               B->length = sizeof(XBellFeedbackState);
+               B->id = b->id;
+               B->percent = b->percent;
+               B->pitch = b->pitch;
+               B->duration = b->duration;
+               break;
+           }
+           default:
+               break;
+           }
+           f = (xFeedbackState *) ((char *)f + f->length);
+           Feedback = (XFeedbackState *) ((char *)Feedback + Feedback->length);
+       }
+    }
+out:
+    XFree((char *)sav);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Sav);
+}
+
+void
+XFreeFeedbackList(XFeedbackState *list)
+{
+    XFree((char *)list);
+}
diff --git a/src/XGetKMap.c b/src/XGetKMap.c
new file mode 100644 (file)
index 0000000..4596ff0
--- /dev/null
@@ -0,0 +1,104 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XGetDeviceKeyMapping - get the keymap of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+KeySym *
+XGetDeviceKeyMapping(register Display * dpy, XDevice * dev,
+#if NeedWidePrototypes
+                    unsigned int first,
+#else
+                    KeyCode first,
+#endif
+                    int keycount, int *syms_per_code)
+{
+    long nbytes;
+    register KeySym *mapping = NULL;
+    xGetDeviceKeyMappingReq *req;
+    xGetDeviceKeyMappingReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return ((KeySym *) NoSuchExtension);
+
+    GetReq(GetDeviceKeyMapping, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_GetDeviceKeyMapping;
+    req->deviceid = dev->device_id;
+    req->firstKeyCode = first;
+    req->count = keycount;
+
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return (KeySym *) NULL;
+    }
+    if (rep.length > 0) {
+       *syms_per_code = rep.keySymsPerKeyCode;
+       nbytes = (long)rep.length << 2;
+       mapping = (KeySym *) Xmalloc((unsigned)nbytes);
+       if (mapping)
+           _XRead(dpy, (char *)mapping, nbytes);
+       else
+           _XEatData(dpy, (unsigned long)nbytes);
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (mapping);
+}
diff --git a/src/XGetMMap.c b/src/XGetMMap.c
new file mode 100644 (file)
index 0000000..a4bf094
--- /dev/null
@@ -0,0 +1,99 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XGetDeviceModifierMapping - get the modifier map of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XModifierKeymap *
+XGetDeviceModifierMapping(
+    register Display   *dpy,
+    XDevice            *dev)
+{
+    unsigned long nbytes;
+    XModifierKeymap *res;
+    xGetDeviceModifierMappingReq *req;
+    xGetDeviceModifierMappingReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return ((XModifierKeymap *) NoSuchExtension);
+
+    GetReq(GetDeviceModifierMapping, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_GetDeviceModifierMapping;
+    req->deviceid = dev->device_id;
+
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return (XModifierKeymap *) NULL;
+    }
+    nbytes = (unsigned long)rep.length << 2;
+    res = (XModifierKeymap *) Xmalloc(sizeof(XModifierKeymap));
+    if (res) {
+       res->modifiermap = (KeyCode *) Xmalloc(nbytes);
+       if (res->modifiermap)
+           _XReadPad(dpy, (char *)res->modifiermap, nbytes);
+       else
+           _XEatData(dpy, (unsigned long)nbytes);
+       res->max_keypermod = rep.numKeyPerModifier;
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (res);
+}
diff --git a/src/XGetProp.c b/src/XGetProp.c
new file mode 100644 (file)
index 0000000..7ccf9fe
--- /dev/null
@@ -0,0 +1,111 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XGetDeviceDontPropagateList - Get the dont_propagate_list for a
+ * window.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XEventClass *
+XGetDeviceDontPropagateList(
+    register Display   *dpy,
+    Window              window,
+    int                        *count)
+{
+    XEventClass *list = NULL;
+    int rlen;
+    xGetDeviceDontPropagateListReq *req;
+    xGetDeviceDontPropagateListReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return ((XEventClass *) NoSuchExtension);
+
+    GetReq(GetDeviceDontPropagateList, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_GetDeviceDontPropagateList;
+    req->window = window;
+
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return (XEventClass *) NULL;
+    }
+    *count = rep.count;
+
+    if (*count) {
+       rlen = rep.length << 2;
+       list = (XEventClass *) Xmalloc(rep.length * sizeof(XEventClass));
+       if (list) {
+           int i;
+           CARD32 ec;
+
+           /* read and assign each XEventClass separately because
+            * the library representation may not be the same size
+            * as the wire representation (64 bit machines)
+            */
+           for (i = 0; i < rep.length; i++) {
+               _XRead(dpy, (char *)(&ec), sizeof(CARD32));
+               list[i] = (XEventClass) ec;
+           }
+       } else
+           _XEatData(dpy, (unsigned long)rlen);
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (list);
+}
diff --git a/src/XGetVers.c b/src/XGetVers.c
new file mode 100755 (executable)
index 0000000..4718617
--- /dev/null
@@ -0,0 +1,113 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XGetExtensionVersion - Get the version of the input extension.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XExtensionVersion *
+XGetExtensionVersion(register Display * dpy, _Xconst char *name)
+{
+    XExtensionVersion *ext;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    ext = _XiGetExtensionVersion(dpy, name, info);
+    if (ext != (XExtensionVersion *) NoSuchExtension) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+    }
+    return (ext);
+}
+
+_X_HIDDEN XExtensionVersion*
+_XiGetExtensionVersionRequest(Display *dpy, _Xconst char *name, int xi_opcode)
+{
+    xGetExtensionVersionReq *req;
+    xGetExtensionVersionReply rep;
+    XExtensionVersion *ext;
+
+    GetReq(GetExtensionVersion, req);
+    req->reqType = xi_opcode;
+    req->ReqType = X_GetExtensionVersion;
+    req->nbytes = strlen(name);
+    req->length += (unsigned)(req->nbytes + 3) >> 2;
+    _XSend(dpy, name, (long)req->nbytes);
+
+    if (!_XReply(dpy, (xReply *) & rep, 0, xTrue)) {
+       return (XExtensionVersion *) NULL;
+    }
+
+    ext = (XExtensionVersion *) Xmalloc(sizeof(XExtensionVersion));
+    if (ext) {
+       ext->present = rep.present;
+       if (ext->present) {
+           ext->major_version = rep.major_version;
+           ext->minor_version = rep.minor_version;
+       }
+    }
+
+    return ext;
+}
+
+_X_HIDDEN XExtensionVersion *
+_XiGetExtensionVersion(register Display * dpy, _Xconst char *name,
+                       XExtDisplayInfo *info)
+{
+    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+       return ((XExtensionVersion *) NoSuchExtension);
+
+    return _XiGetExtensionVersionRequest(dpy, name, info->codes->major_opcode);
+}
diff --git a/src/XGrDvBut.c b/src/XGrDvBut.c
new file mode 100644 (file)
index 0000000..264effd
--- /dev/null
@@ -0,0 +1,109 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XGrabDeviceBut - Grab a button on an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XGrabDeviceButton(
+    register Display   *dpy,
+    XDevice            *dev,
+    unsigned int        button,        /* CARD8 */
+    unsigned int        modifiers,     /* CARD16 */
+    XDevice            *modifier_device,
+    Window              grab_window,
+    Bool                owner_events,
+    unsigned int        event_count,
+    XEventClass                *event_list,
+    int                         this_device_mode,
+    int                         other_devices_mode)
+{
+    register xGrabDeviceButtonReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(GrabDeviceButton, req);
+
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_GrabDeviceButton;
+    req->grabbed_device = dev->device_id;
+    req->button = button;
+    req->modifiers = modifiers;
+    if (modifier_device)
+       req->modifier_device = modifier_device->device_id;
+    else
+       req->modifier_device = UseXKeyboard;
+    req->grabWindow = grab_window;
+    req->ownerEvents = owner_events;
+    req->event_count = event_count;
+    req->this_device_mode = this_device_mode;
+    req->other_devices_mode = other_devices_mode;
+    req->length += event_count;
+
+    /* note: Data is a macro that uses its arguments multiple
+     * times, so "nvalues" is changed in a separate assignment
+     * statement */
+
+    event_count <<= 2;
+    Data32(dpy, (long *)event_list, event_count);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XGrDvKey.c b/src/XGrDvKey.c
new file mode 100644 (file)
index 0000000..3c36000
--- /dev/null
@@ -0,0 +1,111 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XGrabDeviceKey - Grab a key on an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XGrabDeviceKey(
+    register Display   *dpy,
+    XDevice            *dev,
+    unsigned int        key,           /* CARD8 */
+    unsigned int        modifiers,     /* CARD16 */
+    XDevice            *modifier_device,
+    Window              grab_window,
+    Bool                owner_events,
+    unsigned int        event_count,
+    XEventClass                *event_list,
+    int                         this_device_mode,
+    int                         other_devices_mode)
+{
+    register xGrabDeviceKeyReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(GrabDeviceKey, req);
+
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_GrabDeviceKey;
+    req->grabbed_device = dev->device_id;
+    req->key = key;
+    req->modifiers = modifiers;
+    if (modifier_device)
+       req->modifier_device = modifier_device->device_id;
+    else
+       req->modifier_device = UseXKeyboard;
+    req->grabWindow = grab_window;
+    req->ownerEvents = owner_events;
+    req->event_count = event_count;
+    req->this_device_mode = this_device_mode;
+    req->other_devices_mode = other_devices_mode;
+    req->length += event_count;
+
+    /* note: Data is a macro that uses its arguments multiple
+     * times, so "nvalues" is changed in a separate assignment
+     * statement */
+
+    if (event_count) {
+       event_count <<= 2;
+       Data32(dpy, (long *)event_list, event_count);
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XGrabDev.c b/src/XGrabDev.c
new file mode 100644 (file)
index 0000000..1cba1f6
--- /dev/null
@@ -0,0 +1,105 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XGrabDevice - grab an extension input device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XGrabDevice(
+    register Display   *dpy,
+    XDevice            *dev,
+    Window              grab_window,
+    Bool                ownerEvents,
+    int                         event_count,
+    XEventClass                *event_list,
+    int                         this_device_mode,
+    int                         other_devices_mode,
+    Time                time)
+{
+    xGrabDeviceReply rep;
+    register xGrabDeviceReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(GrabDevice, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_GrabDevice;
+
+    req->deviceid = dev->device_id;
+    req->grabWindow = grab_window;
+    req->ownerEvents = ownerEvents;
+    req->event_count = event_count;
+    req->this_device_mode = this_device_mode;
+    req->other_devices_mode = other_devices_mode;
+    req->time = time;
+    req->length += event_count;
+
+    /* note: Data is a macro that uses its arguments multiple
+     * times, so "nvalues" is changed in a separate assignment
+     * statement */
+
+    event_count <<= 2;
+    Data32(dpy, (long *)event_list, event_count);
+
+    if (_XReply(dpy, (xReply *) & rep, 0, xTrue) == 0)
+       rep.status = GrabSuccess;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (rep.status);
+}
diff --git a/src/XGtFocus.c b/src/XGtFocus.c
new file mode 100644 (file)
index 0000000..6b95361
--- /dev/null
@@ -0,0 +1,88 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XGetDeviceFocus - Get the focus of an input device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XGetDeviceFocus(
+    register Display   *dpy,
+    XDevice            *dev,
+    Window             *focus,
+    int                        *revert_to,
+    Time               *time)
+{
+    xGetDeviceFocusReq *req;
+    xGetDeviceFocusReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(GetDeviceFocus, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_GetDeviceFocus;
+    req->deviceid = dev->device_id;
+
+    (void)_XReply(dpy, (xReply *) & rep, 0, xTrue);
+    *focus = rep.focus;
+    *revert_to = rep.revertTo;
+    *time = rep.time;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XGtSelect.c b/src/XGtSelect.c
new file mode 100644 (file)
index 0000000..dea8c4c
--- /dev/null
@@ -0,0 +1,139 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XGetSelectedExtensionEvents - return a list of currently selected events.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XGetSelectedExtensionEvents(
+    register Display    *dpy,
+    Window               w,
+    int                         *this_client_count,
+    XEventClass                **this_client_list,
+    int                         *all_clients_count,
+    XEventClass                **all_clients_list)
+{
+    int tlen, alen;
+    register xGetSelectedExtensionEventsReq *req;
+    xGetSelectedExtensionEventsReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+    GetReq(GetSelectedExtensionEvents, req);
+
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_GetSelectedExtensionEvents;
+    req->window = w;
+
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return Success;
+    }
+
+    *this_client_count = rep.this_client_count;
+    *all_clients_count = rep.all_clients_count;
+
+    if (rep.length) {
+       int i;
+       CARD32 ec;
+
+       tlen = (*this_client_count) * sizeof(CARD32);
+       alen = (rep.length << 2) - tlen;
+
+       if (tlen) {
+           *this_client_list =
+               (XEventClass *) Xmalloc(*this_client_count *
+                                       sizeof(XEventClass));
+           if (!*this_client_list) {
+               _XEatData(dpy, (unsigned long)tlen + alen);
+                UnlockDisplay(dpy);
+                SyncHandle();
+               return (Success);
+           }
+           for (i = 0; i < *this_client_count; i++) {
+               _XRead(dpy, (char *)(&ec), sizeof(CARD32));
+               (*this_client_list)[i] = (XEventClass) ec;
+           }
+       } else
+           *this_client_list = (XEventClass *) NULL;
+       if (alen) {
+           *all_clients_list =
+               (XEventClass *) Xmalloc(*all_clients_count *
+                                       sizeof(XEventClass));
+           if (!*all_clients_list) {
+               Xfree((char *)*this_client_list);
+               *this_client_list = NULL;
+               _XEatData(dpy, (unsigned long)alen);
+                UnlockDisplay(dpy);
+                SyncHandle();
+               return (Success);
+           }
+           for (i = 0; i < *all_clients_count; i++) {
+               _XRead(dpy, (char *)(&ec), sizeof(CARD32));
+               (*all_clients_list)[i] = (XEventClass) ec;
+           }
+       } else
+           *all_clients_list = (XEventClass *) NULL;
+
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XIAllowEvents.c b/src/XIAllowEvents.c
new file mode 100644 (file)
index 0000000..75980a0
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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 <stdint.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+Status
+XIAllowEvents(Display *dpy, int deviceid, int event_mode, Time time)
+{
+    xXIAllowEventsReq *req;
+
+    XExtDisplayInfo *extinfo = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, extinfo) == -1)
+       return (NoSuchExtension);
+
+    GetReq(XIAllowEvents, req);
+    req->reqType = extinfo->codes->major_opcode;
+    req->ReqType = X_XIAllowEvents;
+    req->deviceid = deviceid;
+    req->mode = event_mode;
+    req->time = time;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return Success;
+}
diff --git a/src/XIDefineCursor.c b/src/XIDefineCursor.c
new file mode 100644 (file)
index 0000000..5ad1534
--- /dev/null
@@ -0,0 +1,65 @@
+/************************************************************
+
+Copyright 2006 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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+*/
+
+/***********************************************************************
+ *
+ * XIDefineCursor - Change the cursor of an extension input device.
+ *
+ */
+#include <stdint.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+
+int XIDefineCursor(Display *dpy, int deviceid, Window w, Cursor cursor)
+{
+    xXIChangeCursorReq *req;
+
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+    LockDisplay(dpy);
+
+    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(XIChangeCursor, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_XIChangeCursor;
+    req->deviceid = deviceid;
+    req->win = w;
+    req->cursor = cursor;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return Success;
+}
+
+int XIUndefineCursor(Display *dpy, int deviceid, Window w)
+{
+    return XIDefineCursor(dpy, deviceid, w, None);
+}
+
diff --git a/src/XIGetDevFocus.c b/src/XIGetDevFocus.c
new file mode 100644 (file)
index 0000000..1d2a9bf
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * 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 <stdint.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+Status
+XIGetFocus(Display *dpy, int deviceid, Window *focus_return)
+{
+    xXIGetFocusReq   *req;
+    xXIGetFocusReply reply;
+
+    XExtDisplayInfo *extinfo = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, extinfo) == -1)
+       return (NoSuchExtension);
+
+    GetReq(XIGetFocus, req);
+    req->reqType  = extinfo->codes->major_opcode;
+    req->ReqType  = X_XIGetFocus;
+    req->deviceid = deviceid;
+
+    if (!_XReply(dpy, (xReply*) &reply, 0, xFalse)) {
+        UnlockDisplay(dpy);
+        SyncHandle();
+        return False;
+    }
+
+    *focus_return = reply.focus;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return Success;
+
+}
+
diff --git a/src/XIGrabDevice.c b/src/XIGrabDevice.c
new file mode 100644 (file)
index 0000000..985d3f1
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * 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 <stdint.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+
+Status
+XIGrabDevice(Display* dpy, int deviceid, Window grab_window, Time time,
+             Cursor cursor, int grab_mode, int paired_device_mode,
+             Bool owner_events, XIEventMask *mask)
+{
+    xXIGrabDeviceReq *req;
+    xXIGrabDeviceReply reply;
+    char* buff;
+    int len;
+
+    XExtDisplayInfo *extinfo = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, extinfo) == -1)
+       return (NoSuchExtension);
+
+    GetReq(XIGrabDevice, req);
+    req->reqType  = extinfo->codes->major_opcode;
+    req->ReqType  = X_XIGrabDevice;
+    req->deviceid = deviceid;
+    req->grab_window = grab_window;
+    req->time = time;
+    req->grab_mode = grab_mode;
+    req->paired_device_mode = paired_device_mode;
+    req->owner_events = owner_events;
+    req->mask_len = (mask->mask_len + 3)/4;
+    req->cursor = cursor;
+
+
+    /* masks.mask_len is in bytes, but we need 4-byte units on the wire,
+     * and they need to be padded with 0 */
+    len = req->mask_len * 4;
+    buff = calloc(1, len);
+    memcpy(buff, mask->mask, mask->mask_len);
+
+    SetReqLen(req, len, len);
+    Data(dpy, buff, len * 4);
+    free(buff);
+
+    if (_XReply(dpy, (xReply *)&reply, 0, xTrue) == 0)
+       reply.status = GrabSuccess;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return reply.status;
+}
+
+Status
+XIUngrabDevice(Display* dpy, int deviceid, Time time)
+{
+    xXIUngrabDeviceReq *req;
+
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(XIUngrabDevice, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_XIUngrabDevice;
+
+    req->deviceid = deviceid;
+    req->time = time;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
+
+
diff --git a/src/XIHierarchy.c b/src/XIHierarchy.c
new file mode 100644 (file)
index 0000000..9b267bf
--- /dev/null
@@ -0,0 +1,156 @@
+/************************************************************
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+*/
+
+/***********************************************************************
+ *
+ * XIChangeHierarchy - change the device hierarchy, i.e. which slave
+ * device is attached to which master, etc.
+ */
+
+#include <stdint.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XIChangeHierarchy(Display* dpy,
+                        XIAnyHierarchyChangeInfo* changes,
+                        int num_changes)
+{
+    XIAnyHierarchyChangeInfo* any;
+    xXIChangeHierarchyReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+    char *data = NULL, *dptr;
+    int dlen = 0, i;
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(XIChangeHierarchy, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_XIChangeHierarchy;
+    req->num_changes = num_changes;
+
+    /* alloc required memory */
+    for (i = 0, any = changes; i < num_changes; i++, any++)
+    {
+        switch(any->type)
+        {
+            case XIAddMaster:
+                {
+                    int slen = (strlen(any->add.name));
+                    dlen += sizeof(xXIAddMasterInfo) +
+                        slen + (4 - (slen % 4));
+                }
+                break;
+            case XIRemoveMaster:
+                dlen += sizeof(xXIRemoveMasterInfo);
+                break;
+            case XIAttachSlave:
+                dlen += sizeof(xXIAttachSlaveInfo);
+                break;
+            case XIDetachSlave:
+                dlen += sizeof(xXIDetachSlaveInfo);
+                break;
+            default:
+                return BadValue;
+        }
+    }
+
+    req->length += dlen / 4; /* dlen is 4-byte aligned */
+    data = Xmalloc(dlen);
+    if (!data)
+        return BadAlloc;
+
+    dptr = data;
+    for (i = 0, any = changes; i < num_changes; i++, any++)
+    {
+        switch(any->type)
+        {
+                case XIAddMaster:
+                {
+                    XIAddMasterInfo* C = &any->add;
+                    xXIAddMasterInfo* c = (xXIAddMasterInfo*)dptr;
+                    c->type = C->type;
+                    c->send_core = C->send_core;
+                    c->enable = C->enable;
+                    c->name_len = strlen(C->name);
+                    c->length = (sizeof(xXIAddMasterInfo) + c->name_len + 3)/4;
+                    strncpy((char*)&c[1], C->name, c->name_len);
+                    dptr += c->length;
+                }
+                break;
+            case XIRemoveMaster:
+                {
+                    XIRemoveMasterInfo* R = &any->remove;
+                    xXIRemoveMasterInfo* r = (xXIRemoveMasterInfo*)dptr;
+                    r->type = R->type;
+                    r->return_mode = R->return_mode;
+                    r->deviceid = R->deviceid;
+                    r->length = sizeof(xXIRemoveMasterInfo)/4;
+                    if (r->return_mode == XIAttachToMaster)
+                    {
+                        r->return_pointer = R->return_pointer;
+                        r->return_keyboard = R->return_keyboard;
+                    }
+                    dptr += sizeof(xXIRemoveMasterInfo);
+                }
+                break;
+            case XIAttachSlave:
+                {
+                    XIAttachSlaveInfo* C = &any->attach;
+                    xXIAttachSlaveInfo* c = (xXIAttachSlaveInfo*)dptr;
+
+                    c->type = C->type;
+                    c->deviceid = C->deviceid;
+                    c->length = sizeof(xXIAttachSlaveInfo)/4;
+                    c->new_master = C->new_master;
+
+                    dptr += sizeof(xXIAttachSlaveInfo);
+                }
+                break;
+            case XIDetachSlave:
+                {
+                    XIDetachSlaveInfo *D = &any->detach;
+                    xXIDetachSlaveInfo *d = (xXIDetachSlaveInfo*)dptr;
+
+                    d->type = D->type;
+                    d->deviceid = D->deviceid;
+                    d->length = sizeof(xXIDetachSlaveInfo)/4;
+                    dptr += sizeof(xXIDetachSlaveInfo);
+                }
+        }
+    }
+
+    Data(dpy, data, dlen);
+    Xfree(data);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return Success;
+}
diff --git a/src/XIPassiveGrab.c b/src/XIPassiveGrab.c
new file mode 100644 (file)
index 0000000..8953013
--- /dev/null
@@ -0,0 +1,210 @@
+/*
+ * 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 <stdint.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+static int
+_XIPassiveGrabDevice(Display* dpy, int deviceid, int grabtype, int detail,
+                     Window grab_window, Cursor cursor,
+                     int grab_mode, int paired_device_mode,
+                     Bool owner_events, XIEventMask *mask,
+                     int num_modifiers, XIGrabModifiers *modifiers_inout)
+{
+    xXIPassiveGrabDeviceReq *req;
+    xXIPassiveGrabDeviceReply reply;
+    xXIGrabModifierInfo *failed_mods;
+    int len = 0, i;
+    char *buff;
+
+    XExtDisplayInfo *extinfo = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, extinfo) == -1)
+       return -1;
+
+    GetReq(XIPassiveGrabDevice, req);
+    req->reqType = extinfo->codes->major_opcode;
+    req->ReqType = X_XIPassiveGrabDevice;
+    req->deviceid = deviceid;
+    req->grab_mode = grab_mode;
+    req->paired_device_mode = paired_device_mode;
+    req->owner_events = owner_events;
+    req->grab_window = grab_window;
+    req->cursor = cursor;
+    req->detail = detail;
+    req->num_modifiers = num_modifiers;
+    req->mask_len = (mask->mask_len + 3)/4;
+    req->grab_type = grabtype;
+
+    len = req->mask_len + num_modifiers;
+    SetReqLen(req, len, len);
+
+    buff = calloc(4, req->mask_len);
+    memcpy(buff, mask->mask, mask->mask_len);
+    Data32(dpy, buff, req->mask_len * 4);
+    for (i = 0; i < num_modifiers; i++)
+        Data32(dpy, &modifiers_inout[i].modifiers, 4);
+
+    free(buff);
+
+    if (_XReply(dpy, (xReply *)&reply, 0, xTrue))
+    {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return -1;
+    }
+
+    failed_mods = calloc(reply.num_modifiers, sizeof(xXIGrabModifierInfo));
+    if (!failed_mods)
+        return -1;
+    _XRead(dpy, (char*)failed_mods, reply.num_modifiers * sizeof(xXIGrabModifierInfo));
+
+    for (i = 0; i < reply.num_modifiers; i++)
+    {
+        modifiers_inout[i].status = failed_mods[i].status;
+        modifiers_inout[i].modifiers = failed_mods[i].modifiers;
+    }
+    free(failed_mods);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return reply.num_modifiers;
+}
+
+int
+XIGrabButton(Display* dpy, int deviceid, int button,
+             Window grab_window, Cursor cursor,
+             int grab_mode, int paired_device_mode,
+             Bool owner_events, XIEventMask *mask,
+             int num_modifiers, XIGrabModifiers *modifiers_inout)
+{
+    return _XIPassiveGrabDevice(dpy, deviceid, XIGrabtypeButton, button,
+                                grab_window, cursor, grab_mode,
+                                paired_device_mode, owner_events, mask,
+                                num_modifiers, modifiers_inout);
+}
+
+int
+XIGrabKeycode(Display* dpy, int deviceid, int keycode,
+             Window grab_window, int grab_mode, int paired_device_mode,
+             Bool owner_events, XIEventMask *mask,
+             int num_modifiers, XIGrabModifiers *modifiers_inout)
+{
+    return _XIPassiveGrabDevice(dpy, deviceid, XIGrabtypeKeycode, keycode,
+                                grab_window, None, grab_mode, paired_device_mode,
+                                owner_events, mask, num_modifiers,
+                                modifiers_inout);
+}
+
+int
+XIGrabEnter(Display *dpy, int deviceid, Window grab_window, Cursor cursor,
+            int grab_mode, int paired_device_mode, Bool owner_events,
+            XIEventMask *mask, int num_modifiers,
+            XIGrabModifiers *modifiers_inout)
+{
+    return _XIPassiveGrabDevice(dpy, deviceid, XIGrabtypeEnter, 0,
+                                grab_window, cursor, grab_mode, paired_device_mode,
+                                owner_events, mask, num_modifiers,
+                                modifiers_inout);
+}
+
+int
+XIGrabFocusIn(Display *dpy, int deviceid, Window grab_window, int grab_mode,
+            int paired_device_mode, Bool owner_events, XIEventMask *mask,
+            int num_modifiers, XIGrabModifiers *modifiers_inout)
+{
+    return _XIPassiveGrabDevice(dpy, deviceid, XIGrabtypeFocusIn, 0,
+                                grab_window, None, grab_mode, paired_device_mode,
+                                owner_events, mask, num_modifiers,
+                                modifiers_inout);
+}
+
+static int
+_XIPassiveUngrabDevice(Display* dpy, int deviceid, int grabtype, int detail,
+                       Window grab_window, int num_modifiers, XIGrabModifiers *modifiers)
+{
+    xXIPassiveUngrabDeviceReq *req;
+    int i;
+
+    XExtDisplayInfo *extinfo = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, extinfo) == -1)
+       return -1;
+
+    GetReq(XIPassiveUngrabDevice, req);
+    req->reqType = extinfo->codes->major_opcode;
+    req->ReqType = X_XIPassiveUngrabDevice;
+    req->deviceid = deviceid;
+    req->grab_window = grab_window;
+    req->detail = detail;
+    req->num_modifiers = num_modifiers;
+    req->grab_type = grabtype;
+
+    SetReqLen(req, num_modifiers, num_modifiers);
+    for (i = 0; i < num_modifiers; i++)
+        Data32(dpy, &modifiers[i].modifiers, 4);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return Success;
+}
+
+int
+XIUngrabButton(Display* display, int deviceid, int button,Window grab_window,
+               int num_modifiers, XIGrabModifiers *modifiers)
+{
+    return _XIPassiveUngrabDevice(display, deviceid, XIGrabtypeButton, button,
+                                  grab_window, num_modifiers, modifiers);
+}
+
+int
+XIUngrabKeycode(Display* display, int deviceid, int keycode, Window grab_window,
+               int num_modifiers, XIGrabModifiers *modifiers)
+{
+    return _XIPassiveUngrabDevice(display, deviceid, XIGrabtypeKeycode, keycode,
+                                  grab_window, num_modifiers, modifiers);
+}
+
+
+int
+XIUngrabEnter(Display* display, int deviceid, Window grab_window,
+               int num_modifiers, XIGrabModifiers *modifiers)
+{
+    return _XIPassiveUngrabDevice(display, deviceid, XIGrabtypeEnter, 0,
+                                  grab_window, num_modifiers, modifiers);
+}
+
+int
+XIUngrabFocusIn(Display* display, int deviceid, Window grab_window,
+               int num_modifiers, XIGrabModifiers *modifiers)
+{
+    return _XIPassiveUngrabDevice(display, deviceid, XIGrabtypeFocusIn, 0,
+                                  grab_window, num_modifiers, modifiers);
+}
diff --git a/src/XIProperties.c b/src/XIProperties.c
new file mode 100755 (executable)
index 0000000..0f77e58
--- /dev/null
@@ -0,0 +1,242 @@
+/*
+ * 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.
+ *
+ */
+
+/***********************************************************************
+ * XI2 property requests, list, change, delete and get properties.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdint.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XI2.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+Atom*
+XIListProperties(Display* dpy, int deviceid, int *num_props_return)
+{
+    xXIListPropertiesReq        *req;
+    xXIListPropertiesReply      rep;
+    XExtDisplayInfo             *info = XInput_find_display(dpy);
+    Atom                        *props = NULL;
+
+    LockDisplay(dpy);
+    *num_props_return = 0;
+    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+       goto cleanup;
+
+    GetReq(XIListProperties, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_XIListProperties;
+    req->deviceid = deviceid;
+
+    if (!_XReply(dpy, (xReply*)&rep, 0, xFalse))
+        goto cleanup;
+
+    if (rep.num_properties) {
+        props = (Atom*)Xmalloc(rep.num_properties * sizeof(Atom));
+        if (!props)
+        {
+            _XEatData(dpy, rep.num_properties << 2);
+            goto cleanup;
+        }
+
+        _XRead32(dpy, (long*)props, rep.num_properties << 2);
+    }
+
+    *num_props_return = rep.num_properties;
+
+cleanup:
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return props;
+}
+
+
+void
+XIDeleteProperty(Display* dpy, int deviceid, Atom property)
+{
+    xXIDeletePropertyReq   *req;
+
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+       return;
+
+    GetReq(XIDeleteProperty, req);
+    req->reqType    = info->codes->major_opcode;
+    req->ReqType    = X_XIDeleteProperty;
+    req->deviceid   = deviceid;
+    req->property   = property;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+void
+XIChangeProperty(Display* dpy, int deviceid, Atom property, Atom type,
+                 int format, int mode, unsigned char *data, int num_items)
+{
+    xXIChangePropertyReq *req;
+    int len;
+
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+       return;
+
+    GetReq(XIChangeProperty, req);
+    req->reqType    = info->codes->major_opcode;
+    req->ReqType    = X_XIChangeProperty;
+    req->deviceid   = deviceid;
+    req->property   = property;
+    req->type       = type;
+    req->mode       = mode;
+    if (num_items < 0) {
+       req->num_items = 0;
+       req->format = 0; /* ask for garbage, get garbage */
+    } else {
+       req->num_items = num_items;
+       req->format = format;
+    }
+
+    switch (req->format) {
+    case 8:
+       len = (num_items + 3)/4;
+        SetReqLen(req, len, len);
+        len = num_items;
+       break;
+
+    case 16:
+       len = (num_items + 1)/2;
+        SetReqLen(req, len, len);
+        len = num_items * 2;
+       break;
+
+    case 32:
+       len = num_items;
+        SetReqLen(req, len, len);
+        len = num_items * 4;
+       break;
+
+    default:
+       /* BadValue will be generated */ ;
+        len = 0;
+    }
+
+    /* we use data instead of Data32 and friends to avoid Xlib's braindead
+     * 64 bit handling.*/
+
+    Data(dpy, (const char*)data, len);
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+Status
+XIGetProperty(Display* dpy, int deviceid, Atom property, long offset,
+              long length, Bool delete_property, Atom type,
+              Atom *type_return, int *format_return,
+              unsigned long *num_items_return,unsigned long *bytes_after_return,
+              unsigned char **data)
+{
+    xXIGetPropertyReq   *req;
+    xXIGetPropertyReply rep;
+    long                    nbytes, rbytes;
+
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+       return 1;
+
+    GetReq(XIGetProperty, req);
+    req->reqType    = info->codes->major_opcode;
+    req->ReqType    = X_XIGetProperty;
+    req->deviceid   = deviceid;
+    req->property   = property;
+    req->type       = type;
+    req->offset     = offset;
+    req->len        = length;
+    req->delete     = delete_property;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse))
+    {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return 1;
+    }
+
+    *data = NULL;
+
+    if (rep.type != None) {
+        if (rep.format != 8 && rep.format != 16 && rep.format != 32) {
+           /*
+            * This part of the code should never be reached.  If it is,
+            * the server sent back a property with an invalid format.
+            */
+           nbytes = rep.length << 2;
+           _XEatData(dpy, nbytes);
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return(BadImplementation);
+        }
+
+       /*
+        * One extra byte is malloced than is needed to contain the property
+        * data, but this last byte is null terminated and convenient for
+        * returning string properties, so the client doesn't then have to
+        * recopy the string to make it null terminated.
+        */
+
+        nbytes = rep.num_items * rep.format/8;
+        rbytes = nbytes + 1;
+        *data = Xmalloc(rbytes);
+
+       if (!(*data)) {
+           _XEatData(dpy, nbytes);
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return(BadAlloc);
+       }
+
+        _XReadPad (dpy, (char *)*data, nbytes);
+       (*data)[rbytes - 1] = '\0';
+    }
+
+    *type_return        = rep.type;
+    *format_return      = rep.format;
+    *num_items_return   = rep.num_items;
+    *bytes_after_return = rep.bytes_after;
+    UnlockDisplay (dpy);
+    SyncHandle();
+    return Success;
+}
diff --git a/src/XIQueryDevice.c b/src/XIQueryDevice.c
new file mode 100644 (file)
index 0000000..34c38cb
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * 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 <stdint.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+extern int copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses);
+extern int size_classes(xXIAnyInfo* from, int nclasses);
+
+XIDeviceInfo*
+XIQueryDevice(Display *dpy, int deviceid, int *ndevices_return)
+{
+    XIDeviceInfo        *info = NULL;
+    xXIQueryDeviceReq   *req;
+    xXIQueryDeviceReply reply;
+    char                *ptr;
+    int                 i;
+    char                *buf;
+
+    XExtDisplayInfo *extinfo = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, extinfo) == -1)
+       goto error;
+
+    GetReq(XIQueryDevice, req);
+    req->reqType  = extinfo->codes->major_opcode;
+    req->ReqType  = X_XIQueryDevice;
+    req->deviceid = deviceid;
+
+    if (!_XReply(dpy, (xReply*) &reply, 0, xFalse))
+        goto error;
+
+    *ndevices_return = reply.num_devices;
+    info = Xmalloc((reply.num_devices + 1) * sizeof(XIDeviceInfo));
+    if (!info)
+        goto error;
+
+    buf = Xmalloc(reply.length * 4);
+    _XRead(dpy, buf, reply.length * 4);
+    ptr = buf;
+
+    /* info is a null-terminated array */
+    info[reply.num_devices].name = NULL;
+
+    for (i = 0; i < reply.num_devices; i++)
+    {
+        XIDeviceInfo    *lib = &info[i];
+        xXIDeviceInfo   *wire = (xXIDeviceInfo*)ptr;
+
+        lib->deviceid    = wire->deviceid;
+        lib->use         = wire->use;
+        lib->attachment  = wire->attachment;
+        lib->enabled     = wire->enabled;
+        lib->num_classes = wire->num_classes;
+        lib->classes     = (XIAnyClassInfo**)&lib[1];
+
+        ptr += sizeof(xXIDeviceInfo);
+
+        lib->name = Xcalloc(wire->name_len + 1, 1);
+        strncpy(lib->name, ptr, wire->name_len);
+        ptr += ((wire->name_len + 3)/4) * 4;
+
+        lib->classes = Xmalloc(size_classes((xXIAnyInfo*)ptr, lib->num_classes));
+        ptr += copy_classes(lib, (xXIAnyInfo*)ptr, lib->num_classes);
+    }
+
+    Xfree(buf);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return info;
+
+error:
+    UnlockDisplay(dpy);
+    SyncHandle();
+    *ndevices_return = -1;
+    return NULL;
+}
+
+void
+XIFreeDeviceInfo(XIDeviceInfo* info)
+{
+    XIDeviceInfo *ptr = info;
+    while(ptr->name)
+    {
+        Xfree(ptr->classes);
+        Xfree(ptr->name);
+        ptr++;
+    }
+    Xfree(info);
+}
diff --git a/src/XIQueryPointer.c b/src/XIQueryPointer.c
new file mode 100644 (file)
index 0000000..b3bfebc
--- /dev/null
@@ -0,0 +1,101 @@
+/************************************************************
+
+Copyright 2006 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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+*/
+
+/***********************************************************************
+ *
+ * XIQueryPointer - Query the pointer of an extension input device.
+ *
+ */
+
+#include <stdint.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+#define FP1616toDBL(x) ((x) * 1.0 / (1 << 16))
+
+Bool
+XIQueryPointer(Display     *dpy,
+               int         deviceid,
+               Window      w,
+               Window      *root,
+               Window      *child,
+               double      *root_x,
+               double      *root_y,
+               double      *win_x,
+               double      *win_y,
+               XIButtonState       *buttons,
+               XIModifierState     *mods,
+               XIGroupState        *group)
+{
+    xXIQueryPointerReq *req;
+    xXIQueryPointerReply rep;
+
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+       return False;
+
+    GetReq(XIQueryPointer, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_XIQueryPointer;
+    req->deviceid = deviceid;
+    req->win = w;
+
+    if (!_XReply(dpy, (xReply *)&rep,
+                 (sizeof(xXIQueryPointerReply) - sizeof(xReply))/4, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+
+
+    *root = rep.root;
+    *child = rep.child;
+    *root_x = FP1616toDBL(cvtINT16toInt(rep.root_x));
+    *root_y = FP1616toDBL(cvtINT16toInt(rep.root_y));
+    *win_x = FP1616toDBL(cvtINT16toInt(rep.win_x));
+    *win_y = FP1616toDBL(cvtINT16toInt(rep.win_y));
+
+    mods->base          = rep.mods.base_mods;
+    mods->latched       = rep.mods.latched_mods;
+    mods->locked        = rep.mods.locked_mods;
+    group->base         = rep.group.base_group;
+    group->latched      = rep.group.latched_group;
+    group->locked       = rep.group.locked_group;
+
+    buttons->mask_len   = rep.buttons_len * 4;
+    buttons->mask       = malloc(buttons->mask_len);
+    if (buttons->mask)
+        _XRead(dpy, (char*)buttons->mask, buttons->mask_len);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return rep.same_screen;
+}
diff --git a/src/XIQueryVersion.c b/src/XIQueryVersion.c
new file mode 100755 (executable)
index 0000000..1e4f9a4
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * 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 <stdint.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+Status
+XIQueryVersion(Display *dpy, int *major_inout, int *minor_inout)
+{
+    int rc = Success;
+
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    rc = _xiQueryVersion(dpy, major_inout, minor_inout, info);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return rc;
+}
+
+_X_HIDDEN Status
+_xiQueryVersion(Display * dpy, int *major, int *minor, XExtDisplayInfo *info)
+{
+    xXIQueryVersionReq *req;
+    xXIQueryVersionReply rep;
+
+    /* This could mean either a malloc problem, or supported
+        version < XInput_2_0 */
+    if (_XiCheckExtInit(dpy, XInput_2_0, info) == -1)
+    {
+        XExtensionVersion *ext;
+        XExtDisplayInfo *info = XInput_find_display(dpy);
+
+        if (!info || !info->data) {
+            *major = 0;
+            *minor = 0;
+            return BadRequest;
+        }
+
+        ext = ((XInputData*)info->data)->vers;
+
+        *major = ext->major_version;
+        *minor = ext->minor_version;
+       return BadRequest;
+    }
+
+    GetReq(XIQueryVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_XIQueryVersion;
+    req->major_version = *major;
+    req->minor_version = *minor;
+
+    if (!_XReply(dpy, (xReply*)&rep, 0, xTrue)) {
+       return BadImplementation;
+    }
+    *major = rep.major_version;
+    *minor = rep.minor_version;
+    return Success;
+}
diff --git a/src/XISelEv.c b/src/XISelEv.c
new file mode 100755 (executable)
index 0000000..f1f3fa4
--- /dev/null
@@ -0,0 +1,173 @@
+/************************************************************
+
+Copyright 2009 Red Hat, Inc.
+
+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.
+
+*/
+
+/***********************************************************************
+ *
+ * XISelectEvent - Select for XI2 events.
+ *
+ */
+
+
+#include <stdint.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/ge.h>
+#include <X11/extensions/geproto.h>
+#include "XIint.h"
+
+int
+XISelectEvents(Display* dpy, Window win, XIEventMask* masks, int num_masks)
+{
+    XIEventMask  *current;
+    xXISelectEventsReq  *req;
+    xXIEventMask mask;
+    int i;
+    int len = 0;
+    int r = Success;
+
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1) {
+        r = NoSuchExtension;
+        goto out;
+    }
+    GetReq(XISelectEvents, req);
+
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_XISelectEvents;
+    req->win = win;
+    req->num_masks = num_masks;
+
+    /* get the right length */
+    for (i = 0; i < num_masks; i++)
+    {
+        len++;
+        current = &masks[i];
+        len += (current->mask_len + 3)/4;
+    }
+
+    SetReqLen(req, len, len);
+
+    for (i = 0; i < num_masks; i++)
+    {
+        char *buff;
+        current = &masks[i];
+        mask.deviceid = current->deviceid;
+        mask.mask_len = (current->mask_len + 3)/4;
+        /* masks.mask_len is in bytes, but we need 4-byte units on the wire,
+         * and they need to be padded with 0 */
+        buff = calloc(1, mask.mask_len * 4);
+        memcpy(buff, current->mask, current->mask_len);
+        Data32(dpy, &mask, sizeof(xXIEventMask));
+        Data(dpy, buff, mask.mask_len * 4);
+        free(buff);
+    }
+
+out:
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return r;
+
+}
+
+XIEventMask*
+XIGetSelectedEvents(Display* dpy, Window win, int *num_masks_return)
+{
+    int i, len = 0;
+    unsigned char *mask;
+    XIEventMask *mask_out = NULL;
+    xXIEventMask *mask_in = NULL, *mi;
+    xXIGetSelectedEventsReq *req;
+    xXIGetSelectedEventsReply reply;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    *num_masks_return = -1;
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+        goto out;
+
+    GetReq(XIGetSelectedEvents, req);
+
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_XIGetSelectedEvents;
+    req->win = win;
+
+    if (!_XReply(dpy, (xReply *) &reply, 0, xFalse))
+        goto out;
+
+    if (reply.num_masks == 0)
+    {
+        *num_masks_return = 0;
+        goto out;
+    }
+
+    mask_in = Xmalloc(reply.length * 4);
+    if (!mask_in)
+        goto out;
+
+    _XRead(dpy, (char*)mask_in, reply.length * 4);
+
+    /* Memory layout of the XIEventMask for a 3 mask reply:
+     * [struct a][struct b][struct c][masks a][masks b][masks c]
+     */
+    len = reply.num_masks * sizeof(XIEventMask);
+
+    for (i = 0, mi = mask_in; i < reply.num_masks; i++)
+    {
+        len += mi->mask_len * 4;
+        mi = (xXIEventMask*)((char*)mi + mi->mask_len * 4);
+        mi++;
+    }
+
+    mask_out = Xmalloc(len);
+    if (!mask_out)
+        goto out;
+
+    mi = mask_in;
+    mask = (unsigned char*)&mask_out[reply.num_masks];
+    for (i = 0; i < reply.num_masks; i++)
+    {
+        mask_out[i].deviceid = mi->deviceid;
+        mask_out[i].mask_len = mi->mask_len * 4;
+        mask_out[i].mask = mask;
+        memcpy(mask_out[i].mask, &mi[1], mask_out[i].mask_len);
+        mask += mask_out[i].mask_len;
+        mi = (xXIEventMask*)((char*)mi + mi->mask_len * 4);
+        mi++;
+    }
+
+    *num_masks_return = reply.num_masks;
+
+out:
+    Xfree(mask_in);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return mask_out;
+}
diff --git a/src/XISetDevFocus.c b/src/XISetDevFocus.c
new file mode 100644 (file)
index 0000000..e1567bd
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * 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 <stdint.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+Status
+XISetFocus(Display *dpy, int deviceid, Window focus, Time time)
+{
+    xXISetFocusReq   *req;
+
+    XExtDisplayInfo *extinfo = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, extinfo) == -1)
+       return (NoSuchExtension);
+
+    GetReq(XISetFocus, req);
+    req->reqType  = extinfo->codes->major_opcode;
+    req->ReqType  = X_XISetFocus;
+    req->deviceid = deviceid;
+    req->focus    = focus;
+    req->time     = time;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return Success;
+
+}
+
diff --git a/src/XIWarpPointer.c b/src/XIWarpPointer.c
new file mode 100644 (file)
index 0000000..038a0d3
--- /dev/null
@@ -0,0 +1,77 @@
+/************************************************************
+
+Copyright 2006 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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+*/
+
+/***********************************************************************
+ *
+ * XIWarpPointer - Warp the pointer of an extension input device.
+ *
+ */
+
+#include <stdint.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XIWarpPointer(Display      *dpy,
+              int          deviceid,
+              Window       src_win,
+              Window       dst_win,
+              double       src_x,
+              double       src_y,
+              unsigned int src_width,
+              unsigned int src_height,
+              double       dst_x,
+              double       dst_y)
+{
+    xXIWarpPointerReq *req;
+
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(XIWarpPointer, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_XIWarpPointer;
+    req->deviceid = deviceid;
+    req->src_win = src_win;
+    req->dst_win = dst_win;
+    req->src_x = (int)(src_x * 65536.0);
+    req->src_y = (int)(src_y * 65536.0);
+    req->src_width = src_width;
+    req->src_height = src_height;
+    req->dst_x = (int)(dst_x * 65536.0);
+    req->dst_y = (int)(dst_y * 65536.0);
+
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return Success;
+}
diff --git a/src/XIint.h b/src/XIint.h
new file mode 100755 (executable)
index 0000000..b27f04a
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ *     XIint.h - Header definition and support file for the internal
+ *     support routines used by the Xi library.
+ */
+
+#ifndef _XIINT_H_
+#define _XIINT_H_
+#include <X11/extensions/XI.h>
+
+extern XExtDisplayInfo *XInput_find_display(Display *);
+
+extern int _XiCheckExtInit(Display *, int, XExtDisplayInfo *);
+
+extern XExtensionVersion *_XiGetExtensionVersion(Display *, _Xconst char *, XExtDisplayInfo *);
+extern XExtensionVersion* _XiGetExtensionVersionRequest(Display *dpy, _Xconst char *name, int xi_opcode);
+extern Status _xiQueryVersion(Display *dpy, int*, int*, XExtDisplayInfo *);
+
+extern Status _XiEventToWire(
+    register Display *         /* dpy */,
+    register XEvent *          /* re */,
+    register xEvent **         /* event */,
+    register int *             /* count */
+);
+
+typedef struct _XInputData
+{
+    XEvent data;
+    XExtensionVersion *vers;
+} XInputData;
+
+
+/**
+ * Returns the next valid memory block of the given size within the block
+ * previously allocated.
+ * Use letting pointers inside a struct point to bytes after the same
+ * struct, e.g. during protocol parsing etc.
+ *
+ * Caller is responsible for allocating enough memory.
+ *
+ * Example:
+ *    void *ptr;
+ *    struct foo {
+ *       int num_a;
+ *       int num_b;
+ *       int *a;
+ *       int *b;
+ *    } bar;
+ *
+ *    ptr = malloc(large_enough);
+ *    bar = next_block(&ptr, sizeof(struct foo));
+ *    bar->num_a = 10;
+ *    bar->num_b = 20;
+ *    bar->a = next_block(&ptr, bar->num_a);
+ *    bar->b = next_block(&ptr, bar->num_b);
+ */
+static inline void*
+next_block(void **ptr, int size) {
+    void *ret = *ptr;
+
+    if (!*ptr)
+        return NULL;
+
+    *(unsigned char**)ptr += size;
+
+    return ret;
+}
+
+#endif
diff --git a/src/XListDProp.c b/src/XListDProp.c
new file mode 100644 (file)
index 0000000..66b9eca
--- /dev/null
@@ -0,0 +1,82 @@
+/************************************************************
+
+Copyright 2008 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.
+
+*/
+
+/***********************************************************************
+ * XListDeviceProperties - List an input device's properties.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <X11/Xlibint.h>
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+Atom*
+XListDeviceProperties(Display* dpy, XDevice* dev, int *nprops_return)
+{
+    xListDevicePropertiesReq    *req;
+    xListDevicePropertiesReply  rep;
+    XExtDisplayInfo             *info = XInput_find_display(dpy);
+    Atom                        *props = NULL;
+
+    LockDisplay(dpy);
+    *nprops_return = 0;
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       goto cleanup;
+
+    GetReq(ListDeviceProperties, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_ListDeviceProperties;
+    req->deviceid = dev->device_id;
+
+    if (!_XReply(dpy, (xReply*)&rep, 0, xFalse))
+        goto cleanup;
+
+    if (rep.nAtoms) {
+        props = (Atom*)Xmalloc(rep.nAtoms * sizeof(Atom));
+        if (!props)
+        {
+            _XEatData(dpy, rep.nAtoms << 2);
+            goto cleanup;
+        }
+
+        _XRead32(dpy, props, rep.nAtoms << 2);
+    }
+
+    *nprops_return = rep.nAtoms;
+
+cleanup:
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return props;
+}
+
diff --git a/src/XListDev.c b/src/XListDev.c
new file mode 100755 (executable)
index 0000000..c544ae0
--- /dev/null
@@ -0,0 +1,260 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XListInputDevices - Request the server to return a list of 
+ *                      available input devices.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+static int
+SizeClassInfo(xAnyClassPtr *any, int num_classes)
+{
+    int size = 0;
+    int j;
+    for (j = 0; j < num_classes; j++) {
+        switch ((*any)->class) {
+            case KeyClass:
+                size += sizeof(XKeyInfo);
+                break;
+            case ButtonClass:
+                size += sizeof(XButtonInfo);
+                break;
+            case ValuatorClass:
+                {
+                    xValuatorInfoPtr v;
+
+                    v = (xValuatorInfoPtr) *any;
+                    size += sizeof(XValuatorInfo) +
+                        (v->num_axes * sizeof(XAxisInfo));
+                    break;
+                }
+            default:
+                break;
+        }
+        *any = (xAnyClassPtr) ((char *)(*any) + (*any)->length);
+    }
+
+    return size;
+}
+
+static void
+ParseClassInfo(xAnyClassPtr *any, XAnyClassPtr *Any, int num_classes)
+{
+    int j, k;
+
+    for (j = 0; j < num_classes; j++) {
+        switch ((*any)->class) {
+            case KeyClass:
+                {
+                    XKeyInfoPtr K = (XKeyInfoPtr) *Any;
+                    xKeyInfoPtr k = (xKeyInfoPtr) *any;
+
+                    K->class = KeyClass;
+                    K->length = sizeof(XKeyInfo);
+                    K->min_keycode = k->min_keycode;
+                    K->max_keycode = k->max_keycode;
+                    K->num_keys = k->num_keys;
+                    break;
+                }
+            case ButtonClass:
+                {
+                    XButtonInfoPtr B = (XButtonInfoPtr) *Any;
+                    xButtonInfoPtr b = (xButtonInfoPtr) *any;
+
+                    B->class = ButtonClass;
+                    B->length = sizeof(XButtonInfo);
+                    B->num_buttons = b->num_buttons;
+                    break;
+                }
+            case ValuatorClass:
+                {
+                    XValuatorInfoPtr V = (XValuatorInfoPtr) *Any;
+                    xValuatorInfoPtr v = (xValuatorInfoPtr) *any;
+                    XAxisInfoPtr A;
+                    xAxisInfoPtr a;
+
+                    V->class = ValuatorClass;
+                    V->length = sizeof(XValuatorInfo) +
+                        (v->num_axes * sizeof(XAxisInfo));
+                    V->num_axes = v->num_axes;
+                    V->motion_buffer = v->motion_buffer_size;
+                    V->mode = v->mode;
+                    A = (XAxisInfoPtr) ((char *)V + sizeof(XValuatorInfo));
+                    V->axes = A;
+                    a = (xAxisInfoPtr) ((char *)(*any) + sizeof(xValuatorInfo));
+                    for (k = 0; k < (int)v->num_axes; k++, a++, A++) {
+                        A->min_value = a->min_value;
+                        A->max_value = a->max_value;
+                        A->resolution = a->resolution;
+                    }
+                    break;
+                }
+            default:
+                break;
+        }
+        *any = (xAnyClassPtr) ((char *)(*any) + (*any)->length);
+        *Any = (XAnyClassPtr) ((char *)(*Any) + (*Any)->length);
+    }
+}
+
+XDeviceInfo *
+XListInputDevices(
+    register Display   *dpy,
+    int                        *ndevices)
+{
+    int size;
+    xListInputDevicesReq *req;
+    xListInputDevicesReply rep;
+    xDeviceInfo *list, *slist = NULL;
+    XDeviceInfo *sclist = NULL;
+    XDeviceInfo *clist = NULL;
+    xAnyClassPtr any, sav_any;
+    XAnyClassPtr Any;
+    char *nptr, *Nptr;
+    int i;
+    long rlen;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return ((XDeviceInfo *) NULL);
+
+    GetReq(ListInputDevices, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_ListInputDevices;
+
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return (XDeviceInfo *) NULL;
+    }
+
+    if ((*ndevices = rep.ndevices)) {  /* at least 1 input device */
+       size = *ndevices * sizeof(XDeviceInfo);
+       rlen = rep.length << 2; /* multiply length by 4    */
+       list = (xDeviceInfo *) Xmalloc(rlen);
+       slist = list;
+       if (!slist) {
+           _XEatData(dpy, (unsigned long)rlen);
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return (XDeviceInfo *) NULL;
+       }
+       _XRead(dpy, (char *)list, rlen);
+
+       any = (xAnyClassPtr) ((char *)list + (*ndevices * sizeof(xDeviceInfo)));
+       sav_any = any;
+       for (i = 0; i < *ndevices; i++, list++) {
+            size += SizeClassInfo(&any, (int)list->num_classes);
+       }
+
+       for (i = 0, nptr = (char *)any; i < *ndevices; i++) {
+           size += *nptr + 1;
+           nptr += (*nptr + 1);
+       }
+
+       clist = (XDeviceInfoPtr) Xmalloc(size);
+       if (!clist) {
+           XFree((char *)slist);
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return (XDeviceInfo *) NULL;
+       }
+       sclist = clist;
+       Any = (XAnyClassPtr) ((char *)clist +
+                             (*ndevices * sizeof(XDeviceInfo)));
+       list = slist;
+       any = sav_any;
+       for (i = 0; i < *ndevices; i++, list++, clist++) {
+           clist->type = list->type;
+           clist->id = list->id;
+           clist->use = list->use;
+           clist->num_classes = list->num_classes;
+           clist->inputclassinfo = Any;
+
+            ParseClassInfo(&any, &Any, (int)list->num_classes);
+       }
+
+       clist = sclist;
+       nptr = (char *)any;
+       Nptr = (char *)Any;
+       for (i = 0; i < *ndevices; i++, clist++) {
+           clist->name = (char *)Nptr;
+           memcpy(Nptr, nptr + 1, *nptr);
+           Nptr += (*nptr);
+           *Nptr++ = '\0';
+           nptr += (*nptr + 1);
+       }
+    }
+
+    XFree((char *)slist);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (sclist);
+}
+
+/***********************************************************************
+ *
+ * Free the list of input devices.
+ *
+ */
+
+void
+XFreeDeviceList(XDeviceInfo *list)
+{
+    if (list != NULL) {
+       XFree((char *)list);
+    }
+}
diff --git a/src/XOpenDev.c b/src/XOpenDev.c
new file mode 100644 (file)
index 0000000..b50d5b0
--- /dev/null
@@ -0,0 +1,106 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XOpenDevice - Request the server to open and extension input device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XDevice *
+XOpenDevice(
+    register Display   *dpy,
+    register XID        id)
+{
+    register long rlen;        /* raw length */
+    xOpenDeviceReq *req;
+    xOpenDeviceReply rep;
+    XDevice *dev;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return ((XDevice *) NoSuchExtension);
+
+    GetReq(OpenDevice, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_OpenDevice;
+    req->deviceid = id;
+
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return (XDevice *) NULL;
+    }
+
+    rlen = rep.length << 2;
+    dev = (XDevice *) Xmalloc(sizeof(XDevice) + rep.num_classes *
+                             sizeof(XInputClassInfo));
+    if (dev) {
+       int dlen;       /* data length */
+
+       dev->device_id = req->deviceid;
+       dev->num_classes = rep.num_classes;
+       dev->classes = (XInputClassInfo *) ((char *)dev + sizeof(XDevice));
+       dlen = rep.num_classes * sizeof(xInputClassInfo);
+       _XRead(dpy, (char *)dev->classes, dlen);
+       /* could be padding that we still need to eat (yummy!) */
+       if (rlen - dlen > 0)
+           _XEatData(dpy, (unsigned long)rlen - dlen);
+    } else
+       _XEatData(dpy, (unsigned long)rlen);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (dev);
+}
diff --git a/src/XQueryDv.c b/src/XQueryDv.c
new file mode 100755 (executable)
index 0000000..637d5cf
--- /dev/null
@@ -0,0 +1,184 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XQueryDeviceState - Query the state of an extension input device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+XDeviceState *
+XQueryDeviceState(
+    register Display   *dpy,
+    XDevice            *dev)
+{
+    int i, j;
+    int rlen;
+    int size = 0;
+    xQueryDeviceStateReq *req;
+    xQueryDeviceStateReply rep;
+    XDeviceState *state = NULL;
+    XInputClass *any, *Any;
+    char *data = NULL;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return ((XDeviceState *) NoSuchExtension);
+
+    GetReq(QueryDeviceState, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_QueryDeviceState;
+    req->deviceid = dev->device_id;
+
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
+        goto out;
+
+    rlen = rep.length << 2;
+    if (rlen > 0) {
+       data = Xmalloc(rlen);
+       if (!data) {
+           _XEatData(dpy, (unsigned long)rlen);
+           goto out;
+       }
+       _XRead(dpy, data, rlen);
+
+       for (i = 0, any = (XInputClass *) data; i < (int)rep.num_classes; i++) {
+           switch (any->class) {
+           case KeyClass:
+               size += sizeof(XKeyState);
+               break;
+           case ButtonClass:
+               size += sizeof(XButtonState);
+               break;
+           case ValuatorClass:
+           {
+               xValuatorState *v = (xValuatorState *) any;
+               size += (sizeof(XValuatorState) +
+                        (v->num_valuators * sizeof(int)));
+           }
+               break;
+           }
+           any = (XInputClass *) ((char *)any + any->length);
+       }
+       state = (XDeviceState *) Xmalloc(size + sizeof(XDeviceState));
+       if (!state)
+            goto out;
+
+       state->device_id = dev->device_id;
+       state->num_classes = rep.num_classes;
+       state->data = (XInputClass *) (state + 1);
+
+       Any = state->data;
+       for (i = 0, any = (XInputClass *) data; i < (int)rep.num_classes; i++) {
+           switch (any->class) {
+           case KeyClass:
+           {
+               xKeyState *k = (xKeyState *) any;
+               XKeyState *K = (XKeyState *) Any;
+
+               K->class = k->class;
+               K->length = sizeof(XKeyState);
+               K->num_keys = k->num_keys;
+               memcpy((char *)&K->keys[0], (char *)&k->keys[0], 32);
+               Any = (XInputClass *) (K + 1);
+           }
+               break;
+           case ButtonClass:
+           {
+               xButtonState *b = (xButtonState *) any;
+               XButtonState *B = (XButtonState *) Any;
+
+               B->class = b->class;
+               B->length = sizeof(XButtonState);
+               B->num_buttons = b->num_buttons;
+               memcpy((char *)&B->buttons[0], (char *)&b->buttons[0], 32);
+               Any = (XInputClass *) (B + 1);
+           }
+               break;
+           case ValuatorClass:
+           {
+               xValuatorState *v = (xValuatorState *) any;
+               XValuatorState *V = (XValuatorState *) Any;
+               CARD32 *valuators = (CARD32 *) (v + 1);
+
+               V->class = v->class;
+               V->length = sizeof(XValuatorState) +
+                           v->num_valuators * sizeof(int);
+               V->num_valuators = v->num_valuators;
+               V->mode = v->mode;
+               Any = (XInputClass *) (V + 1);
+               V->valuators = (int *)Any;
+               for (j = 0; j < (int)V->num_valuators; j++)
+                   *(V->valuators + j) = *valuators++;
+               Any = (XInputClass *) ((char *)Any +
+                                      V->num_valuators * sizeof(int));
+           }
+               break;
+           }
+           any = (XInputClass *) ((char *)any + any->length);
+       }
+    }
+out:
+    Xfree(data);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (state);
+}
+
+void
+XFreeDeviceState(XDeviceState *list)
+{
+    XFree((char *)list);
+}
diff --git a/src/XSelect.c b/src/XSelect.c
new file mode 100644 (file)
index 0000000..fb401a6
--- /dev/null
@@ -0,0 +1,91 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XSelectExtensionEvent - Select input from an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XSelectExtensionEvent(
+    register Display   *dpy,
+    Window              w,
+    XEventClass                *event_list,
+    int                         count)
+{
+    register xSelectExtensionEventReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+    GetReq(SelectExtensionEvent, req);
+
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_SelectExtensionEvent;
+    req->window = w;
+    req->count = count;
+    req->length += count;
+
+    /* note: Data is a macro that uses its arguments multiple
+     * times, so "nvalues" is changed in a separate assignment
+     * statement */
+
+    count <<= 2;
+    Data32(dpy, (long *)event_list, count);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XSetBMap.c b/src/XSetBMap.c
new file mode 100755 (executable)
index 0000000..d0a6398
--- /dev/null
@@ -0,0 +1,89 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XSetDeviceButtonMapping - Set the button mapping of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+/* returns either  DeviceMappingSuccess or DeviceMappingBusy  */
+
+int
+XSetDeviceButtonMapping(
+    register Display   *dpy,
+    XDevice            *device,
+    unsigned char       map[],
+    int                         nmap)
+{
+    register xSetDeviceButtonMappingReq *req;
+    xSetDeviceButtonMappingReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+    GetReq(SetDeviceButtonMapping, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_SetDeviceButtonMapping;
+    req->map_length = nmap;
+    req->length += (nmap + 3) >> 2;
+    req->deviceid = device->device_id;
+
+    Data(dpy, (char *)map, (long)nmap);        /* note that map is char[] */
+    if (_XReply(dpy, (xReply *) & rep, 0, xFalse) == 0)        /* suppress error   */
+       rep.status = MappingSuccess;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return ((int)rep.status);
+}
diff --git a/src/XSetCPtr.c b/src/XSetCPtr.c
new file mode 100644 (file)
index 0000000..1176c5d
--- /dev/null
@@ -0,0 +1,62 @@
+/************************************************************
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+*/
+
+/***********************************************************************
+ *
+ * XISetClientPointer - Sets the default pointer for a client. This call is
+ * important for legacy applications that may send ambiguous requests to the
+ * server where the server has to randomly pick a device.
+ * Ideally, the window manager will always send a SetClientPointer request
+ * before the client interacts with an application.
+ */
+
+#include <stdint.h>
+#include <X11/extensions/XI2proto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+Status 
+XISetClientPointer(Display* dpy, Window win, int deviceid)
+{
+    xXISetClientPointerReq* req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, Dont_Check, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(XISetClientPointer, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_XISetClientPointer;
+    req->win = win;
+    req->deviceid = deviceid;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return Success;
+}
diff --git a/src/XSetDVal.c b/src/XSetDVal.c
new file mode 100644 (file)
index 0000000..dcbf25e
--- /dev/null
@@ -0,0 +1,96 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XSetDeviceValuators - Set the value of valuators on an extension input
+ * device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XSetDeviceValuators(
+    register Display   *dpy,
+    XDevice            *dev,
+    int                        *valuators,
+    int                         first_valuator,
+    int                         num_valuators)
+{
+    xSetDeviceValuatorsReq *req;
+    xSetDeviceValuatorsReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Add_XSetDeviceValuators, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(SetDeviceValuators, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_SetDeviceValuators;
+    req->deviceid = dev->device_id;
+    req->first_valuator = first_valuator;
+    req->num_valuators = num_valuators;
+    req->length += num_valuators;
+
+    /* note: Data is a macro that uses its arguments multiple
+     * times, so "nvalues" is changed in a separate assignment
+     * statement */
+
+    num_valuators <<= 2;
+    Data(dpy, (char *)valuators, num_valuators);
+
+    (void)_XReply(dpy, (xReply *) & rep, 0, xTrue);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (rep.status);
+}
diff --git a/src/XSetMMap.c b/src/XSetMMap.c
new file mode 100644 (file)
index 0000000..11e8859
--- /dev/null
@@ -0,0 +1,89 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XSetDeviceModifierMapping - set the modifier map of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XSetDeviceModifierMapping(
+    register Display   *dpy,
+    XDevice            *dev,
+    XModifierKeymap    *modmap)
+{
+    int mapSize = modmap->max_keypermod << 3;  /* 8 modifiers */
+    xSetDeviceModifierMappingReq *req;
+    xSetDeviceModifierMappingReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReqExtra(SetDeviceModifierMapping, mapSize, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_SetDeviceModifierMapping;
+    req->deviceid = dev->device_id;
+    req->numKeyPerModifier = modmap->max_keypermod;
+    memcpy((char *)&req[1], modmap->modifiermap, mapSize);
+
+    (void)_XReply(dpy, (xReply *) & rep,
+                 (sizeof(xSetDeviceModifierMappingReply) -
+                  sizeof(xReply)) >> 2, xTrue);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (rep.success);
+}
diff --git a/src/XSetMode.c b/src/XSetMode.c
new file mode 100644 (file)
index 0000000..b184a33
--- /dev/null
@@ -0,0 +1,84 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XSetDeviceMode - Set the mode of an extension input device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XSetDeviceMode(
+    register Display   *dpy,
+    XDevice            *dev,
+    int                         mode)
+{
+    xSetDeviceModeReq *req;
+    xSetDeviceModeReply rep;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(SetDeviceMode, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_SetDeviceMode;
+    req->deviceid = dev->device_id;
+    req->mode = mode;
+
+    (void)_XReply(dpy, (xReply *) & rep, 0, xTrue);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (rep.status);
+}
diff --git a/src/XSndExEv.c b/src/XSndExEv.c
new file mode 100644 (file)
index 0000000..ebaab33
--- /dev/null
@@ -0,0 +1,116 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XSendExtensionEvent - send an extension event to a client.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+Status
+XSendExtensionEvent(
+    register Display   *dpy,
+    XDevice            *dev,
+    Window              dest,
+    Bool                prop,
+    int                         count,
+    XEventClass                *list,
+    XEvent             *event)
+{
+    int num_events;
+    int ev_size;
+    xSendExtensionEventReq *req;
+    xEvent *ev;
+    register Status(**fp) (Display *, XEvent*, xEvent **, int *);
+    Status status;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    /* call through display to find proper conversion routine */
+
+    fp = &dpy->wire_vec[event->type & 0177];
+    if (*fp == NULL)
+       *fp = _XiEventToWire;
+    status = (**fp) (dpy, event, &ev, &num_events);
+
+    if (status) {
+       GetReq(SendExtensionEvent, req);
+       req->reqType = info->codes->major_opcode;
+       req->ReqType = X_SendExtensionEvent;
+       req->deviceid = dev->device_id;
+       req->destination = dest;
+       req->propagate = prop;
+       req->count = count;
+       req->num_events = num_events;
+       ev_size = num_events * sizeof(xEvent);
+       req->length += (count + (ev_size >> 2));
+
+       /* note: Data is a macro that uses its arguments multiple
+        * times, so "count" is changed in a separate assignment
+        * statement.  Any extra events must be sent before the event
+        * list, in order to ensure quad alignment. */
+
+       Data(dpy, (char *)ev, ev_size);
+
+       count <<= 2;
+       Data32(dpy, (long *)list, count);
+       XFree((char *)ev);
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (status);
+}
diff --git a/src/XStFocus.c b/src/XStFocus.c
new file mode 100644 (file)
index 0000000..273cd0d
--- /dev/null
@@ -0,0 +1,86 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XSetDeviceFocus - Set the focus of an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XSetDeviceFocus(
+    register Display   *dpy,
+    XDevice            *dev,
+    Window              focus,
+    int                         revert_to,
+    Time                time)
+{
+    xSetDeviceFocusReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(SetDeviceFocus, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_SetDeviceFocus;
+    req->device = dev->device_id;
+    req->focus = focus;
+    req->revertTo = revert_to;
+    req->time = time;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XUngrDev.c b/src/XUngrDev.c
new file mode 100644 (file)
index 0000000..7b59ae6
--- /dev/null
@@ -0,0 +1,83 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XUngrabDevice - Ungrab an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XUngrabDevice(
+    register Display   *dpy,
+    XDevice            *dev,
+    Time                time)
+{
+    register xUngrabDeviceReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+
+    GetReq(UngrabDevice, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_UngrabDevice;
+
+    req->deviceid = dev->device_id;
+    req->time = time;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XUngrDvB.c b/src/XUngrDvB.c
new file mode 100644 (file)
index 0000000..38267a6
--- /dev/null
@@ -0,0 +1,90 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XUngrabDeviceButton - Ungrab a button on an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XUngrabDeviceButton(
+    register Display   *dpy,
+    XDevice            *dev,
+    unsigned int        button,        /* CARD8 */
+    unsigned int        modifiers,     /* CARD16 */
+    XDevice            *modifier_dev,
+    Window              grab_window)
+{
+    register xUngrabDeviceButtonReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+    GetReq(UngrabDeviceButton, req);
+
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_UngrabDeviceButton;
+    req->grabbed_device = dev->device_id;
+    req->button = button;
+    req->modifiers = modifiers;
+    if (modifier_dev)
+       req->modifier_device = modifier_dev->device_id;
+    else
+       req->modifier_device = UseXKeyboard;
+    req->grabWindow = grab_window;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/src/XUngrDvK.c b/src/XUngrDvK.c
new file mode 100644 (file)
index 0000000..1a60785
--- /dev/null
@@ -0,0 +1,90 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+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
+OPEN GROUP 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 Open Group 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 Open Group.
+
+Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
+
+                       All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+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 Hewlett-Packard not be
+used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+HEWLETT-PACKARD 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.
+
+********************************************************/
+
+/***********************************************************************
+ *
+ * XUngrabDeviceKey - Ungrab a key on an extension device.
+ *
+ */
+
+#include <X11/extensions/XI.h>
+#include <X11/extensions/XIproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/extutil.h>
+#include "XIint.h"
+
+int
+XUngrabDeviceKey(
+    register Display   *dpy,
+    XDevice            *dev,
+    unsigned int        key,           /* CARD8 */
+    unsigned int        modifiers,     /* CARD16 */
+    XDevice            *modifier_dev,
+    Window              grab_window)
+{
+    register xUngrabDeviceKeyReq *req;
+    XExtDisplayInfo *info = XInput_find_display(dpy);
+
+    LockDisplay(dpy);
+    if (_XiCheckExtInit(dpy, XInput_Initial_Release, info) == -1)
+       return (NoSuchExtension);
+    GetReq(UngrabDeviceKey, req);
+
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_UngrabDeviceKey;
+    req->grabbed_device = dev->device_id;
+    req->key = key;
+    req->modifiers = modifiers;
+    if (modifier_dev)
+       req->modifier_device = modifier_dev->device_id;
+    else
+       req->modifier_device = UseXKeyboard;
+    req->grabWindow = grab_window;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return (Success);
+}
diff --git a/xi.pc.in b/xi.pc.in
new file mode 100644 (file)
index 0000000..3f05dd8
--- /dev/null
+++ b/xi.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Xi
+Description: X Input Extension Library
+Version: @VERSION@
+Requires: inputproto
+Requires.private: x11 xext
+Cflags: -I${includedir}
+Libs: -L${libdir} -lXi