Git init
authorKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:49:15 +0000 (00:49 +0900)
committerKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:49:15 +0000 (00:49 +0900)
124 files changed:
AUTHORS [new file with mode: 0644]
COPYING [new file with mode: 0755]
ChangeLog [new file with mode: 0755]
Makefile.am [new file with mode: 0755]
NEWS [new file with mode: 0755]
README [new file with mode: 0644]
autogen.sh [new file with mode: 0644]
configure.ac [new file with mode: 0755]
debian/README.source [new file with mode: 0644]
debian/changelog [new file with mode: 0755]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0755]
debian/copyright [new file with mode: 0644]
debian/libxext-dev.install [new file with mode: 0755]
debian/libxext6-udeb.install [new file with mode: 0644]
debian/libxext6.install [new file with mode: 0644]
debian/libxext6.symbols [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/MITMisc.h [new file with mode: 0755]
include/X11/extensions/XEVI.h [new file with mode: 0755]
include/X11/extensions/XLbx.h [new file with mode: 0755]
include/X11/extensions/XShm.h [new file with mode: 0755]
include/X11/extensions/Xag.h [new file with mode: 0755]
include/X11/extensions/Xcup.h [new file with mode: 0755]
include/X11/extensions/Xdbe.h [new file with mode: 0755]
include/X11/extensions/Xext.h [new file with mode: 0755]
include/X11/extensions/Xge.h [new file with mode: 0644]
include/X11/extensions/dpms.h [new file with mode: 0755]
include/X11/extensions/extutil.h [new file with mode: 0755]
include/X11/extensions/multibuf.h [new file with mode: 0755]
include/X11/extensions/security.h [new file with mode: 0755]
include/X11/extensions/shape.h [new file with mode: 0755]
include/X11/extensions/sync.h [new file with mode: 0755]
include/X11/extensions/xtestext1.h [new file with mode: 0755]
man/DBE.man [new file with mode: 0755]
man/DPMSCapable.man [new file with mode: 0755]
man/DPMSDisable.man [new file with mode: 0755]
man/DPMSEnable.man [new file with mode: 0755]
man/DPMSForceLevel.man [new file with mode: 0755]
man/DPMSGetTimeouts.man [new file with mode: 0755]
man/DPMSGetVersion.man [new file with mode: 0755]
man/DPMSInfo.man [new file with mode: 0755]
man/DPMSQueryExtension.man [new file with mode: 0755]
man/DPMSSetTimeouts.man [new file with mode: 0755]
man/Makefile.am [new file with mode: 0755]
man/XShape.man [new file with mode: 0755]
man/XShapeCombineMask.man [new file with mode: 0755]
man/XShapeCombineRectangles.man [new file with mode: 0755]
man/XShapeCombineRegion.man [new file with mode: 0755]
man/XShapeCombineShape.man [new file with mode: 0755]
man/XShapeGetRectangles.man [new file with mode: 0755]
man/XShapeInputSelected.man [new file with mode: 0755]
man/XShapeOffsetShape.man [new file with mode: 0755]
man/XShapeQueryExtension.man [new file with mode: 0755]
man/XShapeQueryExtents.man [new file with mode: 0755]
man/XShapeQueryVersion.man [new file with mode: 0755]
man/XShapeSelectInput.man [new file with mode: 0755]
man/XShm.man [new file with mode: 0755]
man/XShmAttach.man [new file with mode: 0755]
man/XShmCreateImage.man [new file with mode: 0755]
man/XShmCreatePixmap.man [new file with mode: 0755]
man/XShmDetach.man [new file with mode: 0755]
man/XShmGetEventBase.man [new file with mode: 0755]
man/XShmGetImage.man [new file with mode: 0755]
man/XShmPixmapFormat.man [new file with mode: 0755]
man/XShmPutImage.man [new file with mode: 0755]
man/XShmQueryExtension.man [new file with mode: 0755]
man/XShmQueryVersion.man [new file with mode: 0755]
man/XcupGetReservedColormapEntries.man [new file with mode: 0755]
man/XcupQueryVersion.man [new file with mode: 0755]
man/XcupStoreColors.man [new file with mode: 0755]
man/XdbeAllocateBackBufferName.man [new file with mode: 0755]
man/XdbeBeginIdiom.man [new file with mode: 0755]
man/XdbeDeallocateBackBufferName.man [new file with mode: 0755]
man/XdbeEndIdiom.man [new file with mode: 0755]
man/XdbeFreeVisualInfo.man [new file with mode: 0755]
man/XdbeGetBackBufferAttributes.man [new file with mode: 0755]
man/XdbeGetVisualInfo.man [new file with mode: 0755]
man/XdbeQueryExtension.man [new file with mode: 0755]
man/XdbeSwapBuffers.man [new file with mode: 0755]
man/Xevi.man [new file with mode: 0755]
man/XeviGetVisualInfo.man [new file with mode: 0755]
man/XeviQueryExtension.man [new file with mode: 0755]
man/XeviQueryVersion.man [new file with mode: 0755]
man/Xmbuf.man [new file with mode: 0755]
man/XmbufChangeBufferAttributes.man [new file with mode: 0755]
man/XmbufChangeWindowAttributes.man [new file with mode: 0755]
man/XmbufCreateBuffers.man [new file with mode: 0755]
man/XmbufCreateStereoWindow.man [new file with mode: 0755]
man/XmbufDestroyBuffers.man [new file with mode: 0755]
man/XmbufDisplayBuffers.man [new file with mode: 0755]
man/XmbufGetBufferAttributes.man [new file with mode: 0755]
man/XmbufGetScreenInfo.man [new file with mode: 0755]
man/XmbufGetVersion.man [new file with mode: 0755]
man/XmbufGetWindowAttributes.man [new file with mode: 0755]
man/XmbufQueryExtension.man [new file with mode: 0755]
packaging/libXext.spec [new file with mode: 0644]
specs/Makefile.am [new file with mode: 0755]
specs/dbelib.xml [new file with mode: 0755]
specs/dpmslib.xml [new file with mode: 0755]
specs/shapelib.xml [new file with mode: 0755]
specs/synclib.xml [new file with mode: 0755]
src/DPMS.c [new file with mode: 0755]
src/MITMisc.c [new file with mode: 0755]
src/Makefile.am [new file with mode: 0755]
src/XAppgroup.c [new file with mode: 0755]
src/XEVI.c [new file with mode: 0755]
src/XLbx.c [new file with mode: 0755]
src/XMultibuf.c [new file with mode: 0755]
src/XSecurity.c [new file with mode: 0755]
src/XShape.c [new file with mode: 0755]
src/XShm.c [new file with mode: 0755]
src/XSync.c [new file with mode: 0755]
src/XTestExt1.c [new file with mode: 0755]
src/Xcup.c [new file with mode: 0755]
src/Xdbe.c [new file with mode: 0755]
src/Xge.c [new file with mode: 0755]
src/extutil.c [new file with mode: 0755]
src/globals.c [new file with mode: 0755]
xext.pc.in [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..00e1f42
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,20 @@
+Extension      Authors/Affiliation
+---------      -------------------
+DPMS:          Rob Lembree, Digital Equipment Corporation
+MITMisc:       Bob Scheifler, MIT
+XAppgroup:     Kaleb S. Keithley, X Consortium
+Xcup:          Kaleb S, Keithley, The Open Group
+Xdbe:          Ian Elliot, Hewlett-Packard, David Wiggens, X Consortium
+XEVI:          Peter Daifuku, Silicon Graphics
+XLbx:          D. Converse, J Fulton, C. Kantarjiev, D. Lemke, R. Mor, 
+               Keith Packard, NCD (who now believes lbx should be nuked), 
+               R. Tice, D. Tonogai
+XMultibuf:     Jeffrey Friedberg, Larry Seiler, Jeff Vroom, Digital Equipment
+XSecurity:     Dave Wiggens, X Consortium
+XShape:        Jonathan Corbet, NCAR, Keith Packard, MIT X Consortium
+Xshm:          Bob Scheifler and Keith Packard, MIT X Consortium
+XSync:                 Tim Glauert, Olivetti Research, DAve Carver, Jim Gettys, 
+               Digital Equipment, Dave Wiggens, X Consortium
+XTestExt:      Kieron Drake, UniSoft, Ltd.
+
+Our apologies if there are any mistakes in the above.
diff --git a/COPYING b/COPYING
new file mode 100755 (executable)
index 0000000..e8f72ea
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,196 @@
+Copyright 1986, 1987, 1988, 1989, 1994, 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 (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
+
+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.
+
+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
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, 
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation 
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital 
+Equipment Corporation.
+
+Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS 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 1992 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 NCD. not be used in advertising or
+publicity pertaining to distribution of the software without specific,
+written prior permission.  NCD. makes no representations about the
+suitability of this software for any purpose.  It is provided "as is"
+without express or implied warranty.
+
+NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
+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 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
+and Olivetti Research Limited, Cambridge, England.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or Olivetti
+not be used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL THEY 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 1986, 1987, 1988 by Hewlett-Packard Corporation
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett-Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Hewlett-Packard makes no representations about the 
+suitability of this software for any purpose.  It is provided 
+"as is" without express or implied warranty.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+Copyright (c) 1994, 1995  Hewlett-Packard Company
+
+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 HEWLETT-PACKARD COMPANY 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 Hewlett-Packard
+Company 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 Hewlett-Packard Company.
+
+Copyright Digital Equipment Corporation, 1996
+
+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.  Digital Equipment Corporation
+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 1999, 2005, 2006 Sun Microsystems, Inc.  All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+Copyright (c) 1989 X Consortium, Inc. and Digital Equipment Corporation.
+Copyright (c) 1992 X Consortium, Inc. and Intergraph Corporation.
+Copyright (c) 1993 X Consortium, Inc. and Silicon Graphics, Inc.
+Copyright (c) 1994, 1995 X Consortium, Inc. and Hewlett-Packard Company.
+
+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.
+Digital Equipment Corporation, Intergraph Corporation, Silicon
+Graphics, Hewlett-Packard, and the X Consortium make 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.
diff --git a/ChangeLog b/ChangeLog
new file mode 100755 (executable)
index 0000000..bcec265
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,1039 @@
+commit 3ddeb5328e1a5413e4800fb396ebab429153d1a1
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Wed Oct 27 23:06:51 2010 -0700
+
+    libXext 1.2.0
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 67e6f3d5d56a70c6f8288e9af141916c29307e2d
+Author: Jesse Adkins <jesserayadkins@gmail.com>
+Date:   Tue Sep 28 13:30:02 2010 -0700
+
+    Purge cvs tags.
+    
+    Signed-off-by: Jesse Adkins <jesserayadkins@gmail.com>
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit e246505ef46f2850abf07ef50fa16865d15c53e1
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Aug 16 17:47:02 2010 -0400
+
+    man: list files to install only once
+    
+    Newer versions of autoconf detect that error.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 3593a22f82bc6aaf6fef47cacfbe4daa35438ee1
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Aug 16 14:13:54 2010 -0400
+
+    man: store shadow man pages in git rather than generating them
+    
+    Simplify the build process and the makefile.
+    
+    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 ef3d8a5b240335623d5f4d554ea4694829fc8eaf
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Aug 16 13:47:46 2010 -0400
+
+    man: whitespace management
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 05fd8155ef8cf32606bf6966caa3a9c689d1149d
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Aug 16 13:41:24 2010 -0400
+
+    man: use "shadows" terminology to refer to linking man pages
+    
+    To be consistent with other libraries
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 076820b006853d7c36f37fcdd9c2391b83f37ed8
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Aug 5 19:32:34 2010 -0400
+
+    man: using the C preprocessor is not required for man pages.
+    
+    There were no special symbols needing cpp.
+    Everything can be handled by the default MAN_SUBSTS in util-macros.
+    
+    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 34500310c8c4ec3a55078837bae15d644fbf24d0
+Author: Fernando Carrijo <fcarrijo@yahoo.com.br>
+Date:   Thu Jul 1 06:54:24 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 23643bd1ce181650fff32a8192c816dfc31989d7
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sun Jun 27 14:21:24 2010 -0400
+
+    specs: add dbelib and synclib. Remove trailing spaces
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 7a945c21ebe87cd0b3e91159f83059f55ed40006
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Sat Jun 26 14:29:04 2010 -0400
+
+    doc: replace groff input format with docbook xml format
+    
+    Initial version of docbook xml.
+    dbelib abd synclib are missing and will be added later.
+    Requires util-macros 1.10
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 0860348104536fc3a6e7daa44079b7a58cbfe4e5
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Thu Jun 17 16:21:22 2010 -0400
+
+    specs: translate, format, process, install and distribute.
+    
+    Makefile copied from libXtst
+    Remains to do are the Tex files.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 675ca9abbc38f088b177a67501ab5eff1c9dcff5
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Fri Jun 11 18:47:23 2010 -0700
+
+    Move specs for several extension API's from xorg-docs module
+    
+    Not formatted, translated or processed yet, just moved & added to EXTRA_DIST
+    Only moved those that had separate library/API docs from the protocol specs.
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 72cc123fbf3b5186771529cd5d9d9af46470b1af
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Fri Jun 11 18:25:30 2010 -0700
+
+    Remove headers for functions found in liblbxutil
+    
+    As reported in https://bugs.freedesktop.org/show_bug.cgi?id=25880
+    they were already added to liblbxutil, but I missed removing them
+    from here, where they're not used.
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit ce440c7d68fa06763f8413859c25ae3a8a22c81b
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date:   Thu Jun 3 17:19:30 2010 -0700
+
+    libXext 1.1.2
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 904f71cda5ef818b53171888efb6b0dd0f929565
+Author: Jamey Sharp <jamey@minilop.net>
+Date:   Fri Apr 9 17:30:06 2010 -0700
+
+    XAllocID must only be called with the Display lock held.
+    
+    This patch makes XdbeAllocateBackBufferName follow the same XID allocation
+    pattern used in other stubs.
+    
+    Signed-off-by: Jamey Sharp <jamey@minilop.net>
+
+commit b403e38d7d0994d223984c11f26f5b8749851522
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Apr 5 19:58:03 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 048e97e3948dd0caf886f3cb789899f63dc9d1bf
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Mon Mar 29 14:53:48 2010 -0400
+
+    config: remove the pkgconfig pc.in file from EXTRA_DIST
+    
+    Automake always includes it in the tarball.
+    
+    Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 658574bb531f342947f484f9903e30032afce070
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Fri Feb 5 13:58:33 2010 +0100
+
+    Revert "Don't smash the event_vec if num_events differs between lib and server."
+    
+    That commit created a single ext_handlers[] array to check for
+    non-overlapping extension events, but the event codes need to be
+    per-display, so checking them globally is wrong.
+    
+    This reverts commit 83fdb27df4ddc2fb088ddf2ec65f0db6b7c57287.
+    
+    Signed-off-by: Julien Cristau <jcristau@debian.org>
+    Cc: Peter Hutterer <peter.hutterer@who-t.net>
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 1ed7492638d6d6fb7c06da64017df6b7877d9780
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jan 14 20:36:51 2010 -0800
+
+    Update Sun license notices to current X.Org standard form
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 83fdb27df4ddc2fb088ddf2ec65f0db6b7c57287
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Nov 26 09:38:31 2009 +1000
+
+    Don't smash the event_vec if num_events differs between lib and server.
+    
+    If the library extension thinks there's more events to an extension than the
+    server actually has, the event_vec for the overlapping range can get
+    overwritten. This depends on the initialization order of the libraries.
+    
+    Reported-by: Nathan Kidd
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Reviewed-by: Julien Cristau <jcristau@debian.org>
+
+commit 9632775f2195e3448fcc402a3743f3368a8a1c9c
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Mon Nov 30 00:07:22 2009 +0100
+
+    Don't export xgeExtRegister
+    
+    Its only caller is XextAddDisplay()
+    
+    Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
+    Signed-off-by: Julien Cristau <jcristau@debian.org>
+
+commit db2a28e540f9eb7cbfeffc771ce7cdf414231aa7
+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 6ede21305688873a34fcbd2b0d9f7480679f02ee
+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 42aef4da8ab2b75bbfc3c27a430f43847ab5a0f6
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date:   Tue Oct 27 15:07:25 2009 -0400
+
+    Deploy the new XORG_DEFAULT_OPTIONS #24242
+    
+    This macro aggregate a number of existing macros that sets commmon
+    X.Org components configuration options. It shields the configuration file from
+    future changes.
+
+commit 28049a6d210913f8bf4b9d82382076718c9c3f1e
+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 49957bedce40cc706bdb71edc3e827212a4d586c
+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 28d16f8ce9dd6ed681e6bc149878002b093c976f
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Mon Nov 2 16:34:14 2009 -0800
+
+    Fix CFLAGS/CPPFLAGS so lint works properly
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 9f94bf9de7607c11ab82667a73a4160d705e355c
+Author: Keith Packard <keithp@keithp.com>
+Date:   Tue Nov 3 14:42:35 2009 -0800
+
+    Make library headers compatible with old server builds
+    
+    Old servers (1.6 and before) included the extension library headers
+    instead of using separate server header files. This patch makes the
+    library headers compatibile with the server by hiding the library
+    definitions from the server build.
+    
+    Signed-off-by: Keith Packard <keithp@keithp.com>
+    Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit ed7bbe65222286828fa42f3c264ed5c4190fe58c
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Oct 21 20:13:24 2009 -0700
+
+    libXext 1.1.1
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 341bddfc6eddef77e57dd64a084b69fd24bba152
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Oct 21 20:12:49 2009 -0700
+
+    Use $(AM_V_GEN) to silence makefile generation rules
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 38c351f2f49d44944958e9b4d003a74bd6d8d683
+Author: Jeremy Huddleston <jeremyhu@freedesktop.org>
+Date:   Wed Oct 21 12:47:25 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 956fd30e1046e5779ac0b6c07ec4f0e87250869a
+Author: Jamey Sharp <jamey@minilop.net>
+Date:   Wed Oct 7 19:31:21 2009 -0700
+
+    XAllocID must only be called with the Display lock held.
+    
+    This patch makes XShmAttach follow the same XID allocation pattern used in
+    other stubs, such as XShmCreatePixmap.
+    
+    Reported-by: <fdsteve@ihug.co.nz>
+    Signed-off-by: Jamey Sharp <jamey@minilop.net>
+
+commit 927e3260bcf1ad020228e8f2dce0176269982b4f
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Oct 2 10:52:13 2009 +1000
+
+    libXext 1.1
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 003e2eb714c39984b3c054e0fc637cdb051dcdf3
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Oct 2 10:43:14 2009 +1000
+
+    Require macros 1.3 for XORG_DEFAULT_OPTIONS
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit e29cd70df7d5abdccb6b7ed973611044d02241d0
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Jul 21 13:38:01 2009 +1000
+
+    Bump to 1.0.99.4
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit c3dc01ce05b26ec389eb2fbfc8633e3e0955572f
+Author: Jon TURNEY <jon.turney@dronecode.org.uk>
+Date:   Mon Jul 20 22:49:15 2009 +0100
+
+    Rename mitmisc.h to mitmiscconst.h to avoid a collision with MITMisc.h on case-insensitive filesystems
+    
+    Requires xextproto 7.0.99.2
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit dbc6ca9306f0f683419aca737e0d98243475bc0d
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Mon Jul 20 13:19:04 2009 +1000
+
+    Remove XTest header, belongs to libXtst.
+    
+    All prototypes declared in XTest.h are defined in libXtst/src/XTest.c, not
+    here.
+    
+    This removes the circular dependency between libXi and libXext.
+    
+    Reported-by: Colin Guthrie
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 1d1860f31f673f9cf2efb6dc59fdcf8fe625736f
+Author: Julien Cristau <jcristau@debian.org>
+Date:   Thu Jul 16 11:13:02 2009 +0100
+
+    Prevent shape.h being included in the server
+    
+    fixesproto includes shape.h, but doesn't want client side headers.  This
+    needs to be fixed there, but work around this in shape.h anyway so we
+    don't break older xfixesproto.h.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit dae2e0478eef5aa8a80288b417e1f8282dc0329c
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Fri Jul 17 08:40:42 2009 +1000
+
+    Bump to 1.0.99.3
+
+commit 391b5844b13f5bc0f030a2ef8dd415f41f92f84c
+Author: Adam Jackson <ajax@redhat.com>
+Date:   Thu Jul 16 17:25:51 2009 -0400
+
+    Fix DPMS/MBUF/SECURITY for new header names
+
+commit 02efa0486b7272e9e395d36774ee782f48bcb4ec
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Jul 16 13:33:08 2009 +1000
+
+    Bump to 1.0.99.2
+
+commit 1772c991ec6370fcf1bad79b00a87a02c5b484cc
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Thu Jun 25 15:36:39 2009 +1000
+
+    Move libXext library headers from xextproto to libXext.
+    
+    All library headers (or parts thereof) from xextproto are moved to
+    include/X11/extensions/. Including build fixes to include and build with the
+    new header locations and names.
+    
+    Requires xextproto 7.0.99.1
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit d1f3bc77a48c8e42771579e3fdf3370b35d3209d
+Author: Paul TBBle Hampson <Paul.Hampson@Pobox.com>
+Date:   Sat Jun 6 05:23:08 2009 +1000
+
+    Remove dependancy on libXau
+    
+    No symbols from Xau appear to be being used in libXext
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit b2c2cbaca4bf7ae6d735a5d18a7732f3d73d77db
+Author: Paul TBBle Hampson <Paul.Hampson@Pobox.com>
+Date:   Sat Jun 6 05:22:12 2009 +1000
+
+    Don't export extra symbols
+    
+    Turns the following functions static
+       _xgeFindDisplay
+       _xgeCheckExtInit
+       _xgeEventToWire
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit cad77b1d6d1a344f2cb31c16401076c003bb97dd
+Author: Imranullah Syed <freakabcd@gmail.com>
+Date:   Thu Feb 19 18:02:26 2009 +1000
+
+    Corrected order of arguments in man page for function: XShmCreateImage
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit 8a91fc6f72206362f399b5e29bf3d5f44f4eb822
+Author: Peter Hutterer <peter.hutterer@who-t.net>
+Date:   Tue Feb 10 07:45:32 2009 +1000
+
+    Silence "Generic Event Extension missing on display" warning.
+    
+    If we're already doing a check anyway, we don't need to print an extra
+    warning.
+    
+    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
+
+commit befd39f6766ebd06294216be3fe9592f8cabb423
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Mon Feb 2 20:34:33 2009 -0800
+
+    Add README with pointers to mailing list, bugzilla & git repos
+    
+    Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
+
+commit 0fb431359306af0db78b3bc3055bed446be39fef
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Fri Jan 30 01:03:51 2009 -0200
+
+    Bump back to 1.0.99.1.
+    
+      The intermediate 1.0.5 was not mean't to be really required,
+    but was done to not cause problems for people doing builds
+    from tarballs.
+
+commit f7b69edc21b90a5b343115de55d6f1a98aeda5e2
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Thu Jan 29 20:38:22 2009 -0200
+
+    Xorg libXext Version 1.0.5.
+
+commit 52cf9c06819d94e178285d75de6434e98358b63d
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Thu Jan 29 17:02:46 2009 -0200
+
+    patch to avoid gcc warning in libXext
+    
+      Original patch author is Peter Breitenlohner <peb@mppmu.mpg.de>.
+      This closes bug #18038.
+
+commit a2e8bc500dfad18ab161b3a7be44cf6fa15f140f
+Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
+Date:   Thu Jan 29 16:33:40 2009 -0200
+
+    Janitor: Correct make distcheck and compiler warnings.
+
+commit f467d17ae5a89aa1a2b8c7260334f41e8ee2d08c
+Author: Kim Woelders <kim@woelders.dk>
+Date:   Fri Oct 17 16:53:29 2008 -0400
+
+    Bug #17774: Allocate the right size in XSyncListSystemCounters.
+
+commit 49563f5d76637e2ca28fe0b91ce3114271c0955d
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu May 29 10:55:49 2008 +0930
+
+    Bump to 1.0.99.1
+
+commit 64edd246587adb59ac71031f72955fa5a73ac467
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu May 29 10:40:59 2008 +0930
+
+    Require xproto 7.0.13, xextproto 7.0.3 and xlib 1.1.99.1.
+
+commit 0721b2d71c40e877944aa22a3c57ed70225f508d
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Mon May 26 23:16:29 2008 +0930
+
+    Xge: Replace XExtensionVersion with XGEVersionRec.
+    
+    XExtensionVersion is defined in XInput.h, leading to a circular dependency.
+    Thanks to Jens Stroebel for pointing this out.
+
+commit 44d3a4d4016c58f8ac46843d0b2dd4ddb26e2fc9
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Tue May 13 11:23:59 2008 +0930
+
+    Xge: replace copyright with standard template from xserver, whitespace fixes.
+
+commit 7e0b3b9029d3d12c9edf961c1d9db4cdbf021f1d
+Merge: c4b0ae9 9884a41
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Mon May 12 18:04:09 2008 +0930
+
+    Merge branch 'master' into xge
+
+commit 9884a41dd0282ca3dd19db5bf3a11554ee7eee57
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Feb 28 19:02:58 2008 -0800
+
+    Version bump: 1.0.4
+
+commit f6c7c70f312c8eb0883437c003ba78bb4abbabc3
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Fri Dec 7 15:41:42 2007 -0800
+
+    Coverity #467: security_error_list has fewer than XSecurityNumberErrors entries
+    
+    Sometimes it's annoying that C silently merges adjacent strings without
+    warning you that you forgot a comma in your list of strings.
+
+commit 37fe15843fd892c529e554f24a937ed712ea129c
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Fri Dec 7 15:39:13 2007 -0800
+
+    Allow overriding the SOREV in configure.ac
+
+commit 285deb33da14fb5476b18cb1071b41070cf3ae99
+Author: James Cloos <cloos@jhcloos.com>
+Date:   Thu Dec 6 15:51:16 2007 -0500
+
+    Add missing PHONY line for automatic ChangeLog generation
+
+commit c4b0ae960d63f461d6e9efd64f70084f06a674b3
+Merge: d1c9350 249daf0
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Thu Dec 6 14:23:02 2007 +1030
+
+    Merge branch 'master' into xge
+
+commit 249daf0d8a044a97d053c957ab45445c159d31e4
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Wed Nov 28 17:29:28 2007 -0800
+
+    XeviGetVisualInfo: check for null pointer before writing to it, not after
+
+commit a7d211f6e3ded98c79e7be73253a51958d3e98db
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Tue Nov 27 18:12:29 2007 -0800
+
+    include of config.h should not be inside #ifdef WIN32
+
+commit 1614ea1074d62f32f51032141b0c55250380ca17
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Tue Nov 27 17:54:34 2007 -0800
+
+    Add hooks for checking code with lint/sparse/etc.
+
+commit 8a2bb8793eed1c7f690be5c00772b2a64b9632fd
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Tue Nov 27 16:54:21 2007 -0800
+
+    Fix sparse warnings (type mismatches in function pointers, int as pointer)
+
+commit 781dbe7d723e9fe5a0e028dcb5a0fafeb59629e3
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Tue Nov 27 16:11:49 2007 -0800
+
+    Add missing copyright/license notices to COPYING
+
+commit 39cb1caa381666ac79307d3d312992d4e22980d1
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Tue Nov 27 16:03:14 2007 -0800
+
+    Fix incorrect comment delimiters in libXext man pages
+    
+    Similar to X.Org Bug #4312 <http://bugs.freedesktop.org/show_bug.cgi?id=4312>
+    Protect /* sequences from cpp pre-processor removal without transforming
+    to Unicode mathematical asterisk character, and fix incorrectly encoded
+    /* sequences in XShm.man.
+
+commit cca90a25678bf3c3269af1c0ac5493cfd4809727
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Tue Nov 27 15:55:28 2007 -0800
+
+    Fix typos in source comments
+
+commit d1c93500e2f56b8aefda7133848c21f62572f5d5
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Tue Jun 26 11:46:10 2007 +0930
+
+    Don't call _xgeCheckExtInit() from _xgeWireToEvent(). It will cause a SIGABRT
+    when trying to get the display lock.
+
+commit 40d1cbaaf0fd12883c048288a62b0088286463f4
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Wed Jun 13 16:26:03 2007 +0930
+
+    Lock/Unlock in _xgeCheckExtInit(), and not in xgeGetExtensionVersion().
+    Otherwise we get a SIGABRT for displays that don't have XGE when we try to get
+    the disply lock.
+
+commit b125890386d5ebbc3811bc67e0a1ad469b0a10ed
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Wed May 30 11:07:25 2007 +0930
+
+    Remove useless line in XGE that didn't do anything except segfaulting.
+    
+    Thanks to Paulo Zanoni for spotting it.
+
+commit 850263ac9f772ab80f3e0680997f00e0c566f7d4
+Author: Peter Hutterer <peter@cs.unisa.edu.au>
+Date:   Tue May 15 17:00:07 2007 +0930
+
+    Add GenericEvent extension (XGE).
+    
+    Automatically register any extension at XGE and relay events to
+    the extension's event handlers.
+
+commit 8d8a6ac4012c2bd5bfd037e42f69f5b2b111433d
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jan 25 18:28:21 2007 -0800
+
+    Version bump: 1.0.3
+
+commit 6856538d6dec00795f492262eb4f730735eff8d1
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jan 25 18:23:14 2007 -0800
+
+    Replace static ChangeLog with dist-hook to generate from git log
+
+commit 5243b3f7d462a06ec245b28ed007d5b4c85651ee
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Tue Oct 24 17:22:34 2006 -0700
+
+    Man page spelling/typo fixes
+
+commit 0bf51bc7ba7c0b6f2540503491b9ec104c1c22d1
+Merge: ee11d4d a82d7b9
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Tue Oct 24 17:14:45 2006 -0700
+
+    Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/lib/libXext
+
+commit ee11d4d2098dfcb711d1ca9825256bd4625e91bb
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Tue Oct 24 17:14:32 2006 -0700
+
+    Add XShm.man and aliases to Makefile.am
+
+commit 50bb4abe86635c8bb26ad643d4402f109e03a7d0
+Author: Sam Lau <sam.lau@sun.com>
+Date:   Tue Oct 24 17:14:02 2006 -0700
+
+    Sun bug 4985712: man pages needed for MIT-SHM extension functions
+    
+    <http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=4985712>
+
+commit 6b50588e63ba02cb08a9465a1c30127f726c9ce2
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Tue Oct 24 17:11:48 2006 -0700
+
+    Add *~ to .gitignore to skip over emacs/patch backup files
+
+commit a82d7b9481ffb2dc62e490fb48e72219099d8b40
+Author: Adam Jackson <ajax@benzedrine.nwnk.net>
+Date:   Fri Oct 13 16:10:28 2006 -0400
+
+    Bump to 1.0.2
+
+commit 1faa250b670e735bc4a8674ca4fa9df66626fb33
+Author: David Nusinow <dnusinow@debian.org>
+Date:   Sat Aug 26 18:25:16 2006 +0000
+
+    Fix various manpages that didn't have their section generated from
+    __libmansuffix__.
+
+commit 9606f8ba35c568a5e9300bd9e3e2d217279c3d09
+Author: Alan Coopersmith <alan.coopersmith@sun.com>
+Date:   Thu Jul 13 14:58:53 2006 -0700
+
+    renamed: .cvsignore -> .gitignore
+
+commit 16889772a59ae778e1e8ec9c110d18c1acd38674
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu Apr 27 00:10:14 2006 +0000
+
+    Bump to 1.0.1
+
+commit 01e915b2775b78d461c873bac1b2787985196a5f
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Mon Apr 3 00:55:03 2006 +0000
+
+    Coverity #929: Additional defensive NULL check.
+
+commit 1225f28f6ef0712c9adf52edd8b1a3205bbc76b2
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Mon Apr 3 00:51:20 2006 +0000
+
+    Coverity #575: Plug a leak on the error path.
+
+commit bd0bcd84be01052d9d1ebd075f459113ac96e9de
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sun Feb 12 18:19:21 2006 +0000
+
+    Bug #5628 <https://bugs.freedesktop.org/show_bug.cgi?id=5628> Shadow pages
+        not created correctly when MANDIR & MANSUFFIX don't match.
+
+commit 33b0f4398ee48a7ec57748573871a48793dd49d9
+Author: Kevin E Martin <kem@kem.org>
+Date:   Thu Dec 15 00:24:29 2005 +0000
+
+    Update package version number for final X11R7 release candidate.
+
+commit 9c6b36858dc722e8aa63afc6ad10e1378d81f9cb
+Author: Kevin E Martin <kem@kem.org>
+Date:   Tue Dec 6 22:48:43 2005 +0000
+
+    Change *man_SOURCES ==> *man_PRE to fix autotools warnings.
+
+commit d885a4e61b8571cf7fe2b226f203b18f16de5cc1
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Dec 3 05:49:43 2005 +0000
+
+    Update package version number for X11R7 RC3 release.
+
+commit f472f2feebab449d9eddd920d4313c2f37c82c41
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Dec 3 04:41:49 2005 +0000
+
+    Add check and cflags for malloc(0) returning NULL.
+
+commit a290a2dd0022398dd70acf965bc0d9a590a71a40
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Mon Nov 28 22:03:05 2005 +0000
+
+    Change *mandir targets to use new *_MAN_DIR variables set by xorg-macros.m4
+        update to fix bug #5167 (Linux prefers *.1x man pages in man1 subdir)
+
+commit 59ac6be6490072bd562d5f4447f01a5a080cf5f9
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Nov 19 07:15:41 2005 +0000
+
+    Update pkgconfig files to separate library build-time dependencies from
+        application build-time dependencies, and update package deps to work
+        with separate build roots.
+
+commit d17efabf719888d7895e6cee7ff06d7ccb013676
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Nov 9 21:19:12 2005 +0000
+
+    Update package version number for X11R7 RC2 release.
+
+commit 81bbc01afbb1c5cfb466ced2d11930ed15c942aa
+Author: Kevin E Martin <kem@kem.org>
+Date:   Tue Nov 1 15:11:51 2005 +0000
+
+    Update pkgcheck dependencies to work with separate build roots.
+
+commit 954f6a876e909a80490934b44ffc7656bb16e87a
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Oct 19 02:48:10 2005 +0000
+
+    Update package version number for RC1 release.
+
+commit 31dcfdc277cef24b62ca328df9d0e9556b86fff2
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Tue Oct 18 00:00:08 2005 +0000
+
+    Use @LIB_MAN_SUFFIX@ instead of $(LIB_MAN_SUFFIX) in macro substitutions to
+        work better with BSD make
+
+commit ba4c273726718bbb6e7aabb9607f08cf1ac0faeb
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Mon Oct 17 21:13:15 2005 +0000
+
+    Rename .shadows.DONE to shadows.DONE to avoid some make's thinking it's a
+        suffix rule (reported by Matthieu Herrb)
+
+commit 3482953f137322896027b1bfa3dae09064270ff0
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Thu Oct 13 04:25:46 2005 +0000
+
+    Add generated man pages to .cvsignores
+
+commit 3a57856605a30b29d770571d6c734a5560215aa6
+Author: Kevin E Martin <kem@kem.org>
+Date:   Wed Oct 12 14:04:00 2005 +0000
+
+    Add .shadows.DONE to CLEANFILES to pass distcheck
+
+commit 1c34ea842fdece6b1a8c8666c2e7fc2b803ffd89
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Tue Oct 11 23:05:30 2005 +0000
+
+    configure.ac Set up cpp pre-processing of man pages Add shadow man pages
+        for man pages that document multiple functions.
+
+commit 2751dbddbea70b8732081f0ad63b1b0d6791447c
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sat Sep 24 00:59:00 2005 +0000
+
+    Fix function prototypes to match dpms.h
+
+commit 78c1c4533bcbe7f4af0d700e6b7442824048e0af
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sat Jul 30 21:07:25 2005 +0000
+
+    Add prototypes of Xalloc/free functions.
+    Export ImUtil.h to match modular tree install.
+    Define SVR4 to 1 to avoid warning about redefining to different values.
+    Include missing headers to clear more compiler warnings.
+
+commit bc50fc0cb028ed21f919a55a2f6b82aad38d0e07
+Author: Kevin E Martin <kem@kem.org>
+Date:   Fri Jul 29 21:22:51 2005 +0000
+
+    Various changes preparing packages for RC0:
+    - Verify and update package version numbers as needed
+    - Implement versioning scheme
+    - Change bug address to point to bugzilla bug entry form
+    - Disable loadable i18n in libX11 by default (use --enable-loadable-i18n to
+        reenable it)
+    - Fix makedepend to use pkgconfig and pass distcheck
+    - Update build script to build macros first
+    - Update modular Xorg version
+
+commit beb3c2e2d2122198043034b789c5ea8857fb1c10
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Jul 23 18:09:40 2005 +0000
+
+    Modify modular libs to use Xregion.h instead of region.h
+
+commit 5413d41389ce8dc1b93039b557385bf6e7477cf8
+Author: Kevin E Martin <kem@kem.org>
+Date:   Sat Jul 23 18:06:16 2005 +0000
+
+    lib/Xrender/Picture.c Change region.h to Xregion.h and modify internal
+        references to include <X11/Xregion.h>.
+
+commit df6e6114ddef0f7facd8417f1a78ceca25cf9cb6
+Author: Daniel Stone <daniel@fooishbar.org>
+Date:   Sat Jul 16 07:04:25 2005 +0000
+
+    Set Xext soversion to 6.4.0 per default.
+
+commit 4b8f4b7e6085a34d081a3c9057d34fa6f8030125
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Fri Jul 15 17:17:10 2005 +0000
+
+    Set .so versions correctly for Solaris and recent OpenBSD releases
+
+commit 4f16d4cf4ddac8709e0ab6612239287c9469c753
+Author: Keith Packard <keithp@keithp.com>
+Date:   Sat Jul 9 06:17:03 2005 +0000
+
+    Add .cvsignore files Switch _la_CFLAGS for AM_CFLAGS to clean up directory
+
+commit 1533ef4bfd436df164979ff5e79491edbb086d94
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Tue Jun 28 23:32:40 2005 +0000
+
+    Add man pages for DPMS Extension calls in libXext. (Converted to man page
+        format by Sun doc teams based on DPMS specification docs.)
+
+commit 8d8d049eca980869cc1df5e48f992e8a8de2e49b
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Tue Jun 28 23:21:40 2005 +0000
+
+    Add man pages for DPMS Extension calls in libXext. (Converted to man page
+        format by Sun doc teams based on DPMS specification docs.)
+
+commit f4c9f37c88bf2e08d57abc2c1ecf31fb7223cb02
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sun May 22 19:05:11 2005 +0000
+
+    Convert man pages to long file names in lib/X11, lib/Xt, & lib/Xext
+
+commit 1706d249d70a5045530ec9aee5ac9c51e00a7f93
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu May 19 00:22:32 2005 +0000
+
+    revert last change, didn't do right thing at all, sorry for the noise
+
+commit f8bdfbae1846ea01877cedd7ea836eaa289ecbe6
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Thu May 19 00:10:07 2005 +0000
+
+    Require automake 1.7 in AM_INIT_AUTOMAKE
+
+commit dc7cb253ba14b78ef0f863995bd0fc5a6a0ee017
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Wed May 18 18:52:39 2005 +0000
+
+    - Link Xext to /lib/Xext/src rather than /lib/Xext
+    - Conditionally include config.h in Xext source
+    - Remove unnecessary include of ImUtil.h from XShm.c
+
+commit 279e13a6a36bfeb3c8aa4272fdd6d4bcef9723a6
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Wed May 18 18:50:58 2005 +0000
+
+    Add man/Makefile.am and src/Makefile.am
+
+commit 3dde0d733cad58f01c3d667d7e6bc0dd6ca40608
+Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk>
+Date:   Wed May 18 18:50:23 2005 +0000
+
+    - Add build system for Xext
+
+commit d7dfac923b491ade943977e6949e40794bdc722f
+Author: Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>
+Date:   Fri Feb 18 12:29:55 2005 +0000
+
+    Bugzilla #2570 (https://bugs.freedesktop.org/show_bug.cgi?id=2570)
+        attachment #1930 (https://bugs.freedesktop.org/attachment.cgi?id=1930):
+        fixes build of libXext on mingw
+
+commit f6ae96f7a0d7cd5f36536b030563369801a1faba
+Author: Alan Coopersmith <Alan.Coopersmith@sun.com>
+Date:   Sat Jan 22 05:12:08 2005 +0000
+
+    Add man pages for TOG-CUP extension functions. (Converted to man page
+        format by Sun based on TOG-CUP specification docs.)
+
+commit 989a1ba0ea890190988b86b4570376cd07ed49ea
+Author: Adam Jackson <ajax@nwnk.net>
+Date:   Fri Sep 24 03:46:28 2004 +0000
+
+    Bug #1434: Convert lib/Xext to ANSI function prototypes (Jeff Muizelaar).
+
+commit 6a810dfc8f3797a833539c3092bc585a25995192
+Author: Egbert Eich <eich@suse.de>
+Date:   Fri Apr 23 18:43:41 2004 +0000
+
+    Merging XORG-CURRENT into trunk
+
+commit b3efb5deb1d9450351760545960d6cea63425ebe
+Author: Egbert Eich <eich@suse.de>
+Date:   Sun Mar 14 08:32:07 2004 +0000
+
+    Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004
+
+commit b0aeb370a60a2034a92957278e110fadbabfc042
+Author: Egbert Eich <eich@suse.de>
+Date:   Wed Mar 3 12:11:28 2004 +0000
+
+    Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004
+
+commit 0e02a1b3add5b25b9668bc28136ca4ccca92ace8
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 13:35:33 2004 +0000
+
+    readding XFree86's cvs IDs
+
+commit 40996c108cd47b63e433f39b32435401fd429d7f
+Author: Egbert Eich <eich@suse.de>
+Date:   Thu Feb 26 09:22:42 2004 +0000
+
+    Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004
+
+commit 1d27856035fac5f390ad1e475f4a7f9082792899
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Thu Dec 4 22:01:36 2003 +0000
+
+    XFree86 4.3.99.901 (RC 1)
+
+commit c0ca603fd38f805d5f53490ec6fb8b5e7f813954
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Tue Nov 25 19:28:09 2003 +0000
+
+    XFree86 4.3.99.16 Bring the tree up to date for the Cygwin folks
+
+commit 6b0dceb5b6027c98e478467576cf61aee1d87074
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 16:48:48 2003 +0000
+
+    XFree86 4.3.0.1
+
+commit 0d3d2607404af7f6e059fab64caea39dc34e391e
+Author: Kaleb Keithley <kaleb@freedesktop.org>
+Date:   Fri Nov 14 15:54:38 2003 +0000
+
+    R6.6 is the Xorg base-line
diff --git a/Makefile.am b/Makefile.am
new file mode 100755 (executable)
index 0000000..091d920
--- /dev/null
@@ -0,0 +1,22 @@
+SUBDIRS = man src specs
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = xext.pc
+
+MAINTAINERCLEANFILES = ChangeLog INSTALL
+
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+       $(INSTALL_CMD)
+
+ChangeLog:
+       $(CHANGELOG_CMD)
+
+dist-hook: ChangeLog INSTALL
+
+if LINT
+# Check source code with tools like lint & sparse
+lint:
+       (cd src && $(MAKE) $(MFLAGS) lint)
+endif LINT
diff --git a/NEWS b/NEWS
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..8bd443b
--- /dev/null
+++ b/README
@@ -0,0 +1,29 @@
+libXext - library for common extensions to the X11 protocol
+
+No new extensions should be added to this library - it is now instead
+preferred to make per-extension libraries that can be evolved as needed
+without breaking compatibility of this core library.
+
+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/libXext
+
+        http://cgit.freedesktop.org/xorg/lib/libXext
+
+For patch submission instructions, see:
+
+       http://www.x.org/wiki/Development/Documentation/SubmittingPatches
+
+For more information on the git code manager, see:
+
+        http://wiki.x.org/wiki/GitPage
+
diff --git a/autogen.sh b/autogen.sh
new file mode 100644 (file)
index 0000000..904cd67
--- /dev/null
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+autoreconf -v --install || exit 1
+cd $ORIGDIR || exit $?
+
+$srcdir/configure --enable-maintainer-mode "$@"
diff --git a/configure.ac b/configure.ac
new file mode 100755 (executable)
index 0000000..0baddc5
--- /dev/null
@@ -0,0 +1,62 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.60])
+AC_INIT([libXext],
+        [1.2.0],
+        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
+        [libXext])
+
+AC_CONFIG_SRCDIR([Makefile.am])
+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])
+
+# Determine .so library version per platform 
+# based on SharedXextRev in monolith xc/config/cf/*Lib.tmpl
+AC_CANONICAL_HOST
+if test "x$XEXT_SOREV" = "x" ; then
+    case $host_os in
+       openbsd*)       XEXT_SOREV=8:0          ;;
+       solaris*)       XEXT_SOREV=0            ;;
+       *)              XEXT_SOREV=6:4:0        ;;
+    esac
+fi
+AC_SUBST(XEXT_SOREV)
+
+# Checks for programs.
+AC_PROG_LIBTOOL
+AC_PROG_CC
+
+# Checks for pkg-config packages
+PKG_CHECK_MODULES(XEXT, [xproto >= 7.0.13] [x11 >= 1.1.99.1] [xextproto >= 7.0.99.2])
+AC_SUBST(XEXT_CFLAGS)
+AC_SUBST(XEXT_LIBS)
+
+# Checks for libraries.
+
+# Checks for header files.
+AC_HEADER_STDC
+
+XORG_CHECK_MALLOC_ZERO
+
+dnl Allow checking code with lint, sparse, etc.
+XORG_WITH_LINT
+XORG_LINT_LIBRARY([Xext])
+
+AC_OUTPUT([Makefile
+           man/Makefile
+          src/Makefile
+          specs/Makefile
+          xext.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..5e77ecd
--- /dev/null
@@ -0,0 +1,190 @@
+libxext (2:1.2.0-1slp2) unstable; urgency=low
+
+  * [X11R7.6] upgrade package
+  * Git: 165.213.180.234:slp/pkgs/xorg/lib/libxext
+  * Tag: libxext_1.2.0-1slp2
+
+ -- SooChan Lim <sc1.lim@samsung.com>  Tue, 04 Jan 2011 11:07:12 +0900
+
+libxext (2:1.1.2-1) unstable; urgency=low
+
+  * New upstream release.
+  * Update debian/copyright from upstream COPYING.
+  * Bump xutils-dev build-dep for xorg-macros 1.4.
+  * Drop patch included upstream, disable patch system.
+  * Bump Standards-Version to 3.9.0.
+
+ -- Julien Cristau <jcristau@debian.org>  Sun, 11 Jul 2010 14:15:51 +0100
+
+libxext (2:1.1.1-3) unstable; urgency=low
+
+  [ Julien Cristau ]
+  * Rename the build directory to not include DEB_BUILD_GNU_TYPE for no
+    good reason.  Thanks, Colin Watson!
+
+  [ Cyril Brulebois ]
+  * Add udeb needed for the graphical installer: libxext6-udeb.
+  * Bump the B-D on libx11-dev to ensure libxext6-udeb gets a dependency
+    on libx11-6-udeb.
+  * Bump Standards-Version from 3.8.3 to 3.8.4 (no changes needed).
+  * Add myself to Uploaders.
+
+ -- Cyril Brulebois <kibi@debian.org>  Thu, 11 Mar 2010 03:54:58 +0100
+
+libxext (2:1.1.1-2) unstable; urgency=low
+
+  * Upload to unstable.
+
+ -- Julien Cristau <jcristau@debian.org>  Wed, 06 Jan 2010 13:03:11 +0000
+
+libxext (2:1.1.1-1) experimental; urgency=low
+
+  [ Timo Aaltonen ]
+  * New upstream release (closes: #555999).
+  * Bump the build-dep on xutils-dev (>= 1:7.5~1).
+
+  [ Julien Cristau ]
+  * Add a symbols file for libxext6.
+  * Don't export xgeExtRegister.
+
+ -- Julien Cristau <jcristau@debian.org>  Sat, 28 Nov 2009 15:46:39 +0100
+
+libxext (2:1.0.99.4-1) experimental; urgency=low
+
+  [ Julien Cristau ]
+  * Drop the -1 debian revisions from build-deps.
+  * Drop the XS- prefix from Vcs-* control fields.
+  * libxext6{,-dbg} don't need to depend on x11-common.
+  * Use ${binary:Version} instead of the deprecated ${Source-Version}.
+  * Run autoreconf at build time.
+  * Parse space-separated DEB_BUILD_OPTIONS, handle parallel=N.
+  * Drop Pre-Depends on x11-common.  This was needed for upgrades from sarge.
+  * Bump Standards-Version to 3.8.3
+  * New upstream release.
+  * Bump build-dependencies following configure.ac, and drop libxau-dev
+    (unneeded).
+  * Update libxext-dev.install to install headers.
+  * libxext-dev Depends on new x11proto-xext-dev, and Replaces old one.
+
+  [ Brice Goglin ]
+  * Add a link to www.X.org and a reference to the upstream module
+    in the long description.
+  * Add upstream URL to debian/copyright.
+  * Use updated xsfbs, closes: #538585.
+  * Move -dbg package to section debug.
+
+  [ Timo Aaltonen ]
+  * Add README.source from xsfbs.
+
+ -- Julien Cristau <jcristau@debian.org>  Tue, 29 Sep 2009 11:52:49 +0200
+
+libxext (2:1.0.4-1) unstable; urgency=low
+
+  [ Timo Aaltonen ]
+  * Bump the epoch so that this can be synced to Ubuntu in the future.
+
+  [ Brice Goglin ]
+  * New upstream release.
+  * Update debian/copyright to the new upstream COPYING.
+  * Add myself to Uploaders, remove Fabio and Branden with their permission.
+
+ -- Brice Goglin <bgoglin@debian.org>  Sun, 02 Mar 2008 16:25:56 +0100
+
+libxext (1:1.0.3-2) unstable; urgency=low
+
+  * Put binary packages in the correct sections.
+  * Add XS-Vcs-Browser.
+  * Upload to unstable.
+
+ -- Julien Cristau <jcristau@debian.org>  Wed, 11 Apr 2007 14:45:45 +0200
+
+libxext (1:1.0.3-1) experimental; urgency=low
+
+  * New upstream release.
+    + includes XShm(3) manpage (closes: #128929).
+    + drop manpage sections patch, applied upstream.
+  * Fix typo in package description, thanks to Rakesh 'arky' Ambati
+    (closes: #398487).
+  * Drop obsolete CVS info from the descriptions, and add XS-Vcs-Git.
+  * Install the upstream ChangeLog
+  * Use dh_installman to replace ".so" links with symlinks.
+
+ -- Julien Cristau <jcristau@debian.org>  Fri,  9 Feb 2007 12:14:36 +0100
+
+libxext (1:1.0.1-2) unstable; urgency=low
+
+  [ Andres Salomon ]
+  * Test for obj-$(DEB_BUILD_GNU_TYPE) before creating it during build;
+    idempotency fix.
+
+  [ Drew Parsons ]
+  * dbg package has priority extra.
+
+  [ David Nusinow ]
+  * Make a new manpage section patch to dynamically generate the manpage
+    sections using the libmandir variable that other manpages in the package
+    use
+  * Autoreconf for manpage sections
+
+ -- David Nusinow <dnusinow@debian.org>  Sat, 26 Aug 2006 18:16:06 +0000
+
+libxext (1:1.0.1-1) experimental; urgency=low
+
+  * New upstream release
+  * Run dh_install with --list-missing
+  * Bump debhelper compat to 5
+  * Update manpage location patch to be a lot simpler
+  * Don't try to install headers, as they aren't included
+  * Remove extra dependency on x11-common in libxext-dev
+  * Version libxext-dev's pre-dep on x11-common to be >= 1:7.0.0 to match the
+    rest of Debian and shut up lintian
+  * Re-wrap description of libxext-dev so that it's not too long on any one
+    line
+  * Update standards version to 3.7.2.0
+
+ -- David Nusinow <dnusinow@debian.org>  Mon,  3 Jul 2006 15:41:05 -0400
+
+libxext (1:1.0.0-4) unstable; urgency=low
+
+  * Reorder makeshlib command in rules file so that ldconfig is run
+    properly. Thanks Drew Parsons and Steve Langasek.
+  * Add quilt to build-depends
+
+ -- David Nusinow <dnusinow@debian.org>  Tue, 18 Apr 2006 23:40:53 -0400
+
+libxext (1:1.0.0-3) unstable; urgency=low
+
+  * Upload to unstable
+
+ -- David Nusinow <dnusinow@debian.org>  Thu, 23 Mar 2006 22:44:36 -0500
+
+libxext (1:1.0.0-2) experimental; urgency=low
+
+  * Backport manpage location fix from upstream
+
+ -- David Nusinow <dnusinow@debian.org>  Thu,  9 Mar 2006 23:16:00 -0500
+
+libxext (1:1.0.0-1) experimental; urgency=low
+
+  * First upload to Debian
+
+ -- David Nusinow <dnusinow@debian.org>  Thu, 29 Dec 2005 20:51:38 -0500
+
+libxext (1:6.4.3-3) breezy; urgency=low
+
+  * Bump Build-Depends on x11proto-core-dev and libx11-dev to today's CVS
+    versions, to stop _XOPEN_SOURCE leakage.
+
+ -- Daniel Stone <daniel.stone@ubuntu.com>  Fri, 22 Jul 2005 23:33:51 +1000
+
+libxext (1:6.4.3-2) breezy; urgency=low
+
+  * Add missing build-dep on libxau-dev.
+
+ -- Adam Conrad <adconrad@ubuntu.com>  Fri, 17 Jun 2005 08:42:42 +0000
+
+libxext (1:6.4.3-1) breezy; urgency=low
+
+  * First libxext 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..049766f
--- /dev/null
@@ -0,0 +1,133 @@
+Source: libxext
+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>, Brice Goglin <bgoglin@debian.org>, Cyril Brulebois <kibi@debian.org>
+Build-Depends: debhelper (>= 5.0.0), libx11-dev (>= 2:1.3.3-2), x11proto-core-dev (>= 7.0.13), x11proto-xext-dev (>= 7.0.99.2), pkg-config, automake, libtool, xutils-dev (>= 1:7.5-1slp2+1),
+Standards-Version: 3.9.0
+Vcs-Git: git://git.debian.org/git/pkg-xorg/lib/libxext
+Vcs-Browser: http://git.debian.org/?p=pkg-xorg/lib/libxext.git
+
+Package: libxext6
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: X11 miscellaneous extension library
+ libXext provides an X Window System client interface to several extensions to
+ the X protocol.
+ .
+ The supported protocol extensions are:
+  - DOUBLE-BUFFER (DBE), the Double Buffer extension;
+  - DPMS, the VESA Display Power Management System extension;
+  - Extended-Visual-Information (EVI), an extension for gathering extra
+    information about the X server's visuals;
+  - LBX, the Low Bandwidth X extension;
+  - MIT-SHM, the MIT X client/server shared memory extension;
+  - MIT-SUNDRY-NONSTANDARD, a miscellaneous extension by MIT;
+  - Multi-Buffering, the multi-buffering and stereo display extension;
+  - SECURITY, the X security extension;
+  - SHAPE, the non-rectangular shaped window extension;
+  - SYNC, the X synchronization extension;
+  - TOG-CUP, the Open Group's Colormap Utilization extension;
+  - XC-APPGROUP, the X Consortium's Application Group extension;
+  - XC-MISC, the X Consortium's resource ID querying extension;
+  - XTEST, the X test extension (this is one of two client-side
+    implementations; the other is in the libXtst library, provided by the
+    libxtst6 package);
+ .
+ libXext also provides a small set of utility functions to aid authors of
+ client APIs for X protocol extensions.
+ .
+ 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/libXext
+
+#Package: libxext6-udeb
+##XC-Package-Type: udeb
+#Section: debian-installer
+#Architecture: any
+#Depends: ${shlibs:Depends}, ${misc:Depends}
+#Description: X11 miscellaneous extension library
+# This is a udeb, or a microdeb, for the debian-installer.
+
+Package: libxext6-dbg
+Section: debug
+Architecture: any
+Priority: extra
+Depends: ${shlibs:Depends}, ${misc:Depends}, libxext6 (= ${binary:Version})
+Description: X11 miscellaneous extensions library (debug package)
+ libXext provides an X Window System client interface to several extensions to
+ the X protocol.
+ .
+ The supported protocol extensions are:
+  - DOUBLE-BUFFER (DBE), the Double Buffer extension;
+  - DPMS, the VESA Display Power Management System extension;
+  - Extended-Visual-Information (EVI), an extension for gathering extra
+    information about the X server's visuals;
+  - LBX, the Low Bandwidth X extension;
+  - MIT-SHM, the MIT X client/server shared memory extension;
+  - MIT-SUNDRY-NONSTANDARD, a miscellaneous extension by MIT;
+  - Multi-Buffering, the multi-buffering and stereo display extension;
+  - SECURITY, the X security extension;
+  - SHAPE, the non-rectangular shaped window extension;
+  - SYNC, the X synchronization extension;
+  - TOG-CUP, the Open Group's Colormap Utilization extension;
+  - XC-APPGROUP, the X Consortium's Application Group extension;
+  - XC-MISC, the X Consortium's resource ID querying extension;
+  - XTEST, the X test extension (this is one of two client-side
+    implementations; the other is in the libXtst library, provided by the
+    libxtst6 package);
+ .
+ libXext also provides a small set of utility functions to aid authors of
+ client APIs for X protocol extensions.
+ .
+ This package contains the debug versions of the library found in libxext6.
+ 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/libXext
+
+Package: libxext-dev
+Section: libdevel
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, libxext6 (= ${binary:Version}), x11proto-core-dev, x11proto-xext-dev (>= 7.0.99.2), libx11-dev
+Replaces: x11proto-xext-dev (<< 7.0.99.2)
+Description: X11 miscellaneous extensions library (development headers)
+ libXext provides an X Window System client interface to several extensions to
+ the X protocol.
+ .
+ The supported protocol extensions are:
+  - DOUBLE-BUFFER (DBE), the Double Buffer extension;
+  - DPMS, the VESA Display Power Management System extension;
+  - Extended-Visual-Information (EVI), an extension for gathering extra
+    information about the X server's visuals;
+  - LBX, the Low Bandwidth X extension;
+  - MIT-SHM, the MIT X client/server shared memory extension;
+  - MIT-SUNDRY-NONSTANDARD, a miscellaneous extension by MIT;
+  - Multi-Buffering, the multi-buffering and stereo display extension;
+  - SECURITY, the X security extension;
+  - SHAPE, the non-rectangular shaped window extension;
+  - SYNC, the X synchronization extension;
+  - TOG-CUP, the Open Group's Colormap Utilization extension;
+  - XC-APPGROUP, the X Consortium's Application Group extension;
+  - XC-MISC, the X Consortium's resource ID querying extension;
+  - XTEST, the X test extension (this is one of two client-side
+    implementations; the other is in the libXtst library, provided by the
+    libxtst6 package);
+ .
+ libXext also provides a small set of utility functions to aid authors of
+ client APIs for X protocol extensions.
+ .
+ This package contains the development headers for the library found in 
+ libxext6. 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/libXext
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..4b160be
--- /dev/null
@@ -0,0 +1,185 @@
+This package was downloaded from
+http://xorg.freedesktop.org/releases/individual/lib/
+
+Copyright 1986, 1987, 1988, 1989, 1994, 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 (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
+
+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.
+
+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
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, 
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation 
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital 
+Equipment Corporation.
+
+Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS 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 1992 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 NCD. not be used in advertising or
+publicity pertaining to distribution of the software without specific,
+written prior permission.  NCD. makes no representations about the
+suitability of this software for any purpose.  It is provided "as is"
+without express or implied warranty.
+
+NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
+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 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
+and Olivetti Research Limited, Cambridge, England.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or Olivetti
+not be used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL THEY 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 1986, 1987, 1988 by Hewlett-Packard Corporation
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett-Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Hewlett-Packard makes no representations about the 
+suitability of this software for any purpose.  It is provided 
+"as is" without express or implied warranty.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+Copyright (c) 1994, 1995  Hewlett-Packard Company
+
+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 HEWLETT-PACKARD COMPANY 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 Hewlett-Packard
+Company 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 Hewlett-Packard Company.
+
+Copyright Digital Equipment Corporation, 1996
+
+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.  Digital Equipment Corporation
+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 1999, 2005, 2006 Sun Microsystems, Inc.  All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/debian/libxext-dev.install b/debian/libxext-dev.install
new file mode 100755 (executable)
index 0000000..e35f70a
--- /dev/null
@@ -0,0 +1,6 @@
+usr/share/man/man3/*
+usr/lib/libXext.a
+usr/lib/libXext.so
+usr/lib/libXext.la
+usr/lib/pkgconfig/xext.pc
+usr/include/X11/extensions/
diff --git a/debian/libxext6-udeb.install b/debian/libxext6-udeb.install
new file mode 100644 (file)
index 0000000..5c9aabf
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/libXext.so.6*
diff --git a/debian/libxext6.install b/debian/libxext6.install
new file mode 100644 (file)
index 0000000..5c9aabf
--- /dev/null
@@ -0,0 +1 @@
+usr/lib/libXext.so.6*
diff --git a/debian/libxext6.symbols b/debian/libxext6.symbols
new file mode 100644 (file)
index 0000000..54b7db3
--- /dev/null
@@ -0,0 +1,136 @@
+libXext.so.6 libxext6 #MINVER#
+ DPMSCapable@Base 0
+ DPMSDisable@Base 0
+ DPMSEnable@Base 0
+ DPMSForceLevel@Base 0
+ DPMSGetTimeouts@Base 0
+ DPMSGetVersion@Base 0
+ DPMSInfo@Base 0
+ DPMSQueryExtension@Base 0
+ DPMSSetTimeouts@Base 0
+ XGEQueryExtension@Base 2:1.1
+ XGEQueryVersion@Base 2:1.1
+ XLbxGetEventBase@Base 0
+ XLbxQueryExtension@Base 0
+ XLbxQueryVersion@Base 0
+ XMITMiscGetBugMode@Base 0
+ XMITMiscQueryExtension@Base 0
+ XMITMiscSetBugMode@Base 0
+ XMissingExtension@Base 0
+ XSecurityAllocXauth@Base 0
+ XSecurityFreeXauth@Base 0
+ XSecurityGenerateAuthorization@Base 0
+ XSecurityQueryExtension@Base 0
+ XSecurityRevokeAuthorization@Base 0
+ XSetExtensionErrorHandler@Base 0
+ XShapeCombineMask@Base 0
+ XShapeCombineRectangles@Base 0
+ XShapeCombineRegion@Base 0
+ XShapeCombineShape@Base 0
+ XShapeGetRectangles@Base 0
+ XShapeInputSelected@Base 0
+ XShapeOffsetShape@Base 0
+ XShapeQueryExtension@Base 0
+ XShapeQueryExtents@Base 0
+ XShapeQueryVersion@Base 0
+ XShapeSelectInput@Base 0
+ XShmAttach@Base 0
+ XShmCreateImage@Base 0
+ XShmCreatePixmap@Base 0
+ XShmDetach@Base 0
+ XShmGetEventBase@Base 0
+ XShmGetImage@Base 0
+ XShmPixmapFormat@Base 0
+ XShmPutImage@Base 0
+ XShmQueryExtension@Base 0
+ XShmQueryVersion@Base 0
+ XSyncAwait@Base 0
+ XSyncAwaitFence@Base 2:1.2.0-1slp2
+ XSyncChangeAlarm@Base 0
+ XSyncChangeCounter@Base 0
+ XSyncCreateAlarm@Base 0
+ XSyncCreateCounter@Base 0
+ XSyncCreateFence@Base 2:1.2.0-1slp2
+ XSyncDestroyAlarm@Base 0
+ XSyncDestroyCounter@Base 0
+ XSyncDestroyFence@Base 2:1.2.0-1slp2
+ XSyncFreeSystemCounterList@Base 0
+ XSyncGetPriority@Base 0
+ XSyncInitialize@Base 0
+ XSyncIntToValue@Base 0
+ XSyncIntsToValue@Base 0
+ XSyncListSystemCounters@Base 0
+ XSyncMaxValue@Base 0
+ XSyncMinValue@Base 0
+ XSyncQueryAlarm@Base 0
+ XSyncQueryCounter@Base 0
+ XSyncQueryExtension@Base 0
+ XSyncQueryFence@Base 2:1.2.0-1slp2
+ XSyncResetFence@Base 2:1.2.0-1slp2
+ XSyncSetCounter@Base 0
+ XSyncSetPriority@Base 0
+ XSyncTriggerFence@Base 2:1.2.0-1slp2
+ XSyncValueAdd@Base 0
+ XSyncValueEqual@Base 0
+ XSyncValueGreaterOrEqual@Base 0
+ XSyncValueGreaterThan@Base 0
+ XSyncValueHigh32@Base 0
+ XSyncValueIsNegative@Base 0
+ XSyncValueIsPositive@Base 0
+ XSyncValueIsZero@Base 0
+ XSyncValueLessOrEqual@Base 0
+ XSyncValueLessThan@Base 0
+ XSyncValueLow32@Base 0
+ XSyncValueSubtract@Base 0
+ XTestFakeAckType@Base 0
+ XTestFakeInput@Base 0
+ XTestFlush@Base 0
+ XTestGetInput@Base 0
+ XTestInputActionType@Base 0
+ XTestMovePointer@Base 0
+ XTestPressButton@Base 0
+ XTestPressKey@Base 0
+ XTestQueryInputSize@Base 0
+ XTestReset@Base 0
+ XTestStopInput@Base 0
+ XagCreateAssociation@Base 0
+ XagCreateEmbeddedApplicationGroup@Base 0
+ XagCreateNonembeddedApplicationGroup@Base 0
+ XagDestroyApplicationGroup@Base 0
+ XagDestroyAssociation@Base 0
+ XagGetApplicationGroupAttributes@Base 0
+ XagQueryApplicationGroup@Base 0
+ XagQueryVersion@Base 0
+ XcupGetReservedColormapEntries@Base 0
+ XcupQueryVersion@Base 0
+ XcupStoreColors@Base 0
+ XdbeAllocateBackBufferName@Base 0
+ XdbeBeginIdiom@Base 0
+ XdbeDeallocateBackBufferName@Base 0
+ XdbeEndIdiom@Base 0
+ XdbeFreeVisualInfo@Base 0
+ XdbeGetBackBufferAttributes@Base 0
+ XdbeGetVisualInfo@Base 0
+ XdbeQueryExtension@Base 0
+ XdbeSwapBuffers@Base 0
+ XeviGetVisualInfo@Base 0
+ XeviQueryExtension@Base 0
+ XeviQueryVersion@Base 0
+ XextAddDisplay@Base 0
+ XextCreateExtension@Base 0
+ XextDestroyExtension@Base 0
+ XextFindDisplay@Base 0
+ XextRemoveDisplay@Base 0
+ XmbufChangeBufferAttributes@Base 0
+ XmbufChangeWindowAttributes@Base 0
+ XmbufClearBufferArea@Base 0
+ XmbufCreateBuffers@Base 0
+ XmbufCreateStereoWindow@Base 0
+ XmbufDestroyBuffers@Base 0
+ XmbufDisplayBuffers@Base 0
+ XmbufGetBufferAttributes@Base 0
+ XmbufGetScreenInfo@Base 0
+ XmbufGetVersion@Base 0
+ XmbufGetWindowAttributes@Base 0
+ XmbufQueryExtension@Base 0
+ _XExtensionErrorFunction@Base 0
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..00c17b4
--- /dev/null
@@ -0,0 +1,102 @@
+#!/usr/bin/make -f
+# debian/rules for the Debian libxext 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 = libxext6
+
+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: $(STAMP_DIR)/patch
+       dh_testdir
+       autoreconf -vfi
+       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.h.in config.sub configure
+       rm -f depcomp install-sh ltmain.sh missing mkinstalldirs
+       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_link
+#      dh_installman
+       dh_strip --dbg-package=$(PACKAGE)-dbg
+       dh_compress
+       dh_fixperms
+       dh_makeshlibs -- -c4
+#      dh_makeshlibs --add-udeb=$(PACKAGE)-udeb -- -c4
+       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..03b9300
--- /dev/null
@@ -0,0 +1,2 @@
+version=3
+http://xorg.freedesktop.org/releases/individual/lib/ libXext-(.*)\.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/MITMisc.h b/include/X11/extensions/MITMisc.h
new file mode 100755 (executable)
index 0000000..4cfb334
--- /dev/null
@@ -0,0 +1,54 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
+
+#ifndef _XMITMISC_H_
+#define _XMITMISC_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/mitmiscconst.h>
+
+_XFUNCPROTOBEGIN
+
+Bool XMITMiscQueryExtension(
+    Display*           /* dpy */,
+    int*               /* event_basep */,
+    int*               /* error_basep */
+);
+
+Status XMITMiscSetBugMode(
+    Display*           /* dpy */,
+    Bool               /* onOff */
+);
+
+Bool XMITMiscGetBugMode(
+    Display*           /* dpy */
+);
+
+_XFUNCPROTOEND
+
+#endif
diff --git a/include/X11/extensions/XEVI.h b/include/X11/extensions/XEVI.h
new file mode 100755 (executable)
index 0000000..9ca4412
--- /dev/null
@@ -0,0 +1,61 @@
+/************************************************************
+Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS 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 _XEVI_H_
+#define _XEVI_H_
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/EVI.h>
+
+typedef struct {
+    VisualID           core_visual_id;
+    int                        screen;
+    int                        level;
+    unsigned int       transparency_type;
+    unsigned int       transparency_value;
+    unsigned int       min_hw_colormaps;
+    unsigned int       max_hw_colormaps;
+    unsigned int       num_colormap_conflicts;
+    VisualID*          colormap_conflicts;
+} ExtendedVisualInfo;
+
+_XFUNCPROTOBEGIN
+
+Bool XeviQueryExtension(
+    Display*            /* dpy */
+);
+Status XeviQueryVersion(
+    Display*           /* dpy */,
+    int*               /* majorVersion */,
+    int*               /* minorVersion */
+);
+Status XeviGetVisualInfo(
+    Display*                   /* dpy */,
+    VisualID*                  /* visual_query */,
+    int                                /* nVisual_query */,
+    ExtendedVisualInfo**       /* extendedVisualInfo_return */,
+    int*                       /* nInfo_return */
+);
+
+_XFUNCPROTOEND
+
+#endif
diff --git a/include/X11/extensions/XLbx.h b/include/X11/extensions/XLbx.h
new file mode 100755 (executable)
index 0000000..ce8c835
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright 1992 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 NCD. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  NCD. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
+ * 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 _XLBX_H_
+#define _XLBX_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/Xdefs.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/lbx.h>
+
+_XFUNCPROTOBEGIN
+
+Bool XLbxQueryExtension(
+    Display*           /* dpy */,
+    int*               /* requestp */,
+    int*               /* event_basep */,
+    int*               /* error_basep */
+);
+
+Bool XLbxQueryVersion(
+    Display*           /* dpy */,
+    int*               /* majorVersion */,
+    int*               /* minorVersion */
+);
+
+int XLbxGetEventBase(Display *dpy);
+
+_XFUNCPROTOEND
+
+#endif
diff --git a/include/X11/extensions/XShm.h b/include/X11/extensions/XShm.h
new file mode 100755 (executable)
index 0000000..af1baea
--- /dev/null
@@ -0,0 +1,135 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
+
+#ifndef _XSHM_H_
+#define _XSHM_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/shm.h>
+
+#ifndef _XSHM_SERVER_
+typedef unsigned long ShmSeg;
+
+typedef struct {
+    int        type;               /* of event */
+    unsigned long serial;   /* # of last request processed by server */
+    Bool send_event;       /* true if this came frome a SendEvent request */
+    Display *display;      /* Display the event was read from */
+    Drawable drawable;     /* drawable of request */
+    int major_code;        /* ShmReqCode */
+    int minor_code;        /* X_ShmPutImage */
+    ShmSeg shmseg;         /* the ShmSeg used in the request */
+    unsigned long offset;   /* the offset into ShmSeg used in the request */
+} XShmCompletionEvent;
+
+typedef struct {
+    ShmSeg shmseg;     /* resource id */
+    int shmid;         /* kernel id */
+    char *shmaddr;     /* address in client */
+    Bool readOnly;     /* how the server should attach it */
+} XShmSegmentInfo;
+
+_XFUNCPROTOBEGIN
+
+Bool XShmQueryExtension(
+    Display*           /* dpy */
+);
+
+int XShmGetEventBase(
+    Display*           /* dpy */
+);
+
+Bool XShmQueryVersion(
+    Display*           /* dpy */,
+    int*               /* majorVersion */,
+    int*               /* minorVersion */,
+    Bool*              /* sharedPixmaps */
+);
+
+int XShmPixmapFormat(
+    Display*           /* dpy */
+);
+
+Status XShmAttach(
+    Display*           /* dpy */,
+    XShmSegmentInfo*   /* shminfo */
+);
+
+Status XShmDetach(
+    Display*           /* dpy */,
+    XShmSegmentInfo*   /* shminfo */
+);
+
+Status XShmPutImage(
+    Display*           /* dpy */,
+    Drawable           /* d */,
+    GC                 /* gc */,
+    XImage*            /* image */,
+    int                        /* src_x */,
+    int                        /* src_y */,
+    int                        /* dst_x */,
+    int                        /* dst_y */,
+    unsigned int       /* src_width */,
+    unsigned int       /* src_height */,
+    Bool               /* send_event */
+);
+
+Status XShmGetImage(
+    Display*           /* dpy */,
+    Drawable           /* d */,
+    XImage*            /* image */,
+    int                        /* x */,
+    int                        /* y */,
+    unsigned long      /* plane_mask */
+);
+
+XImage *XShmCreateImage(
+    Display*           /* dpy */,
+    Visual*            /* visual */,
+    unsigned int       /* depth */,
+    int                        /* format */,
+    char*              /* data */,
+    XShmSegmentInfo*   /* shminfo */,
+    unsigned int       /* width */,
+    unsigned int       /* height */
+);
+
+Pixmap XShmCreatePixmap(
+    Display*           /* dpy */,
+    Drawable           /* d */,
+    char*              /* data */,
+    XShmSegmentInfo*   /* shminfo */,
+    unsigned int       /* width */,
+    unsigned int       /* height */,
+    unsigned int       /* depth */
+);
+
+_XFUNCPROTOEND
+#endif /* _XSHM_SERVER_ */
+
+#endif
diff --git a/include/X11/extensions/Xag.h b/include/X11/extensions/Xag.h
new file mode 100755 (executable)
index 0000000..9f69f78
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+Copyright 1996, 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 _XAG_H_
+#define _XAG_H_
+
+#include <X11/extensions/ag.h>
+#include <X11/Xfuncproto.h>
+
+#include <stdarg.h>
+
+_XFUNCPROTOBEGIN
+
+typedef XID XAppGroup;
+
+Bool XagQueryVersion(
+    Display*                   /* dpy */,
+    int*                       /* major_version */,
+    int*                       /* minor_version */
+);
+
+Status XagCreateEmbeddedApplicationGroup(
+    Display*                   /* dpy */,
+    VisualID                   /* root_visual */,
+    Colormap                   /* default_colormap */,
+    unsigned long              /* black_pixel */,
+    unsigned long              /* white_pixel */,
+    XAppGroup*                 /* app_group_return */
+);
+
+Status XagCreateNonembeddedApplicationGroup(
+    Display*                   /* dpy */,
+    XAppGroup*                 /* app_group_return */
+);
+
+Status XagDestroyApplicationGroup(
+    Display*                   /* dpy */,
+    XAppGroup                  /* app_group */
+);
+
+Status XagGetApplicationGroupAttributes(
+    Display*                   /* dpy */,
+    XAppGroup                  /* app_group */,
+    ...
+);
+
+Status XagQueryApplicationGroup(
+    Display*                   /* dpy */,
+    XID                                /* resource_base */,
+    XAppGroup*                 /* app_group_ret */
+);
+
+Status XagCreateAssociation(
+    Display*                   /* dpy */,
+    Window*                    /* window_ret */,
+    void*                      /* system_window */
+);
+
+Status XagDestroyAssociation(
+    Display*                   /* dpy */,
+    Window                     /* window */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XAG_H_ */
+
diff --git a/include/X11/extensions/Xcup.h b/include/X11/extensions/Xcup.h
new file mode 100755 (executable)
index 0000000..c8074cf
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+
+Copyright 1987, 1988, 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 _XCUP_H_
+#define _XCUP_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/cup.h>
+
+_XFUNCPROTOBEGIN
+
+Bool XcupQueryVersion(
+    Display*                   /* dpy */,
+    int*                       /* major_version */,
+    int*                       /* minor_version */
+);
+
+Status XcupGetReservedColormapEntries(
+    Display*                   /* dpy */,
+    int                                /* screen */,
+    XColor**                   /* colors_out */,
+    int*                       /* ncolors */
+);
+
+Status XcupStoreColors(
+    Display*                   /* dpy */,
+    Colormap                   /* colormap */,
+    XColor*                    /* colors */,
+    int                                /* ncolors */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _XCUP_H_ */
+
diff --git a/include/X11/extensions/Xdbe.h b/include/X11/extensions/Xdbe.h
new file mode 100755 (executable)
index 0000000..14ce53d
--- /dev/null
@@ -0,0 +1,138 @@
+/******************************************************************************
+ * 
+ * Copyright (c) 1994, 1995  Hewlett-Packard Company
+ *
+ * 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 HEWLETT-PACKARD COMPANY 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 Hewlett-Packard
+ * Company 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 Hewlett-Packard Company.
+ * 
+ *     Header file for Xlib-related DBE
+ *
+ *****************************************************************************/
+
+#ifndef XDBE_H
+#define XDBE_H
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/dbe.h>
+
+typedef struct
+{
+    VisualID    visual;    /* one visual ID that supports double-buffering */
+    int         depth;     /* depth of visual in bits                      */
+    int         perflevel; /* performance level of visual                  */
+}
+XdbeVisualInfo;
+
+typedef struct
+{
+    int                 count;          /* number of items in visual_depth   */
+    XdbeVisualInfo      *visinfo;       /* list of visuals & depths for scrn */
+}
+XdbeScreenVisualInfo;
+
+
+typedef Drawable XdbeBackBuffer;
+
+typedef unsigned char XdbeSwapAction;
+
+typedef struct
+{
+    Window             swap_window;    /* window for which to swap buffers   */
+    XdbeSwapAction     swap_action;    /* swap action to use for swap_window */
+}
+XdbeSwapInfo;
+
+typedef struct
+{
+    Window     window;                 /* window that buffer belongs to */
+}
+XdbeBackBufferAttributes;
+
+typedef struct
+{
+    int                        type;
+    Display            *display;       /* display the event was read from */
+    XdbeBackBuffer     buffer;         /* resource id                     */
+    unsigned long      serial;         /* serial number of failed request */
+    unsigned char      error_code;     /* error base + XdbeBadBuffer      */
+    unsigned char      request_code;   /* major opcode of failed request  */
+    unsigned char      minor_code;     /* minor opcode of failed request  */
+}
+XdbeBufferError;
+
+/* _XFUNCPROTOBEGIN and _XFUNCPROTOEND are defined as noops
+ * (for non-C++ builds) in X11/Xfuncproto.h.
+ */
+_XFUNCPROTOBEGIN
+
+extern Status XdbeQueryExtension(
+    Display*           /* dpy                  */,
+    int*               /* major_version_return */,
+    int*               /* minor_version_return */
+);
+
+extern XdbeBackBuffer XdbeAllocateBackBufferName(
+    Display*           /* dpy         */,
+    Window             /* window      */,
+    XdbeSwapAction     /* swap_action */
+);
+
+extern Status XdbeDeallocateBackBufferName(
+    Display*           /* dpy    */,
+    XdbeBackBuffer     /* buffer */
+);
+
+extern Status XdbeSwapBuffers(
+    Display*           /* dpy         */,
+    XdbeSwapInfo*      /* swap_info   */,
+    int                        /* num_windows */
+);
+
+extern Status XdbeBeginIdiom(
+    Display*           /* dpy */
+);
+
+extern Status XdbeEndIdiom(
+    Display*           /* dpy */
+);
+
+extern XdbeScreenVisualInfo *XdbeGetVisualInfo(
+    Display*           /* dpy               */,
+    Drawable*          /* screen_specifiers */,
+    int*               /* num_screens       */
+);
+
+extern void XdbeFreeVisualInfo(
+    XdbeScreenVisualInfo*      /* visual_info */
+);
+
+extern XdbeBackBufferAttributes *XdbeGetBackBufferAttributes(
+    Display*           /* dpy    */,
+    XdbeBackBuffer     /* buffer */
+);
+
+_XFUNCPROTOEND
+
+#endif /* XDBE_H */
+
diff --git a/include/X11/extensions/Xext.h b/include/X11/extensions/Xext.h
new file mode 100755 (executable)
index 0000000..858592b
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+#ifndef _XEXT_H_
+#define _XEXT_H_
+
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+typedef int (*XextErrorHandler) (
+    Display *          /* dpy */,
+    _Xconst char*      /* ext_name */,
+    _Xconst char*      /* reason */
+);
+
+extern XextErrorHandler XSetExtensionErrorHandler(
+    XextErrorHandler   /* handler */
+);
+
+extern int XMissingExtension(
+    Display*           /* dpy */,
+    _Xconst char*      /* ext_name */
+);
+
+_XFUNCPROTOEND
+
+#define X_EXTENSION_UNKNOWN "unknown"
+#define X_EXTENSION_MISSING "missing"
+
+#endif /* _XEXT_H_ */
diff --git a/include/X11/extensions/Xge.h b/include/X11/extensions/Xge.h
new file mode 100644 (file)
index 0000000..51382ff
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright © 2007-2008 Peter Hutterer
+ *
+ * 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.
+ *
+ * Authors: Peter Hutterer, University of South Australia, NICTA
+ *
+ */
+
+
+/* XGE Client interfaces */
+
+#ifndef _XGE_H_
+#define _XGE_H_
+
+#include <X11/Xlib.h>
+#include <X11/Xfuncproto.h>
+
+_XFUNCPROTOBEGIN
+
+/**
+ * Generic Event mask. 
+ * To be used whenever a list of masks per extension has to be provided.
+ *
+ * But, don't actually use the CARD{8,16,32} types.  We can't get them them
+ * defined here without polluting the namespace.
+ */
+typedef struct {
+    unsigned char       extension;
+    unsigned char       pad0;
+    unsigned short      pad1;
+    unsigned int      evmask;
+} XGenericEventMask;
+
+Bool XGEQueryExtension(Display* dpy, int *event_basep, int *err_basep);
+Bool XGEQueryVersion(Display* dpy, int *major, int* minor);
+
+_XFUNCPROTOEND
+
+#endif /* _XGE_H_ */
diff --git a/include/X11/extensions/dpms.h b/include/X11/extensions/dpms.h
new file mode 100755 (executable)
index 0000000..57e98f8
--- /dev/null
@@ -0,0 +1,53 @@
+/*****************************************************************
+
+Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
+
+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.
+
+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
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, 
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation 
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital 
+Equipment Corporation.
+
+******************************************************************/
+
+#ifndef _X11_EXTENSIONS_DPMS_H
+#define _X11_EXTENSIONS_DPMS_H 1
+
+#include <X11/X.h>
+#include <X11/Xmd.h>
+#include <X11/extensions/dpmsconst.h>
+
+#ifndef DPMS_SERVER
+_XFUNCPROTOBEGIN
+
+extern Bool DPMSQueryExtension(Display *, int *, int *);
+extern Status DPMSGetVersion(Display *, int *, int *);
+extern Bool DPMSCapable(Display *);
+extern Status DPMSSetTimeouts(Display *, CARD16, CARD16, CARD16);
+extern Bool DPMSGetTimeouts(Display *, CARD16 *, CARD16 *, CARD16 *);
+extern Status DPMSEnable(Display *);
+extern Status DPMSDisable(Display *);
+extern Status DPMSForceLevel(Display *, CARD16);
+extern Status DPMSInfo(Display *, CARD16 *, BOOL *);
+
+_XFUNCPROTOEND
+#endif
+
+#endif /* !_X11_EXTENSIONS_DPMS_H */
+
diff --git a/include/X11/extensions/extutil.h b/include/X11/extensions/extutil.h
new file mode 100755 (executable)
index 0000000..031c520
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author:  Jim Fulton, MIT The Open Group
+ * 
+ *                     Xlib Extension-Writing Utilities
+ *
+ * This package contains utilities for writing the client API for various
+ * protocol extensions.  THESE INTERFACES ARE NOT PART OF THE X STANDARD AND
+ * ARE SUBJECT TO CHANGE!
+ */
+
+#ifndef _EXTUTIL_H_
+#define _EXTUTIL_H_
+
+#include <X11/extensions/Xext.h>
+
+/*
+ * We need to keep a list of open displays since the Xlib display list isn't
+ * public.  We also have to per-display info in a separate block since it isn't
+ * stored directly in the Display structure.
+ */
+typedef struct _XExtDisplayInfo {
+    struct _XExtDisplayInfo *next;     /* keep a linked list */
+    Display *display;                  /* which display this is */
+    XExtCodes *codes;                  /* the extension protocol codes */
+    XPointer data;                     /* extra data for extension to use */
+} XExtDisplayInfo;
+
+typedef struct _XExtensionInfo {
+    XExtDisplayInfo *head;             /* start of list */
+    XExtDisplayInfo *cur;              /* most recently used */
+    int ndisplays;                     /* number of displays */
+} XExtensionInfo;
+
+typedef struct _XExtensionHooks {
+    int (*create_gc)(
+             Display*                  /* display */,
+             GC                        /* gc */,
+             XExtCodes*                /* codes */
+);
+    int (*copy_gc)(
+             Display*                  /* display */,
+              GC                       /* gc */,
+              XExtCodes*               /* codes */
+);
+    int (*flush_gc)(
+             Display*                  /* display */,
+              GC                       /* gc */,
+              XExtCodes*               /* codes */
+);
+    int (*free_gc)(
+             Display*                  /* display */,
+              GC                       /* gc */,
+              XExtCodes*               /* codes */
+);
+    int (*create_font)(
+             Display*                  /* display */,
+              XFontStruct*             /* fs */,
+              XExtCodes*               /* codes */
+);
+    int (*free_font)(
+             Display*                  /* display */,
+              XFontStruct*             /* fs */,
+              XExtCodes*               /* codes */
+);
+    int (*close_display)(
+             Display*                  /* display */,
+              XExtCodes*               /* codes */
+);
+    Bool (*wire_to_event)(
+              Display*                 /* display */,
+               XEvent*                 /* re */,
+               xEvent*                 /* event */
+);
+    Status (*event_to_wire)(
+             Display*                  /* display */,
+              XEvent*                  /* re */,
+              xEvent*                  /* event */
+);
+    int (*error)(
+             Display*                  /* display */,
+              xError*                  /* err */,
+              XExtCodes*               /* codes */,
+              int*                     /* ret_code */
+);
+    char *(*error_string)(
+               Display*                /* display */,
+                int                    /* code */,
+                XExtCodes*             /* codes */,
+                char*                  /* buffer */,
+                int                    /* nbytes */
+);
+} XExtensionHooks;
+
+extern XExtensionInfo *XextCreateExtension(
+    void
+);
+extern void XextDestroyExtension(
+    XExtensionInfo*    /* info */
+);
+extern XExtDisplayInfo *XextAddDisplay(
+    XExtensionInfo*    /* extinfo */,
+    Display*           /* dpy */,
+    char*              /* ext_name */,
+    XExtensionHooks*   /* hooks */,
+    int                        /* nevents */,
+    XPointer           /* data */
+);
+extern int XextRemoveDisplay(
+    XExtensionInfo*    /* extinfo */,
+    Display*           /* dpy */
+);
+extern XExtDisplayInfo *XextFindDisplay(
+    XExtensionInfo*    /* extinfo */,
+    Display*           /* dpy */
+);
+
+#define XextHasExtension(i) ((i) && ((i)->codes))
+#define XextCheckExtension(dpy,i,name,val) \
+  if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return val; }
+#define XextSimpleCheckExtension(dpy,i,name) \
+  if (!XextHasExtension(i)) { XMissingExtension (dpy, name); return; }
+
+
+/*
+ * helper macros to generate code that is common to all extensions; caller
+ * should prefix it with static if extension source is in one file; this
+ * could be a utility function, but have to stack 6 unused arguments for 
+ * something that is called many, many times would be bad.
+ */
+#define XEXT_GENERATE_FIND_DISPLAY(proc,extinfo,extname,hooks,nev,data) \
+XExtDisplayInfo *proc (Display *dpy) \
+{ \
+    XExtDisplayInfo *dpyinfo; \
+    if (!extinfo) { if (!(extinfo = XextCreateExtension())) return NULL; } \
+    if (!(dpyinfo = XextFindDisplay (extinfo, dpy))) \
+      dpyinfo = XextAddDisplay (extinfo,dpy,extname,hooks,nev,data); \
+    return dpyinfo; \
+}
+
+#define XEXT_FIND_DISPLAY_PROTO(proc) \
+       XExtDisplayInfo *proc(Display *dpy)
+
+#define XEXT_GENERATE_CLOSE_DISPLAY(proc,extinfo) \
+int proc (Display *dpy, XExtCodes *codes) \
+{ \
+    return XextRemoveDisplay (extinfo, dpy); \
+}
+
+#define XEXT_CLOSE_DISPLAY_PROTO(proc) \
+       int proc(Display *dpy, XExtCodes *codes)
+
+#define XEXT_GENERATE_ERROR_STRING(proc,extname,nerr,errl) \
+char *proc (Display *dpy, int code, XExtCodes *codes, char *buf, int n) \
+{  \
+    code -= codes->first_error;  \
+    if (code >= 0 && code < nerr) { \
+       char tmp[256]; \
+       sprintf (tmp, "%s.%d", extname, code); \
+       XGetErrorDatabaseText (dpy, "XProtoError", tmp, errl[code], buf, n); \
+       return buf; \
+    } \
+    return (char *)0; \
+}
+
+#define XEXT_ERROR_STRING_PROTO(proc) \
+       char *proc(Display *dpy, int code, XExtCodes *codes, char *buf, int n)
+#endif
diff --git a/include/X11/extensions/multibuf.h b/include/X11/extensions/multibuf.h
new file mode 100755 (executable)
index 0000000..12fda35
--- /dev/null
@@ -0,0 +1,213 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+#ifndef _MULTIBUF_H_
+#define _MULTIBUF_H_
+
+#include <X11/Xfuncproto.h>
+
+#include <X11/extensions/multibufconst.h>
+
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define MbufGetReq(name,req,info) GetReq (name, req); \
+       req->reqType = info->codes->major_opcode; \
+       req->mbufReqType = X_##name;
+#else
+#define MbufGetReq(name,req,info) GetReq (name, req); \
+       req->reqType = info->codes->major_opcode; \
+       req->mbufReqType = X_/**/name;
+#endif
+
+/*
+ * Extra definitions that will only be needed in the client
+ */
+typedef XID Multibuffer;
+
+typedef struct {
+    int        type;               /* of event */
+    unsigned long serial;   /* # of last request processed by server */
+    int send_event;        /* true if this came frome a SendEvent request */
+    Display *display;      /* Display the event was read from */
+    Multibuffer buffer;            /* buffer of event */
+    int        state;              /* see Clobbered constants above */
+} XmbufClobberNotifyEvent;
+
+typedef struct {
+    int        type;               /* of event */
+    unsigned long serial;   /* # of last request processed by server */
+    int send_event;        /* true if this came frome a SendEvent request */
+    Display *display;      /* Display the event was read from */
+    Multibuffer buffer;            /* buffer of event */
+} XmbufUpdateNotifyEvent;
+
+
+/*
+ * per-window attributes that can be got
+ */
+typedef struct {
+    int displayed_index;       /* which buffer is being displayed */
+    int update_action;         /* Undefined, Background, Untouched, Copied */
+    int update_hint;           /* Frequent, Intermittent, Static */
+    int window_mode;           /* Mono, Stereo */
+    int nbuffers;              /* Number of buffers */
+    Multibuffer *buffers;      /* Buffers */
+} XmbufWindowAttributes;
+
+/*
+ * per-window attributes that can be set
+ */
+typedef struct {
+    int update_hint;           /* Frequent, Intermittent, Static */
+} XmbufSetWindowAttributes;
+
+
+/*
+ * per-buffer attributes that can be got
+ */
+typedef struct {
+    Window window;             /* which window this belongs to */
+    unsigned long event_mask;  /* events that have been selected */
+    int buffer_index;          /* which buffer is this */
+    int side;                  /* Mono, Left, Right */
+} XmbufBufferAttributes;
+
+/*
+ * per-buffer attributes that can be set
+ */
+typedef struct {
+    unsigned long event_mask;  /* events that have been selected */
+} XmbufSetBufferAttributes;
+
+
+/*
+ * per-screen buffer info (there will be lists of them)
+ */
+typedef struct {
+    VisualID visualid;         /* visual usuable at this depth */
+    int max_buffers;           /* most buffers for this visual */
+    int depth;                 /* depth of buffers to be created */
+} XmbufBufferInfo;
+
+_XFUNCPROTOBEGIN
+
+extern Bool XmbufQueryExtension(
+    Display*           /* dpy */,
+    int*               /* event_base_return */,
+    int*               /* error_base_return */
+);
+
+extern Status XmbufGetVersion(
+    Display*           /* dpy */,
+    int*               /* major_version_return */,
+    int*               /* minor_version_return */
+);
+
+extern int XmbufCreateBuffers(
+    Display*           /* dpy */,
+    Window             /* w */,
+    int                        /* count */,
+    int                        /* update_action */,
+    int                        /* update_hint */,
+    Multibuffer*       /* buffers */
+);
+
+extern void XmbufDestroyBuffers(
+    Display*           /* dpy */,
+    Window             /* window */
+);
+
+extern void XmbufDisplayBuffers(
+    Display*           /* dpy */,
+    int                        /* count */,
+    Multibuffer*       /* buffers */,
+    int                        /* min_delay */,
+    int                        /* max_delay */
+);
+
+extern Status XmbufGetWindowAttributes(
+    Display*                   /* dpy */,
+    Window                     /* w */,
+    XmbufWindowAttributes*     /* attr */
+);
+
+extern void XmbufChangeWindowAttributes(
+    Display*                   /* dpy */,
+    Window                     /* w */,
+    unsigned long              /* valuemask */,
+    XmbufSetWindowAttributes*  /* attr */
+);
+
+extern Status XmbufGetBufferAttributes(
+    Display*                   /* dpy */,
+    Multibuffer                        /* b */,
+    XmbufBufferAttributes*     /* attr */
+);
+
+extern void XmbufChangeBufferAttributes(
+    Display*                   /* dpy */,
+    Multibuffer                        /* b */,
+    unsigned long              /* valuemask */,
+    XmbufSetBufferAttributes*  /* attr */
+);
+
+extern Status XmbufGetScreenInfo(
+    Display*                   /* dpy */,
+    Drawable                   /* d */,
+    int*                       /* nmono_return */,
+    XmbufBufferInfo**          /* mono_info_return */,
+    int*                       /* nstereo_return */,
+    XmbufBufferInfo**          /* stereo_info_return */
+);
+
+extern Window XmbufCreateStereoWindow(
+    Display*                   /* dpy */,
+    Window                     /* parent */,
+    int                                /* x */,
+    int                                /* y */,
+    unsigned int               /* width */,
+    unsigned int               /* height */,
+    unsigned int               /* border_width */,
+    int                                /* depth */,
+    unsigned int               /* class */,
+    Visual*                    /* visual */,
+    unsigned long              /* valuemask */,
+    XSetWindowAttributes*      /* attr */,
+    Multibuffer*               /* leftp */,
+    Multibuffer*               /* rightp */
+);
+
+extern void XmbufClearBufferArea(
+    Display*                   /* dpy */,
+    Multibuffer                        /* buffer */,
+    int                                /* x */,
+    int                                /* y */,
+    unsigned int               /* width */,
+    unsigned int               /* height */,
+    Bool                       /* exposures */
+);
+
+_XFUNCPROTOEND
+
+#endif /* _MULTIBUF_H_ */
diff --git a/include/X11/extensions/security.h b/include/X11/extensions/security.h
new file mode 100755 (executable)
index 0000000..f554131
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+Copyright 1996, 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 _SECURITY_H
+#define _SECURITY_H
+
+#define _XAUTH_STRUCT_ONLY
+#include <X11/Xauth.h>
+
+#include <X11/extensions/secur.h>
+
+_XFUNCPROTOBEGIN
+
+Status XSecurityQueryExtension (
+    Display *dpy,
+    int *major_version_return,
+    int *minor_version_return);
+
+Xauth *XSecurityAllocXauth(void);
+
+void XSecurityFreeXauth(Xauth *auth);
+
+/* type for returned auth ids */
+typedef unsigned long XSecurityAuthorization;
+
+typedef struct {
+    unsigned int timeout;
+    unsigned int trust_level;
+    XID          group;
+    long        event_mask;
+} XSecurityAuthorizationAttributes;
+
+Xauth *XSecurityGenerateAuthorization(
+    Display *dpy,
+    Xauth *auth_in,
+    unsigned long valuemask,
+    XSecurityAuthorizationAttributes *attributes,
+    XSecurityAuthorization *auth_id_return);
+
+Status XSecurityRevokeAuthorization(
+    Display *dpy,
+    XSecurityAuthorization auth_id);
+
+_XFUNCPROTOEND
+
+typedef struct {
+    int type;                /* event base + XSecurityAuthorizationRevoked */
+    unsigned long serial;     /* # of last request processed by server */
+    Bool send_event;         /* true if this came from a SendEvent request */
+    Display *display;        /* Display the event was read from */
+    XSecurityAuthorization auth_id; /* revoked authorization id */
+} XSecurityAuthorizationRevokedEvent;
+
+#endif /* _SECURITY_H */
diff --git a/include/X11/extensions/shape.h b/include/X11/extensions/shape.h
new file mode 100755 (executable)
index 0000000..66af5b1
--- /dev/null
@@ -0,0 +1,152 @@
+/************************************************************
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+#ifndef _SHAPE_H_
+#define _SHAPE_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/shapeconst.h>
+
+#ifndef _SHAPE_SERVER_
+#include <X11/Xutil.h>
+
+typedef struct {
+    int        type;               /* of event */
+    unsigned long serial;   /* # of last request processed by server */
+    Bool send_event;       /* true if this came frome a SendEvent request */
+    Display *display;      /* Display the event was read from */
+    Window window;         /* window of event */
+    int kind;              /* ShapeBounding or ShapeClip */
+    int x, y;              /* extents of new region */
+    unsigned width, height;
+    Time time;             /* server timestamp when region changed */
+    Bool shaped;           /* true if the region exists */
+} XShapeEvent;
+
+_XFUNCPROTOBEGIN
+
+extern Bool XShapeQueryExtension (
+    Display*   /* display */,
+    int*       /* event_base */,
+    int*       /* error_base */
+);
+
+extern Status XShapeQueryVersion (
+    Display*   /* display */,
+    int*       /* major_version */,
+    int*       /* minor_version */
+);
+
+extern void XShapeCombineRegion (
+    Display*   /* display */,
+    Window     /* dest */,
+    int                /* dest_kind */,
+    int                /* x_off */,
+    int                /* y_off */,
+    Region     /* region */,
+    int                /* op */
+);
+
+extern void XShapeCombineRectangles (
+    Display*   /* display */,
+    Window     /* dest */,
+    int                /* dest_kind */,
+    int                /* x_off */,
+    int                /* y_off */,
+    XRectangle*        /* rectangles */,
+    int                /* n_rects */,
+    int                /* op */,
+    int                /* ordering */
+);
+
+extern void XShapeCombineMask (
+    Display*   /* display */,
+    Window     /* dest */,
+    int                /* dest_kind */,
+    int                /* x_off */,
+    int                /* y_off */,
+    Pixmap     /* src */,
+    int                /* op */
+);
+
+extern void XShapeCombineShape (
+    Display*   /* display */,
+    Window     /* dest */,
+    int                /* dest_kind */,
+    int                /* x_off */,
+    int                /* y_off */,
+    Window     /* src */,
+    int                /* src_kind */,
+    int                /* op */
+);
+
+extern void XShapeOffsetShape (
+    Display*   /* display */,
+    Window     /* dest */,
+    int                /* dest_kind */,
+    int                /* x_off */,
+    int                /* y_off */
+);
+
+extern Status XShapeQueryExtents (
+    Display*           /* display */,
+    Window             /* window */,
+    Bool*              /* bounding_shaped */,
+    int*               /* x_bounding */,
+    int*               /* y_bounding */,
+    unsigned int*      /* w_bounding */,
+    unsigned int*      /* h_bounding */,
+    Bool*              /* clip_shaped */,
+    int*               /* x_clip */,
+    int*               /* y_clip */,
+    unsigned int*      /* w_clip */,
+    unsigned int*      /* h_clip */
+);
+
+extern void XShapeSelectInput (
+    Display*           /* display */,
+    Window             /* window */,
+    unsigned long      /* mask */
+);
+
+extern unsigned long XShapeInputSelected (
+    Display*   /* display */,
+    Window     /* window */
+);
+
+extern XRectangle *XShapeGetRectangles (
+    Display*   /* display */,
+    Window     /* window */,
+    int                /* kind */,
+    int*       /* count */,
+    int*       /* ordering */
+);
+
+_XFUNCPROTOEND
+
+#endif /* !_SHAPE_SERVER_ */
+
+#endif /* _SHAPE_H_ */
diff --git a/include/X11/extensions/sync.h b/include/X11/extensions/sync.h
new file mode 100755 (executable)
index 0000000..a00d9c5
--- /dev/null
@@ -0,0 +1,375 @@
+/*
+
+Copyright 1991, 1993, 1994, 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 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
+and Olivetti Research Limited, Cambridge, England.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the names of Digital or Olivetti
+not be used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.  
+
+DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL THEY 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 _SYNC_H_
+#define _SYNC_H_
+
+#include <X11/Xfuncproto.h>
+#include <X11/extensions/syncconst.h>
+
+#ifdef _SYNC_SERVER
+#include <X11/extensions/syncproto.h>
+#else
+
+_XFUNCPROTOBEGIN
+/* get rid of macros so we can define corresponding functions */
+#undef XSyncIntToValue
+#undef XSyncIntsToValue
+#undef XSyncValueGreaterThan
+#undef XSyncValueLessThan
+#undef XSyncValueGreaterOrEqual
+#undef XSyncValueLessOrEqual
+#undef XSyncValueEqual
+#undef XSyncValueIsNegative
+#undef XSyncValueIsZero
+#undef XSyncValueIsPositive
+#undef XSyncValueLow32
+#undef XSyncValueHigh32
+#undef XSyncValueAdd
+#undef XSyncValueSubtract
+#undef XSyncMaxValue
+#undef XSyncMinValue
+
+extern void XSyncIntToValue(
+    XSyncValue* /*pv*/,
+    int /*i*/
+);
+
+extern void XSyncIntsToValue(
+    XSyncValue* /*pv*/,
+    unsigned int /*l*/,
+    int /*h*/
+);
+
+extern Bool XSyncValueGreaterThan(
+    XSyncValue /*a*/,
+    XSyncValue /*b*/
+);
+
+extern Bool XSyncValueLessThan(
+    XSyncValue /*a*/,
+    XSyncValue /*b*/
+);
+
+extern Bool XSyncValueGreaterOrEqual(
+    XSyncValue /*a*/,
+    XSyncValue /*b*/
+);
+
+extern Bool XSyncValueLessOrEqual(
+    XSyncValue /*a*/,
+    XSyncValue /*b*/
+);
+
+extern Bool XSyncValueEqual(
+    XSyncValue /*a*/,
+    XSyncValue /*b*/
+);
+
+extern Bool XSyncValueIsNegative(
+    XSyncValue /*v*/
+);
+
+extern Bool XSyncValueIsZero(
+    XSyncValue /*a*/
+);
+
+extern Bool XSyncValueIsPositive(
+    XSyncValue /*v*/
+);
+
+extern unsigned int XSyncValueLow32(
+    XSyncValue /*v*/
+);
+
+extern int XSyncValueHigh32(
+    XSyncValue /*v*/
+);
+
+extern void XSyncValueAdd(
+    XSyncValue* /*presult*/,
+    XSyncValue /*a*/,
+    XSyncValue /*b*/,
+    int* /*poverflow*/
+);
+
+extern void XSyncValueSubtract(
+    XSyncValue* /*presult*/,
+    XSyncValue /*a*/,
+    XSyncValue /*b*/,
+    int* /*poverflow*/
+);
+
+extern void XSyncMaxValue(
+    XSyncValue* /*pv*/
+);
+
+extern void XSyncMinValue(
+    XSyncValue* /*pv*/
+);
+
+_XFUNCPROTOEND
+
+
+typedef struct _XSyncSystemCounter {
+    char *name;                        /* null-terminated name of system counter */
+    XSyncCounter counter;      /* counter id of this system counter */
+    XSyncValue resolution;     /* resolution of this system counter */
+} XSyncSystemCounter;
+
+
+typedef struct {
+    XSyncCounter counter;      /* counter to trigger on */
+    XSyncValueType value_type; /* absolute/relative */
+    XSyncValue wait_value;     /* value to compare counter to */
+    XSyncTestType test_type;   /* pos/neg comparison/transtion */
+} XSyncTrigger;
+
+typedef struct {
+    XSyncTrigger trigger;      /* trigger for await */
+    XSyncValue event_threshold; /* send event if past threshold */
+} XSyncWaitCondition;
+
+
+typedef struct {
+    XSyncTrigger trigger;
+    XSyncValue  delta;
+    Bool events;
+    XSyncAlarmState state;
+} XSyncAlarmAttributes;
+
+/*
+ *  Events
+ */
+
+typedef struct {
+    int type;                  /* event base + XSyncCounterNotify */
+    unsigned long serial;      /* # of last request processed by server */
+    Bool send_event;           /* true if this came from a SendEvent request */
+    Display *display;          /* Display the event was read from */
+    XSyncCounter counter;      /* counter involved in await */
+    XSyncValue wait_value;     /* value being waited for */
+    XSyncValue counter_value;  /* counter value when this event was sent */
+    Time time;                 /* milliseconds */
+    int count;                 /* how many more events to come */
+    Bool destroyed;            /* True if counter was destroyed */
+} XSyncCounterNotifyEvent;
+
+typedef struct {
+    int type;                  /* event base + XSyncCounterNotify */
+    unsigned long serial;      /* # of last request processed by server */
+    Bool send_event;           /* true if this came from a SendEvent request */
+    Display *display;          /* Display the event was read from */
+    XSyncAlarm alarm;          /* alarm that triggered */
+    XSyncValue counter_value;  /* value that triggered the alarm */
+    XSyncValue alarm_value;    /* test  value of trigger in alarm */
+    Time time;                 /* milliseconds */
+    XSyncAlarmState state;     /* new state of alarm */
+} XSyncAlarmNotifyEvent;
+
+/*
+ *  Errors 
+ */
+
+typedef struct {
+    int type;                  
+    Display *display;          /* Display the event was read from */
+    XSyncAlarm alarm;          /* resource id */
+    unsigned long serial;      /* serial number of failed request */
+    unsigned char error_code;  /* error base + XSyncBadAlarm */
+    unsigned char request_code;        /* Major op-code of failed request */
+    unsigned char minor_code;  /* Minor op-code of failed request */
+} XSyncAlarmError;
+
+typedef struct {
+    int type;                  
+    Display *display;          /* Display the event was read from */
+    XSyncCounter counter;      /* resource id */
+    unsigned long serial;      /* serial number of failed request */
+    unsigned char error_code;  /* error base + XSyncBadCounter */
+    unsigned char request_code;        /* Major op-code of failed request */
+    unsigned char minor_code;  /* Minor op-code of failed request */
+} XSyncCounterError;
+
+/* 
+ *  Prototypes
+ */
+
+_XFUNCPROTOBEGIN
+
+extern Status XSyncQueryExtension(
+    Display* /*dpy*/,
+    int* /*event_base_return*/,
+    int* /*error_base_return*/
+);
+
+extern Status XSyncInitialize(
+    Display* /*dpy*/,
+    int* /*major_version_return*/,
+    int* /*minor_version_return*/
+);
+
+extern XSyncSystemCounter *XSyncListSystemCounters(
+    Display* /*dpy*/,
+    int* /*n_counters_return*/
+);
+
+extern void XSyncFreeSystemCounterList(
+    XSyncSystemCounter* /*list*/
+);
+
+extern XSyncCounter XSyncCreateCounter(
+    Display* /*dpy*/,
+    XSyncValue /*initial_value*/
+);
+
+extern Status XSyncSetCounter(
+    Display* /*dpy*/,
+    XSyncCounter /*counter*/,
+    XSyncValue /*value*/
+);
+
+extern Status XSyncChangeCounter(
+    Display* /*dpy*/,
+    XSyncCounter /*counter*/,
+    XSyncValue /*value*/
+);
+
+extern Status XSyncDestroyCounter(
+    Display* /*dpy*/,
+    XSyncCounter /*counter*/
+);
+
+extern Status XSyncQueryCounter(
+    Display* /*dpy*/,
+    XSyncCounter /*counter*/,
+    XSyncValue* /*value_return*/
+);
+
+extern Status XSyncAwait(
+    Display* /*dpy*/,
+    XSyncWaitCondition* /*wait_list*/,
+    int /*n_conditions*/
+);
+
+extern XSyncAlarm XSyncCreateAlarm(
+    Display* /*dpy*/,
+    unsigned long /*values_mask*/,
+    XSyncAlarmAttributes* /*values*/
+);
+
+extern Status XSyncDestroyAlarm(
+    Display* /*dpy*/,
+    XSyncAlarm /*alarm*/
+);
+
+extern Status XSyncQueryAlarm(
+    Display* /*dpy*/,
+    XSyncAlarm /*alarm*/,
+    XSyncAlarmAttributes* /*values_return*/
+);
+
+extern Status XSyncChangeAlarm(
+    Display* /*dpy*/,
+    XSyncAlarm /*alarm*/,
+    unsigned long /*values_mask*/,
+    XSyncAlarmAttributes* /*values*/
+);
+
+extern Status XSyncSetPriority(
+    Display* /*dpy*/,
+    XID /*client_resource_id*/,
+    int /*priority*/
+);
+
+extern Status XSyncGetPriority(
+    Display* /*dpy*/,
+    XID /*client_resource_id*/,
+    int* /*return_priority*/
+);
+
+extern XSyncFence XSyncCreateFence(
+    Display* /*dpy*/,
+    Drawable /*d*/,
+    Bool /*initially_triggered*/
+);
+
+extern Bool XSyncTriggerFence(
+    Display* /*dpy*/,
+    XSyncFence /*fence*/
+);
+
+extern Bool XSyncResetFence(
+    Display* /*dpy*/,
+    XSyncFence /*fence*/
+);
+
+extern Bool XSyncDestroyFence(
+    Display* /*dpy*/,
+    XSyncFence /*fence*/
+);
+
+extern Bool XSyncQueryFence(
+    Display* /*dpy*/,
+    XSyncFence /*fence*/,
+    Bool* /*triggered*/
+);
+
+extern Bool XSyncAwaitFence(
+    Display* /*dpy*/,
+    const XSyncFence* /*fence_list*/,
+    int /*n_fences*/
+);
+
+_XFUNCPROTOEND
+
+#endif /* _SYNC_SERVER */
+
+#endif /* _SYNC_H_ */
diff --git a/include/X11/extensions/xtestext1.h b/include/X11/extensions/xtestext1.h
new file mode 100755 (executable)
index 0000000..f7699fb
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * xtestext1.h
+ *
+ * X11 Input Synthesis Extension include file
+ */
+
+/*
+
+
+Copyright 1986, 1987, 1988, 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 1986, 1987, 1988 by Hewlett-Packard Corporation
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett-Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Hewlett-Packard makes no representations about the 
+suitability of this software for any purpose.  It is provided 
+"as is" without express or implied warranty.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+
+#ifndef _XTESTEXT1_H
+#define _XTESTEXT1_H
+/*
+ * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h
+ */
+
+#include <X11/extensions/xtestext1const.h>
+/*
+ * This is the definition for the input action host format event structure.
+ * This is the form that a client using this extension will see when
+ * it receives an input action event.
+ */
+typedef struct {
+        int     type;           /* always XTestInputActionType */
+       Display *display;
+       Window  window;
+        CARD8   actions[XTestACTIONS_SIZE];
+} XTestInputActionEvent;
+
+/*
+ * This is the definition for the xTestFakeAck host format event structure.
+ * This is the form that a client using this extension will see when
+ * it receives an XTestFakeAck event.
+ */
+typedef struct {
+        int     type;           /* always XTestFakeAckType */
+       Display *display;
+       Window  window;
+} XTestFakeAckEvent;
+
+#endif /* _XTESTEXT1_H */
diff --git a/man/DBE.man b/man/DBE.man
new file mode 100755 (executable)
index 0000000..7cd36b6
--- /dev/null
@@ -0,0 +1,313 @@
+.\" Copyright (c) 1995  Hewlett-Packard Company
+.\" 
+.\" 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 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 
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company shall not 
+.\" be used in advertising or otherwise to promote the sale, use or other 
+.\" dealing in this Software without prior written authorization from the 
+.\" Hewlett-Packard Company.
+.\"
+.TH DBE __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DBE - Double Buffer Extension
+.SH SYNOPSIS
+The Double Buffer Extension (DBE) provides a standard way to utilize
+double-buffering within the framework of the X Window System.
+Double-buffering uses two buffers, called front and back, which hold images.
+The front buffer is visible to the user; the back buffer is not.  Successive
+frames of an animation are rendered into the back buffer while the previously
+rendered frame is displayed in the front buffer.  When a new frame is ready,
+the back and front buffers swap roles, making the new frame visible.  Ideally, 
+this exchange appears to happen instantaneously to the user, with no visual
+artifacts.  Thus, only completely rendered images are presented to the user, 
+and remain visible during the entire time it takes to render a new frame.  The
+result is a flicker-free animation.
+.SH DESCRIPTION
+.B Concepts
+.RS
+Normal windows are created using
+.B XCreateWindow()
+or
+.B XCreateSimpleWindow(),
+which allocate a set of window attributes and, for InputOutput windows, a front
+buffer, into which an image can be drawn.  The contents of this buffer will be 
+displayed when the window is visible.
+
+This extension enables applications to use double-buffering with a window.
+This involves creating a second buffer, called a back buffer, and associating
+one or more back buffer names
+.I (XIDs)
+with the window, for use when referring 
+to (i.e., drawing to or reading from) the window's back buffer.
+The back buffer name is a drawable of type
+.I XdbeBackBuffer.
+
+DBE provides a relative double-buffering model.  One XID, the window,
+always refers to the front buffer.  One or more other XIDs, the back buffer
+names, always refer to the back buffer.  After a buffer swap, the window 
+continues to refer to the (new) front buffer, and the back buffer name
+continues to refer to the (new) back buffer.  Thus, applications and toolkits
+that want to just render to the back buffer always use the back buffer name
+for all drawing requests to the window.  Portions of an application that want
+to render to the front buffer always use the window XID for all drawing 
+requests to the window.
+
+Multiple clients and toolkits can all use double-buffering on the same window.
+DBE does not provide a request for querying whether a window has 
+double-buffering support, and if so, what the back buffer name is.  Given the 
+asynchronous nature of the X Window System, this would cause race
+conditions.  Instead, DBE allows multiple back buffer names to exist for the 
+same window; they all refer to the same physical back buffer.  The first time a 
+back buffer name is allocated for a window, the window becomes
+double-buffered and the back buffer name is associated with the window.
+Subsequently, the window already is a double-buffered window, and nothing
+about the window changes when a new back buffer name is allocated, except
+that the new back buffer name is associated with the window.  The window
+remains double-buffered until either the window is destroyed, or until all of
+the back buffer names for the window are deallocated.
+
+In general, both the front and back buffers ae treated the same.  In 
+particular, here are some important characteristics:
+
+.RS
+Only one buffer per window can be visible at a time (the front buffer).
+
+Both buffers associated with a window have the same visual type, depth,
+width, height, and shape as the window.
+
+Both buffers associated with a window are "visible" (or "obscured") in
+the same way.  When an Expose event is generated for a window, this 
+event is considered to apply to both buffers equally.  When a 
+double-buffered window is exposed, both buffers are tiled with the 
+window background.
+Even though the back buffer is not visible, terms such as obscure apply to the 
+back buffer as well as to the front buffer.
+
+It is acceptable at any time to pass an
+.I XdbeBackBuffer
+in any function that expects a drawable.
+This enables an application to draw directly into
+.I XdbeBackBuffer
+in the same fashion as it would draw into any other drawable.
+
+It is an error (Window) to pass an
+.I XdbeBackBuffer
+in a function that expects a Window.
+
+An
+.I XdbeBackBuffer
+will never be sent in a reply, event, or error where a Window is specified.
+
+If backing-store and save-under applies to a double-buffered
+window, it applies to both buffers equally.
+
+If the
+.B XClearArea()
+or
+.B XClearWindow()
+function is executed on a
+double-buffered window, the same area in both the front and back buffers
+is cleared.
+.RE
+
+The effect of passing a window to a function that accepts a drawable
+is unchanged by this extension.  The window and front buffer are synonymous
+with each other.  This includes obeying the
+.B XGetImage()
+and
+.B XGetSubImage()
+semantics and the subwindow-mode semantics if a graphics context is
+involved.  Regardless of whether the window was explicitly passed in an
+.B XGetImage()
+or
+.B XGetSubImage()
+call, or implicitly referenced (i.e., one of
+the window's ancestors was passed in the function), the front (i.e. visible)
+buffer is always referenced.
+Thus, DBE-naive screen dump clients will always get the front buffer.
+.B XGetImage()
+and
+.B XGetSubImage()
+on a back
+buffer return undefined image contents for any obscured regions of the back
+buffer that fall within the image.
+
+Drawing to a back buffer always uses the clip region that would be used to 
+draw to the front buffer with a GC subwindow-mode of ClipByChildren.  If an 
+ancestor of a double-buffered window is drawn to with a GC having a
+subwindow-mode of IncludeInferiors, the effect on the double-buffered
+window's back buffer depends on the depth of the double-buffered window
+and the ancestor.  If the depths are the same, the contents of the back buffer
+of the double-buffered window are not changed.  If the depths are different,
+the contents of the back buffer of the double-buffered window are undefined 
+for the pixels that the IncludeInferiors drawing touched.
+
+DBE adds no new events.  DBE does not extend the semantics of any existing
+events with the exception of adding a new drawable type called
+.I XdbeBackBuffer.
+
+If events, replies, or errors that contain a drawable
+(e.g., GraphicsExpose) are generated in response to a request, the
+drawable returned will be the one specified in the request.
+
+DBE advertises which visuals support double buffering.
+
+DBE does not include any timing or synchronization facilities.  Applications
+that need such facilities (e.g., to maintain a constant frame rate) should
+investigate the Synchronization Extension, an X Consortium standard.
+.RE
+
+.B Window Management Operations
+
+.RS
+The basic philosophy of DBE is that both buffers are treated the same by
+X window management operations.
+
+When a double-buffered window is destroyed,
+both buffers associated with the window are destroyed, and all back buffer
+names associated with the window are freed.
+
+If the size of a double-buffered window changes, both 
+buffers assume the new size.  If the window's size increases, the effect on the 
+buffers depends on whether the implementation honors bit gravity for buffers.
+If bit gravity is implemented, then the contents of both buffers are moved in 
+accordance with the window's bit gravity,
+and the remaining areas are tiled with the window background.  If 
+bit gravity is not implemented, then the entire unobscured region of both 
+buffers is tiled with the window background.  In either case, Expose events are
+generated for the region that is tiled with the window background.
+
+If the
+.B XGetGeometry()
+function is executed on an
+.I XdbeBackBuffer,
+the returned x, y, and border-width will be zero.
+
+If the Shape extension
+.B ShapeRectangles, ShapeMask, ShapeCombine,
+or
+.B ShapeOffset
+request is executed on a double-buffered window, both 
+buffers are reshaped to match the new window shape.  The region difference
+D = new shape - old shape is tiled with the window background in both 
+buffers, and Expose events are generated for D.
+.RE
+
+.B Complex Swap Actions
+
+.RS
+DBE has no explicit knowledge of ancillary buffers (e.g. depth buffers or 
+alpha buffers), and only has a limited set of defined swap actions.  Some
+applications may need a richer set of swap actions than DBE provides.  Some 
+DBE implementations have knowledge of ancillary buffers, and/or can provide 
+a rich set of swap actions. Instead of continually extending DBE to increase
+its set of swap actions, DBE provides a flexible "idiom" mechanism.  If an 
+applications's needs are served by the defined swap actions, it should use
+them; otherwise, it should use the following method of expressing a complex
+swap action as an idiom.  Following this policy will ensure the best possible
+performance across a wide variety of implementations.
+
+As suggested by the term "idiom," a complex swap action should be expressed 
+as a group/series of requests.  Taken together, this group of requests may be 
+combined into an atomic operation by the implementation, in order to 
+maximize performance.  The set of idioms actually recognized for optimization
+is implementation dependent.  To help with idiom expression and 
+interpretation, an idiom must be surrounded by two function calls:  
+.B XdbeBeginIdiom()
+and
+.B XdbeEndIdiom().
+Unless this begin-end pair
+surrounds the idiom, it may not be recognized by a given implementation, and 
+performance will suffer.
+
+For example, if an application wants to swap buffers for two windows, and use
+X to clear only certain planes of the back buffers, the application would
+make the following calls as a group, and in the following order:
+
+.RS
+.B XdbeBeginIdiom().
+
+.B XdbeSwapBuffers()
+with XIDs for two windows, each of which uses a swap action of Untouched.
+
+.B XFillRectangle()
+to the back buffer of one window.
+
+.B XFillRectangle()
+to the back buffer of the other window.
+
+.B XdbeEndIdiom().
+.RE
+
+The
+.B XdbeBeginIdiom()
+and
+.B XdbeEndIdiom()
+functions do not perform any
+actions themselves.  They are treated as markers by implementations that can 
+combine certain groups/series of requests as idioms, and are ignored by other
+implementations or for non-recognized groups/series of requests.  If these
+function calls are made out of order, or are mismatched, no errors are sent,
+and the functions are executed as usual, though performance may suffer.
+
+.B XdbeSwapBuffers()
+need not be included in an idiom.  For
+example, if a swap action of Copied is desired, but only some of the planes
+should be copied,
+.B XCopyArea()
+may be used instead of 
+.B XdbeSwapBuffers().
+If
+.B XdbeSwapBuffers()
+is included in an idiom, it should immediately follow the
+.B XdbeBeginIdiom()
+call.  Also, when the 
+.B XdbeSwapBuffers()
+is included in an idiom, that request's swap action will 
+still be valid, and if the swap action might overlap with another request, then 
+the final result of the idiom must be as if the separate requests were executed
+serially.  For example, if the specified swap action is Untouched, and if a 
+.B XFillRectangle()
+using a client clip rectangle is done to the window's back
+buffer after the
+.B XdbeSwapBuffers()
+call, then the contents of the new 
+back buffer (after the idiom) will be the same as if the idiom was not
+recognized by the implementation.
+
+It is highly recommended that API providers define, and application 
+developers use, "convenience" functions that allow client applications to call
+one procedure that encapsulates common idioms.  These functions will
+generate the
+.B XdbeBeginIdiom(),
+idiom, and 
+.B XdbeEndIdiom()
+calls.  Usage of these functions will ensure best possible
+performance across a wide variety of implementations.
+.SH SEE ALSO
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/man/DPMSCapable.man b/man/DPMSCapable.man
new file mode 100755 (executable)
index 0000000..0513f2b
--- /dev/null
@@ -0,0 +1,65 @@
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\" 
+.\" 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.  Digital Equipment Corporation
+.\" 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 1999, 2005 Sun Microsystems, Inc.  All rights reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the next
+.\" paragraph) shall be included in all copies or substantial portions of the
+.\" Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\"
+.TH DPMSCapable __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSCapable \- returns the DPMS capability of the X server
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.BR "Bool DPMSCapable" " ( Display *\fIdisplay\fP\^ );"
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.SH DESCRIPTION
+.LP
+The 
+.I DPMSCapable 
+function returns the Display Power Management Signaling (DPMS) capability of 
+the X server, either TRUE \^(capable of DPMS\^) or FALSE \^(incapable of 
+DPMS\^).
+.SH "RETURN VALUES"
+.TP 15
+True
+The 
+.I DPMSCapable 
+function returns True if the X server is capable of DPMS.
+.TP 15
+False
+The 
+.I DPMSCapable 
+function returns True if the X server is incapable of DPMS.
diff --git a/man/DPMSDisable.man b/man/DPMSDisable.man
new file mode 100755 (executable)
index 0000000..2f1bb49
--- /dev/null
@@ -0,0 +1,65 @@
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\" 
+.\" 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.  Digital Equipment Corporation
+.\" 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 1999, 2005 Sun Microsystems, Inc.  All rights reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the next
+.\" paragraph) shall be included in all copies or substantial portions of the
+.\" Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\"
+.TH DPMSDisable __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSDisable \- disables DPMS on the specified display
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.BR "Status DPMSDisable" " ( Display \fI*display\fP\^ );"
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.SH DESCRIPTION
+.LP
+The 
+.I DPMSDisable 
+function disables Display Power Management Signaling (DPMS) on the specified
+display.  When disabled, DPMS sets the display to DPMSModeOn.  If 
+.I DPMSDisable 
+is invoked on a display with DPMS already disabled or on a display which does 
+not support DPMS, no change is made and no error is returned.
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The 
+.I DPMSDisable 
+function always returns TRUE.
+.SH "SEE ALSO"
+.BR DPMSCapable (__libmansuffix__),
+.BR DPMSEnable (__libmansuffix__)
diff --git a/man/DPMSEnable.man b/man/DPMSEnable.man
new file mode 100755 (executable)
index 0000000..73a7878
--- /dev/null
@@ -0,0 +1,77 @@
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\" 
+.\" 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.  Digital Equipment Corporation
+.\" 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 1999, 2005 Sun Microsystems, Inc.  All rights reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the next
+.\" paragraph) shall be included in all copies or substantial portions of the
+.\" Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\"
+.\" X Window System is a trademark of The Open Group.
+.\" 
+.TH DPMSEnable __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSEnable \- enables DPMS on the specified display
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.BR "Status DPMSEnable" " ( Display *\fIdisplay\fP\^ );"
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.SH DESCRIPTION
+.LP
+The 
+.I DPMSEnable 
+function enables Display Power Management Signaling (DPMS) on the specified 
+.I display. 
+When DPMS is enabled, DPMS will use the currently saved timeout values. It will 
+trigger the appropriate DPMS power level based on the timeout values. Refer to 
+.I DPMSSetTimeouts. 
+All physical screens are affected by 
+.I DPMSEnable 
+at the same time.
+
+If 
+.I DPMSEnable 
+is invoked on a display which has DPMS already enabled, or on a display which 
+does not support DPMS, no change is made and no error is returned.
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The 
+.I DPMSEnable 
+function always returns TRUE.
+.SH "SEE ALSO"
+.BR DPMSCapable (__libmansuffix__),
+.BR DPMSDisable (__libmansuffix__),
+.BR DPMSGetTimeouts (__libmansuffix__),
+.BR DPMSSetTimeouts (__libmansuffix__)
diff --git a/man/DPMSForceLevel.man b/man/DPMSForceLevel.man
new file mode 100755 (executable)
index 0000000..69f28db
--- /dev/null
@@ -0,0 +1,83 @@
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\" 
+.\" 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.  Digital Equipment Corporation
+.\" 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 1999, 2005 Sun Microsystems, Inc.  All rights reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the next
+.\" paragraph) shall be included in all copies or substantial portions of the
+.\" Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\"
+.\" X Window System is a trademark of The Open Group.
+.\" 
+.TH DPMSForceLevel __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSForceLevel \- forces a DPMS capable display into the
+specified power level
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.BR "Status DPMSForceLevel" " ( Display \fI*display\fP\^, CARD16 \fIlevel\fP\^ );"
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.TP
+.I level
+Specifies the level to force power to
+.SH DESCRIPTION
+.LP
+The 
+.I DPMSForceLevel 
+function forces a DPMS capable display into the specified power level.  The 
+\fIlevel\fP must be one of following four states: DPMSModeOn, DPMSModeStandby, 
+DPMSModeSuspend, or DPMSModeOff. Values other than these will result in a 
+BadValue error.  If DPMS
+is disabled on the display, trying to set the power level on the display will 
+result in a BadMatch 
+protocol error.
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The 
+.I DPMSForceLevel 
+function always returns TRUE.
+.SH ERRORS
+.TP 15
+BadValue
+A level other than DPMSModeOn, DPMSModeStandby, DPMSModeSuspend, or DPMSModeOff
+was specified.
+.TP 15
+.SM BadMatch
+DPMS is disabled on the specified display.
+.SH "SEE ALSO"
+.BR DPMSCapable (__libmansuffix__),
+.BR DPMSInfo (__libmansuffix__),
+.BR DPMSGetTimeouts (__libmansuffix__),
+.BR DPMSSetTimeouts (__libmansuffix__)
diff --git a/man/DPMSGetTimeouts.man b/man/DPMSGetTimeouts.man
new file mode 100755 (executable)
index 0000000..53d8eed
--- /dev/null
@@ -0,0 +1,102 @@
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\" 
+.\" 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.  Digital Equipment Corporation
+.\" 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 1999, 2005 Sun Microsystems, Inc.  All rights reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the next
+.\" paragraph) shall be included in all copies or substantial portions of the
+.\" Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\"
+.\" X Window System is a trademark of The Open Group.
+.\" 
+.TH DPMSGetTimeouts __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSGetTimeouts \- retrieves the timeout values used by the X server for DPMS 
+timings
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.B Bool DPMSGetTimeouts
+(
+.br
+      Display *\fIdisplay\fP\^,
+.br
+      CARD16 *\fIstandby\fP\^,
+.br
+      CARD16 *\fIsuspend\fP\^,
+.br
+      CARD16 *\fIoff\fP\^ 
+);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.TP
+.I standby
+Specifies the current standby timeout in seconds
+.TP
+.I suspend
+Specifies the current suspend timeout in seconds
+.TP
+.I off
+Specifies the current off timeout in seconds
+.SH DESCRIPTION
+.LP
+The 
+.I DPMSGetTimeouts 
+function retrieves the timeout values used by the X server for DPMS timings.  
+.LP
+The value 
+.I standby 
+is the amount of time of inactivity in seconds before standby mode is invoked. A 
+value of zero indicates that this mode has been disabled.
+.LP
+The value \fIsuspend\fP is the amount of time of inactivity in seconds before 
+the second level of power savings is invoked.  A value of zero indicates that 
+this mode has been disabled.
+.LP
+The value \fIoff\fP is the amount of time of inactivity in seconds before the 
+third and final level of power savings is invoked. A value of zero indicates 
+that this mode has been disabled.
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The 
+.I DPMSGetTimeouts 
+function returns TRUE when values are returned.
+.TP 15
+FALSE
+The 
+.I DPMSGetTimeouts 
+function returns FALSE when no values returned.
+.SH "SEE ALSO"
+.BR DPMSCapable (__libmansuffix__),
+.BR DPMSInfo (__libmansuffix__),
+.BR DPMSSetTimeouts (__libmansuffix__)
diff --git a/man/DPMSGetVersion.man b/man/DPMSGetVersion.man
new file mode 100755 (executable)
index 0000000..d793199
--- /dev/null
@@ -0,0 +1,87 @@
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\" 
+.\" 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.  Digital Equipment Corporation
+.\" 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 1999, 2005 Sun Microsystems, Inc.  All rights reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the next
+.\" paragraph) shall be included in all copies or substantial portions of the
+.\" Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\"
+.\" X Window System is a trademark of The Open Group.
+.\" 
+.TH DPMSGetVersion __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSGetVersion \- returns the version of the DPMS extension implemented by
+the X server
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.B Status DPMSGetVersion
+(
+.br
+      Display *\fIdisplay\fP\^,
+.br
+      int *\fImajor_version\fP\^,
+.br
+      int *\fIminor_version\fP\^ 
+);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.TP
+.I major_version
+Specifies the return location for the extension major version
+.TP
+.I minor_version
+Specifies the return location for the extension minor version
+.SH DESCRIPTION
+.LP
+The 
+.I DPMSGetVersion 
+function returns the version of the Display Power Management Signaling (DPMS)
+extension implemented by the X server.  It returns a major and minor version 
+number. The major version number will be incremented for protocol incompatible
+changes, and the minor version number will be incremented for small, upward 
+compatible changes.
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The 
+.I DPMSGetVersion 
+function returns TRUE when the extension is supported and values are returned.
+.TP 15
+FALSE
+The 
+.I DPMSGetVersion 
+function returns FALSE when the extension is not supported.
+.SH "SEE ALSO"
+.BR DPMSCapable (__libmansuffix__),
+.BR DPMSQueryExtension (__libmansuffix__)
diff --git a/man/DPMSInfo.man b/man/DPMSInfo.man
new file mode 100755 (executable)
index 0000000..6c8e2f9
--- /dev/null
@@ -0,0 +1,86 @@
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\" 
+.\" 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.  Digital Equipment Corporation
+.\" 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 1999, 2005 Sun Microsystems, Inc.  All rights reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the next
+.\" paragraph) shall be included in all copies or substantial portions of the
+.\" Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\"
+.\" X Window System is a trademark of The Open Group.
+.\" 
+.TH DPMSInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSInfo \- returns information about the current DPMS state
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.B Status DPMSInfo
+(
+.br
+      Display \fI*display\fP\^,
+.br
+      CARD16 \fI*power_level\fP\^,
+.br
+      BOOL \fI*state\fP\^ 
+);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.TP
+.I power_level
+Specifies the current power level
+.TP
+.I state
+Specifies the current DPMS state
+.SH DESCRIPTION
+.LP
+The 
+.I DPMSInfo 
+function returns information about the current Display Power Management 
+Signaling (DPMS) state. The \fIstate\fP 
+return parameter indicates whether or not DPMS is enabled \^(TRUE\^) or
+disabled \^(FALSE\^). The \fIpower_level\fP return parameter indicates the 
+current power level \^(one of DPMSModeOn, DPMSModeStandby, DPMSModeSuspend, or
+DPMSModeOff.\^)
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The 
+.I DPMSInfo 
+function returns TRUE, if values are returned.
+.TP 15
+FALSE
+The 
+.I DPMSInfo 
+function returns FALSE, if no values are returned.
+.SH "SEE ALSO"
+.BR DPMSEnable (__libmansuffix__)
diff --git a/man/DPMSQueryExtension.man b/man/DPMSQueryExtension.man
new file mode 100755 (executable)
index 0000000..2bfb222
--- /dev/null
@@ -0,0 +1,104 @@
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\" 
+.\" 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.  Digital Equipment Corporation
+.\" 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 1999, 2005 Sun Microsystems, Inc.  All rights reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the next
+.\" paragraph) shall be included in all copies or substantial portions of the
+.\" Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\"
+.\" X Window System is a trademark of The Open Group.
+.\" 
+.TH DPMSQueryExtension __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSQueryExtension \- queries the X server to determine the availability
+of the DPMS Extension
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.B Bool DPMSQueryExtension
+(
+.br
+      Display \fI*display\fP\^,
+.br
+      int \fI*event_base\fP\^,
+.br
+      int \fI*error_base\fP\^ 
+);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.TP
+.I event_base
+Specifies the return location for the assigned base event
+.TP
+.I error_base
+Specifies the return location for the assigned base error
+.SH DESCRIPTION
+.LP
+The 
+.I DPMSQueryExtension 
+function queries the X server to determine the availability of the
+Display Power Management Signaling (DPMS) 
+Extension.  If the extension is available, it returns TRUE, and the
+.I event_base
+and 
+.I error_base
+are set to the base event and error numbers, respectively.  Otherwise, the 
+return value is FALSE, and the 
+values of
+.I event_base
+and 
+.I error_base 
+are undefined.
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The 
+.I DPMSQueryExtension 
+function returns TRUE if the extension is available, 
+and
+.I event_base
+and 
+.I error_base
+are set to the base event number and base error number for the extension, 
+respectively.
+.TP 15
+FALSE
+The 
+.I DPMSQueryExtension 
+function returns FALSE if extension is not available, and the values of
+.I event_base
+and 
+.I error_base 
+are undefined.
+.SH "SEE ALSO"
+.BR DPMSGetVersion (__libmansuffix__)
diff --git a/man/DPMSSetTimeouts.man b/man/DPMSSetTimeouts.man
new file mode 100755 (executable)
index 0000000..30d1af0
--- /dev/null
@@ -0,0 +1,128 @@
+.\" Copyright \(co Digital Equipment Corporation, 1996
+.\" 
+.\" 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.  Digital Equipment Corporation
+.\" 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 1999, 2005 Sun Microsystems, Inc.  All rights reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the next
+.\" paragraph) shall be included in all copies or substantial portions of the
+.\" Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\"
+.\" X Window System is a trademark of The Open Group.
+.\" 
+.TH DPMSSetTimeouts __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+DPMSSetTimeouts \- permits applications to set the timeout values
+used by the X server for DPMS timings
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/dpms.h>
+.HP
+.B Status DPMSSetTimeouts
+(
+.br
+      Display *\fIdisplay\fP\^,
+.br
+      CARD16 \fIstandby\fP\^,
+.br
+      CARD16 \fIsuspend\fP\^,
+.br
+      CARD16 \fIoff\fP\^ 
+);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.TP
+.I display
+Specifies the connection to the X server
+.TP
+.I standby
+Specifies the new standby timeout in seconds
+.TP
+.I suspend
+Specifies the new suspend timeout in seconds
+.TP
+.I off
+Specifies the new off timeout in seconds
+.SH DESCRIPTION
+.LP
+The DPMSSetTimeouts function permits applications to set the timeout values
+used by the X server for Display Power Management Signaling (DPMS) timings. 
+.LP
+The value \fIstandby\fP is the amount of inactivity time, in seconds, before 
+standby mode is invoked. The actual 
+effects of this mode are dependent on the characteristics of the monitor and 
+frame buffer card. Standby mode is 
+implemented by shutting off the horizontal sync signal, and pulsing the vertical 
+sync signal. Standby mode 
+provides the quickest monitor recovery time.  Note also that many monitors 
+implement this mode identical to 
+suspend mode.  A value of zero disables the standby mode.
+.LP
+The value \fIsuspend\fP is the amount of time of inactivity, in seconds, before 
+the second level of power 
+savings is invoked. Suspend mode's physical and electrical characteristics are 
+implementation defined. For DPMS 
+compliant hardware, setting the suspend mode is implemented by pulsing the 
+horizontal sync signal and 
+shutting off the vertical sync signal.  In general, suspend mode recovery is 
+considered to be slower than 
+standby mode, but faster than off mode. However it may vary from monitor to 
+monitor.  As noted above, many 
+monitors implement this mode identical to the standby mode.  A value of zero 
+disables this mode.
+.LP
+The value \fIoff\fP is the amount of time of inactivity,in seconds, before the 
+third and final level of power 
+savings is invoked. Off mode's physical and electrical characteristics are 
+implementation defined. In DPMS 
+compliant hardware, it is implemented by shutting off both horizontal and 
+vertical sync signals, resulting in 
+powering down of the monitor.  Recovery time is implementation dependent. 
+Usually the recovery time is very 
+close to the power-up time of the monitor. A value of zero disables this mode.
+.LP
+Chronologically, \fIstandby\fP mode occurs before or simultaneously with 
+\fIsuspend\fP mode, and 
+\fIsuspend\fP mode must occur before or simultaneously with \fIoff\fP mode. 
+Therefore, non-zero mode timeout 
+values must be greater than or equal to the timeout values of earlier modes.  If 
+inconsistent values are 
+supplied, a BadValue error will result.
+.SH "RETURN VALUES"
+.TP 15
+TRUE
+The 
+.I DPMSSetTimeouts 
+function returns TRUE when the function has succeeded. 
+.SH ERRORS
+.TP 15
+.SM BadValue
+An argument is out of range.
+.SH "SEE ALSO"
+.BR DPMSCapable (__libmansuffix__),
+.BR DPMSInfo (__libmansuffix__),
+.BR DPMSGetTimeouts (__libmansuffix__)
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100755 (executable)
index 0000000..fef283f
--- /dev/null
@@ -0,0 +1,87 @@
+libmandir = $(LIB_MAN_DIR)
+
+libman_PRE =                                   \
+       $(all_shadows:=.man)                    \
+       DBE.man                                 \
+       DPMSCapable.man                         \
+       DPMSDisable.man                         \
+       DPMSEnable.man                          \
+       DPMSForceLevel.man                      \
+       DPMSGetTimeouts.man                     \
+       DPMSGetVersion.man                      \
+       DPMSInfo.man                            \
+       DPMSQueryExtension.man                  \
+       DPMSSetTimeouts.man                     \
+       XShape.man                              \
+       XShm.man                                \
+       XcupGetReservedColormapEntries.man      \
+       XcupQueryVersion.man                    \
+       XcupStoreColors.man                     \
+       XdbeAllocateBackBufferName.man          \
+       XdbeBeginIdiom.man                      \
+       XdbeDeallocateBackBufferName.man        \
+       XdbeEndIdiom.man                        \
+       XdbeFreeVisualInfo.man                  \
+       XdbeGetBackBufferAttributes.man         \
+       XdbeGetVisualInfo.man                   \
+       XdbeQueryExtension.man                  \
+       XdbeSwapBuffers.man                     \
+       Xevi.man                                \
+       Xmbuf.man
+
+XShape_shadows =                               \
+       XShapeQueryExtension                    \
+       XShapeQueryVersion                      \
+       XShapeCombineRegion                     \
+       XShapeCombineRectangles                 \
+       XShapeCombineMask                       \
+       XShapeCombineShape                      \
+       XShapeOffsetShape                       \
+       XShapeQueryExtents                      \
+       XShapeSelectInput                       \
+       XShapeInputSelected                     \
+       XShapeGetRectangles
+
+XShm_shadows =                                 \
+       XShmQueryExtension                      \
+       XShmQueryVersion                        \
+       XShmPixmapFormat                        \
+       XShmAttach                              \
+       XShmDetach                              \
+       XShmCreateImage                         \
+       XShmPutImage                            \
+       XShmGetImage                            \
+       XShmCreatePixmap                        \
+       XShmGetEventBase
+
+Xmbuf_shadows =                                        \
+       XmbufQueryExtension                     \
+       XmbufGetVersion                         \
+       XmbufCreateBuffers                      \
+       XmbufDestroyBuffers                     \
+       XmbufDisplayBuffers                     \
+       XmbufGetWindowAttributes                \
+       XmbufChangeWindowAttributes             \
+       XmbufGetBufferAttributes                \
+       XmbufChangeBufferAttributes             \
+       XmbufGetScreenInfo                      \
+       XmbufCreateStereoWindow
+
+Xevi_shadows =                                 \
+       XeviQueryVersion                        \
+       XeviGetVisualInfo                       \
+       XeviQueryExtension
+
+all_shadows = $(XShape_shadows) $(XShm_shadows) $(Xmbuf_shadows) $(Xevi_shadows)
+
+libman_DATA = $(libman_PRE:man=@LIB_MAN_SUFFIX@)
+
+EXTRA_DIST  = $(libman_PRE)
+
+CLEANFILES  = $(libman_DATA)
+
+SUFFIXES = .$(LIB_MAN_SUFFIX) .man
+
+# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
+.man.$(LIB_MAN_SUFFIX):
+       $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@
diff --git a/man/XShape.man b/man/XShape.man
new file mode 100755 (executable)
index 0000000..de1873a
--- /dev/null
@@ -0,0 +1,174 @@
+.\" Copyright (c) 1989, 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 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 
+.\" dealing in this Software without prior written authorization from the 
+.\" X Consortium.
+.\"
+.de ZN
+.ie t \fB\^\\$1\^\fR\\$2
+.el \fI\^\\$1\^\fP\\$2
+..
+.TH XSHAPE __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XShapeQueryExtension, XShapeQueryVersion, XShapeCombineRegion, XShapeCombineRectangles, XShapeCombineMask, XShapeCombineShape, XShapeOffsetShape, XShapeQueryExtents, XShapeSelectInput, XShapeInputSelected, XShapeGetRectangles \- X nonrectangular shape functions
+.SH SYNTAX
+.nf
+.LP
+\&#include <X11/extensions/shape.h>
+.LP
+Bool XShapeQueryExtension (
+       Display *dpy, 
+       int *event_basep, 
+       int *error_basep);
+.LP
+Status XShapeQueryVersion (
+       Display *dpy, 
+       int *major_versionp, 
+       int *minor_versionp);
+.LP
+void XShapeCombineRegion (
+       Display *dpy, 
+       Window dest, 
+       int destKind, 
+       int xOff, 
+       int yOff, 
+       struct _XRegion *r, 
+       int op);
+.LP
+void XShapeCombineRectangles (
+       Display *dpy, 
+       XID dest, 
+       int destKind, 
+       int xOff, 
+       int yOff, 
+       XRectangle *rects, 
+       int n_rects, 
+       int op, 
+       int ordering);
+.LP
+void XShapeCombineMask (
+       Display *dpy, 
+       XID dest, 
+       int destKind, 
+       int xOff, 
+       int yOff, 
+       Pixmap src, 
+       int op);
+.LP
+void XShapeCombineShape (
+       Display *dpy, 
+       XID dest, 
+       int destKind, 
+       int xOff, 
+       int yOff, 
+       Pixmap src, 
+       int srcKind, 
+       int op);
+.LP
+void XShapeOffsetShape (
+       Display *dpy, 
+       XID dest, 
+       int destKind, 
+       int xOff, 
+       int yOff);
+.LP
+Status XShapeQueryExtents (
+       Display *dpy, 
+       Window window, 
+       int *bShaped, 
+       int *xbs, 
+       int *ybs, 
+       unsigned int *wbs, 
+       unsigned int *hbs, 
+       int *cShaped, 
+       int *xcs, 
+       int *ycs, 
+       unsigned int *wcs, 
+       unsigned int *hcs);
+.LP
+void XShapeSelectInput (
+       Display *dpy, 
+       Window window, 
+       unsigned longmask);
+.LP
+unsigned long XShapeInputSelected (
+       Display *dpy, 
+       Window window);
+.LP
+XRectangle *XShapeGetRectangles (
+       Display *dpy, 
+       Window window, 
+       int kind, 
+       int *count, 
+       int *ordering);
+.fi
+.SH STRUCTURES
+.nf
+.LP
+.ta 3i
+typedef struct {
+    int type;  /\&* of event */
+    unsigned long serial;      /\&* # of last request processed by server */
+    Bool send_event;   /\&* true if this came from a SendEvent request */
+    Display *display;  /\&* Display the event was read from */
+    Window window;     /\&* window of event */
+    int kind;  /\&* ShapeBounding or ShapeClip */
+    int x, y;  /\&* extents of new region */
+    unsigned width, height;
+    Time time; /\&* server timestamp when region changed */
+    Bool shaped;       /\&* true if the region exists */
+} XShapeEvent;
+.fi
+.SH DESCRIPTION
+The \fIX11 Nonrectangular Window Shape Extension\fP adds nonrectangular
+windows to the X Window System.
+.SH PREDEFINED VALUES
+Operations:
+.in +.5i
+.nf
+.ZN ShapeSet
+.ZN ShapeUnion
+.ZN ShapeIntersect
+.ZN ShapeSubtract
+.ZN ShapeInvert
+.in -.5i
+.fi
+.sp
+Shape Kinds:
+.in +.5i
+.nf
+.ZN ShapeBounding
+.ZN ShapeClip
+.in -.5i
+.fi
+.sp
+Event defines:
+.in +.5i
+.nf
+.ZN ShapeNotifyMask
+.ZN ShapeNotify
+.in -.5i
+.fi
+.SH BUGS
+This manual pages needs a lot more work.
+.SH SEE ALSO
+\fIX11 Nonrectangular Window Shape Extension\fP
diff --git a/man/XShapeCombineMask.man b/man/XShapeCombineMask.man
new file mode 100755 (executable)
index 0000000..4153fae
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShape.__libmansuffix__
diff --git a/man/XShapeCombineRectangles.man b/man/XShapeCombineRectangles.man
new file mode 100755 (executable)
index 0000000..4153fae
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShape.__libmansuffix__
diff --git a/man/XShapeCombineRegion.man b/man/XShapeCombineRegion.man
new file mode 100755 (executable)
index 0000000..4153fae
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShape.__libmansuffix__
diff --git a/man/XShapeCombineShape.man b/man/XShapeCombineShape.man
new file mode 100755 (executable)
index 0000000..4153fae
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShape.__libmansuffix__
diff --git a/man/XShapeGetRectangles.man b/man/XShapeGetRectangles.man
new file mode 100755 (executable)
index 0000000..4153fae
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShape.__libmansuffix__
diff --git a/man/XShapeInputSelected.man b/man/XShapeInputSelected.man
new file mode 100755 (executable)
index 0000000..4153fae
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShape.__libmansuffix__
diff --git a/man/XShapeOffsetShape.man b/man/XShapeOffsetShape.man
new file mode 100755 (executable)
index 0000000..4153fae
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShape.__libmansuffix__
diff --git a/man/XShapeQueryExtension.man b/man/XShapeQueryExtension.man
new file mode 100755 (executable)
index 0000000..4153fae
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShape.__libmansuffix__
diff --git a/man/XShapeQueryExtents.man b/man/XShapeQueryExtents.man
new file mode 100755 (executable)
index 0000000..4153fae
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShape.__libmansuffix__
diff --git a/man/XShapeQueryVersion.man b/man/XShapeQueryVersion.man
new file mode 100755 (executable)
index 0000000..4153fae
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShape.__libmansuffix__
diff --git a/man/XShapeSelectInput.man b/man/XShapeSelectInput.man
new file mode 100755 (executable)
index 0000000..4153fae
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShape.__libmansuffix__
diff --git a/man/XShm.man b/man/XShm.man
new file mode 100755 (executable)
index 0000000..4309461
--- /dev/null
@@ -0,0 +1,198 @@
+.\" Copyright (c) 1991  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 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 
+.\" dealing in this Software without prior written authorization from the 
+.\" X Consortium.
+.\"
+.\" Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the next
+.\" paragraph) shall be included in all copies or substantial portions of the
+.\" Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\"
+.\" X Window System is a trademark of The Open Group.
+.\"
+.de ZN
+.ie t \fB\^\\$1\^\fR\\$2
+.el \fI\^\\$1\^\fP\\$2
+..
+.TH XShm __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XShmQueryExtension, XShmQueryVersion, XShmPixmapFormat, XShmAttach, XShmDetach
+XShmCreateImage, XShmPutImage, XShmGetImage, XShmCreatePixmap, XShmGetEventBase - X Shared Memory extension functions
+.SH SYNTAX
+.nf
+.LP
+\&#include <X11/Xlib.h>
+\&#include <sys/ipc.h>
+\&#include <sys/shm.h>
+\&#include <X11/extensions/XShm.h>
+.LP
+Bool   XShmQueryExtension(
+       Display *display);
+.LP
+Bool XShmQueryVersion(
+       Display *display;
+       int *major, *minor;
+       Bool *pixmaps);
+.LP
+Status XShmPixmapFormat(
+       Display *display);
+.LP
+Status XShmAttach(
+       Display *display;
+       XShmSegmentInfo *shminfo);
+.LP
+Status XShmDetach(
+       Display *display;
+       XShmSegmentInfo *shminfo);
+
+.LP
+XImage *XShmCreateImage (
+       Display *display;
+       Visual *visual;
+       unsigned int depth;
+       int format;
+       char *data;
+       XShmSegmentInfo *shminfo;
+       unsigned int width, height);
+.LP
+Status XShmPutImage(
+       Display *display;
+       Drawable d;
+       GC gc;
+       XImage *image;
+       int src_x, src_y, dest_x, dest_y;
+       unsigned int width, height;
+       bool send_event);
+.LP
+Status XShmGetImage (
+       Display *display;
+       Drawable d;
+       XImage *image;
+       int x, y;
+       unsigned long plane_mask);
+.LP
+Pixmap XShmCreatePixmap(
+        Display *display;
+        Drawable d;
+        char *data;
+       XShmSegmentInfo *shminfo;
+       unsigned int width, height, depth);
+.LP
+Status XShmGetEventBase(
+       Display *display);
+.LP
+
+.fi
+.SH STRUCTURES
+.nf
+.ta 3i
+\fIEvents:\fP
+typedef struct {
+    int type;               /\&* of event */
+    unsigned long serial;   /\&* # of last request processed by server*/
+    Bool send_event;        /\&* true if this came from a SendEvent request*/
+    Display *display;       /\&* Display the event was read from */
+    Drawable drawable;      /\&* drawable of request */
+    int major_code;         /\&* ShmReqCode */
+    int minor_code;         /\&* X_ShmPutImage */
+    ShmSeg shmseg;          /\&* the ShmSeg used in the request*/
+    unsigned long offset;   /\&* the offset into ShmSeg used in the request*/
+} XShmCompletionEvent;
+.LP
+\fIa structure of type XShmSegmentInfo :\fP
+
+typedef struct {
+    ShmSeg shmseg;      /\&* resource id */
+    int shmid;          /\&* kernel id */
+    char *shmaddr;      /\&* address in client */
+    Bool readOnly;      /\&* how the server should attach it */
+} XShmSegmentInfo;
+
+.SH DESCRIPTION
+.PP
+.PP
+.ZN XShmQueryExtension
+checks to see if the shared memory extensions are available for the
+specified display.
+.PP
+.ZN XShmQueryVersion
+returns the version numbers of the extension implementation. Shared
+memory pixmaps are supported if the pixmaps argument returns true.
+.PP
+.ZN XShmAttach
+tells the server to attach to your shared memory segment. If all goes
+well, you will get a non-zero status, back and your XImage is ready
+for use.
+.PP
+.ZN XShmDetach
+tells the server to detach from your shared memory segment.
+.PP
+.ZN XShmPutImage
+combines an image in memory with a shape of the specified drawable. If
+XYBitmap format is used, the depth must be one, or a ``BadMatch''
+error results. The foreground pixel in the GC defines the source for
+the one bits in the image, and the background pixel defines the source
+for the zero bits. For XYPixmap and ZPixmap, the depth must match the
+depth of the drawable, or a ``BadMatch'' error results.
+.PP
+.ZN XShmGetImage
+reads image data into a shared memory XImage where display is the
+display of interest, drawable is the source drawable, image is the
+destination XImage, x and y are offsets within the drawable, and
+plane_mask defines which planes are to be read.
+.PP
+.ZN XShmCreateImage
+allocates the memory needed for an XImage structure for the specified
+display but does not allocate space for the image itself.
+.PP
+.ZN XShmPixmapFormat
+gets the format for the server. If your application can deal with the
+server pixmap data format, a shared memory segment and shminfo
+structure are created.
+.PP
+.ZN XShmCreatePixmap
+points to a pixmap which you can manipulate in all of the usual ways,
+with the added bonus of being able to edit its contents directly
+through the shared memory segment.
+.PP
+.ZN XShmGetEventBase
+gets the completion event value.
+.PP
+.SH SEE ALSO
+\fIMIT-SHM - The MIT Shared Memory Extension \fP
diff --git a/man/XShmAttach.man b/man/XShmAttach.man
new file mode 100755 (executable)
index 0000000..0bbd0a8
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShm.__libmansuffix__
diff --git a/man/XShmCreateImage.man b/man/XShmCreateImage.man
new file mode 100755 (executable)
index 0000000..0bbd0a8
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShm.__libmansuffix__
diff --git a/man/XShmCreatePixmap.man b/man/XShmCreatePixmap.man
new file mode 100755 (executable)
index 0000000..0bbd0a8
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShm.__libmansuffix__
diff --git a/man/XShmDetach.man b/man/XShmDetach.man
new file mode 100755 (executable)
index 0000000..0bbd0a8
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShm.__libmansuffix__
diff --git a/man/XShmGetEventBase.man b/man/XShmGetEventBase.man
new file mode 100755 (executable)
index 0000000..0bbd0a8
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShm.__libmansuffix__
diff --git a/man/XShmGetImage.man b/man/XShmGetImage.man
new file mode 100755 (executable)
index 0000000..0bbd0a8
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShm.__libmansuffix__
diff --git a/man/XShmPixmapFormat.man b/man/XShmPixmapFormat.man
new file mode 100755 (executable)
index 0000000..0bbd0a8
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShm.__libmansuffix__
diff --git a/man/XShmPutImage.man b/man/XShmPutImage.man
new file mode 100755 (executable)
index 0000000..0bbd0a8
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShm.__libmansuffix__
diff --git a/man/XShmQueryExtension.man b/man/XShmQueryExtension.man
new file mode 100755 (executable)
index 0000000..0bbd0a8
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShm.__libmansuffix__
diff --git a/man/XShmQueryVersion.man b/man/XShmQueryVersion.man
new file mode 100755 (executable)
index 0000000..0bbd0a8
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/XShm.__libmansuffix__
diff --git a/man/XcupGetReservedColormapEntries.man b/man/XcupGetReservedColormapEntries.man
new file mode 100755 (executable)
index 0000000..351530a
--- /dev/null
@@ -0,0 +1,73 @@
+.\" Copyright \(co 1986-1997   The Open Group    All Rights Reserved
+.\" Copyright 1999, 2005 Sun Microsystems, Inc.  All rights reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the next
+.\" paragraph) shall be included in all copies or substantial portions of the
+.\" Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\" 
+.\" X Window System is a trademark of The Open Group.
+.\" 
+.de ZN
+.ie t \fB\^\\$1\^\fR\\$2
+.el \fI\^\\$1\^\fP\\$2
+..
+.TH XCUP __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XcupGetReservedColormapEntries \- list colormap entries reserved by the system
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/Xcup.h>
+.HP
+Status \fBXcupGetReservedColormapEntries\fP\^(\^Display *\fIdisplay\fP\^, 
+int \fIscreen\fP\^, XColor **\fIcolors_out\fP\^, int *\fIncolors\fP\^);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.IP \fIdisplay\fP 1i
+Specifies the connection to the X server.
+.IP \fIscreen\fP 1i
+Screen number on the host server.
+.IP \fIcolors_out\fP 1i
+Returns the values reserved by the server.
+.IP \fIncolors\fP 1i
+Returns the number of items in \fIcolors_out\fP.
+.SH DESCRIPTION
+.LP
+The 
+.ZN XcupGetReservedColormapEntries 
+function returns a list of colormap entries (pixels) that are reserved
+by the system. This list will, at a minimum, contain entries for the 
+BlackPixel and WhitePixel of the specified screen. Use 
+.ZN XFree 
+to free 
+.I colors_out.
+.LP
+To minimize colormap flash, an application which installs its own private
+colormap should query the special colors by calling
+.ZN XCupGetReservedColormapEntries , 
+and can then store those entries (in the
+proper location) in its private colormap using 
+.ZN XCupStoreColors .
+.SH "SEE ALSO"
+.BR XcupQueryVersion (3Xext),
+.BR XcupStoreColors (3Xext),
+.BR XFree (3X11),
+.br
+\fIColormap Utilization Policy and Extension\fP
diff --git a/man/XcupQueryVersion.man b/man/XcupQueryVersion.man
new file mode 100755 (executable)
index 0000000..49211a8
--- /dev/null
@@ -0,0 +1,74 @@
+.\" Copyright \(co 1986-1997   The Open Group    All Rights Reserved
+.\" Copyright 1999, 2005 Sun Microsystems, Inc.  All rights reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the next
+.\" paragraph) shall be included in all copies or substantial portions of the
+.\" Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\"
+.\" X Window System is a trademark of The Open Group.
+.\" 
+.de ZN
+.ie t \fB\^\\$1\^\fR\\$2
+.el \fI\^\\$1\^\fP\\$2
+..
+.TH XcupQueryVersion __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XcupQueryVersion \- Returns TOG-CUP protocol version supported by the X server
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/Xcup.h>
+.HP
+Status \fBXcupQueryVersion\fP\^(\^Display *\fIdisplay\fP\^, 
+int *\fImajor_version_return\fP\^, int *\fIminor_version_return\fP\^);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.IP \fIdisplay\fP 1i
+Specifies the connection to the X server
+.IP \fImajor_version_return\fP 1i
+Returns the major version supported by the server
+.IP \fIminor_version_return\fP 1i
+Returns the minor version supported by the server
+.SH DESCRIPTION
+.LP
+.ZN XcupQueryVersion 
+sets 
+.I major_version_return 
+and 
+.I minor_version_return 
+to the major and minor TOG-CUP protocol version supported by the
+server. If the TOG-CUP library is compatible with the version returned
+by the server, it returns nonzero. If the server does not support the TOG-CUP
+extension, or if there was an error during communications with the
+server, or if the server and library protocol versions are
+incompatible, it returns zero. No other Xcup functions may be called
+before this function. If a client violates this rule, the effects of
+all subsequent Xcup calls that it makes are undefined.
+.LP
+To get the list of reserved colormap entries, use 
+.ZN XcupGetReservedColormapEntries.
+.LP
+To allocate one or more read-only color cells with RGB values, use 
+.ZN XcupStoreColors.
+.SH "SEE ALSO"
+.BR XcupGetReservedColormapEntries (3Xext),
+.BR XcupStoreColors (3Xext),
+.br
+\fIColormap Utilization Policy and Extension\fP
diff --git a/man/XcupStoreColors.man b/man/XcupStoreColors.man
new file mode 100755 (executable)
index 0000000..3db448f
--- /dev/null
@@ -0,0 +1,79 @@
+.\" Copyright \(co 1986-1997   The Open Group    All Rights Reserved
+.\" Copyright 1999, 2005 Sun Microsystems, Inc.  All rights reserved.
+.\"
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"),
+.\" to deal in the Software without restriction, including without limitation
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
+.\" and/or sell copies of the Software, and to permit persons to whom the
+.\" Software is furnished to do so, subject to the following conditions:
+.\"
+.\" The above copyright notice and this permission notice (including the next
+.\" paragraph) shall be included in all copies or substantial portions of the
+.\" Software.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+.\" THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+.\" DEALINGS IN THE SOFTWARE.
+.\" 
+.\" X Window System is a trademark of The Open Group.
+.\" 
+.de ZN
+.ie t \fB\^\\$1\^\fR\\$2
+.el \fI\^\\$1\^\fP\\$2
+..
+.TH XcupStoreColors __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XcupStoreColors \- initialize shareable colormap entries at specific locations
+.SH SYNOPSIS
+.PP
+.nf
+\fBcc\fR [ \fIflag\fR \&.\&.\&. ] \fIfile\fR \&.\&.\&. -\fBlXext\fR [ \fIlibrary\fR \&.\&.\&. ]
+\&#include <X11/extensions/Xcup.h>
+.HP
+Status \fBXcupStoreColors\fP\^(\^Display *\fIdisplay\fP\^, Colormap \fIcolormap\fP\^,
+XColor *\fIcolors_in_out\fP\^, int \fIncolors\fP\^);
+.if n .ti +5n
+.if t .ti +.5i
+.SH ARGUMENTS
+.IP \fIdisplay\fP 1i
+Specifies the connection to the X server
+.IP \fIcolormap\fP 1i
+Specifies the colormap
+.IP \fIcolors_in_out\fP 1i
+Specifies and returns the values actually used in the colormap
+.IP \fIncolors\fP 1i
+Specifies the number of items in colors_in_out
+.SH DESCRIPTION
+.LP
+The 
+.ZN XcupStoreColors 
+function changes the colormap entries of the pixel values in the pixel
+members of the XColor structures. The colormap entries are allocated
+as if an AllocColor has been used instead, i.e. the colors are
+read-only (shareable).
+.ZN XcupStoreColors 
+returns the number of colors that were successfully allocated in the colormap.
+.LP
+A 
+.ZN Value 
+error is generated if a pixel is not a valid index into the colormap. A
+.ZN BadMatch 
+error is generated if the colormap does not belong to a GrayScale,
+PseudoColor, or DirectColor visual.
+.LP
+Applications which allocate many colors in a screen's default colormap, e.g.
+a color-cube or a gray-ramp, should allocate them with 
+.ZN XCupStoreColors .
+By using XCupStoreColors the colors will be allocated sharable (read-only) 
+and any other application which allocates the same color will share that 
+color cell.
+.SH "SEE ALSO"
+.BR XcupQueryVersion (3Xext),
+.BR XcupGetReservedColormapEntries (3Xext),
+.br
+\fIColormap Utilization Policy and Extension\fP
diff --git a/man/XdbeAllocateBackBufferName.man b/man/XdbeAllocateBackBufferName.man
new file mode 100755 (executable)
index 0000000..aa4704e
--- /dev/null
@@ -0,0 +1,67 @@
+.\" Copyright (c) 1995  Hewlett-Packard Company
+.\" 
+.\" 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 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 
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company shall not 
+.\" be used in advertising or otherwise to promote the sale, use or other 
+.\" dealing in this Software without prior written authorization from the 
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeAllocateBackBufferName __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeAllocateBackBufferName - allocates a DBE buffer.
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+XdbeBackBuffer XdbeAllocateBackBufferName(
+    Display        *dpy,
+    Window         window, 
+    XdbeSwapAction swap_action)
+.SH DESCRIPTION
+This function returns a drawable ID used to refer to the back buffer of the 
+specified window.  The swap_action is a hint to indicate the swap action that 
+will likely be used in subsequent calls to
+.B XdbeSwapBuffers().
+The actual swap
+action used in calls to
+.B XdbeSwapBuffers()
+does not have to be the same as the 
+swap_action passed to this function, though clients are encouraged to provide
+accurate information whenever possible.
+.SH ERRORS
+.IP BadAlloc
+.IP BadIDChoice
+.IP BadMatch
+The specified window is not an InputOutput window or its visual does not
+support DBE.
+.IP BadValue
+An invalid swap action was specified.
+.IP BadWindow
+An invalid window was specified.
+.SH SEE ALSO
+DBE,
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/man/XdbeBeginIdiom.man b/man/XdbeBeginIdiom.man
new file mode 100755 (executable)
index 0000000..af7dca4
--- /dev/null
@@ -0,0 +1,46 @@
+.\" Copyright (c) 1995  Hewlett-Packard Company
+.\" 
+.\" 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 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 
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company shall not 
+.\" be used in advertising or otherwise to promote the sale, use or other 
+.\" dealing in this Software without prior written authorization from the 
+.\" Hewlett-Packard Company.
+.\"
+.TH DBE __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeBeginIdiom - marks the beginning of a DBE idiom sequence.
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+Status XdbeBeginIdiom(
+    Display *dpy)
+.SH DESCRIPTION
+This function marks the beginning of an idiom sequence.
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/man/XdbeDeallocateBackBufferName.man b/man/XdbeDeallocateBackBufferName.man
new file mode 100755 (executable)
index 0000000..92b7da2
--- /dev/null
@@ -0,0 +1,53 @@
+.\" Copyright (c) 1995  Hewlett-Packard Company
+.\" 
+.\" 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 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 
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company shall not 
+.\" be used in advertising or otherwise to promote the sale, use or other 
+.\" dealing in this Software without prior written authorization from the 
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeDeallocateBackBufferName __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeDeallocateBackBufferName - frees a DBE buffer.
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+Status XdbeDeallocateBackBufferName(
+    Display        *dpy,
+    XdbeBackBuffer buffer)
+.SH DESCRIPTION
+This function frees a drawable ID, buffer, that was obtained via
+.B XdbeAllocateBackBufferName().
+The buffer must be a valid name for the back
+buffer of a window, or a protocol error results.
+.SH ERRORS
+.IP BadBuffer
+The specified buffer is not associated with a window.
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/man/XdbeEndIdiom.man b/man/XdbeEndIdiom.man
new file mode 100755 (executable)
index 0000000..c5600f2
--- /dev/null
@@ -0,0 +1,46 @@
+.\" Copyright (c) 1995  Hewlett-Packard Company
+.\" 
+.\" 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 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 
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company shall not 
+.\" be used in advertising or otherwise to promote the sale, use or other 
+.\" dealing in this Software without prior written authorization from the 
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeEndIdiom __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeEndIdiom - marks the end of a DBE idiom sequence.
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+Status XdbeEndIdiom(
+    Display *dpy)
+.SH DESCRIPTION
+This function marks the end of an idiom sequence.
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/man/XdbeFreeVisualInfo.man b/man/XdbeFreeVisualInfo.man
new file mode 100755 (executable)
index 0000000..3495345
--- /dev/null
@@ -0,0 +1,48 @@
+.\" Copyright (c) 1995  Hewlett-Packard Company
+.\" 
+.\" 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 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 
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company shall not 
+.\" be used in advertising or otherwise to promote the sale, use or other 
+.\" dealing in this Software without prior written authorization from the 
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeFreeVisualInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeFreeVisualInfo - frees information returned by
+.B XdbeGetVisualInfo().
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+void XdbeFreeVisualInfo(
+    XdbeScreenVisualInfo *visual_info)
+.SH DESCRIPTION
+This function frees the list of XdbeScreenVisualInfo returned by the function
+.B XdbeGetVisualInfo().
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/man/XdbeGetBackBufferAttributes.man b/man/XdbeGetBackBufferAttributes.man
new file mode 100755 (executable)
index 0000000..b30f2c2
--- /dev/null
@@ -0,0 +1,65 @@
+.\" Copyright (c) 1995  Hewlett-Packard Company
+.\" 
+.\" 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 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 
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company shall not 
+.\" be used in advertising or otherwise to promote the sale, use or other 
+.\" dealing in this Software without prior written authorization from the 
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeGetBackBufferAttributes __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeGetBackBufferAttributes - returns attributes of a DBE buffer.
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+XdbeBackBufferAttributes *XdbeGetBackBufferAttributes(
+    Display        *dpy,
+    XdbeBackBuffer buffer)
+.SH DESCRIPTION
+This function returns the attributes associated with the specified buffer.
+
+The
+.I XdbeBackBufferAttributes
+structure has the following fields:
+
+.RS
+Window     window     window that buffer belongs to
+.RE
+    
+If buffer is not a valid
+.I XdbeBackBuffer,
+window returns None.
+
+The returned
+.I XdbeBackBufferAttributes
+structure can be freed with the 
+Xlib function
+.B Xfree().
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/man/XdbeGetVisualInfo.man b/man/XdbeGetVisualInfo.man
new file mode 100755 (executable)
index 0000000..9ebcd66
--- /dev/null
@@ -0,0 +1,125 @@
+.\" Copyright (c) 1995  Hewlett-Packard Company
+.\" 
+.\" 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 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 
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company shall not 
+.\" be used in advertising or otherwise to promote the sale, use or other 
+.\" dealing in this Software without prior written authorization from the 
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeGetVisualInfo __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeGetVisualInfo - Get dbe Visual Informations
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+XdbeScreenVisualInfo *XdbeGetVisualInfo(
+    Display  *dpy,
+    Drawable *screen_specifiers,
+    int      *num_screens)
+.SH DESCRIPTION
+This function returns information about which visuals support double
+buffering.  The argument
+.I num_screens
+specifies how many elements there are 
+in the
+.I screen_specifiers
+list.  Each drawable in
+.I screen_specifiers
+designates a 
+screen for which the supported visuals are being requested.  If
+.I num_screens
+is zero, information for all screens is requested.  In this case, upon return
+from this function,
+.I num_screens
+will be set to the number of screens that were
+found.  If an error occurs, this function returns NULL, else it returns a
+pointer to a list of
+.I XdbeScreenVisualInfo
+structures of length
+.I num_screens.
+The nth
+element in the returned list corresponds to the nth drawable in the 
+.I screen_specifiers
+list, unless
+.I num_screens
+was passed in with the value zero,
+in which case the nth element in the returned list corresponds to the nth screen
+of the server, starting with screen zero.  The
+.I XdbeScreenVisualInfo
+structure has the following fields:
+
+     int            count
+     XdbeVisualInfo *visinfo
+
+.I count
+specifies the number of items in
+.I visinfo.
+.I visinfo
+specifies a list of visuals, depths, and performance hints for this screen.
+
+The
+.I XdbeVisualInfo
+structure has the following fields:
+
+     VisualID visual
+     int      depth
+     int      perflevel
+
+.I visual
+specifies one visual ID that supports double-buffering.
+.I depth
+specifies the depth of the visual.
+.I perflevel
+is a performance hint.
+
+The only operation defined on a
+.I perflevel
+is comparison to a
+.I perflevel
+of another visual on the same screen.  The visual having the higher
+.I perflevel
+is likely to have better double-buffering graphics performance than the visual
+having the lower
+.I perflevel.
+Nothing can be deduced from the following: the magnitude of the difference
+of two
+.I perflevels,
+a
+.I perflevel
+value in isolation, or comparing
+.I perflevels
+from different servers.
+
+.SH ERRORS
+.IP BadDrawable
+One or more values passed in
+.I screen_specifiers
+is not a valid drawable.
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeQueryExtension(),
+.I XdbeSwapBuffers().
+
diff --git a/man/XdbeQueryExtension.man b/man/XdbeQueryExtension.man
new file mode 100755 (executable)
index 0000000..4b50a6a
--- /dev/null
@@ -0,0 +1,61 @@
+.\" Copyright (c) 1995  Hewlett-Packard Company
+.\" 
+.\" 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 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 
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company shall not 
+.\" be used in advertising or otherwise to promote the sale, use or other 
+.\" dealing in this Software without prior written authorization from the 
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeQueryExtension __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeQueryExtension - returns the version of DBE supported by the server.
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+Status XdbeQueryExtension(
+    Display *dpy,
+    int     *major_version_return,
+    int     *minor_version_return)
+.SH DESCRIPTION
+Sets
+.I major_version_return
+and
+.I minor_version_return
+to the major and minor
+DBE protocol version supported by the server.  If the DBE library is 
+compatible with the version returned by the server, this function returns
+non-zero.  If
+.I dpy
+does not support the DBE extension, or if there was an error
+during communication with the server, or if the server and library protocol
+versions are incompatible, this function returns zero.  No other Xdbe functions
+may be called before this function.  If a client violates this rule, the
+effects of all subsequent Xdbe calls that it makes are undefined.
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeSwapBuffers().
+
diff --git a/man/XdbeSwapBuffers.man b/man/XdbeSwapBuffers.man
new file mode 100755 (executable)
index 0000000..2cd4b41
--- /dev/null
@@ -0,0 +1,96 @@
+.\" Copyright (c) 1995  Hewlett-Packard Company
+.\" 
+.\" 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 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 
+.\" HEWLETT-PACKARD COMPANY 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 Hewlett-Packard Company shall not 
+.\" be used in advertising or otherwise to promote the sale, use or other 
+.\" dealing in this Software without prior written authorization from the 
+.\" Hewlett-Packard Company.
+.\"
+.TH XdbeSwapBuffers __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XdbeSwapBuffers - swaps front and back DBE buffers.
+.SH SYNOPSIS
+\&#include <X11/extensions/Xdbe.h>
+
+Status XdbeSwapBuffers(
+    Display      *dpy,
+    XdbeSwapInfo *swap_info,
+    int          num_windows)
+.SH DESCRIPTION
+This function swaps the front and back buffers for a list of windows.  The
+argument
+.I num_windows
+specifies how many windows are to have their buffers
+swapped; it is the number of elements in the
+.I swap_info
+array.  The argument
+.I swap_info
+specifies the information needed per window to do the swap.
+
+The
+.I XdbeSwapInfo
+structure has the following fields:
+
+     Window            swap_window
+     XdbeSwapAction    swap_action
+
+.I swap_window
+specifies the window for which to swap buffers.
+.I swap_action
+specifies the swap action to use for this
+.I swap_window.
+
+.I swap_action
+determines what will happen to the new back buffer of the
+.I swap_window
+it is paired with in the list in addition to making the old back buffer
+become visible.  The defined actions are as follows:
+
+.IP XdbeUndefined
+The contents of the new back buffer become undefined.  This may be the most
+efficient action since it allows the implementation to discard the contents of
+the buffer if it needs to.
+.IP XdbeBackground
+The unobscured region of the new back buffer will be tiled with the
+window background.  The background action allows devices to use a fast clear
+capability during a swap.
+.IP XdbeUntouched
+The unobscured region of the new back buffer will be unmodified by the swap.
+.IP XdbeCopied
+The unobscured region of the new back buffer will be the contents of the old
+back buffer
+.SH ERRORS
+.IP BadMatch
+A non-double-buffered window was specified or a window was specified twice.
+.IP BadWindow
+An invalid window was specified.
+.IP BadValue
+An invalid swap action was specified.
+.SH SEE ALSO
+DBE,
+.I XdbeAllocateBackBufferName(),
+.I XdbeBeginIdiom(),
+.I XdbeDeallocateBackBufferName(),
+.I XdbeEndIdiom(),
+.I XdbeFreeVisualInfo(),
+.I XdbeGetBackBufferAttributes(),
+.I XdbeGetVisualInfo(),
+.I XdbeQueryExtension().
+
diff --git a/man/Xevi.man b/man/Xevi.man
new file mode 100755 (executable)
index 0000000..f1e97c2
--- /dev/null
@@ -0,0 +1,161 @@
+.\" Copyright (c) 1997  Silicon Graphics, Inc.
+.\" 
+.\" Permission is hereby granted, free of charge, to any person obtaining a
+.\" copy of this software and associated documentation files (the "Software"), 
+.\" to deal in the Software without restriction, including without limitation 
+.\" the rights to use, copy, modify, merge, publish, distribute, sublicense, 
+.\" and/or sell copies of the Software, and to permit persons to whom the 
+.\" Software 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 
+.\" SILICON GRAPHICS, INC. 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 Silicon Graphics, Inc. shall not 
+.\" be used in advertising or otherwise to promote the sale, use or other 
+.\" dealing in this Software without prior written authorization from
+.\" Silicon Graphics, Inc.
+.\"
+.TH XEVI __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XeviQueryExtension, XeviQueryVersion, XeviGetVisualInfo - X Extended Visual Information functions
+.SH SYNOPSIS
+\&#include <X11/extensions/XEVI.h>
+
+Bool
+XeviQueryExtension (Display *dpy);
+.LP
+Bool
+XeviQueryVersion (Display *dpy, 
+    int *major_version_return,
+    int *minor_version_return);
+.LP
+int
+XeviGetVisualInfo (Display *dpy, VisualID *visual,
+    int n_visual, ExtendedVisualInfo ** evi_return,
+    int * n_info_return);
+.fi
+.SH DESCRIPTION
+The
+X11 Extended Visual Information extension (EVI) allows a client to determine
+information about core X visuals beyond what the core protocol provides.
+
+The EVI application programming library contains the interfaces described below.
+With the exception of
+.BR XeviQueryExtension,
+if any of these routines are
+called with a display that does not support the extension, the
+ExtensionErrorHandler (which can be set with
+.BR XSetExtensionErrorHandler
+and functions the same way as
+.BR XSetErrorHandler )
+will be called and the function will then return.
+.PP
+.BR XeviQueryExtension
+returns 
+.BR True
+if the Extended Visual Information extension is available on the given display.
+A client must call
+.BR XeviQueryExtension
+before calling any other EVI
+function in order to negotiate a compatible protocol version; otherwise
+the client will get undefined behavior (EVI may or may not work).
+.PP
+.BR XeviQueryVersion
+returns
+.BR True
+if the request succeeded; the values of the major and minor protocol
+version supported by the server are returned in
+.I major_version_return
+and
+.I minor_version_return.
+.PP
+.BR XeviGetVisualInfo
+returns a list of ExtendedVisualInfo structures that describe
+visual information beyond that supported by the core protocol. This includes 
+layer information relevant for systems supporting overlays and/or underlay
+planes, and information that allows applications better to determine the level
+of hardware support for multiple colormaps. XeviGetVisualInfo returns 
+.BR Success 
+if successful, or an X error otherwise.
+If the argument
+.I visual
+is NULL, then information for all visuals of all 
+screens is returned. Otherwise, it's a pointer to a list of visuals for which
+extended visual information is desired.
+.I n_visual
+is the number of elements in the array visual.
+.I evi_return
+returns a pointer to a list of ExtendedVisualInfo. When done, the client
+should free the list using XFree\.
+.I n_info_return
+returns the number of elements in the array evi_return.
+.LP
+The
+.BR ExtendedVisualInfo
+structure has the following fields:
+.in +.5i
+.nf
+.ta 1.6i
+VisualID       \fIcore_visual_id\fR    
+int    \fIscreen\fR            
+int    \fIlevel\fR             
+unsigned int   \fItransparency_type\fR 
+unsigned int   \fItransparency_value\fR 
+unsigned int   \fImin_hw_colormaps\fR
+unsigned int   \fImax_hw_colormaps\fR
+unsigned int   \fInum_colormap_conflicts\fR
+VisualID *     \fIcolormap_conflicts\fR
+.fi
+.LP
+The combination of 
+.I core_visual_id
+and
+.I screen
+number uniquely specify the visual being described.
+.LP
+.I level
+returns the level number for the visual, 0 for normal planes, > 0 for
+overlays, < 0 for underlays.
+.LP
+.I
+transparency_type
+returns the type of transparency supported by the visual. XEVI_TRANSPARENCY_NONE if
+there are no transparent pixels, XEVI_TRANSPARENCY_PIXEL if the visual supports
+a transparent pixel, XEVI_TRANSPARENCY_MASK if the visual supports transparent
+plane(s).
+.LP
+.I transparency_value
+returns the pixel/plane value to set for transparency if transparency_type isn't
+XEVI_TRANSPARENCY_NONE.
+.LP
+.I min_hw_colormaps
+and
+.I max_hw_colormaps
+return the minimum and maximum number of hardware colormaps backing up the
+visual. 
+.LP
+.I num_colormap_conflicts
+returns the number of elements in 
+.I colormap_conflicts.
+This array returns a list of visuals that may cause conflicts in the use of the
+hardware colormap. For example, if a 12-bit hardware colormap is overloaded to
+support 8-bit colormaps, the corresponding 8-bit visuals would conflict with the
+12-bit visuals.
+
+.SH ERRORS
+.BR XeviGetVisualInfo
+will return
+.I BadValue
+if passed an illegal visual ID,
+.I BadAccess
+if the X server does not respond,
+.I BadAlloc
+if there is a memory allocation failure.
diff --git a/man/XeviGetVisualInfo.man b/man/XeviGetVisualInfo.man
new file mode 100755 (executable)
index 0000000..a4324e7
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xevi.__libmansuffix__
diff --git a/man/XeviQueryExtension.man b/man/XeviQueryExtension.man
new file mode 100755 (executable)
index 0000000..a4324e7
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xevi.__libmansuffix__
diff --git a/man/XeviQueryVersion.man b/man/XeviQueryVersion.man
new file mode 100755 (executable)
index 0000000..a4324e7
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xevi.__libmansuffix__
diff --git a/man/Xmbuf.man b/man/Xmbuf.man
new file mode 100755 (executable)
index 0000000..7ddacb7
--- /dev/null
@@ -0,0 +1,343 @@
+.\" Copyright (c) 1989, 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 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 
+.\" dealing in this Software without prior written authorization from the 
+.\" X Consortium.
+.\"
+.\" Copyright 1989, Digital Equipment Corporation.
+.\" Permission to use, copy, modify, distribute, and sell 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.
+.\" Digital Equipment Corporation 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.
+.\"
+.de ZN
+.ie t \fB\^\\$1\^\fR\\$2
+.el \fI\^\\$1\^\fP\\$2
+..
+.TH XMBUF __libmansuffix__ __xorgversion__ "X FUNCTIONS"
+.SH NAME
+XmbufQueryExtension, XmbufGetVersion, XmbufCreateBuffers, XmbufDestroyBuffers, XmbufDisplayBuffers, XmbufGetWindowAttributes, XmbufChangeWindowAttributes, XmbufGetBufferAttributes, XmbufChangeBufferAttributes, XmbufGetScreenInfo, XmbufCreateStereoWindow - X multibuffering functions
+.SH SYNTAX
+.nf
+.LP
+\&#include <X11/extensions/multibuf.h>
+.LP
+Bool XmbufQueryExtension(
+    Display *dpy,
+    Display *dpy,
+    int *event_base_return,
+    int *error_base_return);
+.LP
+Status XmbufGetVersion(
+    Display *dpy,
+    int *major_version_return,
+    int *minor_version_return);
+.LP
+int XmbufCreateBuffers(
+    Display *dpy,
+    Window window,
+    int count,
+    int update_action,
+    int update_hint,
+    Multibuffer *buffers_update);
+.LP
+void XmbufDestroyBuffers(
+    Display *dpy,
+    Window window);
+.LP
+void XmbufDisplayBuffers(
+    Display *dpy,
+    int count,
+    Multibuffer *buffers,
+    int min_delay,
+    int max_delay);
+.LP
+Status XmbufGetWindowAttributes(
+    Display *dpy,
+    Window window,
+    XmbufWindowAttributes *attributes);
+.LP
+void XmbufChangeWindowAttributes(
+    Display *dpy,
+    Window window,
+    unsigned long valuemask,
+    XmbufSetWindowAttributes *attributes);
+.LP
+Status XmbufGetBufferAttributes(
+    Display *dpy,
+    Multibuffer buffer,
+    XmbufBufferAttributes *attributes);
+.LP
+void XmbufChangeBufferAttributes(
+    Display *dpy,
+    Multibuffer buffer,
+    unsigned long valuemask,
+    XmbufSetBufferAttributes *attributes);
+.LP
+Status XmbufGetScreenInfo(
+    Display *dpy,
+    Drawable drawable,
+    int *nmono_return,
+    XmbufBufferInfo **mono_info_return,
+    int *nstereo_return,
+    XmbufBufferInfo **stereo_info_return);
+.LP
+Window XmbufCreateStereoWindow(
+    Display *dpy,
+    Window parent,
+    int x,
+    int y,
+    unsigned int width,
+    unsigned int height,
+    unsigned int border_width,
+    int depth,
+    unsigned int class,                 /\&* InputOutput, InputOnly*/
+    Visual *visual,
+    unsigned long valuemask,
+    XSetWindowAttributes *attributes,
+    Multibuffer *left_return,
+    Multibuffer *right_return);
+.fi
+.SH STRUCTURES
+.nf
+.ta 3i
+\fIEvents:\fP
+typedef struct {
+    int type;  /\&* of event */
+    unsigned long serial;      /\&* # of last request processed by server */
+    int send_event;    /\&* true if this came from a SendEvent request */
+    Display *display;  /\&* Display the event was read from */
+    Multibuffer buffer;        /\&* buffer of event */
+    int state; /\&* see Clobbered constants above */
+} XmbufClobberNotifyEvent;
+.LP
+typedef struct {
+    int type;  /\&* of event */
+    unsigned long serial;      /\&* # of last request processed by server */
+    int send_event;    /\&* true if this came from a SendEvent request */
+    Display *display;  /\&* Display the event was read from */
+    Multibuffer buffer;        /\&* buffer of event */
+} XmbufUpdateNotifyEvent;
+.LP
+\fIPer-window attributes that can be got:\fP
+typedef struct {
+    int displayed_index;       /\&* which buffer is being displayed */
+    int update_action; /\&* Undefined, Background, Untouched, Copied */
+    int update_hint;   /\&* Frequent, Intermittent, Static */
+    int window_mode;   /\&* Mono, Stereo */
+    int nbuffers;      /\&* Number of buffers */
+    Multibuffer *buffers;      /\&* Buffers */
+} XmbufWindowAttributes;
+.LP
+\fIPer-window attributes that can be set:\fP
+typedef struct {
+    int update_hint;   /\&* Frequent, Intermittent, Static */
+} XmbufSetWindowAttributes;
+.LP
+\fIPer-buffer attributes that can be got:\fP
+typedef struct {
+    Window window;     /\&* which window this belongs to */
+    unsigned long event_mask;  /\&* events that have been selected */
+    int buffer_index;  /\&* which buffer is this */
+    int side;  /\&* Mono, Left, Right */
+} XmbufBufferAttributes;
+.LP
+\fIPer-buffer attributes that can be set:\fP
+typedef struct {
+    unsigned long event_mask;  /\&* events that have been selected */
+} XmbufSetBufferAttributes;
+.LP
+\fIPer-screen buffer info (there will be lists of them):\fP
+typedef struct {
+    VisualID visualid; /\&* visual usable at this depth */
+    int max_buffers;   /\&* most buffers for this visual */
+    int depth; /\&* depth of buffers to be created */
+} XmbufBufferInfo;
+.fi
+.SH DESCRIPTION
+The application programming library for the
+\fIX11 Double-Buffering, Multi-Buffering, and Stereo Extension\fP
+contains the interfaces described below.
+With the exception of
+.ZN XmbufQueryExtension ,
+if any of these routines are
+called with a display that does not support the extension, the
+ExtensionErrorHandler (which can be set with
+.ZN XSetExtensionErrorHandler
+and functions the same way as
+.ZN XSetErrorHandler )
+will be called and the function will then return.
+.PP
+.ZN XmbufQueryExtension
+returns 
+.ZN True
+if the multibuffering/stereo 
+extension is available on the
+given display.  If the extension exists, the value of the first event
+code (which should be added to the event type constants
+.ZN MultibufferClobberNotify
+and 
+.ZN MultibufferUpdateNotify
+to get the actual
+values) is stored into event_base_return and the value of the first
+error code (which should be added to the error type constant
+.ZN MultibufferBadBuffer
+to get the actual value) is stored into error_base_return.
+.PP
+.ZN XmbufGetVersion
+gets the major and minor version numbers of the extension.  
+The return
+value is zero if an error occurs or non-zero if no error happens.
+.PP
+.ZN XmbufCreateBuffers
+requests that "count" buffers be 
+created with the given update_action
+and update_hint and be associated with the indicated window.  The
+number of buffers created is returned (zero if an error occurred)
+and buffers_update is filled in with that many Multibuffer identifiers.
+.PP
+.ZN XmbufDestroyBuffers
+destroys the buffers associated 
+with the given window.
+.PP
+.ZN XmbufDisplayBuffers
+displays the indicated buffers their
+appropriate windows within
+max_delay milliseconds after min_delay milliseconds have passed.
+No two buffers may be associated with the same window or else a Match
+error is generated.
+.PP
+.ZN XmbufGetWindowAttributes
+gets the multibuffering attributes that apply 
+to all buffers associated
+with the given window.
+The list of buffers returns may be freed with 
+.ZN XFree .
+Returns non-zero on success and zero if an error occurs.
+.PP
+.ZN XmbufChangeWindowAttributes
+sets the multibuffering attributes 
+that apply to all buffers associated
+with the given window.  This is currently limited to the update_hint.
+.PP
+.ZN XmbufGetBufferAttributes
+gets the attributes for the indicated buffer.
+Returns non-zero on
+success and zero if an error occurs.
+.PP
+.ZN XmbufChangeBufferAttributes
+sets the attributes for the indicated buffer.
+This is currently limited to the event_mask.
+.PP
+.ZN XmbufGetScreenInfo
+gets the parameters controlling how
+mono and stereo windows may be
+created on the screen of the given drawable.  The numbers of sets of
+visual and depths are returned in nmono_return and nstereo_return.  If
+nmono_return is greater than zero, then mono_info_return is set to the
+address of an array of 
+.ZN XmbufBufferInfo
+structures describing the
+various visuals and depths that may be used.  Otherwise,
+mono_info_return is set to NULL.  Similarly, stereo_info_return is set
+according to nstereo_return.  The storage returned in mono_info_return
+and stereo_info_return may be released by 
+.ZN XFree .
+If no errors are
+encounted, non-zero will be returned.
+.PP
+.ZN XmbufCreateStereoWindow
+creates a stereo window in the same way that 
+.ZN XCreateWindow
+creates a mono window.  The buffer ids for the left and right buffers are
+returned in left_return and right_return, respectively.  If an
+extension error handler that returns is installed, 
+.ZN None
+will be returned if the extension is not available on this display.
+.SH PREDEFINED VALUES
+.sp
+Update_action field:
+.in +.5i
+.nf
+.ZN MultibufferUpdateActionUndefined   
+.ZN MultibufferUpdateActionBackground
+.ZN MultibufferUpdateActionUntouched
+.ZN MultibufferUpdateActionCopied
+.in -.5i
+.fi
+.sp
+Update_hint field:
+.in +.5i
+.nf
+.ZN MultibufferUpdateHintFrequent              
+.ZN MultibufferUpdateHintIntermittent
+.ZN MultibufferUpdateHintStatic        
+.in -.5i
+.sp
+.fi
+Valuemask fields:
+.in +.5i
+.nf
+.ZN MultibufferWindowUpdateHint
+.ZN MultibufferBufferEventMask
+.in -.5i
+.fi
+.sp
+Mono vs. stereo and left vs. right:
+.in +.5i
+.nf
+.ZN MultibufferModeMono        
+.ZN MultibufferModeStereo
+.ZN MultibufferSideMono
+.ZN MultibufferSideLeft
+.ZN MultibufferSideRight               
+.in -.5i
+.fi
+.sp
+Clobber state:
+.in +.5i
+.nf
+.ZN MultibufferUnclobbered     
+.ZN MultibufferPartiallyClobbered
+.ZN MultibufferFullyClobbered  
+.in -.5i
+.fi
+.sp
+Event stuff:
+.in +.5i
+.nf
+.ZN MultibufferClobberNotifyMask
+.ZN MultibufferUpdateNotifyMask
+.ZN MultibufferClobberNotify
+.ZN MultibufferUpdateNotify
+.ZN MultibufferNumberEvents
+.ZN MultibufferBadBuffer
+.ZN MultibufferNumberErrors
+.in -.5i
+.fi
+.SH BUGS
+This manual page needs more work.
+.SH SEE ALSO
+\fIExtending X for Double Buffering, Multi-Buffering, and Stereo\fP
diff --git a/man/XmbufChangeBufferAttributes.man b/man/XmbufChangeBufferAttributes.man
new file mode 100755 (executable)
index 0000000..2d3501d
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xmbuf.__libmansuffix__
diff --git a/man/XmbufChangeWindowAttributes.man b/man/XmbufChangeWindowAttributes.man
new file mode 100755 (executable)
index 0000000..2d3501d
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xmbuf.__libmansuffix__
diff --git a/man/XmbufCreateBuffers.man b/man/XmbufCreateBuffers.man
new file mode 100755 (executable)
index 0000000..2d3501d
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xmbuf.__libmansuffix__
diff --git a/man/XmbufCreateStereoWindow.man b/man/XmbufCreateStereoWindow.man
new file mode 100755 (executable)
index 0000000..2d3501d
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xmbuf.__libmansuffix__
diff --git a/man/XmbufDestroyBuffers.man b/man/XmbufDestroyBuffers.man
new file mode 100755 (executable)
index 0000000..2d3501d
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xmbuf.__libmansuffix__
diff --git a/man/XmbufDisplayBuffers.man b/man/XmbufDisplayBuffers.man
new file mode 100755 (executable)
index 0000000..2d3501d
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xmbuf.__libmansuffix__
diff --git a/man/XmbufGetBufferAttributes.man b/man/XmbufGetBufferAttributes.man
new file mode 100755 (executable)
index 0000000..2d3501d
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xmbuf.__libmansuffix__
diff --git a/man/XmbufGetScreenInfo.man b/man/XmbufGetScreenInfo.man
new file mode 100755 (executable)
index 0000000..2d3501d
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xmbuf.__libmansuffix__
diff --git a/man/XmbufGetVersion.man b/man/XmbufGetVersion.man
new file mode 100755 (executable)
index 0000000..2d3501d
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xmbuf.__libmansuffix__
diff --git a/man/XmbufGetWindowAttributes.man b/man/XmbufGetWindowAttributes.man
new file mode 100755 (executable)
index 0000000..2d3501d
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xmbuf.__libmansuffix__
diff --git a/man/XmbufQueryExtension.man b/man/XmbufQueryExtension.man
new file mode 100755 (executable)
index 0000000..2d3501d
--- /dev/null
@@ -0,0 +1 @@
+.so man__libmansuffix__/Xmbuf.__libmansuffix__
diff --git a/packaging/libXext.spec b/packaging/libXext.spec
new file mode 100644 (file)
index 0000000..6c802b1
--- /dev/null
@@ -0,0 +1,75 @@
+
+Name:       libXext
+Summary:    X.Org X11 libXext runtime library
+Version:    1.2.0
+Release:    1
+Group:      System/Libraries
+License:    MIT
+URL:        http://www.x.org/
+Source0:    http://cgit.freedesktop.org/xorg/lib/libXext/snapshot/%{name}-%{version}.tar.gz
+Requires(post):  /sbin/ldconfig
+Requires(postun):  /sbin/ldconfig
+BuildRequires:  pkgconfig(xorg-macros)
+BuildRequires:  pkgconfig(xproto)
+BuildRequires:  pkgconfig(x11)
+BuildRequires:  pkgconfig(xextproto)
+BuildRequires:  pkgconfig(xau)
+
+
+%description
+Description: %{summary}
+
+
+%package devel
+Summary:    Development components for the libXext library
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+
+%description devel
+Description: %{summary}
+
+
+%prep
+%setup -q -n %{name}-%{version}
+
+
+
+%build
+
+%reconfigure \
+       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 AUTHORS COPYING
+%{_libdir}/libXext.so.6
+%{_libdir}/libXext.so.6.4.0
+
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/X11/extensions/*.h
+%{_libdir}/libXext.so
+%{_libdir}/pkgconfig/xext.pc
+%doc %{_mandir}/man3/*.3*
+%doc %{_docdir}/%{name}
+
diff --git a/specs/Makefile.am b/specs/Makefile.am
new file mode 100755 (executable)
index 0000000..8986e3e
--- /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 = dbelib.xml dpmslib.xml shapelib.xml synclib.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/dbelib.xml b/specs/dbelib.xml
new file mode 100755 (executable)
index 0000000..83edf7b
--- /dev/null
@@ -0,0 +1,728 @@
+<?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="dbelib">
+
+<bookinfo>
+   <title>Double Buffer Extension Library</title>
+   <subtitle>X Consortium Standard</subtitle>
+   <!-- <releaseinfo>X Version 11, Release 6.4</releaseinfo> -->
+   <authorgroup>
+      <author>
+         <firstname>Ian</firstname><surname>Elliot</surname>
+      </author>
+   </authorgroup>
+   <othercredit>
+      <firstname>Davide</firstname><surname>Wiggins</surname>
+   </othercredit>
+   <corpname>Hewlett-Packard Company</corpname>
+   <copyright><year>1989</year><holder>X Consortium, Inc and Digital Equipment Corporation</holder></copyright>
+   <copyright><year>1992</year><holder>X Consortium, Inc and Intergraph Corporation</holder></copyright>
+   <copyright><year>1993</year><holder>X Consortium, Inc and Silicon Graphics, Inc.</holder></copyright>
+   <copyright><year>1994</year><holder>X Consortium, Inc and Hewlett-Packard Company</holder></copyright>
+   <copyright><year>1995</year><holder>X Consortium, Inc and Hewlett-Packard Company</holder></copyright>
+   <releaseinfo>Version 1.0</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. Digital Equipment
+Corporation, Intergraph Corporation, Silicon Graphics, Hewlett-Packard, and
+the X Consortium make 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>
+
+</legalnotice>
+
+</bookinfo>
+
+<chapter id="introduction">
+<title>Introduction</title>
+<para>
+The Double Buffer Extension (DBE) provides a standard way to utilize
+double-buffering within the framework of the X Window System.
+Double-buffering uses two buffers, called front and back, which hold images.
+The front buffer is visible to the user; the back buffer is not. Successive
+frames of an animation are rendered into the back buffer while the previously
+rendered frame is displayed in the front buffer. When a new frame is ready,
+the back and front buffers swap roles, making the new frame visible. Ideally,
+this exchange appears to happen instantaneously to the user and with no
+visual artifacts. Thus, only completely rendered images are presented to the
+user, and they remain visible during the entire time it takes to render a new
+frame. The result is a flicker-free animation.
+</para>
+
+</chapter>
+
+<chapter id="goals">
+<title>Goals</title>
+
+<para>
+This extension should enable clients to:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+Allocate and deallocate double-buffering for a window.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Draw to and read from the front and back buffers associated with a window.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Swap the front and back buffers associated with a window.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Specify a wide range of actions to be taken when a window is swapped.
+This includes explicit, simple swap actions (defined below), and more
+complex actions (for example, clearing ancillary buffers) that can be put
+together within explicit "begin" and "end" requests (defined below).
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Request that the front and back buffers associated with multiple
+double-buffered windows be swapped simultaneously.
+    </para>
+  </listitem>
+</itemizedlist>
+
+<para>
+In addition, the extension should:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+Allow multiple clients to use double-buffering on the same window.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Support a range of implementation methods that can capitalize on
+existing hardware features.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Add no new event types.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Be reasonably easy to integrate with a variety of direct graphics
+hardware access (DGHA) architectures.
+    </para>
+  </listitem>
+</itemizedlist>
+
+</chapter>
+
+<chapter id="concepts">
+<title>Concepts</title>
+<para>
+Normal windows are created using the core CreateWindow request, which
+allocates a set of window attributes and, for InputOutput windows, a front
+buffer, into which an image can be drawn. The contents of this buffer will be
+displayed when the window is visible.
+</para>
+<para>
+This extension enables applications to use double-buffering with a window.
+This involves creating a second buffer, called a back buffer, and associating
+one or more back buffer names (XIDs) with the window for use when referring
+to (that is, drawing to or reading from) the window’s back buffer. The back
+buffer name is a DRAWABLE of type BACKBUFFER.
+</para>
+<para>
+DBE provides a relative double-buffering model. One XID, the window,
+always refers to the front buffer. One or more other XIDs, the back buffer
+names, always refer to the back buffer. After a buffer swap, the window
+continues to refer to the (new) front buffer, and the back buffer name
+continues to refer to the (new) back buffer. Thus, applications and toolkits
+that want to just render to the back buffer always use the back buffer name
+for all drawing requests to the window. Portions of an application that want
+to render to the front buffer always use the window XID for all drawing
+requests to the window.
+</para>
+<para>
+Multiple clients and toolkits can all use double-buffering on the same window.
+DBE does not provide a request for querying whether a window has
+double-buffering support, and if so, what the back buffer name is. Given the
+asynchronous nature of the X Window System, this would cause race
+conditions. Instead, DBE allows multiple back buffer names to exist for the
+same window; they all refer to the same physical back buffer. The first time a
+back buffer name is allocated for a window, the window becomes
+double-buffered and the back buffer name is associated with the window.
+Subsequently, the window already is a double-buffered window, and nothing
+about the window changes when a new back buffer name is allocated, except
+that the new back buffer name is associated with the window. The window
+remains double-buffered until either the window is destroyed or until all of the
+back buffer names for the window are deallocated.
+</para>
+<para>
+In general, both the front and back buffers are treated the same.
+particular, here are some important characteristics:
+</para>
+<itemizedlist>
+  <listitem>
+    <para>
+Only one buffer per window can be visible at a time (the front buffer).
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Both buffers associated with a window have the same visual type, depth,
+width, height, and shape as the window.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Both buffers associated with a window are "visible" (or "obscured") in
+the same way. When an Expose event is generated for a window, both
+buffers should be considered to be damaged in the exposed area.
+Damage that occurs to either buffer will result in an Expose event on
+the window. When a double-buffered window is exposed, both buffers
+are tiled with the window background, exactly as stated by the core
+protocol. Even though the back buffer is not visible, terms such as
+obscure apply to the back buffer as well as to the front buffer.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It is acceptable at any time to pass a BACKBUFFER in any request,
+notably any core or extension drawing request, that expects a
+DRAWABLE.  This enables an application to draw directly into
+BACKBUFFERs in the same fashion as it would draw into any other
+DRAWABLE.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+It is an error (Window) to pass a BACKBUFFER in a core request that
+expects a Window.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+A BACKBUFFER will never be sent by core X in a reply, event, or
+error where a Window is specified.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If core X11 backing-store and save-under applies to a double-buffered
+window, it applies to both buffers equally.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+If the core ClearArea request is executed on a double-buffered window,
+the same area in both the front and back buffers is cleared.
+    </para>
+  </listitem>
+</itemizedlist>
+
+<para>
+The effect of passing a window to a request that accepts a
+<function>DRAWABLE</function> is
+unchanged by this extension. The window and front buffer are synonomous
+with each other. This includes obeying the <function>GetImage</function>
+semantics and the
+subwindow-mode semantics if a core graphics context is involved. Regardless
+of whether the window was explicitly passed in a
+<function>GetImage</function> request, or
+implicitly referenced (that is, one of the window’s ancestors was passed in the
+request), the front (that is, visible) buffer is always referenced. Thus,
+DBE-naive screen dump clients will always get the front buffer.
+<function>GetImage</function> on
+a back buffer returns undefined image contents for any obscured regions of the
+back buffer that fall within the image.
+</para>
+<para>
+Drawing to a back buffer always uses the clip region that would be used to
+draw to the front buffer with a GC subwindow-mode of
+<function>ClipByChildren</function>. If
+an ancestor of a double-buffered window is drawn to with a core GC having a
+subwindow-mode of IncludeInferiors, the effect on the double-buffered
+window’s back buffer depends on the depth of the double-buffered window
+and the ancestor. If the depths are the same, the contents of the back buffer
+of the double-buffered window are not changed. If the depths are different,
+the contents of the back buffer of the double-buffered window are undefined
+for the pixels that the <function>IncludeInferiors</function> drawing touched.
+</para>
+
+
+<para>
+DBE adds no new events. DBE does not extend the semantics of any existing
+events with the exception of adding a new DRAWABLE type called
+BACKBUFFER. If events, replies, or errors that contain a DRAWABLE (for
+example, <function>GraphicsExpose</function>) are generated in response to
+a request, the
+DRAWABLE returned will be the one specified in the request.
+</para>
+<para>
+DBE advertises which visuals support double-buffering.
+</para>
+<para>
+DBE does not include any timing or synchronization facilities. Applications
+that need such facilities (for example, to maintain a constant frame rate)
+should investigate the Synchronization Extension, an X Consortium standard.
+</para>
+
+<sect1 id="window_management_operations">
+<title>Window Management Operations</title>
+
+<para>
+The basic philosophy of DBE is that both buffers are treated the same by core
+X window management operations.
+</para>
+<para>
+When the core <function>DestroyWindow</function> is executed on a
+double-buffered window, both buffers associated with the window are
+destroyed, and all back buffer names associated with the window are freed.
+</para>
+<para>
+If the core <function>ConfigureWindow</function> request changes the size
+of a window, both buffers assume the new size. If the window’s size
+increases, the effect on the buffers depends on whether the implementation
+honors bit gravity for buffers.
+If bit gravity is implemented, then the contents of both buffers are moved in
+accordance with the window’s bit gravity (see the core
+<function>ConfigureWindow</function>
+request), and the remaining areas are tiled with the window background. If
+bit gravity is not implemented, then the entire unobscured region of both
+buffers is tiled with the window background. In either case,
+<function>Expose</function> events are
+generated for the region that is tiled with the window background.
+If the core GetGeometry request is executed on a BACKBUFFER, the
+returned x, y, and border-width will be zero.
+</para>
+<para>
+If the Shape extension
+<function>ShapeRectangles</function>,
+<function>ShapeMask</function>,
+<function>ShapeCombine</function>, or
+<function>ShapeOffset</function>
+request is executed on a double-buffered window, both buffers
+are reshaped to match the new window shape. The region difference is the
+following:
+</para>
+
+<literallayout remap='Ds'>
+        D = newshape − oldshape
+</literallayout>
+
+<para>
+It is tiled with the window background in both buffers, and
+<function>Expose</function>
+events are generated for D.
+</para>
+
+</sect1>
+
+<sect1 id="complex_swap_actions">
+<title>Complex Swap Actions</title>
+<para>
+DBE has no explicit knowledge of ancillary buffers (for example, depth buffers
+or alpha buffers), and only has a limited set of defined swap actions. Some
+applications may need a richer set of swap actions than DBE provides. Some
+DBE implementations have knowledge of ancillary buffers, and/or can provide
+a rich set of swap actions. Instead of continually extending DBE to increase
+its set of swap actions, DBE provides a flexible "idiom" mechanism. If an
+application’s needs are served by the defined swap actions, it should use them;
+otherwise, it should use the following method of expressing a complex swap
+action as an idiom. Following this policy will ensure the best possible
+performance across a wide variety of implementations.
+</para>
+<para>
+As suggested by the term "idiom," a complex swap action should be expressed
+as a group/series of requests. Taken together, this group of requests may be
+combined into an atomic operation by the implementation, in order to
+maximize performance. The set of idioms actually recognized for optimization
+is implementation dependent.
+To help with idiom expression and
+interpretation, an idiom must be surrounded by two protocol requests:
+<function>DBEBeginIdiom</function> and <function>DBEEndIdiom</function>.
+Unless this begin-end pair surrounds the idiom, it may not be recognized
+by a given implementation, and performance will suffer.
+</para>
+<para>
+For example, if an application wants to swap buffers for two windows, and use
+core X to clear only certain planes of the back buffers, the application would
+issue the following protocol requests as a group, and in the following order:
+</para>
+
+<itemizedlist>
+  <listitem>
+    <para>
+<function>DBEBeginIdiom</function> request.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+<function>DBESwapBuffers</function> request with XIDs for two windows, each of which uses
+a swap action of Untouched.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Core X <function>PolyFillRectangle</function> request to the back buffer of one window.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+Core X <function>PolyFillRectangle</function> request to the back buffer of the other
+window.
+    </para>
+  </listitem>
+  <listitem>
+    <para>
+<function>DBEEndIdiom</function> request.
+    </para>
+  </listitem>
+</itemizedlist>
+
+<para>
+The <function>DBEBeginIdiom</function> and <function>DBEEndIdiom</function>
+requests do not perform any actions
+themselves. They are treated as markers by implementations that can
+combine certain groups/series of requests as idioms, and are ignored by other
+implementations or for nonrecognized groups/series of requests. If these
+requests are sent out of order, or are mismatched, no errors are sent, and the
+requests are executed as usual, though performance may suffer.
+</para>
+
+<para>
+
+An idiom need not include a <function>DBESwapBuffers</function> request.
+For example, if a swap action of <function>Copied</function> is desired,
+but only some of the planes should be copied, a core X
+<function>CopyArea</function> request may be used instead of
+<function>DBESwapBuffers</function>. If
+<function>DBESwapBuffers</function> is included in an idiom, it should
+immediately follow the
+<function>DBEBeginIdiom</function> request. Also, when the
+<function>DBESwapBuffers</function> is included in an idiom, that
+request’s swap action will still be valid, and if the swap action
+might overlap with another request, then the final result of the idiom must be
+as if the separate requests were executed serially. For example, if the
+specified swap action is <function>Untouched</function>, and if a
+<function>PolyFillRectangle</function> using a client clip
+rectangle is done to the window’s back buffer after the
+<function>DBESwapBuffers</function> request, then the contents of the new
+back buffer (after the idiom) will be the
+same as if the idiom was not recognized by the implementation.
+</para>
+<para>
+It is highly recommended that Application Programming Interface (API)
+providers define, and application developers use, "convenience" functions that
+allow client applications to call one procedure that encapsulates common
+idioms. These functions will generate the
+<function>DBEBeginIdiom</function> request, the idiom
+requests, and <function>DBEEndIdiom</function> request. Usage of these
+functions will ensure best possible performance across a wide
+variety of implementations.
+</para>
+
+</sect1>
+</chapter>
+
+<chapter id="c_language_bindings">
+<title>C Language Binding</title>
+<para>
+All identifier The header for this extension is &lt;X11/extensions/Xdbe.h&gt;.
+names provided by this header begin with Xdbe.
+</para>
+
+<sect1 id="types">
+<title>Types</title>
+
+<para>
+The type <function>XdbeBackBuffer</function> is a <function>Drawable</function>.
+</para>
+
+<para>
+The type <function>XdbeSwapAction</function> can be one of the constants
+<function>XdbeUndefined</function>,
+<function>XdbeBackground</function>,
+<function>XdbeUntouched</function>, or
+<function>XdbeCopied</function>.
+</para>
+
+</sect1>
+
+<sect1 id="c_functions">
+<title>C Functions</title>
+<para>
+The C functions provide direct access to the protocol and add no additional
+semantics. For complete details on the effects of these functions, refer to the
+appropriate protocol request, which can be derived by replacing Xdbe at the
+start of the function name with DBE. All functions that have return type
+<function>Status</function> will return nonzero for success and
+zero for failure.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XdbeQueryExtension</function></funcdef>
+    <paramdef>Display <parameter> *dpy</parameter></paramdef>
+    <paramdef>int <parameter> *major_version_return</parameter></paramdef>
+    <paramdef>int <parameter> *minor_version_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XdbeQueryExtension</function> sets major version return and minor
+version return to the major and minor DBE protocol version supported by
+the server. If the DBE library is compatible with the version returned by
+the server, it returns nonzero. If dpy does not support the DBE extension,
+or if there was an error during communication with the server, or if the
+server and library protocol versions are incompatible, it returns zero.
+No other Xdbe functions may be called before this function. If a client
+violates this rule, the effects of all subsequent Xdbe calls that it makes
+are undefined.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XdbeScreenVisualInfo *<function>XdbeGetVisualInfo</function></funcdef>
+    <paramdef>Display <parameter> *dpy</parameter></paramdef>
+    <paramdef>Drawable <parameter> *screen_specifiers</parameter></paramdef>
+    <paramdef>int <parameter> *num_screens</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+
+<function>XdbeGetVisualInfo</function> returns information about which
+visuals support double buffering. The argument num_screens specifies how
+many elements there are in the screen_specifiers list. Each drawable in
+screen_specifiers designates a screen for which the supported visuals are
+being requested. If num_screens is zero, information for all screens is
+requested. In this case, upon return from this function, num_screens will
+be set to the number of screens that were found. If an error occurs,
+this function returns NULL; otherwise, it returns a pointer to a list of
+<function>XdbeScreenVisualInfo</function>
+structures of length num_screens.  The nth element in the returned list
+corresponds to the nth drawable in the screen_specifiers list, unless
+
+element in the returned list corresponds to the nth screen of the server,
+starting with screen zero.
+</para>
+
+
+<para>
+The XdbeScreenVisualInfo structure has the following fields:
+</para>
+<literallayout remap='Ds'>
+int                     count      number of items in visinfo
+XdbeVisualInfo*    visinfo     list of visuals and depths for this screen
+</literallayout>
+
+<para>
+The <function>XdbeVisualInfo</function> structure has the following fields:
+</para>
+
+<literallayout remap='Ds'>
+VisualID         visual    one visual ID that supports double-buffering
+int              depth     depth of visual in bits
+int              perflevel  performance level of visual
+</literallayout>
+
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void XdbeFreeVisualInfo <function>XdbeGetVisualInfo</function></funcdef>
+    <paramdef>XdbeScreenVisualInfo <parameter> *visual_info</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XdbeFreeVisualInfo</function> frees the list of
+<function>XdbeScreenVisualInfo</function> returned by
+<function>XdbeGetVisualInfo</function>.
+</para>
+
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XdbeBackBuffer <function>XdbeAllocateBackBufferName</function></funcdef>
+    <paramdef>Display <parameter> *dpy</parameter></paramdef>
+    <paramdef>Window <parameter> *window</parameter></paramdef>
+    <paramdef>XdbeSwapAction <parameter> swap_action</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+
+<para>
+<function>XdbeAllocateBackBufferName</function> returns a drawable ID used
+to refer to the back buffer of the specified window. The swap_action is a
+hint to indicate the swap_action that will likely be used in subsequent
+calls to <function>XdbeSwapBuffers</function>.  The actual swap_action
+used in calls to <function>XdbeSwapBuffers</function> does not have to be
+the same as the swap_action passed to this function, though clients are
+encouraged to provide accurate information whenever possible.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XdbeDeallocateBackBufferName</function></funcdef>
+    <paramdef>Display <parameter> *dpy</parameter></paramdef>
+    <paramdef>XdbeBackBuffer <parameter> buffer</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XdbeDeallocateBackBufferName</function> frees the specified
+drawable ID, buffer, that was obtained via
+<function>XdbeAllocateBackBufferName</function>. The buffer must be a valid
+name for the back buffer of a window, or an
+<function>XdbeBadBuffer</function> error results.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XdbeSwapBuffers</function></funcdef>
+    <paramdef>Display <parameter> *dpy</parameter></paramdef>
+    <paramdef>XdbeSwapInfo <parameter> *swap_info</parameter></paramdef>
+    <paramdef>int <parameter> num_windows</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XdbeSwapBuffers</function> swaps the front and back buffers
+for a list of windows. The argument num_windows specifies how many windows
+are to have their buffers swapped; it is the number of elements in the
+swap_info array. The argument swap_info specifies the information needed
+per window to do the swap.
+</para>
+<para>
+The XdbeSwapInfo structure has the following fields:
+</para>
+
+<literallayout remap='Ds'>
+Window              swap_window    window for which to swap buffers
+XdbeSwapAction      swap_action    swap action to use for this swap window
+</literallayout>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XdbeBeginIdiom</function></funcdef>
+    <paramdef>Display <parameter> *dpy</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XdbeBeginIdiom</function> marks the beginning of an idiom
+sequence. See
+<link linkend="complex_swap_actions">
+<xref linkend="complex_swap_actions"></xref></link>
+for a complete discussion of idioms.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XdbeEndIdiom</function></funcdef>
+    <paramdef>Display <parameter> *dpy</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XdbeEndIdiom</function> marks the end of an idiom sequence.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XdbeBackBufferAttributes *<function>XdbeGetBackBufferAttributes</function></funcdef>
+    <paramdef>Display <parameter> *dpy</parameter></paramdef>
+    <paramdef>XdbeBackBuffer <parameter> buffer</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XdbeGetBackBufferAttributes</function> returns the attributes associated with
+the specified buffer.
+</para>
+<para>
+The XdbeBackBufferAttributes structure has the following fields:
+</para>
+
+<literallayout remap='Ds'>
+Window           window           window that buffer belongs to
+</literallayout>
+
+<para>
+If buffer is not a valid <function>XdbeBackBuffer</function>, window is
+set to None.
+</para>
+<para>
+The returned <function>XdbeBackBufferAttributes</function> structure
+can be freed with the Xlib function <function>XFree</function>.
+</para>
+</sect1>
+
+<sect1 id="errors">
+<title>Errors</title>
+<para>
+The <function>XdbeBufferError</function> structure has the following fields:
+</para>
+<literallayout remap='Ds'>
+int                 type
+Display *           display       Display the event was read from
+XdbeBackBuffer      buffer        resource id
+unsigned long       serial        serial number of failed request
+unsigned char       error code    error base + <function>XdbeBadBuffer</function>
+unsigned char       request code  Major op-code of failed request
+unsigned char       minor code    Minor op-code of failed request
+</literallayout>
+</sect1>
+</chapter>
+
+<chapter id="acknowledgements">
+<title>Acknowledgements</title>
+
+<para>
+We wish to thank the following individuals who have contributed their time
+and talent toward shaping the DBE specification:
+</para>
+<para>
+T. Alex Chen, IBM; Peter Daifuku, Silicon Graphics, Inc.; Ian Elliott,
+Hewlett-Packard Company; Stephen Gildea, X Consortium, Inc.; Jim Graham,
+Sun; Larry Hare, AGE Logic; Jay Hersh, X Consortium, Inc.; Daryl Huff,
+Sun; Deron Dann Johnson, Sun; Louis Khouw, Sun; Mark Kilgard, Silicon
+Graphics, Inc.; Rob Lembree, Digital Equipment Corporation; Alan Ricker,
+Metheus; Michael Rosenblum, Digital Equipment Corporation; Bob Scheifler,
+X Consortium, Inc.; Larry Seiler, Digital Equipment Corporation; Jeanne
+Sparlin Smith, IBM; Jeff Stevenson, Hewlett-Packard Company; Walter
+Strand, Metheus; Ken Tidwell, Hewlett-Packard Company; and David P.
+Wiggins, X Consortium, Inc.
+</para>
+<para>
+Mark provided the impetus to start the DBE project. Ian wrote the first draft
+of the specification. David served as architect.
+</para>
+
+</chapter>
+<chapter id="references">
+<title>References</title>
+<para>
+Jeffrey Friedberg, Larry Seiler, and Jeff Vroom, "Multi-buffering Extension
+Specification Version 3.3."
+</para>
+<para>
+Tim Glauert, Dave Carver, Jim Gettys, and David P. Wiggins, "X
+Synchronization Extension Version 3.0."
+</para>
+</chapter>
+</book>
diff --git a/specs/dpmslib.xml b/specs/dpmslib.xml
new file mode 100755 (executable)
index 0000000..79fcffe
--- /dev/null
@@ -0,0 +1,419 @@
+<?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="dpmslib">
+
+<bookinfo>
+   <title>X Display Power Management Signaling (DPMS) Extension</title>
+   <subtitle>X Consortium Standard</subtitle>
+   <releaseinfo>X Version 11, Release 6.8</releaseinfo>
+   <authorgroup>
+      <author>
+         <firstname>Rob</firstname><surname>Lembree</surname>
+      </author>
+   </authorgroup>
+   <corpname>Digital Equipment Corporation</corpname>
+   <copyright><year>1996</year><holder>X Consortium</holder></copyright>
+   <releaseinfo>Version 1.0</releaseinfo>
+   <affiliation><orgname>X Consortium</orgname></affiliation>
+   <productnumber>X Version 11, Release 6.8</productnumber>
+
+<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.  Digital Equipment Corporation
+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>
+<emphasis remap='I'>X Window System</emphasis> is a trademark of The Open Group.
+</para>
+</legalnotice>
+
+</bookinfo>
+
+<chapter id='overview'>
+<title>Overview</title>
+
+<para>This extension provides X Protocol control over the VESA Display
+Power Management Signaling (DPMS) characteristics of video boards
+under control of the X Window System.
+</para>
+
+<para>
+Traditionally, the X Window System has provided for both blanking and
+non-blanking screen savers.  Timeouts associated with these built-in
+screen saver mechanisms are limited to idle (dwell) time, and a change
+timeout that specifies the change interval for non-blanking screen savers.
+</para>
+
+<para>
+The United States' Environmental Protection Agency (EPA) Energy Star program
+requires that monitors power down after some idle time by default.
+While it is possible to simply overload the existing screen saver timeouts,
+this solution leaves the non-privileged user little to no control over
+the DPMS characteristics of his or her system.  For example, disabling
+DPMS would require some unintended side effect in the core screen saver,
+such as disabling the changing of a non-blanking screen saver.  Providing
+clients with this control requires an extension to the core X Window System
+Protocol, and this extension seeks to fill this gap.
+</para>
+
+<para>
+There are four power levels specified by the Video Electronics Standards
+Association (VESA) Display Power Management Signaling (DPMS) standard.
+These are mapped onto the X DPMS Extension like this:
+</para>
+
+<literallayout remap='Ds'>
+<function>DPMS Extension Power Levels</function>
+     0     DPMSModeOn               In use
+     1     DPMSModeStandby          Blanked, low power
+     2     DPMSModeSuspend          Blanked, lower power
+     3     DPMSModeOff               Shut off, awaiting activity
+</literallayout> <!-- remap='De' -->
+
+</chapter>
+
+<chapter id='dpms_functions'>
+<title>DPMS Functions</title>
+
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Bool <function>DPMSQueryExtention</function></funcdef>
+    <paramdef>Display <parameter>*display</parameter></paramdef>
+    <paramdef>int <parameter>event_base</parameter></paramdef>
+    <paramdef>int <parameter>error_base</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'>event_base</emphasis></term>
+    <listitem><para>Specifies the return location for the assigned base event</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>error_base</emphasis></term>
+    <listitem><para>Specifies the return location for the assigned base error</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+The DPMSQueryExtension function queries the X server to determine the
+availability of the DPMS Extension.  If the extension is available, the
+return value is TRUE, and <emphasis remap='I'>event_base</emphasis> and
+<emphasis remap='I'>error_base</emphasis> are set to the base event number
+and base error number for the extension, respectively.  Otherwise, the
+return value is FALSE, and the values of
+<emphasis remap='I'>event_base</emphasis> and
+<emphasis remap='I'>error_base</emphasis> are undefined.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>DPMSGetVersion</function></funcdef>
+    <paramdef>Display <parameter>*display</parameter></paramdef>
+    <paramdef>int <parameter>*major_version</parameter></paramdef>
+    <paramdef>int <parameter>*minor_version</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'>major_version</emphasis></term>
+    <listitem><para>Specifies the return location for the extension major version.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>minor_version</emphasis></term>
+    <listitem><para>Specifies the return location for the extension minor version.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+
+<para>
+The DPMSGetVersion function returns the version of the DPMS extension
+implemented by the X server.  The version is returned in
+<emphasis remap='I'>major_version</emphasis> and
+<emphasis remap='I'>minor_version</emphasis>.
+The major version and minor version for this specification are '1' and '1',
+respectively.  The major version will be incremented for protocol
+incompatible changes, and the minor version will be incremented for small,
+upwardly compatible changes.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Bool <function>DPMSCapable</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 DPMSCapable function returns the DPMS capability of the X server, either
+TRUE (capable of DPMS) or FALSE (incapable of DPMS).  The capability of an
+X server is implementation defined.  For example, if a multi-headed  X server
+is capable of DPMS on one head, and incapable on another, the truth value of
+this function is defined by the X server implementation.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>DPMSSetTimeouts</function></funcdef>
+    <paramdef>Display <parameter>*display</parameter></paramdef>
+    <paramdef>CARD16 <parameter>standby</parameter></paramdef>
+    <paramdef>CARD16 <parameter>suspend</parameter></paramdef>
+    <paramdef>CARD16 <parameter>off</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'>standby</emphasis></term>
+    <listitem><para>Specifies the new standby timeout in seconds.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>suspend</emphasis></term>
+    <listitem><para>Specifies the new suspend timeout in seconds.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>off</emphasis></term>
+    <listitem><para>Specifies the new off timeout in seconds.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+The DPMSSetTimeouts function permits applications to set the timeout values
+used by the X server for DPMS timings.
+</para>
+
+<para>
+The value <emphasis remap='I'>standby</emphasis> is the amount of time of
+inactivity in seconds before standby mode is invoked. The actual effects of
+this mode are implementation defined, but in the case of DPMS compliant
+hardware, it is implemented by shutting off the horizontal sync signal,
+and pulsing the vertical sync signal.
+Standby mode provides the quickest monitor recovery time.  Note also that
+many monitors implement this mode identically to suspend mode.  A value
+of zero disables this mode.
+</para>
+
+<para>
+The value <emphasis remap='I'>suspend</emphasis> is the amount of time of
+inactivity in seconds before the second level of power savings is invoked.
+Suspend mode's physical and electrical characteristics are implementation
+defined, but in DPMS compliant hardware, results in the pulsing of the
+horizontal sync signal, and shutting off of the vertical sync signal.
+Suspend mode recovery is considered to be slower than standby mode, but
+faster than off mode, however this is monitor dependent.  As noted above,
+many monitors implement this mode identically to standby mode.  A value of
+zero disables this mode.
+</para>
+
+<para>
+The value <emphasis remap='I'>off</emphasis> is the amount of time of
+inactivity in seconds before the third and final level of power savings is
+invoked. Off mode's physical and electrical characteristics are
+implementation defined, but in DPMS compliant hardware, is implemented by
+shutting off both horizontal and vertical sync signals, resulting in
+the power-down of the monitor.  Recovery time is implementation dependant,
+but frequently is similar to the power-up time of the monitor.  A value
+of zero disables this mode.
+</para>
+
+<para>
+Chronologically, standby mode occurs before or simultaneously with
+suspend mode, and suspend mode must occur before or simultaneously with
+off mode.  Therefore, non-zero mode timeout values must be greater than
+or equal to the timeout values of earlier modes.  If inconsistent values
+are supplied, a BadValue error will result.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>DPMSGetTimeouts</function></funcdef>
+    <paramdef>Display <parameter>*display</parameter></paramdef>
+    <paramdef>CARD16 <parameter>*standby</parameter></paramdef>
+    <paramdef>CARD16 <parameter>*suspend</parameter></paramdef>
+    <paramdef>CARD16 <parameter>*off</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'>standby</emphasis></term>
+    <listitem><para>Specifies the new standby timeout in seconds.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>suspend</emphasis></term>
+    <listitem><para>Specifies the new suspend timeout in seconds.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>off</emphasis></term>
+    <listitem><para>Specifies the new off timeout in seconds.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+The DPMSGetTimeouts function retrieves the timeout values used by the X
+server for DPMS timings.
+</para>
+
+<para>
+The value <emphasis remap='I'>standby</emphasis> is the amount of time of
+inactivity in seconds before standby mode is invoked. A value of zero
+indicates that this mode has been disabled.
+</para>
+
+<para>
+The value <emphasis remap='I'>suspend</emphasis> is the amount of time of
+inactivity in seconds before the second level of power savings is invoked.
+A value of zero indicates that this mode has been disabled.
+</para>
+
+<para>
+The value <emphasis remap='I'>off</emphasis> is the amount of time of
+inactivity in seconds before the third and final level of power savings is
+invoked. A value of zero indicates that this mode has been disabled.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>DPMSEnable</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 DPMSEnable function enables DPMS on the specified display.  When
+enabled, DPMS will use the currently saved timeout values, and will
+invoke the DPMS power mode appropriate for the amount of time that
+the workstation input devices have been idle.  If DPMSEnable is invoked
+on a display with DPMS already enabled, no change is made, and no
+error is returned.  If DPMSEnable is invoked on a display without
+support for DPMS, no change is made and no error is returned.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>DPMSDisable</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 DPMSDisable function disables DPMS on the specified display.  When
+disabled, DPMS returns the display to DPMSModeOn.  If DPMSDisable is
+invoked on a display with DPMS already disabled, no change is made,
+and no error is returned.  If DPMSDisable is invoked on a display
+without support for DPMS, no change is made and no error is returned.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>DPMSForceLevel</function></funcdef>
+    <paramdef>Display <parameter>*display</parameter></paramdef>
+    <paramdef>CARD16 <parameter>level</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'>level</emphasis></term>
+    <listitem><para>Specifies the level to force power to.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+The DPMSForceLevel function forces a DPMS capable display into the
+specified power level.  The <emphasis remap='I'>level</emphasis> must be one of
+DPMSModeOn, DPMSModeStandby, DPMSModeSuspend, or DPMSModeOff.
+Values other than these will result in a BadValue error.  If DPMS
+is disabled on the display, a BadMatch protocol error will result.
+</para>
+
+<para>Status DPMSInfo(<emphasis remap='I'>display, power_level, state</emphasis>)</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>DPMSInfo</function></funcdef>
+    <paramdef>Display <parameter>*display</parameter></paramdef>
+    <paramdef>CARD16 <parameter>power_level</parameter></paramdef>
+    <paramdef>BOOL <parameter>*state</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'>power_level</emphasis></term>
+    <listitem><para>Specifies the current power level.</para></listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><emphasis remap='I'>state</emphasis></term>
+    <listitem><para>Specifies the current DPMS state.</para></listitem>
+  </varlistentry>
+</variablelist>
+
+<para>
+The DPMSInfo function returns information about the current DPMS state.
+The <emphasis remap='I'>state</emphasis> return parameter indicates whether
+or not DPMS is enabled (TRUE) or disabled (FALSE).  The
+<emphasis remap='I'>power_level</emphasis> return parameter indicates the
+current power level (one of DPMSModeOn, DPMSModeStandby, DPMSModeSuspend,
+or DPMSModeOff.)
+</para>
+
+</chapter>
+</book>
diff --git a/specs/shapelib.xml b/specs/shapelib.xml
new file mode 100755 (executable)
index 0000000..2a2fd8f
--- /dev/null
@@ -0,0 +1,581 @@
+<?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="shapelib">
+
+<bookinfo>
+   <title>X Nonrectangular Window Shape Extension Library</title>
+   <subtitle>X Consortium Standard</subtitle>
+   <releaseinfo>X Version 11, Release 6.4</releaseinfo>
+   <authorgroup>
+      <author>
+         <firstname>Keith</firstname><surname>Packard</surname>
+      </author>
+   </authorgroup>
+   <corpname>MIT X Consortium</corpname>
+   <copyright><year>1989</year><holder>X Consortium</holder></copyright>
+   <releaseinfo>Version 1.0</releaseinfo>
+   <affiliation><orgname>MIT X Consortium</orgname></affiliation>
+   <productnumber>X Version 11, Release 6.4</productnumber>
+
+<legalnotice>
+
+<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>
+</legalnotice>
+</bookinfo>
+
+<chapter id='overview'>
+<title>Overview</title>
+
+<para>This extension provides arbitrary window and border shapes within
+the X11 protocol.
+</para>
+
+<para>
+The restriction of rectangular windows within the X protocol is a significant
+limitation in the implementation of many styles of user interface.  For
+example, many transient windows would like to display a
+&ldquo;drop shadow&rdquo; to give the illusion of 3 dimensions.  As
+another example, some user interface style guides call for buttons with
+rounded corners; the full simulation of a nonrectangular shape,
+particularly with respect to event distribution and cursor shape, is not
+possible within the core X protocol.  As a final example, round clocks
+and nonrectangular icons are desirable visual addition to the desktop.
+</para>
+
+<para>
+This extension provides mechanisms for changing the visible shape of a
+window to an arbitrary, possibly disjoint, nonrectangular form.  The intent
+of the extension is to supplement the existing semantics, not replace them.
+In particular, it is desirable for clients that are unaware of the
+extension to still be able to cope reasonably with shaped windows.  For
+example, window managers should still be able to negotiate screen
+real estate in rectangular pieces.  Toward this end, any shape specified for
+a window is clipped by the bounding rectangle for the window as specified by
+the window's geometry in the core protocol.  An expected convention would be
+that client programs expand their shape to fill the area offered by the
+window manager.
+</para>
+</chapter>
+
+<chapter id='description'>
+<title>Description</title>
+
+<para>
+Each window (even with no shapes specified) is defined by two regions:  the
+<emphasis remap='I'>bounding region</emphasis> and the
+<emphasis remap='I'>clip region</emphasis>.  The bounding region is the
+area of the parent window that the window will occupy (including border).
+The clip region is the subset of the bounding region that is available for
+subwindows and graphics.  The area between the bounding region and the
+clip region is defined to be the border of the window.
+</para>
+
+<para>
+A nonshaped window will have a bounding region that is a rectangle spanning
+the window, including its border; the clip region will be a rectangle
+filling the inside dimensions (not including the border).  In this document,
+these areas are referred to as the
+<emphasis remap='I'>default bounding region</emphasis> and the
+<emphasis remap='I'>default clip region</emphasis>.  For a window with
+inside size of <emphasis remap='I'>width</emphasis> by
+<emphasis remap='I'>height</emphasis> and border width
+<emphasis remap='I'>bwidth</emphasis>, the default bounding and clip
+regions are the rectangles (relative to the window origin):
+</para>
+
+<literallayout remap='Ds'>
+bounding.x = -<emphasis remap='I'>bwidth</emphasis>
+bounding.y = -<emphasis remap='I'>bwidth</emphasis>
+bounding.width = <emphasis remap='I'>width</emphasis> + 2 * <emphasis remap='I'>bwidth</emphasis>
+bounding.height = <emphasis remap='I'>height</emphasis> + 2 * <emphasis remap='I'>bwidth</emphasis>
+
+clip.x = 0
+clip.y = 0
+clip.width = <emphasis remap='I'>width</emphasis>
+clip.height = <emphasis remap='I'>height</emphasis>
+</literallayout>
+
+<para>
+This extension allows a client to modify either or both of the bounding or
+clip regions by specifying new regions that combine with the default
+regions.  These new regions are called the
+<emphasis remap='I'>client bounding region</emphasis> and the
+<emphasis remap='I'>client clip region</emphasis>.  They are specified
+relative to the origin of the window and are always defined by offsets
+relative to the window origin (that is, region adjustments are not
+required when the window is moved).  Three mechanisms for specifying
+regions are provided:  a list of rectangles, a bitmap, and an existing
+bounding or clip region from a window.  This is modeled on the specification
+of regions in graphics contexts in the core protocol and allows a variety
+of different uses of the extension.
+</para>
+
+<para>
+When using an existing window shape as an operand in specifying a new shape,
+the client region is used, unless none has been set, in which case the
+default region is used instead.
+</para>
+
+<para>
+The <emphasis remap='I'>effective bounding region</emphasis> of a window is
+defined to be the intersection of the client bounding region with the default
+bounding region.  Any portion of the client bounding region that is not
+included in the default bounding region will not be included in the
+effective bounding region on the screen.  This means that window managers
+(or other geometry managers) used to dealing with rectangular client windows
+will be able to constrain the client to a rectangular area of the screen.
+</para>
+
+<para>
+Construction of the effective bounding region is dynamic; the client bounding
+region is not mutated to obtain the effective bounding region.  If a client
+bounding region is specified that extends beyond the current default bounding
+region, and the window is later enlarged, the effective bounding region will
+be enlarged to include more of the client bounding region.
+</para>
+
+<para>
+The <emphasis remap='I'>effective clip region</emphasis> of a window is
+defined to be the intersection of the client clip region with both the
+default clip region and the client bounding region.  Any portion of the
+client clip region that is not included in both the default clip region
+and the client bounding region will not be included in the effective clip
+region on the screen.
+</para>
+
+<para>
+Construction of the effective clip region is dynamic; the client clip region is
+not mutated to obtain the effective clip region.  If a client clip region is
+specified that extends beyond the current default clip region and the
+window or its bounding region is later enlarged, the effective clip region will
+be enlarged to include more of the client clip region if it is included in
+the effective bounding region.
+</para>
+
+<para>
+The border of a window is defined to be the difference between the effective
+bounding region and the effective clip region.  If this region is empty, no
+border is displayed.  If this region is nonempty, the border is filled
+using the border-tile or border-pixel of the window as specified in the core
+protocol.  Note that a window with a nonzero border width will never be able
+to draw beyond the default clip region of the window.  Also note that a zero
+border width does not prevent a window from having a border, since the clip
+shape can still be made smaller than the bounding shape.
+</para>
+
+<para>
+All output to the window and visible regions of any subwindows will be
+clipped to the effective clip region.  The server must not retain window
+contents beyond the effective bounding region with backing store.  The window's
+origin (for graphics operations, background tiling, and subwindow placement)
+is not affected by the existence of a bounding region or clip region.
+</para>
+
+<para>
+Areas that are inside the default bounding region but outside the effective
+bounding region are not part of the window; these areas of the screen will
+be occupied by other windows.  Input events that occur within the default
+bounding region but outside the effective bounding region will be delivered as
+if the window was not occluding the event position.  Events that occur in
+a nonrectangular border of a window will be delivered to that window, just
+as for events that occur in a normal rectangular border.
+</para>
+
+<para>An
+<function>InputOnly</function>
+window can have its bounding region set, but it is a
+<function>Match</function>
+error to attempt to set a clip region on an
+<function>InputOnly</function>
+window or to specify its clip region as a source to a request
+in this extension.
+</para>
+
+<para>
+The server must accept changes to the clip region of a root window, but
+the server is permitted to ignore requested changes to the bounding region
+of a root window.  If the server accepts bounding region changes, the contents
+of the screen outside the bounding region are implementation dependent.
+</para>
+</chapter>
+
+<chapter id='c_language_binding'>
+<title>C Language Binding</title>
+
+<para>
+The C functions provide direct access to the protocol and add no additional
+semantics.
+</para>
+
+<para>The include file for this extension is
+&lt;<symbol role='Pn'>X11/extensions/shape.h</symbol>&gt;.
+The defined shape kinds are
+<function>ShapeBounding</function>
+and
+<function>ShapeClip</function>
+The defined region operations are
+<function>ShapeSet</function>
+<function>ShapeUnion</function>
+<function>ShapeIntersect</function>
+<function>ShapeSubtract</function>
+and
+<function>ShapeInvert</function>.</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef>Bool<function> XShapeQueryExtension</function></funcdef>
+<paramdef>Display <parameter>*display</parameter></paramdef>
+<paramdef>int <parameter>*event_base</parameter></paramdef>
+<paramdef>int <parameter>*error_base</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XShapeQueryExtension</function>
+returns
+<function>True</function>
+if the specified display supports the SHAPE extension else
+<function>False</function>
+If the extension is supported, *event_base is set to the event number for
+<function>ShapeNotify</function>
+events and *error_base would be set to the error number for the first error for
+this extension.  Because no errors are defined for this version of
+the extension, the value returned here is not defined (nor useful).
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef>Status<function> XShapeQueryVersion</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>int<parameter> *major_version</parameter></paramdef>
+<paramdef>int<parameter> *minor_version</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+If the extension is supported,
+<function>XShapeQueryVersion</function>
+sets the major and minor version numbers of the
+extension supported by the display and returns a nonzero value.
+Otherwise, the arguments are not set and zero is returned.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef><function>XShapeCombineRegion</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>Window<parameter> dest</parameter></paramdef>
+<paramdef>int<parameter> dest_kind</parameter></paramdef>
+<paramdef>int<parameter> x_off</parameter></paramdef>
+<paramdef>int<parameter> y_off</parameter></paramdef>
+<paramdef>int<parameter> region</parameter></paramdef>
+<paramdef>int<parameter> op</parameter></paramdef>
+<paramdef>REGION<parameter> *region</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XShapeCombineRegion</function>
+converts the specified region into a list of rectangles and calls
+<function>XShapeCombineRectangles</function>
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef><function>XShapeCombineRectangles</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>Window<parameter> dest</parameter></paramdef>
+<paramdef>int<parameter> dest_kind</parameter></paramdef>
+<paramdef>int<parameter> x_off</parameter></paramdef>
+<paramdef>int<parameter> y_off</parameter></paramdef>
+<paramdef>XRectangle<parameter> *rectangles</parameter></paramdef>
+<paramdef>int<parameter> n_rects</parameter></paramdef>
+<paramdef>int<parameter> op</parameter></paramdef>
+<paramdef>int<parameter> ordering</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+If the extension is supported,
+<function>XShapeCombineRectangles</function>
+performs a
+<function>ShapeRectangles</function>
+operation; otherwise, the request is ignored.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef><function>XShapeCombineMask</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>int<parameter> dest</parameter></paramdef>
+<paramdef>int<parameter> dest_kind</parameter></paramdef>
+<paramdef>int<parameter> x_off</parameter></paramdef>
+<paramdef>int<parameter> y_off</parameter></paramdef>
+<paramdef>Pixmap<parameter> src</parameter></paramdef>
+<paramdef>int<parameter> op</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+If the extension is supported,
+<function>XShapeCombineMask</function>
+performs a
+<function>ShapeMask</function>
+operation; otherwise, the request is ignored.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef><function>XShapeCombineShape</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>Window<parameter> dest</parameter></paramdef>
+<paramdef>int<parameter> dest_kind</parameter></paramdef>
+<paramdef>int<parameter> x_off</parameter></paramdef>
+<paramdef>int<parameter> y_off</parameter></paramdef>
+<paramdef>Window<parameter> src</parameter></paramdef>
+<paramdef>int<parameter> src_kind</parameter></paramdef>
+<paramdef>int<parameter> op</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+If the extension is supported,
+<function>XShapeCombineShape</function>
+performs a
+<function>ShapeCombine</function>
+operation; otherwise, the request is ignored.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef><function>XShapeOffsetShape</function></funcdef>
+<paramdef><parameter>display</parameter></paramdef>
+<paramdef><parameter>dest</parameter></paramdef>
+<paramdef><parameter>dest_kind</parameter></paramdef>
+<paramdef><parameter>x_off</parameter></paramdef>
+<paramdef><parameter>y_off</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+If the extension is supported,
+<function>XShapeOffsetShape</function>
+performs a
+<function>ShapeOffset</function>
+operation; otherwise, the request is ignored.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef>Status <function>XShapeQueryExtents</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>Window<parameter> window</parameter></paramdef>
+<paramdef>Bool<parameter> *bounding_shaped</parameter></paramdef>
+<paramdef>int<parameter> *x_bounding</parameter></paramdef>
+<paramdef>int<parameter> *y_bounding</parameter></paramdef>
+<paramdef>unsigned int<parameter> *w_bounding</parameter></paramdef>
+<paramdef>unsigned int<parameter> *h_bounding</parameter></paramdef>
+<paramdef>Bool<parameter> *clip_shaped</parameter></paramdef>
+<paramdef>int<parameter> *x_clip</parameter></paramdef>
+<paramdef>int<parameter> *y_clip</parameter></paramdef>
+<paramdef>unsigned int<parameter> *w_clip</parameter></paramdef>
+<paramdef>unsigned int<parameter> *h_clip</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+If the extension is supported,
+<function>XShapeQueryExtents</function>
+sets x_bounding, y_bounding, w_bounding, h_bounding to the extents of the
+bounding shape and sets x_clip, y_clip, w_clip, h_clip to the extents of
+the clip shape.  For unspecified client regions, the extents of the
+corresponding default region are used.
+</para>
+
+<para>
+If the extension is supported, a nonzero value is returned; otherwise,
+zero is returned.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef><function>XShapeSelectInput</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>Window<parameter> window</parameter></paramdef>
+<paramdef>unsigned long<parameter> mask</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+To make this extension more compatible with other interfaces, although
+only one event type can be selected via the extension,
+<function>XShapeSelectInput</function>
+provides a general mechanism similar to the standard Xlib binding for
+window events.  A mask value has been defined,
+<function>ShapeNotifyMask</function>
+that is the only valid bit in mask that may be specified.
+The structure for this event is defined as follows:
+</para>
+
+<literallayout remap='Ds'>
+typedef struct {
+    int type;     /* of event */
+    unsigned long serial;     /* # of last request processed by server */
+    Bool send_event;     /* true if this came frome a SendEvent request */
+    Display *display;     /* Display the event was read from */
+    Window window;     /* window of event */
+    int kind;     /* ShapeBounding or ShapeClip */
+    int x, y;     /* extents of new region */
+    unsigned width, height;
+    Time time;     /* server timestamp when region changed */
+    Bool shaped;     /* true if the region exists */
+} XShapeEvent;
+</literallayout>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef>unsigned long <function>XShapeInputSelected</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>Window<parameter> window</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XShapeInputSelected</function>
+returns the current input mask for extension events on the specified
+window; the value returned if
+<function>ShapeNotify</function>
+is selected for is
+<function>ShapeNotifyMask</function>
+otherwise, it returns zero.
+If the extension is not supported, it returns zero.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef>XRectangle<function> *XShapeGetRectangles</function></funcdef>
+<paramdef>Display<parameter> *display</parameter></paramdef>
+<paramdef>Window<parameter> window</parameter></paramdef>
+<paramdef>int<parameter> kind</parameter></paramdef>
+<paramdef>int<parameter> *count</parameter></paramdef>
+<paramdef>int<parameter> *ordering</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+If the extension is not supported,
+<function>XShapeGetRectangles</function>
+returns NULL.  Otherwise, it returns a list of rectangles that describe the
+region specified by kind.
+</para>
+</chapter>
+
+<glossary id='glossary'>
+
+<glossdiv>
+<title>Glossary</title>
+<glossentry id='bounding_region'>
+  <glossterm>bounding region</glossterm>
+  <glossdef><para>The area of the parent window that this window will occupy.
+This area is divided into two parts:  the border and the interior.</para>
+  </glossdef>
+</glossentry>
+
+<glossentry id='clip_region'>
+  <glossterm>clip region</glossterm>
+  <glossdef><para>The interior of the window, as a subset of the bounding
+region.  This region describes the area that will be painted with the
+window background when the window is cleared, will contain all graphics
+output to the window, and will clip any subwindows.</para></glossdef>
+</glossentry>
+
+<glossentry id='default_bounding_region'>
+  <glossterm>default bounding region</glossterm>
+  <glossdef><para>The rectangular area, as described by the core protocol
+window size, that covers the interior of the window and its border.</para>
+  </glossdef>
+</glossentry>
+
+<glossentry id='default_clip_region'>
+  <glossterm>default clip region</glossterm>
+  <glossdef><para>The rectangular area, as described by the core protocol
+window size, that covers the interior of the window and excludes the border.
+  </para></glossdef>
+</glossentry>
+
+<glossentry id='client_bounding_region'>
+  <glossterm>client bounding region</glossterm>
+  <glossdef><para>The region associated with a window that is directly
+modified via this extension when specified by
+<function>ShapeBounding</function>
+This region is used in conjunction with the default bounding region
+to produce the effective bounding region.</para></glossdef>
+</glossentry>
+
+<glossentry id='client_clip_region'>
+  <glossterm>client clip region</glossterm>
+  <glossdef><para>The region associated with a window that is directly
+modified via this extension when specified by
+<function>ShapeClip</function>
+This region is used in conjunction with the default clip region
+and the client bounding region to produce the effective clip region.</para>
+  </glossdef>
+</glossentry>
+
+<glossentry id='effective_bounding_region'>
+  <glossterm>effective bounding region</glossterm>
+  <glossdef><para>The actual shape of the window on the screen, including
+border and interior (but excluding the effects of overlapping windows).
+When a window has a client bounding region, the effective bounding region
+is the intersection of the default bounding region and the client bounding
+region.  Otherwise, the effective bounding region is the same as the
+default bounding region.</para>
+  </glossdef>
+</glossentry>
+
+<glossentry id='effective_clip_region'>
+  <glossterm>effective clip region</glossterm>
+  <glossdef><para>The actual shape of the interior of the window on the
+screen (excluding the effects of overlapping windows).  When a window
+has a client clip region or a client bounding region, the effective
+clip region is the intersection of the default clip region, the client
+clip region (if any) and the client bounding region (if any).  Otherwise,
+the effective clip region is the same as the default clip region.</para>
+  </glossdef>
+</glossentry>
+
+</glossdiv>
+</glossary>
+</book>
diff --git a/specs/synclib.xml b/specs/synclib.xml
new file mode 100755 (executable)
index 0000000..febf27f
--- /dev/null
@@ -0,0 +1,804 @@
+<?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 Synchronization Extension Library</title>
+   <subtitle>X Consortium Standard</subtitle>
+   <releaseinfo>X Version 11, Release 6.4</releaseinfo>
+   <authorgroup>
+      <author>
+        <firstname>Tim</firstname><surname>Glauert</surname>
+        <affiliation><orgname>Olivetti Research/MultiWorks</orgname></affiliation>
+      </author>
+      <othercredit>
+          <firstname>Dave</firstname>
+          <surname>Carver</surname>
+          <affiliation><orgname>Digital EquipmentCorporation, MIT/Project Athena</orgname></affiliation>
+      </othercredit>
+      <othercredit>
+        <firstname>Jim</firstname>
+        <surname>Gettys</surname>
+        <affiliation><orgname>Digital EquipmentCorporation, Cambridge Research Laboratory</orgname></affiliation>
+      </othercredit>
+      <othercredit>
+        <firstname>David</firstname>
+        <surname>Wiggins</surname>
+        <affiliation><orgname>X Consortium, Inc.</orgname></affiliation>
+      </othercredit>
+   </authorgroup>
+   <copyright><year>1991</year><holder>Olivetti Research Limited, Cambridge England and Digital Equipment Corporation, Maynard, Massachusetts</holder></copyright>
+   <copyright><year>1991</year><holder>X Consortium</holder></copyright>
+   <releaseinfo>Version 3.0</releaseinfo>
+   <affiliation><orgname>X Consortium</orgname></affiliation>
+   <productnumber>X Version 11, Release 6.4</productnumber>
+<legalnotice>
+
+<para>
+Permission to use, copy, modify, and distribute this documentation for any
+purpose and without fee is hereby granted, provided that the above
+copyright notice appear in all copies. Olivetti, Digital, MIT, and the
+X Consortium make 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 above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+</para>
+
+<para>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+</para>
+
+<para>
+Except as contained in this notice, the name of the X Consortium shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from the
+X Consortium.
+</para>
+
+</legalnotice>
+</bookinfo>
+
+<chapter id="synchronization_protocol">
+<title>Synchronization Protocol</title>
+
+<para>
+The core X protocol makes no guarantees about the relative order of
+execution of requests for different clients.  This means that any
+synchronization between clients must be done at the client level in an
+operating system-dependent and network-dependent manner. Even if there
+was an accepted standard for such synchronization, the use of a network
+introduces unpredictable delays between the synchronization of the clients and
+the delivery of the resulting requests to the X server.
+</para>
+<para>
+The core X protocol also makes no guarantees about the time at which
+requests are executed, which means that all clients with real-time constraints
+must implement their timing on the host computer. Any such timings are
+subject to error introduced by delays within the operating system and
+network and are inefficient because of the need for round-trip requests that
+keep the client and server synchronized.
+</para>
+<para>
+The synchronization extension provides primitives that allow synchronization
+between clients to take place entirely within the X server. This removes any
+error introduced by the network and makes it possible to synchronize clients
+on different hosts running different operating systems. This is important for
+multimedia applications, where audio, video, and graphics data streams are
+being synchronized. The extension also provides internal timers within the X
+server to which client requests can be synchronized. This allows simple
+animation applications to be implemented without any round-trip requests
+and makes best use of buffering within the client, network, and server.
+</para>
+
+<sect1 id="description">
+<title>Description</title>
+<para>
+The mechanism used by this extension for synchronization within the X server
+is to block the processing of requests from a client until a specific
+synchronization condition occurs. When the condition occurs, the client is
+released and processing of requests continues. Multiple clients may block on
+the same condition to give inter-client synchronization. Alternatively, a single
+client may block on a condition such as an animation frame marker.
+</para>
+<para>
+The extension adds <function>Counter</function> and
+<function>Alarm</function> to the set of resources managed by
+the server. A counter has a 64-bit integer value that may be increased or
+decreased by client requests or by the server internally. A client can
+block by sending an <function>Await</function> request that waits until
+one of a set of synchronization conditions, called TRIGGERs, becomes TRUE.
+</para>
+<para>
+The <function>CreateCounter</function> request allows a client to create
+a <function>Counter</function> that can be changed by explicit
+<function>SetCounter</function> and <function>ChangeCounter</function>
+requests. These can be used to implement synchronization between
+different clients.
+</para>
+<para>
+There are some counters, called <function>System Counters</function>,
+that are changed by the server internally rather than by client
+requests. The effect of any change to a system counter is not visible
+until the server has finished processing the current request. In other
+words, system counters are apparently updated in the gaps between the
+execution of requests rather than during the actual execution of a
+request. The extension provides a system counter that advances with the
+server time as defined by the core protocol, and it may also provide
+counters that advance with the real-world time or that change each
+time the CRT screen is refreshed. Other extensions may provide their own
+extension-specific system counters.
+</para>
+<para>
+The extension provides an <function>Alarm</function> mechanism that allows clients to receive an
+event on a regular basis when a particular counter is changed.
+</para>
+</sect1>
+</chapter>
+
+<chapter id="c_language_binding">
+<title>C Language Binding</title>
+
+<para>
+The C routines provide direct access to the protocol and add no additional
+semantics.
+</para>
+<para>
+The include file for this extension is &lt;X11/extensions/sync.h&gt;.
+Most of the names in the language binding are derived from the protocol
+names by prepending XSync to the protocol name and changing the
+capitalization.
+</para>
+
+<sect1 id="c_functions">
+<title>C Functions</title>
+
+<para>
+Most of the following functions generate SYNC protocol requests.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XSyncQueryExtension</function></funcdef>
+    <paramdef>Display <parameter> *dpy</parameter></paramdef>
+    <paramdef>int <parameter> *event_base_return</parameter></paramdef>
+    <paramdef>int <parameter> *error_base_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+If dpy supports the SYNC extension,
+<function>XSyncQueryExtension</function> returns True,
+sets *event_base_return to the event number for the first SYNC event, and
+sets *error_base_return to the error number for the first SYNC error. If dpy
+does not support the SYNC extension, it returns False.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XSyncInitialize</function></funcdef>
+    <paramdef>Display <parameter> *dpy</parameter></paramdef>
+    <paramdef>int <parameter> *major_version_return</parameter></paramdef>
+    <paramdef>int <parameter> *minor_version_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XSyncInitialize</function> sets *major_version_return and
+*minor version return to the major/minor SYNC protocol version supported
+by the server. If the XSync library is compatible with the version
+returned by the server, this function returns <function>True</function>.
+If dpy does not support the SYNC extension, or if there was an error
+during communication with the server, or if the server and library protocol
+versions are incompatible, this function returns <function>False</function>.
+The only XSync function that may be called before this function is
+XSyncQueryExtension. If a client violates this rule, the effects of all XSync
+calls that it makes are undefined.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XSyncSystemCounter *<function>XSyncListSystemCounters</function></funcdef>
+    <paramdef>Display <parameter> *dpy</parameter></paramdef>
+    <paramdef>int <parameter> *n_counters_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XSyncListSystemCounters</function> returns a pointer to an array
+of system counters supported by the display and sets *n_counters_return
+to the number of counters in the array.  The array should be freed with
+<function>XSyncFreeSystemCounterList</function>. If dpy does not support
+the SYNC extension, or if there was an error during communication with
+the server, or if the server does not support any system counters,
+this function returns NULL.
+</para>
+
+<para>
+XSyncSystemCounter has the following fields:
+</para>
+
+<literallayout remap='Ds'>
+char *              name;        /* null-terminated name of system counter */
+XSyncCounter        counter;     /* counter id of this system counter */
+XSyncValue          resolution;  /* resolution of this system counter */
+</literallayout>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function>XSyncFreeSystemCounterList</function></funcdef>
+    <paramdef>XSyncSystemCounter <parameter> *list</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XSyncFreeSystemCounterList</function> frees the memory
+associated with the system counter list returned by
+<function>XSyncListSystemCounters</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XSyncCounter <function>XSyncCreateCounter</function></funcdef>
+    <paramdef>Display<parameter> *dpy</parameter></paramdef>
+    <paramdef>XSyncValue<parameter> initial_value</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XSyncCreateCounter</function> creates a counter on the dpy
+with the given initial value and returns the counter ID. It returns
+<function>None</function> if dpy does not support the SYNC extension.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XSyncSetCounter</function></funcdef>
+    <paramdef>Display<parameter> *dpy</parameter></paramdef>
+    <paramdef>XSyncCounter<parameter> counter</parameter></paramdef>
+    <paramdef>XSyncValue<parameter> value</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+
+<para>
+<function>XSyncSetCounter</function> sets counter to value. It returns
+<function>False </function> if dpy does not
+support the SYNC extension; otherwise, it returns <function>True</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XSyncChangeCounter</function></funcdef>
+    <paramdef>Display<parameter> *dpy</parameter></paramdef>
+    <paramdef>XSyncCounter<parameter> counter</parameter></paramdef>
+    <paramdef>XSyncValue<parameter> value</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XSyncChangeCounter</function> adds value to counter. It returns
+<function>False</function> if dpy does not support the SYNC extension;
+otherwise, it returns
+<function>True</function>.
+</para>
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XSyncDestroyCounter</function></funcdef>
+    <paramdef>Display<parameter> *dpy</parameter></paramdef>
+    <paramdef>XSyncCounter<parameter> counter</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XSyncDestroyCounter</function> destroys counter. It returns
+<function>False</function> if dpy does not support the SYNC extension;
+otherwise, it returns <function>True</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XSyncQueryCounter</function></funcdef>
+    <paramdef>Display<parameter> *dpy</parameter></paramdef>
+    <paramdef>XSyncCounter<parameter> counter</parameter></paramdef>
+    <paramdef>XSyncValue<parameter> *value_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XSyncQueryCounter</function> sets *value_return to the current
+value of counter. It returns <function>False</function> if there was an
+error during communication with the server or if dpy does not support the
+SYNC extension; otherwise, it returns <function>True</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XSyncAwait</function></funcdef>
+    <paramdef>Display<parameter> *dpy</parameter></paramdef>
+    <paramdef>XSyncWaitCondition<parameter> *wait_list</parameter></paramdef>
+    <paramdef>int<parameter> n_conditions</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XSyncAwait</function> awaits on the conditions in wait_list.
+The n_conditions is the number of wait conditions in wait_list. It
+returns <function>False</function> if dpy does not support the SYNC
+extension; otherwise, it returns <function>True</function>. The await is
+processed asynchronously by the server; this function always returns
+immediately after issuing the request.
+</para>
+<para>
+XSyncWaitCondition has the following fields:
+</para>
+
+<literallayout remap='Ds'>
+XSyncCounter     trigger.counter;    /*counter to trigger on */
+XSyncValueType   trigger.value_type; /*absolute/relative */
+XSyncValue       trigger.wait_value; /*value to compare counter to */
+XSyncTestType    trigger.test_type;  /*pos/neg comparison/transtion */
+XSyncValue       event_threshold;    /*send event if past threshold */
+</literallayout>
+
+<para>
+<function>XSyncValueType</function> can be either
+<function>XSyncAbsolute</function> or <function>XSyncRelative</function>.
+</para>
+
+<para>
+<function>XSyncTestType</function> can be one of
+<function>XSyncPositiveTransition</function>,
+<function>XSyncNegativeTransition</function>,
+<function>XSyncPositiveComparison</function>, or
+<function>XSyncNegativeComparison</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>XSyncAlarm <function>XSyncCreateAlarm</function></funcdef>
+    <paramdef>Display<parameter> *dpy</parameter></paramdef>
+    <paramdef>unsigned long<parameter> values_mask</parameter></paramdef>
+    <paramdef>XSyncAlarmAttributes<parameter> *values`</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XSyncCreateAlarm</function> creates an alarm and returns the
+alarm ID. It returns None if the display does not support the SYNC
+extension. The values_mask and values specify the alarm attributes.
+</para>
+
+<para>
+<function>XSyncAlarmAttributes</function> has the following fields. The
+attribute_mask column specifies the symbol that the caller should OR
+into values_mask to indicate that the value for the corresponding
+attribute was actually supplied. Default values are used for all
+attributes that do not have their attribute_mask OR’ed into values_mask.
+See the protocol description for <function>CreateAlarm</function> for the
+defaults.
+</para>
+
+<literallayout remap='Ds'>
+type                 field name           attribute_mask
+XSyncCounter       trigger.counter;     XSyncCACounter
+XSyncValueType     trigger.value_type;  XSyncCAValueType
+XSyncValue         trigger.wait_value;  XSyncCAValue
+XSyncTestType      trigger.test_type;   XSyncCATestType
+XSyncValue         delta;               XSyncCADelta
+Bool               events;              XSyncCAEvents
+XSyncAlarmState    state;               client cannot set this
+</literallayout>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XSyncDestroyAlarm</function></funcdef>
+    <paramdef>Display<parameter> *dpy</parameter></paramdef>
+    <paramdef>XSyncAlarm<parameter> alarm</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XSyncDestroyAlarm</function> destroys alarm. It returns
+<function>False</function> if dpy does not support
+the SYNC extension; otherwise, it returns <function>True</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XSyncQueryAlarm</function></funcdef>
+    <paramdef>Display<parameter> *dpy</parameter></paramdef>
+    <paramdef>XSyncAlarm<parameter> alarm</parameter></paramdef>
+    <paramdef>XSyncAlarmAttributes<parameter> *values_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+
+<para>
+<function>XSyncQueryAlarm</function> sets *values_return to the alarm’s
+attributes. It returns <function>False</function> if there was an error
+during communication with the server or if dpy does not support the
+SYNC extension; otherwise, it returns <function>True</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XSyncChangeAlarm</function></funcdef>
+    <paramdef>Display<parameter> *dpy</parameter></paramdef>
+    <paramdef>XSyncAlarm<parameter> alarm</parameter></paramdef>
+    <paramdef>unsigned long<parameter> values_mask</parameter></paramdef>
+    <paramdef>XSyncAlarmAttributes<parameter> *values</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XSyncChangeAlarm</function> changes alarm’s attributes. The
+attributes to change are specified as in
+<function>XSyncCreateAlarm</function>. It returns
+<function>False</function> if dpy does not support
+the SYNC extension; otherwise, it returns <function>True</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XSyncSetPriority</function></funcdef>
+    <paramdef>Display<parameter> *dpy</parameter></paramdef>
+    <paramdef>XID<parameter> client_resource_id</parameter></paramdef>
+    <paramdef>int<parameter> priority</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XSyncSetPriority</function> sets the priority of the client
+owning client_resource_id to priority. If client_resource_id is None, it
+sets the caller’s priority. It returns
+<function>False</function> if dpy does not support the SYNC extension;
+otherwise, it returns <function>True</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Status <function>XSyncGetPriority</function></funcdef>
+    <paramdef>Display<parameter> *dpy</parameter></paramdef>
+    <paramdef>XID<parameter> client_resource_id</parameter></paramdef>
+    <paramdef>int<parameter> *return_priority</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<function>XSyncGetPriority</function> sets *return_priority to the
+priority of the client owning client_resource_id. If client_resource_id
+is None, it sets *return_priority to the caller’s priority. It returns
+<function>False</function> if there was an error during communication
+with the server or if dpy does not support the SYNC extension; otherwise, it
+returns <function>True</function>.
+</para>
+
+</sect1>
+
+<sect1 id="c_macros_functions">
+<title>C Macros/Functions</title>
+
+<para>
+The following procedures manipulate 64-bit values. They are defined both as
+macros and as functions. By default, the macro form is used. To use the
+function form, #undef the macro name to uncover the function.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function>XSyncIntToValue</function></funcdef>
+    <paramdef>XSyncValue<parameter> *pv</parameter></paramdef>
+    <paramdef>int<parameter> i</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Converts i to an <function>XSyncValue</function> and stores it in *pv.
+Performs sign extension (*pv will have the same sign as i.)
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function>XSyncIntsToValue</function></funcdef>
+    <paramdef>XSyncValue<parameter> *pv</parameter></paramdef>
+    <paramdef>unsigned int<parameter> low</parameter></paramdef>
+    <paramdef>int<parameter> high</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Stores low in the low 32 bits of *pv and high in the high 32 bits of *pv.
+</para>
+
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Bool <function>XSyncValueGreaterThan</function></funcdef>
+    <paramdef>XSyncValue<parameter> a</parameter></paramdef>
+    <paramdef>XSyncValue<parameter> b</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Returns <function>True</function> if a is greater than b, else returns
+<function>False</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Bool <function>XSyncValueLessThan</function></funcdef>
+    <paramdef>XSyncValue<parameter> a</parameter></paramdef>
+    <paramdef>XSyncValue<parameter> b</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Returns <function>True</function> if a is less than b, else returns
+<function>False</function>.
+</para>
+
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Bool <function>XSyncValueGreaterOrEqual</function></funcdef>
+    <paramdef>XSyncValue<parameter> a</parameter></paramdef>
+    <paramdef>XSyncValue<parameter> b</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Returns <function>True</function> if a is greater than or equal to b,
+else returns <function>False</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Bool <function>XSyncValueLessOrEqual</function></funcdef>
+    <paramdef>XSyncValue<parameter> a</parameter></paramdef>
+    <paramdef>XSyncValue<parameter> b</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Returns <function>True</function> if a is less than or equal to b,
+else returns <function>False</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Bool <function>XSyncValueEqual</function></funcdef>
+    <paramdef>XSyncValue<parameter> a</parameter></paramdef>
+    <paramdef>XSyncValue<parameter> b</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Returns <function>True</function> if a is equal to b,
+else returns <function>False</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Bool <function>XSyncValueIsNegative</function></funcdef>
+    <paramdef>XSyncValue<parameter> v</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Returns <function>True</function> if v is negative,
+else returns <function>False</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Bool <function>XSyncValueIsZero</function></funcdef>
+    <paramdef>XSyncValue<parameter> v</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Returns <function>True</function> if v is zero,
+else returns <function>False</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>Bool <function>XSyncValueIsPositive</function></funcdef>
+    <paramdef>XSyncValue<parameter> v</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Returns <function>True</function> if v is positive,
+else returns <function>False</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>unsigned int <function>XSyncValueLow32</function></funcdef>
+    <paramdef>XSyncValue<parameter> v</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Returns the low 32 bits of v.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>unsigned int <function>XSyncValueHigh32</function></funcdef>
+    <paramdef>XSyncValue<parameter> v</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Returns the high 32 bits of v.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function>XSyncValueAdd</function></funcdef>
+    <paramdef>XSyncValue<parameter> *presult</parameter></paramdef>
+    <paramdef>XSyncValue<parameter> a</parameter></paramdef>
+    <paramdef>XSyncValue<parameter> b</parameter></paramdef>
+    <paramdef>Bool<parameter> *poverflow</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Adds a to b and stores the result in *presult. If the result could not
+fit in 64 bits, *poverflow is set to <function>True</function>, else it is
+set to <function>False</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function>XSyncValueSubtract</function></funcdef>
+    <paramdef>XSyncValue<parameter> *presult</parameter></paramdef>
+    <paramdef>XSyncValue<parameter> a</parameter></paramdef>
+    <paramdef>XSyncValue<parameter> b</parameter></paramdef>
+    <paramdef>Bool<parameter> *poverflow</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Subtracts b from a and stores the result in *presult. If the result could not
+fit in 64 bits, *poverflow is set to <function>True</function>, else it is
+set to <function>False</function>.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function>XSyncMaxValue</function></funcdef>
+    <paramdef>XSyncValue<parameter> *pv</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Sets *pv to the maximum value expressible in 64 bits.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+  <funcdef>void <function>XSyncMinValue</function></funcdef>
+    <paramdef>XSyncValue<parameter> *pv</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Sets *pv to the minimum value expressible in 64 bits.
+</para>
+
+</sect1>
+
+<sect1 id="events">
+<title>Events</title>
+
+<para>
+Let <emphasis remap='I'>event_base</emphasis> be the value event base return as defined in the function
+<function>XSyncQueryExtension</function>.
+</para>
+
+<para>
+An <function>XSyncCounterNotifyEvent</function>’s type field has the value
+event_base + <function>XSyncCounterNotify</function>. The fields of this
+structure are:
+</para>
+
+<literallayout remap='Ds'>
+int              type;          /* event base + XSyncCounterNotify */
+unsigned long    serial;        /* number of last request processed by server */
+Bool             send event;    /* true if this came from a SendEvent request */
+Display *        display;       /* Display the event was read from */
+XSyncCounter     counter;       /* counter involved in await */
+XSyncValue       wait_value;    /* value being waited for */
+XSyncValue       counter_value; /* counter value when this event was sent */
+Time             time;          /* milliseconds */
+int              count;         /* how many more events to come */
+Bool             destroyed;     /* True if counter was destroyed */
+</literallayout>
+
+<para>
+An <function>XSyncAlarmNotifyEvent</function>’s type field has the value
+event_base + <function>XSyncAlarmNotify</function>. The fields of
+this structure are:
+</para>
+
+<literallayout remap='Ds'>
+int             type;         /* event_base + XSyncAlarmNotify */
+unsigned long   serial;       /* number of last request processed by server */
+Bool            send_event;   /* true if this came from a SendEvent request */
+Display *       display;      /*Display the event was read from */
+XSyncAlarm      alarm;        /* alarm that triggered */
+XSyncValue      counter_value /* value that triggered the alarm */
+XSyncValue      alarm_value   /* test value of trigger in alarm */
+Time            time;         /* milliseconds */
+XSyncAlarmState state;        /* new state of alarm */
+</literallayout>
+
+</sect1>
+
+<sect1 id="errors">
+<title>Errors</title>
+<para>
+Let <emphasis remap='I'>error_base</emphasis> be the value
+<emphasis remap='I'>error_base_return</emphasis> as defined in the function
+<function>XSyncQueryExtension</function>.
+</para>
+
+<para>
+An <function>XSyncAlarmError</function>’s error_code field has
+<function>XSyncBadAlarm</function>. The fields of this structure are:
+</para>
+
+<literallayout remap='Ds'>
+int                type
+Display *          display;      /* Display the event was read from */
+XSyncCounter       counter;      /* resource id */
+unsigned long      serial;       /* serial number of failed request */
+unsigned char      error_code;   /* error_base + XSyncBadAlarm */
+unsigned char      request_code; /* Major op-code of failed request */
+unsigned char      minor_code;   /* Minor op-code of failed request */
+</literallayout>
+
+<para>
+An <function>XSyncCounterError</function>’s error code field has the value
+error_base + <function>XSyncBadCounter</function>. The fields of this
+structure are:
+</para>
+<literallayout remap='Ds'>
+int                type
+Display *          display;      /* Display the event was read from */
+XSyncCounter       counter;      /* resource id */
+unsigned long      serial;       /* serial number of failed request */
+unsigned char      error_code;   /* error_base + XSyncBadCounter */
+unsigned char      request_code; /* Major op-code of failed request */
+unsigned char      minor_code;   /* Minor op-code of failed request */
+</literallayout>
+
+</sect1>
+</chapter>
+</book>
diff --git a/src/DPMS.c b/src/DPMS.c
new file mode 100755 (executable)
index 0000000..9fc9cca
--- /dev/null
@@ -0,0 +1,290 @@
+/*****************************************************************
+
+Copyright (c) 1996 Digital Equipment Corporation, Maynard, Massachusetts.
+
+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.
+
+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
+DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, 
+BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation 
+shall not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from Digital 
+Equipment Corporation.
+
+******************************************************************/
+
+/*
+ * HISTORY
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlibint.h>
+#include <X11/extensions/dpms.h>
+#include <X11/extensions/dpmsproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <stdio.h>
+
+static XExtensionInfo _dpms_info_data;
+static XExtensionInfo *dpms_info = &_dpms_info_data;
+static char *dpms_extension_name = DPMSExtensionName;
+
+#define DPMSCheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, dpms_extension_name, val)
+
+/*****************************************************************************
+ *                                                                           *
+ *                         private utility routines                          *
+ *                                                                           *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static /* const */ XExtensionHooks dpms_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 XEXT_GENERATE_FIND_DISPLAY (find_display, dpms_info,
+                                  dpms_extension_name,
+                                   &dpms_extension_hooks, DPMSNumberEvents,
+                                   NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, dpms_info)
+                                                              
+/*****************************************************************************
+ *                                                                           *
+ *                  public routines                                          *
+ *                                                                           *
+ *****************************************************************************/
+
+Bool
+DPMSQueryExtension (Display *dpy, int *event_basep, int *error_basep)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+
+    if (XextHasExtension(info)) {
+       *event_basep = info->codes->first_event;
+       *error_basep = info->codes->first_error;
+       return True;
+    } else {
+       return False;
+    }
+}
+
+Status
+DPMSGetVersion(Display *dpy, int *major_versionp, int *minor_versionp)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xDPMSGetVersionReply           rep;
+    register xDPMSGetVersionReq  *req;
+
+    DPMSCheckExtension (dpy, info, 0);
+
+    LockDisplay (dpy);
+    GetReq (DPMSGetVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->dpmsReqType = X_DPMSGetVersion;
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return 0;
+    }
+    *major_versionp = rep.majorVersion;
+    *minor_versionp = rep.minorVersion;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return 1;
+}
+
+Bool
+DPMSCapable(Display *dpy)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xDPMSCapableReq *req;
+    xDPMSCapableReply rep;
+
+    DPMSCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(DPMSCapable, req);
+    req->reqType = info->codes->major_opcode;
+    req->dpmsReqType = X_DPMSCapable;
+
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return rep.capable;
+}
+
+Status
+DPMSSetTimeouts(Display *dpy, CARD16 standby, CARD16 suspend, CARD16 off)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xDPMSSetTimeoutsReq *req;
+
+    if ((off != 0)&&(off < suspend)) 
+    {
+       return BadValue;
+    }
+    if ((suspend != 0)&&(suspend < standby))
+    {
+       return BadValue;
+    }  
+
+    DPMSCheckExtension (dpy, info, 0);
+    LockDisplay(dpy);
+    GetReq(DPMSSetTimeouts, req);
+    req->reqType = info->codes->major_opcode;
+    req->dpmsReqType = X_DPMSSetTimeouts;
+    req->standby = standby;
+    req->suspend = suspend;
+    req->off = off;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+Bool
+DPMSGetTimeouts(Display *dpy, CARD16 *standby, CARD16 *suspend, CARD16 *off)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xDPMSGetTimeoutsReq *req;
+    xDPMSGetTimeoutsReply rep;
+
+    DPMSCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(DPMSGetTimeouts, req);
+    req->reqType = info->codes->major_opcode;
+    req->dpmsReqType = X_DPMSGetTimeouts;
+
+    if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    *standby = rep.standby;
+    *suspend = rep.suspend;
+    *off = rep.off;
+    return 1;
+}
+
+Status
+DPMSEnable(Display *dpy)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xDPMSEnableReq *req;
+
+    DPMSCheckExtension (dpy, info, 0);
+    LockDisplay(dpy);
+    GetReq(DPMSEnable, req);
+    req->reqType = info->codes->major_opcode;
+    req->dpmsReqType = X_DPMSEnable;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+Status
+DPMSDisable(Display *dpy)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xDPMSDisableReq *req;
+
+    DPMSCheckExtension (dpy, info, 0);
+    LockDisplay(dpy);
+    GetReq(DPMSDisable, req);
+    req->reqType = info->codes->major_opcode;
+    req->dpmsReqType = X_DPMSDisable;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+
+Status
+DPMSForceLevel(Display *dpy, CARD16 level)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xDPMSForceLevelReq *req;
+
+    DPMSCheckExtension (dpy, info, 0);
+
+    if ((level != DPMSModeOn) &&
+       (level != DPMSModeStandby) &&
+       (level != DPMSModeSuspend) &&
+       (level != DPMSModeOff))
+       return BadValue;
+
+    LockDisplay(dpy);
+    GetReq(DPMSForceLevel, req);
+    req->reqType = info->codes->major_opcode;
+    req->dpmsReqType = X_DPMSForceLevel;
+    req->level = level;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+Status
+DPMSInfo(Display *dpy, CARD16 *power_level, BOOL *state)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xDPMSInfoReq *req;
+    xDPMSInfoReply rep;
+
+    DPMSCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(DPMSInfo, req);
+    req->reqType = info->codes->major_opcode;
+    req->dpmsReqType = X_DPMSInfo;
+
+    if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    *power_level = rep.power_level;
+    *state = rep.state;
+    return 1;
+}
+
+
+
diff --git a/src/MITMisc.c b/src/MITMisc.c
new file mode 100755 (executable)
index 0000000..a4000d6
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ */
+
+/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM BLESSING */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlibint.h>
+#include <X11/extensions/MITMisc.h>
+#include <X11/extensions/mitmiscproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+static XExtensionInfo _mit_info_data;
+static XExtensionInfo *mit_info = &_mit_info_data;
+static /* const */ char *mit_extension_name = MITMISCNAME;
+
+#define MITCheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, mit_extension_name, val)
+
+/*****************************************************************************
+ *                                                                           *
+ *                        private utility routines                          *
+ *                                                                           *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static /* const */ XExtensionHooks mit_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 XEXT_GENERATE_FIND_DISPLAY (find_display, mit_info, mit_extension_name, 
+                                  &mit_extension_hooks, MITMiscNumberEvents,
+                                  NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, mit_info)
+
+
+/*****************************************************************************
+ *                                                                           *
+ *                 public routines                                          *
+ *                                                                           *
+ *****************************************************************************/
+
+Bool XMITMiscQueryExtension (Display *dpy, int *event_basep, int *error_basep)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+
+    if (XextHasExtension(info)) {
+       *event_basep = info->codes->first_event;
+       *error_basep = info->codes->first_error;
+       return True;
+    } else {
+       return False;
+    }
+}
+
+
+Status XMITMiscSetBugMode(Display *dpy, Bool onOff)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xMITSetBugModeReq *req;
+
+    MITCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(MITSetBugMode, req);
+    req->reqType = info->codes->major_opcode;
+    req->mitReqType = X_MITSetBugMode;
+    req->onOff = onOff;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+Bool XMITMiscGetBugMode(Display *dpy)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xMITGetBugModeReq *req;
+    xMITGetBugModeReply rep;
+
+    MITCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(MITGetBugMode, req);
+    req->reqType = info->codes->major_opcode;
+    req->mitReqType = X_MITGetBugMode;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return rep.onOff;
+}
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100755 (executable)
index 0000000..6e34bb9
--- /dev/null
@@ -0,0 +1,65 @@
+lib_LTLIBRARIES=libXext.la
+
+AM_CPPFLAGS=\
+          -I$(top_srcdir)/include \
+          -I$(top_srcdir)/include/X11/extensions\
+          $(XEXT_CFLAGS) $(MALLOC_ZERO_CFLAGS)
+
+AM_CFLAGS=$(CWARNFLAGS)
+
+libXext_la_LDFLAGS = -version-number $(XEXT_SOREV) -no-undefined
+
+libXext_la_LIBADD = $(XEXT_LIBS)
+
+libXext_la_SOURCES = \
+       DPMS.c \
+       MITMisc.c \
+       XAppgroup.c \
+       XEVI.c \
+       XLbx.c \
+       XMultibuf.c \
+       XSecurity.c \
+       XShape.c \
+       XShm.c \
+       XSync.c \
+       XTestExt1.c \
+       Xcup.c \
+       Xdbe.c \
+        Xge.c \
+       extutil.c \
+       globals.c
+
+libXextincludedir = $(includedir)/X11/extensions
+libXextinclude_HEADERS = $(top_srcdir)/include/X11/extensions/dpms.h \
+                        $(top_srcdir)/include/X11/extensions/extutil.h \
+                        $(top_srcdir)/include/X11/extensions/MITMisc.h \
+                        $(top_srcdir)/include/X11/extensions/multibuf.h \
+                        $(top_srcdir)/include/X11/extensions/security.h \
+                        $(top_srcdir)/include/X11/extensions/shape.h \
+                        $(top_srcdir)/include/X11/extensions/sync.h \
+                        $(top_srcdir)/include/X11/extensions/Xag.h \
+                        $(top_srcdir)/include/X11/extensions/Xcup.h \
+                        $(top_srcdir)/include/X11/extensions/Xdbe.h \
+                        $(top_srcdir)/include/X11/extensions/XEVI.h \
+                        $(top_srcdir)/include/X11/extensions/Xext.h \
+                        $(top_srcdir)/include/X11/extensions/Xge.h \
+                        $(top_srcdir)/include/X11/extensions/XLbx.h \
+                        $(top_srcdir)/include/X11/extensions/XShm.h \
+                        $(top_srcdir)/include/X11/extensions/xtestext1.h
+
+if LINT
+ALL_LINT_FLAGS=$(LINT_FLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+                $(AM_CPPFLAGS) $(CPPFLAGS)
+
+lint:
+       $(LINT) $(ALL_LINT_FLAGS) $(libXext_la_SOURCES) $(XEXT_LIBS)
+endif LINT
+
+if MAKE_LINT_LIB
+lintlibdir = $(libdir)
+
+lintlib_DATA = $(LINTLIB)
+
+$(LINTLIB): $(libXext_la_SOURCES)
+       $(LINT) -y -oXext -x $(ALL_LINT_FLAGS) $(libXext_la_SOURCES) 
+endif MAKE_LINT_LIB
diff --git a/src/XAppgroup.c b/src/XAppgroup.c
new file mode 100755 (executable)
index 0000000..0d4396c
--- /dev/null
@@ -0,0 +1,388 @@
+/*
+
+Copyright 1996, 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.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#ifdef WIN32
+#include <X11/Xwindows.h>
+#endif
+
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xag.h>
+#include <X11/extensions/agproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+#include <stdarg.h>
+
+struct xagstuff {
+    int attrib_mask;
+    Bool app_group_leader;
+    Bool single_screen;
+    Window default_root;
+    VisualID root_visual;
+    Colormap default_colormap;
+    unsigned long black_pixel;
+    unsigned long white_pixel;
+};
+
+static XExtensionInfo _xag_info_data;
+static XExtensionInfo *xag_info = &_xag_info_data;
+static char *xag_extension_name = XAGNAME;
+
+#define XagCheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, xag_extension_name, val)
+
+/*****************************************************************************
+ *                                                                           *
+ *                        private utility routines                          *
+ *                                                                           *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static /* const */ XExtensionHooks xag_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 XEXT_GENERATE_FIND_DISPLAY (find_display, xag_info, 
+                                  xag_extension_name, 
+                                  &xag_extension_hooks, 
+                                  0, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xag_info)
+
+
+/*****************************************************************************
+ *                                                                           *
+ *                 public Xag Extension routines                            *
+ *                                                                           *
+ *****************************************************************************/
+
+Bool
+XagQueryVersion(
+    Display *dpy,
+    int *major_version_return,
+    int *minor_version_return)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xXagQueryVersionReply rep;
+    xXagQueryVersionReq *req;
+
+    XagCheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XagQueryVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->xagReqType = X_XagQueryVersion;
+    req->client_major_version = XAG_MAJOR_VERSION;
+    req->client_minor_version = XAG_MINOR_VERSION;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    *major_version_return = rep.server_major_version;
+    *minor_version_return = rep.server_minor_version;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+static void
+StuffToWire (Display *dpy, struct xagstuff *stuff, xXagCreateReq *req)
+{
+    unsigned long values[8];
+    unsigned long* value = values;
+    unsigned int nvalues;
+
+    /* the order these are in is important */
+    if (stuff->attrib_mask & XagSingleScreenMask)
+       *value++ = stuff->single_screen;
+
+    if (stuff->attrib_mask & XagDefaultRootMask)
+       *value++ = stuff->default_root;
+
+    if (stuff->attrib_mask & XagRootVisualMask)
+       *value++ = stuff->root_visual;
+
+    if (stuff->attrib_mask & XagDefaultColormapMask)
+       *value++ = stuff->default_colormap;
+
+    if (stuff->attrib_mask & XagBlackPixelMask)
+       *value++ = stuff->black_pixel;
+
+    if (stuff->attrib_mask & XagWhitePixelMask)
+       *value++ = stuff->white_pixel;
+
+    if (stuff->attrib_mask & XagAppGroupLeaderMask)
+       *value++ = stuff->app_group_leader;
+
+    req->length += (nvalues = value - values);
+
+    nvalues <<= 2;
+    Data32 (dpy, (long*) values, (long) nvalues);
+}
+
+Bool 
+XagCreateEmbeddedApplicationGroup(
+    Display* dpy,
+    VisualID root_visual,
+    Colormap default_colormap,
+    unsigned long black_pixel,
+    unsigned long white_pixel,
+    XAppGroup* app_group_return)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xXagCreateReq *req;
+    struct xagstuff stuff;
+
+    XagCheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    stuff.app_group_leader = True;
+    stuff.single_screen = True;
+    stuff.default_root = RootWindow (dpy, DefaultScreen(dpy));
+    stuff.root_visual = root_visual;
+    stuff.default_colormap = default_colormap;
+    stuff.attrib_mask = 
+       XagAppGroupLeaderMask | XagSingleScreenMask | XagDefaultRootMask |
+       XagRootVisualMask | XagDefaultColormapMask;
+    if (default_colormap != None) {
+       stuff.black_pixel = black_pixel;
+       stuff.white_pixel = white_pixel;
+       stuff.attrib_mask |= XagBlackPixelMask | XagWhitePixelMask;
+    }
+    /* might do some validation here */
+    GetReq(XagCreate, req);
+    req->reqType = info->codes->major_opcode;
+    req->xagReqType = X_XagCreate;
+    *app_group_return = req->app_group = XAllocID(dpy);
+    req->attrib_mask = stuff.attrib_mask;
+    StuffToWire (dpy, &stuff, req);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Bool 
+XagCreateNonembeddedApplicationGroup(
+    Display* dpy,
+    XAppGroup* app_group_return)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xXagCreateReq *req;
+    struct xagstuff stuff;
+
+    XagCheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    stuff.app_group_leader = False;
+    stuff.single_screen = False;
+    stuff.attrib_mask = XagAppGroupLeaderMask | XagSingleScreenMask;
+    /* might do some validation here */
+    GetReq(XagCreate, req);
+    req->reqType = info->codes->major_opcode;
+    req->xagReqType = X_XagCreate;
+    *app_group_return = req->app_group = XAllocID(dpy);
+    req->attrib_mask = stuff.attrib_mask;
+    StuffToWire (dpy, &stuff, req);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Bool XagDestroyApplicationGroup(Display* dpy, XAppGroup app_group)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xXagDestroyReq *req;
+
+    XagCheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XagDestroy, req);
+    req->reqType = info->codes->major_opcode;
+    req->xagReqType = X_XagDestroy;
+    req->app_group = app_group;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Bool
+XagGetApplicationGroupAttributes(Display* dpy, XAppGroup app_group, ...)
+{
+    va_list var;
+    XExtDisplayInfo *info = find_display (dpy);
+    xXagGetAttrReq *req;
+    xXagGetAttrReply rep;
+    int attr;
+
+    XagCheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XagGetAttr, req);
+    req->reqType = info->codes->major_opcode;
+    req->xagReqType = X_XagGetAttr;
+    req->app_group = app_group;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    va_start (var, app_group);
+    for (attr = va_arg(var, int); attr != 0; attr = va_arg(var, int)) {
+       void* ptr;
+
+       switch (attr) {
+       case XagNappGroupLeader:
+           ptr = va_arg(var, void*);
+           *(Bool*)ptr = rep.app_group_leader;
+           break;
+       case XagNsingleScreen:
+           ptr = va_arg(var, void*);
+           *(Bool*)ptr = rep.single_screen;
+           break;
+       case XagNdefaultRoot:
+           ptr = va_arg(var, void*);
+           *(Window*)ptr = rep.default_root;
+           break;
+       case XagNrootVisual:
+           ptr = va_arg(var, void*);
+           *(VisualID*)ptr = rep.root_visual;
+           break;
+       case XagNdefaultColormap:
+           ptr = va_arg(var, void*);
+           *(Colormap*)ptr = rep.default_colormap;
+           break;
+       case XagNblackPixel:
+           ptr = va_arg(var, void*);
+           *(unsigned long*)ptr = rep.black_pixel;
+           break;
+       case XagNwhitePixel:
+           ptr = va_arg(var, void*);
+           *(unsigned long*)ptr = rep.white_pixel;
+           break;
+       }
+    }
+    va_end (var);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Bool
+XagQueryApplicationGroup(
+    Display* dpy,
+    XID resource,
+    XAppGroup* app_group_return)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xXagQueryReq *req;
+    xXagQueryReply rep;
+
+    XagCheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XagQuery, req);
+    req->reqType = info->codes->major_opcode;
+    req->xagReqType = X_XagQuery;
+    req->resource = resource;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    *app_group_return = rep.app_group;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+
+}
+
+Bool
+XagCreateAssociation(Display* dpy, Window* window_return, void* system_window)
+{
+#ifdef WIN32
+    long tmp = *(HWND*) system_window;
+    XExtDisplayInfo *info = find_display (dpy);
+    xXagCreateAssocReq *req;
+
+    XagCheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XagCreateAssoc, req);
+    req->reqType = info->codes->major_opcode;
+    req->xagReqType = X_XagCreateAssoc;
+    *window_return = req->window = XAllocID(dpy);
+    req->window_type = XagWindowTypeWin32;
+    req->system_window_len = sizeof(HWND);
+    Data32 (dpy, (long*) tmp, 1L);
+    req->length++;
+    UnlockDisplay(dpy);
+    SyncHandle();
+#else
+    /* other platforms go here */
+
+    /* this whole thing could be arranged better, but since X need
+     * only short-circuit the protocol and WIN32 is the only other 
+     * platform the XC supports, it will suffice for now.
+     */
+    *window_return = *(Window*)system_window;
+#endif
+    return True;
+}
+
+Bool
+XagDestroyAssociation(Display* dpy, Window window)
+{
+#ifdef WIN32
+    XExtDisplayInfo *info = find_display (dpy);
+    xXagDestroyAssocReq *req;
+
+    XagCheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XagDestroyAssoc, req);
+    req->reqType = info->codes->major_opcode;
+    req->xagReqType = X_XagDestroyAssoc;
+    req->window = window;
+    UnlockDisplay(dpy);
+    SyncHandle();
+#endif
+    return True;
+}
+
diff --git a/src/XEVI.c b/src/XEVI.c
new file mode 100755 (executable)
index 0000000..a30daac
--- /dev/null
@@ -0,0 +1,213 @@
+/************************************************************
+Copyright (c) 1997 by Silicon Graphics Computer Systems, Inc.
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Silicon Graphics not be
+used in advertising or publicity pertaining to distribution
+of the software without specific prior written permission.
+Silicon Graphics makes no representation about the suitability
+of this software for any purpose. It is provided "as is"
+without any express or implied warranty.
+SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
+GRAPHICS 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.
+********************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlibint.h>
+#include <X11/extensions/XEVI.h>
+#include <X11/extensions/EVIproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/Xutil.h>
+static XExtensionInfo *xevi_info;/* needs to move to globals.c */
+static /* const */ char *xevi_extension_name = EVINAME;
+#define XeviCheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, xevi_extension_name, val)
+/*****************************************************************************
+ *                                                                           *
+ *                        private utility routines                          *
+ *                                                                           *
+ *****************************************************************************/
+static /* const */ XExtensionHooks xevi_extension_hooks = {
+    NULL,                      /* create_gc */
+    NULL,                      /* copy_gc */
+    NULL,                      /* flush_gc */
+    NULL,                      /* free_gc */
+    NULL,                      /* create_font */
+    NULL,                      /* free_font */
+    NULL,                      /* close_display */
+    NULL,                      /* wire_to_event */
+    NULL,                      /* event_to_wire */
+    NULL,                      /* error */
+    NULL,                      /* error_string */
+};
+static XEXT_GENERATE_FIND_DISPLAY (find_display, xevi_info,
+                                   xevi_extension_name,
+                                   &xevi_extension_hooks, 0, NULL)
+Bool XeviQueryExtension (Display *dpy)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    if (XextHasExtension(info)) {
+       return True;
+    } else {
+       return False;
+    }
+}
+Bool XeviQueryVersion(Display *dpy, int *majorVersion, int *minorVersion)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xEVIQueryVersionReply rep;
+    register xEVIQueryVersionReq *req;
+    XeviCheckExtension (dpy, info, False);
+    LockDisplay(dpy);
+    GetReq(EVIQueryVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->xeviReqType = X_EVIQueryVersion;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    *majorVersion = rep.majorVersion;
+    *minorVersion = rep.minorVersion;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+static Bool notInList(VisualID32 *visual, int sz_visual, VisualID newVisualid)
+{
+    while  (sz_visual-- > 0)  {
+       if (*visual == newVisualid)
+           return False;
+       visual++;
+    }
+    return True;
+}
+Status XeviGetVisualInfo(
+    register Display *dpy,
+    VisualID *visual,
+    int n_visual,
+    ExtendedVisualInfo **evi_return,
+    int *n_info_return)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xEVIGetVisualInfoReq *req;
+    xEVIGetVisualInfoReply rep;
+    int sz_info, sz_xInfo, sz_conflict, sz_xConflict;
+    VisualID32 *temp_conflict, *temp_visual, *xConflictPtr;
+    VisualID *conflict;
+    xExtendedVisualInfo *temp_xInfo;
+    XVisualInfo *vinfo;
+    register ExtendedVisualInfo *infoPtr;
+    register xExtendedVisualInfo *xInfoPtr;
+    register int n_data, visualIndex, vinfoIndex;
+    Bool isValid;
+    XeviCheckExtension (dpy, info, 0);
+    if (!n_info_return || !evi_return) {
+       return BadValue;
+    }
+    *n_info_return = 0;
+    *evi_return = NULL;
+    vinfo = XGetVisualInfo(dpy, 0, NULL, &sz_info);
+    if (!vinfo) {
+       return BadValue;
+    }
+    if (!n_visual || !visual) {                /* copy the all visual */
+       temp_visual = (VisualID32 *)Xmalloc(sz_VisualID32 * sz_info);
+       n_visual = 0;
+        for (vinfoIndex = 0; vinfoIndex < sz_info; vinfoIndex++)
+           if (notInList(temp_visual, n_visual, vinfo[vinfoIndex].visualid))
+               temp_visual[n_visual++] = vinfo[vinfoIndex].visualid;
+    }
+    else {     /* check if the visual is valid */
+        for (visualIndex = 0; visualIndex < n_visual; visualIndex++) {
+           isValid = False;
+            for (vinfoIndex = 0; vinfoIndex < sz_info; vinfoIndex++) {
+               if (visual[visualIndex] == vinfo[vinfoIndex].visualid) {
+                   isValid = True;
+                   break;
+               }
+           }
+           if (!isValid) {
+               XFree(vinfo);
+               return BadValue;
+           }
+       }
+       temp_visual = (VisualID32 *)Xmalloc(sz_VisualID32 * n_visual);
+        for (visualIndex = 0; visualIndex < n_visual; visualIndex++)
+           temp_visual[visualIndex] = visual[visualIndex];
+    }
+    XFree(vinfo);
+    LockDisplay(dpy);
+    GetReq(EVIGetVisualInfo, req);
+    req->reqType = info->codes->major_opcode;
+    req->xeviReqType = X_EVIGetVisualInfo;
+    req->n_visual = n_visual;
+    SetReqLen(req, n_visual, 1);
+    Data(dpy, (char *)temp_visual, n_visual * sz_VisualID32);
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       Xfree(temp_visual);
+       return BadAccess;
+    }
+    Xfree(temp_visual);
+    sz_info = rep.n_info * sizeof(ExtendedVisualInfo);
+    sz_xInfo = rep.n_info * sz_xExtendedVisualInfo;
+    sz_conflict = rep.n_conflicts * sizeof(VisualID);
+    sz_xConflict = rep.n_conflicts * sz_VisualID32;
+    infoPtr = *evi_return = (ExtendedVisualInfo *)Xmalloc(sz_info + sz_conflict);
+    xInfoPtr = temp_xInfo = (xExtendedVisualInfo *)Xmalloc(sz_xInfo);
+    xConflictPtr = temp_conflict = (VisualID32 *)Xmalloc(sz_xConflict);
+    if (!*evi_return || !temp_xInfo || !temp_conflict) {
+        _XEatData(dpy, (sz_xInfo + sz_xConflict + 3) & ~3);
+       UnlockDisplay(dpy);
+       SyncHandle();
+       if (evi_return)
+          Xfree(evi_return);
+       if (temp_xInfo)
+          Xfree(temp_xInfo);
+       if (temp_conflict)
+          Xfree(temp_conflict);
+       return BadAlloc;
+    }
+    _XRead(dpy, (char *)temp_xInfo, sz_xInfo);
+    _XRead(dpy, (char *)temp_conflict, sz_xConflict);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    n_data = rep.n_info;
+    conflict = (VisualID *)(infoPtr + n_data);
+    while (n_data-- > 0) {
+       infoPtr->core_visual_id         = xInfoPtr->core_visual_id;
+       infoPtr->screen                 = xInfoPtr->screen;
+       infoPtr->level                  = xInfoPtr->level;
+       infoPtr->transparency_type      = xInfoPtr->transparency_type;
+       infoPtr->transparency_value     = xInfoPtr->transparency_value;
+       infoPtr->min_hw_colormaps       = xInfoPtr->min_hw_colormaps;
+       infoPtr->max_hw_colormaps       = xInfoPtr->max_hw_colormaps;
+       infoPtr->num_colormap_conflicts = xInfoPtr->num_colormap_conflicts;
+       infoPtr->colormap_conflicts     = conflict;
+       conflict += infoPtr->num_colormap_conflicts;
+       infoPtr++;
+       xInfoPtr++;
+    }
+    n_data = rep.n_conflicts;
+    conflict = (VisualID *)(infoPtr);
+    while (n_data-- > 0)
+       *conflict++ = *xConflictPtr++;
+    Xfree(temp_xInfo);
+    Xfree(temp_conflict);
+    *n_info_return = rep.n_info;
+    return Success;
+}
diff --git a/src/XLbx.c b/src/XLbx.c
new file mode 100755 (executable)
index 0000000..e180dc4
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Copyright 1992 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 NCD. not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  NCD. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as is"
+ * without express or implied warranty.
+ *
+ * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
+ * 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.
+ *
+ * Author:  Keith Packard, Network Computing Devices
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/XLbx.h>
+#include <X11/extensions/lbxproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+static XExtensionInfo _lbx_info_data;
+static XExtensionInfo *lbx_info = &_lbx_info_data;
+static /* const */ char *lbx_extension_name = LBXNAME;
+
+#define LbxCheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, lbx_extension_name, val)
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static char *error_string(Display *dpy, int code, XExtCodes *codes,
+                         char *buf, int n);
+static /* const */ XExtensionHooks lbx_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 /* const */ char *lbx_error_list[] = {
+    "BadLbxClient",                    /* BadLbxClient */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, lbx_info, lbx_extension_name, 
+                                  &lbx_extension_hooks, LbxNumberEvents, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, lbx_info)
+
+static XEXT_GENERATE_ERROR_STRING (error_string, lbx_extension_name,
+                                  LbxNumberErrors, lbx_error_list)
+
+
+Bool XLbxQueryExtension (
+    Display *dpy,
+    int *requestp, int *event_basep, int *error_basep)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+
+    if (XextHasExtension(info)) {
+       *requestp = info->codes->major_opcode;
+       *event_basep = info->codes->first_event;
+       *error_basep = info->codes->first_error;
+       return True;
+    } else {
+       return False;
+    }
+}
+
+
+int XLbxGetEventBase(Display *dpy)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+
+    if (XextHasExtension(info)) {
+       return info->codes->first_event;
+    } else {
+       return -1;
+    }
+}
+
+
+Bool XLbxQueryVersion(Display *dpy, int *majorVersion, int *minorVersion)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xLbxQueryVersionReply rep;
+    register xLbxQueryVersionReq *req;
+
+    LbxCheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(LbxQueryVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->lbxReqType = X_LbxQueryVersion;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    *majorVersion = rep.majorVersion;
+    *minorVersion = rep.minorVersion;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+/* all other requests will run after Xlib has lost the wire ... */
diff --git a/src/XMultibuf.c b/src/XMultibuf.c
new file mode 100755 (executable)
index 0000000..ca9473d
--- /dev/null
@@ -0,0 +1,711 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Authors:  Jim Fulton, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlibint.h>
+#include <stdio.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/multibufproto.h>
+#include <X11/extensions/multibuf.h>
+
+static XExtensionInfo _multibuf_info_data;
+static XExtensionInfo *multibuf_info = &_multibuf_info_data;
+static /* const */ char *multibuf_extension_name = MULTIBUFFER_PROTOCOL_NAME;
+
+#define MbufCheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, multibuf_extension_name, val)
+#define MbufSimpleCheckExtension(dpy,i) \
+  XextSimpleCheckExtension (dpy, i, multibuf_extension_name)
+
+
+/*****************************************************************************
+ *                                                                           *
+ *                        private utility routines                          *
+ *                                                                           *
+ *****************************************************************************/
+
+/*
+ * find_display - locate the display info block
+ */
+static int close_display(Display *dpy, XExtCodes *codes);
+static char *error_string(Display *dpy, int code, XExtCodes *codes, char *buf, int n);
+static Bool wire_to_event(Display *dpy, XEvent *libevent, xEvent *netevent);
+static Status event_to_wire(Display *dpy, XEvent *libevent, xEvent *netevent);
+static /* const */ XExtensionHooks multibuf_extension_hooks = {
+    NULL,                              /* create_gc */
+    NULL,                              /* copy_gc */
+    NULL,                              /* flush_gc */
+    NULL,                              /* free_gc */
+    NULL,                              /* create_font */
+    NULL,                              /* free_font */
+    close_display,                     /* close_display */
+    wire_to_event,                     /* wire_to_event */
+    event_to_wire,                     /* event_to_wire */
+    NULL,                              /* error */
+    error_string,                      /* error_string */
+};
+
+static /* const */ char *multibuf_error_list[] = {
+    "BadBuffer",                       /* MultibufferBadBuffer */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, multibuf_info,
+                                  multibuf_extension_name, 
+                                  &multibuf_extension_hooks, 
+                                  MultibufferNumberEvents, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, multibuf_info)
+
+static XEXT_GENERATE_ERROR_STRING (error_string, multibuf_extension_name,
+                                  MultibufferNumberErrors, 
+                                  multibuf_error_list)
+
+/*
+ * wire_to_event - convert a wire event in network format to a C 
+ * event structure
+ */
+static Bool wire_to_event (Display *dpy, XEvent *libevent, xEvent *netevent)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+
+    MbufCheckExtension (dpy, info, False);
+
+    switch ((netevent->u.u.type & 0x7f) - info->codes->first_event) {
+      case MultibufferClobberNotify:
+       {
+           XmbufClobberNotifyEvent *ev;
+           xMbufClobberNotifyEvent *event;
+    
+           ev = (XmbufClobberNotifyEvent *) libevent;
+           event = (xMbufClobberNotifyEvent *) netevent;
+           ev->type = event->type & 0x7f;
+           ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *) netevent);
+           ev->send_event = ((event->type & 0x80) != 0);
+           ev->display = dpy;
+           ev->buffer = event->buffer;
+           ev->state = event->state;
+           return True;
+       }
+      case MultibufferUpdateNotify:
+       {
+           XmbufUpdateNotifyEvent *ev;
+           xMbufUpdateNotifyEvent *event;
+
+           ev = (XmbufUpdateNotifyEvent *) libevent;
+           event = (xMbufUpdateNotifyEvent *) netevent;
+           ev->type = event->type & 0x7f;
+           ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *) netevent);
+           ev->send_event = ((event->type & 0x80) != 0);
+           ev->display = dpy;
+           ev->buffer = event->buffer;
+           return True;
+       }
+    }
+    return False;
+}
+
+
+/*
+ * event_to_wire - convert a C event structure to a wire event in
+ * network format
+ */
+static Status event_to_wire (Display *dpy, XEvent *libevent, xEvent *netevent)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+
+    MbufCheckExtension (dpy, info, 0);
+
+    switch ((libevent->type & 0x7f) - info->codes->first_event) {
+      case MultibufferClobberNotify:
+       {
+           XmbufClobberNotifyEvent *ev;
+           xMbufClobberNotifyEvent *event;
+    
+           ev = (XmbufClobberNotifyEvent *) libevent;
+           event = (xMbufClobberNotifyEvent *) netevent;
+           event->type = ev->type;
+           event->sequenceNumber = (ev->serial & 0xffff);
+           event->buffer = ev->buffer;
+           event->state = ev->state;
+           return 1;
+       }
+      case MultibufferUpdateNotify:
+       {
+           XmbufUpdateNotifyEvent *ev;
+           xMbufUpdateNotifyEvent *event;
+
+           ev = (XmbufUpdateNotifyEvent *) libevent;
+           event = (xMbufUpdateNotifyEvent *) netevent;
+           event->type = ev->type;
+           event->sequenceNumber = (ev->serial & 0xffff);
+           event->buffer = ev->buffer;
+           return 1;
+       }
+    }
+    return 0;
+}
+
+
+/*
+ * read_buffer_info - read Buffer Info descriptors from the net; if unable
+ * to allocate memory, read junk to make sure that stream is clear.
+ */
+#define TALLOC(type,count) ((type *) Xmalloc ((unsigned) count * sizeof(type)))
+
+static XmbufBufferInfo *read_buffer_info (Display *dpy, int nbufs)
+{
+    xMbufBufferInfo *netbuf = TALLOC (xMbufBufferInfo, nbufs);
+    XmbufBufferInfo *bufinfo = NULL;
+    long netbytes = nbufs * SIZEOF(xMbufBufferInfo);
+
+    if (netbuf) {
+       _XRead (dpy, (char *) netbuf, netbytes);
+
+       bufinfo = TALLOC (XmbufBufferInfo, nbufs);
+       if (bufinfo) {
+           register XmbufBufferInfo *c;
+           register xMbufBufferInfo *net;
+           register int i;
+
+           for (i = 0, c = bufinfo, net = netbuf; i < nbufs;
+                i++, c++, net++) {
+               c->visualid = net->visualID;
+               c->max_buffers = net->maxBuffers;
+               c->depth = net->depth;
+           }
+       }
+       Xfree ((char *) netbuf);
+    } else {                           /* eat the data */
+       while (netbytes > 0) {
+           char dummy[256];            /* stack size vs loops tradeoff */
+           long nbytes = sizeof dummy;
+
+           if (nbytes > netbytes) nbytes = netbytes;
+           _XRead (dpy, dummy, nbytes);
+           netbytes -= nbytes;
+       }
+    }
+
+    return bufinfo;
+}
+
+#undef TALLOC
+
+
+/*****************************************************************************
+ *                                                                           *
+ *                 Multibuffering/stereo public interfaces                  *
+ *                                                                           *
+ *****************************************************************************/
+
+
+/* 
+ * XmbufQueryExtension - 
+ *     Returns True if the multibuffering/stereo extension is available
+ *     on the given display.  If the extension exists, the value of the
+ *     first event code (which should be added to the event type constants
+ *     MultibufferClobberNotify and MultibufferUpdateNotify to get the
+ *     actual values) is stored into event_base and the value of the first
+ *     error code (which should be added to the error type constant
+ *     MultibufferBadBuffer to get the actual value) is stored into 
+ *     error_base.
+ */
+Bool XmbufQueryExtension (
+    Display *dpy,
+    int *event_base_return, int *error_base_return)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    
+    if (XextHasExtension (info)) {
+       *event_base_return = info->codes->first_event;
+       *error_base_return = info->codes->first_error;
+       return True;
+    } else {
+       return False;
+    }
+}
+
+
+/* 
+ * XmbufGetVersion -
+ *     Gets the major and minor version numbers of the extension.  The return
+ *     value is zero if an error occurs or non-zero if no error happens.
+ */
+Status XmbufGetVersion (
+    Display *dpy,
+    int *major_version_return, int *minor_version_return)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xMbufGetBufferVersionReply rep;
+    register xMbufGetBufferVersionReq *req;
+
+    MbufCheckExtension (dpy, info, 0);
+
+    LockDisplay (dpy);
+    MbufGetReq (MbufGetBufferVersion, req, info);
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return 0;
+    }
+    *major_version_return = rep.majorVersion;
+    *minor_version_return = rep.minorVersion;
+    UnlockDisplay (dpy);
+
+    SyncHandle ();
+    return 1;
+}
+
+
+/*
+ * XmbufCreateBuffers - 
+ *     Requests that "count" buffers be created with the given update_action
+ *     and update_hint and be associated with the indicated window.  The
+ *     number of buffers created is returned (zero if an error occurred)
+ *     and buffers_return is filled in with that many Multibuffer identifiers.
+ */
+int XmbufCreateBuffers (
+    Display *dpy,
+    Window w,
+    int count,
+    int update_action, int update_hint,
+    Multibuffer *buffers)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xMbufCreateImageBuffersReply rep;
+    register xMbufCreateImageBuffersReq *req;
+    int result;
+
+    MbufCheckExtension (dpy, info, 0);
+
+    LockDisplay (dpy);
+
+    XAllocIDs(dpy, buffers, count);
+    MbufGetReq (MbufCreateImageBuffers, req, info);
+    req->window = w;
+    req->updateAction = update_action;
+    req->updateHint = update_hint;
+    req->length += count;
+    count <<= 2;
+    PackData32 (dpy, buffers, count);
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return 0;
+    }
+    result = rep.numberBuffer;
+    UnlockDisplay (dpy);
+
+    SyncHandle ();
+    return result;
+}
+
+
+/*
+ * XmbufDestroyBuffers - 
+ *     Destroys the buffers associated with the given window.
+ */
+void XmbufDestroyBuffers (Display *dpy, Window window)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xMbufDestroyImageBuffersReq *req;
+
+    MbufSimpleCheckExtension (dpy, info);
+
+    LockDisplay (dpy);
+    MbufGetReq (MbufDestroyImageBuffers, req, info);
+    req->window = window;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+}
+
+
+/*
+ * XmbufDisplayBuffers - 
+ *     Displays the indicated buffers their appropriate windows within
+ *     max_delay milliseconds after min_delay milliseconds have passed.
+ *     No two buffers may be associated with the same window or else a Match
+ *     error is generated.
+ */
+void XmbufDisplayBuffers (
+    Display *dpy,
+    int count,
+    Multibuffer *buffers,
+    int min_delay, int max_delay)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xMbufDisplayImageBuffersReq *req;
+
+    MbufSimpleCheckExtension (dpy, info);
+
+    LockDisplay (dpy);
+    MbufGetReq (MbufDisplayImageBuffers, req, info);
+    req->minDelay = min_delay;
+    req->maxDelay = max_delay;
+    req->length += count;
+    count <<= 2;
+    PackData32 (dpy, buffers, count);
+    UnlockDisplay (dpy);
+    SyncHandle();
+}
+
+
+/*
+ * XmbufGetWindowAttributes - 
+ *     Gets the multibuffering attributes that apply to all buffers associated
+ *     with the given window.  Returns non-zero on success and zero if an
+ *     error occurs.
+ */
+Status XmbufGetWindowAttributes (
+    Display *dpy,
+    Window w,
+    XmbufWindowAttributes *attr)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xMbufGetMBufferAttributesReq *req;
+    xMbufGetMBufferAttributesReply rep;
+
+    MbufCheckExtension (dpy, info, 0);
+
+    LockDisplay (dpy);
+    MbufGetReq (MbufGetMBufferAttributes, req, info);
+    req->window = w;
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return 0;
+    }
+    attr->buffers = (Multibuffer *) NULL; 
+    if ((attr->nbuffers = rep.length)) {
+       int nbytes = rep.length * sizeof(Multibuffer);
+       attr->buffers = (Multibuffer *) Xmalloc((unsigned) nbytes);
+       nbytes = rep.length << 2;
+       if (! attr->buffers) {
+           _XEatData(dpy, (unsigned long) nbytes);
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return (0);
+       }
+       _XRead32 (dpy, (long *) attr->buffers, nbytes);
+    }
+    attr->displayed_index = rep.displayedBuffer;
+    attr->update_action = rep.updateAction;
+    attr->update_hint = rep.updateHint;
+    attr->window_mode = rep.windowMode;
+
+    UnlockDisplay (dpy);
+    SyncHandle();
+    return 1;
+}
+
+
+/*
+ * XmbufChangeWindowAttributes - 
+ *     Sets the multibuffering attributes that apply to all buffers associated
+ *     with the given window.  This is currently limited to the update_hint.
+ */
+void XmbufChangeWindowAttributes (
+    Display *dpy,
+    Window w,
+    unsigned long valuemask,
+    XmbufSetWindowAttributes *attr)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xMbufSetMBufferAttributesReq *req;
+
+    MbufSimpleCheckExtension (dpy, info);
+
+    LockDisplay (dpy);
+    MbufGetReq (MbufSetMBufferAttributes, req, info);
+    req->window = w;
+    if ((req->valueMask = valuemask)) {        /* stolen from lib/X/XWindow.c */
+       unsigned long values[1];        /* one per element in if stmts below */
+       unsigned long *v = values;
+       unsigned int nvalues;
+
+       if (valuemask & MultibufferWindowUpdateHint) 
+         *v++ = attr->update_hint;
+       req->length += (nvalues = v - values);
+       nvalues <<= 2;                  /* watch out for macros... */
+       Data32 (dpy, (long *) values, (long)nvalues);
+    }
+    UnlockDisplay (dpy);
+    SyncHandle();
+}
+
+
+/*
+ * XmbufGetBufferAttributes - 
+ *     Gets the attributes for the indicated buffer.  Returns non-zero on
+ *     success and zero if an error occurs.
+ */
+Status XmbufGetBufferAttributes (
+    Display *dpy,
+    Multibuffer b,
+    XmbufBufferAttributes *attr)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xMbufGetBufferAttributesReq *req;
+    xMbufGetBufferAttributesReply rep;
+
+    MbufCheckExtension (dpy, info, 0);
+
+    LockDisplay (dpy);
+    MbufGetReq (MbufGetBufferAttributes, req, info);
+    req->buffer = b;
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return 0;
+    }
+    attr->window = rep.window;
+    attr->event_mask = rep.eventMask;
+    attr->buffer_index = rep.bufferIndex;
+    attr->side = rep.side;
+
+    UnlockDisplay (dpy);
+    SyncHandle();
+    return 1;
+}
+
+
+/*
+ * XmbufChangeBufferAttributes - 
+ *     Sets the attributes for the indicated buffer.  This is currently
+ *     limited to the event_mask.
+ */
+void XmbufChangeBufferAttributes (
+    Display *dpy,
+    Multibuffer b,
+    unsigned long valuemask,
+    XmbufSetBufferAttributes *attr)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xMbufSetBufferAttributesReq *req;
+
+    MbufSimpleCheckExtension (dpy, info);
+
+    LockDisplay (dpy);
+    MbufGetReq (MbufSetBufferAttributes, req, info);
+    req->buffer = b;
+    if ((req->valueMask = valuemask)) {        /* stolen from lib/X/XWindow.c */
+       unsigned long values[1];        /* one per element in if stmts below */
+       unsigned long *v = values;
+       unsigned int nvalues;
+
+       if (valuemask & MultibufferBufferEventMask)
+         *v++ = attr->event_mask;
+       req->length += (nvalues = v - values);
+       nvalues <<= 2;                  /* watch out for macros... */
+       Data32 (dpy, (long *) values, (long)nvalues);
+    }
+    UnlockDisplay (dpy);
+    SyncHandle();
+}
+
+
+
+/*
+ * XmbufGetScreenInfo - 
+ *     Gets the parameters controlling how mono and stereo windows may be
+ *     created on the indicated screen.  The numbers of sets of visual and 
+ *     depths are returned in nmono_return and nstereo_return.  If 
+ *     nmono_return is greater than zero, then mono_info_return is set to
+ *     the address of an array of XmbufBufferInfo structures describing the
+ *     various visuals and depths that may be used.  Otherwise,
+ *     mono_info_return is set to NULL.  Similarly, stereo_info_return is
+ *     set according to nstereo_return.  The storage returned in 
+ *     mono_info_return and stereo_info_return may be released by XFree.
+ *     If no errors are encounted, non-zero will be returned.
+ */
+Status XmbufGetScreenInfo (
+    Display *dpy,
+    Drawable d,
+    int *nmono_return,
+    XmbufBufferInfo **mono_info_return,
+    int *nstereo_return,
+    XmbufBufferInfo **stereo_info_return)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xMbufGetBufferInfoReq *req;
+    xMbufGetBufferInfoReply rep;
+    int nmono, nstereo;
+    XmbufBufferInfo *minfo, *sinfo;
+
+    MbufCheckExtension (dpy, info, 0);
+
+    LockDisplay (dpy);
+    MbufGetReq (MbufGetBufferInfo, req, info);
+    req->drawable = d;
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return 0;
+    }
+    nmono = rep.normalInfo;
+    nstereo = rep.stereoInfo;
+    minfo = ((nmono > 0) ? read_buffer_info (dpy, nmono) : NULL);
+    sinfo = ((nstereo > 0) ? read_buffer_info (dpy, nstereo) : NULL);
+
+    /* check for bad reads indicating we need to return an error */
+    if ((nmono > 0 && !minfo) || (nstereo > 0 && !sinfo)) {
+       if (minfo) Xfree ((char *) minfo);
+       if (sinfo) Xfree ((char *) sinfo);
+       UnlockDisplay (dpy);
+       SyncHandle();
+       return 0;
+    }
+
+    *nmono_return = nmono;
+    *mono_info_return = minfo;
+    *nstereo_return = nstereo;
+    *stereo_info_return = sinfo;
+
+    UnlockDisplay (dpy);
+    SyncHandle();
+    return 1;
+}
+
+
+/*
+ * XmbufCreateStereoWindow - 
+ *     Creates a stereo window in the same way that XCreateWindow creates
+ *     a mono window (in fact, use the same code, except for the request)
+ *      and returns the left and right buffers that may be 
+ */
+Window XmbufCreateStereoWindow (
+    Display *dpy,
+    Window parent,
+    int x, int y,
+    unsigned int width, unsigned int height, unsigned int border_width,
+    int depth,
+    unsigned int class,
+    Visual *visual,
+    unsigned long valuemask,
+    XSetWindowAttributes *attr,
+    Multibuffer *leftp, Multibuffer *rightp)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    Window wid;
+    register xMbufCreateStereoWindowReq *req;
+
+    MbufCheckExtension (dpy, info, None);
+
+    LockDisplay(dpy);
+    MbufGetReq(MbufCreateStereoWindow, req, info);
+    wid = req->wid = XAllocID(dpy);
+    req->parent = parent;
+    req->left = *leftp = XAllocID (dpy);
+    req->right = *rightp = XAllocID (dpy);
+    req->x = x;
+    req->y = y;
+    req->width = width;
+    req->height = height;
+    req->borderWidth = border_width;
+    req->depth = depth;
+    req->class = class;
+    if (visual == (Visual *)CopyFromParent)
+       req->visual = CopyFromParent;
+    else
+       req->visual = visual->visualid;
+    valuemask &= (CWBackPixmap|CWBackPixel|CWBorderPixmap|
+                    CWBorderPixel|CWBitGravity|CWWinGravity|
+                    CWBackingStore|CWBackingPlanes|CWBackingPixel|
+                    CWOverrideRedirect|CWSaveUnder|CWEventMask|
+                    CWDontPropagate|CWColormap|CWCursor);
+    if ((req->mask = valuemask)) {
+       unsigned long values[32];
+       register unsigned long *value = values;
+       unsigned int nvalues;
+
+       if (valuemask & CWBackPixmap)
+         *value++ = attr->background_pixmap;
+       if (valuemask & CWBackPixel)
+         *value++ = attr->background_pixel;
+       if (valuemask & CWBorderPixmap)
+         *value++ = attr->border_pixmap;
+       if (valuemask & CWBorderPixel)
+         *value++ = attr->border_pixel;
+       if (valuemask & CWBitGravity)
+         *value++ = attr->bit_gravity;
+       if (valuemask & CWWinGravity)
+         *value++ = attr->win_gravity;
+       if (valuemask & CWBackingStore)
+         *value++ = attr->backing_store;
+       if (valuemask & CWBackingPlanes)
+         *value++ = attr->backing_planes;
+       if (valuemask & CWBackingPixel)
+         *value++ = attr->backing_pixel;
+       if (valuemask & CWOverrideRedirect)
+         *value++ = attr->override_redirect;
+       if (valuemask & CWSaveUnder)
+         *value++ = attr->save_under;
+       if (valuemask & CWEventMask)
+         *value++ = attr->event_mask;
+       if (valuemask & CWDontPropagate)
+         *value++ = attr->do_not_propagate_mask;
+       if (valuemask & CWColormap)
+         *value++ = attr->colormap;
+       if (valuemask & CWCursor)
+         *value++ = attr->cursor;
+       req->length += (nvalues = value - values);
+
+       nvalues <<= 2;                      /* watch out for macros... */
+       Data32 (dpy, (long *) values, (long)nvalues);
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return wid;
+}
+
+void XmbufClearBufferArea (
+    Display *dpy,
+    Multibuffer buffer,
+    int x, int y,
+    unsigned int width, unsigned int height,
+    Bool exposures)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xMbufClearImageBufferAreaReq *req;
+
+    MbufSimpleCheckExtension (dpy, info);
+
+    LockDisplay (dpy);
+    MbufGetReq (MbufClearImageBufferArea, req, info);
+    req->buffer = buffer;
+    req->x      = x;
+    req->y      = y;
+    req->width  = width;
+    req->height = height;
+    req->exposures = exposures;
+    UnlockDisplay (dpy);
+    SyncHandle();
+}
+
diff --git a/src/XSecurity.c b/src/XSecurity.c
new file mode 100755 (executable)
index 0000000..b2aa98c
--- /dev/null
@@ -0,0 +1,309 @@
+/*
+
+Copyright 1996, 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.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlibint.h>
+#include <stdio.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/securproto.h>
+#include <X11/extensions/security.h>
+
+static XExtensionInfo _Security_info_data;
+static XExtensionInfo *Security_info = &_Security_info_data;
+static char *Security_extension_name = SECURITY_EXTENSION_NAME;
+
+#define SecurityCheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, Security_extension_name, val)
+#define SecuritySimpleCheckExtension(dpy,i) \
+  XextSimpleCheckExtension (dpy, i, Security_extension_name)
+
+#define SecurityGetReq(name,req,info) GetReq (name, req); \
+        req->reqType = info->codes->major_opcode; \
+        req->securityReqType = X_##name;
+
+/*****************************************************************************
+ *                                                                           *
+ *                        private utility routines                          *
+ *                                                                           *
+ *****************************************************************************/
+
+/*
+ * find_display - locate the display info block
+ */
+static int close_display(Display *dpy, XExtCodes *codes);
+static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire);
+static Status event_to_wire(Display *dpy, XEvent *event, xEvent *wire);
+static char *error_string(Display *dpy, int code, XExtCodes *codes,
+                         char *buf, int n);
+
+static XExtensionHooks Security_extension_hooks = {
+    NULL,                               /* create_gc */
+    NULL,                               /* copy_gc */
+    NULL,                               /* flush_gc */
+    NULL,                               /* free_gc */
+    NULL,                               /* create_font */
+    NULL,                               /* free_font */
+    close_display,                      /* close_display */
+    wire_to_event,                      /* wire_to_event */
+    event_to_wire,                      /* event_to_wire */
+    NULL,                               /* error */
+    error_string                        /* error_string */
+};
+
+static char    *security_error_list[] = {
+    "BadAuthorization",
+    "BadAuthorizationProtocol"
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, Security_info,
+                                  Security_extension_name,
+                                  &Security_extension_hooks,
+                                  XSecurityNumberEvents, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, Security_info)
+
+static
+XEXT_GENERATE_ERROR_STRING(error_string, Security_extension_name,
+                          XSecurityNumberErrors, security_error_list)
+
+static Bool
+wire_to_event(Display *dpy, XEvent *event, xEvent *wire)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+
+    SecurityCheckExtension (dpy, info, False);
+
+    switch ((wire->u.u.type & 0x7F) - info->codes->first_event)
+    {
+       case XSecurityAuthorizationRevoked:
+       {
+           xSecurityAuthorizationRevokedEvent *rwire =
+               (xSecurityAuthorizationRevokedEvent *)wire;
+           XSecurityAuthorizationRevokedEvent *revent =
+               (XSecurityAuthorizationRevokedEvent *)event;
+
+         revent->type = rwire->type & 0x7F;
+         revent->serial = _XSetLastRequestRead(dpy,
+                                               (xGenericReply *) wire);
+         revent->send_event = (rwire->type & 0x80) != 0;
+         revent->display = dpy;
+         revent->auth_id = rwire->authId;
+         return True;
+       }
+    }
+    return False;
+}
+
+static Status
+event_to_wire(Display *dpy, XEvent *event, xEvent *wire)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+
+    SecurityCheckExtension(dpy, info, False);
+
+    switch ((event->type & 0x7F) - info->codes->first_event)
+    {
+       case XSecurityAuthorizationRevoked:
+       {
+           xSecurityAuthorizationRevokedEvent *rwire =
+               (xSecurityAuthorizationRevokedEvent *)wire;
+           XSecurityAuthorizationRevokedEvent *revent =
+               (XSecurityAuthorizationRevokedEvent *)event;
+           rwire->type = revent->type | (revent->send_event ? 0x80 : 0);
+           rwire->sequenceNumber = revent->serial & 0xFFFF;
+           return True;
+       }
+    }
+    return False;
+}
+
+/*****************************************************************************
+ *                                                                           *
+ *                    Security public interfaces                            *
+ *                                                                           *
+ *****************************************************************************/
+
+Status XSecurityQueryExtension (
+    Display *dpy,
+    int *major_version_return,
+    int *minor_version_return)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xSecurityQueryVersionReply rep;
+    register xSecurityQueryVersionReq *req;
+
+    if (!XextHasExtension (info))
+        return (Status)0; /* failure */
+
+    LockDisplay (dpy);
+    SecurityGetReq (SecurityQueryVersion, req, info);
+    req->majorVersion = SECURITY_MAJOR_VERSION;
+    req->minorVersion = SECURITY_MINOR_VERSION;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return (Status)0; /* failure */
+    }
+    *major_version_return = rep.majorVersion;
+    *minor_version_return = rep.minorVersion;
+    UnlockDisplay (dpy);
+
+    SyncHandle ();
+
+    if (*major_version_return != SECURITY_MAJOR_VERSION)
+        return (Status)0; /* failure */
+    else
+        return (Status)1; /* success */
+}
+
+Xauth *
+XSecurityAllocXauth(void)
+{
+    return Xcalloc(1, sizeof(Xauth));
+}
+
+void
+XSecurityFreeXauth(Xauth *auth)
+{
+    XFree(auth);
+}
+
+static int
+Ones(Mask mask)
+{
+    register Mask y;
+
+    y = (mask >> 1) &033333333333;
+    y = mask - y - ((y >>1) & 033333333333);
+    return (((y + (y >> 3)) & 030707070707) % 077);
+}
+
+Xauth *
+XSecurityGenerateAuthorization(
+    Display *dpy,
+    Xauth *auth_in,
+    unsigned long valuemask,
+    XSecurityAuthorizationAttributes *attributes,
+    XSecurityAuthorization *auth_id_return)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xSecurityGenerateAuthorizationReq *req;
+    xSecurityGenerateAuthorizationReply rep;
+    Xauth *auth_return;
+    unsigned long values[3];
+    unsigned long *value = values;
+    unsigned int nvalues;
+
+    *auth_id_return = 0;  /* in case we fail */
+
+    /* make sure extension is available */
+
+    SecurityCheckExtension (dpy, info, (Xauth *)NULL);
+
+    LockDisplay(dpy);
+    SecurityGetReq(SecurityGenerateAuthorization, req, info);
+
+    req->nbytesAuthProto = auth_in->name_length;
+    req->nbytesAuthData  = auth_in->data_length;
+
+    /* adjust length to account for auth name and data */
+    req->length += (auth_in->name_length + (unsigned)3) >> 2;
+    req->length += (auth_in->data_length + (unsigned)3) >> 2;
+
+    /* adjust length to account for list of values */
+    req->valueMask = valuemask & XSecurityAllAuthorizationAttributes;
+    nvalues = Ones(req->valueMask);
+    req->length += nvalues;
+
+    /* send auth name and data */
+    Data(dpy, auth_in->name, auth_in->name_length);
+    Data(dpy, auth_in->data, auth_in->data_length);
+
+    /* send values */
+    if (valuemask & XSecurityTimeout)   *value++ = attributes->timeout;
+    if (valuemask & XSecurityTrustLevel) *value++ = attributes->trust_level;
+    if (valuemask & XSecurityGroup)     *value++ = attributes->group;
+    if (valuemask & XSecurityEventMask)         *value++ = attributes->event_mask;
+
+    nvalues <<= 2;
+    Data32(dpy, (long *)values, (long)nvalues);
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return (Xauth *)NULL;
+    }
+
+    *auth_id_return = rep.authId;
+
+    /* Allocate space for the Xauth struct and the auth name and data all
+     * in one hunk.  This lets XSecurityFreeXauth not have to care
+     * about whether the auth was allocated here or in
+     * XSecurityAllocXauth; in both cases, you just free one pointer.
+     */
+
+    if ((auth_return = (Xauth *)Xcalloc(1,
+               (sizeof(Xauth) + auth_in->name_length + rep.dataLength))))
+    {
+       auth_return->data_length = rep.dataLength;
+       auth_return->data = (char *)&auth_return[1];
+       _XReadPad(dpy, auth_return->data, (long)rep.dataLength);
+
+       auth_return->name_length = auth_in->name_length;
+       auth_return->name = auth_return->data + auth_return->data_length;
+       memcpy(auth_return->name, auth_in->name, auth_return->name_length);
+    }
+    else
+    {
+       _XEatData(dpy, (unsigned long) (rep.dataLength + 3) & ~3);
+    }
+
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return auth_return;
+
+} /* XSecurityGenerateAuthorization */
+
+Status
+XSecurityRevokeAuthorization(
+    Display *dpy,
+    XSecurityAuthorization auth_id)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xSecurityRevokeAuthorizationReq *req;
+
+    SecurityCheckExtension (dpy, info, 0);
+    LockDisplay(dpy);
+    SecurityGetReq(SecurityRevokeAuthorization, req, info);
+    req->authId = auth_id;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return 1;
+} /* XSecurityRevokeAuthorization */
diff --git a/src/XShape.c b/src/XShape.c
new file mode 100755 (executable)
index 0000000..708c20f
--- /dev/null
@@ -0,0 +1,488 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author:  Keith Packard, MIT X Consortium
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlibint.h>
+#include <X11/Xutil.h>
+#include <X11/Xregion.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/shape.h>
+#include <X11/extensions/shapeproto.h>
+
+static XExtensionInfo _shape_info_data;
+static XExtensionInfo *shape_info = &_shape_info_data;
+static /* const */ char *shape_extension_name = SHAPENAME;
+
+#define ShapeCheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, shape_extension_name, val)
+#define ShapeSimpleCheckExtension(dpy,i) \
+  XextSimpleCheckExtension (dpy, i, shape_extension_name)
+
+
+/*****************************************************************************
+ *                                                                           *
+ *                        private utility routines                          *
+ *                                                                           *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static Bool wire_to_event (Display *dpy, XEvent *re, xEvent *event);
+static Status event_to_wire (Display *dpy, XEvent *re, xEvent *event);
+static /* const */ XExtensionHooks shape_extension_hooks = {
+    NULL,                              /* create_gc */
+    NULL,                              /* copy_gc */
+    NULL,                              /* flush_gc */
+    NULL,                              /* free_gc */
+    NULL,                              /* create_font */
+    NULL,                              /* free_font */
+    close_display,                     /* close_display */
+    wire_to_event,                     /* wire_to_event */
+    event_to_wire,                     /* event_to_wire */
+    NULL,                              /* error */
+    NULL,                              /* error_string */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, shape_info,
+                                  shape_extension_name, 
+                                  &shape_extension_hooks,
+                                  ShapeNumberEvents, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, shape_info)
+
+
+static Bool
+wire_to_event (Display *dpy, XEvent *re, xEvent *event)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    XShapeEvent                *se;
+    xShapeNotifyEvent  *sevent;
+
+    ShapeCheckExtension (dpy, info, False);
+
+    switch ((event->u.u.type & 0x7f) - info->codes->first_event) {
+    case ShapeNotify:
+       se = (XShapeEvent *) re;
+       sevent = (xShapeNotifyEvent *) event;
+       se->type = sevent->type & 0x7f;
+       se->serial = _XSetLastRequestRead(dpy,(xGenericReply *) event);
+       se->send_event = (sevent->type & 0x80) != 0;
+       se->display = dpy;
+       se->window = sevent->window;
+       se->kind = sevent->kind;
+       se->x = cvtINT16toInt (sevent->x);
+       se->y = cvtINT16toInt (sevent->y);
+       se->width = sevent->width;
+       se->height = sevent->height;
+       se->time = sevent->time;
+       se->shaped = True;
+       if (sevent->shaped == xFalse)
+           se->shaped = False;
+       return True;
+    }
+    return False;
+}
+
+static Status
+event_to_wire (Display *dpy, XEvent *re, xEvent *event)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    XShapeEvent                *se;
+    xShapeNotifyEvent  *sevent;
+
+    ShapeCheckExtension (dpy, info, 0);
+
+    switch ((re->type & 0x7f) - info->codes->first_event) {
+    case ShapeNotify:
+       se = (XShapeEvent *) re;
+       sevent = (xShapeNotifyEvent *) event;
+       sevent->type = se->type | (se->send_event ? 0x80 : 0);
+       sevent->sequenceNumber = se->serial & 0xffff;
+       sevent->window = se->window;
+       sevent->kind = se->kind;
+       sevent->x = se->x;
+       sevent->y = se->y;
+       sevent->width = se->width;
+       sevent->height = se->height;
+       sevent->time = se->time;
+       return 1;
+    }
+    return 0;
+}
+
+
+/****************************************************************************
+ *                                                                          *
+ *                         Shape public interfaces                         *
+ *                                                                          *
+ ****************************************************************************/
+
+Bool XShapeQueryExtension (Display *dpy, int *event_basep, int *error_basep)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+
+    if (XextHasExtension(info)) {
+       *event_basep = info->codes->first_event;
+       *error_basep = info->codes->first_error;
+       return True;
+    } else {
+       return False;
+    }
+}
+
+
+Status XShapeQueryVersion(
+    Display *dpy,
+    int *major_versionp,
+    int *minor_versionp)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xShapeQueryVersionReply        rep;
+    register xShapeQueryVersionReq  *req;
+
+    ShapeCheckExtension (dpy, info, 0);
+
+    LockDisplay (dpy);
+    GetReq (ShapeQueryVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->shapeReqType = X_ShapeQueryVersion;
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return 0;
+    }
+    *major_versionp = rep.majorVersion;
+    *minor_versionp = rep.minorVersion;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return 1;
+}
+
+void XShapeCombineRegion(
+    register Display *dpy,
+    Window dest,
+    int destKind, int xOff, int yOff,
+    register REGION *r,
+    int op)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xShapeRectanglesReq *req;
+    register long nbytes;
+    register int i;
+    register XRectangle *xr, *pr;
+    register BOX *pb;
+
+    ShapeSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq(ShapeRectangles, req);
+    xr = (XRectangle *) 
+       _XAllocScratch(dpy, (unsigned long)(r->numRects * sizeof (XRectangle)));
+    for (pr = xr, pb = r->rects, i = r->numRects; --i >= 0; pr++, pb++) {
+        pr->x = pb->x1;
+       pr->y = pb->y1;
+       pr->width = pb->x2 - pb->x1;
+       pr->height = pb->y2 - pb->y1;
+     }
+    req->reqType = info->codes->major_opcode;
+    req->shapeReqType = X_ShapeRectangles;
+    req->op = op;
+    req->ordering = YXBanded;
+    req->destKind = destKind;
+    req->dest = dest;
+    req->xOff = xOff;
+    req->yOff = yOff;
+
+    /* SIZEOF(xRectangle) will be a multiple of 4 */
+    req->length += r->numRects * (SIZEOF(xRectangle) / 4);
+
+    nbytes = r->numRects * sizeof(xRectangle);
+
+    Data16 (dpy, (short *) xr, nbytes);
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+
+void XShapeCombineRectangles (
+    register Display *dpy,
+    XID dest,
+    int destKind, int xOff, int yOff,
+    XRectangle *rects,
+    int n_rects,
+    int op, int ordering)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xShapeRectanglesReq *req;
+    register long nbytes;
+
+    ShapeSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq(ShapeRectangles, req);
+    req->reqType = info->codes->major_opcode;
+    req->shapeReqType = X_ShapeRectangles;
+    req->op = op;
+    req->ordering = ordering;
+    req->destKind = destKind;
+    req->dest = dest;
+    req->xOff = xOff;
+    req->yOff = yOff;
+
+    /* SIZEOF(xRectangle) will be a multiple of 4 */
+    req->length += n_rects * (SIZEOF(xRectangle) / 4);
+
+    nbytes = n_rects * sizeof(xRectangle);
+
+    Data16 (dpy, (short *) rects, nbytes);
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+
+void XShapeCombineMask (
+    register Display *dpy,
+    XID dest,
+    int destKind,
+    int xOff, int yOff,
+    Pixmap src,
+    int op)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xShapeMaskReq *req;
+
+    ShapeSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq(ShapeMask, req);
+    req->reqType = info->codes->major_opcode;
+    req->shapeReqType = X_ShapeMask;
+    req->op = op;
+    req->destKind = destKind;
+    req->dest = dest;
+    req->xOff = xOff;
+    req->yOff = yOff;
+    req->src = src;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+void XShapeCombineShape (
+    register Display *dpy,
+    XID dest,
+    int destKind,
+    int xOff, int yOff,
+    XID src,
+    int srcKind,
+    int op)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xShapeCombineReq *req;
+
+    ShapeSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq(ShapeCombine, req);
+    req->reqType = info->codes->major_opcode;
+    req->shapeReqType = X_ShapeCombine;
+    req->op = op;
+    req->destKind = destKind;
+    req->srcKind = srcKind;
+    req->dest = dest;
+    req->xOff = xOff;
+    req->yOff = yOff;
+    req->src = src;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+void XShapeOffsetShape (
+    register Display *dpy,
+    XID dest,
+    int destKind,
+    int xOff, int yOff)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xShapeOffsetReq *req;
+
+    ShapeSimpleCheckExtension (dpy, info);
+
+    LockDisplay(dpy);
+    GetReq(ShapeOffset, req);
+    req->reqType = info->codes->major_opcode;
+    req->shapeReqType = X_ShapeOffset;
+    req->destKind = destKind;
+    req->dest = dest;
+    req->xOff = xOff;
+    req->yOff = yOff;
+    UnlockDisplay(dpy);
+    SyncHandle();
+}
+
+Status XShapeQueryExtents (
+    register Display *dpy,
+    Window window,
+    int *bShaped, int *xbs, int *ybs, unsigned int *wbs, unsigned int *hbs, /* RETURN */
+    int *cShaped, int *xcs, int *ycs, unsigned int *wcs, unsigned int *hcs /* RETURN */)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xShapeQueryExtentsReply        rep;
+    register xShapeQueryExtentsReq *req;
+    
+    ShapeCheckExtension (dpy, info, 0);
+
+    LockDisplay (dpy);
+    GetReq (ShapeQueryExtents, req);
+    req->reqType = info->codes->major_opcode;
+    req->shapeReqType = X_ShapeQueryExtents;
+    req->window = window;
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return 0;
+    }
+    *bShaped = rep.boundingShaped;
+    *cShaped = rep.clipShaped;
+    *xbs = cvtINT16toInt (rep.xBoundingShape);
+    *ybs = cvtINT16toInt (rep.yBoundingShape);
+    *wbs = rep.widthBoundingShape;
+    *hbs = rep.heightBoundingShape;
+    *xcs = cvtINT16toInt (rep.xClipShape);
+    *ycs = cvtINT16toInt (rep.yClipShape);
+    *wcs = rep.widthClipShape;
+    *hcs = rep.heightClipShape;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return 1;
+}
+
+
+void XShapeSelectInput (
+    register Display *dpy,
+    Window window,
+    unsigned long mask)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xShapeSelectInputReq   *req;
+
+    ShapeSimpleCheckExtension (dpy, info);
+
+    LockDisplay (dpy);
+    GetReq (ShapeSelectInput, req);
+    req->reqType = info->codes->major_opcode;
+    req->shapeReqType = X_ShapeSelectInput;
+    req->window = window;
+    if (mask & ShapeNotifyMask)
+       req->enable = xTrue;
+    else
+       req->enable = xFalse;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+}
+
+unsigned long XShapeInputSelected (register Display *dpy, Window window)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xShapeInputSelectedReq *req;
+    xShapeInputSelectedReply       rep;
+
+    ShapeCheckExtension (dpy, info, False);
+
+    LockDisplay (dpy);
+    GetReq (ShapeInputSelected, req);
+    req->reqType = info->codes->major_opcode;
+    req->shapeReqType = X_ShapeInputSelected;
+    req->window = window;
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return False;
+    }
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return rep.enabled ? ShapeNotifyMask : 0L;
+}
+
+
+XRectangle *XShapeGetRectangles (
+    register Display *dpy,
+    Window window,
+    int kind,
+    int *count, /* RETURN */
+    int *ordering /* RETURN */)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xShapeGetRectanglesReq   *req;
+    xShapeGetRectanglesReply       rep;
+    XRectangle                     *rects;
+    xRectangle                     *xrects;
+    int                                    i;
+
+    ShapeCheckExtension (dpy, info, (XRectangle *)NULL);
+
+    LockDisplay (dpy);
+    GetReq (ShapeGetRectangles, req);
+    req->reqType = info->codes->major_opcode;
+    req->shapeReqType = X_ShapeGetRectangles;
+    req->window = window;
+    req->kind = kind;
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return (XRectangle *)NULL;
+    }
+    *count = rep.nrects;
+    *ordering = rep.ordering;
+    rects = NULL;
+    if (*count) {
+       xrects = (xRectangle *) Xmalloc (*count * sizeof (xRectangle));
+       rects = (XRectangle *) Xmalloc (*count * sizeof (XRectangle));
+       if (!xrects || !rects) {
+           if (xrects)
+               Xfree (xrects);
+           if (rects)
+               Xfree (rects);
+           _XEatData (dpy, *count * sizeof (xRectangle));
+           rects = NULL;
+           *count = 0;
+       } else {
+           _XRead (dpy, (char *) xrects, *count * sizeof (xRectangle));
+           for (i = 0; i < *count; i++) {
+               rects[i].x = (short) cvtINT16toInt (xrects[i].x);
+               rects[i].y = (short) cvtINT16toInt (xrects[i].y);
+               rects[i].width = xrects[i].width;
+               rects[i].height = xrects[i].height;
+           }
+           Xfree (xrects);
+       }
+    }
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return rects;
+}
diff --git a/src/XShm.c b/src/XShm.c
new file mode 100755 (executable)
index 0000000..007fcd8
--- /dev/null
@@ -0,0 +1,431 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author:  Bob Scheifler and Keith Packard, MIT X Consortium
+ */
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlibint.h>
+#include <X11/ImUtil.h>
+#include <X11/extensions/XShm.h>
+#include <X11/extensions/shmproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+static XExtensionInfo _shm_info_data;
+static XExtensionInfo *shm_info = &_shm_info_data;
+static /* const */ char *shm_extension_name = SHMNAME;
+
+#define ShmCheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, shm_extension_name, val)
+
+/*****************************************************************************
+ *                                                                           *
+ *                        private utility routines                          *
+ *                                                                           *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static char *error_string(Display *dpy, int code, XExtCodes *codes,
+                         char *buf, int n);
+static Bool wire_to_event (Display *dpy, XEvent *re, xEvent *event);
+static Status event_to_wire (Display *dpy, XEvent *re, xEvent *event);
+static /* const */ XExtensionHooks shm_extension_hooks = {
+    NULL,                              /* create_gc */
+    NULL,                              /* copy_gc */
+    NULL,                              /* flush_gc */
+    NULL,                              /* free_gc */
+    NULL,                              /* create_font */
+    NULL,                              /* free_font */
+    close_display,                     /* close_display */
+    wire_to_event,                     /* wire_to_event */
+    event_to_wire,                     /* event_to_wire */
+    NULL,                              /* error */
+    error_string,                      /* error_string */
+};
+
+static /* const */ char *shm_error_list[] = {
+    "BadShmSeg",                       /* BadShmSeg */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, shm_info, shm_extension_name, 
+                                  &shm_extension_hooks, ShmNumberEvents, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, shm_info)
+
+static XEXT_GENERATE_ERROR_STRING (error_string, shm_extension_name,
+                                  ShmNumberErrors, shm_error_list)
+
+
+static Bool
+wire_to_event (Display *dpy, XEvent *re, xEvent *event)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    XShmCompletionEvent        *se;
+    xShmCompletionEvent        *sevent;
+
+    ShmCheckExtension (dpy, info, False);
+
+    switch ((event->u.u.type & 0x7f) - info->codes->first_event) {
+    case ShmCompletion:
+       se = (XShmCompletionEvent *) re;
+       sevent = (xShmCompletionEvent *) event;
+       se->type = sevent->type & 0x7f;
+       se->serial = _XSetLastRequestRead(dpy,(xGenericReply *) event);
+       se->send_event = (sevent->type & 0x80) != 0;
+       se->display = dpy;
+       se->drawable = sevent->drawable;
+       se->major_code = sevent->majorEvent;
+       se->minor_code = sevent->minorEvent;
+       se->shmseg = sevent->shmseg;
+       se->offset = sevent->offset;
+       return True;
+    }
+    return False;
+}
+
+static Status
+event_to_wire (Display *dpy, XEvent *re, xEvent *event)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    XShmCompletionEvent        *se;
+    xShmCompletionEvent        *sevent;
+
+    ShmCheckExtension (dpy, info, 0);
+
+    switch ((re->type & 0x7f) - info->codes->first_event) {
+    case ShmCompletion:
+       se = (XShmCompletionEvent *) re;
+       sevent = (xShmCompletionEvent *) event;
+       sevent->type = se->type | (se->send_event ? 0x80 : 0);
+       sevent->sequenceNumber = se->serial & 0xffff;
+       sevent->drawable = se->drawable;
+       sevent->majorEvent = se->major_code;
+       sevent->minorEvent = se->minor_code;
+       sevent->shmseg = se->shmseg;
+       sevent->offset = se->offset;
+       return True;
+    }
+    return False;
+}
+
+/*****************************************************************************
+ *                                                                           *
+ *                 public Shared Memory Extension routines                  *
+ *                                                                           *
+ *****************************************************************************/
+
+Bool XShmQueryExtension (Display *dpy /*  int *event_basep, *error_basep */)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+
+    if (XextHasExtension(info)) {
+/*     *event_basep = info->codes->first_event;
+       *error_basep = info->codes->error_event; */
+       return True;
+    } else {
+       return False;
+    }
+}
+
+
+int XShmGetEventBase(Display *dpy)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+
+    if (XextHasExtension(info)) {
+       return info->codes->first_event;
+    } else {
+       return -1;
+    }
+}
+
+
+Bool XShmQueryVersion(
+    Display *dpy,
+    int *majorVersion,
+    int *minorVersion,
+    Bool *sharedPixmaps)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xShmQueryVersionReply rep;
+    register xShmQueryVersionReq *req;
+
+    ShmCheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(ShmQueryVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->shmReqType = X_ShmQueryVersion;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    *majorVersion = rep.majorVersion;
+    *minorVersion = rep.minorVersion;
+    *sharedPixmaps = rep.sharedPixmaps ? True : False;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+
+int XShmPixmapFormat(Display *dpy)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xShmQueryVersionReply rep;
+    register xShmQueryVersionReq *req;
+
+    ShmCheckExtension (dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(ShmQueryVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->shmReqType = X_ShmQueryVersion;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return 0;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    if (rep.sharedPixmaps &&
+       (rep.majorVersion > 1 || rep.minorVersion > 0))
+       return rep.pixmapFormat;
+    return 0;
+}
+
+
+Status XShmAttach(Display *dpy, XShmSegmentInfo *shminfo)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xShmAttachReq *req;
+
+    ShmCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(ShmAttach, req);
+    req->reqType = info->codes->major_opcode;
+    req->shmReqType = X_ShmAttach;
+    req->shmseg = shminfo->shmseg = XAllocID(dpy);
+    req->shmid = shminfo->shmid;
+    req->readOnly = shminfo->readOnly ? xTrue : xFalse;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+
+Status XShmDetach(Display *dpy, XShmSegmentInfo *shminfo)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xShmDetachReq *req;
+
+    ShmCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(ShmDetach, req);
+    req->reqType = info->codes->major_opcode;
+    req->shmReqType = X_ShmDetach;
+    req->shmseg = shminfo->shmseg;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+static int _XShmDestroyImage (XImage *ximage)
+{
+       Xfree((char *)ximage);
+       return 1;
+}
+
+#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad) - 1)) / (pad)) * (pad))
+
+XImage *XShmCreateImage (
+    register Display *dpy,
+    register Visual *visual,
+    unsigned int depth,
+    int format,
+    char *data,
+    XShmSegmentInfo *shminfo,
+    unsigned int width,
+    unsigned int height)
+{
+    register XImage *image;
+
+    image = (XImage *)Xcalloc(1, (unsigned)sizeof(XImage));
+    if (!image)
+       return image;
+    image->data = data;
+    image->obdata = (char *)shminfo;
+    image->width = width;
+    image->height = height;
+    image->depth = depth;
+    image->format = format;
+    image->byte_order = dpy->byte_order;
+    image->bitmap_unit = dpy->bitmap_unit;
+    image->bitmap_bit_order = dpy->bitmap_bit_order;
+    image->bitmap_pad = _XGetScanlinePad(dpy, depth);
+    image->xoffset = 0;
+    if (visual) {
+       image->red_mask = visual->red_mask;
+       image->green_mask = visual->green_mask;
+       image->blue_mask = visual->blue_mask;
+    } else {
+       image->red_mask = image->green_mask = image->blue_mask = 0;
+    }
+    if (format == ZPixmap)
+       image->bits_per_pixel = _XGetBitsPerPixel(dpy, (int)depth);
+    else
+       image->bits_per_pixel = 1;
+    image->bytes_per_line = ROUNDUP((image->bits_per_pixel * width),
+                                   image->bitmap_pad) >> 3;
+    _XInitImageFuncPtrs(image);
+    image->f.destroy_image = _XShmDestroyImage;
+    return image;
+}
+
+Status XShmPutImage (
+    register Display *dpy,
+    Drawable d,
+    GC gc,
+    register XImage *image,
+    int src_x, int src_y, int dst_x, int dst_y,
+    unsigned int src_width, unsigned int src_height,
+    Bool send_event)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    XShmSegmentInfo *shminfo = (XShmSegmentInfo *)image->obdata;
+    register xShmPutImageReq *req;
+
+    ShmCheckExtension (dpy, info, 0);
+    if (!shminfo) return 0;
+
+    LockDisplay(dpy);
+    FlushGC(dpy, gc);
+    GetReq(ShmPutImage, req);
+    req->reqType = info->codes->major_opcode;
+    req->shmReqType = X_ShmPutImage;
+    req->drawable = d;
+    req->gc = gc->gid;
+    req->srcX = src_x;
+    req->srcY = src_y;
+    req->srcWidth = src_width;
+    req->srcHeight = src_height;
+    req->dstX = dst_x;
+    req->dstY = dst_y;
+    req->totalWidth = image->width;
+    req->totalHeight = image->height;
+    req->depth = image->depth;
+    req->format = image->format;
+    req->sendEvent = send_event;
+    req->shmseg = shminfo->shmseg;
+    req->offset = image->data - shminfo->shmaddr;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+
+Status XShmGetImage(
+    register Display *dpy,
+    Drawable d,
+    XImage *image,
+    int x, int y,
+    unsigned long plane_mask)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    XShmSegmentInfo *shminfo = (XShmSegmentInfo *)image->obdata;
+    register xShmGetImageReq *req;
+    xShmGetImageReply rep;
+    register Visual *visual;
+
+    ShmCheckExtension (dpy, info, 0);
+    if (!shminfo) return 0;
+
+    LockDisplay(dpy);
+    GetReq(ShmGetImage, req);
+    req->reqType = info->codes->major_opcode;
+    req->shmReqType = X_ShmGetImage;
+    req->drawable = d;
+    req->x = x;
+    req->y = y;
+    req->width = image->width;
+    req->height = image->height;
+    req->planeMask = plane_mask;
+    req->format = image->format;
+    req->shmseg = shminfo->shmseg;
+    req->offset = image->data - shminfo->shmaddr;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return 0;
+    }
+    visual = _XVIDtoVisual(dpy, rep.visual);
+    if (visual) {
+       image->red_mask = visual->red_mask;
+       image->green_mask = visual->green_mask;
+       image->blue_mask = visual->blue_mask;
+    } else {
+       image->red_mask = image->green_mask = image->blue_mask = 0;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return 1;
+}
+
+Pixmap XShmCreatePixmap (
+    register Display *dpy,
+    Drawable d,
+    char *data,
+    XShmSegmentInfo *shminfo,
+    unsigned int width, unsigned int height, unsigned int depth)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    Pixmap pid;
+    register xShmCreatePixmapReq *req;
+
+    ShmCheckExtension (dpy, info, 0);
+
+    LockDisplay(dpy);
+    GetReq(ShmCreatePixmap, req);
+    req->reqType = info->codes->major_opcode;
+    req->shmReqType = X_ShmCreatePixmap;
+    req->drawable = d;
+    req->width = width;
+    req->height = height;
+    req->depth = depth;
+    req->shmseg = shminfo->shmseg;
+    req->offset = data - shminfo->shmaddr;
+    pid = req->pid = XAllocID(dpy);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return pid;
+}
diff --git a/src/XSync.c b/src/XSync.c
new file mode 100755 (executable)
index 0000000..2bdecfc
--- /dev/null
@@ -0,0 +1,999 @@
+/*
+
+Copyright 1991, 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.
+
+*/
+
+/***********************************************************
+Copyright 1991,1993 by Digital Equipment Corporation, Maynard, Massachusetts,
+and Olivetti Research Limited, Cambridge, England.
+
+                        All Rights Reserved
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the names of Digital or Olivetti
+not be used in advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+DIGITAL AND OLIVETTI DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL THEY 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.
+
+******************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/sync.h>
+#include <X11/extensions/syncproto.h>
+
+static XExtensionInfo _sync_info_data;
+static XExtensionInfo *sync_info = &_sync_info_data;
+static char    *sync_extension_name = SYNC_NAME;
+
+#define SyncCheckExtension(dpy,i,val) \
+               XextCheckExtension(dpy, i, sync_extension_name, val)
+#define SyncSimpleCheckExtension(dpy,i) \
+               XextSimpleCheckExtension(dpy, i, sync_extension_name)
+
+static int      close_display(Display *dpy, XExtCodes *codes);
+static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire);
+static Status event_to_wire(Display *dpy, XEvent *event, xEvent *wire);
+static char    *error_string(Display *dpy, int code, XExtCodes *codes,
+                            char *buf, int n);
+
+static XExtensionHooks sync_extension_hooks = {
+    NULL,                      /* create_gc */
+    NULL,                      /* copy_gc */
+    NULL,                      /* flush_gc */
+    NULL,                      /* free_gc */
+    NULL,                      /* create_font */
+    NULL,                      /* free_font */
+    close_display,             /* close_display */
+    wire_to_event,             /* wire_to_event */
+    event_to_wire,             /* event_to_wire */
+    NULL,                      /* error */
+    error_string,              /* error_string */
+};
+
+static char    *sync_error_list[] = {
+    "BadCounter",
+    "BadAlarm",
+    "BadFence",
+};
+
+typedef struct _SyncVersionInfoRec {
+    short major;
+    short minor;
+    int num_errors;
+} SyncVersionInfo;
+
+static /* const */ SyncVersionInfo supported_versions[] = {
+    { 3 /* major */, 0 /* minor */, 2 /* num_errors */ },
+    { 3 /* major */, 1 /* minor */, 3 /* num_errors */ },
+};
+
+#define NUM_VERSIONS (sizeof(supported_versions)/sizeof(supported_versions[0]))
+#define GET_VERSION(info) ((info) ? (const SyncVersionInfo*)(info)->data : NULL)
+#define IS_VERSION_SUPPORTED(info) (!!GET_VERSION(info))
+
+static
+const SyncVersionInfo* GetVersionInfo(Display *dpy)
+{
+    xSyncInitializeReply rep;
+    xSyncInitializeReq *req;
+    XExtCodes codes;
+    int i;
+
+    if (!XQueryExtension(dpy, sync_extension_name,
+                         &codes.major_opcode,
+                         &codes.first_event,
+                         &codes.first_error))
+        return NULL;
+
+    LockDisplay(dpy);
+    GetReq(SyncInitialize, req);
+    req->reqType = codes.major_opcode;
+    req->syncReqType = X_SyncInitialize;
+    req->majorVersion = SYNC_MAJOR_VERSION;
+    req->minorVersion = SYNC_MINOR_VERSION;
+    if (!_XReply(dpy, (xReply *) & rep, 0, xTrue))
+    {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return NULL;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    for (i = 0; i < NUM_VERSIONS; i++) {
+       if (supported_versions[i].major == rep.majorVersion &&
+           supported_versions[i].minor == rep.minorVersion) {
+           return &supported_versions[i];
+       }
+    }
+
+    return NULL;
+}
+
+static
+XExtDisplayInfo *find_display_create_optional(Display *dpy, Bool create)
+{
+    XExtDisplayInfo *dpyinfo;
+
+    if (!sync_info) {
+        if (!(sync_info = XextCreateExtension())) return NULL;
+    }
+
+    if (!(dpyinfo = XextFindDisplay (sync_info, dpy)) && create) {
+        dpyinfo = XextAddDisplay(sync_info, dpy,
+                                 sync_extension_name,
+                                 &sync_extension_hooks,
+                                 XSyncNumberEvents,
+                                 (XPointer)GetVersionInfo(dpy));
+    }
+
+    return dpyinfo;
+}
+
+static
+XExtDisplayInfo *find_display (Display *dpy)
+{
+    return find_display_create_optional(dpy, True);
+}
+
+static
+XEXT_GENERATE_CLOSE_DISPLAY(close_display, sync_info)
+
+static
+char *error_string(Display *dpy, int code, XExtCodes *codes, char *buf, int n)
+{
+    XExtDisplayInfo *info = find_display_create_optional(dpy, False);
+    int nerr = IS_VERSION_SUPPORTED(info) ? GET_VERSION(info)->num_errors : 0;
+
+    code -= codes->first_error;
+    if (code >= 0 && code < nerr) {
+       char tmp[256];
+       sprintf (tmp, "%s.%d", sync_extension_name, code);
+       XGetErrorDatabaseText (dpy, "XProtoError", tmp, sync_error_list[code], buf, n);
+       return buf;
+    }
+    return (char *)0;
+}
+
+static Bool
+wire_to_event(Display *dpy, XEvent *event, xEvent *wire)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    XSyncCounterNotifyEvent *aevent;
+    xSyncCounterNotifyEvent *awire;
+    XSyncAlarmNotifyEvent *anl;
+    xSyncAlarmNotifyEvent *ane;
+
+    SyncCheckExtension(dpy, info, False);
+
+    switch ((wire->u.u.type & 0x7F) - info->codes->first_event)
+    {
+      case XSyncCounterNotify:
+       awire = (xSyncCounterNotifyEvent *) wire;
+       aevent = (XSyncCounterNotifyEvent *) event;
+       aevent->type = awire->type & 0x7F;
+       aevent->serial = _XSetLastRequestRead(dpy,
+                                             (xGenericReply *) wire);
+       aevent->send_event = (awire->type & 0x80) != 0;
+       aevent->display = dpy;
+       aevent->counter = awire->counter;
+       XSyncIntsToValue(&aevent->wait_value, awire->wait_value_lo,
+                                   awire->wait_value_hi);
+       XSyncIntsToValue(&aevent->counter_value,
+                                   awire->counter_value_lo,
+                                   awire->counter_value_hi);
+       aevent->time = awire->time;
+       aevent->count = awire->count;
+       aevent->destroyed = awire->destroyed;
+       return True;
+
+      case XSyncAlarmNotify:
+       ane = (xSyncAlarmNotifyEvent *) wire;   /* ENCODING EVENT PTR */
+       anl = (XSyncAlarmNotifyEvent *) event;  /* LIBRARY EVENT PTR */
+       anl->type = ane->type & 0x7F;
+       anl->serial = _XSetLastRequestRead(dpy,
+                                          (xGenericReply *) wire);
+       anl->send_event = (ane->type & 0x80) != 0;
+       anl->display = dpy;
+       anl->alarm = ane->alarm;
+       XSyncIntsToValue(&anl->counter_value,
+                                   ane->counter_value_lo,
+                                   ane->counter_value_hi);
+       XSyncIntsToValue(&anl->alarm_value,
+                                   ane->alarm_value_lo,
+                                   ane->alarm_value_hi);
+       anl->state = (XSyncAlarmState)ane->state;
+       anl->time = ane->time;
+       return True;
+    }
+
+    return False;
+}
+
+static Status
+event_to_wire(Display *dpy, XEvent *event, xEvent *wire)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    XSyncCounterNotifyEvent *aevent;
+    xSyncCounterNotifyEvent *awire;
+    XSyncAlarmNotifyEvent *anl;
+    xSyncAlarmNotifyEvent *ane;
+
+    SyncCheckExtension(dpy, info, False);
+
+    switch ((event->type & 0x7F) - info->codes->first_event)
+    {
+      case XSyncCounterNotify:
+       awire = (xSyncCounterNotifyEvent *) wire;
+       aevent = (XSyncCounterNotifyEvent *) event;
+       awire->type = aevent->type | (aevent->send_event ? 0x80 : 0);
+       awire->sequenceNumber = aevent->serial & 0xFFFF;
+       awire->counter = aevent->counter;
+       awire->wait_value_lo = XSyncValueLow32(aevent->wait_value);
+       awire->wait_value_hi = XSyncValueHigh32(aevent->wait_value);
+       awire->counter_value_lo = XSyncValueLow32(aevent->counter_value);
+       awire->counter_value_hi = XSyncValueHigh32(aevent->counter_value);
+       awire->time = aevent->time;
+       awire->count = aevent->count;
+       awire->destroyed = aevent->destroyed;
+       return True;
+
+      case XSyncAlarmNotify:
+       ane = (xSyncAlarmNotifyEvent *) wire;   /* ENCODING EVENT PTR */
+       anl = (XSyncAlarmNotifyEvent *) event;  /* LIBRARY EVENT PTR */
+       ane->type = anl->type | (anl->send_event ? 0x80 : 0);
+       ane->sequenceNumber = anl->serial & 0xFFFF;
+       ane->alarm = anl->alarm;
+       ane->counter_value_lo = XSyncValueLow32(anl->counter_value);
+       ane->counter_value_hi = XSyncValueHigh32(anl->counter_value);
+       ane->alarm_value_lo = XSyncValueLow32(anl->alarm_value);
+       ane->alarm_value_hi = XSyncValueHigh32(anl->alarm_value);
+       ane->state = anl->state;
+       ane->time = anl->time;
+       return True;
+    }
+    return False;
+}
+
+Status
+XSyncQueryExtension(
+    Display *dpy,
+    int *event_base_return, int *error_base_return)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+
+    if (XextHasExtension(info))
+    {
+       *event_base_return = info->codes->first_event;
+       *error_base_return = info->codes->first_error;
+       return True;
+    }
+    else
+       return False;
+}
+
+Status
+XSyncInitialize(
+    Display *dpy,
+    int *major_version_return, int *minor_version_return)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+
+    SyncCheckExtension(dpy, info, False);
+
+    if (IS_VERSION_SUPPORTED(info)) {
+       *major_version_return = GET_VERSION(info)->major;
+       *minor_version_return = GET_VERSION(info)->minor;
+
+       return True;
+    } else {
+       return False;
+    }
+}
+
+XSyncSystemCounter *
+XSyncListSystemCounters(Display *dpy, int *n_counters_return)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncListSystemCountersReply rep;
+    xSyncListSystemCountersReq *req;
+    XSyncSystemCounter *list = NULL;
+
+    SyncCheckExtension(dpy, info, NULL);
+
+    LockDisplay(dpy);
+    GetReq(SyncListSystemCounters, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncListSystemCounters;
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
+       goto bail;
+
+    *n_counters_return = rep.nCounters;
+    if (rep.nCounters > 0)
+    {
+       xSyncSystemCounter *pWireSysCounter, *pNextWireSysCounter;
+       XSyncCounter counter;
+       int replylen;
+       int i;
+
+       list = Xmalloc(rep.nCounters * sizeof(XSyncSystemCounter));
+       replylen = rep.length << 2;
+       pWireSysCounter = Xmalloc ((unsigned) replylen + sizeof(XSyncCounter));
+        /* +1 to leave room for last counter read-ahead */
+
+       if ((!list) || (!pWireSysCounter))
+       {
+           if (list) Xfree((char *) list);
+           if (pWireSysCounter)   Xfree((char *) pWireSysCounter);
+           _XEatData(dpy, (unsigned long) replylen);
+           list = NULL;
+           goto bail;
+       }
+
+       _XReadPad(dpy, (char *)pWireSysCounter, replylen);
+
+       counter = pWireSysCounter->counter;
+       for (i = 0; i < rep.nCounters; i++)
+       {
+           list[i].counter = counter;
+           XSyncIntsToValue(&list[i].resolution,
+                                       pWireSysCounter->resolution_lo,
+                                       pWireSysCounter->resolution_hi);
+
+           /* we may be about to clobber the counter field of the
+            * next syscounter because we have to add a null terminator
+            * to the counter name string.  So we save the next counter
+            * here.
+            */
+           pNextWireSysCounter = (xSyncSystemCounter *)
+               (((char *)pWireSysCounter) + ((SIZEOF(xSyncSystemCounter) +
+                                    pWireSysCounter->name_length + 3) & ~3));
+           counter = pNextWireSysCounter->counter;
+
+           list[i].name = ((char *)pWireSysCounter) +
+                                               SIZEOF(xSyncSystemCounter);
+           /* null-terminate the string */
+           *(list[i].name + pWireSysCounter->name_length) = '\0';
+           pWireSysCounter = pNextWireSysCounter;
+       }
+    }
+
+bail:
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return list;
+}
+
+void
+XSyncFreeSystemCounterList(XSyncSystemCounter *list)
+{
+    if (list)
+    {
+       Xfree( ((char *)list[0].name) - SIZEOF(xSyncSystemCounter));
+       Xfree(list);
+    }
+}
+
+
+XSyncCounter 
+XSyncCreateCounter(Display *dpy, XSyncValue initial_value)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncCreateCounterReq *req;
+
+    SyncCheckExtension(dpy, info, None);
+
+    LockDisplay(dpy);
+    GetReq(SyncCreateCounter, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncCreateCounter;
+
+    req->cid = XAllocID(dpy);
+    req->initial_value_lo = XSyncValueLow32(initial_value);
+    req->initial_value_hi = XSyncValueHigh32(initial_value);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return req->cid;
+}
+
+Status
+XSyncSetCounter(Display *dpy, XSyncCounter counter, XSyncValue value)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncSetCounterReq *req;
+
+    SyncCheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(SyncSetCounter, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncSetCounter;
+    req->cid = counter;
+    req->value_lo = XSyncValueLow32(value);
+    req->value_hi = XSyncValueHigh32(value);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Status
+XSyncChangeCounter(Display *dpy, XSyncCounter counter, XSyncValue value)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncChangeCounterReq *req;
+
+    SyncCheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(SyncChangeCounter, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncChangeCounter;
+    req->cid = counter;
+    req->value_lo = XSyncValueLow32(value);
+    req->value_hi = XSyncValueHigh32(value);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Status
+XSyncDestroyCounter(Display *dpy, XSyncCounter counter)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncDestroyCounterReq *req;
+
+    SyncCheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(SyncDestroyCounter, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncDestroyCounter;
+    req->counter = counter;
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return True;
+}
+
+Status
+XSyncQueryCounter(Display *dpy, XSyncCounter counter, XSyncValue *value_return)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncQueryCounterReply rep;
+    xSyncQueryCounterReq *req;
+
+    SyncCheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(SyncQueryCounter, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncQueryCounter;
+    req->counter = counter;
+    if (!_XReply(dpy, (xReply *) & rep, 0, xTrue))
+    {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    XSyncIntsToValue(value_return, rep.value_lo, rep.value_hi);
+    UnlockDisplay(dpy);
+    SyncHandle();
+
+    return True;
+}
+
+
+Status
+XSyncAwait(Display *dpy, XSyncWaitCondition *wait_list, int n_conditions)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    XSyncWaitCondition *wait_item = wait_list;
+    xSyncAwaitReq  *req;
+    unsigned int    len;
+
+    SyncCheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(SyncAwait, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncAwait;
+    len = (n_conditions * SIZEOF(xSyncWaitCondition)) >> 2;
+    SetReqLen(req, len, len /* XXX */ );
+
+    while (n_conditions--)
+    {
+       xSyncWaitCondition  wc;
+       wc.counter = wait_item->trigger.counter;
+       wc.value_type = wait_item->trigger.value_type;
+       wc.wait_value_lo = XSyncValueLow32(wait_item->trigger.wait_value);
+       wc.wait_value_hi = XSyncValueHigh32(wait_item->trigger.wait_value);
+       wc.test_type = wait_item->trigger.test_type;
+       wc.event_threshold_lo = XSyncValueLow32(wait_item->event_threshold);
+       wc.event_threshold_hi = XSyncValueHigh32(wait_item->event_threshold);
+       Data(dpy, (char *)&wc, SIZEOF(xSyncWaitCondition));
+       wait_item++;            /* get next trigger */
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+static void
+_XProcessAlarmAttributes(Display *dpy, xSyncChangeAlarmReq *req,
+                        unsigned long valuemask,
+                        XSyncAlarmAttributes *attributes)
+{
+
+    unsigned long  values[32];
+    unsigned long *value = values;
+    unsigned int    nvalues;
+
+    if (valuemask & XSyncCACounter)
+       *value++ = attributes->trigger.counter;
+
+    if (valuemask & XSyncCAValueType)
+       *value++ = attributes->trigger.value_type;
+
+    if (valuemask & XSyncCAValue)
+    {
+       *value++ = XSyncValueHigh32(attributes->trigger.wait_value);
+       *value++ = XSyncValueLow32(attributes->trigger.wait_value);
+    }
+
+    if (valuemask & XSyncCATestType)
+       *value++ = attributes->trigger.test_type;
+
+    if (valuemask & XSyncCADelta)
+    {
+       *value++ = XSyncValueHigh32(attributes->delta);
+       *value++ = XSyncValueLow32(attributes->delta);
+    }
+
+    if (valuemask & XSyncCAEvents)
+       *value++ = attributes->events;
+
+    /* N.B. the 'state' field cannot be set or changed */
+    req->length += (nvalues = value - values);
+    nvalues <<= 2;             /* watch out for macros... */
+
+    Data32(dpy, (long *) values, (long) nvalues);
+}
+
+XSyncAlarm
+XSyncCreateAlarm(
+    Display *dpy,
+    unsigned long values_mask,
+    XSyncAlarmAttributes *values)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncCreateAlarmReq *req;
+    XSyncAlarm      aid;
+
+    SyncCheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(SyncCreateAlarm, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncCreateAlarm;
+    req->id = aid = XAllocID(dpy);
+    values_mask &= XSyncCACounter | XSyncCAValueType | XSyncCAValue
+                       | XSyncCATestType | XSyncCADelta | XSyncCAEvents;
+    if ((req->valueMask = values_mask))
+       _XProcessAlarmAttributes(dpy, (xSyncChangeAlarmReq *) req,
+                                values_mask, values);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return aid;
+}
+
+Status
+XSyncDestroyAlarm(Display *dpy, XSyncAlarm alarm)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncDestroyAlarmReq *req;
+
+    SyncCheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(SyncDestroyAlarm, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncDestroyAlarm;
+    req->alarm = alarm;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Status
+XSyncQueryAlarm(
+    Display *dpy,
+    XSyncAlarm alarm,
+    XSyncAlarmAttributes *values_return)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncQueryAlarmReq *req;
+    xSyncQueryAlarmReply rep;
+
+    SyncCheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(SyncQueryAlarm, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncQueryAlarm;
+    req->alarm = alarm;
+
+    if (!(_XReply(dpy, (xReply *) & rep,
+    ((SIZEOF(xSyncQueryAlarmReply) - SIZEOF(xGenericReply)) >> 2), xFalse)))
+    {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+
+    values_return->trigger.counter = rep.counter;
+    values_return->trigger.value_type = (XSyncValueType)rep.value_type;
+    XSyncIntsToValue(&values_return->trigger.wait_value,
+                               rep.wait_value_lo, rep.wait_value_hi);
+    values_return->trigger.test_type = (XSyncTestType)rep.test_type;
+    XSyncIntsToValue(&values_return->delta, rep.delta_lo,
+                               rep.delta_hi);
+    values_return->events = rep.events;
+    values_return->state = (XSyncAlarmState)rep.state;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Status
+XSyncChangeAlarm(
+    Display *dpy,
+    XSyncAlarm alarm,
+    unsigned long values_mask,
+    XSyncAlarmAttributes *values)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncChangeAlarmReq *req;
+
+    SyncCheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(SyncChangeAlarm, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncChangeAlarm;
+    req->alarm = alarm;
+    values_mask &= XSyncCACounter | XSyncCAValueType | XSyncCAValue
+                | XSyncCATestType | XSyncCADelta | XSyncCAEvents;
+    if ((req->valueMask = values_mask))
+       _XProcessAlarmAttributes(dpy, req, values_mask, values);
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Status
+XSyncSetPriority(
+    Display *dpy,
+    XID client_resource_id,
+    int priority)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncSetPriorityReq *req;
+
+    SyncCheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(SyncSetPriority, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncSetPriority;
+    req->id = client_resource_id;
+    req->priority = priority;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Status
+XSyncGetPriority(Display *dpy, XID client_resource_id, int *return_priority)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncGetPriorityReply rep;
+    xSyncGetPriorityReq *req;
+
+    SyncCheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(SyncGetPriority, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncGetPriority;
+    req->id = client_resource_id;
+
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
+    {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    if (return_priority)
+       *return_priority = rep.priority;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+XSyncFence
+XSyncCreateFence(Display *dpy, Drawable d, Bool initially_triggered)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncCreateFenceReq *req;
+    XSyncFence id;
+
+    SyncCheckExtension(dpy, info, None);
+
+    LockDisplay(dpy);
+    GetReq(SyncCreateFence, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncCreateFence;
+
+    req->d = d;
+    id = req->fid = XAllocID(dpy);
+    req->initially_triggered = initially_triggered;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return id;
+}
+
+Bool
+XSyncTriggerFence(Display *dpy, XSyncFence fence)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncTriggerFenceReq *req;
+
+    SyncCheckExtension(dpy, info, None);
+
+    LockDisplay(dpy);
+    GetReq(SyncTriggerFence, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncTriggerFence;
+
+    req->fid = fence;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Bool
+XSyncResetFence(Display *dpy, XSyncFence fence)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncResetFenceReq *req;
+
+    SyncCheckExtension(dpy, info, None);
+
+    LockDisplay(dpy);
+    GetReq(SyncResetFence, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncResetFence;
+
+    req->fid = fence;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Bool
+XSyncDestroyFence(Display *dpy, XSyncFence fence)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncDestroyFenceReq *req;
+
+    SyncCheckExtension(dpy, info, None);
+
+    LockDisplay(dpy);
+    GetReq(SyncDestroyFence, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncDestroyFence;
+
+    req->fid = fence;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Bool
+XSyncQueryFence(Display *dpy, XSyncFence fence, Bool *triggered)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncQueryFenceReply rep;
+    xSyncQueryFenceReq *req;
+
+    SyncCheckExtension(dpy, info, None);
+
+    LockDisplay(dpy);
+    GetReq(SyncQueryFence, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncQueryFence;
+    req->fid = fence;
+
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse))
+    {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    if (triggered)
+       *triggered = rep.triggered;
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+Bool
+XSyncAwaitFence(Display *dpy, const XSyncFence *fence_list, int n_fences)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xSyncAwaitFenceReq  *req;
+
+    SyncCheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(SyncAwaitFence, req);
+    req->reqType = info->codes->major_opcode;
+    req->syncReqType = X_SyncAwaitFence;
+    SetReqLen(req, n_fences, n_fences);
+
+    Data32(dpy, (char *)fence_list, sizeof(CARD32) * n_fences);
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+/*
+ *  Functions corresponding to the macros for manipulating 64-bit values
+ */
+
+void
+XSyncIntToValue(XSyncValue *pv, int i)
+{
+    _XSyncIntToValue(pv,i);
+}
+
+void
+XSyncIntsToValue(XSyncValue *pv, unsigned int l, int h)
+{
+    _XSyncIntsToValue(pv, l, h);
+}
+
+Bool
+XSyncValueGreaterThan(XSyncValue a, XSyncValue b)
+{
+    return _XSyncValueGreaterThan(a, b);
+}
+
+Bool
+XSyncValueLessThan(XSyncValue a, XSyncValue b)
+{
+    return _XSyncValueLessThan(a, b);
+}
+
+Bool
+XSyncValueGreaterOrEqual(XSyncValue a, XSyncValue b)
+{
+    return _XSyncValueGreaterOrEqual(a, b);
+}
+
+Bool
+XSyncValueLessOrEqual(XSyncValue a, XSyncValue b)
+{
+    return _XSyncValueLessOrEqual(a, b);
+}
+
+Bool
+XSyncValueEqual(XSyncValue a, XSyncValue b)
+{
+    return _XSyncValueEqual(a, b);
+}
+
+Bool
+XSyncValueIsNegative(XSyncValue v)
+{
+    return _XSyncValueIsNegative(v);
+}
+
+Bool
+XSyncValueIsZero(XSyncValue a)
+{
+    return _XSyncValueIsZero(a);
+}
+
+Bool
+XSyncValueIsPositive(XSyncValue v)
+{
+    return _XSyncValueIsPositive(v);
+}
+
+unsigned int
+XSyncValueLow32(XSyncValue v)
+{
+    return _XSyncValueLow32(v);
+}
+
+int
+XSyncValueHigh32(XSyncValue v)
+{
+    return _XSyncValueHigh32(v);
+}
+
+void
+XSyncValueAdd(XSyncValue *presult, XSyncValue a, XSyncValue b, Bool *poverflow)
+{
+    _XSyncValueAdd(presult, a, b, poverflow);
+}
+
+void
+XSyncValueSubtract(
+    XSyncValue *presult,
+    XSyncValue a, XSyncValue b,
+    Bool *poverflow)
+{
+    _XSyncValueSubtract(presult, a, b, poverflow);
+}
+
+void
+XSyncMaxValue(XSyncValue *pv)
+{
+    _XSyncMaxValue(pv);
+}
+
+void
+XSyncMinValue(XSyncValue *pv)
+{
+    _XSyncMinValue(pv);
+}
diff --git a/src/XTestExt1.c b/src/XTestExt1.c
new file mode 100755 (executable)
index 0000000..c12c223
--- /dev/null
@@ -0,0 +1,1317 @@
+/*
+ *     File:  xtestext1lib.c
+ *
+ *     This file contains the Xlib parts of the input synthesis extension
+ */
+
+/*
+
+
+Copyright 1986, 1987, 1988, 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 1986, 1987, 1988 by Hewlett-Packard Corporation
+
+Permission to use, copy, modify, and distribute this
+software and its documentation for any purpose and without
+fee is hereby granted, provided that the above copyright
+notice appear in all copies and that both that copyright
+notice and this permission notice appear in supporting
+documentation, and that the name of Hewlett-Packard not be used in
+advertising or publicity pertaining to distribution of the
+software without specific, written prior permission.
+
+Hewlett-Packard makes no representations about the 
+suitability of this software for any purpose.  It is provided 
+"as is" without express or implied warranty.
+
+This software is not subject to any license of the American
+Telephone and Telegraph Company or of the Regents of the
+University of California.
+
+*/
+
+/******************************************************************************
+ * include files
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xproto.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/xtestext1.h>
+#include <X11/extensions/xtestext1proto.h>
+
+/******************************************************************************
+ * variables
+ *****************************************************************************/
+
+/*
+ * Holds the request type code for this extension.  The request type code
+ * for this extension may vary depending on how many extensions are installed
+ * already, so the initial value given below will be added to the base request
+ * code that is acquired when this extension is installed.
+ */
+static int             XTestReqCode = 0;
+/*
+ * Holds the two event type codes for this extension.  The event type codes
+ * for this extension may vary depending on how many extensions are installed
+ * already, so the initial values given below will be added to the base event
+ * code that is acquired when this extension is installed.
+ *
+ * These two variables must be available to programs that use this extension.
+ */
+int                    XTestInputActionType = 0;
+int                    XTestFakeAckType   = 1;
+/*
+ * holds the current x and y coordinates for XTestMovePointer
+ */
+static int     current_x = 0;
+static int     current_y = 0;
+/*
+ * Holds input actions being accumulated until the input action buffer is
+ * full or until XTestFlush is called.
+ */
+static CARD8           action_buf[XTestMAX_ACTION_LIST_SIZE];
+/*
+ * the index into the input action buffer
+ */
+static int             action_index = 0;
+/*
+ * the number of input actions that the server can handle at one time
+ */
+static unsigned long   action_array_size = 0;
+/*
+ * the current number of input actions
+ */
+static unsigned long   action_count = 0;
+
+/******************************************************************************
+ * function declarations
+ *****************************************************************************/
+
+static int     XTestWireToEvent(Display *dpy, XEvent *reTemp, xEvent *eventTemp);
+static int     XTestCheckExtInit(register Display *dpy);
+static Bool    XTestIdentifyMyEvent(Display *display, XEvent *event_ptr, char *args);
+static int     XTestInitExtension(register Display *dpy);
+static int     XTestKeyOrButton(Display *display, int device_id, long unsigned int delay, unsigned int code, unsigned int action);
+static int     XTestCheckDelay(Display *display, long unsigned int *delay_addr);
+static int     XTestPackInputAction(Display *display, CARD8 *action_addr, int action_size);
+static int     XTestWriteInputActions(Display *display, char *action_list_addr, int action_list_size, int ack_flag);
+
+/******************************************************************************
+ *
+ *     XTestFakeInput
+ *
+ *     Send a a request containing one or more input actions to be sent
+ *     to the server by this extension.
+ */
+int
+XTestFakeInput(
+/*
+ * the connection to the X server
+ */
+register Display       *dpy,
+/*
+ * the address of a list of input actions to be sent to the server
+ */
+char                   *action_list_addr,
+/*
+ * the size (in bytes) of the list of input actions
+ */
+int                    action_list_size,
+/*
+ * specifies whether the server needs to send an event to indicate that its
+ * input action buffer is empty
+ */
+int                    ack_flag)
+{      
+       /*
+        * pointer to xTestFakeInputReq structure
+        */
+       xTestFakeInputReq       *req;
+       /*
+        * loop index
+        */
+       int                     i;
+
+       LockDisplay(dpy);
+       if ((XTestCheckExtInit(dpy) == -1) ||
+           (action_list_size > XTestMAX_ACTION_LIST_SIZE))
+       {
+               /*
+                * if the extension is not installed in the server or the 
+                * action list will not fit in the request, then unlock
+                * the display and return -1.
+                */
+               UnlockDisplay(dpy);
+               return(-1);
+       }
+       else
+       {
+               /*
+                * Get the next available X request packet in the buffer.
+                * It sets the `length' field to the size (in 32-bit words)
+                * of the request.  It also sets the `reqType' field in the
+                * request to X_TestFakeInput, which is not what is needed.
+                *
+                * GetReq is a macro defined in Xlibint.h.
+                */
+               GetReq(TestFakeInput, req);             
+               /*
+                * fix up the request type code to what is needed
+                */
+               req->reqType = XTestReqCode;
+               /*
+                * set the minor request type code to X_TestFakeInput
+                */
+               req->XTestReqType = X_TestFakeInput;
+               /*
+                * set the ack code
+                */
+               req->ack = ack_flag;
+               /*
+                * Set the action_list area to all 0's. An input action header
+                * value of 0 is interpreted as a flag to the input action
+                * list handling code in the server part of this extension
+                * that there are no more input actions in this request.
+                */
+               for (i = 0; i < XTestMAX_ACTION_LIST_SIZE; i++)
+               {
+                       req->action_list[i] = 0;
+               }
+               /*
+                * copy the input actions into the request
+                */
+               for (i = 0; i < action_list_size; i++)
+               {
+                       req->action_list[i] = *(action_list_addr++);
+               }
+               UnlockDisplay(dpy);
+               SyncHandle();
+               return(0);
+       }
+}
+
+/******************************************************************************
+ *
+ *     XTestGetInput
+ *
+ *     Request the server to begin putting user input actions into events
+ *     to be sent to the client that called this function.
+ */
+int
+XTestGetInput(
+/*
+ * the connection to the X server
+ */
+register Display       *dpy,
+/*
+ * tells the server what to do with the user input actions
+ */
+int                    action_handling)
+{      
+       /*
+        * pointer to xTestGetInputReq structure
+        */
+       xTestGetInputReq        *req;
+
+       LockDisplay(dpy);
+       if (XTestCheckExtInit(dpy) == -1)
+       {
+               /*
+                * if the extension is not installed in the server
+                * then unlock the display and return -1.
+                */
+               UnlockDisplay(dpy);
+               return(-1);
+       }
+       else
+       {
+               /*
+                * Get the next available X request packet in the buffer.
+                * It sets the `length' field to the size (in 32-bit words)
+                * of the request.  It also sets the `reqType' field in the
+                * request to X_TestGetInput, which is not what is needed.
+                *
+                * GetReq is a macro defined in Xlibint.h.
+                */
+               GetReq(TestGetInput, req);              
+               /*
+                * fix up the request type code to what is needed
+                */
+               req->reqType = XTestReqCode;
+               /*
+                * set the minor request type code to X_TestGetInput
+                */
+               req->XTestReqType = X_TestGetInput;
+               /*
+                * set the action handling mode
+                */
+               req->mode = action_handling;
+               UnlockDisplay(dpy);
+               SyncHandle();
+               return(0);
+       }
+}
+
+/******************************************************************************
+ *
+ *     XTestStopInput
+ *
+ *     Tell the server to stop putting information about user input actions
+ *     into events.
+ */
+int
+XTestStopInput(
+/*
+ * the connection to the X server
+ */
+register Display       *dpy)
+{      
+       /*
+        * pointer to xTestStopInputReq structure
+        */
+       xTestStopInputReq       *req;
+
+       LockDisplay(dpy);
+       if (XTestCheckExtInit(dpy) == -1)
+       {
+               /*
+                * if the extension is not installed in the server
+                * then unlock the display and return -1.
+                */
+               UnlockDisplay(dpy);
+               return(-1);
+       }
+       else
+       {
+               /*
+                * Get the next available X request packet in the buffer.
+                * It sets the `length' field to the size (in 32-bit words)
+                * of the request.  It also sets the `reqType' field in the
+                * request to X_TestStopInput, which is not what is needed.
+                *
+                * GetReq is a macro defined in Xlibint.h.
+                */
+               GetReq(TestStopInput, req);             
+               /*
+                * fix up the request type code to what is needed
+                */
+               req->reqType = XTestReqCode;
+               /*
+                * set the minor request type code to X_TestStopInput
+                */
+               req->XTestReqType = X_TestStopInput;
+               UnlockDisplay(dpy);
+               SyncHandle();
+               return(0);
+       }
+}
+
+/******************************************************************************
+ *
+ *     XTestReset
+ *
+ *     Tell the server to set everything having to do with this extension
+ *     back to its initial state.
+ */
+int
+XTestReset(
+/*
+ * the connection to the X server
+ */
+register Display       *dpy)
+{      
+       /*
+        * pointer to xTestReset structure
+        */
+       xTestResetReq   *req;
+
+       LockDisplay(dpy);
+       if (XTestCheckExtInit(dpy) == -1)
+       {
+               /*
+                * if the extension is not installed in the server
+                * then unlock the display and return -1.
+                */
+               UnlockDisplay(dpy);
+               return(-1);
+       }
+       else
+       {
+               /*
+                * Get the next available X request packet in the buffer.
+                * It sets the `length' field to the size (in 32-bit words)
+                * of the request.  It also sets the `reqType' field in the
+                * request to X_TestReset, which is not what is needed.
+                *
+                * GetReq is a macro defined in Xlibint.h.
+                */
+               GetReq(TestReset, req);         
+               /*
+                * fix up the request type code to what is needed
+                */
+               req->reqType = XTestReqCode;
+               /*
+                * set the minor request type code to X_TestReset
+                */
+               req->XTestReqType = X_TestReset;
+               UnlockDisplay(dpy);
+               SyncHandle();
+               return(0);
+       }
+}
+
+/******************************************************************************
+ *
+ *     XTestQueryInputSize
+ *
+ *     Returns the number of input actions in the server's input action buffer.
+ */
+int
+XTestQueryInputSize(
+/*
+ * the connection to the X server
+ */
+register Display       *dpy,
+/*
+ * the address of the place to put the number of input actions in the
+ * server's input action buffer
+ */
+unsigned long          *size_return)
+{      
+       /*
+        * pointer to xTestQueryInputSize structure
+        */
+       xTestQueryInputSizeReq          *req;
+       /*
+        * pointer to xTestQueryInputSize structure
+        */
+       xTestQueryInputSizeReply        rep;
+
+       LockDisplay(dpy);
+       if (XTestCheckExtInit(dpy) == -1)
+       {
+               /*
+                * if the extension is not installed in the server
+                * then unlock the display and return -1.
+                */
+               UnlockDisplay(dpy);
+               return(-1);
+       }
+       else
+       {
+               /*
+                * Get the next available X request packet in the buffer.
+                * It sets the `length' field to the size (in 32-bit words)
+                * of the request.  It also sets the `reqType' field in the
+                * request to X_TestQueryInputSize, which is not what is needed.
+                *
+                * GetReq is a macro defined in Xlibint.h.
+                */
+               GetReq(TestQueryInputSize, req);                
+               /*
+                * fix up the request type code to what is needed
+                */
+               req->reqType = XTestReqCode;
+               /*
+                * set the minor request type code to X_TestQueryInputSize
+                */
+               req->XTestReqType = X_TestQueryInputSize;
+               /*
+                * get a reply from the server
+                */
+               (void) _XReply (dpy, (xReply *) &rep, 0, xTrue);
+               /*
+                * put the size in the caller's variable
+                */
+               *size_return = (unsigned long) rep.size_return;
+               UnlockDisplay(dpy);
+               SyncHandle();
+               return(0);
+       }
+}
+
+/******************************************************************************
+ *
+ *     XTestCheckExtInit
+ *
+ *     Check to see if the XTest extension is installed in the server.
+ */
+static int
+XTestCheckExtInit(
+/*
+ * the connection to the X server
+ */
+register Display       *dpy)
+{
+       /*
+        * if the extension has not been initialized, then do so
+        */
+       if (!XTestReqCode) 
+       {
+               return(XTestInitExtension(dpy));
+       }
+       return(0);
+}
+
+/******************************************************************************
+ *
+ *     XTestInitExtension
+ *
+ *     Attempt to initialize this extension in the server.  Return 0 if it
+ *     succeeds, -1 if it does not succeed.
+ */
+static int
+XTestInitExtension(
+/*
+ * the connection to the X server
+ */
+register Display       *dpy)
+{
+       /*
+        * loop index
+        */
+       int                     i;
+       /*
+        * return value from XInitExtension
+        */
+       XExtCodes               *ret;
+
+       /*
+        * attempt to initialize the extension
+        */
+       ret = XInitExtension(dpy, XTestEXTENSION_NAME);
+       /*
+        * if the initialize failed, return -1
+        */
+       if (ret == NULL)
+       {
+               return (-1);
+       }
+       /*
+        * the initialize succeeded, remember the major opcode
+        * for this extension
+        */
+       XTestReqCode = ret->major_opcode;
+       /*
+        * set up the event handler for any events from 
+        * this extension
+        */
+       for (i = 0; i < XTestEVENT_COUNT; i++)
+       {
+               XESetWireToEvent(dpy,
+                                ret->first_event+i,
+                                XTestWireToEvent);
+       }
+       /*
+        * compute the event type codes for the events
+        * in this extension
+        */
+       XTestInputActionType += ret->first_event;
+       XTestFakeAckType += ret->first_event;
+       /*
+        * everything worked ok
+        */
+       return(0);
+}
+
+/******************************************************************************
+ *
+ *     XTestWireToEvent
+ *
+ *     Handle XTest extension events.
+ *     Reformat a wire event into an XEvent structure of the right type.
+ */
+static Bool
+XTestWireToEvent(
+/*
+ * the connection to the X server
+ */
+Display        *dpy,
+/*
+ * a pointer to where a host formatted event should be stored
+ * with the information copied to it
+ */
+XEvent *reTemp,
+/*
+ * a pointer to the wire event
+ */
+xEvent *eventTemp)
+{
+       XTestInputActionEvent *re    = (XTestInputActionEvent *) reTemp;
+       xTestInputActionEvent *event = (xTestInputActionEvent *) eventTemp;
+
+       /*
+        * loop index
+        */
+       int     i;
+       /*
+        * pointer to where the input actions go in the host format event
+        */
+       CARD8   *to;
+       /*
+        * pointer to the input actions in the wire event
+        */
+       CARD8   *from;
+
+       /*
+        * Copy the type of the wire event to the new event.
+        * This will work for either event type because the type,
+        * display, and window fields in the events have to be the same.
+        */
+       re->type = event->type;
+       /*
+        * set the display parameter in case it is needed (by who?)
+        */
+       re->display = dpy;
+       if (re->type == XTestInputActionType)
+       {
+               /*
+                * point at the first byte of input actions in the wire event
+                */
+               from = &(event->actions[0]);
+               /*
+                * point at where the input action bytes go in the new event
+                */
+               to = &(re->actions[0]);
+               /*
+                * copy the input action bytes from the wire event to
+                * the new event
+                */
+               for (i = 0; i < XTestACTIONS_SIZE; i++)
+               {
+                       *(to++) = *(from++);
+               }
+       }
+       else if (re->type == XTestFakeAckType)
+       {
+               /*
+                * nothing else needs to be done
+                */
+       }
+       else
+       {
+               printf("XTestWireToEvent: UNKNOWN WIRE EVENT! type=%d\n",
+                       (int) event->type);
+               printf("%s is giving up.\n", XTestEXTENSION_NAME);
+               exit (1);
+       }
+       return 1;
+}
+
+/******************************************************************************
+ *
+ *     XTestPressKey
+ *
+ *     Send input actions to the server to cause the server to think
+ *     that the specified key on the keyboard was moved as specified.
+ */
+int
+XTestPressKey(
+Display                *display,
+int            device_id,
+unsigned long  delay,
+unsigned int   keycode,
+unsigned int   key_action)
+{
+       /*
+        * bounds check the key code
+        */
+       if (keycode < 8 || keycode > 255)
+       {
+               return(-1);
+       }
+       /*
+        * use the commmon key/button handling routine
+        */
+       return(XTestKeyOrButton(display,
+                               device_id,
+                               delay,
+                               keycode,
+                               key_action));
+}
+
+/******************************************************************************
+ *
+ *     XTestPressButton
+ *
+ *     Send input actions to the server to cause the server to think
+ *     that the specified button on the mouse was moved as specified.
+ */
+int
+XTestPressButton(
+Display                *display,
+int            device_id,
+unsigned long  delay,
+unsigned int   button_number,
+unsigned int   button_action)
+{
+       /*
+        * bounds check the button number
+        */
+       if (button_number > 7)
+       {
+               return(-1);
+       }
+       /*
+        * use the commmon key/button handling routine
+        */
+       return(XTestKeyOrButton(display,
+                               device_id,
+                               delay,
+                               button_number,
+                               button_action));
+}
+
+/******************************************************************************
+ *
+ *     XTestKeyOrButton
+ *
+ *     Send input actions to the server to cause the server to think
+ *     that the specified key/button was moved as specified.
+ */
+static int
+XTestKeyOrButton(
+Display                *display,
+int            device_id,
+unsigned long  delay,
+unsigned int   code,
+unsigned int   action)
+{
+       /*
+        * holds a key input action to be filled out and sent to the server
+        */
+       XTestKeyInfo    keyinfo;
+
+       /*
+        * bounds check the device id
+        */
+       if (device_id < 0 || device_id > XTestMAX_DEVICE_ID)
+       {
+               return(-1);
+       }
+       /*
+        * fill out the key input action(s) as appropriate
+        */
+       switch(action)
+       {
+       case XTestPRESS:
+               /*
+                * Check the delay.  If it is larger than will fit in the
+                * key input action, send a delay input action.
+                */
+               if(XTestCheckDelay(display, &delay) == -1)
+               {
+                       /*
+                        * an error occurred, return -1
+                        */
+                       return(-1);
+               }
+               /*
+                * create the header 
+                */
+               keyinfo.header = XTestPackDeviceID(device_id) |
+                                XTestKEY_ACTION |
+                                XTestKEY_DOWN;
+               /*
+                * set the key/button code
+                */
+               keyinfo.keycode = code;
+               /*
+                * set the delay time
+                */
+               keyinfo.delay_time = delay;
+               /*
+                * pack the input action into a request to be sent to the
+                * server when the request is full or XTestFlush is called
+                */
+               return(XTestPackInputAction(display,
+                                           (CARD8 *) &keyinfo,
+                                           sizeof(XTestKeyInfo)));
+       case XTestRELEASE:
+               /*
+                * Check the delay.  If it is larger than will fit in the
+                * key input action, send a delay input action.
+                */
+               if(XTestCheckDelay(display, &delay) == -1)
+               {
+                       /*
+                        * an error occurred, return -1
+                        */
+                       return(-1);
+               }
+               /*
+                * create the header 
+                */
+               keyinfo.header = XTestPackDeviceID(device_id) |
+                                XTestKEY_ACTION |
+                                XTestKEY_UP;
+               /*
+                * set the key/button code
+                */
+               keyinfo.keycode = code;
+               /*
+                * set the delay time
+                */
+               keyinfo.delay_time = delay;
+               /*
+                * pack the input action into a request to be sent to the
+                * server when the request is full or XTestFlush is called
+                */
+               return(XTestPackInputAction(display,
+                                           (CARD8 *) &keyinfo,
+                                           sizeof(XTestKeyInfo)));
+       case XTestSTROKE:
+               /*
+                * Check the delay.  If it is larger than will fit in the
+                * key input action, send a delay input action.
+                */
+               if(XTestCheckDelay(display, &delay) == -1)
+               {
+                       /*
+                        * an error occurred, return -1
+                        */
+                       return(-1);
+               }
+               /*
+                * create a key/button-down input action header
+                */
+               keyinfo.header = XTestPackDeviceID(device_id) |
+                                XTestKEY_ACTION |
+                                XTestKEY_DOWN;
+               /*
+                * set the key/button code
+                */
+               keyinfo.keycode = code;
+               /*
+                * set the delay time
+                */
+               keyinfo.delay_time = delay;
+               /*
+                * pack the input action into a request to be sent to the
+                * server when the request is full or XTestFlush is called
+                */
+               if (XTestPackInputAction(display,
+                                        (CARD8 *) &keyinfo,
+                                        sizeof(XTestKeyInfo)) == -1)
+               {
+                       /*
+                        * an error occurred, return -1
+                        */
+                       return(-1);
+               }
+               /*
+                * set the delay to XTestSTROKE_DELAY_TIME
+                */
+               delay = XTestSTROKE_DELAY_TIME;
+               /*
+                * Check the delay.  If it is larger than will fit in the
+                * key input action, send a delay input action.
+                */
+               if(XTestCheckDelay(display, &delay) == -1)
+               {
+                       /*
+                        * an error occurred, return -1
+                        */
+                       return(-1);
+               }
+               /*
+                * create a key/button-up input action header
+                */
+               keyinfo.header = XTestPackDeviceID(device_id) |
+                                XTestKEY_ACTION |
+                                XTestKEY_UP;
+               /*
+                * set the key/button code
+                */
+               keyinfo.keycode = code;
+               /*
+                * set the delay time
+                */
+               keyinfo.delay_time = delay;
+               /*
+                * pack the input action into a request to be sent to the
+                * server when the request is full or XTestFlush is called
+                */
+               return(XTestPackInputAction(display,
+                                           (CARD8 *) &keyinfo,
+                                           sizeof(XTestKeyInfo)));
+       default:
+               /*
+                * invalid action value, return -1
+                */
+                return(-1);
+       }
+}
+
+/******************************************************************************
+ *
+ *     XTestMovePointer
+ *
+ *     Send input actions to the server to cause the server to think
+ *     that the mouse was moved as specified.
+ */
+int
+XTestMovePointer(
+Display                *display,
+int            device_id,
+unsigned long  delay[],
+int            x[],
+int            y[],
+unsigned int   count)
+{
+       /*
+        * holds a motion input action to be filled out and sent to the server
+        */
+       XTestMotionInfo motioninfo;
+       /*
+        * holds a jump input action to be filled out and sent to the server
+        */
+       XTestJumpInfo   jumpinfo;
+       /*
+        * loop index
+        */
+       unsigned int    i;
+       /*
+        * holds the change in x and y directions from the current x and y
+        * coordinates
+        */
+       int     dx;
+       int     dy;
+
+       /*
+        * bounds check the device id
+        */
+       if (device_id < 0 || device_id > XTestMAX_DEVICE_ID)
+       {
+               return(-1);
+       }
+       /*
+        * if the count is 0, there is nothing to do.  return 0
+        */
+       if (count == 0)
+       {
+               return(0);
+       }
+       /*
+        * loop through the pointer motions, creating the appropriate
+        * input actions for each motion
+        */
+       for (i = 0; i < count; i++)
+       {
+               /*
+                * Check the delay.  If it is larger than will fit in the
+                * input action, send a delay input action.
+                */
+               if(XTestCheckDelay(display, &(delay[i])) == -1)
+               {
+                       /*
+                        * an error occurred, return -1
+                        */
+                       return(-1);
+               }
+               /*
+                * compute the change from the current x and y coordinates
+                * to the new x and y coordinates
+                */
+               dx = x[i] - current_x;
+               dy = y[i] - current_y;
+               /*
+                * update the current x and y coordinates
+                */
+               current_x = x[i];
+               current_y = y[i];
+               /*
+                * If the pointer motion range is too large to fit into
+                * a motion input action, then use a jump input action.
+                * Otherwise, use a motion input action.
+                */
+                if ((dx > XTestMOTION_MAX) || (dx < XTestMOTION_MIN) ||
+                    (dy > XTestMOTION_MAX) || (dy < XTestMOTION_MIN))
+               {
+                       /*
+                        * create a jump input action header
+                        */
+                       jumpinfo.header = XTestPackDeviceID(device_id) |
+                                         XTestJUMP_ACTION;
+                       /*
+                        * set the x and y coordinates to jump to
+                        */
+                       jumpinfo.jumpx = x[i];
+                       jumpinfo.jumpy = y[i];
+                       /*
+                        * set the delay time
+                        */
+                       jumpinfo.delay_time = delay[i];
+                       /*
+                        * pack the jump input action into a request to be
+                        * sent to the server when the request is full
+                        * or XTestFlush is called
+                        */
+                       if (XTestPackInputAction(display,
+                                                (CARD8 *) &jumpinfo,
+                                                sizeof(XTestJumpInfo)) == -1)
+                       {
+                               /*
+                                * an error occurred, return -1
+                                */
+                               return(-1);
+                       }
+               }
+               else
+               {
+                       /*
+                        * create a motion input action header
+                        */
+                       motioninfo.header = XTestPackDeviceID(device_id) |
+                                           XTestMOTION_ACTION;
+                       /*
+                        * compute the motion data byte
+                        */
+                       if (dx < 0)
+                       {
+                               motioninfo.header |= XTestX_NEGATIVE;
+                               dx = abs(dx);
+                       }
+                       if (dy < 0)
+                       {
+                               motioninfo.header |= XTestY_NEGATIVE;
+                               dy = abs(dy);
+                       }
+                       motioninfo.motion_data = XTestPackXMotionValue(dx);
+                       motioninfo.motion_data |= XTestPackYMotionValue(dy);
+                       /*
+                        * set the delay time
+                        */
+                       motioninfo.delay_time = delay[i];
+                       /*
+                        * pack the motion input action into a request to be
+                        * sent to the server when the request is full
+                        * or XTestFlush is called
+                        */
+                       if (XTestPackInputAction(display,
+                                                (CARD8 *) &motioninfo,
+                                                sizeof(XTestMotionInfo)) == -1)
+                       {
+                               /*
+                                * an error occurred, return -1
+                                */
+                               return(-1);
+                       }
+               }
+       }
+       /*
+        * if you get here, everything went ok
+        */
+       return(0);
+}
+
+/******************************************************************************
+ *
+ *     XTestCheckDelay
+ *
+ *     Check the delay value at the passed-in address.  If it is larger than
+ *     will fit in a normal input action, then send a delay input action.
+ */
+static int
+XTestCheckDelay(
+Display                *display,
+unsigned long  *delay_addr)
+{
+       /*
+        * holds a delay input action to be filled out and sent to the server
+        */
+       XTestDelayInfo  delayinfo;
+
+       /*
+        * if the delay value will fit in the input action,
+        * then there is no need for a delay input action
+        */
+       if (*delay_addr <= XTestSHORT_DELAY_TIME)
+       {
+               return(0);
+       }
+       /*
+        * fill out a delay input action
+        */
+       delayinfo.header = XTestPackDeviceID(XTestDELAY_DEVICE_ID);
+       delayinfo.delay_time = *delay_addr;
+       /*
+        * all of the delay time will be accounted for in the
+        * delay input action, so set the original delay value to 0
+        */
+       *delay_addr = 0;
+       /*
+        * pack the delay input action into a request to be sent to the
+        * server when the request is full or XTestFlush is called
+        */
+       return(XTestPackInputAction(display,
+                                   (CARD8 *) &delayinfo,
+                                   sizeof(XTestDelayInfo)));
+}
+
+/******************************************************************************
+ *
+ *     XTestPackInputAction
+ *
+ *     If the input action buffer is full or the number of input actions
+ *     has reached the maximum that the server can handle at one time,
+ *     then send the input actions to the server using XTestFakeInput.
+ */
+static int
+XTestPackInputAction(
+Display        *display,
+CARD8  *action_addr,
+int    action_size)
+{
+       /*
+        * loop index
+        */
+       int     i;
+       /*
+        * acknowledge flag
+        */
+       int     ack_flag;
+
+       /*
+        * if we don't already know it, find out how many input actions
+        * the server can handle at one time
+        */
+       if (action_array_size == 0)
+       {
+               if(XTestQueryInputSize(display, &action_array_size) == -1)
+               {
+                       /*
+                        * if an error, return -1
+                        */
+                       return(-1);
+               }
+       }
+       /*
+        * if the specified input action will fit in the the input
+        * action buffer and won't exceed the server's capacity, then
+        * put the input action into the input buffer
+        */
+       if(((action_index + action_size) <= XTestMAX_ACTION_LIST_SIZE) &&
+          ((action_count + 1) < action_array_size))
+       {
+               /*
+                * copy the input action into the buffer
+                */
+               for (i = 0; i < action_size; i++)
+               {
+                       action_buf[action_index++] = *(action_addr++);
+               }
+               /*
+                * increment the action count
+                */
+               action_count++;
+               /*
+                * everything went ok, return 0
+                */
+               return(0);
+       }
+       /*
+        * We have to write input actions to the server.  If the server's
+        * input action capacity will be reached, then ask for an
+        * acknowledge event when the server has processed all of the 
+        * input actions.  Otherwise, an acknowledge event is not needed.
+        */
+       if (action_count >= action_array_size)
+       {
+               ack_flag = XTestFAKE_ACK_REQUEST;
+       }
+       else
+       {
+               ack_flag = XTestFAKE_ACK_NOT_NEEDED;
+       }
+       /*
+        * write the input actions to the server
+        */
+       if (XTestWriteInputActions(display,
+                                  (char *) &(action_buf[0]),
+                                  action_index,
+                                  ack_flag) == -1)
+       {
+               /*
+                * error, return -1
+                */
+               return(-1);
+       }
+       /*
+        * copy the input action into the buffer
+        */
+       for (i = 0; i < action_size; i++)
+       {
+               action_buf[action_index++] = *(action_addr++);
+       }
+       /*
+        * increment the action count
+        */
+       action_count++;
+       return(0);
+}
+
+/******************************************************************************
+ *
+ *     XTestWriteInputActions
+ *
+ *     Send input actions to the server.
+ */
+static int
+XTestWriteInputActions(
+Display        *display,
+char   *action_list_addr,
+int    action_list_size,
+int    ack_flag)
+{
+       /*
+        * Holds an event.  Used while waiting for an acknowledge event
+        */
+       XEvent  event;
+       /*
+        * points to XTestIdentifyMyEvent
+        */
+       Bool    (*func_ptr)(Display *, XEvent *, XPointer);
+
+       /*
+        * write the input actions to the server
+        */
+       if (XTestFakeInput(display,
+                          action_list_addr,
+                          action_list_size,
+                          ack_flag) == -1)
+       {
+               /*
+                * if an error, return -1
+                */
+               return(-1);
+       }
+       /*
+        * flush X's buffers to make sure that the server really gets
+        * the input actions
+        */
+       XFlush(display);
+       /*
+        * mark the input action buffer as empty
+        */
+       action_index = 0;
+       /*
+        * if we asked for an acknowledge event, then wait for it
+        */
+       if (ack_flag == XTestFAKE_ACK_REQUEST)
+       {
+               /*
+                * point func_ptr at XTestIdentifyMyEvent
+                */
+               func_ptr = XTestIdentifyMyEvent;
+               /*
+                * Wait until the acknowledge event comes.  When the
+                * acknowledge event comes, it is removed from the event
+                * queue without disturbing any other events that might
+                * be in the queue.
+                */
+               XIfEvent(display, &event, func_ptr, NULL);
+               /*
+                * set the input action count back to 0
+                */
+               action_count = 0;
+       }
+       /*
+        * if we got here, then everything is ok, return 0
+        */
+       return(0);
+}
+
+/******************************************************************************
+ *
+ *     XTestIdentifyMyEvent
+ *
+ *     This function is called by XIfEvent to look at an event and see if
+ *     it is of XTestFakeAckType.
+ */
+static Bool
+XTestIdentifyMyEvent(
+Display        *display,
+/*
+ * Holds the event that this routine is supposed to look at.
+ */
+XEvent *event_ptr,
+/*
+ * this points to any user-specified arguments (ignored)
+ */
+char   *args)
+{
+       /*
+        * if the event if of the correct type, return the Bool True,
+        * otherwise return the Bool False.
+        */
+       if (event_ptr->type == XTestFakeAckType)
+       {
+               return(True);
+       }
+       else
+       {
+               return(False);
+       }
+}
+
+/******************************************************************************
+ *
+ *     XTestFlush
+ *
+ *     Send any input actions in the input action buffer to the server.
+ */
+int
+XTestFlush(Display *display)
+{
+       /*
+        * acknowledge flag
+        */
+       int     ack_flag;
+
+       /*
+        * if there are no input actions in the input action buffer,
+        * then return 0
+        */
+       if (action_index == 0)
+       {
+               return(0);
+       }
+       /*
+        * We have input actions to write to the server.  We will
+        * wait until the server has finished processing the input actions.
+        */
+       ack_flag = XTestFAKE_ACK_REQUEST;
+       /*
+        * write the input actions to the server
+        */
+       return(XTestWriteInputActions(display,
+                                     (char *) &(action_buf[0]),
+                                     action_index,
+                                     ack_flag));
+}
diff --git a/src/Xcup.c b/src/Xcup.c
new file mode 100755 (executable)
index 0000000..2f73d2d
--- /dev/null
@@ -0,0 +1,262 @@
+/*
+
+Copyright 1987, 1988, 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.
+
+*/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#ifdef WIN32
+#include <X11/Xwindows.h>
+#endif
+
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xcup.h>
+#include <X11/extensions/cupproto.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+
+static XExtensionInfo _xcup_info_data;
+static XExtensionInfo *xcup_info = &_xcup_info_data;
+static char *xcup_extension_name = XCUPNAME;
+
+/*****************************************************************************
+ *                                                                           *
+ *                        private utility routines                          *
+ *                                                                           *
+ *****************************************************************************/
+
+static int close_display(Display *dpy, XExtCodes *codes);
+static /* const */ XExtensionHooks xcup_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 XEXT_GENERATE_FIND_DISPLAY (find_display, xcup_info, 
+                                  xcup_extension_name, 
+                                  &xcup_extension_hooks, 
+                                  0, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xcup_info)
+
+
+/*****************************************************************************
+ *                                                                           *
+ *                 public Xcup Extension routines                           *
+ *                                                                           *
+ *****************************************************************************/
+
+Status
+XcupQueryVersion(
+    Display* dpy,
+    int* major_version_return,
+    int* minor_version_return)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xXcupQueryVersionReply rep;
+    xXcupQueryVersionReq *req;
+
+    XextCheckExtension (dpy, info, xcup_extension_name, False);
+
+    LockDisplay(dpy);
+    GetReq(XcupQueryVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->xcupReqType = X_XcupQueryVersion;
+    req->client_major_version = XCUP_MAJOR_VERSION;
+    req->client_minor_version = XCUP_MINOR_VERSION;
+    if (!_XReply(dpy, (xReply *)&rep, 0, xTrue)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return False;
+    }
+    *major_version_return = rep.server_major_version;
+    *minor_version_return = rep.server_minor_version;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return True;
+}
+
+/* Win32 reserves 20 colormap entries for its desktop */
+#ifndef TYP_RESERVED_ENTRIES
+#define TYP_RESERVED_ENTRIES 20
+#endif
+
+Status 
+XcupGetReservedColormapEntries(
+    Display* dpy,
+    int screen,
+    XColor** colors_out,
+    int* ncolors)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xXcupGetReservedColormapEntriesReply rep;
+    xXcupGetReservedColormapEntriesReq *req;
+    xColorItem rbuf[TYP_RESERVED_ENTRIES];
+
+    *ncolors = 0;
+
+    XextCheckExtension (dpy, info, xcup_extension_name, False);
+
+    LockDisplay(dpy);
+    GetReq(XcupGetReservedColormapEntries, req);
+    req->reqType = info->codes->major_opcode;
+    req->xcupReqType = X_XcupGetReservedColormapEntries;
+    req->screen = screen;
+    if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       long nbytes;
+       xColorItem* rbufp;
+       int nentries = rep.length / 3;
+
+       nbytes = nentries * SIZEOF (xColorItem);
+       if (nentries > TYP_RESERVED_ENTRIES)
+           rbufp = (xColorItem*) Xmalloc (nbytes);
+       else
+           rbufp = rbuf;
+
+       if (rbufp == NULL) {
+           _XEatData (dpy, (unsigned long) nbytes);
+           UnlockDisplay (dpy);
+           SyncHandle ();
+           return False;
+       }
+       _XRead (dpy, (char*) rbufp, nbytes);
+
+       *colors_out = (XColor*) Xmalloc (nentries  * sizeof (XColor));
+       if (*colors_out) {
+           xColorItem* cs = (xColorItem *) rbufp;
+           XColor* cd = *colors_out;
+           int i;
+
+           *ncolors = nentries;
+           for (i = 0; i < *ncolors; i++, cd++) {
+               cd->pixel = cs->pixel;
+               cd->red = cs->red;
+               cd->green = cs->green;
+               cd->blue = cs->blue;
+               cs = (xColorItem*) (((char*) cs) + SIZEOF(xColorItem));
+           }
+           if (rbufp != rbuf) XFree ((char*) rbufp);
+           UnlockDisplay(dpy);
+           SyncHandle();
+           return True;
+       }
+       if (rbufp != rbuf) XFree ((char*) rbufp);
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return False;
+}
+
+Status
+XcupStoreColors(
+    Display* dpy,
+    Colormap colormap,
+    XColor* colors_in_out,
+    int ncolors)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xXcupStoreColorsReply rep;
+    xXcupStoreColorsReq *req;
+    xColorItem rbuf[256];
+    xColorItem citem;
+    int i;
+    XColor* xcp;
+
+    XextCheckExtension (dpy, info, xcup_extension_name, False);
+
+    LockDisplay(dpy);
+    GetReq(XcupStoreColors, req);
+    req->reqType = info->codes->major_opcode;
+    req->xcupReqType = X_XcupStoreColors;
+    req->cmap = colormap;
+    req->length += (ncolors * SIZEOF(xColorItem)) >> 2;
+
+    for (i = 0, xcp = colors_in_out; i < ncolors; i++, xcp++) {
+       citem.pixel = xcp->pixel;
+       citem.red = xcp->red;
+       citem.green = xcp->green;
+       citem.blue = xcp->blue;
+
+       /* note that xColorItem doesn't contain all 16-bit quantities, so
+          we can't use Data16 */
+       Data(dpy, (char *)&citem, (long) SIZEOF(xColorItem));
+    }
+
+    if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
+       long nbytes;
+       xColorItem* rbufp;
+       xColorItem* cs;
+       int nentries = rep.length / 3;
+
+       nbytes = nentries * SIZEOF (xColorItem);
+
+       if (nentries != ncolors) {
+           _XEatData (dpy, (unsigned long) nbytes);
+           UnlockDisplay (dpy);
+           SyncHandle ();
+           return False;
+       }
+
+       if (ncolors > 256)
+           rbufp = (xColorItem*) Xmalloc (nbytes);
+       else
+           rbufp = rbuf;
+
+       if (rbufp == NULL) {
+           _XEatData (dpy, (unsigned long) nbytes);
+           UnlockDisplay (dpy);
+           SyncHandle ();
+           return False;
+
+       }
+
+       _XRead (dpy, (char*) rbufp, nbytes);
+
+       for (i = 0, xcp = colors_in_out, cs = rbufp; i < ncolors; i++, xcp++, cs++) {
+           xcp->pixel = cs->pixel;
+           xcp->red = cs->red;
+           xcp->green = cs->green;
+           xcp->blue = cs->blue;
+           xcp->flags = cs->flags;
+       }
+       if (rbufp != rbuf) XFree ((char*)rbufp);
+
+       UnlockDisplay(dpy);
+       SyncHandle();
+       return True;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    return False;
+}
+
diff --git a/src/Xdbe.c b/src/Xdbe.c
new file mode 100755 (executable)
index 0000000..f167088
--- /dev/null
@@ -0,0 +1,468 @@
+/******************************************************************************
+ * 
+ * Copyright (c) 1994, 1995  Hewlett-Packard Company
+ *
+ * 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 HEWLETT-PACKARD COMPANY 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 Hewlett-Packard
+ * Company 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 Hewlett-Packard Company.
+ * 
+ *     Xlib DBE code
+ *
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/Xdbe.h>
+#include <X11/extensions/dbeproto.h>
+
+static XExtensionInfo _dbe_info_data;
+static XExtensionInfo *dbe_info = &_dbe_info_data;
+static char *dbe_extension_name = DBE_PROTOCOL_NAME;
+
+#define DbeCheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, dbe_extension_name, val)
+#define DbeSimpleCheckExtension(dpy,i) \
+  XextSimpleCheckExtension (dpy, i, dbe_extension_name)
+
+#if !defined(UNIXCPP)
+#define DbeGetReq(name,req,info) GetReq (name, req); \
+        req->reqType = info->codes->major_opcode; \
+        req->dbeReqType = X_##name;
+#else
+#define DbeGetReq(name,req,info) GetReq (name, req); \
+        req->reqType = info->codes->major_opcode; \
+        req->dbeReqType = X_/**/name;
+#endif
+
+
+/*****************************************************************************
+ *                                                                           *
+ *                        private utility routines                          *
+ *                                                                           *
+ *****************************************************************************/
+
+/*
+ * find_display - locate the display info block
+ */
+static int close_display(Display *dpy, XExtCodes *codes);
+static char *error_string(Display *dpy, int code, XExtCodes *codes,
+                         char *buf, int n);
+static XExtensionHooks dbe_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 char *dbe_error_list[] = {
+    "BadBuffer",                       /* DbeBadBuffer */
+};
+
+static XEXT_GENERATE_FIND_DISPLAY (find_display, dbe_info,
+                                  dbe_extension_name, 
+                                  &dbe_extension_hooks, 
+                                  DbeNumberEvents, NULL)
+
+static XEXT_GENERATE_CLOSE_DISPLAY (close_display, dbe_info)
+
+static XEXT_GENERATE_ERROR_STRING (error_string, dbe_extension_name,
+                                  DbeNumberErrors, 
+                                  dbe_error_list)
+
+
+/*****************************************************************************
+ *                                                                           *
+ *                    Double-Buffering public interfaces                    *
+ *                                                                           *
+ *****************************************************************************/
+
+/* 
+ * XdbeQueryExtension -
+ *     Sets major_version_return and minor_verion_return to the major and
+ *     minor DBE protocol version supported by the server.  If the DBE
+ *     library is compatible with the version returned by the server, this
+ *     function returns non-zero.  If dpy does not support the DBE
+ *     extension, or if there was an error during communication with the
+ *     server, or if the server and library protocol versions are
+ *     incompatible, this functions returns zero.  No other Xdbe functions
+ *     may be called before this function.   If a client violates this rule,
+ *     the effects of all subsequent Xdbe calls are undefined.
+ */
+Status XdbeQueryExtension (
+    Display *dpy,
+    int *major_version_return,
+    int *minor_version_return)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    xDbeGetVersionReply rep;
+    register xDbeGetVersionReq *req;
+
+    if (!XextHasExtension (info))
+        return (Status)0; /* failure */
+
+    LockDisplay (dpy);
+    DbeGetReq (DbeGetVersion, req, info);
+    req->majorVersion = DBE_MAJOR_VERSION;
+    req->minorVersion = DBE_MINOR_VERSION;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+       UnlockDisplay (dpy);
+       SyncHandle ();
+       return (Status)0; /* failure */
+    }
+    *major_version_return = rep.majorVersion;
+    *minor_version_return = rep.minorVersion;
+    UnlockDisplay (dpy);
+
+    SyncHandle ();
+
+    if (*major_version_return != DBE_MAJOR_VERSION)
+        return (Status)0; /* failure */
+    else
+        return (Status)1; /* success */
+}
+
+
+/*
+ * XdbeAllocateBackBuffer -
+ *     This function returns a drawable ID used to refer to the back buffer
+ *     of the specified window.  The swap_action is a hint to indicate the
+ *     swap action that will likely be used in subsequent calls to
+ *     XdbeSwapBuffers.  The actual swap action used in calls to
+ *     XdbeSwapBuffers does not have to be the same as the swap_action
+ *     passed to this function, though clients are encouraged to provide
+ *     accurate information whenever possible.
+ */
+
+XdbeBackBuffer XdbeAllocateBackBufferName(
+    Display *dpy,
+    Window window,
+    XdbeSwapAction swap_action)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xDbeAllocateBackBufferNameReq *req;
+    XdbeBackBuffer buffer;
+
+    /* make sure extension is available; if not, return the
+     * third parameter (0).
+     */
+    DbeCheckExtension (dpy, info, (XdbeBackBuffer)0);
+
+    LockDisplay(dpy);
+    DbeGetReq(DbeAllocateBackBufferName, req, info);
+    req->window = window;
+    req->swapAction = (unsigned char)swap_action;
+    req->buffer = buffer = XAllocID (dpy);
+
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return buffer;
+
+} /* XdbeAllocateBackBufferName() */
+
+/*
+ * XdbeDeallocateBackBufferName - 
+ *     This function frees a drawable ID, buffer, that was obtained via
+ *     XdbeAllocateBackBufferName.  The buffer must refer to the back buffer
+ *     of the specified window, or a protocol error results.
+ */
+Status XdbeDeallocateBackBufferName (
+    Display *dpy,
+    XdbeBackBuffer buffer)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xDbeDeallocateBackBufferNameReq *req;
+
+    DbeCheckExtension (dpy, info, (Status)0 /* failure */);
+
+    LockDisplay (dpy);
+    DbeGetReq (DbeDeallocateBackBufferName, req, info);
+    req->buffer = buffer;
+    UnlockDisplay (dpy);
+    SyncHandle ();
+
+    return (Status)1; /* success */
+}
+
+
+/*
+ * XdbeSwapBuffers - 
+ *     This function swaps the front and back buffers for a list of windows.
+ *     The argument num_windows specifies how many windows are to have their
+ *     buffers swapped; it is the number of elements in the swap_info array.
+ *     The argument swap_info specifies the information needed per window
+ *     to do the swap.
+ */
+Status XdbeSwapBuffers (
+    Display *dpy,
+    XdbeSwapInfo *swap_info,
+    int num_windows)
+{
+    XExtDisplayInfo *info = find_display (dpy);
+    register xDbeSwapBuffersReq *req;
+    int i;
+
+    DbeCheckExtension (dpy, info, (Status)0 /* failure */);
+
+    LockDisplay (dpy);
+    DbeGetReq (DbeSwapBuffers, req, info);
+    req->length += 2*num_windows;
+    req->n = num_windows;
+
+    /* We need to handle 64-bit machines, where we can not use PackData32
+     * directly because info would be lost in translating from 32- to 64-bit.
+     * Instead we send data via a loop that accounts for the translation.
+     */
+    for (i = 0; i < num_windows; i++)
+    {
+        char tmp[4];
+        Data32 (dpy, (long *)&swap_info[i].swap_window, 4);
+        tmp[0] = swap_info[i].swap_action;
+        Data (dpy, (char *)tmp, 4);
+    }
+
+    UnlockDisplay (dpy);
+    SyncHandle ();
+
+
+    return (Status)1; /* success */
+
+} /* XdbeSwapBuffers() */
+
+
+/*
+ * XdbeBeginIdiom -
+ *     This function marks the beginning of an idiom sequence.
+ */
+Status XdbeBeginIdiom (Display *dpy)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    register xDbeBeginIdiomReq *req;
+
+    DbeCheckExtension (dpy, info, (Status)0 /* failure */);
+
+    LockDisplay (dpy);
+    DbeGetReq (DbeBeginIdiom, req, info);
+    UnlockDisplay (dpy);
+    SyncHandle ();
+
+    return (Status)1; /* success */
+}
+
+
+/*
+ * XdbeEndIdiom -
+ *     This function marks the end of an idiom sequence.
+ */
+Status XdbeEndIdiom (Display *dpy)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    register xDbeEndIdiomReq *req;
+
+    DbeCheckExtension (dpy, info, (Status)0 /* failure */);
+
+    LockDisplay (dpy);
+    DbeGetReq (DbeEndIdiom, req, info);
+    UnlockDisplay (dpy);
+    SyncHandle ();
+
+    return (Status)1; /* success */
+}
+
+
+/*
+ * XdbeGetVisualInfo -
+ *     This function returns information about which visuals support
+ *     double buffering.  The argument num_screens specifies how many
+ *     elements there are in the screen_specifiers list.  Each drawable
+ *     in screen_specifiers designates a screen for which the supported
+ *     visuals are being requested.  If num_screens is zero, information
+ *     for all screens is requested.  In this case, upon return from this
+ *     function, num_screens will be set to the number of screens that were
+ *     found.  If an error occurs, this function returns NULL, else it returns
+ *     a pointer to a list of XdbeScreenVisualInfo structures of length
+ *     num_screens.  The nth element in the returned list corresponds to the
+ *     nth drawable in the screen_specifiers list, unless num_screens was
+ *     passed in with the value zero, in which case the nth element in the
+ *     returned list corresponds to the nth screen of the server, starting
+ *     with screen zero.
+ */
+XdbeScreenVisualInfo *XdbeGetVisualInfo (
+    Display        *dpy,
+    Drawable       *screen_specifiers,
+    int            *num_screens)  /* SEND and RETURN */
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    register xDbeGetVisualInfoReq *req;
+    xDbeGetVisualInfoReply rep;
+    XdbeScreenVisualInfo *scrVisInfo;
+    int i;
+
+    DbeCheckExtension (dpy, info, (XdbeScreenVisualInfo *)NULL);
+
+    LockDisplay (dpy);
+
+    DbeGetReq(DbeGetVisualInfo, req, info);
+    req->length = 2 + *num_screens;
+    req->n      = *num_screens;
+    Data32 (dpy, screen_specifiers, (*num_screens * sizeof (CARD32)));
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) {
+        UnlockDisplay (dpy);
+        SyncHandle ();
+        return NULL;
+    }
+
+    /* return the number of screens actually found if we
+     * requested information about all screens (*num_screens == 0)
+     */
+    if (*num_screens == 0)
+       *num_screens = rep.m;
+
+    /* allocate list of visual information to be returned */
+    if (!(scrVisInfo =
+        (XdbeScreenVisualInfo *)Xmalloc(
+        (unsigned)(*num_screens * sizeof(XdbeScreenVisualInfo))))) {
+        UnlockDisplay (dpy);
+        SyncHandle ();
+        return NULL;
+    }
+
+    for (i = 0; i < *num_screens; i++)
+    {
+        int nbytes;
+        int j;
+        long c;
+
+        _XRead32 (dpy, &c, sizeof(CARD32));
+        scrVisInfo[i].count = c;
+
+        nbytes = scrVisInfo[i].count * sizeof(XdbeVisualInfo);
+
+        /* if we can not allocate the list of visual/depth info
+         * then free the lists that we already allocate as well
+         * as the visual info list itself
+         */
+        if (!(scrVisInfo[i].visinfo = (XdbeVisualInfo *)Xmalloc(
+            (unsigned)nbytes))) {
+            for (j = 0; j < i; j++) {
+                Xfree ((char *)scrVisInfo[j].visinfo);
+            }
+            Xfree ((char *)scrVisInfo);
+            UnlockDisplay (dpy);
+            SyncHandle ();
+            return NULL;
+        }
+    
+        /* Read the visual info item into the wire structure.  Then copy each
+         * element into the library structure.  The element sizes and/or
+         * padding may be different in the two structures.
+         */
+        for (j = 0; j < scrVisInfo[i].count; j++) {
+            xDbeVisInfo xvi;
+
+            _XRead (dpy, (char *)&xvi, sizeof(xDbeVisInfo));
+            scrVisInfo[i].visinfo[j].visual    = xvi.visualID;
+            scrVisInfo[i].visinfo[j].depth     = xvi.depth;
+            scrVisInfo[i].visinfo[j].perflevel = xvi.perfLevel;
+        }
+
+    }
+
+    UnlockDisplay (dpy);
+    SyncHandle ();
+    return scrVisInfo;
+
+} /* XdbeGetVisualInfo() */
+
+
+/*
+ * XdbeFreeVisualInfo -
+ *     This function frees the list of XdbeScreenVisualInfo returned by the
+ *     function XdbeGetVisualInfo.
+ */
+void XdbeFreeVisualInfo(XdbeScreenVisualInfo *visual_info)
+{
+    if (visual_info == NULL) {
+        return;
+    }
+
+    if (visual_info->visinfo) {
+        XFree(visual_info->visinfo);
+    }
+
+    XFree(visual_info);
+}
+
+
+/*
+ * XdbeGetBackBufferAttributes -
+ *     This function returns the attributes associated with the specified
+ *     buffer.
+ */
+XdbeBackBufferAttributes *XdbeGetBackBufferAttributes(
+    Display *dpy,
+    XdbeBackBuffer buffer)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    register xDbeGetBackBufferAttributesReq *req;
+    xDbeGetBackBufferAttributesReply rep;
+    XdbeBackBufferAttributes *attr;
+
+    DbeCheckExtension(dpy, info, (XdbeBackBufferAttributes *)NULL);
+
+    if (!(attr =
+       (XdbeBackBufferAttributes *)Xmalloc(sizeof(XdbeBackBufferAttributes)))) {
+        return NULL;
+    }
+
+    LockDisplay(dpy);
+    DbeGetReq(DbeGetBackBufferAttributes, req, info);
+    req->buffer = buffer;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) {
+        UnlockDisplay (dpy);
+        SyncHandle ();
+       Xfree(attr);
+        return NULL;
+    }
+    attr->window = rep.attributes;
+
+    UnlockDisplay (dpy);
+    SyncHandle ();
+
+    return attr;
+}
+
diff --git a/src/Xge.c b/src/Xge.c
new file mode 100755 (executable)
index 0000000..0655e00
--- /dev/null
+++ b/src/Xge.c
@@ -0,0 +1,365 @@
+/*
+ * Copyright © 2007-2008 Peter Hutterer
+ *
+ * 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.
+ *
+ * Authors: Peter Hutterer, University of South Australia, NICTA
+ */
+
+/*
+ * XGE is an extension to re-use a single opcode for multiple events,
+ * depending on the extension. XGE allows events >32 bytes.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <X11/extensions/geproto.h>
+#include <X11/extensions/ge.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/Xge.h>
+
+/***********************************************************************/
+/*                    internal data structures                         */
+/***********************************************************************/
+
+typedef struct {
+        int     present;
+        short   major_version;
+        short   minor_version;
+} XGEVersionRec;
+
+/* NULL terminated list of registered extensions. */
+typedef struct _XGEExtNode {
+    int extension;
+    XExtensionHooks* hooks;
+    struct _XGEExtNode* next;
+} XGEExtNode, *XGEExtList;
+
+/* Internal data for GE extension */
+typedef struct _XGEData {
+    XEvent data;
+    XGEVersionRec *vers;
+    XGEExtList extensions;
+} XGEData;
+
+
+/* forward declarations */
+static XExtDisplayInfo* _xgeFindDisplay(Display*);
+static Bool _xgeWireToEvent(Display*, XEvent*, xEvent*);
+static Status _xgeEventToWire(Display*, XEvent*, xEvent*);
+static int _xgeDpyClose(Display*, XExtCodes*);
+static XGEVersionRec* _xgeGetExtensionVersion(Display*,
+                                              _Xconst char*,
+                                              XExtDisplayInfo*);
+static Bool _xgeCheckExtension(Display* dpy, XExtDisplayInfo* info);
+
+/* main extension information data */
+static XExtensionInfo *xge_info;
+static char xge_extension_name[] = GE_NAME;
+static XExtensionHooks xge_extension_hooks = {
+    NULL,              /* create_gc */
+    NULL,              /* copy_gc */
+    NULL,              /* flush_gc */
+    NULL,              /* free_gc */
+    NULL,              /* create_font */
+    NULL,              /* free_font */
+    _xgeDpyClose,      /* close_display */
+    _xgeWireToEvent,   /* wire_to_event */
+    _xgeEventToWire,   /* event_to_wire */
+    NULL,              /* error */
+    NULL,              /* error_string */
+};
+
+
+static XExtDisplayInfo *_xgeFindDisplay(Display *dpy)
+{
+    XExtDisplayInfo *dpyinfo;
+    if (!xge_info)
+    {
+        if (!(xge_info = XextCreateExtension()))
+            return NULL;
+    }
+    if (!(dpyinfo = XextFindDisplay (xge_info, dpy)))
+    {
+        dpyinfo = XextAddDisplay (xge_info,
+                                  dpy,
+                                  xge_extension_name,
+                                  &xge_extension_hooks,
+                                  0 /* no events, see below */,
+                                  NULL);
+        /* We don't use an extension opcode, so we have to set the handlers
+         * directly. If GenericEvent would be > 64, the job would be done by
+         * XExtAddDisplay  */
+        XESetWireToEvent (dpy,
+                          GenericEvent,
+                          xge_extension_hooks.wire_to_event);
+        XESetEventToWire (dpy,
+                          GenericEvent,
+                          xge_extension_hooks.event_to_wire);
+    }
+    return dpyinfo;
+}
+
+/*
+ * Check extension is set up and internal data fields are filled.
+ */
+static Bool
+_xgeCheckExtInit(Display* dpy, XExtDisplayInfo* info)
+{
+    LockDisplay(dpy);
+    if(!_xgeCheckExtension(dpy, info))
+    {
+        goto cleanup;
+    }
+
+    if (!info->data)
+    {
+        XGEData* data = (XGEData*)Xmalloc(sizeof(XGEData));
+        if (!data) {
+            goto cleanup;
+        }
+        /* get version from server */
+        data->vers =
+            _xgeGetExtensionVersion(dpy, "Generic Event Extension", info);
+        data->extensions = NULL;
+        info->data = (XPointer)data;
+    }
+
+    UnlockDisplay(dpy);
+    return True;
+
+cleanup:
+    UnlockDisplay(dpy);
+    return False;
+}
+
+/* Return 1 if XGE extension exists, 0 otherwise. */
+static Bool
+_xgeCheckExtension(Display* dpy, XExtDisplayInfo* info)
+{
+    return XextHasExtension(info);
+}
+
+
+/* Retrieve XGE version number from server. */
+static XGEVersionRec*
+_xgeGetExtensionVersion(Display* dpy,
+                            _Xconst char* name,
+                            XExtDisplayInfo*info)
+{
+    xGEQueryVersionReply rep;
+    xGEQueryVersionReq *req;
+    XGEVersionRec *vers;
+
+    GetReq(GEQueryVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->ReqType = X_GEQueryVersion;
+    req->majorVersion = GE_MAJOR;
+    req->minorVersion = GE_MINOR;
+
+    if (!_XReply (dpy, (xReply *) &rep, 0, xTrue))
+    {
+        Xfree(info);
+        return NULL;
+    }
+
+    vers = (XGEVersionRec*)Xmalloc(sizeof(XGEVersionRec));
+    vers->major_version = rep.majorVersion;
+    vers->minor_version = rep.minorVersion;
+    return vers;
+}
+
+/*
+ * Display closing routine.
+ */
+
+static int
+_xgeDpyClose(Display* dpy, XExtCodes* codes)
+{
+    XExtDisplayInfo *info = _xgeFindDisplay(dpy);
+
+    if (info->data != NULL) {
+        XGEData* xge_data = (XGEData*)info->data;
+
+        if (xge_data->extensions)
+        {
+            XGEExtList current, next;
+            current = xge_data->extensions;
+            while(current)
+            {
+                next = current->next;
+                Xfree(current);
+                current = next;
+            }
+        }
+
+        XFree(xge_data->vers);
+        XFree(xge_data);
+    }
+
+    return XextRemoveDisplay(xge_info, dpy);
+}
+
+/*
+ * protocol to Xlib event conversion routine.
+ */
+static Bool
+_xgeWireToEvent(Display* dpy, XEvent* re, xEvent *event)
+{
+    int extension;
+    XGEExtList it;
+    XExtDisplayInfo* info = _xgeFindDisplay(dpy);
+    if (!info)
+        return False;
+    /*
+       _xgeCheckExtInit() calls LockDisplay, leading to a SIGABRT.
+       Well, I guess we don't need the data we get in CheckExtInit anyway
+       if (!_xgeCheckExtInit(dpy, info))
+                return False;
+     */
+
+    extension = ((xGenericEvent*)event)->extension;
+
+    it = ((XGEData*)info->data)->extensions;
+    while(it)
+    {
+        if (it->extension == extension)
+        {
+            return (it->hooks->wire_to_event(dpy, re, event));
+        }
+        it = it->next;
+    }
+
+    fprintf(stderr,
+        "_xgeWireToEvent: Unknown extension %d, this should never happen.\n",
+            extension);
+    return False;
+}
+
+/*
+ * xlib event to protocol conversion routine.
+ */
+static Status
+_xgeEventToWire(Display* dpy, XEvent* re, xEvent* event)
+{
+    int extension;
+    XGEExtList it;
+    XExtDisplayInfo* info = _xgeFindDisplay(dpy);
+    if (!info)
+        return 1; /* error! */
+
+    extension = ((XGenericEvent*)re)->extension;
+
+    it = ((XGEData*)info->data)->extensions;
+    while(it)
+    {
+        if (it->extension == extension)
+        {
+            return (it->hooks->event_to_wire(dpy, re, event));
+        }
+        it = it->next;
+    }
+
+    fprintf(stderr,
+        "_xgeEventToWire: Unknown extension %d, this should never happen.\n",
+        extension);
+
+    return Success;
+}
+
+/*
+ * Extensions need to register callbacks for their events.
+ */
+Bool
+xgeExtRegister(Display* dpy, int offset, XExtensionHooks* callbacks)
+{
+    XGEExtNode* newExt;
+    XGEData* xge_data;
+
+    XExtDisplayInfo* info = _xgeFindDisplay(dpy);
+    if (!info)
+        return False; /* error! */
+
+    if (!_xgeCheckExtInit(dpy, info))
+        return False;
+
+    xge_data = (XGEData*)info->data;
+
+    newExt = (XGEExtNode*)Xmalloc(sizeof(XGEExtNode));
+    if (!newExt)
+    {
+        fprintf(stderr, "xgeExtRegister: Failed to alloc memory.\n");
+        return False;
+    }
+
+    newExt->extension = offset;
+    newExt->hooks = callbacks;
+    newExt->next = xge_data->extensions;
+    xge_data->extensions = newExt;
+
+    return True;
+}
+
+/***********************************************************************/
+/*                    Client interfaces                                */
+/***********************************************************************/
+
+/* Set event_base and error_base to the matching values for XGE.
+ * Note that since XGE doesn't use any errors and events, the actual return
+ * value is of limited use.
+ */
+Bool
+XGEQueryExtension(Display* dpy, int* event_base, int* error_base)
+{
+    XExtDisplayInfo* info = _xgeFindDisplay(dpy);
+    if (!_xgeCheckExtInit(dpy, info))
+        return False;
+
+    *event_base = info->codes->first_event;
+    *error_base = info->codes->first_error;
+    return True;
+}
+
+/* Get XGE version number.
+ * Doesn't actually get it from server, that should have been done beforehand
+ * already
+ */
+Bool
+XGEQueryVersion(Display* dpy,
+                int *major_version,
+                int *minor_version)
+{
+    XExtDisplayInfo* info = _xgeFindDisplay(dpy);
+    if (!info)
+        return False;
+
+    if (!_xgeCheckExtInit(dpy, info))
+        return False;
+
+    *major_version = ((XGEData*)info->data)->vers->major_version;
+    *minor_version = ((XGEData*)info->data)->vers->minor_version;
+
+    return True;
+}
+
diff --git a/src/extutil.c b/src/extutil.c
new file mode 100755 (executable)
index 0000000..9fc8e25
--- /dev/null
@@ -0,0 +1,280 @@
+/*
+ *
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ *
+ * Author:  Jim Fulton, MIT X Consortium
+ *
+ * 
+ *                    Xlib Extension-Writing Utilities
+ * 
+ * This package contains utilities for writing the client API for various
+ * protocol extensions.  THESE INTERFACES ARE NOT PART OF THE X STANDARD AND
+ * ARE SUBJECT TO CHANGE!
+ * 
+ *  Routines include:
+ * 
+ *         XextCreateExtension         called once per extension
+ *         XextDestroyExtension                if no longer using extension
+ *         XextAddDisplay              add another display
+ *         XextRemoveDisplay           remove a display
+ *         XextFindDisplay             is a display open
+ * 
+ * In addition, the following Xlib-style interfaces are provided:
+ * 
+ *         XSetExtensionErrorHandler   establish an extension error handler
+ *         XMissingExtension           raise an error about missing ext
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <stdio.h>
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include <X11/extensions/ge.h>
+
+/* defined in Xge.c */
+extern _X_HIDDEN Bool 
+xgeExtRegister(Display* dpy, int extension, XExtensionHooks* callbacks);
+
+/*
+ * XextCreateExtension - return an extension descriptor containing context
+ * information for this extension.  This object is passed to all Xext 
+ * routines.
+ */
+XExtensionInfo *XextCreateExtension (void)
+{
+    register XExtensionInfo *info =
+      (XExtensionInfo *) Xmalloc (sizeof (XExtensionInfo));
+
+    if (info) {
+       info->head = NULL;
+       info->cur = NULL;
+       info->ndisplays = 0;
+    }
+    return info;
+}
+
+
+/*
+ * XextDestroyExtension - free memory the given extension descriptor
+ */
+void XextDestroyExtension (XExtensionInfo *info)
+{
+    info->head = NULL;                 /* to catch refs after this */
+    info->cur = NULL;
+    info->ndisplays = 0;
+    XFree ((char *) info);
+}
+
+
+
+/*
+ * XextAddDisplay - add a display to this extension
+ */
+XExtDisplayInfo *XextAddDisplay (
+    XExtensionInfo *extinfo,
+    Display *dpy,
+    char *ext_name,
+    XExtensionHooks *hooks,
+    int nevents,
+    XPointer data)
+{
+    XExtDisplayInfo *dpyinfo;
+
+    dpyinfo = (XExtDisplayInfo *) Xmalloc (sizeof (XExtDisplayInfo));
+    if (!dpyinfo) return NULL;
+    dpyinfo->display = dpy;
+    dpyinfo->data = data;
+    dpyinfo->codes = XInitExtension (dpy, ext_name);
+
+    /*
+     * if the server has the extension, then we can initialize the 
+     * appropriate function vectors
+     */
+    if (dpyinfo->codes) {
+       int i, j;
+
+       for (i = 0, j = dpyinfo->codes->first_event; i < nevents; i++, j++) {
+           XESetWireToEvent (dpy, j, hooks->wire_to_event);
+           XESetEventToWire (dpy, j, hooks->event_to_wire);
+       }
+
+        /* register extension for XGE */
+        if (strcmp(ext_name, GE_NAME))
+            xgeExtRegister(dpy, dpyinfo->codes->major_opcode, hooks);
+
+       if (hooks->create_gc)
+         XESetCreateGC (dpy, dpyinfo->codes->extension, hooks->create_gc);
+       if (hooks->copy_gc)
+         XESetCopyGC (dpy, dpyinfo->codes->extension, hooks->copy_gc);
+       if (hooks->flush_gc)
+         XESetFlushGC (dpy, dpyinfo->codes->extension, hooks->flush_gc);
+       if (hooks->free_gc)
+         XESetFreeGC (dpy, dpyinfo->codes->extension, hooks->free_gc);
+       if (hooks->create_font)
+         XESetCreateFont (dpy, dpyinfo->codes->extension, hooks->create_font);
+       if (hooks->free_font)
+         XESetFreeFont (dpy, dpyinfo->codes->extension, hooks->free_font);
+       if (hooks->close_display)
+         XESetCloseDisplay (dpy, dpyinfo->codes->extension, 
+                            hooks->close_display);
+       if (hooks->error)
+         XESetError (dpy, dpyinfo->codes->extension, hooks->error);
+       if (hooks->error_string)
+         XESetErrorString (dpy, dpyinfo->codes->extension,
+                           hooks->error_string);
+    } else if (hooks->close_display) {
+       /* The server doesn't have this extension.
+        * Use a private Xlib-internal extension to hang the close_display
+        * hook on so that the "cache" (extinfo->cur) is properly cleaned.
+        * (XBUG 7955)
+        */
+       XExtCodes *codes = XAddExtension(dpy);
+       if (!codes) {
+           XFree(dpyinfo);
+           return NULL;
+       }
+       XESetCloseDisplay (dpy, codes->extension, hooks->close_display);
+    }
+
+    /*
+     * now, chain it onto the list
+     */
+    _XLockMutex(_Xglobal_lock);
+    dpyinfo->next = extinfo->head;
+    extinfo->head = dpyinfo;
+    extinfo->cur = dpyinfo;
+    extinfo->ndisplays++;
+    _XUnlockMutex(_Xglobal_lock);
+    return dpyinfo;
+}
+
+
+/*
+ * XextRemoveDisplay - remove the indicated display from the extension object
+ */
+int XextRemoveDisplay (XExtensionInfo *extinfo, Display *dpy)
+{
+    XExtDisplayInfo *dpyinfo, *prev;
+
+    /*
+     * locate this display and its back link so that it can be removed
+     */
+    _XLockMutex(_Xglobal_lock);
+    prev = NULL;
+    for (dpyinfo = extinfo->head; dpyinfo; dpyinfo = dpyinfo->next) {
+       if (dpyinfo->display == dpy) break;
+       prev = dpyinfo;
+    }
+    if (!dpyinfo) {
+       _XUnlockMutex(_Xglobal_lock);
+       return 0;               /* hmm, actually an error */
+    }
+
+    /*
+     * remove the display from the list; handles going to zero
+     */
+    if (prev)
+       prev->next = dpyinfo->next;
+    else
+       extinfo->head = dpyinfo->next;
+
+    extinfo->ndisplays--;
+    if (dpyinfo == extinfo->cur) extinfo->cur = NULL;  /* flush cache */
+    _XUnlockMutex(_Xglobal_lock);
+
+    Xfree ((char *) dpyinfo);
+    return 1;
+}
+
+
+/*
+ * XextFindDisplay - look for a display in this extension; keeps a cache
+ * of the most-recently used for efficiency.
+ */
+XExtDisplayInfo *XextFindDisplay (XExtensionInfo *extinfo, Display *dpy)
+{
+    register XExtDisplayInfo *dpyinfo;
+
+    /*
+     * see if this was the most recently accessed display
+     */
+    if ((dpyinfo = extinfo->cur)&& dpyinfo->display == dpy) return dpyinfo;
+
+
+    /*
+     * look for display in list
+     */
+    _XLockMutex(_Xglobal_lock);
+    for (dpyinfo = extinfo->head; dpyinfo; dpyinfo = dpyinfo->next) {
+       if (dpyinfo->display == dpy) {
+           extinfo->cur = dpyinfo;     /* cache most recently used */
+           _XUnlockMutex(_Xglobal_lock);
+           return dpyinfo;
+       }
+    }
+    _XUnlockMutex(_Xglobal_lock);
+
+    return NULL;
+}
+
+
+
+static int _default_exterror (Display *dpy, _Xconst char *ext_name, _Xconst char *reason)
+{
+    fprintf (stderr, "Xlib:  extension \"%s\" %s on display \"%s\".\n",
+            ext_name, reason, DisplayString(dpy));
+    return 0;
+}
+
+
+/*
+ * XSetExtensionErrorHandler - sets the handler that gets called when a 
+ * requested extension is referenced.  This should eventually move into Xlib.
+ */
+
+extern XextErrorHandler _XExtensionErrorFunction;
+
+XextErrorHandler XSetExtensionErrorHandler (XextErrorHandler handler)
+{
+    XextErrorHandler oldhandler = _XExtensionErrorFunction;
+
+    _XExtensionErrorFunction = (handler ? handler :
+                               _default_exterror);
+    return oldhandler;
+}
+
+
+/*
+ * XMissingExtension - call the extension error handler
+ */
+int XMissingExtension (Display *dpy, _Xconst char *ext_name)
+{
+    XextErrorHandler func = (_XExtensionErrorFunction ?
+                            _XExtensionErrorFunction : _default_exterror);
+
+    if (!ext_name) ext_name = X_EXTENSION_UNKNOWN;
+    return (*func) (dpy, ext_name, X_EXTENSION_MISSING);
+}
diff --git a/src/globals.c b/src/globals.c
new file mode 100755 (executable)
index 0000000..f85d63a
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+
+Copyright 1989, 1998  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall
+not be used in advertising or otherwise to promote the sale, use or
+other dealings in this Software without prior written authorization
+from The Open Group.
+
+*/
+
+/*
+ * This file should contain only those objects which must be predefined.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <X11/Xlib.h>
+#include <X11/extensions/Xext.h>
+#include <stddef.h>                    /* for definition of NULL */
+
+/*
+ * If possible, it is useful to have the global data default to a null value.
+ * Some shared library implementations are *much* happier if there isn't any
+ * global initialized data.
+ */
+#ifdef NULL_NOT_ZERO                   /* then need to initialize */
+#define SetZero(t,var,z) t var = z
+#else 
+#define SetZero(t,var,z) t var
+#endif
+
+#ifdef ATTSHAREDLIB                    /* then need extra variables */
+/*
+ * If we need to define extra variables for each global
+ */
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define ZEROINIT(t,var,val) SetZero(t,var,val); \
+  SetZero (long, _libX_##var##Flag, 0); \
+  SetZero (void *, _libX_##var##Ptr, NULL)
+#else /* else pcc concatenation */
+#define ZEROINIT(t,var,val) SetZero(t,var,val); \
+  SetZero (long, _libX_/**/var/**/Flag, 0); \
+  SetZero (void *, _libX_/**/var/**/Ptr, NULL)
+#endif /* concat ANSI C vs. pcc */
+
+#else /* else not ATTSHAREDLIB */
+/*
+ * no extra crud
+ */
+#define ZEROINIT(t,var,val) SetZero (t, var, val)
+
+#endif /* ATTSHAREDLIB */
+
+
+/*
+ * Error handlers; used to be in XlibInt.c
+ */
+ZEROINIT (XextErrorHandler, _XExtensionErrorFunction, NULL);
+
+/*
+ * NOTE: any additional external definition NEED
+ * to be inserted BELOW this point!!!
+ */
+
+/*
+ * NOTE: any additional external definition NEED
+ * to be inserted ABOVE this point!!!
+ */
+
diff --git a/xext.pc.in b/xext.pc.in
new file mode 100644 (file)
index 0000000..cf93701
--- /dev/null
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: Xext
+Description: Misc X Extension Library
+Version: @PACKAGE_VERSION@
+Requires: xextproto
+Requires.private: x11
+Cflags: -I${includedir}
+Libs: -L${libdir} -lXext