Git init
authorKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:49:42 +0000 (00:49 +0900)
committerKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:49:42 +0000 (00:49 +0900)
46 files changed:
AUTHORS [new file with mode: 0644]
COPYING [new file with mode: 0644]
ChangeLog [new file with mode: 0755]
Makefile.am [new file with mode: 0755]
NEWS [new file with mode: 0644]
README [new file with mode: 0755]
autogen.sh [new file with mode: 0755]
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/libxtst-dev.install [new file with mode: 0755]
debian/libxtst6.install [new file with mode: 0644]
debian/patches/01_fix_date_in_manpages.diff [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]
include/X11/extensions/XTest.h [new file with mode: 0755]
include/X11/extensions/record.h [new file with mode: 0644]
man/Makefile.am [new file with mode: 0755]
man/XTest.xml [new file with mode: 0755]
man/XTestCompareCurrentCursorWithWindow.man [new file with mode: 0644]
man/XTestCompareCursorWithWindow.man [new file with mode: 0644]
man/XTestDiscard.man [new file with mode: 0644]
man/XTestFakeButtonEvent.man [new file with mode: 0644]
man/XTestFakeKeyEvent.man [new file with mode: 0644]
man/XTestFakeMotionEvent.man [new file with mode: 0644]
man/XTestFakeRelativeMotionEvent.man [new file with mode: 0644]
man/XTestGrabControl.man [new file with mode: 0644]
man/XTestQueryExtension.man [new file with mode: 0755]
man/XTestSetGContextOfGC.man [new file with mode: 0644]
man/XTestSetVisualIDOfVisual.man [new file with mode: 0644]
man/x.stamp [new file with mode: 0644]
packaging/libXtst.spec [new file with mode: 0644]
specs/Makefile.am [new file with mode: 0755]
specs/recordlib.xml [new file with mode: 0755]
specs/xtestlib.xml [new file with mode: 0755]
src/Makefile.am [new file with mode: 0755]
src/XRecord.c [new file with mode: 0755]
src/XTest.c [new file with mode: 0755]
xtst.pc.in [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..3011710
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,66 @@
+Copyright 1990, 1991 by UniSoft Group Limited
+Copyright 1992, 1993, 1995, 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 1995 Network Computing Devices
+
+Permission to use, copy, modify, distribute, and sell this software and
+its documentation for any purpose is hereby granted without fee, provided
+that the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation, and that the name of Network Computing Devices
+not be used in advertising or publicity pertaining to distribution
+of the software without specific, written prior permission.
+
+NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO
+THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES 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 2005  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, and that the name of Red Hat not be used in
+advertising or publicity pertaining to distribution of the software without
+specific, written prior permission.  Red Hat makes no
+representations about the suitability of this software for any purpose.  It
+is provided "as is" without express or implied warranty.
+
+RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL RED HAT 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/ChangeLog b/ChangeLog
new file mode 100755 (executable)
index 0000000..9c34936
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,701 @@
+commit 5c6834bc9e0ab78c78733c59046510a2f48b2d42
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Fri Oct 29 17:38:10 2010 -0700
+
+    libXtst 1.2.0
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 109ec12489f050e537d26eed2e60c6d97eb7439f
+Author: Tobias Koch <tobias.koch@nokia.com>
+Date:   Wed Sep 29 18:03:30 2010 +0300
+
+    Allow more than 6 axes to be sent.
+    
+    From: Tobias Koch <tobias.koch@nokia.com>
+    
+    If the number of axes exceeds 6, X server will return BadValue for
+    XTestFakeInput because the number of axes in a single DeviceValuator
+    event is incorrectly set to the total number of axes.
+    
+    Signed-off-by: Tobias Koch <tobias.koch@nokia.com>
+    Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 809ceed85bb577d4bbf80f2d84382375c65b9fbe
+Author: Jesse Adkins <jesserayadkins@gmail.com>
+Date:   Tue Sep 28 13:30:04 2010 -0700
+
+    Purge cvs tags.
+    
+    Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com>
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 785d8cde2d3beecfb23a9dd9b87bb0d96cf352b8
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Aug 16 11:40:14 2010 -0400
+
+    man: remove unused $(BUILT_SOURCES) variable
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 1dba184f586cc689a79b21b60267c72c2c0172b9
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Aug 16 11:30:23 2010 -0400
+
+    man: remove unused 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
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 601ea1309d80ba19b4e03207d6fb0f54b2f12730
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Jul 8 15:10:27 2010 -0700
+
+    config: Use additional man page support from util-macros 1.8
+    
+    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
+    The existing statement can now be removed from the configuration file.
+    
+    Use automake provided $(AM_V_GEN) and XORG_DEFAULT_OPTIONS provided $(SED)
+    Enables silent rule and use platform appropriate version of sed.
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 672f3ea3431c37ce8f4c33da224287861f64c2a4
+Author: Fernando Carrijo <fcarrijo@yahoo.com.br>
+Date:   Thu Jul 1 07:05:16 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 1676c80db40bffec416da6e3d0002ff9d37093b3
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Jun 27 20:45:38 2010 -0400
+
+    specs: remove trailing spaces in DocBook XML docs
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 96f104f32aef56dd408afbc0d5a073f51e8f0a69
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Jun 27 09:29:26 2010 -0400
+
+    doc: add recordlib converted docbook xml
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit b6a6644e371192be281ff96c59aa39f32ba64a84
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sat Jun 26 13:36:29 2010 -0400
+
+    doc: replace groff input format with docbook xml format
+    
+    Initial version of xtestlib and recordlib docbook xml.
+    recordlib is missing and will be added later
+    Requires util-macros 1.10
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit bbae053ca8bce46639f74f88dc9f687fe53e7c86
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Jun 17 14:45:14 2010 -0400
+
+    specs: translate, format, process, install and distribute.
+    
+    Makefile copied from libSM.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit a9e6bb4e4f06b328f03d3d22b6268c4cdd76b702
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Sat Jun 12 09:03:23 2010 -0700
+
+    Sun's copyrights belong to Oracle now
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 65daf48de4726cb54c7337563b9d828536916b61
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Sat Jun 12 09:00:56 2010 -0700
+
+    Copy some introductory text from the specs to README
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit b2190a83417ae6a4f99ab3acd47ae2c67b5d6693
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Sat Jun 12 08:54:20 2010 -0700
+
+    Move recordlib & testlib specs from xorg-docs module
+    
+    Not formatted, translated, processed or installed yet,
+    just moved & added to EXTRA_DIST
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit c83fb2aeeb458ead667a1ebe30c5a59b9e786ed3
+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 f01cb33610654d590339a838f0978386ed8ac5fd
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Mar 29 14:53:49 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 c4a225f9c96362ca1a2bd98f9c82cb1992d7dd8c
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Mar 11 10:22:59 2010 -0500
+
+    doc: specify 0.0.20 as the minimum version for xmlto
+    
+    Older versions do not have fop backend.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit d6b098f463d185e5ed1b45013bd2600c124b7a3a
+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 a125ac058be77d81c1806420a7fd1df3b19a6bf4
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sat Jan 23 10:49:06 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 1b887152b514c1701e09313dde718fb9e263ff9f
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Jan 18 20:09:55 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 f9ddf6c7bcc3ca2a4745a37d901ab2337b256638
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jan 14 20:38:59 2010 -0800
+
+    Update Sun license notices to current X.Org standard form
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 5b4cd49321b7f74f6597872977d27e5e1a014f94
+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 6757983c1a575a2cc172be70861be70f3e5dc25e
+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 7855bdbf6df8cb5eca0d44713f33aebc17ef6df8
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Oct 27 15:07:26 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 fe3b99e8c996fec849f043ad99e05850f5985b5f
+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 f77d44ecd4ced217745e4f751800152e3fa71c26
+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 c26e9300ce965c394e452b6a02a059b7514994c1
+Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
+Date:   Wed Oct 21 12:47:26 2009 -0700
+
+    This is not a GNU project, so declare it foreign.
+    
+    On Wed, 2009-10-21 at 13:36 +1000, Peter Hutterer wrote:
+    > On Tue, Oct 20, 2009 at 08:23:55PM -0700, Jeremy Huddleston wrote:
+    > > I noticed an INSTALL file in xlsclients and libXvMC today, and it
+    > > was quite annoying to work around since 'autoreconf -fvi' replaces
+    > > it and git wants to commit it.  Should these files even be in git?
+    > > Can I nuke them for the betterment of humanity and since they get
+    > > created by autoreconf anyways?
+    >
+    > See https://bugs.freedesktop.org/show_bug.cgi?id=24206
+    
+    As an interim measure, replace AM_INIT_AUTOMAKE([dist-bzip2]) with
+    AM_INIT_AUTOMAKE([foreign dist-bzip2]). This will prevent the generation
+    of the INSTALL file. It is also part of the 24206 solution.
+    
+    Signed-off-by: Jeremy Huddleston <jeremyhu@freedesktop.org>
+
+commit ddc11c4ef1bd0e6c970630dea74f54bb2b0ea893
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Oct 5 11:38:38 2009 +1000
+
+    libXtst 1.1.0
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit e3d74ecf1a3a7adfeafca8cd02c1da82e95d5eaf
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Oct 5 11:40:53 2009 +1000
+
+    Require libXext 1.0.99.4
+    
+    libXext 1.0.99.1 up to including 1.0.99.3 had the XTest.h header which is
+    now in this module.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 7a9b269ed83c106265896373120603b9c06997f3
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Oct 5 10:38:34 2009 +1000
+
+    Require macros 1.3 for XORG_DEFAULT_OPTIONS
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 9f727168f561c76c5ae6c3115282ac803172e9f8
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Aug 25 14:09:47 2009 +1000
+
+    Version bump: 1.0.99.2
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 527759ae93ceaafca670995ab97545112f89bfbc
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Aug 18 11:12:37 2009 +1000
+
+    Include recordproto.h instead of recordstr.h
+
+commit 849fa907e129575831fbd3fa69249ff843413fd5
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Aug 14 14:15:48 2009 +1000
+
+    Move record headers to here.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 1c928d9c138c90512d534e67e96bced247ca3241
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Aug 14 15:00:15 2009 +1000
+
+    XRecord: avoid use of uninitialised variables.
+    
+    Both variables are initialized inside an if condition but later checked for
+    NULL.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit c0404c6db9a8eacc07d140093982b910e54e3f97
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Wed Jul 22 20:34:51 2009 +1000
+
+    Version bump: 1.0.99.1
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 3f4b895a29b1b48336621e6dcc80831a5910bed9
+Author: Magnus Kessler <Magnus.Kessler@gmx.net>
+Date:   Wed Jul 22 09:29:16 2009 +0100
+
+    Rename xtest.h to xtestconst.h to avoid a collision with XTest.h on case-insensitive filesystems
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit ab9ad139b1f20866405ddcc44d25b7b141cd7bce
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jul 20 13:26:45 2009 +1000
+
+    Move XTest.h header from xextproto/libXext to here.
+    
+    XTest.h was in xextproto until xextproto-7.1 and did a short but whoefully
+    misguided visit to libXext during the cleanup of the xextproto headers.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit a119baf3c5aa4f035040e0b991e99e6b382b9670
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Jul 16 09:41:33 2009 +1000
+
+    Include xtestproto.h, not xteststr.h
+    
+    Require xextproto 7.0.99.1.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 378db00ee91a11629666fc1c5e5a5e13c65ffefc
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Mon Feb 2 20:34:37 2009 -0800
+
+    Add README with pointers to mailing list, bugzilla & git repos
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 3237cc5b45a41ffe93ebde10b1090a7f2db6f88e
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Fri Jan 30 20:41:31 2009 -0200
+
+    Janitor: ansification, make distcheck, compiler warnings.
+    
+      Manual page generation, and xmlto handling, shamelessly cut&paste'd
+    from libXi/man/Makefile.am, so that make distcheck will work.
+
+commit 48544103324d1816139dfafe5873a11c88ee05b6
+Author: Peter Hutterer <peter.hutterer@redhat.com>
+Date:   Fri Aug 8 10:18:19 2008 +0930
+
+    Require xi.pc for XInput.h include.
+    
+    XInput.h is now part of libXi. But just in case we have an older version of
+    libXi floating around, pull in inputproto too.
+
+commit 5b4ba84a422d168c01b335c4fc4046a7316463e0
+Author: Ian Romanick <idr@us.ibm.com>
+Date:   Wed May 21 12:38:00 2008 -0700
+
+    Add .PHONY build target to fix parallel builds
+
+commit 56bc832134b4f6884999797f0f0c1b846602088d
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Mon May 19 17:38:08 2008 +0930
+
+    Rename parameters to clarify QueryExtension call.
+    
+    These parameters are not treated as input. Rename them to make the inner
+    workings slightly more obvious.
+    
+    X.Org Bug 14511 <http://bugs.freedesktop.org/show_bug.cgi?id=14511>
+
+commit f3971bca54ff6018758642303108eec975d80cd5
+Author: James Cloos <cloos@jhcloos.com>
+Date:   Thu Dec 6 15:51:20 2007 -0500
+
+    Add missing PHONY line for automatic ChangeLog generation
+
+commit 8db9ffdf7a16162cd81da2bf1e914ecf3981d0ee
+Author: Egbert Eich <eich@freedesktop.org>
+Date:   Tue Oct 16 14:27:57 2007 +0200
+
+    Wrong place. Reverting srcdir patch.
+
+commit 7684e7da5648fb8664c145a5f4d79d8e2d085808
+Author: Egbert Eich <eich@freedesktop.org>
+Date:   Mon Oct 15 11:44:53 2007 +0200
+
+    Fix man page build when srcdir is specified.
+
+commit 4a5ac6a63c22bdfac9a873803f3a0fa3d6e20a5b
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Fri Aug 17 14:57:22 2007 -0700
+
+    Version bump: 1.0.3
+
+commit fe206f87078c90afaa5eba42a4bbe1c0ea300e9b
+Author: zoka <zoran@microtrol.com.au>
+Date:   Mon Jul 2 20:34:52 2007 -0700
+
+    libXtst man pages generation fails if srcdir != builddir
+
+commit a8738715dd5b74f0dec904c83b732ef6471be0db
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Jun 6 18:57:12 2007 -0700
+
+    Version bump: 1.0.2
+
+commit 8bbc3b75318c67f6089d50f68d53d092390c8233
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Jun 6 18:41:36 2007 -0700
+
+    Replace static ChangeLog with dist-hook to generate from git
+
+commit 6aaa875dffbcc5dd2206644cfa73fdfd8ffe280f
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Jun 6 18:13:32 2007 -0700
+
+    Convert man page to docbook/xml (thanks to doclifter)
+
+commit d9514f97f54b47630b645ef44a5d40262a10d33a
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Jun 6 16:39:01 2007 -0700
+
+    Add man pages for XTest*() functions
+    
+    Converted xorg-docs/Xext/xtestlib.ms to man page formatting
+
+commit 68a28875bc7a2cd760f035508997dfd88b3b6cc8
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Jun 6 14:43:59 2007 -0700
+
+    Fill in COPYING file with real copyright/licenses
+
+commit 931675017dd28ccca8353abeff3055f0c47bc3b2
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Jun 6 14:36:43 2007 -0700
+
+    Coverity #578/579: Don't leak memory if one malloc fails but other succeeds
+    
+    (Unlikely to happen, since the smaller malloc was first, but still possible.)
+
+commit dab4830b8db0d3cf5db5e96b2b870e94a48330bc
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Jun 6 14:23:17 2007 -0700
+
+    ANSIfy static function declarations (clears some lint warnings)
+
+commit 57a201a15637cfea6c15a4d0ed8b629c9cd49495
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Jun 6 14:11:04 2007 -0700
+
+    Add hooks to check code with sparse/lint
+
+commit 5e791a1465aba3b8be89b4cf2d9f90dee18e8e96
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Jun 6 14:10:44 2007 -0700
+
+    Add *~ to .gitignore to skip emacs/patch droppings
+
+commit 68ca8cd2ba9877ee2e3695783f3a8445ab366ea8
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jul 13 14:59:09 2006 -0700
+
+    renamed: .cvsignore -> .gitignore
+
+commit 1f76457e307db2cec4c7f1e4b66dab597271fc86
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Dec 21 02:30:06 2005 +0000
+
+    Update package version for X11R7 release.
+
+commit 0f5c2436708a0d399f8fc348902518a9117728ac
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Mon Dec 19 16:28:27 2005 +0000
+
+    Stub COPYING files
+
+commit b5670af70e2e29f67639e85106817740c83ccc8d
+Author: Kevin E Martin <kem@kem.org>
+Date:   Thu Dec 15 00:24:35 2005 +0000
+
+    Update package version number for final X11R7 release candidate.
+
+commit c68f6e145fac21f3fc6fe7d09b5e8639538d54e1
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Dec 3 05:49:45 2005 +0000
+
+    Update package version number for X11R7 RC3 release.
+
+commit 1d76bb2d8bb23d91a64c23923fc819af0badb57b
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Nov 19 07:15:43 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 3e0b2a05fcfb60561402b46318bd152b466509f9
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Nov 9 21:19:13 2005 +0000
+
+    Update package version number for X11R7 RC2 release.
+
+commit c753f306d0bda3dc3009ad273e9cd3548ea13bb8
+Author: Kevin E Martin <kem@kem.org>
+Date:   Tue Nov 1 15:11:52 2005 +0000
+
+    Update pkgcheck dependencies to work with separate build roots.
+
+commit 36c47a88481794b25118870a6caf93d2b2ca9344
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Oct 19 02:48:12 2005 +0000
+
+    Update package version number for RC1 release.
+
+commit 6578854789201d229f20ae560d4b7051e9402c84
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Wed Aug 3 03:28:02 2005 +0000
+
+    Do PKG_CHECK_MODULES on a unique token instead of on "DEP", so builds with
+        a global configure cache don't get confused.
+
+commit aa10e9ef0425286da35fb3312dd6df31066c627a
+Author: Kevin E Martin <kem@kem.org>
+Date:   Fri Jul 29 21:22:53 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 a72494febb5b14a5ad860f1048ff11bdd83bbe53
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Sat Jul 16 07:39:26 2005 +0000
+
+    Set soversion to 6.1.0 with -version-number.
+
+commit 9001f6684617761cf258e71259f98f85c02f33d1
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu Jul 14 15:07:42 2005 +0000
+
+    more trailing whitespace
+
+commit 3568421ddbec548cff7b49eb339d5bafaab2cbd3
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Jul 9 06:50:41 2005 +0000
+
+    Add .cvsignore files Switch _la_CFLAGS for AM_CFLAGS to clean up directory
+
+commit 1f8c48e0574892a0b3fe359fb65523d7d1dcc236
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Jul 2 06:35:03 2005 +0000
+
+    Add appropriate lib*_CFLAGS to Makefile.am's -- fixes build problems
+
+commit 250934b516532e24e48a9aa93dd389493acc4f53
+Author: Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>
+Date:   Tue Jun 21 15:41:36 2005 +0000
+
+    lib/XScrnSaver/configure.ac
+    lib/XScrnSaver/src/Makefile.am
+    lib/Xfontcache/configure.ac
+    lib/Xfontcache/src/Makefile.am
+    lib/Xinerama/configure.ac
+    lib/Xinerama/src/Makefile.am
+    lib/Xtst/configure.ac
+    lib/Xv/configure.ac
+    lib/XvMC/configure.ac
+    lib/dmx/configure.ac Add missing xext.pc and xextproto.pc Add DEP_CFLAGS to
+        src/Makefile.am
+
+commit dbedf673f50e0baf6d5af60f60dbd16368071ed4
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Mon Jun 13 19:44:25 2005 +0000
+
+    - Add Xtst to symlink.sh
+    - Add Xtst build system
+
+commit e2cdce7dab4c62bdfcff33ee9270f6a7703352ef
+Author: Egbert Eich <eich@suse.de>
+Date:   Mon May 24 19:06:58 2004 +0000
+
+    Fix build glitches when building modules independently using Imake.
+
+commit 3bb9e7d92569600697ec398e9cff01e50101ff22
+Author: Egbert Eich <eich@suse.de>
+Date:   Fri Apr 23 18:43:55 2004 +0000
+
+    Merging XORG-CURRENT into trunk
+
+commit 91ddef6b5dec497a7501fc7a9416cfc6454824f3
+Author: Egbert Eich <eich@suse.de>
+Date:   Sun Mar 14 08:32:27 2004 +0000
+
+    Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004
+
+commit efc2b386671de52b5454a336dab4afa3aeabd340
+Author: Egbert Eich <eich@suse.de>
+Date:   Wed Mar 3 12:11:32 2004 +0000
+
+    Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004
+
+commit b7c0ec40d3045f024bb74292189f72cdf7a1cd14
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 13:35:34 2004 +0000
+
+    readding XFree86's cvs IDs
+
+commit 2f5a9d8afe48466be084cea784ac73e932655f6e
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 09:22:48 2004 +0000
+
+    Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004
+
+commit 7aea93fb6b188b32b0be32f064997aabe8d7bdda
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Tue Nov 25 19:28:16 2003 +0000
+
+    XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks
+
+commit 88eb8a804d05b72091309323ad2df962a1ed7b8d
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 16:48:49 2003 +0000
+
+    XFree86 4.3.0.1
+
+commit 65a2b6d50473730673749ad2facc248ea41af00a
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 15:54:39 2003 +0000
+
+    R6.6 is the Xorg base-line
diff --git a/Makefile.am b/Makefile.am
new file mode 100755 (executable)
index 0000000..c49353f
--- /dev/null
@@ -0,0 +1,42 @@
+# 
+#  Copyright 2005  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, and that the name of Red Hat not be used in
+#  advertising or publicity pertaining to distribution of the software without
+#  specific, written prior permission.  Red Hat makes no
+#  representations about the suitability of this software for any purpose.  It
+#  is provided "as is" without express or implied warranty.
+# 
+#  RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+#  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+#  EVENT SHALL RED HAT 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.
+
+SUBDIRS = src specs
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = xtst.pc
+
+MAINTAINERCLEANFILES = ChangeLog INSTALL
+
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+       $(INSTALL_CMD)
+
+ChangeLog:
+       $(CHANGELOG_CMD)
+
+dist-hook: ChangeLog INSTALL
+
+if LINT
+lint:
+       (cd src && $(MAKE) $(MFLAGS) lint)
+endif LINT
diff --git a/NEWS b/NEWS
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/README b/README
new file mode 100755 (executable)
index 0000000..c83d9fe
--- /dev/null
+++ b/README
@@ -0,0 +1,33 @@
+libXtst provides the Xlib-based client API for the XTEST & RECORD extensions.
+
+The XTEST extension is a minimal set of client and server extensions
+required to completely test the X11 server with no user intervention.
+This extension is not intended to support general journaling and
+playback of user actions.
+
+The RECORD extension supports the recording and reporting of all
+core X protocol and arbitrary X extension protocol.
+
+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/libXtst
+
+        http://cgit.freedesktop.org/xorg/lib/libXtst
+
+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 100755 (executable)
index 0000000..218197d
--- /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..1e66c80
--- /dev/null
@@ -0,0 +1,62 @@
+
+dnl  Copyright 2005 Red Hat, Inc.
+dnl 
+dnl  Permission to use, copy, modify, distribute, and sell this software and its
+dnl  documentation for any purpose is hereby granted without fee, provided that
+dnl  the above copyright notice appear in all copies and that both that
+dnl  copyright notice and this permission notice appear in supporting
+dnl  documentation, and that the name of Red Hat not be used in
+dnl  advertising or publicity pertaining to distribution of the software without
+dnl  specific, written prior permission.  Red Hat makes no
+dnl  representations about the suitability of this software for any purpose.  It
+dnl  is provided "as is" without express or implied warranty.
+dnl 
+dnl  RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+dnl  EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+dnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+dnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+dnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+dnl  PERFORMANCE OF THIS SOFTWARE.
+dnl
+dnl Process this file with autoconf to create configure.
+
+AC_PREREQ([2.60])
+
+AC_INIT([libXtst], [1.2.0],
+        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXtst])
+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)
+AM_CONFIG_HEADER(config.h)
+
+# Check for progs
+AC_PROG_CC
+AC_PROG_LIBTOOL
+
+# Check for dependencies
+PKG_CHECK_MODULES(XTST, x11 [xext >= 1.0.99.4] xi [recordproto >= 1.13.99.1] [xextproto >= 7.0.99.3] inputproto)
+
+# Determine if the source for man pages is available
+# It may already be present (tarball) or can be generated using xmlto
+AM_CONDITIONAL([INSTALL_MANPAGES],
+       [test -f "$srcdir/man/XTestQueryExtension.man" || test "x$have_xmlto" = xyes])
+
+dnl Allow checking code with lint, sparse, etc.
+XORG_WITH_LINT
+XORG_LINT_LIBRARY([Xtst])
+LINT_FLAGS="${LINT_FLAGS} ${XTST_CFLAGS}"
+
+AC_OUTPUT([Makefile
+          src/Makefile
+          specs/Makefile
+          xtst.pc])
diff --git a/debian/README.source b/debian/README.source
new file mode 100644 (file)
index 0000000..b09a1ab
--- /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 using 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..24823d9
--- /dev/null
@@ -0,0 +1,196 @@
+libxtst (2:1.2.0-1slp2+3) unstable; urgency=low
+
+  * Modify files not to make/install man page
+  * Git: 165.213.180.234:slp/pkgs/xorg/lib/libxtst
+  * Tag: libxtst_1.2.0-1slp2+3
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Wed, 02 Nov 2011 16:24:52 +0900
+
+libxtst (2:1.2.0-1slp2+2) unstable; urgency=low
+
+  * [X11R7.6] upgrade package 
+  * Git: 165.213.180.234:slp/pkgs/xorg/lib/libxtst
+  * Tag: libxtst_1.2.0-1slp2+2
+
+ -- SooChan Lim <sc1.lim@samsung.com>  Wed, 05 Jan 2011 19:25:22 +0900
+
+libxtst (2:1.1.0-6slp2+2) unstable; urgency=low
+
+  * change the rules file
+  * Git: 165.213.180.234:/git/slp/pkgs/xorg/lib/libxtst
+  * Tag: libxtst_1.1.0-6slp2+2
+
+ -- SooChan Lim <sc1.lim@samsung.com>  Fri, 03 Dec 2010 19:09:52 +0900
+
+libxtst (2:1.1.0-5slp2+2) unstable; urgency=low
+
+  * add --as-needed
+  * Git: 165.213.180.234:/git/slp/pkgs/xorg/lib/libxtst
+  * Tag: libxtst_1.1.0-5slp2+2 
+
+ -- SooChan Lim <sc1.lim@samsung.com>  Sat, 20 Nov 2010 16:10:02 +0900
+
+libxtst (2:1.1.0-5slp2+1) unstable; urgency=low
+
+  * modify the package name
+
+ -- SooChan Lim <sc1.lim@samsung.com>  Thu, 25 Mar 2010 18:03:04 +0900
+
+libxtst (2:1.1.0-4) unstable; urgency=low
+
+  * Add configure option to choose not/to use xmlto building docs
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Wed, 17 Feb 2010 22:52:18 +0900
+
+libxtst (2:1.1.0-3) unstable; urgency=low
+
+  * Fix debian/rules not to delete ltmain.sh
+
+ -- Sung-Jin Park <sj76.park@samsung.com>  Tue, 29 Dec 2009 14:31:25 +0900
+
+libxtst (2:1.1.0-3) unstable; urgency=low
+
+  [ Julien Cristau ]
+  * Rename the build directory to not include DEB_BUILD_GNU_TYPE for no
+    good reason.  Thanks, Colin Watson!
+
+  [ Brice Goglin ]
+  * Fix short description, thanks Nick Shaforostoff, closes: #565234.
+
+ -- Julien Cristau <jcristau@debian.org>  Wed, 23 Jun 2010 12:34:43 +0100
+
+libxtst (2:1.1.0-2) unstable; urgency=low
+
+  * Upload to unstable.
+
+ -- Julien Cristau <jcristau@debian.org>  Wed, 06 Jan 2010 13:02:50 +0000
+
+libxtst (2:1.1.0-1) experimental; urgency=low
+
+  [ Timo Aaltonen ]
+  * New upstream release.
+  * Bump the build-dep on xutils-dev (>= 1:7.5~1).
+  * Bump the build-dep on libxext-dev (>= 1:1.0.99.4).
+
+ -- Julien Cristau <jcristau@debian.org>  Thu, 26 Nov 2009 17:57:54 +0100
+
+libxtst (2:1.0.99.2-2) experimental; urgency=low
+
+  * Brown paper bag upload.
+  * Actually install the headers.
+
+ -- Julien Cristau <jcristau@debian.org>  Tue, 29 Sep 2009 17:16:59 +0200
+
+libxtst (2:1.0.99.2-1) experimental; urgency=low
+
+  [ Brice Goglin ]
+  * Bump Standards-Version to 3.7.3 (no changes).
+  * Drop the XS- prefix from Vcs-Git and Vcs-Browser fields in debian/control.
+  * Add a link to www.X.org and a reference to the upstream module
+    in the long description.
+  * Install the upstream ChangeLog.
+  * Add README.source, bump Standards-Version to 3.8.2.
+  * Use updated xsfbs, closes: #538589.
+  * Move -dbg package to section debug.
+
+  [ Julien Cristau ]
+  * Run autoreconf at build time.
+  * Parse space-separated DEB_BUILD_OPTIONS, handle parallel=N.
+  * Drop pre-dependency on x11-common from libxtst-dev.  This was needed for
+    upgrades from sarge.
+  * Bump Standards-Version to 3.8.3.
+  * New upstream release candidate
+    - record.h and XTest.h moved here from recordproto and xextproto
+  * Bump {Build-,}Depends, add Replaces on x11proto-xext-dev and
+    x11proto-record-dev.
+  * Drop -1 debian revision from Build-Depends [lintian].
+
+ -- Julien Cristau <jcristau@debian.org>  Tue, 29 Sep 2009 15:53:21 +0200
+
+libxtst (2:1.0.3-1) unstable; urgency=low
+
+  [ Julien Cristau ]
+  * Sync package sections with the override.
+  * Bump epoch so Ubuntu can sync this package.
+
+  [ Brice Goglin ]
+  * New upstream release.
+  * Add myself to Uploaders, and remove Branden and Fabio with their
+    permission.
+  * Add upstream URL to debian/copyright.
+  * Update 01_build_manpages.diff since its first half has been merged
+    upstream, and rename it to 01_fix_date_in_manpages.diff to match
+    the remaining part.
+
+ -- Brice Goglin <bgoglin@debian.org>  Sat, 25 Aug 2007 11:58:00 +0200
+
+libxtst (1:1.0.2-1) unstable; urgency=low
+
+  [ Drew Parsons ]
+  * dbg package has priority extra.
+
+  [ Julien Cristau ]
+  * Add XS-Vcs-* headers, and remove outdated CVS info.
+  * New upstream release.
+  * Build and install the new manpage, and add a new patch to make that work.
+    Accordingly, add build-deps on quilt and xmlto.
+  * Use ${binary:Version} instead of ${Source-Version} in debian/control.
+  * Update debian/copyright from COPYING.
+
+ -- Julien Cristau <jcristau@debian.org>  Thu, 07 Jun 2007 17:54:08 +0200
+
+libxtst (1:1.0.1-5) unstable; urgency=low
+
+  * Revert .la file addition.
+
+ -- Andres Salomon <dilinger@debian.org>  Mon, 24 Jul 2006 11:20:31 -0400
+
+libxtst (1:1.0.1-4) unstable; 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.
+  * Autoreconf w/ an updated xutils-dev so that manpages have the 'x'
+    extension dropped.
+  * Include .la files in -dev package.
+  * Don't attempt to install (non-existent) usr/include/X11/* stuff.
+  * Add a debian/copyright file.
+
+ -- Andres Salomon <dilinger@debian.org>  Mon, 24 Jul 2006 05:13:32 -0400
+
+libxtst (1:1.0.1-3) unstable; urgency=low
+
+  * Reorder makeshlib command in rules file so that ldconfig is run
+    properly. Thanks Drew Parsons and Steve Langasek.
+
+ -- David Nusinow <dnusinow@debian.org>  Tue, 18 Apr 2006 21:50:01 -0400
+
+libxtst (1:1.0.1-2) unstable; urgency=low
+
+  * Upload to unstable
+
+ -- David Nusinow <dnusinow@debian.org>  Thu, 23 Mar 2006 22:45:21 -0500
+
+libxtst (1:1.0.1-1) experimental; urgency=low
+
+  * First modular upload to Debian
+
+ -- David Nusinow <dnusinow@debian.org>  Thu, 29 Dec 2005 20:55:45 -0500
+
+libxtst (1:1.13.0-2) breezy; urgency=low
+
+  * Bump Build-Deps on libx11-dev and libxext-dev to avoid _XOPEN_SOURCE.
+
+ -- Daniel Stone <daniel.stone@ubuntu.com>  Sat, 23 Jul 2005 00:49:26 +1000
+
+libxtst (1:1.13.0-1) breezy; urgency=low
+
+  * First libxtst 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..1f5ad41
--- /dev/null
@@ -0,0 +1,68 @@
+Source: libxtst
+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>, SooChan Lim <sc1.lim@samsung.com>, David Nusinow <dnusinow@debian.org>, Andres Salomon <dilinger@debian.org>, Brice Goglin <bgoglin@debian.org>
+Build-Depends: debhelper (>= 5.0.0), libx11-dev (>= 2:0.99.3), libxext-dev (>= 2:1.0.99.4), libxi-dev, x11proto-record-dev (>= 1.13.99.1), x11proto-xext-dev (>= 7.0.99.3), x11proto-input-dev, pkg-config, xmlto, automake, libtool, xutils-dev (>= 1:7.5-1slp2), quilt
+Standards-Version: 3.8.3
+Vcs-Git: git://git.debian.org/git/pkg-xorg/lib/libxtst
+Vcs-Browser: http://git.debian.org/?p=pkg-xorg/lib/libxtst.git
+
+Package: libxtst6
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, x11-common
+Description: X11 Testing -- Record extension library
+ libXtst provides an X Window System client interface to the Record
+ extension to the X protocol.
+ .
+ The Record extension allows X clients to synthesise input events, which
+ is useful for automated testing.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ .
+ This module can be found at
+ git://anongit.freedesktop.org/git/xorg/lib/libXtst
+
+Package: libxtst6-dbg
+Architecture: any
+Section: debug
+Priority: extra
+Depends: ${shlibs:Depends}, ${misc:Depends}, x11-common, libxtst6 (= ${binary:Version})
+Description: X11 Record extension library (debug package)
+ libXtst provides an X Window System client interface to the Record
+ extension to the X protocol.
+ .
+ The Record extension allows X clients to synthesise input events, which
+ is useful for automated testing.
+ .
+ This package contains the debug versions of the library found in libxtst6.
+ Non-developers likely have little use for this package.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ .
+ This module can be found at
+ git://anongit.freedesktop.org/git/xorg/lib/libXtst
+
+Package: libxtst-dev
+Section: libdevel
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, libxtst6 (= ${binary:Version}), libx11-dev, libxext-dev, libxi-dev, x11proto-xext-dev (>= 7.0.99.3), x11proto-record-dev (>= 1.13.99.1),
+Replaces: x11proto-xext-dev (<< 7.0.99.3), x11proto-record-dev (<< 1.13.99.1)
+Description: X11 Record extension library (development headers)
+ libXtst provides an X Window System client interface to the Record
+ extension to the X protocol.
+ .
+ The Record extension allows X clients to synthesise input events, which
+ is useful for automated testing.
+ .
+ This package contains the development headers for the library found in
+ libxtst6.  Non-developers likely have little use for this package.
+ .
+ More information about X.Org can be found at:
+ <URL:http://www.X.org>
+ .
+ This module can be found at
+ git://anongit.freedesktop.org/git/xorg/lib/libXtst
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..313e438
--- /dev/null
@@ -0,0 +1,73 @@
+This package was downloaded from
+http://xorg.freedesktop.org/releases/individual/lib/
+
+Copyright:
+ XTest.c - Copyright 1990, 1991 by UniSoft Group Limited
+           Copyright 1992, 1993, 1998  The Open Group
+ XRecord.c - Copyright 1995, 1998  The Open Group
+             Copyright 1995 Network Computing Devices
+             By Stephen Gildea, X Consortium, and Martha Zimet, NCD.
+ Build system: Copyright 2005 Red Hat, Inc.
+
+License:
+
+ 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.
+XRecord also contains the following license:
+
+ Permission to use, copy, modify, distribute, and sell this software and
+ its documentation for any purpose is hereby granted without fee, provided
+ that the above copyright notice appear in all copies and that both that
+ copyright notice and this permission notice appear in supporting
+ documentation, and that the name of Network Computing Devices
+ not be used in advertising or publicity pertaining to distribution
+ of the software without specific, written prior permission.
+
+ NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO
+ THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES 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.
+
+License for the build system:
+
+ Permission to use, copy, modify, distribute, and sell this software and its
+ documentation for any purpose is hereby granted without fee, provided that
+ the above copyright notice appear in all copies and that both that
+ copyright notice and this permission notice appear in supporting
+ documentation, and that the name of Red Hat not be used in
+ advertising or publicity pertaining to distribution of the software without
+ specific, written prior permission.  Red Hat makes no
+ representations about the suitability of this software for any purpose.  It
+ is provided "as is" without express or implied warranty.
+
+ RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ EVENT SHALL RED HAT 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/libxtst-dev.install b/debian/libxtst-dev.install
new file mode 100755 (executable)
index 0000000..66d1e5c
--- /dev/null
@@ -0,0 +1,6 @@
+usr/lib/libXtst.a
+usr/lib/libXtst.la
+usr/lib/libXtst.so
+usr/lib/pkgconfig/xtst.pc
+#usr/share/man/man3
+usr/include/X11/extensions/
diff --git a/debian/libxtst6.install b/debian/libxtst6.install
new file mode 100644 (file)
index 0000000..9f81ac0
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/libXtst.so.6*
diff --git a/debian/patches/01_fix_date_in_manpages.diff b/debian/patches/01_fix_date_in_manpages.diff
new file mode 100644 (file)
index 0000000..bdd77be
--- /dev/null
@@ -0,0 +1,14 @@
+Make sure the manpage footer contains the date, not the date within
+<pubdate></pubdate>.
+
+--- a/man/XTest.xml
++++ b/man/XTest.xml
+@@ -43,7 +43,7 @@ X Consortium.
+ <!-- $Xorg: xtestlib.ms,v 1.3 2000/08/17 19:42:37 cpqbld Exp $ -->
+  <refentryinfo>
+   <productname>__vendorversion__</productname>
+-  <pubdate>6 June 2007</pubdate>
++  <date>6 June 2007</date>
+    <author><firstname>Kieron</firstname><surname>Drake</surname>
+    <affiliation><orgname>UniSoft Ltd.</orgname></affiliation>
+    </author>
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644 (file)
index 0000000..b93a37a
--- /dev/null
@@ -0,0 +1 @@
+01_fix_date_in_manpages.diff
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..cf85100
--- /dev/null
@@ -0,0 +1,104 @@
+#!/usr/bin/make -f
+# debian/rules for the Debian libxtst 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 = libxtst6
+
+include debian/xsfbs/xsfbs.mk
+
+CFLAGS = -Wall -g
+LDFLAGS +=  -Wl,--hash-style=both -Wl,--as-needed
+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_TYPE) --host=$(DEB_HOST_GNU_TYPE)
+#      confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
+endif
+
+
+build: build-stamp
+build-stamp:
+#build-stamp: $(STAMP_DIR)/patch
+       dh_testdir
+       autoreconf -vfi
+       ./autogen.sh
+       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)" 
+       cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE)
+       >$@
+
+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 INSTALL aclocal.m4 config.guess config.sub config.h.in configure
+       rm -f depcomp install-sh missing mkinstalldirs
+       rm -f ltmain.sh
+       find -name Makefile.in -exec rm -f {} \;
+       #find -name Makefile.in -delete
+
+       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
+#      dh_installchangelogs ChangeLog
+#      dh_installman
+       dh_link
+       dh_strip --dbg-package=$(PACKAGE)-dbg
+       dh_compress
+       dh_fixperms
+       dh_makeshlibs
+       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..0e59a4d
--- /dev/null
@@ -0,0 +1,2 @@
+version=3
+http://xorg.freedesktop.org/releases/individual/lib/ libXtst-(.*)\.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..3c59c20
--- /dev/null
@@ -0,0 +1,285 @@
+#!/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)/logdir $(STAMP_DIR)/genscripts
+       >$@
+
+.PHONY: logdir
+stampdir_targets+=logdir
+logdir: $(STAMP_DIR)/logdir
+$(STAMP_DIR)/logdir: $(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)/logdir
+       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
+       >$@
+
+# Compute dependencies for drivers
+#
+VIDEODEP = $(shell cat /usr/share/xserver-xorg/videodrvdep 2>/dev/null)
+INPUTDEP = $(shell cat /usr/share/xserver-xorg/xinputdep 2>/dev/null)
+
+# these two can be removed post-squeeze
+VIDEOABI = $(shell cat /usr/share/xserver-xorg/videoabiver 2>/dev/null)
+INPUTABI = $(shell cat /usr/share/xserver-xorg/inputabiver 2>/dev/null)
+VIDDRIVER_PROVIDES = xserver-xorg-video-$(VIDEOABI), xorg-driver-video
+INPDRIVER_PROVIDES = xserver-xorg-input-$(INPUTABI), xorg-driver-input
+
+ifeq ($(PACKAGE),)
+PACKAGE=$(shell awk '/^Package:/ { print $$2; exit }' < debian/control)
+endif
+
+.PHONY: serverabi
+serverabi: install
+ifeq ($(VIDEODEP),)
+       @echo 'error: xserver-xorg-dev >= 1.7.6.901 needs to be installed'
+       @exit 1
+else
+       echo "xviddriver:Depends=$(VIDEODEP)" >> debian/$(PACKAGE).substvars
+       echo "xinpdriver:Depends=$(INPUTDEP)" >> debian/$(PACKAGE).substvars
+       # the following is there for compatibility...
+       echo "xviddriver:Provides=$(VIDDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars
+       echo "xinpdriver:Provides=$(INPDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars
+       echo "xserver:Depends=$(VIDEODEP), $(INPUTDEP)" >> 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/include/X11/extensions/XTest.h b/include/X11/extensions/XTest.h
new file mode 100755 (executable)
index 0000000..f973aeb
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+
+Copyright 1992, 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.
+
+*/
+
+#ifndef _XTEST_H_
+#define _XTEST_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/xtestconst.h>
+#include <X11/extensions/XInput.h>
+
+_XFUNCPROTOBEGIN
+
+Bool XTestQueryExtension(
+    Display*           /* dpy */,
+    int*               /* event_basep */,
+    int*               /* error_basep */,
+    int*               /* majorp */,
+    int*               /* minorp */
+);
+
+Bool XTestCompareCursorWithWindow(
+    Display*           /* dpy */,
+    Window             /* window */,
+    Cursor             /* cursor */
+);
+
+Bool XTestCompareCurrentCursorWithWindow(
+    Display*           /* dpy */,
+    Window             /* window */
+);
+
+extern int XTestFakeKeyEvent(
+    Display*           /* dpy */,
+    unsigned int       /* keycode */,
+    Bool               /* is_press */,
+    unsigned long      /* delay */
+);
+
+extern int XTestFakeButtonEvent(
+    Display*           /* dpy */,
+    unsigned int       /* button */,
+    Bool               /* is_press */,
+    unsigned long      /* delay */
+);
+
+extern int XTestFakeMotionEvent(
+    Display*           /* dpy */,
+    int                        /* screen */,
+    int                        /* x */,
+    int                        /* y */,
+    unsigned long      /* delay */
+);
+
+extern int XTestFakeRelativeMotionEvent(
+    Display*           /* dpy */,
+    int                        /* x */,
+    int                        /* y */,
+    unsigned long      /* delay */
+);
+
+extern int XTestFakeDeviceKeyEvent(
+    Display*           /* dpy */,
+    XDevice*           /* dev */,
+    unsigned int       /* keycode */,
+    Bool               /* is_press */,
+    int*               /* axes */,
+    int                        /* n_axes */,
+    unsigned long      /* delay */
+);
+
+extern int XTestFakeDeviceButtonEvent(
+    Display*           /* dpy */,
+    XDevice*           /* dev */,
+    unsigned int       /* button */,
+    Bool               /* is_press */,
+    int*               /* axes */,
+    int                        /* n_axes */,
+    unsigned long      /* delay */
+);
+
+extern int XTestFakeProximityEvent(
+    Display*           /* dpy */,
+    XDevice*           /* dev */,
+    Bool               /* in_prox */,
+    int*               /* axes */,
+    int                        /* n_axes */,
+    unsigned long      /* delay */
+);
+
+extern int XTestFakeDeviceMotionEvent(
+    Display*           /* dpy */,
+    XDevice*           /* dev */,
+    Bool               /* is_relative */,
+    int                        /* first_axis */,
+    int*               /* axes */,
+    int                        /* n_axes */,
+    unsigned long      /* delay */
+);
+
+extern int XTestGrabControl(
+    Display*           /* dpy */,
+    Bool               /* impervious */
+);
+
+void XTestSetGContextOfGC(
+    GC                 /* gc */,
+    GContext           /* gid */
+);
+
+void XTestSetVisualIDOfVisual(
+    Visual*            /* visual */,
+    VisualID           /* visualid */
+);
+
+Status XTestDiscard(
+    Display*           /* dpy */
+);
+
+_XFUNCPROTOEND
+
+#endif
diff --git a/include/X11/extensions/record.h b/include/X11/extensions/record.h
new file mode 100644 (file)
index 0000000..e82b06c
--- /dev/null
@@ -0,0 +1,183 @@
+/***************************************************************************
+ * Copyright 1995 Network Computing Devices
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Network Computing Devices
+ * not be used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ *
+ * NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES 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.
+ **************************************************************************/
+
+#ifndef _RECORD_H_
+#define _RECORD_H_
+
+#include <X11/extensions/recordconst.h>
+
+typedef unsigned long   XRecordClientSpec;
+typedef unsigned long  XRecordContext;
+
+typedef struct
+{
+    unsigned char      first;
+    unsigned char      last;
+} XRecordRange8;
+
+typedef struct
+{
+    unsigned short     first;
+    unsigned short     last;
+} XRecordRange16;
+
+typedef struct
+{
+    XRecordRange8      ext_major;
+    XRecordRange16     ext_minor;
+} XRecordExtRange;
+
+typedef struct
+{
+    XRecordRange8     core_requests;   /* core X requests */
+    XRecordRange8     core_replies;    /* core X replies */
+    XRecordExtRange   ext_requests;    /* extension requests */
+    XRecordExtRange   ext_replies;     /* extension replies */
+    XRecordRange8     delivered_events;        /* delivered core and ext events */
+    XRecordRange8     device_events;   /* all core and ext device events */
+    XRecordRange8     errors;          /* core X and ext errors */
+    Bool             client_started;   /* connection setup reply */
+    Bool              client_died;     /* notice of client disconnect */
+} XRecordRange;
+
+typedef struct
+{
+    XRecordClientSpec  client;
+    unsigned long      nranges;
+    XRecordRange       **ranges;
+} XRecordClientInfo;
+
+typedef struct
+{
+    Bool               enabled;
+    int                        datum_flags;
+    unsigned long      nclients;
+    XRecordClientInfo  **client_info;
+} XRecordState;
+
+typedef struct
+{
+    XID                id_base;
+    Time               server_time;
+    unsigned long      client_seq;
+    int                        category;
+    Bool               client_swapped;
+    unsigned char      *data;
+    unsigned long      data_len;       /* in 4-byte units */
+} XRecordInterceptData;
+
+_XFUNCPROTOBEGIN
+
+/*********************************************************
+ *
+ * Prototypes
+ *
+ */
+
+XID XRecordIdBaseMask(
+    Display *dpy
+);
+
+extern Status XRecordQueryVersion(
+    Display*                   /* dpy */,
+    int*                       /* cmajor_return */,
+    int*                       /* cminor_return */
+);
+
+extern XRecordContext XRecordCreateContext(
+    Display*                   /* dpy */,
+    int                                /* datum_flags */,
+    XRecordClientSpec*         /* clients */,
+    int                                /* nclients */,
+    XRecordRange**              /* ranges */,
+    int                                /* nranges */
+);
+
+extern XRecordRange *XRecordAllocRange(
+    void
+);
+
+extern Status XRecordRegisterClients(
+    Display*                   /* dpy */,
+    XRecordContext             /* context */,
+    int                                /* datum_flags */,
+    XRecordClientSpec*         /* clients */,
+    int                                /* nclients */,
+    XRecordRange**             /* ranges */,
+    int                                /* nranges */
+);
+
+extern Status XRecordUnregisterClients(
+    Display*                   /* dpy */,
+    XRecordContext             /* context */,
+    XRecordClientSpec*         /* clients */,
+    int                                /* nclients */
+);
+
+extern Status XRecordGetContext(
+    Display*                   /* dpy */,
+    XRecordContext             /* context */,
+    XRecordState**             /* state_return */
+);
+
+extern void XRecordFreeState(
+XRecordState*                  /* state */
+);
+
+typedef void (*XRecordInterceptProc) (
+    XPointer                   /* closure */,
+    XRecordInterceptData*      /* recorded_data */
+);
+
+extern Status XRecordEnableContext(
+    Display*                   /* dpy */,
+    XRecordContext             /* context */,
+    XRecordInterceptProc       /* callback */,
+    XPointer                   /* closure */
+);
+
+extern Status XRecordEnableContextAsync(
+    Display*                   /* dpy */,
+    XRecordContext             /* context */,
+    XRecordInterceptProc       /* callback */,
+    XPointer                   /* closure */
+);
+
+extern void XRecordProcessReplies(
+    Display*                   /* dpy */
+);
+
+extern void XRecordFreeData(
+XRecordInterceptData*  /* data */
+);
+
+extern Status XRecordDisableContext(
+    Display*                   /* dpy */,
+    XRecordContext             /* context */
+);
+
+extern Status XRecordFreeContext(
+    Display*                   /* dpy */,
+    XRecordContext             /* context */
+);
+
+_XFUNCPROTOEND
+
+#endif
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100755 (executable)
index 0000000..2597d07
--- /dev/null
@@ -0,0 +1,78 @@
+#
+# Copyright (c) 2007, Oracle and/or its affiliates. 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)
+
+libman_xml = XTest.xml
+
+libman_PRE =   \
+       XTestQueryExtension.man \
+       XTestCompareCursorWithWindow.man \
+       XTestCompareCurrentCursorWithWindow.man \
+       XTestFakeKeyEvent.man \
+       XTestFakeButtonEvent.man \
+       XTestFakeMotionEvent.man \
+       XTestFakeRelativeMotionEvent.man \
+       XTestGrabControl.man \
+       XTestSetGContextOfGC.man \
+       XTestSetVisualIDOfVisual.man \
+       XTestDiscard.man
+
+EXTRA_DIST = $(libman_PRE) $(libman_xml) x.stamp
+
+CLEANFILES = $(libman_DATA)
+
+MAINTAINERCLEANFILES = $(libman_PRE)
+
+if INSTALL_MANPAGES
+libman_DATA = $(libman_PRE:man=@LIB_MAN_SUFFIX@)
+endif
+
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+SUFFIXES = .$(LIB_MAN_SUFFIX) .man
+
+.man.$(LIB_MAN_SUFFIX):
+       $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
+
+# This is ugly, but handling of tools with multiple outputs in make is a
+# huge PITA. The commands below are taken from the automake manual:
+# http://www.gnu.org/software/automake/manual/automake.html#Multiple-Outputs
+if HAVE_XMLTO
+x.stamp: $(libman_xml)
+       @rm -f x.tmp
+       @touch x.tmp
+       $(XMLTO) man $^
+       @for man in $(libman_PRE); do \
+         out=`echo $$man | sed 's/\.man/.__libmansuffix__/'`; \
+         echo mv -f $$out $$man; \
+         mv -f $$out $$man || exit 1; \
+       done
+       @mv -f x.tmp $@
+$(libman_PRE): x.stamp
+       @if test -f $@; then :; else \
+         rm -f $<; \
+         $(MAKE) $(AM_MAKEFLAGS) $<; \
+       fi
+CLEANFILES += x.tmp
+MAINTAINERCLEANFILES += x.stamp
+endif # HAVE_XMLTO
diff --git a/man/XTest.xml b/man/XTest.xml
new file mode 100755 (executable)
index 0000000..0c33ed8
--- /dev/null
@@ -0,0 +1,413 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<!-- lifted from troff+man by doclifter -->
+<refentry id='XTest.man'>
+<!--  
+Copyright &copy; 1992 by UniSoft Group Ltd.
+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.  
+UniSoft makes no representations about the suitability for any purpose of 
+the information in this document.  This documentation is provided "as is"
+without express or implied warranty.
+
+Copyright &copy; 1992, 1994 X Consortium
+
+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 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 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.
+
+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.
+ -->
+
+<!-- edited for DP edits and code consistency w/ core protocol/xlib 4/2/96 -->
+<!-- Converted from xorg-docs/specs/Xext/xtestlib.ms 6/6/07 -->
+ <refentryinfo>
+  <productname>__vendorversion__</productname>
+  <pubdate>6 June 2007</pubdate>
+   <author><firstname>Kieron</firstname><surname>Drake</surname>
+   <affiliation><orgname>UniSoft Ltd.</orgname></affiliation>
+   </author>
+ </refentryinfo>
+<refmeta>
+<refentrytitle>XTest</refentrytitle>
+<manvolnum>__libmansuffix__</manvolnum>
+<refmiscinfo class='source'>__xorgversion__</refmiscinfo>
+<refmiscinfo class='manual'>XTST FUNCTIONS</refmiscinfo>
+</refmeta>
+<refnamediv id='name'>
+<refname>XTestQueryExtension</refname>
+<refname>XTestCompareCursorWithWindow</refname>
+<refname>XTestCompareCurrentCursorWithWindow</refname>
+<refname>XTestFakeKeyEvent</refname>
+<refname>XTestFakeButtonEvent</refname>
+<refname>XTestFakeMotionEvent</refname>
+<refname>XTestFakeRelativeMotionEvent</refname>
+<refname>XTestGrabControl</refname>
+<refname>XTestSetGContextOfGC</refname>
+<refname>XTestSetVisualIDOfVisual</refname>
+<refname>XTestDiscard</refname>
+<refpurpose>XTest extension functions</refpurpose>
+</refnamediv>
+<!-- body begins here -->
+<refsynopsisdiv id='synopsis'>
+<funcsynopsis>
+<funcsynopsisinfo>
+cc [ flag ... ] file ... -lXtst  [ library ... ]
+</funcsynopsisinfo>
+<funcsynopsisinfo>
+#include &lt;X11/extensions/XTest.h&gt;
+</funcsynopsisinfo>
+<funcprototype>
+<funcdef><function>Bool</function> XTestQueryExtension</funcdef>
+<paramdef><parameter>display</parameter></paramdef>
+<paramdef><parameter>event_base_return</parameter></paramdef>
+<paramdef><parameter>error_base_return</parameter></paramdef>
+<paramdef><parameter>major_version_return</parameter></paramdef>
+<paramdef><parameter>minor_version_return</parameter></paramdef>
+</funcprototype>
+<funcsynopsisinfo>
+ Display *display;
+ int *event_base_return;
+ int *error_base_return;
+ int *major_version_return;
+ int *minor_version_return;
+</funcsynopsisinfo>
+<funcprototype>
+<funcdef><function>Bool</function> XTestCompareCursorWithWindow</funcdef>
+<paramdef><parameter>display</parameter></paramdef>
+<paramdef><parameter>window</parameter></paramdef>
+<paramdef><parameter>cursor</parameter></paramdef>
+</funcprototype>
+<funcsynopsisinfo>
+ Display *display;
+ Window window;
+ Cursor cursor;
+</funcsynopsisinfo>
+<funcprototype>
+<funcdef><function>Bool</function> XTestCompareCurrentCursorWithWindow</funcdef>
+<paramdef><parameter>display</parameter></paramdef>
+<paramdef><parameter>window</parameter></paramdef>
+</funcprototype>
+<funcsynopsisinfo>
+ Display *display;
+ Window window;
+</funcsynopsisinfo>
+<funcprototype>
+<funcdef>int <function>XTestFakeKeyEvent</function></funcdef>
+<paramdef><parameter>display</parameter></paramdef>
+<paramdef><parameter>keycode</parameter></paramdef>
+<paramdef><parameter>is_press</parameter></paramdef>
+<paramdef><parameter>delay</parameter></paramdef>
+</funcprototype>
+<funcsynopsisinfo>
+ Display *display;
+ unsigned int keycode;
+ Bool is_press;
+ unsigned long delay;
+</funcsynopsisinfo>
+<funcprototype>
+<funcdef>int <function>XTestFakeButtonEvent</function></funcdef>
+<paramdef><parameter>display</parameter></paramdef>
+<paramdef><parameter>button</parameter></paramdef>
+<paramdef><parameter>is_press</parameter></paramdef>
+<paramdef><parameter>delay</parameter></paramdef>
+</funcprototype>
+<funcsynopsisinfo>
+ Display *display;
+ unsigned int button;
+ Bool is_press;
+ unsigned long delay;
+</funcsynopsisinfo>
+<funcprototype>
+<funcdef>int <function>XTestFakeMotionEvent</function></funcdef>
+<paramdef><parameter>display</parameter></paramdef>
+<paramdef><parameter>screen_number</parameter></paramdef>
+<paramdef><parameter>x</parameter></paramdef>
+<paramdef><parameter>y</parameter></paramdef>
+<paramdef><parameter>delay</parameter></paramdef>
+</funcprototype>
+<funcsynopsisinfo>
+ Display *display;
+ int screen_number;
+ int x, y;
+ unsigned long delay;
+</funcsynopsisinfo>
+<funcprototype>
+<funcdef>int <function>XTestFakeRelativeMotionEvent</function></funcdef>
+<paramdef><parameter>display</parameter></paramdef>
+<paramdef><parameter>screen_number</parameter></paramdef>
+<paramdef><parameter>x</parameter></paramdef>
+<paramdef><parameter>y</parameter></paramdef>
+<paramdef><parameter>delay</parameter></paramdef>
+</funcprototype>
+<funcsynopsisinfo>
+ Display *display;
+ int screen_number;
+ int x, y;
+ unsigned long delay;
+</funcsynopsisinfo>
+<funcprototype>
+<funcdef>int <function>XTestGrabControl</function></funcdef>
+<paramdef><parameter>display</parameter></paramdef>
+<paramdef><parameter>impervious</parameter></paramdef>
+</funcprototype>
+<funcsynopsisinfo>
+ Display *display;
+ Bool impervious;
+</funcsynopsisinfo>
+<funcprototype>
+<funcdef>void <function>XTestSetGContextOfGC</function></funcdef>
+<paramdef><parameter>gc</parameter></paramdef>
+<paramdef><parameter>gid</parameter></paramdef>
+</funcprototype>
+<funcsynopsisinfo>
+ GC gc;
+ GContext gid;
+</funcsynopsisinfo>
+<funcprototype>
+<funcdef>void <function>XTestSetVisualIDOfVisual</function></funcdef>
+<paramdef><parameter>visual</parameter></paramdef>
+<paramdef><parameter>visualid</parameter></paramdef>
+</funcprototype>
+<funcsynopsisinfo>
+ Visual *visual;
+ VisualID visualid;
+</funcsynopsisinfo>
+<funcprototype>
+<funcdef><function>Status</function> XTestDiscard</funcdef>
+<paramdef><parameter>display</parameter></paramdef>
+</funcprototype>
+<funcsynopsisinfo>
+ Display *display;
+</funcsynopsisinfo>
+</funcsynopsis>
+</refsynopsisdiv>
+
+
+<refsect1 id='description'><title>DESCRIPTION</title>
+<para>This extension is a minimal set of client and server extensions
+required to completely test the X11 server with no user intervention.
+This extension is not intended to support general journaling and
+playback of user actions.</para> 
+
+<para>The functions provided by this extension fall into two groups:</para>
+<variablelist remap='IP'>
+  <varlistentry>
+  <term><emphasis remap='B'>Client Operations</emphasis></term>
+  <listitem>
+<para>These routines manipulate otherwise hidden client-side behavior.  The
+actual implementation will depend on the details of the actual language
+binding and what degree of request buffering, GContext caching, and so on, is
+provided.  In the C binding, routines are provided
+to access the internals of two opaque data structures 
+&mdash; <structname>GC</structname>s
+and
+<structname>Visual</structname>s &mdash;
+and to discard any requests pending within the
+output buffer of a connection.  The exact details can be expected to differ for
+other language bindings.</para>
+  </listitem>
+  </varlistentry>
+  <varlistentry>
+  <term><emphasis remap='B'>Server Requests</emphasis></term>
+  <listitem>
+<para>The first of these requests is similar to that provided in most
+extensions: it allows a client to specify a major and minor version
+number to the server and for the server to respond with major and minor
+versions of its own.  The remaining two requests allow the following:</para>
+ <itemizedlist>
+  <listitem>
+<para>Access to an otherwise <emphasis>write-only</emphasis> server resource: 
+the cursor associated with a given window</para>
+  </listitem>
+  <listitem>
+<para>Perhaps most importantly, limited synthesis of input device events,
+almost as if a cooperative user had moved the pointing device
+or pressed a key or button.</para>
+  </listitem>
+ </itemizedlist>
+  </listitem>
+  </varlistentry>
+</variablelist>
+
+<para>All XTEST extension functions and procedures, and all manifest
+constants and macros, will start with the string <emphasis>XTest</emphasis>.
+All operations are classified as
+server/client (Server) or client-only (Client).</para>
+
+<para><function>XTestQueryExtension</function>
+returns
+<returnvalue>True</returnvalue>
+if the specified display supports the XTEST extension, else
+<returnvalue>False</returnvalue>.
+If the extension is supported, *event_base would be set to the event number for
+the first event for this extension and
+*error_base would be set to the error number for the first error for
+this extension.  As no errors or events are defined for this version of the extension,
+the values returned here are not defined (nor useful).
+If the extension is supported, *major_version and *minor_version are set to
+the major and minor version numbers of the extension supported by the
+display.  Otherwise, none of the arguments are set.</para>
+
+
+<para>If the extension is supported,
+<function>XTestCompareCursorWithWindow</function>
+performs a comparison of the cursor
+whose ID is specified by cursor (which may be
+<emphasis remap='B'>None</emphasis>)
+with the cursor of the window specified by window returning
+<returnvalue>True</returnvalue>
+if they are the same and
+<returnvalue>False</returnvalue>
+otherwise. 
+If the extension is not supported, then the request is ignored and
+zero is returned.</para>
+
+
+<para>If the extension is supported, 
+<function>XTestCompareCurrentCursorWithWindow</function>
+performs a comparison of the current cursor
+with the cursor of the specified window returning
+<returnvalue>True</returnvalue>
+if they are the same and
+<returnvalue>False</returnvalue>
+otherwise.
+If the extension is not supported, then the request is ignored and
+zero is returned.</para>
+
+
+<para>If the extension is supported,
+<function>XTestFakeKeyEvent</function>
+requests the server to simulate either a
+<emphasis remap='B'>KeyPress</emphasis>
+(if is_press is
+<returnvalue>True</returnvalue>)
+or a
+<emphasis remap='B'>KeyRelease</emphasis>
+(if is_press is
+<returnvalue>False</returnvalue>)
+of the key with the specified keycode;
+otherwise, the request is ignored.</para>
+
+<para>If the extension is supported,
+the simulated event will not be processed until delay milliseconds
+after the request is received (if delay is
+<emphasis remap='B'>CurrentTime</emphasis>,
+then this is interpreted as no delay at all).  No other requests from
+this client will be processed until this delay, if any, has expired
+and subsequent processing of the simulated event has been completed.</para>
+
+
+<para>If the extension is supported,
+<function>XTestFakeButtonEvent</function>
+requests the server to simulate either
+a
+<emphasis remap='B'>ButtonPress</emphasis>
+(if is_press is
+<returnvalue>True</returnvalue>)
+or a
+<emphasis remap='B'>ButtonRelease</emphasis>
+(if is_press is
+<returnvalue>False</returnvalue>)
+of the logical button numbered by the specified button;
+otherwise, the request is ignored.</para>
+
+<para>If the extension is supported,
+the simulated event will not be processed until delay milliseconds
+after the request is received (if delay is
+<emphasis remap='B'>CurrentTime</emphasis>,
+then this is interpreted as no delay at all).  No other requests from
+this client will be processed until this delay, if any, has expired
+and subsequent processing of the simulated event has been completed.</para>
+
+
+<para>If the extension is supported,
+<function>XTestFakeMotionEvent</function>
+requests the server to simulate
+a movement of the pointer to the specified position (x, y) on the
+root window of screen_number;
+otherwise, the request is ignored.  If screen_number is -1, the
+current screen (that the pointer is on) is used.</para>
+
+<para>If the extension is supported,
+the simulated event will not be processed until delay milliseconds
+after the request is received (if delay is
+<emphasis remap='B'>CurrentTime</emphasis>,
+then this is interpreted as no delay at all).  No other requests from
+this client will be processed until this delay, if any, has expired
+and subsequent processing of the simulated event has been completed.</para>
+
+
+<para>If the extension is supported,
+<function>XTestFakeRelativeMotionEvent</function>
+requests the server to simulate
+a movement of the pointer by the specified offsets (x, y) relative
+to the current pointer position on screen_number;
+otherwise, the request is ignored.  If screen_number is -1, the
+current screen (that the pointer is on) is used.</para>
+
+<para>If the extension is supported,
+the simulated event will not be processed until delay milliseconds
+after the request is received (if delay is
+<emphasis remap='B'>CurrentTime</emphasis>,
+then this is interpreted as no delay at all).  No other requests from
+this client will be processed until this delay, if any, has expired
+and subsequent processing of the simulated event has been completed.</para>
+
+
+
+<para>If impervious is
+<returnvalue>True</returnvalue>,
+then the executing client becomes impervious to server grabs.
+If impervious is
+<returnvalue>False</returnvalue>,
+then the executing client returns to the normal state of being
+susceptible to server grabs.</para>
+
+
+<para><function>XTestSetGContextOfGC</function>
+sets the GContext within the opaque datatype referenced by gc to
+be that specified by gid.</para>
+
+
+<para><function>XTestSetVisualIDOfVisual</function>
+sets the VisualID within the opaque datatype referenced by visual to
+be that specified by visualid.</para>
+
+
+<para><function>XTestDiscard</function>
+discards any requests within the output buffer for the specified display.
+It returns
+<returnvalue>True</returnvalue>
+if any requests were discarded; otherwise, it returns
+<returnvalue>False</returnvalue>.</para>
+
+</refsect1>
+
+<refsect1 id='return_values'><title>RETURN VALUES</title>
+<para>All routines that have return type Status will return nonzero for
+success and zero for failure.  Even if the XTEST extension is
+supported, the server may withdraw such facilities arbitrarily; in which case
+they will subsequently return zero.</para>
+</refsect1>
+</refentry>
+
diff --git a/man/XTestCompareCurrentCursorWithWindow.man b/man/XTestCompareCurrentCursorWithWindow.man
new file mode 100644 (file)
index 0000000..7d905aa
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XTestQueryExtension.__libmansuffix__
diff --git a/man/XTestCompareCursorWithWindow.man b/man/XTestCompareCursorWithWindow.man
new file mode 100644 (file)
index 0000000..7d905aa
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XTestQueryExtension.__libmansuffix__
diff --git a/man/XTestDiscard.man b/man/XTestDiscard.man
new file mode 100644 (file)
index 0000000..7d905aa
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XTestQueryExtension.__libmansuffix__
diff --git a/man/XTestFakeButtonEvent.man b/man/XTestFakeButtonEvent.man
new file mode 100644 (file)
index 0000000..7d905aa
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XTestQueryExtension.__libmansuffix__
diff --git a/man/XTestFakeKeyEvent.man b/man/XTestFakeKeyEvent.man
new file mode 100644 (file)
index 0000000..7d905aa
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XTestQueryExtension.__libmansuffix__
diff --git a/man/XTestFakeMotionEvent.man b/man/XTestFakeMotionEvent.man
new file mode 100644 (file)
index 0000000..7d905aa
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XTestQueryExtension.__libmansuffix__
diff --git a/man/XTestFakeRelativeMotionEvent.man b/man/XTestFakeRelativeMotionEvent.man
new file mode 100644 (file)
index 0000000..7d905aa
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XTestQueryExtension.__libmansuffix__
diff --git a/man/XTestGrabControl.man b/man/XTestGrabControl.man
new file mode 100644 (file)
index 0000000..7d905aa
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XTestQueryExtension.__libmansuffix__
diff --git a/man/XTestQueryExtension.man b/man/XTestQueryExtension.man
new file mode 100755 (executable)
index 0000000..0370bca
--- /dev/null
@@ -0,0 +1,218 @@
+.\" ** You probably do not want to edit this file directly **
+.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1).
+.\" Instead of manually editing it, you probably should edit the DocBook XML
+.\" source for it and then use the DocBook XSL Stylesheets to regenerate it.
+.TH "XTEST" "__libmansuffix__" "6 June 2007" "__xorgversion__" "XTST FUNCTIONS"
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH "NAME"
+XTestQueryExtension, XTestCompareCursorWithWindow, XTestCompareCurrentCursorWithWindow, XTestFakeKeyEvent, XTestFakeButtonEvent, XTestFakeMotionEvent, XTestFakeRelativeMotionEvent, XTestGrabControl, XTestSetGContextOfGC, XTestSetVisualIDOfVisual, XTestDiscard \- XTest extension functions
+.SH "SYNOPSIS"
+.PP
+\fB
+cc [ flag ... ] file ... \-lXtst  [ library ... ]
+\fR
+.PP
+\fB
+#include <X11/extensions/XTest.h>
+\fR
+.HP 25
+\fB\fBBool\fR\ XTestQueryExtension\fR\fB(\fR\fB\fIdisplay\fR\fR\fB, \fR\fB\fIevent_base_return\fR\fR\fB, \fR\fB\fIerror_base_return\fR\fR\fB, \fR\fB\fImajor_version_return\fR\fR\fB, \fR\fB\fIminor_version_return\fR\fR\fB);\fR
+.PP
+\fB
+ Display *display;
+ int *event_base_return;
+ int *error_base_return;
+ int *major_version_return;
+ int *minor_version_return;
+\fR
+.HP 34
+\fB\fBBool\fR\ XTestCompareCursorWithWindow\fR\fB(\fR\fB\fIdisplay\fR\fR\fB, \fR\fB\fIwindow\fR\fR\fB, \fR\fB\fIcursor\fR\fR\fB);\fR
+.PP
+\fB
+ Display *display;
+ Window window;
+ Cursor cursor;
+\fR
+.HP 41
+\fB\fBBool\fR\ XTestCompareCurrentCursorWithWindow\fR\fB(\fR\fB\fIdisplay\fR\fR\fB, \fR\fB\fIwindow\fR\fR\fB);\fR
+.PP
+\fB
+ Display *display;
+ Window window;
+\fR
+.HP 22
+\fBint\ \fBXTestFakeKeyEvent\fR\fR\fB(\fR\fB\fIdisplay\fR\fR\fB, \fR\fB\fIkeycode\fR\fR\fB, \fR\fB\fIis_press\fR\fR\fB, \fR\fB\fIdelay\fR\fR\fB);\fR
+.PP
+\fB
+ Display *display;
+ unsigned int keycode;
+ Bool is_press;
+ unsigned long delay;
+\fR
+.HP 25
+\fBint\ \fBXTestFakeButtonEvent\fR\fR\fB(\fR\fB\fIdisplay\fR\fR\fB, \fR\fB\fIbutton\fR\fR\fB, \fR\fB\fIis_press\fR\fR\fB, \fR\fB\fIdelay\fR\fR\fB);\fR
+.PP
+\fB
+ Display *display;
+ unsigned int button;
+ Bool is_press;
+ unsigned long delay;
+\fR
+.HP 25
+\fBint\ \fBXTestFakeMotionEvent\fR\fR\fB(\fR\fB\fIdisplay\fR\fR\fB, \fR\fB\fIscreen_number\fR\fR\fB, \fR\fB\fIx\fR\fR\fB, \fR\fB\fIy\fR\fR\fB, \fR\fB\fIdelay\fR\fR\fB);\fR
+.PP
+\fB
+ Display *display;
+ int screen_number;
+ int x, y;
+ unsigned long delay;
+\fR
+.HP 33
+\fBint\ \fBXTestFakeRelativeMotionEvent\fR\fR\fB(\fR\fB\fIdisplay\fR\fR\fB, \fR\fB\fIscreen_number\fR\fR\fB, \fR\fB\fIx\fR\fR\fB, \fR\fB\fIy\fR\fR\fB, \fR\fB\fIdelay\fR\fR\fB);\fR
+.PP
+\fB
+ Display *display;
+ int screen_number;
+ int x, y;
+ unsigned long delay;
+\fR
+.HP 21
+\fBint\ \fBXTestGrabControl\fR\fR\fB(\fR\fB\fIdisplay\fR\fR\fB, \fR\fB\fIimpervious\fR\fR\fB);\fR
+.PP
+\fB
+ Display *display;
+ Bool impervious;
+\fR
+.HP 26
+\fBvoid\ \fBXTestSetGContextOfGC\fR\fR\fB(\fR\fB\fIgc\fR\fR\fB, \fR\fB\fIgid\fR\fR\fB);\fR
+.PP
+\fB
+ GC gc;
+ GContext gid;
+\fR
+.HP 30
+\fBvoid\ \fBXTestSetVisualIDOfVisual\fR\fR\fB(\fR\fB\fIvisual\fR\fR\fB, \fR\fB\fIvisualid\fR\fR\fB);\fR
+.PP
+\fB
+ Visual *visual;
+ VisualID visualid;
+\fR
+.HP 20
+\fB\fBStatus\fR\ XTestDiscard\fR\fB(\fR\fB\fIdisplay\fR\fR\fB);\fR
+.PP
+\fB
+ Display *display;
+\fR
+.SH "DESCRIPTION"
+.PP
+This extension is a minimal set of client and server extensions required to completely test the X11 server with no user intervention. This extension is not intended to support general journaling and playback of user actions.
+.PP
+The functions provided by this extension fall into two groups:
+.TP
+\fIClient Operations\fR
+These routines manipulate otherwise hidden client\-side behavior. The actual implementation will depend on the details of the actual language binding and what degree of request buffering, GContext caching, and so on, is provided. In the C binding, routines are provided to access the internals of two opaque data structures \(em
+GCs and
+Visuals \(em and to discard any requests pending within the output buffer of a connection. The exact details can be expected to differ for other language bindings.
+.TP
+\fIServer Requests\fR
+The first of these requests is similar to that provided in most extensions: it allows a client to specify a major and minor version number to the server and for the server to respond with major and minor versions of its own. The remaining two requests allow the following:
+.RS
+.TP 3
+\(bu
+Access to an otherwise
+\fIwrite\-only\fR
+server resource: the cursor associated with a given window
+.TP
+\(bu
+Perhaps most importantly, limited synthesis of input device events, almost as if a cooperative user had moved the pointing device or pressed a key or button.
+.RE
+.PP
+All XTEST extension functions and procedures, and all manifest constants and macros, will start with the string
+\fIXTest\fR. All operations are classified as server/client (Server) or client\-only (Client).
+.PP
+\fBXTestQueryExtension\fR
+returns
+True
+if the specified display supports the XTEST extension, else
+False. If the extension is supported, *event_base would be set to the event number for the first event for this extension and *error_base would be set to the error number for the first error for this extension. As no errors or events are defined for this version of the extension, the values returned here are not defined (nor useful). If the extension is supported, *major_version and *minor_version are set to the major and minor version numbers of the extension supported by the display. Otherwise, none of the arguments are set.
+.PP
+If the extension is supported,
+\fBXTestCompareCursorWithWindow\fR
+performs a comparison of the cursor whose ID is specified by cursor (which may be
+\fINone\fR) with the cursor of the window specified by window returning
+True
+if they are the same and
+False
+otherwise. If the extension is not supported, then the request is ignored and zero is returned.
+.PP
+If the extension is supported,
+\fBXTestCompareCurrentCursorWithWindow\fR
+performs a comparison of the current cursor with the cursor of the specified window returning
+True
+if they are the same and
+False
+otherwise. If the extension is not supported, then the request is ignored and zero is returned.
+.PP
+If the extension is supported,
+\fBXTestFakeKeyEvent\fR
+requests the server to simulate either a
+\fIKeyPress\fR
+(if is_press is
+True) or a
+\fIKeyRelease\fR
+(if is_press is
+False) of the key with the specified keycode; otherwise, the request is ignored.
+.PP
+If the extension is supported, the simulated event will not be processed until delay milliseconds after the request is received (if delay is
+\fICurrentTime\fR, then this is interpreted as no delay at all). No other requests from this client will be processed until this delay, if any, has expired and subsequent processing of the simulated event has been completed.
+.PP
+If the extension is supported,
+\fBXTestFakeButtonEvent\fR
+requests the server to simulate either a
+\fIButtonPress\fR
+(if is_press is
+True) or a
+\fIButtonRelease\fR
+(if is_press is
+False) of the logical button numbered by the specified button; otherwise, the request is ignored.
+.PP
+If the extension is supported, the simulated event will not be processed until delay milliseconds after the request is received (if delay is
+\fICurrentTime\fR, then this is interpreted as no delay at all). No other requests from this client will be processed until this delay, if any, has expired and subsequent processing of the simulated event has been completed.
+.PP
+If the extension is supported,
+\fBXTestFakeMotionEvent\fR
+requests the server to simulate a movement of the pointer to the specified position (x, y) on the root window of screen_number; otherwise, the request is ignored. If screen_number is \-1, the current screen (that the pointer is on) is used.
+.PP
+If the extension is supported, the simulated event will not be processed until delay milliseconds after the request is received (if delay is
+\fICurrentTime\fR, then this is interpreted as no delay at all). No other requests from this client will be processed until this delay, if any, has expired and subsequent processing of the simulated event has been completed.
+.PP
+If the extension is supported,
+\fBXTestFakeRelativeMotionEvent\fR
+requests the server to simulate a movement of the pointer by the specified offsets (x, y) relative to the current pointer position on screen_number; otherwise, the request is ignored. If screen_number is \-1, the current screen (that the pointer is on) is used.
+.PP
+If the extension is supported, the simulated event will not be processed until delay milliseconds after the request is received (if delay is
+\fICurrentTime\fR, then this is interpreted as no delay at all). No other requests from this client will be processed until this delay, if any, has expired and subsequent processing of the simulated event has been completed.
+.PP
+If impervious is
+True, then the executing client becomes impervious to server grabs. If impervious is
+False, then the executing client returns to the normal state of being susceptible to server grabs.
+.PP
+\fBXTestSetGContextOfGC\fR
+sets the GContext within the opaque datatype referenced by gc to be that specified by gid.
+.PP
+\fBXTestSetVisualIDOfVisual\fR
+sets the VisualID within the opaque datatype referenced by visual to be that specified by visualid.
+.PP
+\fBXTestDiscard\fR
+discards any requests within the output buffer for the specified display. It returns
+True
+if any requests were discarded; otherwise, it returns
+False.
+.SH "RETURN VALUES"
+.PP
+All routines that have return type Status will return nonzero for success and zero for failure. Even if the XTEST extension is supported, the server may withdraw such facilities arbitrarily; in which case they will subsequently return zero.
+.SH "AUTHOR"
+Kieron Drake. 
diff --git a/man/XTestSetGContextOfGC.man b/man/XTestSetGContextOfGC.man
new file mode 100644 (file)
index 0000000..7d905aa
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XTestQueryExtension.__libmansuffix__
diff --git a/man/XTestSetVisualIDOfVisual.man b/man/XTestSetVisualIDOfVisual.man
new file mode 100644 (file)
index 0000000..7d905aa
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XTestQueryExtension.__libmansuffix__
diff --git a/man/x.stamp b/man/x.stamp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/packaging/libXtst.spec b/packaging/libXtst.spec
new file mode 100644 (file)
index 0000000..f39c44e
--- /dev/null
@@ -0,0 +1,81 @@
+
+Name:       libXtst
+Summary:    X.Org X11 libXtst runtime library
+Version:    1.2.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(xproto)
+BuildRequires:  pkgconfig(xextproto)
+BuildRequires:  pkgconfig(randrproto)
+BuildRequires:  pkgconfig(inputproto)
+BuildRequires:  pkgconfig(recordproto)
+BuildRequires:  pkgconfig(xextproto)
+BuildRequires:  pkgconfig(xi)
+BuildRequires:  pkgconfig(x11)
+BuildRequires:  pkgconfig(xext)
+BuildRequires:  pkgconfig(xrender)
+BuildRequires:  pkgconfig(xorg-macros)
+
+%description
+Description: %{summary}
+
+
+%package devel
+Summary:    Development components for the libXtst library
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+Description: %{summary}
+
+
+%prep
+%setup -q -n %{name}-%{version}
+
+
+%build
+
+%reconfigure \
+       CFLAGS="-Wall -g" \
+       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,-)
+%doc COPYING ChangeLog
+%{_libdir}/libXtst.so.6
+%{_libdir}/libXtst.so.6.1.0
+
+
+%files devel
+%defattr(-,root,root,-)
+%{_libdir}/libXtst.so
+%{_libdir}/pkgconfig/xtst.pc
+%{_includedir}/X11/extensions/XTest.h
+%{_includedir}/X11/extensions/record.h
+%{_mandir}/man3/*.gz
+%{_docdir}/libXtst/*.xml
+
diff --git a/specs/Makefile.am b/specs/Makefile.am
new file mode 100755 (executable)
index 0000000..fdaba22
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. 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
+doc_sources = xtestlib.xml recordlib.xml
+dist_doc_DATA = $(doc_sources)
+
+if HAVE_XMLTO
+doc_DATA = $(doc_sources:.xml=.html)
+
+if HAVE_FOP
+doc_DATA += $(doc_sources:.xml=.ps) $(doc_sources:.xml=.pdf)
+endif
+
+if HAVE_XMLTO_TEXT
+doc_DATA += $(doc_sources:.xml=.txt)
+endif
+
+if HAVE_STYLESHEETS
+XMLTO_FLAGS = -m $(XSL_STYLESHEET)
+
+doc_DATA += xorg.css
+xorg.css: $(STYLESHEET_SRCDIR)/xorg.css
+       $(AM_V_GEN)cp -pf $(STYLESHEET_SRCDIR)/xorg.css $@
+endif
+
+CLEANFILES = $(doc_DATA)
+
+SUFFIXES = .xml .ps .pdf .txt .html
+
+.xml.txt:
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) txt $<
+
+.xml.html:
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) xhtml-nochunks $<
+
+.xml.pdf:
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop pdf $<
+
+.xml.ps:
+       $(AM_V_GEN)$(XMLTO) $(XMLTO_FLAGS) --with-fop ps $<
+
+endif HAVE_XMLTO
+endif ENABLE_SPECS
diff --git a/specs/recordlib.xml b/specs/recordlib.xml
new file mode 100755 (executable)
index 0000000..903f02a
--- /dev/null
@@ -0,0 +1,1516 @@
+<?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="recordlib">
+
+<bookinfo>
+   <title>X Record Extension Library</title>
+   <subtitle>X Consortium Standard</subtitle>
+   <releaseinfo>X Version 11, Release 6.7</releaseinfo>
+   <authorgroup>
+      <author>
+         <firstname>Martha</firstname><surname>Zimet</surname>
+      </author>
+   </authorgroup>
+   <corpname>Network Computing Devices, Inc.</corpname>
+   <copyright><year>1994</year><holder>Network Computing Devices, Inc.</holder></copyright>
+   <copyright><year>1995</year><holder>X Consortium</holder></copyright>
+   <releaseinfo>Version 1.13</releaseinfo>
+   <affiliation><orgname>X Consortium</orgname></affiliation>
+   <productnumber>X Version 11, Release 6.7</productnumber>
+   <editor>
+         <firstname>Stephen</firstname><surname>Gildea</surname>
+         <affiliation><orgname>X Consortium</orgname></affiliation>
+   </editor>
+
+<legalnotice>
+
+<para>
+Permission to use, copy, modify, distribute, and sell this
+documentation for any purpose is hereby granted without fee,
+provided that the above copyright notice and this permission
+notice appear in all copies.  Network Computing Devices, Inc.
+makes no representations about the suitability for any purpose
+of the information in this document.  This documentation is
+provided "as is" without express or implied warranty.
+</para>
+
+<para>
+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:
+</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="record_extension_overview">
+<title>Record Extension Overview</title>
+<para>
+The purpose of this extension is to support the recording and reporting of
+all core X protocol and arbitrary X extension protocol. This first section
+gives an overview of the Record extension. The following sections describe
+how to use the Record extension library.
+</para>
+
+<sect1 id="synchronous_playback">
+<title>Synchronous Playback</title>
+<para>
+Environment information is generally provided to an X-based playback
+mechanism, which might use the XTest extension to synthesize input
+events. This synchronization information defines the X state prior to
+event synthesis (for example, location of the cursor, window locations
+and sizes, installed colormap, window manager running, and so on) and
+the consequences that occur after the playback mechanism synthesizes
+the event. If the user moves the mouse into the icon window and presses
+and releases a mouse button, the device events
+<function>MotionNotify</function>, <function>ButtonPress</function>,
+and <function>ButtonRelease</function> are generated by the X server.
+Because X follows an
+event-driven model, there are consequences that follow from the user
+actions, or device events, that are in the form of X protocol. As a result
+of the previous user actions, the client could generate requests such as
+<function>ImageText8</function> and <function>PolyLine</function> to the
+X server, or the X server could send non-device events such as
+<function>Expose</function> and <function>MapNotify</function> to the
+client window. Both the
+requests and non-device events that result from user actions are known
+as consequences, which can be used as a synchronization, or control point,
+during playback. That is, the playback mechanism does not generate a specific
+synthesized event until its matching synchronization condition occurs
+(for example, the window is mapped or unmapped, the cursor changes, a text
+string displays, and so on)
+</para>
+<para>
+Because it cannot be predicted what synchronization information is required
+during playback, the Record extension makes no assumptions about the intended
+use of the recorded data. Facilities exist to record any core X protocol or
+X extension protocol. Therefore, Record does not enforce a specific
+synchronization methodology.
+</para>
+</sect1>
+
+<sect1 id="design_approach">
+<title>Design Approach</title>
+<para>
+The design approach of the extension is to record core X protocol and
+arbitrary X extension protocol entirely within the X server itself. When
+the extension has been requested to record specific protocol by one or more
+recording clients, the protocol data is formatted and returned to the
+recording clients. The extension provides a mechanism for capturing all
+events, including input device events that do not go to any clients.
+</para>
+</sect1>
+
+<sect1 id="record_clients">
+<title>Record Clients</title>
+<para>
+The recommended communication model for a Record application is to open two
+connections to the server—one connection for recording control and one
+connection for reading recorded protocol data.
+</para>
+<para>
+Information about recording (for example, what clients to record, what
+protocol to record for each client, and so on) is stored in resources
+called record contexts (type <function>XRecordContext</function>). Most
+Record extension functions take a record context as an argument. Although
+in theory it is possible to share record contexts between applications,
+it is expected that applications will use their own context when performing
+recording operations.
+</para>
+<para>
+A client that wishes to record X protocol does so through the library
+functions defined in
+<link linkend="library_extension_requests">
+<xref linkend="library_extension_requests"></xref></link>
+A typical sequence of requests that a client would make is as follows:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+<function>XRecordQueryVersion</function>
+    </para>
+    <para>
+query the extension protocol version.
+    </para>
+</listitem>
+<listitem>
+    <para>
+<function>XRecordCreateContext</function>
+    </para>
+    <para>
+request that the server create a record context for access by this client,
+and express interest in clients and protocol to be recorded. This request
+returns an <function>XRecord-Context</function>, which is an XID that is
+used by most other extension requests to identify the specified context.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+<function>XRecordEnableContext</function>
+    </para>
+    <para>
+begin the recording and reporting of protocol data.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+<function>XRecordDisableContext</function>
+    </para>
+    <para>
+end the recording and reporting of protocol data.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+<function>XRecordFreeContext</function>
+    </para>
+    <para>
+free the record context.
+    </para>
+  </listitem>
+</itemizedlist>
+
+<para>
+The header for this library is
+&lt;<function>X11/extensions/record.h</function>&gt;. All identifiers defined
+in the interface are supplied by this header and are prefixed with "XRecord".
+The <function>Xtst</function> library contains the
+<function>XRecord</function> functions.
+</para>
+
+</sect1>
+</chapter>
+
+<chapter id="common_arguments">
+<title>Common Arguments</title>
+<para>
+The Record extension functions <function>XRecordCreateContext</function>
+ and <function>XRecordRegisterClients</function> allow applications to
+specify the following:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+Individual clients or sets of clients to record
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Ranges of core X protocol and X extension protocol to record for each client
+    </para>
+  </listitem>
+</itemizedlist>
+<para>
+Protocol in the ranges specified by the recording client will be recorded
+by the server. The device_events protocol type can be specified by a
+recording client although it may not be sent to a recorded client. The
+device_events type differs from delivered_events, which also can be
+specified by a recording client; delivered_events are actually delivered to
+one or more clients. These event types are discussed in
+<link linkend="protocol_ranges">
+<xref linkend="protocol_ranges"></xref></link>
+</para>
+
+
+<para>
+The Record extension functions <function>XRecordCreateContext</function>
+ and <function>XRecordRegisterClients</function> have the common arguments
+datum_flags, clients, and ranges, which specify whether server time
+and/or client sequence number should precede protocol elements, the
+clients or client set to record, and the protocol ranges to record,
+respectively. These are discussed in the following sections.
+</para>
+
+<sect1 id="datum_flags">
+<title>Datum Flags</title>
+<para>
+The datum_flags argument is a set of ï¬‚ags OR’ed together to specify options
+for the record context.  Specify zero to disable all the options.
+</para>
+
+<para>
+The <function>XRecordFromServerTime</function> ï¬‚ag specifies that
+<function>XRecordInterceptData</function> structures with a category of
+<function>XRecordFromServer</function> will have a server_time field specific to each
+protocol element.
+</para>
+
+<para>
+The <function>XRecordFromClientTime</function> ï¬‚ag specifies that
+<function>XRecordInterceptData</function> structures with a category of
+<function>XRecordFromClient</function> will have a server_time field specific
+to each protocol element.
+</para>
+
+<para>
+The <function>XRecordFromClientSequence</function> ï¬‚ag specifies that
+<function>XRecordInterceptData</function> structures with a category of
+<function>XRecordFromClient</function> or
+<function>XRecordClientDied</function> will have a valid client_seq field.
+</para>
+</sect1>
+
+<sect1 id="selecting_clients">
+<title>Selecting Clients</title>
+
+<para>
+The clients argument is a pointer to an array of
+<function>XRecordClientSpec</function>.
+<function>XRecordClientSpec</function> is an integral type that holds a
+resource ID, a client resource ID base, or one of the client set constants
+defined below.
+</para>
+<para>
+Duplicate elements in the array are ignored by the functions, and if any
+element in the array is not valid, a
+<function>BadMatch</function>
+error results. A resource ID references the client that created that
+resource. The client set may be one of the following constants:
+<function>XRecordCurrentClients</function>,
+<function>XRecordFutureClients</function>, or
+<function>XRecordAllClients</function>.
+</para>
+<para>
+If the element in the array identifies a particular client, protocol
+specified by the ranges argument will be recorded by the server. The
+recorded protocol data will not be returned to the recording client until
+the record context has been enabled. This is described in
+<link linkend="data_transfer">
+<xref linkend="data_transfer"></xref></link>
+</para>
+<para>
+If the element is <function>XRecordCurrentClients</function>, the protocol
+ranges specified by the ranges argument, except for device_events, are
+associated with each current client connection. If the element is
+<function>XRecordFutureClients</function>, the
+protocol ranges specified by the ranges argument are associated with each new
+client connection. If the element is
+<function>XRecordAllClients</function>,
+the protocol ranges specified by the ranges argument are associated with
+each current client connection and with each new client connection.
+When the context is enabled, the data connection is unregistered if it
+was registered. If the context is enabled,
+<function>XRecordCurrentClients</function> and
+<function>XRecordAllClients</function>
+silently exclude the recording data connection. It is an error to explicitly
+register the data connection.
+</para>
+</sect1>
+<sect1 id="protocol_ranges">
+<title>Protocol Ranges</title>
+
+<para>
+The functions <function>XRecordCreateContext</function> and
+<function>XRecordRegisterClients</function> have another common argument,
+ranges, which is an array of pointers to <function>XRecordRange</function>
+structures. Each structure contains ranges of numeric values for each of
+the protocol types that can be specified and recorded individually by the
+Record extension. An <function>XRecordRange</function> structure must be
+allocated by the Record library using the
+<function>XRecordAllocRange</function> function.
+</para>
+<para>
+The <function>XRecordRange</function> typedef is a structure with the
+following members:
+</para>
+
+<literallayout remap='Ds'>
+XRecordRange:
+     XRecordRange8 core_requests     /* core X requests */
+     XRecordRange8 core_replies      /* core X replies */
+     XRecordExtRange ext_requests    /* extension requests */
+     XRecordExtRange ext_replies     /* extension replies */
+     XRecordRange8 delivered_events  /* delivered core and ext events */
+     XRecordRange8 device_events     /* all core and ext device events */
+     XRecordRange8 errors            /* core X and X ext errors */
+     Bool client_started             /* connection setup reply from server */
+     Bool client_died                /* notification of client disconnect */
+</literallayout>
+
+<para>
+The types used in
+<function>XRecordRange</function>
+members are defined as follows.  The
+<function>XRecordRange8</function>
+typedef is a structure with the following members:
+</para>
+
+<literallayout remap='Ds'>
+XRecordRange8:
+     unsigned char first
+     unsigned char last
+</literallayout>
+
+<para>
+The
+<function>XRecordRange16</function>
+typedef is a structure with the following members:
+</para>
+
+<literallayout remap='Ds'>
+XRecordRange16:
+     unsigned short first
+     unsigned short last
+</literallayout>
+
+<para>
+The
+<function>XRecordExtRange</function>
+typedef is a structure with the following members:
+</para>
+
+<literallayout remap='Ds'>
+XRecordExtRange:
+     XRecordRange8  ext_major
+     XRecordRange16 ext_minor
+</literallayout>
+
+<para>
+If any of the values specified in
+<function>XRecordRange</function>
+is invalid, a
+<function>BadValue</function>
+error results.
+</para>
+
+<para>
+The core_requests member specifies the range of core X protocol
+requests to record.  Core X protocol requests with a major opcode
+that is between first and last, inclusive, will be
+recorded.  A
+<function>BadValue</function>
+error results if the value of first is greater than the value of last.
+If the values of both first and last are zero, no core
+X protocol requests will be recorded.
+</para>
+
+<para>
+The core_replies member specifies the range of replies resulting
+from core X protocol requests to record.  Replies that result from
+core X protocol requests with a major opcode between first
+and last, inclusive, will be recorded.  A
+<function>BadValue</function>
+error results if the value of first is greater than the value of last.
+If the values of both first and last are zero, no core X protocol
+replies will be recorded.
+</para>
+
+<para>
+The ext_requests member specifies the range of X extension
+requests to record.  X extension requests with a major opcode
+between ext_major.first and ext_major.last, and with a
+minor opcode
+between ext_minor.first and ext_minor.last, inclusive, will be
+recorded.  A
+<function>BadValue</function>
+error results
+if the value of ext_major.first is greater than the value of
+ext_major.last or if the value of ext_minor.first is
+greater than the value of ext_minor.last.  If the values of both
+ext_major.first
+and ext_major.last are zero,
+no X extension requests will be recorded.
+</para>
+
+<para>
+The ext_replies member specifies the range of replies resulting
+from X extension requests to record.  Replies that result from an X
+extension request with a major opcode between
+ext_major.first and
+ext_major.last, and a minor opcode that is between
+ext_minor.first and ext_minor.last will be recorded.  A
+<function>BadValue</function>
+error results
+if the value of ext_major.first is greater than the value of
+ext_major.last or if the value of ext_minor.first is greater than
+the value of ext_minor.last.  If the values of both
+ext_major.first and ext_major.last are zero, no X extension
+replies will be recorded.
+</para>
+
+<para>
+The delivered_events member specifies the range of both core
+X events and X extension events to record.  These events are
+delivered to at least one client.  Core X events and X extension events
+with a code value between first and last inclusive will be recorded.  A
+<function>BadValue</function>
+error results if the value of first is greater than the value of last.
+If the values of first and last are zero, no events will be recorded.
+</para>
+
+<para>
+The device_events member specifies the range of both core X device
+events and X extension device events to record.  These events may or
+may not be delivered to a client.  Core X device events and X extension
+device events with a code value between first and last inclusive that
+are not delivered to any clients will be recorded.  A
+<function>BadValue</function>
+error results if the value of first is greater than the value of last.  A
+<function>BadValue</function>
+error results if first is less than two or last is less than two, except
+that if first and last are zero, no events will be recorded.
+</para>
+
+<para>
+The errors member specifies the range of both core X errors and X
+extension errors to record.  Core X errors and X extension errors with
+a code value between first and last inclusive will be
+recorded.  A
+<function>BadValue</function>
+error results if the value of first is greater than the value of last.
+If the values of first and last are zero, no errors will be recorded.
+</para>
+
+<para>
+A value of
+<function>True</function>
+for the client_started member specifies the
+connection setup reply from the server to new clients.  If
+<function>False</function>
+the connection setup reply is not specified by this
+<function>XRecordRange</function>
+</para>
+
+<para>
+A value of
+<function>True</function>
+for the client_died member specifies
+notification when a client disconnects.  If
+<function>False</function>
+notification when a client disconnects is not specified by this
+<function>XRecordRange</function>
+</para>
+</sect1>
+</chapter>
+
+<chapter id='library_extension_requests'>
+<title>Library Extension Requests</title>
+
+<para>
+Recording operations are accessed by programs through the use of
+new protocol requests.  The following functions are provided as extensions
+to Xlib.  An Xlib error results if
+an extension request is made to an X server that does not support the
+Record extension.  Note that any of the extension protocol requests may generate
+<function>BadAlloc</function>
+or
+<function>BadLength</function>
+errors.
+</para>
+
+<sect1 id='query_extension_version'>
+<title>Query Extension Version</title>
+
+<para>
+An application uses the
+<function>XRecordQueryVersion</function>
+function to determine
+the version of the Record extension protocol supported by an X server.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XRecordQueryVersion</function></funcdef>
+    <paramdef>Display <parameter> *display</parameter></paramdef>
+    <paramdef>int <parameter> cmajor_return</parameter></paramdef>
+    <paramdef>int <parameter> cminor_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist remap='IP'>
+  <varlistentry>
+    <term><emphasis remap='I'>display</emphasis></term>
+    <listitem><para>Returns the connection to the X server.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>cmajor_return</emphasis></term>
+    <listitem><para>Returns the extension protocol major version in use.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>cminor_return</emphasis></term>
+    <listitem><para>Returns the extension protocol minor version in use.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+The
+<function>XRecordQueryVersion</function>
+function returns the major and minor protocol version numbers supported by
+the server.
+<function>XRecordQueryVersion</function>
+returns nonzero (success) only if the returned version numbers are
+common to both the library and the server; otherwise, it returns zero.
+</para>
+</sect1>
+
+<sect1 id='create_and_modify_context'>
+<title>Create and Modify Context</title>
+
+<para>
+An application uses the
+<function>XRecordCreateContext</function>
+function to create a record context.  At the time the record context is
+created by the recording client, the clients to be recorded and the
+protocol to record for each client may be specified.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XRecordContext <function>XRecordCreateContext</function></funcdef>
+    <paramdef>Display <parameter> *display</parameter></paramdef>
+    <paramdef>int <parameter> datum_flags</parameter></paramdef>
+    <paramdef>XRecordClientSpec <parameter> *clients</parameter></paramdef>
+    <paramdef>int <parameter> nclients</parameter></paramdef>
+    <paramdef>XRecordRange <parameter> *ranges</parameter></paramdef>
+    <paramdef>int <parameter> nranges</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist remap='IP'>
+  <varlistentry>
+    <term><emphasis remap='I'>display</emphasis></term>
+    <listitem><para>Returns the connection to the X server.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>datum_flags</emphasis></term>
+    <listitem><para>Specifies whether detailed time or sequence info should be sent.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>clients</emphasis></term>
+    <listitem><para>Specifies the clients to record.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>nclients</emphasis></term>
+    <listitem><para>Specifies the number of clients.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>ranges</emphasis></term>
+    <listitem><para>Specifies the protocol ranges to record.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>nranges</emphasis></term>
+    <listitem><para>Specifies the number of protocol ranges.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+The
+<function>XRecordCreateContext</function>
+function creates a record context and returns an
+<function>XRecordContext</function>
+which is then used in the other Record library calls.  This request is
+typically executed by the recording client over its control connection to
+the X server.  The datum_flags specifies whether server time and/or client
+sequence number should precede protocol elements recorded by context (
+<link linkend="datum_flags">
+<xref linkend="datum_flags"></xref></link>
+).  When a clients element identifies a particular client, the client is added
+to the context and the protocol to record for that client is set to the
+union of all ranges.  When a clients element is
+<function>XRecordCurrentClients</function>
+<function>XRecordFutureClients</function>
+or
+<function>XRecordAllClients</function>
+the actions described in
+<link linkend="selecting_clients">
+<xref linkend="selecting_clients"></xref></link>
+are performed.
+</para>
+
+<para>
+<function>XRecordCreateContext</function>
+returns zero if the request failed.
+<function>XRecordCreateContext</function>
+can generate
+<function>BadIDChoice</function>
+<function>BadMatch</function>
+and
+<function>BadValue</function>
+errors.
+</para>
+
+<para>The ranges argument is an
+<function>XRecordRange</function>
+array, that is, an array
+of pointers.  The structures the elements point to shall be allocated
+by calling
+<function>XRecordAllocRange</function></para>
+
+<literallayout remap='FD'>
+XRecordRange *
+XRecordAllocRange(void)
+</literallayout> <!-- remap='FN' -->
+
+<para>
+The
+<function>XRecordAllocRange</function>
+function
+allocates and returns an
+<function>XRecordRange</function>
+structure.
+The structure is initialized to specify no protocol.
+The function returns NULL if the structure allocation fails.
+The application can free the structure by calling
+<function>XFree</function>
+</para>
+
+<sect2 id='additions'>
+<title>Additions</title>
+
+<para>
+An application uses the
+<function>XRecordRegisterClients</function>
+function to modify a previously created
+record context, by adding clients or modifying the recorded protocol,
+typically over its control connection to the X server.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XRecordRegisterClients</function></funcdef>
+    <paramdef>Display <parameter> *display</parameter></paramdef>
+    <paramdef>XRecordContext <parameter> context</parameter></paramdef>
+    <paramdef>int <parameter> datum_flags</parameter></paramdef>
+    <paramdef>XRecordClientSpec <parameter> *clients</parameter></paramdef>
+    <paramdef>int <parameter> nclients</parameter></paramdef>
+    <paramdef>XRecordRange <parameter> *ranges</parameter></paramdef>
+    <paramdef>int <parameter> nranges</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist remap='IP'>
+  <varlistentry>
+    <term><emphasis remap='I'>display</emphasis></term>
+    <listitem><para>Returns the connection to the X server.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>context</emphasis></term>
+    <listitem><para>Specifies the record context to modify.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>datum_flags</emphasis></term>
+    <listitem><para>Specifies whether detailed time or sequence info should be sent.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>clients</emphasis></term>
+    <listitem><para>Specifies the clients to record.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>nclients</emphasis></term>
+    <listitem><para>Specifies the number of clients.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>ranges</emphasis></term>
+    <listitem><para>Specifies the protocol ranges to record.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>nranges</emphasis></term>
+    <listitem><para>Specifies the number of protocol ranges.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+The datum_flags specifies whether server time and/or client sequence number
+should precede protocol elements for all clients recorded by context (See
+<link linkend="datum_flags">
+<xref linkend="datum_flags"></xref></link>
+).  When a clients element identifies a particular client and the client is
+not yet targeted for recording in the given context, the client is added
+to the set of clients to record, and the protocol to record for that client
+is set to the union of all ranges.  When the client is
+already targeted for recording, the protocol to record for that client
+is set to the union of all ranges.  When the element is
+<function>XRecordCurrentClients</function>
+<function>XRecordFutureClients</function>
+or
+<function>XRecordAllClients</function>
+the actions described in
+<link linkend="selecting_clients">
+<xref linkend="selecting_clients"></xref></link>
+are performed.
+</para>
+
+<para>
+<function>XRecordRegisterClients</function>
+returns zero if the request failed; otherwise, it
+returns nonzero.
+</para>
+
+<para>
+<function>XRecordRegisterClients</function>
+can generate
+<function>XRecordBadContext</function>
+<function>BadMatch</function>
+and
+<function>BadValue</function>
+errors.
+</para>
+</sect2>
+
+<sect2 id='deletions'>
+<title>Deletions</title>
+
+<para>
+An application uses the
+<function>XRecordUnregisterClients</function>
+function to delete clients from a previously created
+record context, typically over its control connection to the X server.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XRecordUnRegisterClients</function></funcdef>
+    <paramdef>Display <parameter> *display</parameter></paramdef>
+    <paramdef>XRecordContext <parameter> context</parameter></paramdef>
+    <paramdef>XRecordClientSpec <parameter> *clients</parameter></paramdef>
+    <paramdef>int <parameter> nclients</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist remap='IP'>
+  <varlistentry>
+    <term><emphasis remap='I'>display</emphasis></term>
+    <listitem><para>Returns the connection to the X server.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>context</emphasis></term>
+    <listitem><para>Specifies the record context to modify.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>clients</emphasis></term>
+    <listitem><para>Specifies the clients to stop recording.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>nclients</emphasis></term>
+    <listitem><para>Specifies the number of clients.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+When an element in clients identifies a particular client, and the
+specified client is already targeted for recording in the given
+context, the client and the set of protocol to record for that
+client are deleted from the context.  If the specified client is not
+targeted for recording, then no action is performed.
+</para>
+
+<para>
+When the element is
+<function>XRecordCurrentClients</function>
+all clients currently targeted for recording in context and their
+corresponding sets of protocol to record are deleted from context.
+</para>
+
+<para>
+When the item is
+<function>XRecordFutureClients</function>
+any future client connections will not automatically be targeted for
+recording in context.
+</para>
+
+<para>
+When the element is
+<function>XRecordAllClients</function>
+all clients currently targeted for recording in context and their
+corresponding sets of protocol to record are deleted from context.
+Any future client connections will not automatically be targeted
+for recording in context.
+</para>
+
+<para>
+<function>XRecordUnregisterClients</function>
+returns zero if the request failed; otherwise, it returns nonzero.
+</para>
+
+<para>
+<function>XRecordUnregisterClients</function>
+can generate
+<function>XRecordBadContext</function>
+<function>BadMatch</function>
+and
+<function>BadValue</function>
+errors.</para>
+</sect2>
+</sect1>
+
+<sect1 id='query_context_state'>
+<title>Query Context State</title>
+
+<para>
+An application uses the
+<function>XRecordGetContext</function>
+function to query the current state of a record context, typically over
+its control connection to the X server.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XRecordGetContext</function></funcdef>
+    <paramdef>Display <parameter> *display</parameter></paramdef>
+    <paramdef>XRecordContext <parameter> context</parameter></paramdef>
+    <paramdef>XRecordState <parameter> **state_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist remap='IP'>
+  <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'>context</emphasis></term>
+    <listitem><para>Specifies the record context to query.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>state_return</emphasis></term>
+    <listitem><para>Specifies the address of a variable into which
+the function stores a pointer to the current state of the record context.
+    </para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+The
+<function>XRecordState</function>
+typedef returned by
+<function>XRecordGetContext</function>
+is a structure with the following members:
+</para>
+
+<literallayout remap='Ds'>
+XRecordState:
+     Bool              enabled
+     int               datum_flags
+     unsigned long     nclients
+     XRecordClientInfo **client_info
+</literallayout>
+
+<para>
+The enabled member is set to the state of data transfer and is
+<function>True</function>
+when the recording client has asked that recorded data be sent;
+otherwise it is
+<function>False</function>
+The datum_flags member is set to the value of these flags for this context.
+The nclients member is set to the number of
+<function>XRecordClientInfo</function>
+structures returned.  The client_info member is an array of pointers to
+<function>XRecordClientInfo</function>
+structures that contain the protocol to record for each targeted client.  The
+<function>XRecordClientInfo</function>
+typedef is a structure with the following members:
+</para>
+
+<literallayout remap='Ds'>
+XRecordClientInfo:
+     XRecordClientSpec client
+     unsigned long nranges
+     XRecordRange **ranges
+</literallayout>
+
+<para>
+The client member either identifies a client targeted for recording
+or is set to
+<function>XRecordFutureClients</function>
+to describe how future clients will be automatically targeted for recording.
+The nranges member is set to the number of protocol
+ranges to be recorded for the specified client.  The ranges member
+is an array of pointers to
+<function>XRecordRange</function>
+structures, which specify the protocol ranges to record.
+</para>
+
+<para>
+<function>XRecordGetContext</function>
+returns zero if the request failed; otherwise, it returns nonzero.
+The context argument must specify a valid
+<function>XRecordContext</function>
+or a
+<function>XRecordBadContext</function>
+error results.
+</para>
+
+<para>
+Recording clients should use the
+<function>XRecordFreeState</function>
+function to free the state data returned by
+<function>XRecordGetContext</function>
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function>XRecordFreeState</function></funcdef>
+    <paramdef>XRecordState <parameter> *state</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist remap='IP'>
+  <varlistentry>
+    <term><emphasis remap='I'>state</emphasis></term>
+    <listitem><para>Specifies the structure that is to be freed.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+<function>XRecordFreeState</function>
+frees the data pointed to by state.  If the argument does not match an
+<function>XRecordState</function>
+pointer returned from a successful call to
+<function>XRecordGetContext</function>
+or if
+<function>XRecordFreeState</function>
+has already been called with it, the behavior is undefined.
+</para>
+</sect1>
+
+<sect1 id='data_transfer'>
+<title>Data Transfer</title>
+
+<para>
+An application uses the
+<function>XRecordEnableContext</function>
+and
+<function>XRecordDisableContext</function>
+functions to change the state of data transfer
+between the X server and the recording client.  These functions allow
+the application to start recording and reporting of protocol data
+and to stop recording and reporting of protocol data, respectively.
+</para>
+
+<sect2 id='enable_context'>
+<title>Enable Context</title>
+
+<para>
+To direct the X server to record and report protocol, a program uses
+<function>XRecordEnableContext</function>
+typically over its data connection to the X
+server.  The reporting of recorded protocol back to the recording client
+is handled by the following data structures and procedure definitions.
+Each recorded protocol element is reported to the recording client through an
+<function>XRecordInterceptData</function>
+typedef, a structure with the following members:
+</para>
+
+<literallayout remap='Ds'>
+XRecordInterceptData:
+     XID              id_base
+     Time             server_time
+     unsigned long    client_seq
+     int              category
+     Bool             client_swapped
+     unsigned char    *data
+     unsigned long    data_len
+</literallayout>
+
+<para>
+The id_base member is set to the resource identifier base sent to the
+client in the connection setup reply and therefore identifies the client
+being recorded, except when the recorded protocol data is a device
+event that may have not been delivered to a client.  In this case,
+id_base is set to zero.  The server_time member
+is set to the time of the server when the protocol was recorded.
+It is the time that was attached to this protocol element in the reply,
+if so specified by datum_flags,
+or else the time from the header of the reply that contained
+this protocol element.
+The client_seq member is the sequence number of the recorded
+client's most recent request processed by the server at the time this
+protocol element was recorded, if this information were included in the
+recorded data; otherwise client_seq is 0.
+The category member is set to one of the following values:
+<function>XRecordStartOfData</function>
+<function>XRecordFromServer</function>
+<function>XRecordFromClient</function>
+<function>XRecordClientStarted</function>
+<function>XRecordClientDied</function>
+or
+<function>XRecordEndOfData</function>
+<function>XRecordStartOfData</function>
+is immediately sent as the first reply to confirm that the context is enabled.
+<function>XRecordFromClient</function>
+indicates the protocol
+data is from the recorded client to the server (requests).
+<function>XRecordFromServer</function>
+indicates the protocol data is from the server to the recorded client
+(replies, errors, events, or device events).
+<function>XRecordClientStarted</function>
+indicates that the protocol data is the connection setup reply from the server.
+<function>XRecordClientDied</function>
+indicates that the recorded client has closed its connection
+to the X server; there is no protocol data.
+<function>XRecordEndOfData</function>
+indicates that the context has been disabled and that
+this is the last datum.  It does not correspond to any protocol or
+state change in a recorded client.  There is no protocol data.
+</para>
+
+<para>
+The client_swapped member is set to
+<function>True</function>
+if the byte order of the client being recorded is swapped relative to
+the recording client; otherwise, it is set to
+<function>False</function>
+All recorded protocol data is returned in the byte order of the recorded
+client.  Therefore, recording clients are responsible for all byte swapping,
+if required.  Device events are in the byte order of the recording client.
+For replies of category
+<function>XRecordStartOfData</function>
+and
+<function>XRecordEndOfData</function>
+client_swapped is set according
+to the byte order of the server relative to the recording client.
+</para>
+
+<para>
+The data member contains the actual recorded protocol data.
+When category is set to
+<function>XRecordStartOfData</function>
+<function>XRecordClientDied</function>
+or
+<function>XRecordEndOfData</function>
+no protocol data are contained in data.
+</para>
+
+
+<!--  copied exactly from the protocol document -->
+<para>
+For the core X events
+<function>KeyPress</function>
+<function>KeyRelease</function>
+<function>ButtonPress</function>
+and
+<function>ButtonRelease</function>,
+the fields of a device event that contain
+valid information are time and detail.  For the core X event
+<function>MotionNotify</function>
+the fields of a device event that contain valid information are time, root,
+root-x and root-y.
+The time field refers to the time the event was generated by the device.
+</para>
+
+<para>For the extension input device events
+<function>DeviceKeyPress</function>
+<function>DeviceKeyRelease</function>
+<function>DeviceButtonPress</function>
+and
+<function>DeviceButtonRelease</function>
+the fields of a device event that contain valid information are
+device, time, and detail.  For
+<function>DeviceMotionNotify</function>
+the valid device event fields are device and time.
+For the extension input device events
+<function>ProximityIn</function>
+and
+<function>ProximityOut</function>
+the fields of a device event that contain valid
+information are device and time.  For the extension input device event
+<function>DeviceValuator</function>
+the fields of a device event that contain valid information are
+device, num_valuators, first_valuator, and valuators.
+The time field refers to the time the event was generated by the device.
+</para>
+
+
+<para>
+The data_len member is set to the length of the actual recorded protocol
+data in 4-byte units.
+</para>
+
+<para>
+When the context has been enabled, protocol data the recording client has
+previously expressed interest in is recorded and returned to the
+recording client via multiple replies.  Because the X server batches
+the recorded data, more than one protocol element may be contained
+in the same reply packet.  When a reply is received, a procedure of type
+<function>XRecordInterceptProc</function>
+is called for each protocol element in the reply.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>typedef void <function>(*XRecordInterceptProc)</function></funcdef>
+    <paramdef>XPointer<parameter> closure</parameter></paramdef>
+    <paramdef>XRecordInterceptData<parameter> *recorded_data</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist remap='IP'>
+  <varlistentry>
+    <term><emphasis remap='I'>closure</emphasis></term>
+    <listitem><para>Pointer that was passed in when the context was enabled.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>recorded_data</emphasis></term>
+    <listitem><para>A protocol element recorded by the server extension.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+This callback may use the control display connection (or any display
+connection other than the data connection).
+</para>
+
+<para>
+Recording clients should use the
+<function>XRecordFreeData</function>
+function to free the
+<function>XRecordInterceptData</function>
+structure.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XRecordEnableContext</function></funcdef>
+    <paramdef>Display<parameter> *display</parameter></paramdef>
+    <paramdef>XRecordContext<parameter> context</parameter></paramdef>
+    <paramdef>XRecordInterceptProc<parameter> callback</parameter></paramdef>
+    <paramdef>XPointer<parameter> closure</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist remap='IP'>
+  <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'>context</emphasis></term>
+    <listitem><para>Specifies the record context to enable.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>callback</emphasis></term>
+    <listitem><para>Specifies the function to be called for each protocol element received.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>closure</emphasis></term>
+    <listitem><para>Specifies data passed to callback.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+
+<para>
+<function>XRecordEnableContext</function>
+enables data transfer between the recording client and
+the X server.  All core and extension protocol received from or sent to
+targeted clients that the recording client has expressed
+interest in will be recorded and reported to the recording client.
+</para>
+
+<para>
+<function>XRecordEnableContext</function>
+returns zero if the request failed; otherwise, it
+returns nonzero.  The context argument must specify a valid
+<function>XRecordContext</function>
+or a
+<function>XRecordBadContext</function>
+error results.  The error
+<function>BadMatch</function>
+results when data transfer is already enabled on the given context.
+</para>
+</sect2>
+
+<sect2 id='enable_context_asynchronously'>
+<title>Enable Context Asynchronously</title>
+
+<para>Because
+<function>XRecordEnableContext</function>
+does not return until
+<function>XRecordDisableContext</function>
+is executed on the control connection, a nonblocking interface in
+addition to
+<function>XRecordEnableContext</function>
+is provided.  This interface also
+enables data transfer; however, it does not block.
+</para>
+
+<para>
+This interface is defined as follows:
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XRecordEnableContextAsync</function></funcdef>
+    <paramdef>Display<parameter> *display</parameter></paramdef>
+    <paramdef>XRecordContext<parameter> context</parameter></paramdef>
+    <paramdef>XRecordInterceptProc<parameter> callback</parameter></paramdef>
+    <paramdef>XPointer<parameter> closure</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist remap='IP'>
+  <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'>context</emphasis></term>
+    <listitem><para>Specifies the record context to enable.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>callback</emphasis></term>
+    <listitem><para>Specifies the function to be called for each protocol element received.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>closure</emphasis></term>
+    <listitem><para>Specifies data passed to callback.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+<function>XRecordEnableContextAsync</function>
+enables data transfer between the recording
+client and the X server just as
+<function>XRecordEnableContext</function>
+does.  Unlike
+<function>XRecordEnableContext</function>
+it does not wait for the context to be disabled
+before returning;
+<function>XRecordEnableContextAsync</function>
+returns as soon as the
+<function>XRecordStartOfData</function>
+reply has been received and processed.
+</para>
+
+<para>
+<function>XRecordEnableContextAsync</function>
+returns zero if it could not allocate the
+necessary memory and nonzero if it sent the request successfully to
+the server.  The context argument must specify a valid
+<function>XRecordContext</function>
+or a
+<function>XRecordBadContext</function>
+error results.  The error
+<function>BadMatch</function>
+results when data transfer is already enabled.
+</para>
+
+<para>
+Each time it reads data from the server connection, Xlib will check
+for incoming replies and call <emphasis remap='I'>callback</emphasis>
+as necessary.  The application may direct Xlib explicitly to check
+for Record data with the
+<function>XRecordProcessReplies</function>
+function.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function>XRecordProcessReplies</function></funcdef>
+    <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist remap='IP'>
+  <varlistentry>
+    <term><emphasis remap='I'>display</emphasis></term>
+    <listitem><para>Specifies the connection to the X server.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+<function>XRecordProcessReplies</function>
+will check for any replies that have not yet
+been processed by the application.  The asynchronous callback will be called
+as appropriate.
+<function>XRecordProcessReplies</function>
+returns when all immediately
+available replies have been processed.  It does not block.
+</para>
+
+<para>To free the data passed to the
+<function>XRecordInterceptProc</function>
+callback, use
+<function>XRecordFreeData</function></para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function>XRecordFreeData</function></funcdef>
+    <paramdef>XRecordInterceptData<parameter> *data</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist remap='IP'>
+  <varlistentry>
+    <term><emphasis remap='I'>data</emphasis></term>
+    <listitem><para>Specifies the structure that is to be freed.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+
+<para>
+<function>XRecordFreeData</function>
+frees the data pointed to by data.  If the argument does not match an
+<function>XRecordInterceptData</function>
+pointer earlier passed to an
+<function>XRecordInterceptProc</function>
+callback or if
+<function>XRecordFreeData</function>
+has already been called with it, the behavior is undefined.
+</para>
+</sect2>
+
+<sect2 id='disable_context'>
+<title>Disable Context</title>
+
+<para>
+To direct the X server to halt the reporting of recorded protocol, the
+program executes
+<function>XRecordDisableContext</function>
+typically over its control connection to the X server.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XRecordDisableContext</function></funcdef>
+    <paramdef>Display<parameter> *display</parameter></paramdef>
+    <paramdef>XRecordContext<parameter> context</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist remap='IP'>
+  <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'>context</emphasis></term>
+    <listitem><para>Specifies the record context to disable.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+
+<para>
+The
+<function>XRecordDisableContext</function>
+function disables context, stopping all recording over its data connection.
+Any complete protocol elements for context that were buffered in the
+server will be sent to the recording client rather than being discarded.
+If a program attempts to disable an
+<function>XRecordContext</function>
+that has not been enabled, no action will take place.
+</para>
+
+<para>
+<function>XRecordDisableContext</function>
+returns zero if the request failed; otherwise, it
+returns nonzero.  The context argument must specify a valid
+<function>XRecordContext</function>
+or an
+<function>XRecordBadContext</function>
+error results.
+</para>
+</sect2>
+</sect1>
+
+<sect1 id='id_base_mask'><title>ID Base Mask</title>
+
+<para>
+To determine the mask the server uses for the client ID base, use
+<function>XRecordIdBaseMask</function></para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XID <function>XRecordIdBaseMask</function></funcdef>
+    <paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist remap='IP'>
+  <varlistentry>
+    <term><emphasis remap='I'>display</emphasis></term>
+    <listitem><para>Specifies the connection to the X server.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+The
+<function>XRecordIdBaseMask</function>
+function returns the resource ID mask passed to the client by the
+server at connection setup.
+</para>
+
+</sect1>
+
+<sect1 id='free_context'>
+<title>Free Context</title>
+
+<para>
+Before terminating, the program should request that the server
+free the record context.  This is done with the
+<function>XRecordFreeContext</function>
+function, typically over the record client's control connection
+to the X server.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XRecordFreeContext</function></funcdef>
+    <paramdef>Display<parameter> *display</parameter></paramdef>
+    <paramdef>XRecordContext<parameter> context</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist remap='IP'>
+  <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'>context</emphasis></term>
+    <listitem><para>Specifies the record context to free.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+The
+<function>XRecordFreeContext</function>
+function frees the given context for the
+requesting client.  Freeing a record context releases the clients
+targeted for recording and their respective protocol ranges to
+record.  If protocol data is being reported to the recording client,
+generally over the data connection to the X server, the reporting
+ceases as if
+<function>XRecordDisableContext</function>
+had been called on the given context.  When a program terminates
+without freeing its record context, the X server will automatically
+free that context on behalf of the client.
+</para>
+
+<para>
+<function>XRecordFreeContext</function>
+returns zero if the request failed; otherwise,it
+returns nonzero.  The context argument must specify a valid
+<function>XRecordContext</function>
+or a
+<function>XRecordBadContext</function>
+error results.
+</para>
+
+</sect1>
+</chapter>
+</book>
diff --git a/specs/xtestlib.xml b/specs/xtestlib.xml
new file mode 100755 (executable)
index 0000000..e177345
--- /dev/null
@@ -0,0 +1,467 @@
+<?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="xtestlib">
+
+<bookinfo>
+   <title>XTEST Extension Library</title>
+   <subtitle>X Consortium Standard</subtitle>
+   <releaseinfo>X Version 11, Release 6.4</releaseinfo>
+   <authorgroup>
+      <author>
+         <firstname>Kieron</firstname><surname>Drake</surname>
+      </author>
+   </authorgroup>
+   <corpname>UniSoft Ltd.</corpname>
+   <copyright><year>1992</year><holder>UniSoft Group Ltd.</holder></copyright>
+   <copyright><year>1992</year><holder>X Consortium</holder></copyright>
+   <copyright><year>1994</year><holder>X Consortium</holder></copyright>
+   <releaseinfo>Version 2.2</releaseinfo>
+   <affiliation><orgname>X Consortium</orgname></affiliation>
+   <productnumber>X Version 11, Release 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.  UniSoft
+makes no representations about the suitability for any purpose of the
+information in this document.  This documentation is provided
+&ldquo;as is&rdquo; without express or implied warranty.
+</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 &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 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>
+
+<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>
+</legalnotice>
+</bookinfo>
+
+<chapter id='overview'>
+<title>Overview</title>
+
+<para>
+This extension is a minimal set of client and server extensions
+required to completely test the X11 server with no user intervention.
+</para>
+
+<para>
+This extension is not intended to support general journaling and
+playback of user actions.  This is a difficult area [XTrap, 89] as it attempts
+to synchronize synthetic user interactions with their effects; it is at the
+higher level of dialogue recording/playback rather than at the strictly lexical
+level.  We are interested only in the latter, simpler, case.  A more detailed
+discussion and justification of the extension functionality is given in
+[Drake, 91].
+</para>
+
+<para>
+We are aiming only to provide a minimum set of facilities that
+solve immediate testing and validation problems.  The testing extension
+itself needs testing, where possible, and so should be as simple as possible.
+</para>
+
+<para>We have also tried to:</para>
+<itemizedlist mark='bullet'>
+  <listitem>
+    <para>
+Confine the extension to an appropriate high level
+within the server to minimize portability problems.  In practice this
+means that the extension should be at the DIX level or use the
+DIX/DDX interface, or both.  This has effects, in particular, on the
+level at which "input synthesis" can occur.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Minimize the changes required in the rest of the server.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Minimize performance penalties on normal server operation.
+    </para>
+  </listitem>
+</itemizedlist>
+</chapter>
+
+<chapter id='description'>
+<title>Description</title>
+
+<para>The functions provided by this extension fall into two groups:</para>
+
+<itemizedlist>
+    <listitem>
+      <para>Client Operations</para>
+      <para>
+These routines manipulate otherwise hidden client-side behavior.
+The actual implementation will depend on the details of the actual language
+binding and what degree of request buffering, GContext caching, and so on, is
+provided.  In the C binding, defined in section 7, routines are provided
+to access the internals of two opaque data structures -
+<symbol role='Pn'>GC</symbol>s
+and
+<function>Visual</function>s - and to discard any requests pending within the
+output buffer of a connection.  The exact details can be expected to differ for
+other language bindings.
+      </para>
+    </listitem>
+    <listitem>
+      <para>Server Requests</para>
+      <para>
+The first of these requests is similar to that provided in most
+extensions: it allows a client to specify a major and minor version
+number to the server and for the server to respond with major and minor
+versions of its own.  The remaining two requests allow the following:
+      </para>
+    </listitem>
+    <listitem>
+      <itemizedlist>
+        <listitem>
+          <para>
+Access to an otherwise "write-only" server resource: the
+cursor associated with a given window
+          </para>
+        </listitem>
+        <listitem>
+          <para>
+Perhaps most importantly, limited synthesis of input
+device events, almost as if a cooperative user had moved the pointing device
+or pressed a key or button.
+          </para>
+        </listitem>
+      </itemizedlist>
+    </listitem>
+</itemizedlist>
+</chapter>
+
+<chapter id='c_language_binding'>
+<title>C Language Binding</title>
+
+<para>
+The C functions either provide direct access to the protocol and add no
+additional semantics to those defined in section 5 or they correspond
+directly to the abstract descriptions of client operations in section 4.
+</para>
+
+<para>
+All XTEST extension functions and procedures, and all manifest constants
+and macros, will start with the string "XTest".  All operations are
+classified as server/client (Server) or client-only (Client).
+All routines that have return type Status will return nonzero for
+"success" and zero for "failure."  Even if the XTEST extension is
+supported, the server may withdraw such facilities arbitrarily; in which case
+they will subsequently return zero.
+</para>
+
+<para>
+The include file for this extension is
+&lt;<symbol role='Pn'>X11/extensions/XTest.h</symbol>&gt;.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef>Bool<function> XTestQueryExtension</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>int<parameter> *event_base</parameter></paramdef>
+<paramdef>int<parameter> *error_base</parameter></paramdef>
+<paramdef>int<parameter> *major_version</parameter></paramdef>
+<paramdef>int<parameter> *minor_version</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XTestQueryExtension</function>
+returns
+<function>True</function>
+if the specified display supports the XTEST extension, else
+<function>False</function>
+If the extension is supported, *event_base would be set to the event number
+for the first event for this extension and *error_base would be set to the
+error number for the first error for this extension.  As no errors or
+events are defined for this version of the extension, the values returned
+here are not defined (nor useful).  If the extension is supported,
+*major_version and *minor_version are set to the major and minor version
+numbers of the extension supported by the display.  Otherwise, none of
+the arguments are set.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef>Bool<function> XTestCompareCursorWithWindow</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>Window<parameter> *window</parameter></paramdef>
+<paramdef>Cursor<parameter> cursor</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>If the extension is supported,
+<function>XTestCompareCursorWithWindow</function>
+performs a comparison of the cursor whose ID is specified by cursor (which
+may be
+<function>None</function>
+with the cursor of the window specified by window returning
+<function>True</function>
+if they are the same and
+<function>False</function>
+otherwise.  If the extension is not supported, then the request is ignored and
+zero is returned.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef>Bool<function>XTestCompareCurrentCursorWithWindow</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>Window<parameter> window</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>If the extension is supported,
+<function>XTestCompareCurrentCursorWithWindow</function>
+performs a comparison of the current cursor with the cursor of the specified
+window returning
+<function>True</function>
+if they are the same and
+<function>False</function>
+otherwise.  If the extension is not supported, then the request is ignored and
+zero is returned.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef><function>XTestFakeKeyEvent</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>unsigned int<parameter> keycode</parameter></paramdef>
+<paramdef>Bool<parameter> is_press</parameter></paramdef>
+<paramdef>unsigned long<parameter> delay</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>If the extension is supported,
+<function>XTestFakeKeyEvent</function>
+requests the server to simulate either a
+<function>KeyPress</function>
+(if is_press is
+<function>True</function>
+or a
+<function>KeyRelease</function>
+(if is_press is
+<function>False</function>
+of the key with the specified keycode; otherwise, the request is ignored.
+</para>
+
+<para>
+If the extension is supported, the simulated event will not be processed
+until delay milliseconds after the request is received (if delay is
+<function>CurrentTime</function>
+then this is interpreted as no delay at all).  No other requests from
+this client will be processed until this delay, if any, has expired
+and subsequent processing of the simulated event has been completed.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef><function>XTestFakeButtonEvent</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>unsigned int<parameter> button</parameter></paramdef>
+<paramdef>Bool<parameter> is_press</parameter></paramdef>
+<paramdef>unsigned long<parameter> delay</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>If the extension is supported,
+<function>XTestFakeButtonEvent</function>
+requests the server to simulate either a
+<function>ButtonPress</function>
+(if is_press is
+<function>True</function>
+or a
+<function>ButtonRelease</function>
+(if is_press is
+<function>False</function>
+of the logical button numbered by the specified button; otherwise, the
+request is ignored.
+</para>
+
+<para>If the extension is supported,
+the simulated event will not be processed until delay milliseconds
+after the request is received (if delay is
+<function>CurrentTime</function>
+then this is interpreted as no delay at all).  No other requests from
+this client will be processed until this delay, if any, has expired
+and subsequent processing of the simulated event has been completed.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef><function>XTestFakeMotionEvent</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>int<parameter> screen_number</parameter></paramdef>
+<paramdef>int<parameter> x</parameter></paramdef>
+<paramdef>int<parameter> y</parameter></paramdef>
+<paramdef>unsigned long<parameter> delay</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>If the extension is supported,
+<function>XTestFakeMotionEvent</function>
+requests the server to simulate a movement of the pointer to the specified
+position (x, y) on the root window of screen_number; otherwise, the request
+is ignored.  If screen_number is -1, the current screen (that the pointer
+is on) is used.
+</para>
+
+<para>
+If the extension is supported, the simulated event will not be processed
+until delay milliseconds after the request is received (if delay is
+<function>CurrentTime</function>
+then this is interpreted as no delay at all).  No other requests from
+this client will be processed until this delay, if any, has expired
+and subsequent processing of the simulated event has been completed.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef><function>XTestFakeRelativeMotionEvent</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>int<parameter> screen_number</parameter></paramdef>
+<paramdef>int<parameter> x</parameter></paramdef>
+<paramdef>int<parameter> y</parameter></paramdef>
+<paramdef>unsigned long<parameter> delay</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+If the extension is supported,
+<function>XTestFakeRelativeMotionEvent</function>
+requests the server to simulate a movement of the pointer by the specified
+offsets (x, y) relative to the current pointer position on screen_number;
+otherwise, the request is ignored.  If screen_number is -1, the
+current screen (that the pointer is on) is used.
+</para>
+
+<para>
+If the extension is supported, the simulated event will not be processed
+until delay milliseconds after the request is received (if delay is
+<function>CurrentTime</function>
+then this is interpreted as no delay at all).  No other requests from
+this client will be processed until this delay, if any, has expired
+and subsequent processing of the simulated event has been completed.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef><function>XTestGrabControl</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>Bool<parameter> impervious</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>If impervious is
+<function>True</function>
+then the executing client becomes impervious to server grabs.  If impervious is
+<function>False</function>
+then the executing client returns to the normal state of being susceptible
+to server grabs.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef>Bool<function> XTestSetGContextOfGC</function></funcdef>
+<paramdef>GC<parameter> gc</parameter></paramdef>
+<paramdef>GContext<parameter> gid</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XTestSetGContextOfGC</function>
+sets the GContext within the opaque datatype referenced by gc to
+be that specified by gid.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef><function>XTestSetVisualIDOfVisual</function></funcdef>
+<paramdef>Visual<parameter> *visual</parameter></paramdef>
+<paramdef>VisualID<parameter> visualid</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XTestSetVisualIDOfVisual</function>
+sets the VisualID within the opaque datatype referenced by visual to
+be that specified by visualid.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef>Bool<function> XTestDiscard</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XTestDiscard</function>
+discards any requests within the output buffer for the specified display.
+It returns
+<function>True</function>
+if any requests were discarded; otherwise, it returns
+<function>False</function>
+</para>
+</chapter>
+
+<chapter id='references'>
+<title>References</title>
+
+<para>
+Annicchiarico, D., et al., <emphasis remap='I'>XTrap: The XTrap
+Architecture</emphasis>.
+Digital Equipment Corporation, July 1991.
+</para>
+
+<para>
+Drake, K. J., <emphasis remap='I'>Some Proposals for a Minimum X11
+Testing Extension</emphasis>.
+UniSoft Ltd., June 1991.
+</para>
+
+</chapter>
+</book>
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100755 (executable)
index 0000000..1091ece
--- /dev/null
@@ -0,0 +1,27 @@
+lib_LTLIBRARIES = libXtst.la
+
+libXtst_la_SOURCES = \
+         XRecord.c \
+         XTest.c
+
+libXtst_la_LIBADD = @XTST_LIBS@
+
+AM_CFLAGS = \
+       -I$(top_srcdir)/include \
+       -I$(top_srcdir)/include/X11/extensions \
+       $(XTST_CFLAGS) \
+       $(CWARNFLAGS)
+
+libXtst_la_LDFLAGS = -version-number 6:1:0 -no-undefined
+
+libXtstincludedir = $(includedir)/X11/extensions
+libXtstinclude_HEADERS = $(top_srcdir)/include/X11/extensions/XTest.h \
+                         $(top_srcdir)/include/X11/extensions/record.h
+
+if LINT
+ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+              $(AM_CPPFLAGS) $(CPPFLAGS)
+
+lint:
+       $(LINT) $(ALL_LINT_FLAGS) $(libXtst_la_SOURCES) $(XTST_LIBS)
+endif LINT
diff --git a/src/XRecord.c b/src/XRecord.c
new file mode 100755 (executable)
index 0000000..45c8b43
--- /dev/null
@@ -0,0 +1,1073 @@
+/*
+XRecord.c - client-side library for RECORD extension
+
+Copyright 1995, 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 1995 Network Computing Devices
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Network Computing Devices
+ * not be used in advertising or publicity pertaining to distribution
+ * of the software without specific, written prior permission.
+ *
+ * NETWORK COMPUTING DEVICES DISCLAIMs ALL WARRANTIES WITH REGARD TO
+ * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES 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.
+ **************************************************************************/
+/*
+ * By Stephen Gildea, X Consortium, and Martha Zimet, NCD.
+ */
+
+#include <stdio.h>
+#include <assert.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/recordproto.h>
+#include <X11/extensions/record.h>
+
+static XExtensionInfo _xrecord_info_data;
+static XExtensionInfo *xrecord_info = &_xrecord_info_data;
+static /* const */ char *xrecord_extension_name = RECORD_NAME;
+
+#define XRecordCheckExtension(dpy,i,val) \
+    XextCheckExtension(dpy, i, xrecord_extension_name, val)
+
+/**************************************************************************
+ *                                                                        *
+ *                        private utility routines                       *
+ *                                                                        *
+ **************************************************************************/
+
+static XExtDisplayInfo *find_display(Display *dpy);
+
+/*
+ * A reply buffer holds a reply from RecordEnableContext.
+ * Pieces of that buffer are passed to the XRecordEnableContext callback.
+ * ref_count is incremented each time we do that.
+ * ref_count is decremented each time XRecordFreeData is called on
+ * the buffer.  When ref_count is 0, we can free or reuse the buffer.
+ */
+struct reply_buffer
+{
+    struct reply_buffer *next; /* next in list or NULL */
+    unsigned char *buf;                /* pointer to malloc'd buffer */
+    int nbytes;                        /* size of buf */
+    int ref_count;             /* callback uses pending */
+};
+
+
+/*
+ * There's some extra information the implementation finds useful
+ * to attach to an XRecordInterceptData packet to handle memory
+ * management.  So we really allocate one of these.
+ */
+struct intercept_queue
+{
+    /* this struct gets passed to the user as an XRecordInterceptData,
+       so the data field must come first so we can cast the address
+       back and forth */
+    XRecordInterceptData data;
+    struct intercept_queue *next; /* next in free list or NULL */
+    struct mem_cache_str *cache; /* contains head of free list */
+};
+
+/*
+ * per-display pointers to cache of malloc'd but unused memory
+ */
+struct mem_cache_str
+{
+    struct intercept_queue *inter_data;        /* free structs only */
+    struct reply_buffer *reply_buffers;        /* all reply buffers */
+    int inter_data_count;      /* total allocated, free and in use */
+    Bool display_closed;       /* so we know when to free ourself */
+};
+
+static int close_display(
+    Display *dpy,
+    XExtCodes *codes)          /* not used */
+{
+    XExtDisplayInfo *info = find_display (dpy);
+
+    LockDisplay(dpy);
+    if (info && info->data) {
+       struct mem_cache_str *cache = (struct mem_cache_str *)info->data;
+       struct intercept_queue *iq, *iq_next;
+       struct reply_buffer *rbp, **rbp_next_p;
+
+       for (iq=cache->inter_data; iq; iq=iq_next) {
+           iq_next = iq->next;
+           XFree(iq);
+           cache->inter_data_count--;
+       }
+
+       /* this is a little trickier, because some of these
+          might still be in use */
+       for (rbp_next_p = &cache->reply_buffers; *rbp_next_p; ) {
+           rbp = *rbp_next_p;
+           if (rbp->ref_count == 0) {
+               *rbp_next_p = rbp->next;
+               XFree(rbp->buf);
+               XFree(rbp);
+           } else {
+               rbp_next_p = &rbp->next;
+           }
+       }
+
+       if (cache->reply_buffers == NULL  &&  cache->inter_data_count == 0) {
+           /* every thing has been freed, can free ourselves, too */
+           XFree(cache);
+       } else {
+           cache->display_closed = True;
+           cache->inter_data = NULL; /* neatness only; won't be used */
+       }
+    }
+    UnlockDisplay(dpy);
+    return XextRemoveDisplay(xrecord_info, dpy);
+}
+
+static XPointer alloc_mem_cache(void)
+{
+    struct mem_cache_str *cache;
+    
+    /* note that an error will go unnoticed */
+    cache = (struct mem_cache_str *) Xmalloc(sizeof(struct mem_cache_str));
+    if (cache) {
+       cache->display_closed = False;
+       cache->inter_data = NULL;
+       cache->inter_data_count = 0;
+       cache->reply_buffers = NULL;
+    }
+    return (XPointer) cache;
+}
+
+static const char *xrecord_error_list[] = {
+    "XRecordBadContext (Not a defined RECORD context)",
+};
+
+static XEXT_GENERATE_ERROR_STRING (error_string, xrecord_extension_name,
+                                   RecordNumErrors, xrecord_error_list)
+
+static XExtensionHooks xrecord_extension_hooks = {
+    NULL,                               /* create_gc */
+    NULL,                               /* copy_gc */
+    NULL,                               /* flush_gc */
+    NULL,                               /* free_gc */
+    NULL,                               /* create_font */
+    NULL,                               /* free_font */
+    close_display,                      /* close_display */
+    NULL,                                      /* wire_to_event */
+    NULL,                                      /* event_to_wire */
+    NULL,                               /* error */
+    error_string                        /* error_string */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, xrecord_info,
+       xrecord_extension_name, &xrecord_extension_hooks, RecordNumEvents,
+       alloc_mem_cache())
+
+/**************************************************************************
+ *                                                                        *
+ *                        private library routines                       *
+ *                                                                        *
+ **************************************************************************/
+
+static void
+SendRange(
+    Display    *dpy,
+    XRecordRange **range_item,
+    int        nranges)
+{
+    int                rlen = SIZEOF(xRecordRange);
+    while(nranges--)
+    {
+       xRecordRange xrange;
+
+       xrange.coreRequestsFirst = (*range_item)->core_requests.first;
+       xrange.coreRequestsLast = (*range_item)->core_requests.last;
+       xrange.coreRepliesFirst = (*range_item)->core_replies.first;
+       xrange.coreRepliesLast = (*range_item)->core_replies.last;
+       xrange.extRequestsMajorFirst = (*range_item)->ext_requests.ext_major.first;
+       xrange.extRequestsMajorLast = (*range_item)->ext_requests.ext_major.last;
+       xrange.extRequestsMinorFirst = (*range_item)->ext_requests.ext_minor.first;
+       xrange.extRequestsMinorLast = (*range_item)->ext_requests.ext_minor.last;
+       xrange.extRepliesMajorFirst = (*range_item)->ext_replies.ext_major.first;
+       xrange.extRepliesMajorLast = (*range_item)->ext_replies.ext_major.last;
+       xrange.extRepliesMinorFirst = (*range_item)->ext_replies.ext_minor.first;
+       xrange.extRepliesMinorLast = (*range_item)->ext_replies.ext_minor.last;
+       xrange.deliveredEventsFirst = (*range_item)->delivered_events.first;
+       xrange.deliveredEventsLast = (*range_item)->delivered_events.last;
+       xrange.deviceEventsFirst = (*range_item)->device_events.first;
+       xrange.deviceEventsLast = (*range_item)->device_events.last;
+       xrange.errorsFirst = (*range_item)->errors.first;
+       xrange.errorsLast = (*range_item)->errors.last;
+       xrange.clientStarted = (*range_item)->client_started;
+       xrange.clientDied = (*range_item)->client_died;
+       Data(dpy, (char *)&xrange, rlen);
+       range_item++;
+    }
+}
+
+/**************************************************************************
+ *                                                                        *
+ *                 public routines                                       *
+ *                                                                        *
+ **************************************************************************/
+
+XID
+XRecordIdBaseMask(Display *dpy)
+{
+    return 0x1fffffff & ~dpy->resource_mask;
+}
+
+Status
+XRecordQueryVersion(Display *dpy, int *cmajor_return, int *cminor_return)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xRecordQueryVersionReq    *req;
+    xRecordQueryVersionReply           rep;
+
+    XRecordCheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(RecordQueryVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->recordReqType = X_RecordQueryVersion;
+    req->majorVersion = RECORD_MAJOR_VERSION;
+    req->minorVersion = RECORD_MINOR_VERSION;
+    if (!_XReply(dpy,(xReply *)&rep, 0, True)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    *cmajor_return = rep.majorVersion;
+    *cminor_return = rep.minorVersion;
+    return ((rep.majorVersion == RECORD_MAJOR_VERSION) &&
+           (rep.minorVersion >= RECORD_LOWEST_MINOR_VERSION));
+}
+
+XRecordContext
+XRecordCreateContext(Display *dpy, int datum_flags,
+                    XRecordClientSpec *clients, int nclients,
+                    XRecordRange **ranges, int nranges)
+{
+    XExtDisplayInfo    *info = find_display (dpy);
+    register xRecordCreateContextReq   *req;
+    int                        clen = 4 * nclients;
+
+    XRecordCheckExtension (dpy, info, 0);
+    LockDisplay(dpy);
+    GetReq(RecordCreateContext, req);
+
+    req->reqType = info->codes->major_opcode;
+    req->recordReqType = X_RecordCreateContext;
+    req->context = XAllocID(dpy);
+    req->length += (nclients * 4 +
+                   nranges * SIZEOF(xRecordRange)) >> 2;
+    req->elementHeader = datum_flags;
+    req->nClients = nclients;
+    req->nRanges = nranges;
+
+    Data32(dpy, (long *)clients, clen);
+    SendRange(dpy, ranges, nranges);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return req->context;
+}
+
+XRecordRange *
+XRecordAllocRange(void)
+{
+    return (XRecordRange*)Xcalloc(1, sizeof(XRecordRange));
+}
+
+Status
+XRecordRegisterClients(Display *dpy, XRecordContext context, int datum_flags,
+                      XRecordClientSpec *clients, int nclients,
+                      XRecordRange **ranges, int nranges)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xRecordRegisterClientsReq         *req;
+    int                        clen = 4 * nclients;
+
+    XRecordCheckExtension (dpy, info, 0);
+    LockDisplay(dpy);
+    GetReq(RecordRegisterClients, req);
+
+    req->reqType = info->codes->major_opcode;
+    req->recordReqType = X_RecordRegisterClients;
+    req->context =  context;
+    req->length += (nclients * 4 +
+                   nranges * SIZEOF(xRecordRange)) >> 2;
+    req->elementHeader = datum_flags;
+    req->nClients = nclients;
+    req->nRanges = nranges;
+
+    Data32(dpy, (long *)clients, clen);
+    SendRange(dpy, ranges, nranges);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+Status
+XRecordUnregisterClients(Display *dpy, XRecordContext context,
+                        XRecordClientSpec *clients, int nclients)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xRecordUnregisterClientsReq       *req;
+    int                        clen = 4 * nclients;
+
+    XRecordCheckExtension (dpy, info, 0);
+    LockDisplay(dpy);
+    GetReq(RecordUnregisterClients, req);
+
+    req->reqType = info->codes->major_opcode;
+    req->recordReqType = X_RecordUnregisterClients;
+    req->context = context;
+    req->length += nclients;
+    req->nClients = nclients;
+
+    Data32(dpy, (long *)clients, clen);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+static void
+WireToLibRange(
+    xRecordRange *wire_range,
+    XRecordRange *lib_range)
+{
+    lib_range->core_requests.first = wire_range->coreRequestsFirst;
+    lib_range->core_requests.last = wire_range->coreRequestsLast;
+    lib_range->core_replies.first = wire_range->coreRepliesFirst;
+    lib_range->core_replies.last = wire_range->coreRepliesLast;
+    lib_range->ext_requests.ext_major.first = wire_range->extRequestsMajorFirst;
+    lib_range->ext_requests.ext_major.last = wire_range->extRequestsMajorLast;
+    lib_range->ext_requests.ext_minor.first = wire_range->extRequestsMinorFirst;
+    lib_range->ext_requests.ext_minor.last = wire_range->extRequestsMinorLast;
+    lib_range->ext_replies.ext_major.first = wire_range->extRepliesMajorFirst;
+    lib_range->ext_replies.ext_major.last = wire_range->extRepliesMajorLast;
+    lib_range->ext_replies.ext_minor.first = wire_range->extRepliesMinorFirst;
+    lib_range->ext_replies.ext_minor.last = wire_range->extRepliesMinorLast;
+    lib_range->delivered_events.first = wire_range->deliveredEventsFirst;
+    lib_range->delivered_events.last = wire_range->deliveredEventsLast;
+    lib_range->device_events.first = wire_range->deviceEventsFirst;
+    lib_range->device_events.last = wire_range->deviceEventsLast;
+    lib_range->errors.first = wire_range->errorsFirst;
+    lib_range->errors.last = wire_range->errorsLast;
+    lib_range->client_started = wire_range->clientStarted;
+    lib_range->client_died = wire_range->clientDied;
+}
+
+Status
+XRecordGetContext(Display *dpy, XRecordContext context,
+                 XRecordState **state_return)
+{
+    XExtDisplayInfo    *info = find_display (dpy);
+    register           xRecordGetContextReq    *req;
+    xRecordGetContextReply     rep;
+    int                        count, i, rn;
+    xRecordRange       xrange;
+    XRecordRange       *ranges = NULL;
+    xRecordClientInfo   xclient_inf;
+    XRecordClientInfo  **client_inf, *client_inf_str = NULL;
+    XRecordState       *ret;
+
+    XRecordCheckExtension (dpy, info, 0);
+    LockDisplay(dpy);
+    GetReq(RecordGetContext, req);
+    req->reqType = info->codes->major_opcode;
+    req->recordReqType = X_RecordGetContext;
+    req->context = context;
+    if (!_XReply(dpy,(xReply *)&rep, 0, False)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return 0;
+    }
+    count = rep.nClients;
+
+    ret = (XRecordState*)Xmalloc(sizeof(XRecordState));
+    if (!ret) {
+       /* XXX - eat data */
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return 0;
+    }
+
+    ret->enabled = rep.enabled;
+    ret->datum_flags = rep.elementHeader;
+    ret->nclients = count;
+
+    if (count)
+    {
+       client_inf = (XRecordClientInfo **) Xcalloc(count, sizeof(XRecordClientInfo*));
+       ret->client_info = client_inf;
+       if (client_inf != NULL) {
+           client_inf_str = (XRecordClientInfo *) Xmalloc(count*sizeof(XRecordClientInfo));
+       }
+        if (!client_inf || !client_inf_str)
+        {
+           for(i = 0; i < count; i++)
+           {
+               _XEatData (dpy, sizeof(xRecordClientInfo));
+                _XEatData (dpy, SIZEOF(xRecordRange)); /* XXX - don't know how many */
+           }
+          UnlockDisplay(dpy);
+          XRecordFreeState(ret);
+          SyncHandle();
+          return 0;
+        }
+        for(i = 0; i < count; i++)
+        {
+           client_inf[i] = &(client_inf_str[i]);
+            _XRead(dpy, (char *)&xclient_inf, (long)sizeof(xRecordClientInfo));
+            client_inf_str[i].client = xclient_inf.clientResource;
+            client_inf_str[i].nranges = xclient_inf.nRanges;
+
+           if (xclient_inf.nRanges)
+           {
+               client_inf_str[i].ranges = (XRecordRange**) Xcalloc(xclient_inf.nRanges, sizeof(XRecordRange*));
+               if (client_inf_str[i].ranges != NULL) {
+                   ranges = (XRecordRange*)
+                       Xmalloc(xclient_inf.nRanges * sizeof(XRecordRange));
+               }
+               if (!client_inf_str[i].ranges || !ranges) {
+                   /* XXX eat data */
+                   UnlockDisplay(dpy);
+                   XRecordFreeState(ret);
+                   SyncHandle();
+                   return 0;
+               }
+               for (rn=0; rn<xclient_inf.nRanges; rn++) {
+                   client_inf_str[i].ranges[rn] = &(ranges[rn]);
+                   _XRead(dpy, (char *)&xrange, (long)sizeof(xRecordRange));
+                   WireToLibRange(&xrange, &(ranges[rn]));
+               }
+           } else {
+               client_inf_str[i].ranges = NULL;
+           }
+        }
+    } else {
+       ret->client_info = NULL;
+    }
+
+    *state_return = ret;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+void
+XRecordFreeState(XRecordState *state)
+{
+    int i;
+
+    for(i=0; i<state->nclients; i++) {
+       if (state->client_info[i]->ranges) {
+           if (state->client_info[i]->ranges[0])
+               Xfree(state->client_info[i]->ranges[0]);
+           Xfree(state->client_info[i]->ranges);
+       }
+    }
+    if (state->client_info) {
+       if (state->client_info[0])
+           Xfree(state->client_info[0]);
+       Xfree(state->client_info);
+    }
+    Xfree(state);
+}
+
+static struct reply_buffer *alloc_reply_buffer(
+    XExtDisplayInfo *info,
+    int nbytes)
+{
+    struct mem_cache_str *cache = (struct mem_cache_str *)info->data;
+    struct reply_buffer *rbp;
+    struct reply_buffer *saved_rb = NULL;
+    /*
+     * First look for an allocated buffer that is not in use.
+     * If we have a big enough buffer, use that, otherwise
+     * realloc an existing one.
+     */
+    for (rbp = cache->reply_buffers; rbp; rbp = rbp->next) {
+       if (rbp->ref_count == 0) {
+           if (rbp->nbytes >= nbytes)
+               return rbp;
+           else
+               saved_rb = rbp;
+       }
+    }
+    if (saved_rb) {
+       saved_rb->buf = (unsigned char *)Xrealloc(saved_rb->buf, nbytes);
+       if (!saved_rb->buf) {
+           saved_rb->nbytes = 0;
+           return NULL;
+       }
+       saved_rb->nbytes = nbytes;
+       return saved_rb;
+    }
+
+    /*
+     * nothing available; malloc a new struct
+     */
+    rbp = (struct reply_buffer *)Xmalloc(sizeof(struct reply_buffer));
+    if (!rbp)
+       return NULL;
+    rbp->buf = (unsigned char *)Xmalloc(nbytes);
+    if (!rbp->buf) {
+       Xfree(rbp);
+       return NULL;
+    }
+    rbp->nbytes = nbytes;
+    rbp->ref_count = 0;
+    rbp->next = cache->reply_buffers;
+    cache->reply_buffers = rbp;
+    return rbp;
+}
+
+static XRecordInterceptData *alloc_inter_data(XExtDisplayInfo *info)
+{
+    struct mem_cache_str *cache = (struct mem_cache_str *)info->data;
+    struct intercept_queue *iq;
+
+    /* if there is one on the free list, pop it */
+    if (cache->inter_data) {
+       iq = cache->inter_data;
+       cache->inter_data = iq->next;
+       return &iq->data;
+    }
+    /* allocate a new one */
+    iq = (struct intercept_queue *)Xmalloc(sizeof(struct intercept_queue));
+    if (!iq)
+       return NULL;
+    iq->cache = cache;
+    cache->inter_data_count++;
+    return &iq->data;
+}
+
+void
+XRecordFreeData(XRecordInterceptData *data)
+{
+    /* we can do this cast because that is what we really allocated */
+    struct intercept_queue *iq = (struct intercept_queue *)data;
+    struct reply_buffer *rbp = NULL;
+    struct mem_cache_str *cache = iq->cache;
+
+    /*
+     * figure out what reply_buffer this points at
+     * and decrement its ref_count.
+     */
+    if (data->data) {
+
+       for (rbp = cache->reply_buffers; rbp; rbp = rbp->next) {
+           if (data->data >= rbp->buf
+               && data->data < rbp->buf + rbp->nbytes)
+           {
+               assert(rbp->ref_count > 0);
+               rbp->ref_count--;
+               break;
+           }
+       }
+       /* it's an error if we didn't find something to free */
+       assert(rbp);
+    }
+    /*
+     * If the display is still open, put this back on the free queue.
+     *
+     * Otherwise the display is closed and we won't reuse this, so free it.
+     * See if we can free the reply buffer, too.
+     * If we can, see if this is the last reply buffer and if so
+     * free the list of reply buffers.
+     */
+    if (cache->display_closed == False) {
+       iq->next = cache->inter_data;
+       cache->inter_data = iq;
+    } else {
+       if (rbp && rbp->ref_count == 0) {
+           struct reply_buffer *rbp2, **rbp_next_p;
+
+           /* Have to search the list again to find the prev element.
+              This is not the common case, so don't slow down the code
+              above by doing it then. */
+           for (rbp_next_p = &cache->reply_buffers; *rbp_next_p; ) {
+               rbp2 = *rbp_next_p;
+               if (rbp == rbp2) {
+                   *rbp_next_p = rbp2->next;
+                   break;
+               } else {
+                   rbp_next_p = &rbp2->next;
+               }
+           }
+           XFree(rbp->buf);
+           XFree(rbp);
+       }
+
+       XFree(iq);
+       cache->inter_data_count--;
+
+       if (cache->reply_buffers == NULL  &&  cache->inter_data_count == 0) {
+           XFree(cache); /* all finished */
+       }
+    }
+}
+
+/* the EXTRACT macros are adapted from ICElibint.h */
+
+#ifndef WORD64
+
+#define EXTRACT_CARD16(swap, src, dst) \
+{ \
+    (dst) = *((CARD16 *) (src)); \
+    if (swap) \
+        (dst) = lswaps (dst); \
+}
+
+#define EXTRACT_CARD32(swap, src, dst) \
+{ \
+    (dst) = *((CARD32 *) (src)); \
+    if (swap) \
+        (dst) = lswapl (dst); \
+}
+
+#else /* WORD64 */
+
+#define EXTRACT_CARD16(swap, src, dst) \
+{ \
+    (dst) = *((src) + 0); \
+    (dst) <<= 8; \
+    (dst) |= *((src) + 1); \
+    if (swap) \
+        (dst) = lswaps (dst); \
+}
+
+#define EXTRACT_CARD32(swap, src, dst) \
+{ \
+    (dst) = *((src) + 0); \
+    (dst) <<= 8; \
+    (dst) |= *((src) + 1); \
+    (dst) <<= 8; \
+    (dst) |= *((src) + 2); \
+    (dst) <<= 8; \
+    (dst) |= *((src) + 3); \
+    if (swap) \
+        (dst) = lswapl (dst); \
+}
+
+#endif /* WORD64 */
+
+/* byte swapping macros from xfs/include/misc.h */
+
+/* byte swap a long literal */
+#define lswapl(x) ((((x) & 0xff) << 24) |\
+                  (((x) & 0xff00) << 8) |\
+                  (((x) & 0xff0000) >> 8) |\
+                  (((x) >> 24) & 0xff))
+
+/* byte swap a short literal */
+#define lswaps(x) ((((x) & 0xff) << 8) | (((x) >> 8) & 0xff))
+
+enum parser_return { Continue, End, Error };
+
+static enum parser_return
+parse_reply_call_callback(
+    Display *dpy,
+    XExtDisplayInfo *info,
+    xRecordEnableContextReply *rep,
+    struct reply_buffer *reply,
+    XRecordInterceptProc callback,
+    XPointer            closure)
+{
+    int current_index;
+    int datum_bytes = 0;
+    XRecordInterceptData *data;
+
+    /* call the callback for each protocol element in the reply */
+    current_index = 0;
+    do {
+       data = alloc_inter_data(info);
+       if (!data)
+           return Error;
+       
+       data->id_base = rep->idBase;
+       data->category = rep->category;
+       data->client_swapped = rep->clientSwapped;
+       data->server_time = rep->serverTime;
+       data->client_seq = rep->recordedSequenceNumber;
+       /*
+        * compute the size of this protocol element.
+        */
+       switch (rep->category) {
+       case XRecordFromServer:
+           if (rep->elementHeader&XRecordFromServerTime) {
+               EXTRACT_CARD32(rep->clientSwapped,
+                              reply->buf+current_index,
+                              data->server_time);
+               current_index += 4;
+           }
+           switch (reply->buf[current_index]) {
+           case X_Reply: /* reply */
+               EXTRACT_CARD32(rep->clientSwapped,
+                              reply->buf+current_index+4, datum_bytes);
+               datum_bytes = (datum_bytes+8) << 2;
+               break;
+           default: /* error or event */
+               datum_bytes = 32;
+           }
+           break;
+       case XRecordFromClient:
+           if (rep->elementHeader&XRecordFromClientTime) {
+               EXTRACT_CARD32(rep->clientSwapped,
+                              reply->buf+current_index,
+                              data->server_time);
+               current_index += 4;
+           }
+           if (rep->elementHeader&XRecordFromClientSequence) {
+               EXTRACT_CARD32(rep->clientSwapped,
+                              reply->buf+current_index,
+                              data->client_seq);
+               current_index += 4;
+           }
+           if (reply->buf[current_index+2] == 0
+               && reply->buf[current_index+3] == 0) /* needn't swap 0 */
+           {   /* BIG-REQUESTS */
+               EXTRACT_CARD32(rep->clientSwapped,
+                              reply->buf+current_index+4, datum_bytes);
+           } else {
+               EXTRACT_CARD16(rep->clientSwapped,
+                              reply->buf+current_index+2, datum_bytes);
+           }
+           datum_bytes <<= 2;
+           break;
+       case XRecordClientStarted:
+           EXTRACT_CARD16(rep->clientSwapped,
+                          reply->buf+current_index+6, datum_bytes);
+           datum_bytes = (datum_bytes+2) << 2;
+           break;
+       case XRecordClientDied:
+           if (rep->elementHeader&XRecordFromClientSequence) {
+               EXTRACT_CARD32(rep->clientSwapped,
+                              reply->buf+current_index,
+                              data->client_seq);
+               current_index += 4;
+           }
+           /* fall through */
+       case XRecordStartOfData:
+       case XRecordEndOfData:
+           datum_bytes = 0;
+       }
+       
+       if (datum_bytes > 0) {
+           if (current_index + datum_bytes > rep->length << 2)
+               fprintf(stderr,
+                       "XRecord: %lu-byte reply claims %d-byte element (seq %lu)\n",
+                       (long)rep->length << 2, current_index + datum_bytes,
+                       dpy->last_request_read);
+           /*
+            * This assignment (and indeed the whole buffer sharing
+            * scheme) assumes arbitrary 4-byte boundaries are
+            * addressable. 
+            */
+           data->data = reply->buf+current_index;
+           reply->ref_count++;
+       } else {
+           data->data = NULL;
+       }
+       data->data_len = datum_bytes >> 2;
+       
+       (*callback)(closure, data);
+       
+       current_index += datum_bytes;
+    } while (current_index<rep->length<<2);
+
+    if (rep->category == XRecordEndOfData)
+       return End;
+
+    return Continue;
+}
+
+Status
+XRecordEnableContext(Display *dpy, XRecordContext context,
+                    XRecordInterceptProc callback, XPointer closure)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xRecordEnableContextReq           *req;
+    xRecordEnableContextReply  rep;
+    struct reply_buffer *reply;
+    enum parser_return status;
+
+    XRecordCheckExtension (dpy, info, 0);
+    LockDisplay(dpy);
+    GetReq(RecordEnableContext, req);
+
+    req->reqType = info->codes->major_opcode;
+    req->recordReqType = X_RecordEnableContext;
+    req->context = context;
+
+    while (1)
+    {
+       /* This code should match that in XRecordEnableContextAsync */
+       if (!_XReply (dpy, (xReply *)&rep, 0, xFalse))
+       {
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return 0;
+       }
+
+       if (rep.length > 0) {
+           reply = alloc_reply_buffer(info, rep.length<<2);
+           if (!reply) {
+               UnlockDisplay(dpy);
+               SyncHandle();
+               return 0;
+           }
+           _XRead (dpy, (char *)reply->buf, rep.length<<2);
+       } else {
+           reply = NULL;
+       }
+
+       status = parse_reply_call_callback(dpy, info, &rep, reply,
+                                          callback, closure);
+       switch (status) {
+       case Continue:
+           break;
+       case End:
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return 1;
+       case Error:
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return 0;
+       }
+    }
+}
+
+
+typedef struct _record_async_state
+{
+    unsigned long enable_seq;
+    _XAsyncHandler *async;
+    _XAsyncErrorState *error_state;
+    XExtDisplayInfo *info;
+    XRecordInterceptProc callback;
+    XPointer closure;
+} record_async_state;
+
+static Bool
+record_async_handler(
+    register Display *dpy,
+    register xReply *rep,
+    char *buf,
+    int len,
+    XPointer adata)
+{
+    register record_async_state *state = (record_async_state *)adata;
+    struct reply_buffer *reply;
+    enum parser_return status;
+
+    if (dpy->last_request_read != state->enable_seq)
+    {
+       if (dpy->last_request_read > state->enable_seq) {
+           /* it is an error that we are still on the handler list */
+           fprintf(stderr, "XRecord: handler for seq %lu never saw XRecordEndOfData.  (seq now %lu)\n",
+                   state->enable_seq, dpy->last_request_read);
+           DeqAsyncHandler(dpy, state->async);
+           Xfree(state->async);
+       }
+       return False;
+    }
+    if (rep->generic.type == X_Error)
+    {
+       DeqAsyncHandler(dpy, state->async);
+       Xfree(state->async);
+       return False;
+    }
+
+    if (rep->generic.length > 0) {
+       reply = alloc_reply_buffer(state->info, rep->generic.length<<2);
+
+       if (!reply) {
+           DeqAsyncHandler(dpy, state->async);
+           Xfree(state->async);
+           return False;
+       }
+       
+       _XGetAsyncData(dpy, (char *)reply->buf, buf, len,
+                      SIZEOF(xRecordEnableContextReply),
+                      rep->generic.length << 2, 0);
+    } else {
+       reply = NULL;
+    }
+
+    status = parse_reply_call_callback(dpy, state->info, 
+                                      (xRecordEnableContextReply*) rep, 
+                                      reply, state->callback, state->closure);
+
+    if (status != Continue)
+    {
+       DeqAsyncHandler(dpy, state->async);
+       Xfree(state->async);
+       if (status == Error)
+           return False;
+    }
+
+    return True;
+}
+
+/*
+ * reads the first reply, StartOfData, synchronously,
+ * then returns allowing the app to call XRecordProcessReplies
+ * to get the rest.
+ */
+Status
+XRecordEnableContextAsync(Display *dpy, XRecordContext context,
+                         XRecordInterceptProc callback, XPointer closure)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xRecordEnableContextReq *req;
+    xRecordEnableContextReply rep;
+    struct reply_buffer *reply;
+    enum parser_return status;
+    _XAsyncHandler *async;
+    record_async_state *async_state;
+
+    XRecordCheckExtension (dpy, info, 0);
+    async = (_XAsyncHandler *)Xmalloc(sizeof(_XAsyncHandler) +
+       sizeof(record_async_state));
+    if (!async)
+       return 0;
+    async_state = (record_async_state *)(async + 1);
+
+    LockDisplay(dpy);
+    GetReq(RecordEnableContext, req);
+
+    req->reqType = info->codes->major_opcode;
+    req->recordReqType = X_RecordEnableContext;
+    req->context = context;
+
+    /* Get the StartOfData reply. */
+    /* This code should match that in XRecordEnableContext */
+    if (!_XReply (dpy, (xReply *)&rep, 0, xFalse))
+    {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       Xfree(async);
+       return 0;
+    }
+
+    /* this had better be a StartOfData, which has no extra data. */
+    if (rep.length != 0) {
+       fprintf(stderr, "XRecord: malformed StartOfData for sequence %lu\n",
+               dpy->last_request_read);
+    }
+    reply = NULL;
+
+    status = parse_reply_call_callback(dpy, info, &rep, reply,
+                                      callback, closure);
+    if (status != Continue)
+    {
+       UnlockDisplay(dpy);
+       Xfree(async);
+       return 0;
+    }
+
+    /* hook in the async handler for the rest of the replies */
+    async_state->enable_seq = dpy->request;
+    async_state->async = async;
+    async_state->info = info;
+    async_state->callback = callback;
+    async_state->closure = closure;
+
+    async->next = dpy->async_handlers;
+    async->handler = record_async_handler;
+    async->data = (XPointer)async_state;
+    dpy->async_handlers = async;
+
+    UnlockDisplay(dpy);
+    /* Don't invoke SyncHandle here, since this is an async
+       function.  Does this break XSetAfterFunction() ? */
+    return 1;
+}
+
+void
+XRecordProcessReplies(Display *dpy)
+{
+    (void) XPending(dpy);
+}
+
+Status
+XRecordDisableContext(Display *dpy, XRecordContext context)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xRecordDisableContextReq  *req;
+
+    XRecordCheckExtension (dpy, info, 0);
+    LockDisplay(dpy);
+    GetReq(RecordDisableContext, req);
+    req->reqType = info->codes->major_opcode;
+    req->recordReqType = X_RecordDisableContext;
+    req->context =  context;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+Status
+XRecordFreeContext(Display *dpy, XRecordContext context)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xRecordFreeContextReq     *req;
+
+    XRecordCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(RecordFreeContext, req);
+    req->reqType = info->codes->major_opcode;
+    req->recordReqType = X_RecordFreeContext;
+    req->context = context;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
diff --git a/src/XTest.c b/src/XTest.c
new file mode 100755 (executable)
index 0000000..76193a1
--- /dev/null
@@ -0,0 +1,445 @@
+/*
+Copyright 1990, 1991 by UniSoft Group Limited
+*/
+
+/*
+
+Copyright 1992, 1993, 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.
+
+*/
+
+#include <X11/Xlibint.h>
+#include <X11/extensions/XTest.h>
+#include <X11/extensions/xtestproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/XIproto.h>
+
+static XExtensionInfo _xtest_info_data;
+static XExtensionInfo *xtest_info = &_xtest_info_data;
+static /* const */ char *xtest_extension_name = XTestExtensionName;
+
+#define XTestCheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, xtest_extension_name, val)
+
+#define XTestICheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, xtest_extension_name, val); \
+  if (!i->data) return val
+
+/*****************************************************************************
+ *                                                                           *
+ *                        private utility routines                          *
+ *                                                                           *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static /* const */ XExtensionHooks xtest_extension_hooks = {
+    NULL,                              /* create_gc */
+    NULL,                              /* copy_gc */
+    NULL,                              /* flush_gc */
+    NULL,                              /* free_gc */
+    NULL,                              /* create_font */
+    NULL,                              /* free_font */
+    close_display,                     /* close_display */
+    NULL,                              /* wire_to_event */
+    NULL,                              /* event_to_wire */
+    NULL,                              /* error */
+    NULL                               /* error_string */
+};
+
+static XPointer
+get_xinput_base(Display *dpy)
+{
+    int major_opcode, first_event, first_error;
+    first_event = 0;
+
+    XQueryExtension(dpy, INAME, &major_opcode, &first_event, &first_error);
+    return (XPointer)(long)first_event;
+}
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, xtest_info,
+                                  xtest_extension_name, 
+                                  &xtest_extension_hooks, XTestNumberEvents,
+                                  get_xinput_base(dpy))
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xtest_info)
+
+/*****************************************************************************
+ *                                                                           *
+ *                 public routines                                          *
+ *                                                                           *
+ *****************************************************************************/
+
+Bool
+XTestQueryExtension (Display *dpy,
+                    int *event_base_return, int *error_base_return,
+                    int *major_return, int *minor_return)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xXTestGetVersionReq *req;
+    xXTestGetVersionReply rep;
+
+    if (XextHasExtension(info)) {
+       LockDisplay(dpy);
+       GetReq(XTestGetVersion, req);
+       req->reqType = info->codes->major_opcode;
+       req->xtReqType = X_XTestGetVersion;
+       req->majorVersion = XTestMajorVersion;
+       req->minorVersion = XTestMinorVersion;
+       if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return False;
+       }
+       UnlockDisplay(dpy);
+       SyncHandle();
+       *event_base_return = info->codes->first_event;
+       *error_base_return = info->codes->first_error;
+       *major_return = rep.majorVersion;
+       *minor_return = rep.minorVersion;
+       return True;
+    } else {
+       return False;
+    }
+}
+
+Bool
+XTestCompareCursorWithWindow(Display *dpy, Window window, Cursor cursor)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xXTestCompareCursorReq *req;
+    xXTestCompareCursorReply rep;
+
+    XTestCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(XTestCompareCursor, req);
+    req->reqType = info->codes->major_opcode;
+    req->xtReqType = X_XTestCompareCursor;
+    req->window = window;
+    req->cursor = cursor;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return rep.same;
+}
+
+Bool
+XTestCompareCurrentCursorWithWindow(Display *dpy, Window window)
+{
+    return XTestCompareCursorWithWindow(dpy, window, XTestCurrentCursor);
+}
+
+int
+XTestFakeKeyEvent(Display *dpy, unsigned int keycode,
+                 Bool is_press, unsigned long delay)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xXTestFakeInputReq *req;
+
+    XTestCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(XTestFakeInput, req);
+    req->reqType = info->codes->major_opcode;
+    req->xtReqType = X_XTestFakeInput;
+    req->type = is_press ? KeyPress : KeyRelease;
+    req->detail = keycode;
+    req->time = delay;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+int
+XTestFakeButtonEvent(Display *dpy, unsigned int button,
+                    Bool is_press, unsigned long delay)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xXTestFakeInputReq *req;
+
+    XTestCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(XTestFakeInput, req);
+    req->reqType = info->codes->major_opcode;
+    req->xtReqType = X_XTestFakeInput;
+    req->type = is_press ? ButtonPress : ButtonRelease;
+    req->detail = button;
+    req->time = delay;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+int
+XTestFakeMotionEvent(Display *dpy, int screen, int x, int y, unsigned long delay)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xXTestFakeInputReq *req;
+
+    XTestCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(XTestFakeInput, req);
+    req->reqType = info->codes->major_opcode;
+    req->xtReqType = X_XTestFakeInput;
+    req->type = MotionNotify;
+    req->detail = False;
+    if (screen == -1)
+       req->root = None;
+    else
+       req->root = RootWindow(dpy, screen);
+    req->rootX = x;
+    req->rootY = y;
+    req->time = delay;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+int
+XTestFakeRelativeMotionEvent(Display *dpy, int dx, int dy, unsigned long delay)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xXTestFakeInputReq *req;
+
+    XTestCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(XTestFakeInput, req);
+    req->reqType = info->codes->major_opcode;
+    req->xtReqType = X_XTestFakeInput;
+    req->type = MotionNotify;
+    req->detail = True;
+    req->root = None;
+    req->rootX = dx;
+    req->rootY = dy;
+    req->time = delay;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+static void
+send_axes(
+    Display *dpy,
+    XExtDisplayInfo *info,
+    xXTestFakeInputReq *req,
+    XDevice *dev,
+    int first_axis,
+    int *axes,
+    int n_axes)
+{
+    deviceValuator ev;
+    int n;
+
+    req->deviceid |= MORE_EVENTS;
+    req->length += ((n_axes + 5) / 6) * (SIZEOF(xEvent) >> 2);
+    ev.type = XI_DeviceValuator + (long)info->data;
+    ev.deviceid = dev->device_id;
+    ev.first_valuator = first_axis;
+    while (n_axes > 0) {
+       n = n_axes > 6 ? 6 : n_axes;
+       ev.num_valuators = n;
+       switch (n) {
+       case 6:
+           ev.valuator5 = *(axes+5);
+       case 5:
+           ev.valuator4 = *(axes+4);
+       case 4:
+           ev.valuator3 = *(axes+3);
+       case 3:
+           ev.valuator2 = *(axes+2);
+       case 2:
+           ev.valuator1 = *(axes+1);
+       case 1:
+           ev.valuator0 = *axes;
+       }
+       Data(dpy, (char *)&ev, SIZEOF(xEvent));
+       axes += n;
+       n_axes -= n;
+       ev.first_valuator += n;
+    }
+}
+
+int
+XTestFakeDeviceKeyEvent(Display *dpy, XDevice *dev,
+                       unsigned int keycode, Bool is_press,
+                       int *axes, int n_axes, unsigned long delay)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xXTestFakeInputReq *req;
+
+    XTestICheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(XTestFakeInput, req);
+    req->reqType = info->codes->major_opcode;
+    req->xtReqType = X_XTestFakeInput;
+    req->type = is_press ? XI_DeviceKeyPress : XI_DeviceKeyRelease;
+    req->type += (int)(long)info->data;
+    req->detail = keycode;
+    req->time = delay;
+    req->deviceid = dev->device_id;
+    if (n_axes)
+       send_axes(dpy, info, req, dev, 0, axes, n_axes);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+int
+XTestFakeDeviceButtonEvent(Display *dpy, XDevice *dev,
+                          unsigned int button, Bool is_press,
+                          int *axes, int n_axes, unsigned long delay)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xXTestFakeInputReq *req;
+
+    XTestICheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(XTestFakeInput, req);
+    req->reqType = info->codes->major_opcode;
+    req->xtReqType = X_XTestFakeInput;
+    req->type = is_press ? XI_DeviceButtonPress : XI_DeviceButtonRelease;
+    req->type += (int)(long)info->data;
+    req->detail = button;
+    req->time = delay;
+    req->deviceid = dev->device_id;
+    if (n_axes)
+       send_axes(dpy, info, req, dev, 0, axes, n_axes);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+int
+XTestFakeProximityEvent(Display *dpy, XDevice *dev, Bool in_prox,
+                       int *axes, int n_axes, unsigned long delay)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xXTestFakeInputReq *req;
+
+    XTestICheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(XTestFakeInput, req);
+    req->reqType = info->codes->major_opcode;
+    req->xtReqType = X_XTestFakeInput;
+    req->type = in_prox ? XI_ProximityIn : XI_ProximityOut;
+    req->type += (int)(long)info->data;
+    req->time = delay;
+    req->deviceid = dev->device_id;
+    if (n_axes)
+       send_axes(dpy, info, req, dev, 0, axes, n_axes);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+int
+XTestFakeDeviceMotionEvent(Display *dpy, XDevice *dev,
+                          Bool is_relative, int first_axis,
+                          int *axes, int n_axes, unsigned long delay)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xXTestFakeInputReq *req;
+
+    XTestICheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(XTestFakeInput, req);
+    req->reqType = info->codes->major_opcode;
+    req->xtReqType = X_XTestFakeInput;
+    req->type = XI_DeviceMotionNotify + (int)(long)info->data;
+    req->detail = is_relative;
+    req->time = delay;
+    req->deviceid = dev->device_id;
+    send_axes(dpy, info, req, dev, first_axis, axes, n_axes);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+int
+XTestGrabControl(Display *dpy, Bool impervious)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xXTestGrabControlReq *req;
+
+    XTestCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(XTestGrabControl, req);
+    req->reqType = info->codes->major_opcode;
+    req->xtReqType = X_XTestGrabControl;
+    req->impervious = impervious;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+void
+XTestSetGContextOfGC(GC gc, GContext gid)
+{
+    gc->gid = gid;
+}
+
+void
+XTestSetVisualIDOfVisual(Visual *visual, VisualID visualid)
+{
+    visual->visualid = visualid;
+}
+
+static xReq _dummy_request = {
+       0, 0, 0
+};
+
+Status
+XTestDiscard(Display *dpy)
+{
+    Bool something;
+    register char *ptr;
+
+    LockDisplay(dpy);
+    if ((something = (dpy->bufptr != dpy->buffer))) {
+       for (ptr = dpy->buffer;
+            ptr < dpy->bufptr;
+            ptr += (((xReq *)ptr)->length << 2))
+           dpy->request--;
+       dpy->bufptr = dpy->buffer;
+       dpy->last_req = (char *)&_dummy_request;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return something;
+}
diff --git a/xtst.pc.in b/xtst.pc.in
new file mode 100644 (file)
index 0000000..8702044
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Xtst
+Description: The Xtst Library
+Version: @PACKAGE_VERSION@
+Requires: recordproto
+Requires.private: x11 xext
+Cflags: -I${includedir}
+Libs: -L${libdir} -lXtst