summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-12-13 15:12:27 -0800
committerKeith Packard <keithp@keithp.com>2017-12-13 15:12:27 -0800
commit8ce4bff36c1d5b511245eeea67d15dc1fff1496f (patch)
tree8e2f666145326eba70dca2f1c5cf58066d705bfd
parenteabbf0369b7de9fe389fb28be450f0672fe91b89 (diff)
parent8b33dcc5da6f9606a90b3f60a660facccb663585 (diff)
Merge xextproto
-rw-r--r--.gitignore78
-rw-r--r--COPYING201
-rw-r--r--EVI.h36
-rw-r--r--EVIproto.h96
-rw-r--r--Makefile.am59
-rw-r--r--README42
-rw-r--r--ag.h52
-rw-r--r--agproto.h178
-rwxr-xr-xautogen.sh17
-rw-r--r--configure.ac20
-rw-r--r--cup.h38
-rw-r--r--cupproto.h105
-rw-r--r--dbe.h57
-rw-r--r--dbeproto.h224
-rw-r--r--docbook.am105
-rw-r--r--dpmsconst.h43
-rw-r--r--dpmsproto.h175
-rw-r--r--ge.h60
-rw-r--r--geproto.h85
-rw-r--r--lbx.h73
-rw-r--r--lbxproto.h975
-rw-r--r--mitmiscconst.h38
-rw-r--r--mitmiscproto.h68
-rw-r--r--multibufconst.h83
-rw-r--r--multibufproto.h295
-rw-r--r--secur.h61
-rw-r--r--securproto.h110
-rw-r--r--shapeconst.h55
-rw-r--r--shapeproto.h237
-rw-r--r--shapestr.h8
-rw-r--r--shm.h44
-rw-r--r--shmproto.h229
-rw-r--r--shmstr.h63
-rw-r--r--specs/.gitignore5
-rw-r--r--specs/Makefile.am29
-rw-r--r--specs/appendix.xml61
-rw-r--r--specs/appgrp.xml1041
-rw-r--r--specs/dbe.xml1065
-rw-r--r--specs/dpms.xml567
-rw-r--r--specs/evi.xml519
-rw-r--r--specs/geproto.xml126
-rw-r--r--specs/lbx.xml6346
-rw-r--r--specs/multibuf.xml1628
-rw-r--r--specs/security.xml1467
-rw-r--r--specs/shape.xml1244
-rw-r--r--specs/shm.xml476
-rw-r--r--specs/sync.xml1274
-rw-r--r--specs/tog-cup.xml564
-rw-r--r--specs/xtest.xml723
-rw-r--r--syncconst.h181
-rw-r--r--syncproto.h474
-rw-r--r--syncstr.h182
-rw-r--r--xextproto.pc.in9
-rw-r--r--xtestconst.h41
-rw-r--r--xtestext1const.h160
-rw-r--r--xtestext1proto.h221
-rw-r--r--xtestproto.h124
57 files changed, 22537 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f03e5bd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,78 @@
+#
+# X.Org module default exclusion patterns
+# The next section if for module specific patterns
+#
+# Do not edit the following section
+# GNU Build System (Autotools)
+aclocal.m4
+autom4te.cache/
+autoscan.log
+ChangeLog
+compile
+config.guess
+config.h
+config.h.in
+config.log
+config-ml.in
+config.py
+config.status
+config.status.lineno
+config.sub
+configure
+configure.scan
+depcomp
+.deps/
+INSTALL
+install-sh
+.libs/
+libtool
+libtool.m4
+ltmain.sh
+lt~obsolete.m4
+ltoptions.m4
+ltsugar.m4
+ltversion.m4
+Makefile
+Makefile.in
+mdate-sh
+missing
+mkinstalldirs
+*.pc
+py-compile
+stamp-h?
+symlink-tree
+texinfo.tex
+ylwrap
+
+# Do not edit the following section
+# Edit Compile Debug Document Distribute
+*~
+*.[0-9]
+*.[0-9]x
+*.bak
+*.bin
+core
+*.dll
+*.exe
+*-ISO*.bdf
+*-JIS*.bdf
+*-KOI8*.bdf
+*.kld
+*.ko
+*.ko.cmd
+*.lai
+*.l[oa]
+*.[oa]
+*.obj
+*.patch
+*.so
+*.pcf.gz
+*.pdb
+*.tar.bz2
+*.tar.gz
+#
+# Add & Override patterns for xextproto
+#
+# Edit the following section as needed
+# For example, !report.pc overrides *.pc. See 'man gitignore'
+#
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..23135f9
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,201 @@
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+
+Copyright (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 (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 (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 1988, 1989, 1990, 1994 Network Computing Devices, Inc.
+
+Permission to use, copy, modify, distribute, and sell this software and
+its documentation for any purpose is hereby granted without fee, provided
+that the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation, and that the name Network Computing Devices, Inc. not be
+used in advertising or publicity pertaining to distribution of this
+software without specific, written prior permission.
+
+THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
+DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
+LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
+COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
+SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE,
+DATA, OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND
+REGARDLESS OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE,
+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 © 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.
diff --git a/EVI.h b/EVI.h
new file mode 100644
index 0000000..7f3f733
--- /dev/null
+++ b/EVI.h
@@ -0,0 +1,36 @@
+/************************************************************
+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 _EVI_H_
+#define _EVI_H_
+
+#define XEVI_TRANSPARENCY_NONE 0
+#define XEVI_TRANSPARENCY_PIXEL 1
+#define XEVI_TRANSPARENCY_MASK 2
+
+#define EVINAME "Extended-Visual-Information"
+
+#define XEVI_MAJOR_VERSION 1 /* current version numbers */
+#define XEVI_MINOR_VERSION 0
+
+#endif
diff --git a/EVIproto.h b/EVIproto.h
new file mode 100644
index 0000000..afa282a
--- /dev/null
+++ b/EVIproto.h
@@ -0,0 +1,96 @@
+/************************************************************
+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 _EVIPROTO_H_
+#define _EVIPROTO_H_
+
+#include <X11/extensions/EVI.h>
+
+#define X_EVIQueryVersion 0
+#define X_EVIGetVisualInfo 1
+
+#define VisualID CARD32
+
+typedef CARD32 VisualID32;
+#define sz_VisualID32 4
+
+typedef struct _xExtendedVisualInfo {
+ VisualID core_visual_id B32;
+ INT8 screen;
+ INT8 level;
+ CARD8 transparency_type;
+ CARD8 pad0;
+ CARD32 transparency_value B32;
+ CARD8 min_hw_colormaps;
+ CARD8 max_hw_colormaps;
+ CARD16 num_colormap_conflicts B16;
+} xExtendedVisualInfo;
+#define sz_xExtendedVisualInfo 16
+
+typedef struct _XEVIQueryVersion {
+ CARD8 reqType; /* always XEVIReqCode */
+ CARD8 xeviReqType; /* always X_EVIQueryVersion */
+ CARD16 length B16;
+} xEVIQueryVersionReq;
+#define sz_xEVIQueryVersionReq 4
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 unused;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 majorVersion B16; /* major version of EVI protocol */
+ CARD16 minorVersion B16; /* minor version of EVI protocol */
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+} xEVIQueryVersionReply;
+#define sz_xEVIQueryVersionReply 32
+
+typedef struct _XEVIGetVisualInfoReq {
+ CARD8 reqType; /* always XEVIReqCode */
+ CARD8 xeviReqType; /* always X_EVIGetVisualInfo */
+ CARD16 length B16;
+ CARD32 n_visual B32;
+} xEVIGetVisualInfoReq;
+#define sz_xEVIGetVisualInfoReq 8
+
+typedef struct _XEVIGetVisualInfoReply {
+ BYTE type; /* X_Reply */
+ CARD8 unused;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 n_info B32;
+ CARD32 n_conflicts B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+} xEVIGetVisualInfoReply;
+#define sz_xEVIGetVisualInfoReply 32
+
+#undef VisualID
+
+#endif /* _EVIPROTO_H_ */
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..bbe5dd4
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,59 @@
+SUBDIRS=specs
+
+xextdir = $(includedir)/X11/extensions
+xext_HEADERS = \
+ dpmsconst.h \
+ dpmsproto.h \
+ ge.h \
+ geproto.h \
+ lbx.h \
+ lbxproto.h \
+ mitmiscconst.h \
+ mitmiscproto.h \
+ multibufconst.h \
+ multibufproto.h \
+ secur.h \
+ securproto.h \
+ shapeconst.h \
+ shapeproto.h \
+ shm.h \
+ shmproto.h \
+ syncconst.h \
+ syncproto.h \
+ ag.h \
+ agproto.h \
+ cup.h \
+ cupproto.h \
+ dbe.h \
+ dbeproto.h \
+ EVI.h \
+ EVIproto.h \
+ xtestext1proto.h \
+ xtestext1const.h \
+ xtestconst.h \
+ xtestproto.h
+
+#
+# These headers allow old servers to be built with
+# new headers
+#
+compatdir = $(xextdir)
+compat_HEADERS = \
+ shapestr.h \
+ shmstr.h \
+ syncstr.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = xextproto.pc
+
+MAINTAINERCLEANFILES = ChangeLog INSTALL
+
+.PHONY: ChangeLog INSTALL
+
+INSTALL:
+ $(INSTALL_CMD)
+
+ChangeLog:
+ $(CHANGELOG_CMD)
+
+dist-hook: ChangeLog INSTALL
diff --git a/README b/README
new file mode 100644
index 0000000..bb6fc79
--- /dev/null
+++ b/README
@@ -0,0 +1,42 @@
+ X Protocol Extensions
+
+Extension names:
+
+DOUBLE-BUFFER
+DPMS
+Extended-Visual-Information
+Generic Event Extension
+LBX
+MIT-SHM
+MIT-SUNDRY-NONSTANDARD
+Multi-Buffering
+SECURITY
+SHAPE
+SYNC
+TOG-CUP
+XC-APPGROUP
+XTEST
+
+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/proto/xextproto
+
+ http://cgit.freedesktop.org/xorg/proto/xextproto
+
+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/ag.h b/ag.h
new file mode 100644
index 0000000..be5883a
--- /dev/null
+++ b/ag.h
@@ -0,0 +1,52 @@
+/*
+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 _AG_H_
+#define _AG_H_
+
+#define XAGNAME "XC-APPGROUP"
+
+#define XAG_MAJOR_VERSION 1 /* current version numbers */
+#define XAG_MINOR_VERSION 0
+
+#define XagWindowTypeX11 0
+#define XagWindowTypeMacintosh 1
+#define XagWindowTypeWin32 2
+#define XagWindowTypeWin16 3
+
+#define XagBadAppGroup 0
+#define XagNumberErrors (XagBadAppGroup + 1)
+
+#define XagNsingleScreen 7
+#define XagNdefaultRoot 1
+#define XagNrootVisual 2
+#define XagNdefaultColormap 3
+#define XagNblackPixel 4
+#define XagNwhitePixel 5
+#define XagNappGroupLeader 6
+
+#endif /* _AG_H_ */
+
diff --git a/agproto.h b/agproto.h
new file mode 100644
index 0000000..1086661
--- /dev/null
+++ b/agproto.h
@@ -0,0 +1,178 @@
+/*
+Copyright 1996, 1998, 2001 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 _AGPROTO_H_ /* { */
+#define _AGPROTO_H_
+
+#include <X11/extensions/ag.h>
+
+#define X_XagQueryVersion 0
+#define X_XagCreate 1
+#define X_XagDestroy 2
+#define X_XagGetAttr 3
+#define X_XagQuery 4
+#define X_XagCreateAssoc 5
+#define X_XagDestroyAssoc 6
+
+#define XAppGroup CARD32
+
+/*
+* Redefine some basic types used by structures defined herein. This allows
+* both the library and server to view communicated data as 32-bit entities,
+* thus preventing problems on 64-bit architectures where libXext sees this
+* data as 64 bits and the server sees it as 32 bits.
+*/
+
+#define Colormap CARD32
+#define VisualID CARD32
+#define Window CARD32
+
+typedef struct _XagQueryVersion {
+ CARD8 reqType; /* always XagReqCode */
+ CARD8 xagReqType; /* always X_XagQueryVersion */
+ CARD16 length B16;
+ CARD16 client_major_version B16;
+ CARD16 client_minor_version B16;
+} xXagQueryVersionReq;
+#define sz_xXagQueryVersionReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequence_number B16;
+ CARD32 length B32;
+ CARD16 server_major_version B16;
+ CARD16 server_minor_version B16;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xXagQueryVersionReply;
+#define sz_xXagQueryVersionReply 32
+
+/* Set AppGroup Attributes masks */
+#define XagSingleScreenMask 1 << 0
+#define XagDefaultRootMask 1 << XagNdefaultRoot
+#define XagRootVisualMask 1 << XagNrootVisual
+#define XagDefaultColormapMask 1 << XagNdefaultColormap
+#define XagBlackPixelMask 1 << XagNblackPixel
+#define XagWhitePixelMask 1 << XagNwhitePixel
+#define XagAppGroupLeaderMask 1 << XagNappGroupLeader
+
+typedef struct _XagCreate {
+ CARD8 reqType; /* always XagReqCode */
+ CARD8 xagReqType; /* always X_XagCreate */
+ CARD16 length B16;
+ XAppGroup app_group B32;
+ CARD32 attrib_mask B32; /* LISTofVALUE follows */
+} xXagCreateReq;
+#define sz_xXagCreateReq 12
+
+typedef struct _XagDestroy {
+ CARD8 reqType; /* always XagReqCode */
+ CARD8 xagReqType; /* always X_XagDestroy */
+ CARD16 length B16;
+ XAppGroup app_group B32;
+} xXagDestroyReq;
+#define sz_xXagDestroyReq 8
+
+typedef struct _XagGetAttr {
+ CARD8 reqType; /* always XagReqCode */
+ CARD8 xagReqType; /* always X_XagGetAttr */
+ CARD16 length B16;
+ XAppGroup app_group B32;
+} xXagGetAttrReq;
+#define sz_xXagGetAttrReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequence_number B16;
+ CARD32 length B32;
+ Window default_root B32;
+ VisualID root_visual B32;
+ Colormap default_colormap B32;
+ CARD32 black_pixel B32;
+ CARD32 white_pixel B32;
+ BOOL single_screen;
+ BOOL app_group_leader;
+ CARD16 pad2 B16;
+} xXagGetAttrReply;
+#define sz_xXagGetAttrReply 32
+
+typedef struct _XagQuery {
+ CARD8 reqType; /* always XagReqCode */
+ CARD8 xagReqType; /* always X_XagQuery */
+ CARD16 length B16;
+ CARD32 resource B32;
+} xXagQueryReq;
+#define sz_xXagQueryReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequence_number B16;
+ CARD32 length B32;
+ XAppGroup app_group B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xXagQueryReply;
+#define sz_xXagQueryReply 32
+
+typedef struct _XagCreateAssoc {
+ CARD8 reqType; /* always XagReqCode */
+ CARD8 xagReqType; /* always X_XagCreateAssoc */
+ CARD16 length B16;
+ Window window B32;
+ CARD16 window_type B16;
+ CARD16 system_window_len B16; /* LISTofCARD8 follows */
+} xXagCreateAssocReq;
+#define sz_xXagCreateAssocReq 12
+
+typedef struct _XagDestroyAssoc {
+ CARD8 reqType; /* always XagReqCode */
+ CARD8 xagReqType; /* always X_XagDestroyAssoc */
+ CARD16 length B16;
+ Window window B32;
+} xXagDestroyAssocReq;
+#define sz_xXagDestroyAssocReq 8
+
+#undef XAppGroup
+/*
+ * Cancel the previous redefinition of the basic types, thus restoring their
+ * X.h definitions.
+ */
+
+#undef Window
+#undef Colormap
+#undef VisualID
+
+#endif /* } _AGPROTO_H_ */
+
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..4b6f68c
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,17 @@
+#! /bin/sh
+
+srcdir=`dirname "$0"`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd "$srcdir"
+
+autoreconf -v --install || exit 1
+cd "$ORIGDIR" || exit $?
+
+git config --local --get format.subjectPrefix >/dev/null 2>&1 ||
+ git config --local format.subjectPrefix "PATCH xextproto"
+
+if test -z "$NOCONFIGURE"; then
+ exec "$srcdir"/configure "$@"
+fi
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..dcacee8
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,20 @@
+AC_PREREQ([2.60])
+AC_INIT([XExtProto], [7.3.0],
+ [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
+
+# Require xorg-macros minimum of 1.12 for DocBook external references
+m4_ifndef([XORG_MACROS_VERSION],
+ [m4_fatal([must install xorg-macros 1.12 or later before running autoconf/autogen])])
+XORG_MACROS_VERSION(1.12)
+XORG_DEFAULT_OPTIONS
+XORG_ENABLE_SPECS
+XORG_WITH_XMLTO(0.0.22)
+XORG_WITH_FOP
+XORG_WITH_XSLTPROC
+XORG_CHECK_SGML_DOCTOOLS(1.8)
+
+AC_CONFIG_FILES([Makefile
+ specs/Makefile
+ xextproto.pc])
+AC_OUTPUT
diff --git a/cup.h b/cup.h
new file mode 100644
index 0000000..cbbc34b
--- /dev/null
+++ b/cup.h
@@ -0,0 +1,38 @@
+/*
+
+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 _CUP_H_
+#define _CUP_H_
+
+#define XCUPNAME "TOG-CUP"
+
+#define XCUP_MAJOR_VERSION 1 /* current version numbers */
+#define XCUP_MINOR_VERSION 0
+
+#define XcupNumberErrors 0
+
+#endif /* _CUP_H_ */
+
diff --git a/cupproto.h b/cupproto.h
new file mode 100644
index 0000000..f61c9f0
--- /dev/null
+++ b/cupproto.h
@@ -0,0 +1,105 @@
+/*
+
+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 _XCUPPROTO_H_ /* { */
+#define _XCUPPROTO_H_
+
+#include <X11/extensions/cup.h>
+
+#define X_XcupQueryVersion 0
+#define X_XcupGetReservedColormapEntries 1
+#define X_XcupStoreColors 2
+
+typedef struct _XcupQueryVersion {
+ CARD8 reqType; /* always XcupReqCode */
+ CARD8 xcupReqType; /* always X_XcupQueryVersion */
+ CARD16 length B16;
+ CARD16 client_major_version B16;
+ CARD16 client_minor_version B16;
+} xXcupQueryVersionReq;
+#define sz_xXcupQueryVersionReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequence_number B16;
+ CARD32 length B32;
+ CARD16 server_major_version B16;
+ CARD16 server_minor_version B16;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xXcupQueryVersionReply;
+#define sz_xXcupQueryVersionReply 32
+
+typedef struct _XcupGetReservedColormapEntries {
+ CARD8 reqType; /* always XcupReqCode */
+ CARD8 xcupReqType; /* always X_XcupGetReservedColormapEntries */
+ CARD16 length B16;
+ CARD32 screen B32;
+} xXcupGetReservedColormapEntriesReq;
+#define sz_xXcupGetReservedColormapEntriesReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequence_number B16;
+ CARD32 length B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+ CARD32 pad7 B32;
+} xXcupGetReservedColormapEntriesReply;
+#define sz_xXcupGetReservedColormapEntriesReply 32
+
+typedef struct _XcupStoreColors {
+ CARD8 reqType; /* always XcupReqCode */
+ CARD8 xcupReqType; /* always X_XcupStoreColors */
+ CARD16 length B16;
+ CARD32 cmap B32;
+} xXcupStoreColorsReq;
+#define sz_xXcupStoreColorsReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL pad1;
+ CARD16 sequence_number B16;
+ CARD32 length B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+ CARD32 pad7 B32;
+} xXcupStoreColorsReply;
+#define sz_xXcupStoreColorsReply 32
+
+#endif /* } _XCUPPROTO_H_ */
+
diff --git a/dbe.h b/dbe.h
new file mode 100644
index 0000000..7968552
--- /dev/null
+++ b/dbe.h
@@ -0,0 +1,57 @@
+/******************************************************************************
+ *
+ * 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 DBE_H
+#define DBE_H
+
+/* Values for swap_action field of XdbeSwapInfo structure */
+#define XdbeUndefined 0
+#define XdbeBackground 1
+#define XdbeUntouched 2
+#define XdbeCopied 3
+
+/* Errors */
+#define XdbeBadBuffer 0
+
+#define DBE_PROTOCOL_NAME "DOUBLE-BUFFER"
+
+/* Current version numbers */
+#define DBE_MAJOR_VERSION 1
+#define DBE_MINOR_VERSION 0
+
+/* Used when adding extension; also used in Xdbe macros */
+#define DbeNumberEvents 0
+#define DbeBadBuffer 0
+#define DbeNumberErrors (DbeBadBuffer + 1)
+
+#endif /* DBE_H */
+
diff --git a/dbeproto.h b/dbeproto.h
new file mode 100644
index 0000000..784926e
--- /dev/null
+++ b/dbeproto.h
@@ -0,0 +1,224 @@
+/******************************************************************************
+ *
+ * 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 DBE_PROTO_H
+#define DBE_PROTO_H
+
+#include <X11/extensions/dbe.h>
+
+/* Request values used in (S)ProcDbeDispatch() */
+#define X_DbeGetVersion 0
+#define X_DbeAllocateBackBufferName 1
+#define X_DbeDeallocateBackBufferName 2
+#define X_DbeSwapBuffers 3
+#define X_DbeBeginIdiom 4
+#define X_DbeEndIdiom 5
+#define X_DbeGetVisualInfo 6
+#define X_DbeGetBackBufferAttributes 7
+
+typedef CARD8 xDbeSwapAction;
+typedef CARD32 xDbeBackBuffer;
+
+/* TYPEDEFS */
+
+/* Protocol data types */
+
+typedef struct
+{
+ CARD32 window B32; /* window */
+ xDbeSwapAction swapAction; /* swap action */
+ CARD8 pad1; /* unused */
+ CARD16 pad2 B16;
+
+} xDbeSwapInfo;
+
+typedef struct
+{
+ CARD32 visualID B32; /* associated visual */
+ CARD8 depth; /* depth of visual */
+ CARD8 perfLevel; /* performance level hint */
+ CARD16 pad1 B16;
+
+} xDbeVisInfo;
+#define sz_xDbeVisInfo 8
+
+typedef struct
+{
+ CARD32 n B32; /* number of visual info items in list */
+
+} xDbeScreenVisInfo; /* followed by n xDbeVisInfo items */
+
+typedef struct
+{
+ CARD32 window B32; /* window */
+
+} xDbeBufferAttributes;
+
+
+/* Requests and replies */
+
+typedef struct
+{
+ CARD8 reqType; /* major-opcode: always codes->major_opcode */
+ CARD8 dbeReqType; /* minor-opcode: always X_DbeGetVersion (0) */
+ CARD16 length B16; /* request length: (2) */
+ CARD8 majorVersion; /* client-major-version */
+ CARD8 minorVersion; /* client-minor-version */
+ CARD16 unused B16; /* unused */
+
+} xDbeGetVersionReq;
+#define sz_xDbeGetVersionReq 8
+
+typedef struct
+{
+ BYTE type; /* Reply: X_Reply (1) */
+ CARD8 unused; /* unused */
+ CARD16 sequenceNumber B16; /* sequence number */
+ CARD32 length B32; /* reply length: (0) */
+ CARD8 majorVersion; /* server-major-version */
+ CARD8 minorVersion; /* server-minor-version */
+ CARD16 pad1 B16; /* unused */
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+
+} xDbeGetVersionReply;
+#define sz_xDbeGetVersionReply 32
+
+typedef struct
+{
+ CARD8 reqType; /* major-opcode: codes->major_opcode */
+ CARD8 dbeReqType; /* X_DbeAllocateBackBufferName (1) */
+ CARD16 length B16; /* request length: (4) */
+ CARD32 window B32; /* window */
+ xDbeBackBuffer buffer B32; /* back buffer name */
+ xDbeSwapAction swapAction; /* swap action hint */
+ CARD8 pad1; /* unused */
+ CARD16 pad2 B16;
+
+} xDbeAllocateBackBufferNameReq;
+#define sz_xDbeAllocateBackBufferNameReq 16
+
+typedef struct
+{
+ CARD8 reqType; /* major-opcode: codes->major_opcode */
+ CARD8 dbeReqType; /* X_DbeDeallocateBackBufferName (2) */
+ CARD16 length B16; /* request length: (2) */
+ xDbeBackBuffer buffer B32; /* back buffer name */
+
+} xDbeDeallocateBackBufferNameReq;
+#define sz_xDbeDeallocateBackBufferNameReq 8
+
+typedef struct
+{
+ CARD8 reqType; /* major-opcode: always codes->major_opcode */
+ CARD8 dbeReqType; /* minor-opcode: always X_DbeSwapBuffers (3) */
+ CARD16 length B16; /* request length: (2+2n) */
+ CARD32 n B32; /* n, number of window/swap action pairs */
+
+} xDbeSwapBuffersReq; /* followed by n window/swap action pairs */
+#define sz_xDbeSwapBuffersReq 8
+
+typedef struct
+{
+ CARD8 reqType; /* major-opcode: always codes->major_opcode */
+ CARD8 dbeReqType; /* minor-opcode: always X_DbeBeginIdom (4) */
+ CARD16 length B16; /* request length: (1) */
+
+} xDbeBeginIdiomReq;
+#define sz_xDbeBeginIdiomReq 4
+
+typedef struct
+{
+ CARD8 reqType; /* major-opcode: always codes->major_opcode */
+ CARD8 dbeReqType; /* minor-opcode: always X_DbeEndIdom (5) */
+ CARD16 length B16; /* request length: (1) */
+
+} xDbeEndIdiomReq;
+#define sz_xDbeEndIdiomReq 4
+
+typedef struct
+{
+ CARD8 reqType; /* always codes->major_opcode */
+ CARD8 dbeReqType; /* always X_DbeGetVisualInfo (6) */
+ CARD16 length B16; /* request length: (2+n) */
+ CARD32 n B32; /* n, number of drawables in list */
+
+} xDbeGetVisualInfoReq; /* followed by n drawables */
+#define sz_xDbeGetVisualInfoReq 8
+
+typedef struct
+{
+ BYTE type; /* Reply: X_Reply (1) */
+ CARD8 unused; /* unused */
+ CARD16 sequenceNumber B16; /* sequence number */
+ CARD32 length B32; /* reply length */
+ CARD32 m; /* m, number of visual infos in list */
+ CARD32 pad1 B32; /* unused */
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+
+} xDbeGetVisualInfoReply; /* followed by m visual infos */
+#define sz_xDbeGetVisualInfoReply 32
+
+typedef struct
+{
+ CARD8 reqType; /* always codes->major_opcode */
+ CARD8 dbeReqType; /* X_DbeGetBackBufferAttributes (7) */
+ CARD16 length B16; /* request length: (2) */
+ xDbeBackBuffer buffer B32; /* back buffer name */
+
+} xDbeGetBackBufferAttributesReq;
+#define sz_xDbeGetBackBufferAttributesReq 8
+
+typedef struct
+{
+ BYTE type; /* Reply: X_Reply (1) */
+ CARD8 unused; /* unused */
+ CARD16 sequenceNumber B16; /* sequence number */
+ CARD32 length B32; /* reply length: (0) */
+ CARD32 attributes; /* attributes */
+ CARD32 pad1 B32; /* unused */
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+
+} xDbeGetBackBufferAttributesReply;
+#define sz_xDbeGetBackBufferAttributesReply 32
+
+#endif /* DBE_PROTO_H */
+
diff --git a/docbook.am b/docbook.am
new file mode 100644
index 0000000..bba4d54
--- /dev/null
+++ b/docbook.am
@@ -0,0 +1,105 @@
+#
+# Generate output formats for a single DocBook/XML with/without chapters
+#
+# Variables set by the calling Makefile:
+# shelfdir: the location where the docs/specs are installed. Typically $(docdir)
+# docbook: the main DocBook/XML file, no chapters, appendix or image files
+# chapters: all files pulled in by an XInclude statement and images.
+#
+
+#
+# This makefile is intended for Users Documentation and Functional Specifications.
+# Do not use for Developer Documentation which is not installed and does not require olink.
+# Refer to http://www.x.org/releases/X11R7.6/doc/xorg-docs/ReleaseNotes.html#id2584393
+# for an explanation on documents classification.
+#
+
+# DocBook/XML generated output formats to be installed
+shelf_DATA =
+
+# DocBook/XML file with chapters, appendix and images it includes
+dist_shelf_DATA = $(docbook) $(chapters)
+
+if HAVE_XMLTO
+if HAVE_STYLESHEETS
+
+XMLTO_SEARCHPATH_FLAGS = \
+ --searchpath "$(XORG_SGML_PATH)/X11" \
+ --searchpath "$(abs_top_builddir)"
+XMLTO_HTML_OLINK_FLAGS = \
+ --stringparam target.database.document=$(XORG_SGML_PATH)/X11/dbs/masterdb.html.xml \
+ --stringparam current.docid="$(<:.xml=)"
+XMLTO_HTML_STYLESHEET_FLAGS = -x $(STYLESHEET_SRCDIR)/xorg-xhtml.xsl
+XMLTO_HTML_FLAGS = \
+ $(XMLTO_SEARCHPATH_FLAGS) \
+ $(XMLTO_HTML_STYLESHEET_FLAGS) \
+ $(XMLTO_HTML_OLINK_FLAGS)
+
+shelf_DATA += $(docbook:.xml=.html)
+%.html: %.xml $(chapters)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_HTML_FLAGS) xhtml-nochunks $<
+
+if HAVE_XMLTO_TEXT
+
+shelf_DATA += $(docbook:.xml=.txt)
+%.txt: %.xml $(chapters)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_HTML_FLAGS) txt $<
+endif HAVE_XMLTO_TEXT
+
+if HAVE_FOP
+XMLTO_FO_IMAGEPATH_FLAGS = --stringparam img.src.path=$(abs_builddir)/
+XMLTO_PDF_OLINK_FLAGS = \
+ --stringparam target.database.document=$(XORG_SGML_PATH)/X11/dbs/masterdb.pdf.xml \
+ --stringparam current.docid="$(<:.xml=)"
+XMLTO_FO_STYLESHEET_FLAGS = -x $(STYLESHEET_SRCDIR)/xorg-fo.xsl
+
+XMLTO_FO_FLAGS = \
+ $(XMLTO_SEARCHPATH_FLAGS) \
+ $(XMLTO_FO_STYLESHEET_FLAGS) \
+ $(XMLTO_FO_IMAGEPATH_FLAGS) \
+ $(XMLTO_PDF_OLINK_FLAGS)
+
+shelf_DATA += $(docbook:.xml=.pdf)
+%.pdf: %.xml $(chapters)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FO_FLAGS) --with-fop pdf $<
+
+shelf_DATA += $(docbook:.xml=.ps)
+%.ps: %.xml $(chapters)
+ $(AM_V_GEN)$(XMLTO) $(XMLTO_FO_FLAGS) --with-fop ps $<
+endif HAVE_FOP
+
+# Generate documents cross-reference target databases
+if HAVE_XSLTPROC
+
+XSLT_SEARCHPATH_FLAGS = \
+ --path "$(XORG_SGML_PATH)/X11" \
+ --path "$(abs_top_builddir)"
+XSLT_OLINK_FLAGS = \
+ --stringparam targets.filename "$@" \
+ --stringparam collect.xref.targets "only" \
+ --stringparam olink.base.uri "$(@:.db=)"
+
+XSLT_HTML_FLAGS = \
+ $(XSLT_SEARCHPATH_FLAGS) \
+ $(XSLT_OLINK_FLAGS) \
+ --nonet --xinclude \
+ $(STYLESHEET_SRCDIR)/xorg-xhtml.xsl
+XSLT_PDF_FLAGS = \
+ $(XSLT_SEARCHPATH_FLAGS) \
+ $(XSLT_OLINK_FLAGS) \
+ --nonet --xinclude \
+ $(STYLESHEET_SRCDIR)/xorg-fo.xsl
+
+shelf_DATA += $(docbook:.xml=.html.db)
+%.html.db: %.xml $(chapters)
+ $(AM_V_GEN)$(XSLTPROC) $(XSLT_HTML_FLAGS) $<
+
+shelf_DATA += $(docbook:.xml=.pdf.db)
+%.pdf.db: %.xml $(chapters)
+ $(AM_V_GEN)$(XSLTPROC) $(XSLT_PDF_FLAGS) $<
+
+endif HAVE_XSLTPROC
+endif HAVE_STYLESHEETS
+endif HAVE_XMLTO
+
+CLEANFILES = $(shelf_DATA)
diff --git a/dpmsconst.h b/dpmsconst.h
new file mode 100644
index 0000000..75f0586
--- /dev/null
+++ b/dpmsconst.h
@@ -0,0 +1,43 @@
+/*****************************************************************
+
+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 _DPMSCONST_H
+#define _DPMSCONST_H 1
+
+#define DPMSMajorVersion 1
+#define DPMSMinorVersion 1
+
+#define DPMSExtensionName "DPMS"
+
+#define DPMSModeOn 0
+#define DPMSModeStandby 1
+#define DPMSModeSuspend 2
+#define DPMSModeOff 3
+
+#endif /* !_DPMSCONST_H */
+
diff --git a/dpmsproto.h b/dpmsproto.h
new file mode 100644
index 0000000..63fd3fc
--- /dev/null
+++ b/dpmsproto.h
@@ -0,0 +1,175 @@
+/*****************************************************************
+
+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 _DPMSPROTO_H_
+#define _DPMSPROTO_H_
+
+#include <X11/extensions/dpmsconst.h>
+
+#define X_DPMSGetVersion 0
+#define X_DPMSCapable 1
+#define X_DPMSGetTimeouts 2
+#define X_DPMSSetTimeouts 3
+#define X_DPMSEnable 4
+#define X_DPMSDisable 5
+#define X_DPMSForceLevel 6
+#define X_DPMSInfo 7
+
+#define DPMSNumberEvents 0
+
+#define DPMSNumberErrors 0
+
+
+typedef struct {
+ CARD8 reqType; /* always DPMSCode */
+ CARD8 dpmsReqType; /* always X_DPMSGetVersion */
+ CARD16 length B16;
+ CARD16 majorVersion B16;
+ CARD16 minorVersion B16;
+} xDPMSGetVersionReq;
+#define sz_xDPMSGetVersionReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 pad0;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 majorVersion B16;
+ CARD16 minorVersion B16;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xDPMSGetVersionReply;
+#define sz_xDPMSGetVersionReply 32
+
+typedef struct {
+ CARD8 reqType; /* always DPMSCode */
+ CARD8 dpmsReqType; /* always X_DPMSCapable */
+ CARD16 length B16;
+} xDPMSCapableReq;
+#define sz_xDPMSCapableReq 4
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 pad0;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ BOOL capable;
+ CARD8 pad1;
+ CARD16 pad2 B16;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+ CARD32 pad7 B32;
+} xDPMSCapableReply;
+#define sz_xDPMSCapableReply 32
+
+typedef struct {
+ CARD8 reqType; /* always DPMSCode */
+ CARD8 dpmsReqType; /* always X_DPMSGetTimeouts */
+ CARD16 length B16;
+} xDPMSGetTimeoutsReq;
+#define sz_xDPMSGetTimeoutsReq 4
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 pad0;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 standby B16;
+ CARD16 suspend B16;
+ CARD16 off B16;
+ CARD16 pad1 B16;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xDPMSGetTimeoutsReply;
+#define sz_xDPMSGetTimeoutsReply 32
+
+typedef struct {
+ CARD8 reqType; /* always DPMSCode */
+ CARD8 dpmsReqType; /* always X_DPMSSetTimeouts */
+ CARD16 length B16;
+ CARD16 standby B16;
+ CARD16 suspend B16;
+ CARD16 off B16;
+ CARD16 pad0 B16;
+} xDPMSSetTimeoutsReq;
+#define sz_xDPMSSetTimeoutsReq 12
+
+typedef struct {
+ CARD8 reqType; /* always DPMSCode */
+ CARD8 dpmsReqType; /* always X_DPMSEnable */
+ CARD16 length B16;
+} xDPMSEnableReq;
+#define sz_xDPMSEnableReq 4
+
+typedef struct {
+ CARD8 reqType; /* always DPMSCode */
+ CARD8 dpmsReqType; /* always X_DPMSDisable */
+ CARD16 length B16;
+} xDPMSDisableReq;
+#define sz_xDPMSDisableReq 4
+
+typedef struct {
+ CARD8 reqType; /* always DPMSCode */
+ CARD8 dpmsReqType; /* always X_DPMSForceLevel */
+ CARD16 length B16;
+ CARD16 level B16; /* power level requested */
+ CARD16 pad0 B16;
+} xDPMSForceLevelReq;
+#define sz_xDPMSForceLevelReq 8
+
+typedef struct {
+ CARD8 reqType; /* always DPMSCode */
+ CARD8 dpmsReqType; /* always X_DPMSInfo */
+ CARD16 length B16;
+} xDPMSInfoReq;
+#define sz_xDPMSInfoReq 4
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 pad0;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 power_level B16;
+ BOOL state;
+ CARD8 pad1;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xDPMSInfoReply;
+#define sz_xDPMSInfoReply 32
+
+#endif /* _DPMSPROTO_H_ */
diff --git a/ge.h b/ge.h
new file mode 100644
index 0000000..aca1d8a
--- /dev/null
+++ b/ge.h
@@ -0,0 +1,60 @@
+/*
+ * 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
+ *
+ */
+
+#ifndef _GE_H_
+#define _GE_H_
+
+#define GE_NAME "Generic Event Extension"
+#define GE_MAJOR 1
+#define GE_MINOR 0
+
+/*********************************************************
+ *
+ * Requests
+ *
+ */
+
+#define X_GEQueryVersion 0
+
+#define GENumberRequests (X_GEQueryVersion + 1)
+
+/*********************************************************
+ *
+ * Events
+ *
+ */
+
+#define GENumberEvents 0
+
+/*********************************************************
+ *
+ * Errors
+ *
+ */
+
+#define GENumberErrors 0
+
+#endif /* _GE_H_ */
diff --git a/geproto.h b/geproto.h
new file mode 100644
index 0000000..c8860dd
--- /dev/null
+++ b/geproto.h
@@ -0,0 +1,85 @@
+/*
+ * 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
+ *
+ */
+
+#ifndef _GEPROTO_H_
+#define _GEPROTO_H_
+
+#include<X11/Xproto.h>
+#include<X11/X.h>
+#include<X11/extensions/ge.h>
+
+
+/*********************************************************
+ *
+ * Protocol request constants
+ *
+ */
+
+#define X_GEGetExtensionVersion 1
+
+/*********************************************************
+ *
+ * XGE protocol requests/replies
+ *
+ */
+
+/* generic request */
+typedef struct {
+ CARD8 reqType;
+ CARD8 ReqType;
+ CARD16 length B16;
+} xGEReq;
+
+
+/* QueryVersion */
+typedef struct {
+ CARD8 reqType; /* input extension major code */
+ CARD8 ReqType; /* always X_GEQueryVersion */
+ CARD16 length B16;
+ CARD16 majorVersion B16;
+ CARD16 minorVersion B16;
+} xGEQueryVersionReq;
+
+#define sz_xGEQueryVersionReq 8
+
+typedef struct {
+ CARD8 repType; /* X_Reply */
+ CARD8 RepType; /* always X_GEQueryVersion */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 majorVersion B16;
+ CARD16 minorVersion B16;
+ CARD32 pad00 B32;
+ CARD32 pad01 B32;
+ CARD32 pad02 B32;
+ CARD32 pad03 B32;
+ CARD32 pad04 B32;
+} xGEQueryVersionReply;
+
+#define sz_xGEQueryVersionReply 32
+
+#endif /* _GEPROTO_H_ */
+
diff --git a/lbx.h b/lbx.h
new file mode 100644
index 0000000..ecd24ff
--- /dev/null
+++ b/lbx.h
@@ -0,0 +1,73 @@
+/*
+ * 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 _LBX_H_
+#define _LBX_H_
+
+#define LBXNAME "LBX"
+
+#define LBX_MAJOR_VERSION 1
+#define LBX_MINOR_VERSION 0
+
+#define LbxNumberReqs 44
+#define LbxEvent 0
+#define LbxQuickMotionDeltaEvent 1
+#define LbxNumberEvents 2
+
+/* This is always the master client */
+#define LbxMasterClientIndex 0
+
+/* LbxEvent lbxType sub-fields */
+#define LbxSwitchEvent 0
+#define LbxCloseEvent 1
+#define LbxDeltaEvent 2
+#define LbxInvalidateTagEvent 3
+#define LbxSendTagDataEvent 4
+#define LbxListenToOne 5
+#define LbxListenToAll 6
+#define LbxMotionDeltaEvent 7
+#define LbxReleaseCmapEvent 8
+#define LbxFreeCellsEvent 9
+
+/*
+ * Lbx image compression methods
+ *
+ * No compression is always assigned the value of 0.
+ *
+ * The rest of the compression method opcodes are assigned dynamically
+ * at option negotiation time.
+ */
+
+#define LbxImageCompressNone 0
+
+
+#define BadLbxClient 0
+#define LbxNumberErrors (BadLbxClient + 1)
+
+/* tagged data types */
+#define LbxTagTypeModmap 1
+#define LbxTagTypeKeymap 2
+#define LbxTagTypeProperty 3
+#define LbxTagTypeFont 4
+#define LbxTagTypeConnInfo 5
+
+#endif
diff --git a/lbxproto.h b/lbxproto.h
new file mode 100644
index 0000000..a1ae62b
--- /dev/null
+++ b/lbxproto.h
@@ -0,0 +1,975 @@
+/*
+ * 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 _LBXPROTO_H_
+#define _LBXPROTO_H_
+
+#include <X11/extensions/lbx.h>
+/*
+ * NOTE: any changes or additions to the opcodes needs to be reflected
+ * in the lbxCacheable array in Xserver/lbx/lbxmain.c
+ */
+
+#define X_LbxQueryVersion 0
+#define X_LbxStartProxy 1
+#define X_LbxStopProxy 2
+#define X_LbxSwitch 3
+#define X_LbxNewClient 4
+#define X_LbxCloseClient 5
+#define X_LbxModifySequence 6
+#define X_LbxAllowMotion 7
+#define X_LbxIncrementPixel 8
+#define X_LbxDelta 9
+#define X_LbxGetModifierMapping 10
+#define X_LbxInvalidateTag 12
+#define X_LbxPolyPoint 13
+#define X_LbxPolyLine 14
+#define X_LbxPolySegment 15
+#define X_LbxPolyRectangle 16
+#define X_LbxPolyArc 17
+#define X_LbxFillPoly 18
+#define X_LbxPolyFillRectangle 19
+#define X_LbxPolyFillArc 20
+#define X_LbxGetKeyboardMapping 21
+#define X_LbxQueryFont 22
+#define X_LbxChangeProperty 23
+#define X_LbxGetProperty 24
+#define X_LbxTagData 25
+
+#define X_LbxCopyArea 26
+#define X_LbxCopyPlane 27
+#define X_LbxPolyText8 28
+#define X_LbxPolyText16 29
+#define X_LbxImageText8 30
+#define X_LbxImageText16 31
+
+#define X_LbxQueryExtension 32
+#define X_LbxPutImage 33
+#define X_LbxGetImage 34
+
+#define X_LbxBeginLargeRequest 35
+#define X_LbxLargeRequestData 36
+#define X_LbxEndLargeRequest 37
+
+#define X_LbxInternAtoms 38
+#define X_LbxGetWinAttrAndGeom 39
+
+#define X_LbxGrabCmap 40
+#define X_LbxReleaseCmap 41
+#define X_LbxAllocColor 42
+
+#define X_LbxSync 43
+
+/*
+ * Redefine some basic types used by structures defined herein. This removes
+ * any possibility on 64-bit architectures of one entity viewing communicated
+ * data as 32-bit quantities and another entity viewing the same data as 64-bit
+ * quantities.
+ */
+#define XID CARD32
+#define Atom CARD32
+#define Colormap CARD32
+#define Drawable CARD32
+#define VisualID CARD32
+#define Window CARD32
+
+typedef struct {
+ BOOL success; /* TRUE */
+ BOOL changeType;
+ CARD16 majorVersion B16,
+ minorVersion B16;
+ CARD16 length B16; /* 1/4 additional bytes in setup info */
+ CARD32 tag B32;
+} xLbxConnSetupPrefix;
+
+typedef struct _LbxQueryVersion {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxQueryVersion */
+ CARD16 length B16;
+} xLbxQueryVersionReq;
+#define sz_xLbxQueryVersionReq 4
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 unused;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 majorVersion B16; /* major version of LBX protocol */
+ CARD16 minorVersion B16; /* minor version of LBX protocol */
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+} xLbxQueryVersionReply;
+#define sz_xLbxQueryVersionReply 32
+
+typedef struct _LbxStartProxy {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxStartProxy */
+ CARD16 length B16;
+} xLbxStartProxyReq;
+#define sz_xLbxStartProxyReq 4
+
+typedef struct _LbxStopProxy {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxStopProxy */
+ CARD16 length B16;
+} xLbxStopProxyReq;
+#define sz_xLbxStopProxyReq 4
+
+typedef struct _LbxSwitch {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxSwitch */
+ CARD16 length B16;
+ CARD32 client B32; /* new client */
+} xLbxSwitchReq;
+#define sz_xLbxSwitchReq 8
+
+typedef struct _LbxNewClient {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxNewClient */
+ CARD16 length B16;
+ CARD32 client B32; /* new client */
+} xLbxNewClientReq;
+#define sz_xLbxNewClientReq 8
+
+typedef struct _LbxCloseClient {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxCloseClient */
+ CARD16 length B16;
+ CARD32 client B32; /* new client */
+} xLbxCloseClientReq;
+#define sz_xLbxCloseClientReq 8
+
+typedef struct _LbxModifySequence {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxModifySequence */
+ CARD16 length B16;
+ CARD32 adjust B32;
+} xLbxModifySequenceReq;
+#define sz_xLbxModifySequenceReq 8
+
+typedef struct _LbxAllowMotion {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxAllowMotion */
+ CARD16 length B16;
+ CARD32 num B32;
+} xLbxAllowMotionReq;
+#define sz_xLbxAllowMotionReq 8
+
+typedef struct {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxGrabCmap */
+ CARD16 length B16;
+ Colormap cmap B32;
+} xLbxGrabCmapReq;
+#define sz_xLbxGrabCmapReq 8
+
+#define LBX_SMART_GRAB 0x80
+#define LBX_AUTO_RELEASE 0x40
+#define LBX_3CHANNELS 0x20
+#define LBX_2BYTE_PIXELS 0x10
+#define LBX_RGB_BITS_MASK 0x0f
+
+#define LBX_LIST_END 0
+#define LBX_PIXEL_PRIVATE 1
+#define LBX_PIXEL_SHARED 2
+#define LBX_PIXEL_RANGE_PRIVATE 3
+#define LBX_PIXEL_RANGE_SHARED 4
+#define LBX_NEXT_CHANNEL 5
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 flags;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 pad0 B16;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B16;
+} xLbxGrabCmapReply;
+#define sz_xLbxGrabCmapReply 32
+#define sz_xLbxGrabCmapReplyHdr 8
+
+
+typedef struct {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxReleaseCmap */
+ CARD16 length B16;
+ Colormap cmap B32;
+} xLbxReleaseCmapReq;
+#define sz_xLbxReleaseCmapReq 8
+
+typedef struct {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxAllocColor */
+ CARD16 length B16;
+ Colormap cmap B32;
+ CARD32 pixel B32;
+ CARD16 red B16, green B16, blue B16;
+ CARD16 pad B16;
+} xLbxAllocColorReq;
+#define sz_xLbxAllocColorReq 20
+
+typedef struct _LbxIncrementPixel {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxIncrementPixel */
+ CARD16 length B16;
+ CARD32 cmap B32;
+ CARD32 pixel B32;
+} xLbxIncrementPixelReq;
+#define sz_xLbxIncrementPixelReq 12
+
+typedef struct _LbxDelta {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxDelta */
+ CARD16 length B16;
+ CARD8 diffs; /* number of diffs */
+ CARD8 cindex; /* cache index */
+ /* list of diffs follows */
+} xLbxDeltaReq;
+#define sz_xLbxDeltaReq 6
+
+typedef struct _LbxGetModifierMapping {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxGetModifierMapping */
+ CARD16 length B16;
+} xLbxGetModifierMappingReq;
+#define sz_xLbxGetModifierMappingReq 4
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 keyspermod;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 tag B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+} xLbxGetModifierMappingReply;
+#define sz_xLbxGetModifierMappingReply 32
+
+typedef struct _LbxGetKeyboardMapping {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxGetKeyboardMapping */
+ CARD16 length B16;
+ KeyCode firstKeyCode;
+ CARD8 count;
+ CARD16 pad1 B16;
+} xLbxGetKeyboardMappingReq;
+#define sz_xLbxGetKeyboardMappingReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 keysperkeycode;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 tag B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+} xLbxGetKeyboardMappingReply;
+#define sz_xLbxGetKeyboardMappingReply 32
+
+typedef struct _LbxQueryFont {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxQueryFont */
+ CARD16 length B16;
+ CARD32 fid B32;
+} xLbxQueryFontReq;
+#define sz_xLbxQueryFontReq 8
+
+typedef struct _LbxInternAtoms {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxInternAtoms */
+ CARD16 length B16;
+ CARD16 num B16;
+} xLbxInternAtomsReq;
+#define sz_xLbxInternAtomsReq 6
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 unused;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 atomsStart B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+} xLbxInternAtomsReply;
+#define sz_xLbxInternAtomsReply 32
+#define sz_xLbxInternAtomsReplyHdr 8
+
+
+typedef struct _LbxGetWinAttrAndGeom {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxGetWinAttrAndGeom */
+ CARD16 length B16;
+ CARD32 id B32; /* window id */
+} xLbxGetWinAttrAndGeomReq;
+#define sz_xLbxGetWinAttrAndGeomReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 backingStore;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* NOT 0; this is an extra-large reply */
+ VisualID visualID B32;
+#if defined(__cplusplus) || defined(c_plusplus)
+ CARD16 c_class B16;
+#else
+ CARD16 class B16;
+#endif
+ CARD8 bitGravity;
+ CARD8 winGravity;
+ CARD32 backingBitPlanes B32;
+ CARD32 backingPixel B32;
+ BOOL saveUnder;
+ BOOL mapInstalled;
+ CARD8 mapState;
+ BOOL override;
+ Colormap colormap B32;
+ CARD32 allEventMasks B32;
+ CARD32 yourEventMask B32;
+ CARD16 doNotPropagateMask B16;
+ CARD16 pad1 B16;
+ Window root B32;
+ INT16 x B16, y B16;
+ CARD16 width B16, height B16;
+ CARD16 borderWidth B16;
+ CARD8 depth;
+ CARD8 pad2;
+} xLbxGetWinAttrAndGeomReply;
+#define sz_xLbxGetWinAttrAndGeomReply 60
+
+
+typedef struct {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxSync */
+ CARD16 length B16;
+} xLbxSyncReq;
+#define sz_xLbxSyncReq 4
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 pad0;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xLbxSyncReply;
+#define sz_xLbxSyncReply 32
+
+
+/* an LBX squished charinfo packs the data in a CARD32 as follows */
+#define LBX_WIDTH_SHIFT 26
+#define LBX_LEFT_SHIFT 20
+#define LBX_RIGHT_SHIFT 13
+#define LBX_ASCENT_SHIFT 7
+#define LBX_DESCENT_SHIFT 0
+
+#define LBX_WIDTH_BITS 6
+#define LBX_LEFT_BITS 6
+#define LBX_RIGHT_BITS 7
+#define LBX_ASCENT_BITS 6
+#define LBX_DESCENT_BITS 7
+
+#define LBX_WIDTH_MASK 0xfc000000
+#define LBX_LEFT_MASK 0x03f00000
+#define LBX_RIGHT_MASK 0x000fe000
+#define LBX_ASCENT_MASK 0x00001f80
+#define LBX_DESCENT_MASK 0x0000007f
+
+#define LBX_MASK_BITS(val, n) ((unsigned int) ((val) & ((1 << (n)) - 1)))
+
+typedef struct {
+ CARD32 metrics B32;
+} xLbxCharInfo;
+
+/* note that this is identical to xQueryFontReply except for missing
+ * first 2 words
+ */
+typedef struct {
+ xCharInfo minBounds;
+/* XXX do we need to leave this gunk? */
+#ifndef WORD64
+ CARD32 walign1 B32;
+#endif
+ xCharInfo maxBounds;
+#ifndef WORD64
+ CARD32 walign2 B32;
+#endif
+ CARD16 minCharOrByte2 B16, maxCharOrByte2 B16;
+ CARD16 defaultChar B16;
+ CARD16 nFontProps B16; /* followed by this many xFontProp structures */
+ CARD8 drawDirection;
+ CARD8 minByte1, maxByte1;
+ BOOL allCharsExist;
+ INT16 fontAscent B16, fontDescent B16;
+ CARD32 nCharInfos B32; /* followed by this many xLbxCharInfo structures */
+} xLbxFontInfo;
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 compression;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 tag B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ /* X_QueryFont sticks much of the data in the base reply packet,
+ * but we hope that it won't be needed, (and it won't fit in 32 bytes
+ * with the tag anyways)
+ *
+ * if any additional data is needed, its sent in a xLbxFontInfo
+ */
+} xLbxQueryFontReply;
+#define sz_xLbxQueryFontReply 32
+
+typedef struct _LbxChangeProperty {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxChangeProperty */
+ CARD16 length B16;
+ Window window B32;
+ Atom property B32;
+ Atom type B32;
+ CARD8 format;
+ CARD8 mode;
+ BYTE pad[2];
+ CARD32 nUnits B32;
+} xLbxChangePropertyReq;
+#define sz_xLbxChangePropertyReq 24
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 pad;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 tag B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+} xLbxChangePropertyReply;
+#define sz_xLbxChangePropertyReply 32
+
+typedef struct _LbxGetProperty {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxGetProperty */
+ CARD16 length B16;
+ Window window B32;
+ Atom property B32;
+ Atom type B32;
+ CARD8 delete;
+ BYTE pad[3];
+ CARD32 longOffset B32;
+ CARD32 longLength B32;
+} xLbxGetPropertyReq;
+#define sz_xLbxGetPropertyReq 28
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 format;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ Atom propertyType B32;
+ CARD32 bytesAfter B32;
+ CARD32 nItems B32;
+ CARD32 tag B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+} xLbxGetPropertyReply;
+#define sz_xLbxGetPropertyReply 32
+
+typedef struct _LbxTagData {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxTagData */
+ CARD16 length B16;
+ XID tag B32;
+ CARD32 real_length B32;
+ /* data */
+} xLbxTagDataReq;
+#define sz_xLbxTagDataReq 12
+
+typedef struct _LbxInvalidateTag {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxInvalidateTag */
+ CARD16 length B16;
+ CARD32 tag B32;
+} xLbxInvalidateTagReq;
+#define sz_xLbxInvalidateTagReq 8
+
+typedef struct _LbxPutImage {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxPutImage */
+ CARD16 length B16;
+ CARD8 compressionMethod;
+ CARD8 cacheEnts;
+ CARD8 bitPacked;
+ /* rest is variable */
+} xLbxPutImageReq;
+#define sz_xLbxPutImageReq 7
+
+typedef struct {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxGetImage */
+ CARD16 length B16;
+ Drawable drawable B32;
+ INT16 x B16, y B16;
+ CARD16 width B16, height B16;
+ CARD32 planeMask B32;
+ CARD8 format;
+ CARD8 pad1;
+ CARD16 pad2 B16;
+} xLbxGetImageReq;
+
+#define sz_xLbxGetImageReq 24
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 depth;
+ CARD16 sequenceNumber B16;
+ CARD32 lbxLength B32;
+ CARD32 xLength B32;
+ VisualID visual B32;
+ CARD8 compressionMethod;
+ CARD8 pad1;
+ CARD16 pad2 B16;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xLbxGetImageReply;
+
+#define sz_xLbxGetImageReply 32
+
+/* Following used for LbxPolyPoint, LbxPolyLine, LbxPolySegment,
+ LbxPolyRectangle, LbxPolyArc, LbxPolyFillRectangle and LbxPolyFillArc */
+
+#define GFX_CACHE_SIZE 15
+
+#define GFXdCacheEnt(e) ((e) & 0xf)
+#define GFXgCacheEnt(e) (((e) >> 4) & 0xf)
+#define GFXCacheEnts(d,g) (((d) & 0xf) | (((g) & 0xf) << 4))
+
+#define GFXCacheNone 0xf
+
+typedef struct _LbxPolyPoint {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType;
+ CARD16 length B16;
+ CARD8 cacheEnts;
+ CARD8 padBytes;
+} xLbxPolyPointReq;
+
+#define sz_xLbxPolyPointReq 6
+
+typedef xLbxPolyPointReq xLbxPolyLineReq;
+typedef xLbxPolyPointReq xLbxPolySegmentReq;
+typedef xLbxPolyPointReq xLbxPolyRectangleReq;
+typedef xLbxPolyPointReq xLbxPolyArcReq;
+typedef xLbxPolyPointReq xLbxPolyFillRectangleReq;
+typedef xLbxPolyPointReq xLbxPolyFillArcReq;
+
+#define sz_xLbxPolyLineReq sz_xLbxPolyPointReq
+#define sz_xLbxPolySegmentReq sz_xLbxPolyPointReq
+#define sz_xLbxPolyRectangleReq sz_xLbxPolyPointReq
+#define sz_xLbxPolyArcReq sz_xLbxPolyPointReq
+#define sz_xLbxPolyFillRectangleReq sz_xLbxPolyPointReq
+#define sz_xLbxPolyFillArc sz_xLbxPolyPointReq
+
+typedef struct _LbxFillPoly {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType;
+ CARD16 length B16;
+ CARD8 cacheEnts;
+ BYTE shape;
+ CARD8 padBytes;
+} xLbxFillPolyReq;
+#define sz_xLbxFillPolyReq 7
+
+typedef struct _LbxCopyArea {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType;
+ CARD16 length B16;
+ CARD8 srcCache; /* source drawable */
+ CARD8 cacheEnts; /* dest drawable and gc */
+ /* followed by encoded src x, src y, dst x, dst y, width, height */
+} xLbxCopyAreaReq;
+
+#define sz_xLbxCopyAreaReq 6
+
+typedef struct _LbxCopyPlane {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType;
+ CARD16 length B16;
+ CARD32 bitPlane B32;
+ CARD8 srcCache; /* source drawable */
+ CARD8 cacheEnts; /* dest drawable and gc */
+ /* followed by encoded src x, src y, dst x, dst y, width, height */
+} xLbxCopyPlaneReq;
+
+#define sz_xLbxCopyPlaneReq 10
+
+typedef struct _LbxPolyText {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType;
+ CARD16 length B16;
+ CARD8 cacheEnts;
+ /* followed by encoded src x, src y coordinates and text elts */
+} xLbxPolyTextReq;
+
+#define sz_xLbxPolyTextReq 5
+
+typedef xLbxPolyTextReq xLbxPolyText8Req;
+typedef xLbxPolyTextReq xLbxPolyText16Req;
+
+#define sz_xLbxPolyTextReq 5
+#define sz_xLbxPolyText8Req 5
+#define sz_xLbxPolyText16Req 5
+
+typedef struct _LbxImageText {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType;
+ CARD16 length B16;
+ CARD8 cacheEnts;
+ CARD8 nChars;
+ /* followed by encoded src x, src y coordinates and string */
+} xLbxImageTextReq;
+
+typedef xLbxImageTextReq xLbxImageText8Req;
+typedef xLbxImageTextReq xLbxImageText16Req;
+
+#define sz_xLbxImageTextReq 6
+#define sz_xLbxImageText8Req 6
+#define sz_xLbxImageText16Req 6
+
+typedef struct {
+ CARD8 offset;
+ CARD8 diff;
+} xLbxDiffItem;
+#define sz_xLbxDiffItem 2
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 nOpts;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 optDataStart B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+} xLbxStartReply;
+#define sz_xLbxStartReply 32
+#define sz_xLbxStartReplyHdr 8
+
+typedef struct _LbxQueryExtension {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxQueryExtension */
+ CARD16 length B16;
+ CARD32 nbytes B32;
+} xLbxQueryExtensionReq;
+#define sz_xLbxQueryExtensionReq 8
+
+typedef struct _LbxQueryExtensionReply {
+ BYTE type; /* X_Reply */
+ CARD8 numReqs;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ BOOL present;
+ CARD8 major_opcode;
+ CARD8 first_event;
+ CARD8 first_error;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+
+ /* reply & event generating requests */
+} xLbxQueryExtensionReply;
+#define sz_xLbxQueryExtensionReply 32
+
+
+typedef struct _LbxBeginLargeRequest {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxBeginLargeRequest */
+ CARD16 length B16;
+ CARD32 largeReqLength B32;
+} xLbxBeginLargeRequestReq;
+#define sz_BeginLargeRequestReq 8
+
+typedef struct _LbxLargeRequestData {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxLargeRequestData */
+ CARD16 length B16;
+ /* followed by LISTofCARD8 data */
+} xLbxLargeRequestDataReq;
+#define sz_LargeRequestDataReq 4
+
+typedef struct _LbxEndLargeRequest {
+ CARD8 reqType; /* always LbxReqCode */
+ CARD8 lbxReqType; /* always X_LbxEndLargeRequest */
+ CARD16 length B16;
+} xLbxEndLargeRequestReq;
+#define sz_EndLargeRequestReq 4
+
+
+
+typedef struct _LbxSwitchEvent {
+ BYTE type; /* always eventBase + LbxEvent */
+ BYTE lbxType; /* LbxSwitchEvent */
+ CARD16 pad B16;
+ CARD32 client B32;
+} xLbxSwitchEvent;
+#define sz_xLbxSwitchEvent 8
+
+typedef struct _LbxCloseEvent {
+ BYTE type; /* always eventBase + LbxEvent */
+ BYTE lbxType; /* LbxCloseEvent */
+ CARD16 sequenceNumber B16;
+ CARD32 client B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xLbxCloseEvent;
+#define sz_xLbxCloseEvent 32
+
+typedef struct _LbxInvalidateTagEvent {
+ BYTE type; /* always eventBase + LbxEvent */
+ BYTE lbxType; /* LbxInvalidateTagEvent */
+ CARD16 sequenceNumber B16;
+ CARD32 tag B32;
+ CARD32 tagType B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xLbxInvalidateTagEvent;
+#define sz_xLbxInvalidateTagEvent 32
+
+typedef struct _LbxSendTagDataEvent {
+ BYTE type; /* always eventBase + LbxEvent */
+ BYTE lbxType; /* LbxSendTagDataEvent */
+ CARD16 sequenceNumber B16;
+ CARD32 tag B32;
+ CARD32 tagType B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xLbxSendTagDataEvent;
+#define sz_xLbxSendTagDataEvent 32
+
+typedef struct _LbxListenToOneEvent {
+ BYTE type; /* always eventBase + LbxEvent */
+ BYTE lbxType; /* LbxListenToOneEvent */
+ CARD16 sequenceNumber B16;
+ CARD32 client B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xLbxListenToOneEvent;
+#define sz_xLbxListenToOneEvent 32
+
+typedef struct _LbxListenToAllEvent {
+ BYTE type; /* always eventBase + LbxEvent */
+ BYTE lbxType; /* LbxListenToAllEvent */
+ CARD16 sequenceNumber B16;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+ CARD32 pad7 B32;
+} xLbxListenToAllEvent;
+#define sz_xLbxListenToOneEvent 32
+
+typedef struct _LbxReleaseCmapEvent {
+ BYTE type; /* always eventBase + LbxEvent */
+ BYTE lbxType; /* LbxReleaseCmapEvent */
+ CARD16 sequenceNumber B16;
+ Colormap colormap B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xLbxReleaseCmapEvent;
+#define sz_xLbxReleaseCmapEvent 32
+
+
+typedef struct _LbxFreeCellsEvent {
+ BYTE type; /* always eventBase + LbxEvent */
+ BYTE lbxType; /* LbxFreeCellsEvent */
+ CARD16 sequenceNumber B16;
+ Colormap colormap B32;
+ CARD32 pixelStart B32;
+ CARD32 pixelEnd B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+} xLbxFreeCellsEvent;
+#define sz_xLbxFreeCellsEvent 32
+
+
+/*
+ * squished X event sizes. If these change, be sure to update lbxquish.c
+ * and unsquish.c appropriately
+ *
+ * lbxsz_* is the padded squished length
+ * lbxupsz_* is the unpadded squished length
+ */
+
+#define lbxsz_KeyButtonEvent 32
+#define lbxupsz_KeyButtonEvent 31
+
+#define lbxsz_EnterLeaveEvent 32
+#define lbxupsz_EnterLeaveEvent 32
+
+#define lbxsz_FocusEvent 12
+#define lbxupsz_FocusEvent 9
+
+#define lbxsz_KeymapEvent 32
+#define lbxupsz_KeymapEvent 32
+
+#define lbxsz_ExposeEvent 20
+#define lbxupsz_ExposeEvent 18
+
+#define lbxsz_GfxExposeEvent 24
+#define lbxupsz_GfxExposeEvent 21
+
+#define lbxsz_NoExposeEvent 12
+#define lbxupsz_NoExposeEvent 11
+
+#define lbxsz_VisibilityEvent 12
+#define lbxupsz_VisibilityEvent 9
+
+#define lbxsz_CreateNotifyEvent 24
+#define lbxupsz_CreateNotifyEvent 23
+
+#define lbxsz_DestroyNotifyEvent 12
+#define lbxupsz_DestroyNotifyEvent 12
+
+#define lbxsz_UnmapNotifyEvent 16
+#define lbxupsz_UnmapNotifyEvent 13
+
+#define lbxsz_MapNotifyEvent 16
+#define lbxupsz_MapNotifyEvent 13
+
+#define lbxsz_MapRequestEvent 12
+#define lbxupsz_MapRequestEvent 12
+
+#define lbxsz_ReparentEvent 24
+#define lbxupsz_ReparentEvent 21
+
+#define lbxsz_ConfigureNotifyEvent 28
+#define lbxupsz_ConfigureNotifyEvent 27
+
+#define lbxsz_ConfigureRequestEvent 28
+#define lbxupsz_ConfigureRequestEvent 28
+
+#define lbxsz_GravityEvent 16
+#define lbxupsz_GravityEvent 16
+
+#define lbxsz_ResizeRequestEvent 12
+#define lbxupsz_ResizeRequestEvent 12
+
+#define lbxsz_CirculateEvent 20
+#define lbxupsz_CirculateEvent 17
+
+#define lbxsz_PropertyEvent 20
+#define lbxupsz_PropertyEvent 17
+
+#define lbxsz_SelectionClearEvent 16
+#define lbxupsz_SelectionClearEvent 16
+
+#define lbxsz_SelectionRequestEvent 28
+#define lbxupsz_SelectionRequestEvent 28
+
+#define lbxsz_SelectionNotifyEvent 24
+#define lbxupsz_SelectionNotifyEvent 24
+
+#define lbxsz_ColormapEvent 16
+#define lbxupsz_ColormapEvent 14
+
+#define lbxsz_MappingNotifyEvent 8
+#define lbxupsz_MappingNotifyEvent 7
+
+#define lbxsz_ClientMessageEvent 32
+#define lbxupsz_ClientMessageEvent 32
+
+#define lbxsz_UnknownEvent 32
+
+#ifdef DEBUG
+
+#define DBG_SWITCH 0x00000001
+#define DBG_CLOSE 0x00000002
+#define DBG_IO 0x00000004
+#define DBG_READ_REQ 0x00000008
+#define DBG_LEN 0x00000010
+#define DBG_BLOCK 0x00000020
+#define DBG_CLIENT 0x00000040
+#define DBG_DELTA 0x00000080
+#endif
+/*
+ * Cancel the previous redefinition of the basic types, thus restoring their
+ * X.h definitions.
+ */
+
+#undef XID
+#undef Atom
+#undef Colormap
+#undef Drawable
+#undef VisualID
+#undef Window
+
+#endif /* _LBXPROTO_H_ */
diff --git a/mitmiscconst.h b/mitmiscconst.h
new file mode 100644
index 0000000..adc5f94
--- /dev/null
+++ b/mitmiscconst.h
@@ -0,0 +1,38 @@
+/************************************************************
+
+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 _MITMISCCONST_H_
+#define _MITMISCCONST_H_
+
+#define MITMiscNumberEvents 0
+#define MITMiscNumberErrors 0
+
+#define MITMISCNAME "MIT-SUNDRY-NONSTANDARD"
+
+#endif
diff --git a/mitmiscproto.h b/mitmiscproto.h
new file mode 100644
index 0000000..18c202a
--- /dev/null
+++ b/mitmiscproto.h
@@ -0,0 +1,68 @@
+/************************************************************
+
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+********************************************************/
+
+/* RANDOM CRUFT! THIS HAS NO OFFICIAL X CONSORTIUM OR X PROJECT TEAM BLESSING */
+
+#ifndef _MITMISCPROTO_H_
+#define _MITMISCPROTO_H_
+
+#include <X11/extensions/mitmiscconst.h>
+
+#define X_MITSetBugMode 0
+#define X_MITGetBugMode 1
+
+typedef struct _SetBugMode {
+ CARD8 reqType; /* always MITReqCode */
+ CARD8 mitReqType; /* always X_MITSetBugMode */
+ CARD16 length B16;
+ BOOL onOff;
+ BYTE pad0;
+ CARD16 pad1;
+} xMITSetBugModeReq;
+#define sz_xMITSetBugModeReq 8
+
+typedef struct _GetBugMode {
+ CARD8 reqType; /* always MITReqCode */
+ CARD8 mitReqType; /* always X_MITGetBugMode */
+ CARD16 length B16;
+} xMITGetBugModeReq;
+#define sz_xMITGetBugModeReq 4
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL onOff;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xMITGetBugModeReply;
+#define sz_xMITGetBugModeReply 32
+
+#endif /* _MITMISCPROTO_H_ */
diff --git a/multibufconst.h b/multibufconst.h
new file mode 100644
index 0000000..2d1238c
--- /dev/null
+++ b/multibufconst.h
@@ -0,0 +1,83 @@
+/*
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+ */
+
+#ifndef _MULTIBUFCONST_H_
+#define _MULTIBUFCONST_H_
+
+#define MULTIBUFFER_PROTOCOL_NAME "Multi-Buffering"
+
+#define MULTIBUFFER_MAJOR_VERSION 1 /* current version numbers */
+#define MULTIBUFFER_MINOR_VERSION 1 /* has ClearImageBufferArea */
+
+/*
+ * update_action field
+ */
+#define MultibufferUpdateActionUndefined 0
+#define MultibufferUpdateActionBackground 1
+#define MultibufferUpdateActionUntouched 2
+#define MultibufferUpdateActionCopied 3
+
+/*
+ * update_hint field
+ */
+#define MultibufferUpdateHintFrequent 0
+#define MultibufferUpdateHintIntermittent 1
+#define MultibufferUpdateHintStatic 2
+
+/*
+ * valuemask fields
+ */
+#define MultibufferWindowUpdateHint (1L << 0)
+#define MultibufferBufferEventMask (1L << 0)
+
+/*
+ * mono vs. stereo and left vs. right
+ */
+#define MultibufferModeMono 0
+#define MultibufferModeStereo 1
+#define MultibufferSideMono 0
+#define MultibufferSideLeft 1
+#define MultibufferSideRight 2
+
+/*
+ * clobber state
+ */
+#define MultibufferUnclobbered 0
+#define MultibufferPartiallyClobbered 1
+#define MultibufferFullyClobbered 2
+
+/*
+ * event stuff
+ */
+#define MultibufferClobberNotifyMask 0x02000000
+#define MultibufferUpdateNotifyMask 0x04000000
+
+#define MultibufferClobberNotify 0
+#define MultibufferUpdateNotify 1
+#define MultibufferNumberEvents (MultibufferUpdateNotify + 1)
+
+#define MultibufferBadBuffer 0
+#define MultibufferNumberErrors (MultibufferBadBuffer + 1)
+
+#endif /* _MULTIBUFCONST_H_ */
diff --git a/multibufproto.h b/multibufproto.h
new file mode 100644
index 0000000..e2184d3
--- /dev/null
+++ b/multibufproto.h
@@ -0,0 +1,295 @@
+/*
+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 _MULTIBUFPROTO_H_
+#define _MULTIBUFPROTO_H_
+
+#include <X11/extensions/multibufconst.h>
+
+/*
+ * Protocol requests constants and alignment values
+ */
+
+#define Window CARD32
+#define Drawable CARD32
+#define VisualID CARD32
+#define Multibuffer CARD32
+
+#define X_MbufGetBufferVersion 0
+#define X_MbufCreateImageBuffers 1
+#define X_MbufDestroyImageBuffers 2
+#define X_MbufDisplayImageBuffers 3
+#define X_MbufSetMBufferAttributes 4
+#define X_MbufGetMBufferAttributes 5
+#define X_MbufSetBufferAttributes 6
+#define X_MbufGetBufferAttributes 7
+#define X_MbufGetBufferInfo 8
+#define X_MbufCreateStereoWindow 9
+#define X_MbufClearImageBufferArea 10
+
+
+typedef struct xMbufBufferInfo {
+ CARD32 visualID B32; /* associated visual */
+ CARD16 maxBuffers B16; /* maximum supported buffers */
+ CARD8 depth; /* depth of visual (redundant) */
+ CARD8 unused;
+} xMbufBufferInfo;
+#define sz_xMbufBufferInfo 8
+
+typedef struct {
+ BYTE type;
+ BYTE unused;
+ CARD16 sequenceNumber B16;
+ CARD32 buffer B32; /* affected buffer */
+ BYTE state; /* current status */
+ CARD8 unused1;
+ CARD16 unused2 B16;
+ CARD32 unused3 B32;
+ CARD32 unused4 B32;
+ CARD32 unused5 B32;
+ CARD32 unused6 B32;
+ CARD32 unused7 B32;
+} xMbufClobberNotifyEvent;
+
+typedef struct {
+ BYTE type;
+ BYTE unused;
+ CARD16 sequenceNumber B16;
+ CARD32 buffer B32; /* affected buffer */
+ CARD32 timeStamp B32; /* update time */
+ CARD32 unused1 B32;
+ CARD32 unused2 B32;
+ CARD32 unused3 B32;
+ CARD32 unused4 B32;
+ CARD32 unused5 B32;
+ CARD32 unused6 B32;
+} xMbufUpdateNotifyEvent;
+
+typedef struct {
+ CARD8 reqType; /* always codes->major_opcode */
+ CARD8 mbufReqType; /* always X_MbufGetBufferVersion */
+ CARD16 length B16;
+} xMbufGetBufferVersionReq;
+#define sz_xMbufGetBufferVersionReq 4
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 unused; /* not used */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD8 majorVersion; /* major version of Multi-Buffering protocol */
+ CARD8 minorVersion; /* minor version of Multi-Buffering protocol */
+ CARD16 pad1 B16;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xMbufGetBufferVersionReply;
+#define sz_xMbufGetBufferVersionReply 32
+
+typedef struct {
+ CARD8 reqType; /* always codes->major_opcode */
+ CARD8 mbufReqType; /* always X_MbufCreateImageBuffers */
+ CARD16 length B16;
+ CARD32 window B32; /* associated window */
+ CARD8 updateAction; /* action at update */
+ CARD8 updateHint; /* hint as to frequency of updates */
+ CARD16 unused;
+} xMbufCreateImageBuffersReq; /* followed by buffer ids */
+#define sz_xMbufCreateImageBuffersReq 12
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 unused; /* not used */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 numberBuffer B16; /* number successfully allocated */
+ CARD16 unused1 B16;
+ CARD32 unused2 B32;
+ CARD32 unused3 B32;
+ CARD32 unused4 B32;
+ CARD32 unused5 B32;
+ CARD32 unused6 B32;
+} xMbufCreateImageBuffersReply;
+#define sz_xMbufCreateImageBuffersReply 32
+
+typedef struct {
+ CARD8 reqType; /* always codes->major_opcode */
+ CARD8 mbufReqType; /* always X_MbufDestroyImageBuffers */
+ CARD16 length B16;
+ CARD32 window B32; /* associated window */
+} xMbufDestroyImageBuffersReq;
+#define sz_xMbufDestroyImageBuffersReq 8
+
+typedef struct {
+ CARD8 reqType; /* always codes->major_opcode */
+ CARD8 mbufReqType; /* always X_MbufDisplayImageBuffers */
+ CARD16 length B16;
+ CARD16 minDelay B16; /* minimum time between last update and now */
+ CARD16 maxDelay B16; /* maximum time between last update and now */
+} xMbufDisplayImageBuffersReq; /* followed by list of buffers */
+#define sz_xMbufDisplayImageBuffersReq 8
+
+typedef struct {
+ CARD8 reqType; /* always codes->major_opcode */
+ CARD8 mbufReqType; /* always X_MbufSetMBufferAttributes */
+ CARD16 length B16;
+ CARD32 window B32; /* associated window */
+ CARD32 valueMask B32; /* modified entries */
+} xMbufSetMBufferAttributesReq; /* followed by values */
+#define sz_xMbufSetMBufferAttributesReq 12
+
+typedef struct {
+ CARD8 reqType; /* always codes->major_opcode */
+ CARD8 mbufReqType; /* always X_MbufGetMBufferAttributes */
+ CARD16 length B16;
+ CARD32 window B32; /* associated window */
+} xMbufGetMBufferAttributesReq;
+#define sz_xMbufGetMBufferAttributesReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 unused; /* not used */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 displayedBuffer B16; /* currently visible buffer */
+ CARD8 updateAction;
+ CARD8 updateHint;
+ CARD8 windowMode;
+ CARD8 unused0;
+ CARD16 unused1 B16;
+ CARD32 unused2 B32;
+ CARD32 unused3 B32;
+ CARD32 unused4 B32;
+ CARD32 unused5 B32;
+} xMbufGetMBufferAttributesReply;
+#define sz_xMbufGetMBufferAttributesReply 32
+
+typedef struct {
+ CARD8 reqType; /* always codes->major_opcode */
+ CARD8 mbufReqType; /* always X_MbufSetBufferAttributes */
+ CARD16 length B16;
+ CARD32 buffer B32;
+ CARD32 valueMask B32;
+} xMbufSetBufferAttributesReq; /* followed by values */
+#define sz_xMbufSetBufferAttributesReq 12
+
+typedef struct {
+ CARD8 reqType; /* always codes->major_opcode */
+ CARD8 mbufReqType; /* always X_MbufGetBufferAttributes */
+ CARD16 length B16;
+ CARD32 buffer B32;
+} xMbufGetBufferAttributesReq;
+#define sz_xMbufGetBufferAttributesReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 unused; /* not used */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 window B32;
+ CARD32 eventMask B32;
+ CARD16 bufferIndex B16;
+ CARD8 side;
+ CARD8 unused0;
+ CARD32 unused1 B32;
+ CARD32 unused2 B32;
+ CARD32 unused3 B32;
+} xMbufGetBufferAttributesReply;
+#define sz_xMbufGetBufferAttributesReply 32
+
+typedef struct {
+ CARD8 reqType; /* always codes->major_opcode */
+ CARD8 mbufReqType; /* always X_MbufGetBufferInfo */
+ CARD16 length B16;
+ Drawable drawable B32;
+} xMbufGetBufferInfoReq;
+#define sz_xMbufGetBufferInfoReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 unused; /* not used */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 normalInfo B16;
+ CARD16 stereoInfo B16;
+ CARD32 unused1 B32;
+ CARD32 unused2 B32;
+ CARD32 unused3 B32;
+ CARD32 unused4 B32;
+ CARD32 unused5 B32;
+} xMbufGetBufferInfoReply; /* followed by buffer infos */
+#define sz_xMbufGetBufferInfoReply 32
+
+
+typedef struct {
+ CARD8 reqType; /* always codes->major_opcode */
+ CARD8 mbufReqType; /* always X_MbufCreateStereoWindow */
+ CARD16 length B16;
+ CARD8 unused0;
+ CARD8 unused1;
+ CARD8 unused2;
+ CARD8 depth;
+ Window wid B32;
+ Window parent B32;
+ Multibuffer left B32; /* associated buffers */
+ Multibuffer right B32;
+ INT16 x B16;
+ INT16 y B16;
+ CARD16 width B16;
+ CARD16 height B16;
+ CARD16 borderWidth B16;
+#if defined(__cplusplus) || defined(c_plusplus)
+ CARD16 c_class B16;
+#else
+ CARD16 class B16;
+#endif
+ VisualID visual B32;
+ CARD32 mask B32;
+} xMbufCreateStereoWindowReq; /* followed by value list */
+#define sz_xMbufCreateStereoWindowReq 44
+
+typedef struct {
+ CARD8 reqType; /* always codes->major_opcode */
+ CARD8 mbufReqType; /* always X_MbufClearImageBufferArea */
+ CARD16 length B16;
+ Multibuffer buffer B32;
+ INT16 x B16;
+ INT16 y B16;
+ CARD16 width B16;
+ CARD16 height B16;
+ CARD8 unused0;
+ CARD8 unused1;
+ CARD8 unused2;
+ BOOL exposures;
+} xMbufClearImageBufferAreaReq;
+#define sz_xMbufClearImageBufferAreaReq 20
+
+#undef Window
+#undef Drawable
+#undef VisualID
+#undef Multibuffer
+
+#endif /* _MULTIBUFPROTO_H_ */
diff --git a/secur.h b/secur.h
new file mode 100644
index 0000000..ca27b29
--- /dev/null
+++ b/secur.h
@@ -0,0 +1,61 @@
+/*
+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 _SECUR_H
+#define _SECUR_H
+
+#define SECURITY_EXTENSION_NAME "SECURITY"
+#define SECURITY_MAJOR_VERSION 1
+#define SECURITY_MINOR_VERSION 0
+
+#define XSecurityNumberEvents 1
+#define XSecurityNumberErrors 2
+#define XSecurityBadAuthorization 0
+#define XSecurityBadAuthorizationProtocol 1
+
+/* trust levels */
+#define XSecurityClientTrusted 0
+#define XSecurityClientUntrusted 1
+
+/* authorization attribute masks */
+#define XSecurityTimeout (1<<0)
+#define XSecurityTrustLevel (1<<1)
+#define XSecurityGroup (1<<2)
+#define XSecurityEventMask (1<<3)
+#define XSecurityAllAuthorizationAttributes \
+ (XSecurityTimeout | XSecurityTrustLevel | XSecurityGroup | XSecurityEventMask)
+
+/* event masks */
+#define XSecurityAuthorizationRevokedMask (1<<0)
+#define XSecurityAllEventMasks XSecurityAuthorizationRevokedMask
+
+/* event offsets */
+#define XSecurityAuthorizationRevoked 0
+
+#define XSecurityAuthorizationName "XC-QUERY-SECURITY-1"
+#define XSecurityAuthorizationNameLen 19
+
+#endif /* _SECUR_H */
diff --git a/securproto.h b/securproto.h
new file mode 100644
index 0000000..409a4c5
--- /dev/null
+++ b/securproto.h
@@ -0,0 +1,110 @@
+/*
+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 _SECURPROTO_H
+#define _SECURPROTO_H
+
+#include <X11/extensions/secur.h>
+
+#define X_SecurityQueryVersion 0
+#define X_SecurityGenerateAuthorization 1
+#define X_SecurityRevokeAuthorization 2
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 securityReqType;
+ CARD16 length B16;
+ CARD16 majorVersion B16;
+ CARD16 minorVersion B16;
+} xSecurityQueryVersionReq;
+#define sz_xSecurityQueryVersionReq 8
+
+typedef struct {
+ CARD8 type;
+ CARD8 pad0;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 majorVersion B16;
+ CARD16 minorVersion B16;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ } xSecurityQueryVersionReply;
+#define sz_xSecurityQueryVersionReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 securityReqType;
+ CARD16 length B16;
+ CARD16 nbytesAuthProto B16;
+ CARD16 nbytesAuthData B16;
+ CARD32 valueMask B32;
+ /* auth protocol name padded to 4 bytes */
+ /* auth protocol data padded to 4 bytes */
+ /* list of CARD32 values, if any */
+} xSecurityGenerateAuthorizationReq;
+#define sz_xSecurityGenerateAuthorizationReq 12
+
+typedef struct {
+ CARD8 type;
+ CARD8 pad0;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 authId B32;
+ CARD16 dataLength B16;
+ CARD16 pad1 B16;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ } xSecurityGenerateAuthorizationReply;
+#define sz_xSecurityGenerateAuthorizationReply 32
+
+typedef struct {
+ CARD8 reqType;
+ CARD8 securityReqType;
+ CARD16 length B16;
+ CARD32 authId B32;
+} xSecurityRevokeAuthorizationReq;
+#define sz_xSecurityRevokeAuthorizationReq 8
+
+typedef struct _xSecurityAuthorizationRevokedEvent {
+ BYTE type;
+ BYTE detail;
+ CARD16 sequenceNumber B16;
+ CARD32 authId B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xSecurityAuthorizationRevokedEvent;
+#define sz_xSecurityAuthorizationRevokedEvent 32
+
+#endif /* _SECURPROTO_H */
diff --git a/shapeconst.h b/shapeconst.h
new file mode 100644
index 0000000..9088956
--- /dev/null
+++ b/shapeconst.h
@@ -0,0 +1,55 @@
+/************************************************************
+
+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 _SHAPECONST_H_
+#define _SHAPECONST_H_
+
+/*
+ * Protocol requests constants and alignment values
+ * These would really be in SHAPE's X.h and Xproto.h equivalents
+ */
+
+#define SHAPENAME "SHAPE"
+
+#define SHAPE_MAJOR_VERSION 1 /* current version numbers */
+#define SHAPE_MINOR_VERSION 1
+
+#define ShapeSet 0
+#define ShapeUnion 1
+#define ShapeIntersect 2
+#define ShapeSubtract 3
+#define ShapeInvert 4
+
+#define ShapeBounding 0
+#define ShapeClip 1
+#define ShapeInput 2
+
+#define ShapeNotifyMask (1L << 0)
+#define ShapeNotify 0
+
+#define ShapeNumberEvents (ShapeNotify + 1)
+
+#endif /* _SHAPECONST_H_ */
diff --git a/shapeproto.h b/shapeproto.h
new file mode 100644
index 0000000..49bd1a1
--- /dev/null
+++ b/shapeproto.h
@@ -0,0 +1,237 @@
+/************************************************************
+
+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 _SHAPEPROTO_H_
+#define _SHAPEPROTO_H_
+
+#include <X11/extensions/shapeconst.h>
+
+/*
+ * Protocol requests constants and alignment values
+ * These would really be in SHAPE's X.h and Xproto.h equivalents
+ */
+
+#define Window CARD32
+#define Time CARD32
+
+#define X_ShapeQueryVersion 0
+#define X_ShapeRectangles 1
+#define X_ShapeMask 2
+#define X_ShapeCombine 3
+#define X_ShapeOffset 4
+#define X_ShapeQueryExtents 5
+#define X_ShapeSelectInput 6
+#define X_ShapeInputSelected 7
+#define X_ShapeGetRectangles 8
+
+typedef struct _ShapeQueryVersion {
+ CARD8 reqType; /* always ShapeReqCode */
+ CARD8 shapeReqType; /* always X_ShapeQueryVersion */
+ CARD16 length B16;
+} xShapeQueryVersionReq;
+#define sz_xShapeQueryVersionReq 4
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 unused; /* not used */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 majorVersion B16; /* major version of SHAPE protocol */
+ CARD16 minorVersion B16; /* minor version of SHAPE protocol */
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+} xShapeQueryVersionReply;
+#define sz_xShapeQueryVersionReply 32
+
+typedef struct _ShapeRectangles {
+ CARD8 reqType; /* always ShapeReqCode */
+ CARD8 shapeReqType; /* always X_ShapeRectangles */
+ CARD16 length B16;
+ CARD8 op; /* Set, ... */
+ CARD8 destKind; /* ShapeBounding or ShapeClip */
+ CARD8 ordering; /* UnSorted, YSorted, YXSorted, YXBanded */
+ CARD8 pad0; /* not used */
+ Window dest B32;
+ INT16 xOff B16;
+ INT16 yOff B16;
+} xShapeRectanglesReq; /* followed by xRects */
+#define sz_xShapeRectanglesReq 16
+
+typedef struct _ShapeMask {
+ CARD8 reqType; /* always ShapeReqCode */
+ CARD8 shapeReqType; /* always X_ShapeMask */
+ CARD16 length B16;
+
+ CARD8 op; /* Set, ... */
+ CARD8 destKind; /* ShapeBounding or ShapeClip */
+ CARD16 junk B16; /* not used */
+
+ Window dest B32;
+ INT16 xOff B16;
+ INT16 yOff B16;
+ CARD32 src B32; /* 1 bit pixmap */
+} xShapeMaskReq;
+#define sz_xShapeMaskReq 20
+
+typedef struct _ShapeCombine {
+ CARD8 reqType; /* always ShapeReqCode */
+ CARD8 shapeReqType; /* always X_ShapeCombine */
+ CARD16 length B16;
+ CARD8 op; /* Set, ... */
+ CARD8 destKind; /* ShapeBounding or ShapeClip */
+ CARD8 srcKind; /* ShapeBounding or ShapeClip */
+ CARD8 junk; /* not used */
+ Window dest B32;
+ INT16 xOff B16;
+ INT16 yOff B16;
+ Window src B32;
+} xShapeCombineReq;
+#define sz_xShapeCombineReq 20
+
+typedef struct _ShapeOffset {
+ CARD8 reqType; /* always ShapeReqCode */
+ CARD8 shapeReqType; /* always X_ShapeOffset */
+ CARD16 length B16;
+ CARD8 destKind; /* ShapeBounding or ShapeClip */
+ CARD8 junk1; /* not used */
+ CARD16 junk2 B16; /* not used */
+ Window dest B32;
+ INT16 xOff B16;
+ INT16 yOff B16;
+} xShapeOffsetReq;
+#define sz_xShapeOffsetReq 16
+
+typedef struct _ShapeQueryExtents {
+ CARD8 reqType; /* always ShapeReqCode */
+ CARD8 shapeReqType; /* always X_ShapeQueryExtents */
+ CARD16 length B16;
+ Window window B32;
+} xShapeQueryExtentsReq;
+#define sz_xShapeQueryExtentsReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 unused; /* not used */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* 0 */
+ CARD8 boundingShaped; /* window has bounding shape */
+ CARD8 clipShaped; /* window has clip shape */
+ CARD16 unused1 B16;
+ INT16 xBoundingShape B16; /* extents of bounding shape */
+ INT16 yBoundingShape B16;
+ CARD16 widthBoundingShape B16;
+ CARD16 heightBoundingShape B16;
+ INT16 xClipShape B16; /* extents of clip shape */
+ INT16 yClipShape B16;
+ CARD16 widthClipShape B16;
+ CARD16 heightClipShape B16;
+ CARD32 pad1 B32;
+} xShapeQueryExtentsReply;
+#define sz_xShapeQueryExtentsReply 32
+
+typedef struct _ShapeSelectInput {
+ CARD8 reqType; /* always ShapeReqCode */
+ CARD8 shapeReqType; /* always X_ShapeSelectInput */
+ CARD16 length B16;
+ Window window B32;
+ BYTE enable; /* xTrue -> send events */
+ BYTE pad1;
+ CARD16 pad2 B16;
+} xShapeSelectInputReq;
+#define sz_xShapeSelectInputReq 12
+
+typedef struct _ShapeNotify {
+ BYTE type; /* always eventBase + ShapeNotify */
+ BYTE kind; /* either ShapeBounding or ShapeClip */
+ CARD16 sequenceNumber B16;
+ Window window B32;
+ INT16 x B16;
+ INT16 y B16; /* extents of new shape */
+ CARD16 width B16;
+ CARD16 height B16;
+ Time time B32; /* time of change */
+ BYTE shaped; /* set when a shape actual exists */
+ BYTE pad0;
+ CARD16 pad1 B16;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+} xShapeNotifyEvent;
+#define sz_xShapeNotifyEvent 32
+
+typedef struct _ShapeInputSelected {
+ CARD8 reqType; /* always ShapeReqCode */
+ CARD8 shapeReqType; /* always X_ShapeInputSelected */
+ CARD16 length B16;
+ Window window B32;
+} xShapeInputSelectedReq;
+#define sz_xShapeInputSelectedReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 enabled; /* current status */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* 0 */
+ CARD32 pad1 B32; /* unused */
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xShapeInputSelectedReply;
+#define sz_xShapeInputSelectedReply 32
+
+typedef struct _ShapeGetRectangles {
+ CARD8 reqType; /* always ShapeReqCode */
+ CARD8 shapeReqType; /* always X_ShapeGetRectangles */
+ CARD16 length B16;
+ Window window B32;
+ CARD8 kind; /* ShapeBounding or ShapeClip */
+ CARD8 junk1;
+ CARD16 junk2 B16;
+} xShapeGetRectanglesReq;
+#define sz_xShapeGetRectanglesReq 12
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 ordering; /* UnSorted, YSorted, YXSorted, YXBanded */
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* not zero */
+ CARD32 nrects B32; /* number of rectangles */
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xShapeGetRectanglesReply; /* followed by xRectangles */
+#define sz_xShapeGetRectanglesReply 32
+
+#undef Window
+#undef Time
+
+#endif /* _SHAPEPROTO_H_ */
diff --git a/shapestr.h b/shapestr.h
new file mode 100644
index 0000000..20fde1d
--- /dev/null
+++ b/shapestr.h
@@ -0,0 +1,8 @@
+#ifndef _SHAPESTR_H_
+#define _SHAPESTR_H_
+
+#warning "shapestr.h is obsolete and may be removed in the future."
+#warning "include <X11/extensions/shapeproto.h> for the protocol defines."
+#include <X11/extensions/shapeproto.h>
+
+#endif /* _SHAPESTR_H_ */
diff --git a/shm.h b/shm.h
new file mode 100644
index 0000000..be49f5e
--- /dev/null
+++ b/shm.h
@@ -0,0 +1,44 @@
+/************************************************************
+
+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 _SHM_H_
+#define _SHM_H_
+
+#define SHMNAME "MIT-SHM"
+
+#define SHM_MAJOR_VERSION 1 /* current version numbers */
+#define SHM_MINOR_VERSION 2
+
+#define ShmCompletion 0
+#define ShmNumberEvents (ShmCompletion + 1)
+
+#define BadShmSeg 0
+#define ShmNumberErrors (BadShmSeg + 1)
+
+
+#endif /* _SHM_H_ */
diff --git a/shmproto.h b/shmproto.h
new file mode 100644
index 0000000..8136aa9
--- /dev/null
+++ b/shmproto.h
@@ -0,0 +1,229 @@
+/************************************************************
+
+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 _SHMPROTO_H_
+#define _SHMPROTO_H_
+
+#include <X11/extensions/shm.h>
+
+#define ShmSeg CARD32
+#define Drawable CARD32
+#define VisualID CARD32
+#define GContext CARD32
+#define Pixmap CARD32
+
+#define X_ShmQueryVersion 0
+#define X_ShmAttach 1
+#define X_ShmDetach 2
+#define X_ShmPutImage 3
+#define X_ShmGetImage 4
+#define X_ShmCreatePixmap 5
+#define X_ShmAttachFd 6
+#define X_ShmCreateSegment 7
+
+typedef struct _ShmQueryVersion {
+ CARD8 reqType; /* always ShmReqCode */
+ CARD8 shmReqType; /* always X_ShmQueryVersion */
+ CARD16 length B16;
+} xShmQueryVersionReq;
+#define sz_xShmQueryVersionReq 4
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL sharedPixmaps;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 majorVersion B16; /* major version of SHM protocol */
+ CARD16 minorVersion B16; /* minor version of SHM protocol */
+ CARD16 uid B16;
+ CARD16 gid B16;
+ CARD8 pixmapFormat;
+ CARD8 pad0;
+ CARD16 pad1 B16;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+} xShmQueryVersionReply;
+#define sz_xShmQueryVersionReply 32
+
+typedef struct _ShmAttach {
+ CARD8 reqType; /* always ShmReqCode */
+ CARD8 shmReqType; /* always X_ShmAttach */
+ CARD16 length B16;
+ ShmSeg shmseg B32;
+ CARD32 shmid B32;
+ BOOL readOnly;
+ BYTE pad0;
+ CARD16 pad1 B16;
+} xShmAttachReq;
+#define sz_xShmAttachReq 16
+
+typedef struct _ShmDetach {
+ CARD8 reqType; /* always ShmReqCode */
+ CARD8 shmReqType; /* always X_ShmDetach */
+ CARD16 length B16;
+ ShmSeg shmseg B32;
+} xShmDetachReq;
+#define sz_xShmDetachReq 8
+
+typedef struct _ShmPutImage {
+ CARD8 reqType; /* always ShmReqCode */
+ CARD8 shmReqType; /* always X_ShmPutImage */
+ CARD16 length B16;
+ Drawable drawable B32;
+ GContext gc B32;
+ CARD16 totalWidth B16;
+ CARD16 totalHeight B16;
+ CARD16 srcX B16;
+ CARD16 srcY B16;
+ CARD16 srcWidth B16;
+ CARD16 srcHeight B16;
+ INT16 dstX B16;
+ INT16 dstY B16;
+ CARD8 depth;
+ CARD8 format;
+ CARD8 sendEvent;
+ CARD8 bpad;
+ ShmSeg shmseg B32;
+ CARD32 offset B32;
+} xShmPutImageReq;
+#define sz_xShmPutImageReq 40
+
+typedef struct _ShmGetImage {
+ CARD8 reqType; /* always ShmReqCode */
+ CARD8 shmReqType; /* always X_ShmGetImage */
+ CARD16 length B16;
+ Drawable drawable B32;
+ INT16 x B16;
+ INT16 y B16;
+ CARD16 width B16;
+ CARD16 height B16;
+ CARD32 planeMask B32;
+ CARD8 format;
+ CARD8 pad0;
+ CARD8 pad1;
+ CARD8 pad2;
+ ShmSeg shmseg B32;
+ CARD32 offset B32;
+} xShmGetImageReq;
+#define sz_xShmGetImageReq 32
+
+typedef struct _ShmGetImageReply {
+ BYTE type; /* X_Reply */
+ CARD8 depth;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ VisualID visual B32;
+ CARD32 size B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+} xShmGetImageReply;
+#define sz_xShmGetImageReply 32
+
+typedef struct _ShmCreatePixmap {
+ CARD8 reqType; /* always ShmReqCode */
+ CARD8 shmReqType; /* always X_ShmCreatePixmap */
+ CARD16 length B16;
+ Pixmap pid B32;
+ Drawable drawable B32;
+ CARD16 width B16;
+ CARD16 height B16;
+ CARD8 depth;
+ CARD8 pad0;
+ CARD8 pad1;
+ CARD8 pad2;
+ ShmSeg shmseg B32;
+ CARD32 offset B32;
+} xShmCreatePixmapReq;
+#define sz_xShmCreatePixmapReq 28
+
+typedef struct _ShmCompletion {
+ BYTE type; /* always eventBase + ShmCompletion */
+ BYTE bpad0;
+ CARD16 sequenceNumber B16;
+ Drawable drawable B32;
+ CARD16 minorEvent B16;
+ BYTE majorEvent;
+ BYTE bpad1;
+ ShmSeg shmseg B32;
+ CARD32 offset B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+} xShmCompletionEvent;
+#define sz_xShmCompletionEvent 32
+
+/* Version 1.2 additions */
+typedef struct _ShmAttachFd {
+ CARD8 reqType; /* always ShmReqCode */
+ CARD8 shmReqType; /* always X_ShmAttachFd */
+ CARD16 length B16;
+ ShmSeg shmseg B32;
+ BOOL readOnly;
+ BYTE pad0;
+ CARD16 pad1 B16;
+} xShmAttachFdReq;
+/* File descriptor is passed with this request */
+#define sz_xShmAttachFdReq 12
+
+typedef struct _ShmCreateSegment {
+ CARD8 reqType; /* always ShmReqCode */
+ CARD8 shmReqType; /* always X_ShmAttachFd */
+ CARD16 length B16;
+ ShmSeg shmseg B32;
+ CARD32 size B32;
+ BOOL readOnly;
+ BYTE pad0;
+ CARD16 pad1 B16;
+} xShmCreateSegmentReq;
+#define sz_xShmCreateSegmentReq 16
+
+typedef struct {
+ CARD8 type; /* must be X_Reply */
+ CARD8 nfd; /* must be 1 */
+ CARD16 sequenceNumber B16; /* last sequence number */
+ CARD32 length B32; /* 0 */
+ CARD32 pad2 B32; /* unused */
+ CARD32 pad3 B32; /* unused */
+ CARD32 pad4 B32; /* unused */
+ CARD32 pad5 B32; /* unused */
+ CARD32 pad6 B32; /* unused */
+ CARD32 pad7 B32; /* unused */
+} xShmCreateSegmentReply;
+/* File descriptor is passed with this reply */
+#define sz_xShmCreateSegmentReply 32
+
+#undef ShmSeg
+#undef Drawable
+#undef VisualID
+#undef GContext
+#undef Pixmap
+
+#endif /* _SHMPROTO_H_ */
diff --git a/shmstr.h b/shmstr.h
new file mode 100644
index 0000000..78f3759
--- /dev/null
+++ b/shmstr.h
@@ -0,0 +1,63 @@
+/************************************************************
+
+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 _SHMSTR_H_
+#define _SHMSTR_H_
+
+#include <X11/extensions/shmproto.h>
+
+#ifdef _XSHM_SERVER_
+#define XSHM_PUT_IMAGE_ARGS \
+ DrawablePtr /* dst */, \
+ GCPtr /* pGC */, \
+ int /* depth */, \
+ unsigned int /* format */, \
+ int /* w */, \
+ int /* h */, \
+ int /* sx */, \
+ int /* sy */, \
+ int /* sw */, \
+ int /* sh */, \
+ int /* dx */, \
+ int /* dy */, \
+ char * /* data */
+
+#define XSHM_CREATE_PIXMAP_ARGS \
+ ScreenPtr /* pScreen */, \
+ int /* width */, \
+ int /* height */, \
+ int /* depth */, \
+ char * /* addr */
+
+typedef struct _ShmFuncs {
+ PixmapPtr (* CreatePixmap)(XSHM_CREATE_PIXMAP_ARGS);
+ void (* PutImage)(XSHM_PUT_IMAGE_ARGS);
+} ShmFuncs, *ShmFuncsPtr;
+#endif
+
+#endif /* _SHMSTR_H_ */
diff --git a/specs/.gitignore b/specs/.gitignore
new file mode 100644
index 0000000..92946c9
--- /dev/null
+++ b/specs/.gitignore
@@ -0,0 +1,5 @@
+*.html
+*.ps
+*.pdf
+*.txt
+*.db
diff --git a/specs/Makefile.am b/specs/Makefile.am
new file mode 100644
index 0000000..3b046a6
--- /dev/null
+++ b/specs/Makefile.am
@@ -0,0 +1,29 @@
+
+if ENABLE_SPECS
+
+# Main DocBook/XML files (DOCTYPE book)
+docbook = \
+ appgrp.xml \
+ dbe.xml \
+ dpms.xml \
+ evi.xml \
+ geproto.xml \
+ lbx.xml \
+ multibuf.xml \
+ security.xml \
+ shape.xml \
+ shm.xml \
+ sync.xml \
+ tog-cup.xml \
+ xtest.xml
+
+# Included chapters, appendix, images
+chapters = appendix.xml
+
+# The location where the DocBook/XML files and their generated formats are installed
+shelfdir = $(docdir)
+
+# Generate DocBook/XML output formats with or without stylesheets
+include $(top_srcdir)/docbook.am
+
+endif ENABLE_SPECS
diff --git a/specs/appendix.xml b/specs/appendix.xml
new file mode 100644
index 0000000..b6c0f1d
--- /dev/null
+++ b/specs/appendix.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE appendix
+ PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+<appendix id='system_window_encodings'>
+<title>System Window Encodings</title>
+
+<para>
+The AppGroupCreateAssoc request has the following possible variations:
+</para>
+
+<literallayout>
+<emphasis role='bold'>AppGroupCreateAssoc (X11)</emphasis>
+ 1 CARD8 opcode
+ 1 6 XC-APPGROUP opcode
+ 2 n length
+ 4 WINDOW window
+ 2 0 window_type
+ 2 4 system_window_len
+ 4 WINDOW Window
+</literallayout>
+
+<literallayout>
+<emphasis role='bold'>AppGroupCreateAssoc (Macintosh)</emphasis>
+ 1 CARD8 opcode
+ 1 6 XC-APPGROUP opcode
+ 2 n length
+ 4 WINDOW window
+ 2 1 window_type
+ 2 12 system_window_len
+ 4 CARD32 WindowPtr
+ 2 INT16 Rect.top
+ 2 INT16 Rect.left
+ 2 INT16 Rect.bottom
+ 2 INT16 Rect.right
+</literallayout>
+
+<literallayout>
+<emphasis role='bold'>AppGroupCreateAssoc (Win32)</emphasis>
+ 1 CARD8 opcode
+ 1 6 XC-APPGROUP opcode
+ 2 n length
+ 4 WINDOW window
+ 2 2 window_type
+ 2 4 system_window_len
+ 4 CARD32 HWND
+</literallayout>
+
+<literallayout>
+<emphasis role='bold'>AppGroupCreateAssoc (Win16)</emphasis>
+ 1 CARD8 opcode
+ 1 6 XC-APPGROUP opcode
+ 2 n length
+ 4 WINDOW window
+ 2 3 window_type
+ 2 4 system_window_len
+ 2 CARD16 HWND offset
+ 2 CARD16 HWND segment
+</literallayout>
+
+</appendix>
diff --git a/specs/appgrp.xml b/specs/appgrp.xml
new file mode 100644
index 0000000..0f91e16
--- /dev/null
+++ b/specs/appgrp.xml
@@ -0,0 +1,1041 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE article
+ PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+
+<article id="appgrp">
+
+<articleinfo>
+ <title>Application Group Extension to the X Protocol</title>
+ <subtitle>X Consortium Standard</subtitle>
+ <authorgroup>
+ <author>
+ <firstname>Kaleb</firstname>
+ <othername>S.</othername>
+ <surname>KEITHLEY</surname>
+ <affiliation><orgname>X Consortium, Inc</orgname></affiliation>
+ <email>kaleb@x.org</email>
+ </author>
+ </authorgroup>
+ <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
+ <releaseinfo>Version 1.0</releaseinfo>
+ <copyright><year>1996</year><holder>X Consortium, Inc.</holder>
+ </copyright>
+
+<legalnotice>
+<para>
+All Rights Reserved.
+</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 OF OR OTHER DEALINGS IN THE SOFTWARE.
+</para>
+<para>
+Except as contained in this notice, the name of the X Consortium shall not be used in advertising
+or otherwise to promote the sale, use or other dealings in this Software without prior written
+authorization from the X Consortium.
+</para>
+<para>X Window System is a trademark of The OpenGroup.</para>
+</legalnotice>
+
+<pubdate>27 September 1996</pubdate>
+
+<abstract>
+<para>
+The Application Group Extension to the X protocol is intended to provide a framework to allow
+more than one program to manage X applications on the desktop. The initial use of this extension
+will be to insert or embed the windows of X programs into the windows of another program, such
+as a web browser. This extension is not intended to address larger embedding issues that, for
+example, OpenDoc does, such as shared menu bars, etc.
+</para>
+</abstract>
+</articleinfo>
+
+<sect1 id='Purpose_and_Goals'>
+<title>Purpose and Goals</title>
+
+<para>
+The Application Group Extension to the X protocol is intended to provide
+a framework to allow more than one program to manage X applications on
+the desktop. The initial use of this extension will be to insert or embed
+the windows of X programs into the windows of another program, such as a
+web browser. This extension is not intended to address larger embedding
+issues that, for example, OpenDoc does, such as shared menu bars, etc.
+Using X programs on the World Wide Web allows for greater control of the
+presentation and takes advantage of the existing body of X programs rather
+than re-implement them in another language. In addition it allows the
+embedding of non-X programs into web browsers by using third party products
+like Wabi, MAE, and WinCenter.
+<footnote><para>
+Wabi is a trademark of Sun Microsystems, Inc. MAE is a trademark of Apple
+Computer, Inc. WinCenter is a trademark of Network Computing Devices, Inc.
+</para></footnote>
+</para>
+
+</sect1>
+
+<sect1 id='Overview_of_the_protocol'>
+<title>Overview of the protocol.</title>
+
+<para>
+This extension introduces the concept of an Application Group. An Application Group is a set of one or more applications that are primarily managed by a special application known as the Application Group Leader, which, for example, might be a web browser. The primary purpose of Application Groups is to provide a means of sharing the Substructure-Redirect attribute of the root window between the window manager and one or more Application Group Leaders.
+</para>
+
+<para>
+To join an Application Group an application must present the proper authorization during the connection setup. Authorizations are generated by the X server at the request of an Application Group Leader, and are then stored for the application to use to establish its connection to the X server. To generate an authorization the Application Group Leader sends a request to the server naming the Application Group to which the authorization will be bound, and any applications that connect using that authorization will automatically become part of the associated Application Group. The protocol to generate an authorization is defined in the Security Extension specification.
+</para>
+
+<para>
+As a member of an Application Group, when an application creates and maps a window as a child of the root window, the MapRequest and ConfigureRequest events are delivered to the Application Group Leader instead of the window manager. The Application Group Leader may then reparent the window into its own window hierarchy; or reissue the map request, in which case the window comes under the control of the window manager.
+</para>
+
+</sect1>
+<sect1 id='Requests'>
+<title>Requests</title>
+
+
+<para><emphasis role='bold'>AppGroupQueryVersion</emphasis></para>
+
+<informaltable frame='none'>
+<?dbfo keep-together="always" ?>
+<tgroup cols='1' colsep='0' rowsep='0'>
+<colspec colsep='0' colwidth='1.0*'/>
+<tbody>
+ <row>
+ <entry>client_major_version: CARD16</entry>
+ </row>
+ <row>
+ <entry>client_minor_version: CARD16</entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ <row>
+ <entry>server_major_version: CARD16</entry>
+ </row>
+ <row>
+ <entry>server_minor_version: CARD16</entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+<para>
+If supplied, the client_major_version and client_minor_version indicate what version of the protocol the application wants the server to implement. The server version numbers returned indicate the version of the protocol the X server actually supports. This may not match the versions requested by the application. An implementation may (but need not) support more than one version simultaneously. The server_major_version and server_minor_version numbers are a mechanism to support any future revisions of the Application Group extension protocol which may be necessary. In general, the major version would increment for incompatible changes, and the minor version would increment for small, upward-compatible changes. X servers that support the protocol defined in this document will return a server_major_version of 1 and a server_minor_version of 0.
+</para>
+
+
+<para><emphasis role='bold'>AppGroupCreate</emphasis></para>
+
+<informaltable frame='none'>
+<?dbfo keep-together="always" ?>
+<tgroup cols='1' colsep='0' rowsep='0'>
+<colspec colsep='0' colwidth='1.0*'/>
+<tbody>
+ <row>
+ <entry>app_group: APPGROUP</entry>
+ </row>
+ <row>
+ <entry>value_mask: BITMASK</entry>
+ </row>
+ <row>
+ <entry>value_list: LISTofVALUE</entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+<para>
+This request creates an Application Group using app_group as the Application Group ID.
+</para>
+
+
+<para>
+&nbsp;
+</para>
+
+
+<para>
+The value_mask and value_list specify attributes of the Application Group that are to be explicitly initialized. The attributes, their types, and the default values are:
+</para>
+
+<informaltable frame="topbot">
+<?dbfo keep-together="always" ?>
+<tgroup cols='3' colsep='0' rowsep='0'>
+<colspec colname='c1' colwidth='1.0*'/>
+<colspec colname='c2' colwidth='1.0*'/>
+<colspec colname='c3' colwidth='1.0*'/>
+<tbody>
+ <row rowsep='1'>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ </row>
+ <row>
+ <entry>app_group_leader</entry>
+ <entry>Bool</entry>
+ <entry>True</entry>
+ </row>
+ <row>
+ <entry>single_screen</entry>
+ <entry>Bool</entry>
+ <entry>True</entry>
+ </row>
+ <row>
+ <entry>default_root</entry>
+ <entry>Window</entry>
+ <entry>None</entry>
+ </row>
+ <row>
+ <entry>root_visual</entry>
+ <entry>VisualID</entry>
+ <entry>None</entry>
+ </row>
+ <row>
+ <entry>default_colormap</entry>
+ <entry>Colormap</entry>
+ <entry>None</entry>
+ </row>
+ <row>
+ <entry>black_pixel</entry>
+ <entry>Pixel</entry>
+ <entry>0</entry>
+ </row>
+ <row>
+ <entry>white_pixel</entry>
+ <entry>Pixel</entry>
+ <entry>0</entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+<para>
+If the single_screen attribute is True then the number of video screens returned to a program in the Application Group in the connection setup message is one, irrespective of how many video screens the server actually has. If a server supports both video and print screens, then all print screens will always be returned. If single_screen is specified as True then the connection setup message will contain only the information about the video screen which has default_root as its root window, plus any print screens.
+</para>
+
+<note><para>
+The intent is to allow an embedding manager to ensure that it will be able to reparent any top-level windows that Application Group members create. By hiding the fact that there are other screens it can be reasonably assured that applications will only create top-level windows on the same screen that it itself appears on. An embedding manager should take care not to supply an invalid display, e.g. :0.1, to a program that will be in an Application Group where the single_screen attribute is True.
+</para></note>
+
+<para>
+If single_screen is set to True default_root specifies which screen will be returned as screen zero in the connection setup message for applications in the Application Group. If set to None, then the real screen zero is used, otherwise the screen which has default_root as its root window will be used.
+</para>
+
+
+<para>
+If single_screen is set to True the root_visual and default_colormap attributes may be used to over-ride the default values that are returned in the connection setup information returned to new programs in the Application Group. If None is specified for root_visual or default_colormap then the normal default values for the screen (possibly spedified by default_root) are used, otherwise the specified values are used. If root_visual and/or default_colormap are specified they must be valid, i.e. root_visual must be a visual type available on the screen, and the colormap, if specified, must be a valid colormap for the visual that is used.
+</para>
+
+<para>
+IF single_screen is set to True and default_colormap is not specified as None, the black_pixel and white_pixel attributes must be specified, and they will over-ride the default values that are returned in the connection setup returned to new programs in the Application Group. If default_colormap is specified as None and black_pixel and/or white_pixel are specified, they will be ignored.
+</para>
+
+<para>
+The app_group_leader attribute is used to identify the Application Group Leader program for the app_group. By specifying True the server will identify the program making the request as the Application Group Leader for the application group. The Application Group Leader receives MapRequest and ConfigureRequest events from the server when an attempt is made to map or configure top-level windows of a program in an Application Group, instead of being sent to a window manager that has selected SubstructureRedirect events on the root window. The parent window field in these events will contain the Application Group ID.
+</para>
+
+<para><emphasis role='bold'>AppGroupDestroy</emphasis></para>
+
+<para>app_group: APPGROUP</para>
+
+
+<para>
+This request destroys the app_group. If the app_group_leader attribute for the app_group is True, then any applications in the Application Group that are still connected will be killed as if a KillClient request had been received for that application.
+</para>
+
+<note><para>
+If the application that created a non-embedded Application Group exits, and therefore any Authorizations to be cancelled, and any applications that attempt to open new connections to the X server using one of those Authorizations will be unable to do so.
+</para></note>
+
+<para><emphasis role='bold'>AppGroupGetAttr</emphasis></para>
+
+
+<informaltable frame='none'>
+<?dbfo keep-together="always" ?>
+<tgroup cols='1' colsep='0' rowsep='0'>
+<colspec colname='c1' colwidth='1.0*'/>
+<tbody>
+ <row>
+ <entry>>app_group: APPGROUP</entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ <row>
+ <entry>LISTofVALUE</entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+<para>
+This request returns the application group attributes for app_group.
+</para>
+
+<para><emphasis role='bold'>AppGroupQuery</emphasis></para>
+
+<informaltable frame='none'>
+<?dbfo keep-together="always" ?>
+<tgroup cols='1' colsep='0' rowsep='0'>
+<colspec colname='c1' colwidth='1.0*'/>
+<tbody>
+ <row>
+ <entry>resource: XID</entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ <row>
+ <entry>app_group: APPGROUP</entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+<para>
+This request returns the Application Group ID of the application that created resource or None if that application is not associated with any Application Group. The resource value may be the resource base of the application.
+</para>
+
+<para><emphasis role='bold'>AppGroupCreateAssociation</emphasis></para>
+
+<informaltable frame='none'>
+<?dbfo keep-together="always" ?>
+<tgroup cols='1' colsep='0' rowsep='0'>
+<colspec colname='c1' colwidth='1.0*'/>
+<tbody>
+ <row>
+ <entry>window: WINDOW</entry>
+ </row>
+ <row>
+ <entry>window_type: CARD32</entry>
+ </row>
+ <row>
+ <entry>system_window: LISTofCARD8</entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+<para>
+This request associates window with system_window. The window_type indicates the native window system of the application making the request. For non-X window_types both the embedding manager and the server must be executing on the same host. When system_window is Microsoft Windows or OS/2 Presentation Manager, the system_window is an HWND; when the native window system is Macintosh, the system_window is a WindowPtr and a Rect. The window may be used for any X request that takes a Window.
+</para>
+
+<para><emphasis role='bold'>AppGroupDestroyAssociation</emphasis></para>
+
+<informaltable frame='none'>
+<?dbfo keep-together="always" ?>
+<tgroup cols='1' colsep='0' rowsep='0'>
+<colspec colname='c1' colwidth='1.0*'/>
+<tbody>
+ <row>
+ <entry>window: WINDOW</entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+<para>
+This request destroys the association created with AppGroupCreateAssociation. The window is destroyed. The system_window that was specified in the AppGroupCreateAssociation request is not affected.
+</para>
+
+</sect1>
+
+<sect1 id='Changes_to_Existing_Requests'>
+<title>Changes to Existing Requests</title>
+
+<sect2 id='MapWindow'>
+<title>MapWindow</title>
+
+<para>
+If the override-redirect attribute of the window is False and if the window is a child of a root window and if the window belongs to an application that is in an application group and if some other application is the application group leader for that group, then a MapRequest event is generated and the window remains unmapped. Otherwise, the core protocol semantics apply.
+</para>
+
+</sect2>
+<sect2 id='ConfigureWindow'>
+<title>ConfigureWindow</title>
+
+<para>
+If the override-redirect attribute of the window is False and if the window is a child of a root window and if the window belongs to an application that is in an application group and if some other application is the application group leader for that group, then a ConfigureRequest event is generated and the window remains unchanged. Otherwise, the core protocol semantics apply.
+</para>
+
+</sect2>
+<sect2 id='CreateWindow'>
+<title>CreateWindow</title>
+
+<para>
+When a program in an Application Group creates a window that is a child of a root window and specifies CopyFromParent for the Visual, if the single_screen attribute is True and the root_visual attribute is set to something other than None, then the window will be created using the Application Group’s root_visual, otherwise core protocol semantics apply.
+</para>
+
+<para>
+When a program in an Application Group creates a window that is a child of a root window and specifies CopyFromParent for the Colormap, if the single_screen attribute is True, the default_colormap attribute is set to something other than None, and the window’s Visual is the same as the Application Group’s root_visual attribute, then the window will be created using the Application Group’s default_colormap, otherwise core protocol semantics apply.
+</para>
+
+</sect2>
+
+<sect2 id='ChangeWindowAttributes'>
+<title>ChangeWindowAttributes</title>
+
+<para>
+When a program in an Application Group changes the attributes of a window that is a child of a root window and specifies CopyFromParent for the Colormap, if the single_screen attribute is True, the default_colormap attribute is set to something other than None, and the window’s Visual is the same as the Application Group’s root_visual attribute, then the window will be created using the Application Group’s default_colormap, otherwise core protocol semantics apply.
+</para>
+
+</sect2>
+
+</sect1>
+
+<sect1 id='Changes_to_Existing_Events'>
+<title>Changes to Existing Events</title>
+
+<para>
+When the top-level window of an application that is a member of an Application Group is the target of a MapWindow or ConfigureWindow request, if there is an Application Group Leader then MapRequest and ConfigureRequest events are automatically delivered to it, otherwise the core protocol semantics apply, i.e. they are delivered to the client, if any, that has SubstructureRedirect set in its root-window event mask, e.g. the window manager.
+</para>
+
+<note><para>
+The Application Group Leader must not select SubstructuRedirect events on a root window as doing so would result in a core protocol error; only one client is permitted to do so, and that is usually the window manager.
+</para></note>
+
+
+<sect2 id='MapRequest'>
+<title>MapRequest</title>
+
+<para>
+When a MapWindow request is received for a window whose override-redirect attribut is set to False and whose parent is the root window and the window belongs to an application that is in an application group and there is an application group leader for the group, then this event is delivered to the Application Group Leader with the parent field in the event set to the AppGroup ID. Otherwise the core protocol semantics apply.
+</para>
+
+</sect2>
+<sect2 id='ConfigureRequest'>
+<title>ConfigureRequest</title>
+
+<para>
+When a ConfigureWindow request is received for a window whose override-redirect attribut is set to False and whose parent is the root window and the window belongs to an application that is in an application group and there is an application group leader for the group, then this event is delivered to the Application Group Leader with the parent field in the event set to the AppGroup ID. Otherwise the core protocol semantics apply.
+</para>
+
+</sect2>
+</sect1>
+
+<sect1 id='Errors'>
+<title>Errors</title>
+
+<sect2 id='AppGroupQueryVersion'>
+<title>AppGroupQueryVersion</title>
+
+<para>
+There are no errors for AppGroupQueryVersion.
+</para>
+
+</sect2>
+
+<sect2 id='AppGroupCreate'>
+<title>AppGroupCreate</title>
+
+<para>
+A Window error is returned if default_root is specified and is not a valid root window..
+</para>
+
+<para>
+A Color error is returned default_colormap is specified but default_colormap is not a valid colormap for the screen of default_root.
+</para>
+
+<para>
+A Match error is returned if root_visual and default_colormap are both specified, but
+</para>
+
+<para>
+default_colormap’s visual is not root_visual.
+</para>
+
+<para>
+A Match error is returned if root_visual does not exist for the screen of the default_root.
+</para>
+
+</sect2>
+
+<sect2 id='AppGroupDestroy'>
+<title>AppGroupDestroy</title>
+
+<para>
+An AppGroup error is returned if app_group is not a valid Application Group.
+</para>
+
+<para>
+An Access error is returned if an untrusted application attempts to destroy an Application Group created by a trusted application.
+</para>
+
+</sect2>
+
+<sect2 id='AppGroupGetAttr'>
+<title>AppGroupGetAttr</title>
+
+<para>
+An AppGroup error is returned if app_group is not a valid Application Group.
+</para>
+
+<para>
+An Access error is returned if an untrusted application attempts to get the attributes of an Application Group created by a trusted application.
+</para>
+
+</sect2>
+
+<sect2 id='AppGroupQuery'>
+<title>AppGroupQuery</title>
+
+<para>
+An Access error is returned if an untrusted application attempts to query the Application Group of a trusted application.
+</para>
+
+</sect2>
+
+<sect2 id='AppGroupCreateAssociation'>
+<title>AppGroupCreateAssociation</title>
+
+<para>
+A Match error is returned if the X server does not support the window_type.
+</para>
+
+<para>
+An Access error may be returned if the X server only supports the window_type on the local host and the program making the request is on a non-local host.
+</para>
+
+<para>
+A Window error may be returned for system-specific errors related to system_window, e.g. system_window does not represent a valid native window.
+</para>
+
+</sect2>
+
+<sect2 id='AppGroupDestroyAssociation'>
+<title>AppGroupDestroyAssociation</title>
+
+<para>
+A Window error is returned if window was not specified in a previous AppGroupCreateAssociation request.
+</para>
+
+</sect2>
+</sect1>
+
+<sect1 id='Encoding'>
+<title>Encoding</title>
+
+<para>
+Please refer to the X11 Protocol encoding document as this document uses conventions established there.
+</para>
+
+
+<para>
+The name of this extension is XC-APPGROUP
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>AppGroupQueryVersion</emphasis>
+ 1 CARD8 opcode
+ 1 0 XC-APPGROUP opcode
+ 2 3 length
+ 2 CARD16 client_major_version
+ 2 CARD16 client_minor_version
+=&gt;
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence_number
+ 4 0 length
+ 2 CARD16 server_major_version
+ 2 CARD16 server_minor_version
+ 20 unused
+</literallayout>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>AppGroupCreate</emphasis>
+ 1 CARD8 opcode
+ 1 1 XC-APPGROUP opcode
+ 2 8+n length
+ 4 XID app_group
+ 4 BITMASK attrib_mask
+ #x00000001 app_group_leader
+ #x00000002 single_screen
+ #0x0000004 default_root
+ #x00000008 root_visual
+ #x00000010 default_colormap
+ #x00000020 black_pixel
+ #x00000040 white_pixel
+ n LISTofVALUE value-list
+VALUEs
+ 4 BOOL app_group_leader
+ 4 BOOL single_screen
+ 4 WINDOW default_root
+ 4 VISUALID root_visual
+ 4 COLORMAP default_colormap
+ 4 CARD32 black_pixel
+ 4 CARD32 white_pixel
+</literallayout>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>AppGroupDestroy</emphasis>
+ 1 CARD8 opcode
+ 1 2 XC-APPGROUP opcode
+ 2 2 length
+ 4 XID app_group
+</literallayout>
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>AAppGroupGetAttr</emphasis>
+ 1 CARD8 opcode
+ 1 4 XC-APPGROUP opcode
+ 2 2 length
+ 4 XID app_group
+=&gt;
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence_number
+ 4 0 length
+ 4 WINDOW default_root
+ 4 VISUALID root_visual
+ 4 COLORMAP default_colormap
+ 4 CARD32 black_pixel
+ 4 CARD32 whte_pixel
+ 1 BOOL single_screen
+ 1 BOOL app_group_leader
+ 2 unused
+</literallayout>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>AppGroupQuery</emphasis>
+ 1 CARD8 opcode
+ 1 5 XC-APPGROUP opcode
+ 2 2 length
+ 4 XID resource
+=&gt;
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence_number
+ 4 0 length
+ 4 XID app_group
+ 20 unused
+</literallayout>
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>AppGroupCreateAssoc</emphasis>
+ 1 CARD8 opcode
+ 1 6 XC-APPGROUP opcode
+ 2 n length
+ 4 WINDOW window
+ 2 CARD16 window_type
+ #0 X11
+ #1 Macintosh
+ #2 Win32, OS/2 PM 2.x
+ #3 Win16, OS/2 PM 1.x
+ 2 n system_window_len
+ n LISTofCARD8 system_window
+</literallayout>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>AppGroupDestroyAssoc</emphasis>
+ 1 CARD8 opcode
+ 1 7 XC-APPGROUP opcode
+ 2 2 length
+ 4 WINDOW window
+</literallayout>
+
+</sect1>
+
+<sect1 id='Library_API'>
+<title>Library API</title>
+
+<informaltable frame='none'>
+<?dbfo keep-together="always" ?>
+<tgroup cols='1' colsep='0' rowsep='0'>
+<colspec colname='c1' colwidth='1.0*'/>
+<tbody>
+ <row>
+ <entry role='functiondecl'>
+Status <emphasis>XagQueryVersion</emphasis> (<emphasis> xkb, keycode</emphasis>) /* macro */
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+Display <emphasis>dpy</emphasis>;
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+int * <emphasis>major_version_return</emphasis>;
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+int * <emphasis>minor_version_return</emphasis>;
+ </entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+<para>
+XagQueryVersion sets major_version_return and minor_version_return to the major and minor Application Group protocol version supported by the server. If the Xag library is compatible with the version returned by the server it returns non-zero. If dpy does not support the Application Group extension, or if the server and library protocol versions are incompatible, or if there was an error during communication with the server, it returns zero. No other Xag functions may be called before this function. If a program violates this rule, the effects of all subsequent Xag calls that it makes are undefined.
+</para>
+
+<note><para>
+An embedding manager in, e.g. a Personal Computer Web Browser, will need to open a connection to the Personal Computer X server by calling XOpenDisplay() before using the Application Group extension.
+</para></note>
+
+<para>
+An embedding manager such as a web browser that intends to embed programs in an Application Group should create the Application Group with XagCreateEmbeddedApplicationGroup.
+</para>
+
+
+<informaltable frame='none'>
+<?dbfo keep-together="always" ?>
+<tgroup cols='1' colsep='0' rowsep='0'>
+<colspec colname='c1' colwidth='1.0*'/>
+<tbody>
+ <row>
+ <entry role='functiondecl'>
+Status XagCreateEmbeddedApplicationGroup(
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ Display* dpy,
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ VisualID root_visual,
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ Colormap default_colormap,
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ unsigned long black_pixel,
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ unsigned long white_pixel,
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ XAppGroup* app_group_return);
+ </entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+
+<para>
+XagCreateEmbeddedApplicationGroup creates an Application Group for an embedding manager with the attributes specified. It also sets the default_root attribute to DefaultRoot(dpy, DefaultsScreen(dpy)) and the single_screen and app_group_leader attributes to True. It returns the Application Group ID in app_group_return.
+</para>
+
+<para>
+You can create an Application Group without intending to do embedding. One reason for doing this is to give a group of clients their own font-path.
+</para>
+
+<note><para>
+A special font-path can be created by creating an Application Group, getting an Authorization using XSecurityGenerateAuthorization, and then running ‘xset fp+ &lt;new font path&gt;’ as a member of the Application Group. Font-path elements added in this way will be "private" to the Application Group.
+</para></note>
+
+<informaltable frame='none'>
+<?dbfo keep-together="always" ?>
+<tgroup cols='1' colsep='0' rowsep='0'>
+<colspec colname='c1' colwidth='1.0*'/>
+<tbody>
+ <row>
+ <entry role='functiondecl'>
+Status XagCreateNonembeddedApplicationGroup(
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ Display* dpy,
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ XAppGroup* app_group_return);
+ </entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+<para>
+An Application Group created with XagCreateNonembeddedApplicationGroup will have the default_root, root_visual, and default_colormap attributes all set to None; the single_screen and app_group_leader attributes are set to False, and the black_pixel and white_pixel attributes are not used since the default_colormap attribute is None.
+</para>
+
+<para>
+To destroy an Application Group use XagDestroyApplicationGroup.
+</para>
+
+<informaltable frame='none'>
+<?dbfo keep-together="always" ?>
+<tgroup cols='1' colsep='0' rowsep='0'>
+<colspec colname='c1' colwidth='1.0*'/>
+<tbody>
+ <row>
+ <entry role='functiondecl'>
+Status XagDestroyApplicationGroup(
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ Display* dpy,
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ XAppGroup app_group);
+ </entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+<para>
+The Application Group specified by app_group is destroyed. If the Application Group was created using XagCreateEmbeddingApplicationGroup, i.e. and therefore the app_group_leader attribute is True, all programs that are members of the Application Group are killed as if a KillClient request had been issued.
+</para>
+
+
+<para>
+To retrieve the attributes of an Application Group use XagGetApplicationGroupAttributes.
+</para>
+
+
+<informaltable frame='none'>
+<?dbfo keep-together="always" ?>
+<tgroup cols='1' colsep='0' rowsep='0'>
+<colspec colname='c1' colwidth='1.0*'/>
+<tbody>
+ <row>
+ <entry role='functiondecl'>
+Status XagGetApplicationGroupAttributes(
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ Display* dpy,
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ XAppGroup app_group,
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ ...);
+ </entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+
+
+<para>
+XagGetApplicationGroupAttributes is a varargs function that retrieves the Application Group’s attributes specified in the vararg parameter list.
+</para>
+
+<para>
+The attributes that may be specified are: XagNappGroupLeader, XagNsingleScreen, XagNdefaultRoot, XagNrootVisual, XagNdefaultColormap, XagNblackPixel, and XagNwhitePixel; which correspond to app_group_leader, single_screen, default_root, root_visual, default_colormap, black_pixel, and white_pixel respectively. See AppGroupCreate in Section 3 for a description of each attribute.
+</para>
+
+<para>
+The types for each of the parameters are pointers to the following:
+</para>
+
+<literallayout>
+ single_screen Bool
+ default_root Window
+ root_visual VisualID
+ default_colormap Colormap
+ black_pixel unsigned long
+ white_pixel unsigned long
+ app_group_leader Bool
+</literallayout>
+
+<para><programlisting>
+Example:
+ ...
+ Boolean app_group_leader, single_screen;
+ Window default_root;
+ VisualID root_visual;
+ Colormap default_colormap;
+ Pixel black_pixel, white_pixel;
+ ...
+ status = XagGetApplicationGroupAttributes(dpy, app_group,
+ XagNappGroupLeader, &amp;app_group_leader,
+ XagNsingleScreen, &amp;single_screen,
+ XagNdefault_root, &amp;default_root,
+ XagNrootVisual, &amp;root_visual,
+ XagNdefaultColormap, &amp;default_colormap,
+ XagNblackPixel, &amp;black_pixel,
+ XagNwhitePixel, &amp;white_pixel,
+ NULL);
+ ...
+</programlisting></para>
+
+
+<para>
+To determine which Application Group a resource (such as a window) belongs to, use XagQueryApplicationGroup.
+</para>
+
+<informaltable frame='none'>
+<?dbfo keep-together="always" ?>
+<tgroup cols='1' colsep='0' rowsep='0'>
+<colspec colname='c1' colwidth='1.0*'/>
+<tbody>
+ <row>
+ <entry role='functiondecl'>
+Status XagQueryApplicationGroup(
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ Display* dpy,
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ XID resource,
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ XAppGroup* app_group_return);
+ </entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+
+<para>
+The Application Group is returned in app_group_return, if the resource is not in any Application Group then app_group_return will be set to None.
+</para>
+
+<para>
+To associate an X Window ID with a system-specific window ID, such as a HWND or a WindowPtr, use XagCreateAssociation.
+</para>
+
+<informaltable frame='none'>
+<?dbfo keep-together="always" ?>
+<tgroup cols='1' colsep='0' rowsep='0'>
+<colspec colname='c1' colwidth='1.0*'/>
+<tbody>
+ <row>
+ <entry role='functiondecl'>
+Status XagCreateAssociation(
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ Display* dpy,
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ Window* window_return,
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ void* system_window);
+ </entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+
+<para>
+The window_ret may be used as the target for a ReparentWindow request.
+</para>
+
+<note><para>
+Because XReparentWindow is not constrained in the same way that Win32’s SetParent and the Macintosh are, there is no reason to call XagCreateAssociation in an X-based embedding manager. As such if XagCreateAssociation is called in a native X program, the window_return will be the same as the system_window, and the implementation may even elect to not generate any protocol.
+</para></note>
+
+<para>To create an association on the Macintosh:</para>
+
+<para><programlisting>
+ struct {
+ WindowPtr win;
+ Rect rect;
+ } system_window;
+ system_window.win = win_ptr;
+ system_window.rect.top = system_window.rect.left = 20;
+ system_window.rect.bottom = 180;
+ system_window.rect.right = 380;
+</programlisting></para>
+
+<para><programlisting>
+ status = XagCreateAssociation (dpy, &amp;window, (void*)&amp;system_window);
+</programlisting></para>
+
+<para>
+To create an association using a Win16, Win32, or OS/2 PM:
+</para>
+
+<para><programlisting>
+ HWND system_window;
+ status = XagCreateAssociation (dpy, &amp;window, (void*)&amp;system_window);
+</programlisting></para>
+
+<para>
+To destroy the association created with XagCreateAssociation use XagDestroyAssociation.
+</para>
+
+
+<informaltable frame='none'>
+<?dbfo keep-together="always" ?>
+<tgroup cols='1' colsep='0' rowsep='0'>
+<colspec colname='c1' colwidth='1.0*'/>
+<tbody>
+ <row>
+ <entry role='functiondecl'>
+Status XagDestroyAssociation(
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ Display* dpy,
+ </entry>
+ </row>
+ <row>
+ <entry role='functionargdecl'>
+ Window window);
+ </entry>
+ </row>
+</tbody>
+</tgroup>
+</informaltable>
+
+<para>
+After calling XagDestroyAssociation the window may no longer be used to
+reparent windows with XReparentWindow.
+</para>
+
+<note><para>
+Like XagCreateAssociation, if the native window system is X11 the implementation may elect to not generate any protocol as a result of this function call in order to avoid unintentionally destroying the the system_window that was specified in the prior XagCreateAssociation call.
+</para></note>
+</sect1>
+<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="appendix.xml"/>
+</article>
diff --git a/specs/dbe.xml b/specs/dbe.xml
new file mode 100644
index 0000000..5af90a6
--- /dev/null
+++ b/specs/dbe.xml
@@ -0,0 +1,1065 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+
+
+<!--
+by TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)
+xhtml,docbook,html,refcaption -->
+
+<book id="dbe">
+
+<bookinfo>
+ <title>Double Buffer Extension Protocol</title>
+ <subtitle>X Consortium Standard</subtitle>
+ <authorgroup>
+ <author>
+ <firstname>Ian</firstname><surname>Elliott</surname>
+ <affiliation><orgname>Hewlett-Packard Company</orgname></affiliation>
+ </author>
+ <othercredit>
+ <firstname>David</firstname><othername>P.</othername><surname>Wiggins</surname>
+ <affiliation><orgname>X Consortium</orgname></affiliation>
+ </othercredit>
+ </authorgroup>
+ <copyright><year>1989</year><year>1992</year><year>1993</year><year>1994</year>
+ <holder>X Consortium, Inc.</holder>
+ </copyright>
+ <copyright><year>1989</year><holder>Digital Equipment Corporation</holder></copyright>
+ <copyright><year>1992</year><holder>Intergraph Corporation</holder></copyright>
+ <copyright><year>1993</year><holder>Silicon Graphics, Inc.</holder></copyright>
+ <copyright><year>1994</year><holder>Hewlett-Packard Company</holder></copyright>
+ <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
+ <releaseinfo>Version 1.0</releaseinfo>
+
+<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 &ldquo;as is&rdquo;
+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 <function>CreateWindow</function>
+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. In
+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 <function>ClearArea</function> 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 DRAWABLE 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 windo'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 <function>IncludeInferiors</function>, 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 windo'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 windo'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.
+</para>
+
+<para>
+If the core <function>GetGeometry</function> 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>
+ 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>DBEBeginIdiom 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 PolyFillRectangle request to the back buffer of one window.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Core X PolyFillRectangle request to the back buffer of the other window.
+ </para>
+ </listitem>
+ <listitem>
+ <para>DBEEndIdiom 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 Copied 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 Untouched, and if a <function>PolyFillRectangle</function>
+using a client clip rectangle is done to the windo'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='Requests'>
+<title>Requests</title>
+<para>The DBE defines the following requests.</para>
+
+<sect1 id='DBEGetVersion'>
+<title>DBEGetVersion</title>
+<para>
+This request returns the major and minor version numbers of this extension.
+</para>
+
+<para>DBEGetVersion</para>
+<informaltable frame='none'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols="2" align='left' colsep='0' rowsep='0'>
+ <colspec colname="c1" colwidth='1.0*'/>
+ <colspec colname="c2" colwidth='2.0*'/>
+ <tbody>
+ <row>
+ <entry>client-major-version</entry>
+ <entry>CARD8</entry>
+ </row>
+ <row>
+ <entry>client-minor-version </entry>
+ <entry>CARD8</entry>
+ </row>
+ <row>
+ <entry>=></entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>server-major-version </entry>
+ <entry>CARD8</entry>
+ </row>
+ <row>
+ <entry>server-minor-version </entry>
+ <entry>CARD8</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+The client-major-version and client-minor-version numbers indicate what
+version of the protocol the client wants the server to implement. The
+server-major-version and the server-minor-version numbers returned indicate
+the protocol this extension actually supports. This might not equal the
+version sent by the client. An implementation can (but need not) support
+more than one version simultaneously. The server-major-version and
+server-minor-version allow the creation of future revisions of the DBE
+protocol that may be necessary. In general, the major version
+would increment for incompatible changes, and the minor version would increment
+for small, upward-compatible changes. Servers that support the protocol
+defined in this document will return a server-major-version of one (1), and a
+server-minor-version of zero (0).
+</para>
+
+<para>
+The DBE client must issue a DBEGetVersion request before any other double
+buffering request in order to negotiate a compatible protocol version;
+otherwise, the client will get undefined behavior (DBE may or may not work).
+</para>
+
+</sect1>
+
+<sect1 id='DBEGetVisualInfo'>
+<title>DBEGetVisualInfo</title>
+<para>
+This request returns information about which visuals support double buffering.
+</para>
+
+<para>DBEGetVisualInfo</para>
+
+<informaltable frame='none'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols="2" align='left' colsep='0' rowsep='0'>
+ <colspec colname="c1" colwidth='1.0*'/>
+ <colspec colname="c2" colwidth='2.0*'/>
+ <tbody>
+ <row>
+ <entry>screen-specifiers</entry>
+ <entry>LISTofDRAWABLE</entry>
+ </row>
+ <row>
+ <entry>=></entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>visinfo</entry>
+ <entry>LISTofSCREENVISINFO</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+<para>where:</para>
+
+<informaltable frame='none'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols="2" align='left' colsep='0' rowsep='0'>
+ <colspec colname="c1" colwidth='1.0*'/>
+ <colspec colname="c2" colwidth='2.0*'/>
+ <tbody>
+ <row>
+ <entry>SCREENVISINFO</entry>
+ <entry>LISTofVISINFO</entry>
+ </row>
+ <row>
+ <entry>VISINFO</entry>
+ <entry>[ visual: VISUALID</entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry>depth: CARD8</entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry>perflevel: CARD8 ]</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>Errors: Drawable</para>
+
+<para>
+All of the values passed in screen-specifiers must be valid DRAWABLEs (or a
+<function>Drawable</function> error results). For each drawable in
+screen-specifiers, the reply will contain a list of VISINFO structures for
+visuals that support double-buffering on the screen on which the drawable
+resides. The visual member specifies the VISUALID. The depth member specifies
+the depth in bits for the visual. The perflevel is a performance hint. The
+only operation defined on a perflevel is comparison to a perflevel of another
+visual on the same screen. The visual having the higher perflevel is likely
+to have better double-buffer graphics performance than the visual having the
+lower perflevel. Nothing can be deduced from any of the following: the
+magnitude of the difference of two perflevels, a perflevel value in isolation,
+or comparing perflevels from different servers.
+</para>
+
+<para>
+If the list of screen-specifiers is empty, information for all screens is
+returned, starting with screen zero.
+</para>
+
+</sect1>
+
+<sect1 id='DBEAllocateBackBufferName'>
+<title>DBEAllocateBackBufferName</title>
+
+<para>
+This request allocates a drawable ID used to refer to the back buffer of a
+window.
+</para>
+
+<para>DBEAllocateBackBufferName</para>
+
+<informaltable frame='none'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols="2" align='left' colsep='0' rowsep='0'>
+ <colspec colname="c1" colwidth='1.0*'/>
+ <colspec colname="c2" colwidth='2.0*'/>
+ <tbody>
+ <row>
+ <entry>window</entry>
+ <entry>WINDOW</entry>
+ </row>
+ <row>
+ <entry>back-buffer-name</entry>
+ <entry>BACKBUFFER</entry>
+ </row>
+ <row>
+ <entry>swap-action-hint</entry>
+ <entry>SWAPACTION </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+Errors: Alloc, Value, IDChoice, Match, Window
+</para>
+
+<para>
+If the window is not already a double-buffered window, the window becomes
+double-buffered, and the back-buffer-name is associated with the window. The
+swap-action-hint tells the server which swap action is most likely to be
+used with the window in subsequent <function>DBESwapBuffers</function>
+requests. The swap-action-hint must have one of the values specified for type
+SWAPACTION (or a Value error results). See the description of the
+<function>DBESwapBuffers</function> request for a complete discussion of
+swap actions and the SWAPACTION type.
+</para>
+
+<para>
+If the window already is a double-buffered window, nothing about the window
+changes, except that an additional 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>
+The window passed into the request must be a valid WINDOW (or a Window error
+results). The window passed into the request must be an InputOutput window (or
+a Match error results). The visual of the window must be in the list returned
+by <function>DBEGetVisualInfo</function> (or a Match error results). The
+back-buffer-name must be in the range assigned to the client, and must not
+already be in use (or an IDChoice error results). If the server cannot
+allocate all resources associated with turning on double-buffering for the
+window, an Alloc error results, the windo's double-buffer status (whether it
+is already double-buffered or not) remains unchanged, and the
+back-buffer-name is freed.
+</para>
+</sect1>
+
+<sect1 id='DBEDeallocateBackBufferName'>
+<title>DBEDeallocateBackBufferName</title>
+<para>
+This request frees a drawable ID that was obtained by
+<function>DBEAllocateBackBufferName</function>.
+</para>
+
+<para>DBEDeallocateBackBufferName</para>
+
+<informaltable frame='none'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols="2" align='left' colsep='0' rowsep='0'>
+ <colspec colname="c1" colwidth='1.0*'/>
+ <colspec colname="c2" colwidth='2.0*'/>
+ <tbody>
+ <row>
+ <entry>back-buffer-name</entry>
+ <entry>BACKBUFFER</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>Errors: Buffer</para>
+
+<para>
+The back-buffer-name passed in the request is freed and no longer associated
+with the window. If this is the last back-buffer-name associated with the
+window, then the back buffer is no longer accessible to clients, and all
+double-buffering resources associated with the window may be freed. The
+window's current front buffer remains the front buffer.
+</para>
+
+<para>
+The back-buffer-name must be a valid BACKBUFFER associated with a window (or
+a Buffer error results).
+</para>
+</sect1>
+
+<sect1 id='DBESwapBuffers'>
+<title>DBESwapBuffers</title>
+<para>
+This request swaps the buffers for all windows listed, applying the
+appropriate swap action for each window.
+</para>
+
+<para><function>DBESwapBuffers</function></para>
+
+<informaltable frame='none'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols="2" align='left' colsep='0' rowsep='0'>
+ <colspec colname="c1" colwidth='1.0*'/>
+ <colspec colname="c2" colwidth='3.0*'/>
+ <tbody>
+ <row>
+ <entry>windows</entry>
+ <entry>LISTofSWAPINFO</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+<para>where:</para>
+<informaltable frame='none'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols="2" align='left' colsep='0' rowsep='0'>
+ <colspec colname="c1" colwidth='1.0*'/>
+ <colspec colname="c2" colwidth='2.0*'/>
+ <tbody>
+ <row>
+ <entry>SWAPINFO</entry>
+ <entry>[ window: WINDOW</entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry>swap-action: SWAPACTION ]</entry>
+ </row>
+ <row>
+ <entry>SWAPACTION</entry>
+ <entry>{ Undefined, Background, Untouched, Copied }</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>Errors: Match, Window, Value</para>
+
+<para>
+Each window passed into the request must be a valid WINDOW (or a
+<function>Window</function> error results). Each window passed into the
+request must be a double-buffered window (or a <function>Match</function>
+error results). Each window passed into the request must only be listed
+once (or a <function>Match</function> error results). Each swap-action in
+the list must have one of the values specified for type SWAPACTION (or a
+<function>Value</function> error results). If an error results, none of
+the valid double-buffered windows will have their buffers swapped.
+</para>
+
+<para>
+The swap-action determines what will happen to the new back buffer of the
+window it is paired with in the list in addition to making the old back
+buffer become visible. The defined actions are as follows:
+</para>
+
+<variablelist>
+ <varlistentry>
+ <term>Undefined</term>
+ <listitem><para>
+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.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Background</term>
+ <listitem><para>
+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.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Untouched</term>
+ <listitem><para>
+The unobscured region of the new back buffer will be unmodified by the swap.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Copied</term>
+ <listitem><para>
+The unobscured region of the new back buffer will be the contents of the
+old back buffer.
+ </para></listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+If <function>DBESwapBuffers</function> is included in a "swap and clear"
+type of idiom, it must immediately follow the
+<function>DBEBeginIdiom</function> request.
+</para>
+</sect1>
+
+<sect1 id='DBEBeginIdiom'>
+<title>DBEBeginIdiom</title>
+<para>
+This request informs the server that a complex swap will immediately follow
+this request.
+</para>
+
+<para><function>DBEBeginIdiom</function></para>
+
+<para>
+As previously discussed, a complex swap action is a group/series of
+requests that, taken together, may be combined into an atomic operation by
+the implementation. The sole function of this request is to serve as a
+"marker" that the server can use to aid in idiom processing. The server is
+free to implement this request as a no-op.
+</para>
+</sect1>
+
+<sect1 id='DBEEndIdiom'>
+<title>DBEEndIdiom</title>
+
+
+<para>
+This request informs the server that a complex swap has concluded.
+</para>
+
+<para><function>DBEEndIdiom</function></para>
+
+<para>
+The sole function of this request is to serve as a "marker" that the server
+can use to aid in idiom processing. The server is free to implement this
+request as a no-op.
+</para>
+
+</sect1>
+
+<sect1 id='DBEGetBackBufferAttributes'>
+<title>DBEGetBackBufferAttributes</title>
+
+<para>This request returns information about a back buffer.</para>
+
+<para><function>DBEGetBackBufferAttributes</function></para>
+
+<informaltable frame='none'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols="2" align='left' colsep='0' rowsep='0'>
+ <colspec colname="c1" colwidth='1.0*'/>
+ <colspec colname="c2" colwidth='2.0*'/>
+ <tbody>
+ <row>
+ <entry>back-buffer-name</entry>
+ <entry>BACKBUFFER</entry>
+ </row>
+ <row>
+ <entry>=></entry>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>attributes</entry>
+ <entry>BUFFER_ATTRIBUTES</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>where:</para>
+
+<para>BUFFER_ATTRIBUTES: [ window: WINDOW ]</para>
+
+<para>
+If back-buffer-name is a valid BACKBUFFER, the window field of the
+attributes in the reply will be the window which has the back buffer that
+back-buffer-name refers to. If back-buffer-name is not a valid BACKBUFFER,
+the window field of the attributes in the reply will be None.
+</para>
+
+</sect1>
+</chapter>
+
+<chapter id='Encoding'>
+<title>Encoding</title>
+<para>
+Please refer to the X11 Protocol Encoding document as this section uses
+syntactic conventions and data types established there.
+</para>
+
+<para>The name of this extension is "DOUBLE-BUFFER".</para>
+
+<sect1 id='Type'>
+<title>Type</title>
+<para>The following new types are used by the extension.
+</para>
+
+<para>BACKBUFFER: XID</para>
+<para>SWAPACTION</para>
+<literallayout class="monospaced">
+#x00 Undefined
+#x01 Background
+#x02 Untouched
+#x03 Copied
+</literallayout>
+
+<para>SWAPINFO</para>
+<literallayout class="monospaced">
+4 WINDOW window
+1 SWAPACTION swap action
+3 unused
+</literallayout>
+
+<literallayout class="monospaced">
+VISINFO
+4 VISUALID visual
+1 CARD8 depth
+1 CARD8 perflevel
+2 unused
+
+SCREENVISINFO
+4 CARD32 n, number in list
+8n LISTofVISINFO n VISINFOs
+
+BUFFER_ATTRIBUTES
+4 WINDOW window
+</literallayout>
+</sect1>
+
+<sect1 id='Error'>
+<title>Error</title>
+<para><function>Buffer</function></para>
+<literallayout class="monospaced">
+1 0 error
+1 error base + 0 code
+2 CARD16 sequence number
+4 CARD32 bad buffer
+2 CARD16 minor-opcode
+1 CARD8 major-opcode
+21 unused
+</literallayout>
+</sect1>
+
+<sect1 id='Request'>
+<title>Request</title>
+
+<literallayout class="monospaced">
+DBEGetVersion
+1 CARD8 major-opcode
+1 0 minor-opcode
+2 2 request length
+1 CARD8 client-major-version
+1 CARD8 client-minor-version
+2 unused
+=>
+1 unused
+2 CARD16 sequence number
+4 0 reply length
+1 CARD8 server-major-version
+1 CARD8 server-minor-version
+22 unused
+</literallayout>
+
+<para><function>DBEAllocateBackBufferName</function></para>
+<literallayout class="monospaced">
+1 CARD8 major-opcode
+1 1 minor-opcode
+2 4 request length
+4 WINDOW window
+4 BACKBUFFER back buffer name
+1 SWAPACTION swap action hint
+3 unused
+</literallayout>
+
+<para><function>DBEDeallocateBackBufferName</function></para>
+<literallayout class="monospaced">
+1 CARD8 major-opcode
+1 2 minor-opcode
+2 2 request length
+4 BACKBUFFER back buffer name
+</literallayout>
+
+
+<para><function>DBESwapBuffers</function></para>
+<literallayout class="monospaced">
+1 CARD8 major-opcode
+1 3 minor-opcode
+2 2+2n request length
+4 CARD32 n, number of window/swap action pairs in list
+8n LISTofSWAPINFO window/swap action pairs
+</literallayout>
+
+
+<para><function>DBEBeginIdiom</function></para>
+<literallayout class="monospaced">
+1 CARD8 major-opcode
+1 4 minor-opcode
+2 1 request length
+</literallayout>
+
+<para><function>DBEEndIdiom</function></para>
+<literallayout class="monospaced">
+1 CARD8 major-opcode
+1 5 minor-opcode
+2 1 request length
+</literallayout>
+
+<para><function>DBEGetVisualInfo</function></para>
+<literallayout class="monospaced">
+1 CARD8 major-opcode
+1 6 minor-opcode
+2 2+n request length
+4 CARD32 n, number of screen specifiers in list
+4n LISTofDRAWABLE n screen specifiers
+=>
+1 1 Reply
+1 unused
+2 CARD16 sequence number
+4 CARD32 reply length
+4 CARD32 m, number of SCREENVISINFOs in list
+20 unused
+4j LISTofSCREENVISINFO m SCREENVISINFOs
+</literallayout>
+
+<para><function>DBEGetBackBufferAttributes</function></para>
+<literallayout class="monospaced">
+1 CARD8 major-opcode
+1 7 minor-opcode
+2 2 request length
+4 BACKBUFFER back-buffer-name
+=>
+1 unused
+2 CARD16 sequence number
+4 0 reply length
+4 BUFFER_ATTRIBUTES attributes
+20 unused
+</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/dpms.xml b/specs/dpms.xml
new file mode 100644
index 0000000..f504ab7
--- /dev/null
+++ b/specs/dpms.xml
@@ -0,0 +1,567 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+
+<book id="dpms">
+
+<bookinfo>
+ <title>X Display Power Management Signaling (DPMS) Extension Protocol Specification</title>
+ <subtitle>X Project Team Standard</subtitle>
+ <authorgroup>
+ <author>
+ <firstname>Rob </firstname><surname>Lembree</surname>
+ <affiliation><orgname>Digital Equipment Corporation</orgname></affiliation>
+ <email>lembree@zk3.dec.com</email>
+ </author>
+ </authorgroup>
+ <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
+ <releaseinfo>Version 1.0</releaseinfo>
+ <copyright><year>1996</year><holder>Digital Equipment Corporation</holder></copyright>
+
+<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 &ldquo;as is&rdquo; without express or implied warranty.
+</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.<footnote>
+<para>
+<emphasis remap='I'>X Window System</emphasis> is a trademark of The Open Group.
+</para>
+</footnote>
+</para>
+
+
+<para>
+<!-- .LP -->
+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>
+<!-- .LP -->
+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>
+<!-- .LP -->
+The design goal of the DPMS extension is to be a logical extension to
+the traditional screen saver. The protocol and sample implementation is
+designed to use the same date types and time units as the screen saver.
+The sample implementation works independently from the screen saver so that
+policy as it pertains to the interaction between screen saver and DPMS can
+be deferred to the user or screen saver application. The extension has
+been tested with and shown to work correctly with both the internal blanking
+and non-blanking screen savers, as well as with screen saver extension
+clients.
+</para>
+<para>
+The DPMS extension is designed to be simple, yet export sufficient
+VESA DPMS information to enable full function clients to be written.
+Included is the ability to sense DPMS capability, set and get DPMS timeouts,
+enable and disable individual DPMS modes, enable and disable DPMS (without
+destroying timeout values), and sense current DPMS on/off state and
+power level.
+</para>
+<para>
+There are four power levels specified by the Video Electronics Standards
+Association (VESA) Display Power Management Signaling (DPMS) standard.
+These are:
+</para>
+
+<literallayout class="monospaced">
+<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>
+
+<para>
+It is logical to assume that successive DPMS modes be chronologically
+at the same time or later than one another, and the protocol is designed
+to enforce this rule.
+</para>
+
+<para>
+Note however that a concious decision is made to decouple the timeouts
+associated with screen saver from the DPMS timeouts. While it might be
+considered logical to require that the first non-zero DPMS timeout be
+greater than or equal to the screen saver timeout, this is intentionally
+omitted, leaving this policy decision to the user or the screen saver
+application. In the case of a laptop where power may be scarce, the
+importance of power savings should supersede the screen saver. If the
+laptop user plugs the unit in and power is no longer a scarce commodity,
+it may be decided to make DPMS less aggressive, or disable it completely.
+</para>
+</chapter>
+
+<chapter id="Requests">
+<title>Requests</title>
+<para>
+<olink targetdoc='dpmslib' targetptr='DPMSGetVersion'><function>DPMSGetVersion</function></olink>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>client_major_version</emphasis>: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>client_minor_version</emphasis>: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>server_major_version</emphasis>: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>server_minor_version</emphasis>: CARD16
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+If supplied, the <emphasis remap='I'>client_major_version</emphasis> and
+<emphasis remap='I'>client_minor_version</emphasis> indicate what version
+of the protocol the
+client wants the server to implement. The server version numbers
+returned indicate the protocol this extension actually supports. This
+might not equal the version sent by the client. An implementation can
+(but need not) support more than one version simultaneously. The
+<emphasis remap='I'>server_major_version</emphasis> and the
+<emphasis remap='I'>server_minor_version</emphasis> are a
+mechanism to support future revisions of the Display Power Management
+Signaling protocol which may be necessary. In general, the major version
+would increment for incompatible changes, and the minor version would
+increment for small, upward-compatible changes. Servers that support the
+protocol defined in this document will return a
+<emphasis remap='I'>server_major_version</emphasis>
+of one (1), and a <emphasis remap='I'>server_minor_version</emphasis>
+of one (1).
+</para>
+
+<para>
+<olink targetdoc='dpmslib' targetptr='DPMSCapable'><function>DPMSCapable</function></olink>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>capable</emphasis>: BOOL
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request is used to determine whether or not the currently running
+server's devices are capable of DPMS operations. The truth value of this
+request is implementation defined, but is generally based on the capabilities
+of the graphic card and monitor combination. Also, the return value in the
+case of heterogeneous multi-head servers is implementation defined.
+</para>
+
+<para>
+<olink targetdoc='dpmslib' targetptr='DPMSGetTimeouts'><function>DPMSGetTimeouts</function></olink>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>standby_timeout</emphasis>: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>suspend_timeout</emphasis>: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>off_timeout</emphasis>: CARD16
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request returns the current values of the DPMS timeout values. All
+values are in units of seconds.
+</para>
+
+<para>
+<emphasis remap='I'>standby_timeout</emphasis> is the amount of time
+of inactivity 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 indicates that this mode is disabled.
+</para>
+
+<para>
+<emphasis remap='I'>suspend_timeout</emphasis> is the amount of time
+of inactivity 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 indicates that this mode is disabled.
+</para>
+
+<para>
+<emphasis remap='I'>off_timeout</emphasis> is the amount of time of
+inactivity 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 indicates that this mode is disabled.
+</para>
+
+<para>
+<olink targetdoc='dpmslib' targetptr='DPMSSetTimeouts'><function>DPMSSetTimeouts</function></olink>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>standby_timeout</emphasis>: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>suspend_timeout</emphasis>: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>off_timeout</emphasis>: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+
+<para>
+All values are in units of seconds.
+<emphasis remap='I'>standby_timeout</emphasis> is the amount of
+time of inactivity before standby mode will be invoked. This is the
+lightest level of power savings, and the monitor is generally immediately
+ready upon detection of user activity. This is most often implemented by
+shutting off the horizontal sync signal to the monitor.
+A value of zero disables this mode.
+</para>
+
+<para>
+The <emphasis remap='I'>suspend_timeout</emphasis> specifies the amount
+of time of inactivity
+before the screen is placed into suspend mode. Suspend mode is the
+middle level of power savings, resulting in a slightly longer recovery
+upon detection of activity. Suspend mode is most often implemented by
+pulsing the horizontal sync signal, and removing the vertical sync
+signal. A value of zero disables this mode.
+</para>
+
+<para>
+The <emphasis remap='I'>off_timeout</emphasis> specifies the amount of
+time of inactivity before
+the monitor is shut off. Off mode is the deepest level of power management,
+resulting in the greatest power savings and the longest recovery time.
+Off mode is most often implemented by removing both the horizontal and
+vertical signals. A value of zero disables this mode.
+</para>
+<para>
+The values of successive power levels must be greater than or equal
+to the value of the previous (non-zero) level. A BadValue error is generated
+if an illegal combination is detected.
+</para>
+<para>
+<olink targetdoc='dpmslib' targetptr='DPMSEnable'><function>DPMSEnable</function></olink>
+</para>
+<para>
+=&gt;
+</para>
+
+<para>
+This request enables the DPMS characteristics of the server, using the
+server's currently stored timeouts. If DPMS is already enabled, no change is
+effected.
+</para>
+
+<para>
+<olink targetdoc='dpmslib' targetptr='DPMSDisable'><function>DPMSDisable</function></olink>
+</para>
+<para>
+=&gt;
+</para>
+
+<para>
+This request disables the DPMS characteristics of the server. It does
+not affect the core or extension screen savers. If DPMS is already
+disabled, no change is effected. This request is provided so that DPMS
+may be disabled without damaging the server's stored timeout values.
+</para>
+
+<para>
+<olink targetdoc='dpmslib' targetptr='DPMSForceLevel'><function>DPMSForceLevel</function></olink>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>power_level</emphasis>: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request forces a specific DPMS level on the server. If DPMS is
+disabled, a BadMatch error is generated. If an erroneous power level
+is specified, a BadValue error is returned, and the error value contains
+the bad value. If the power level specified is already in effect, no
+changes occur. Power Level must be one of DPMSModeOn, DPMSModeStandby,
+DPMSModeSuspend or DPMSModeOff.
+</para>
+
+<para>
+<olink targetdoc='dpmslib' targetptr='DPMSInfo'><function>DPMSInfo</function></olink>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>power_level</emphasis>: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>state</emphasis>: BOOL
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request returns information about the current DPMS state of the
+display. <emphasis remap='I'>state</emphasis> is one of DPMSEnabled
+or DPMSDisabled.
+If <emphasis remap='I'>state</emphasis> is DPMSEnabled,
+<emphasis remap='I'>power_level</emphasis> is returned as one
+of DPMSModeOn, DPMSModeStandby, DPMSModeSuspend or DPMSModeOff, otherwise
+it is undefined.
+</para>
+
+</chapter>
+
+<chapter id="Events_and_Errors">
+<title>Events and Errors</title>
+<para>
+No new events or errors are defined by this extension.
+</para>
+</chapter>
+
+<chapter id="Encoding">
+<title>Encoding</title>
+<para>
+Please refer to the X11 Protocol Encoding document as this document uses
+conventions established there.
+</para>
+
+<para>
+The name of this extension is "DPMS".
+</para>
+
+<literallayout class="monospaced">
+<olink targetdoc='dpmslib' targetptr='DPMSGetVersion'><function>DPMSGetVersion</function></olink>
+ 1 CARD8 opcode
+ 1 0 DPMS opcode
+ 2 2 request length
+ 2 CARD16 client_major_version
+ 2 CARD16 client_minor_version
+=&gt;
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 length
+ 2 CARD16 server_major_version
+ 2 CARD16 server_minor_version
+ 20 unused
+</literallayout>
+
+<literallayout class="monospaced">
+<olink targetdoc='dpmslib' targetptr='DPMSCapable'><function>DPMSCapable</function></olink>
+ 1 CARD8 opcode
+ 1 1 DPMS opcode
+ 2 1 request length
+=&gt;
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 length
+ 1 BOOL capable
+ 23 unused
+</literallayout>
+
+<literallayout class="monospaced">
+<olink targetdoc='dpmslib' targetptr='DPMSGetTimeouts'><function>DPMSGetTimeouts</function></olink>
+ 1 CARD8 opcode
+ 1 2 DPMS opcode
+ 2 1 request length
+=&gt;
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 length
+ 2 CARD16 standby_timeout
+ 2 CARD16 suspend_timeout
+ 2 CARD16 off_timeout
+ 18 unused
+</literallayout>
+
+<literallayout class="monospaced">
+<olink targetdoc='dpmslib' targetptr='DPMSSetTimeouts'><function>DPMSSetTimeouts</function></olink>
+ 1 CARD8 opcode
+ 1 3 DPMS opcode
+ 2 3 request length
+ 2 CARD16 standby_timeout
+ 2 CARD16 suspend_timeout
+ 2 CARD16 off_timeout
+ 2 unused
+=&gt;
+</literallayout>
+
+<literallayout class="monospaced">
+<olink targetdoc='dpmslib' targetptr='DPMSEnable'><function>DPMSEnable</function></olink>
+ 1 CARD8 opcode
+ 1 4 DPMS opcode
+ 2 1 request length
+ =&gt;
+</literallayout>
+
+<literallayout class="monospaced">
+<olink targetdoc='dpmslib' targetptr='DPMSDisable'><function>DPMSDisable</function></olink>
+ 1 CARD8 opcode
+ 1 5 DPMS opcode
+ 2 1 request length
+ =&gt;
+</literallayout>
+
+<literallayout class="monospaced">
+<olink targetdoc='dpmslib' targetptr='DPMSForceLevel'><function>DPMSForceLevel</function></olink>
+ 1 CARD8 opcode
+ 1 6 DPMS opcode
+ 2 2 request length
+ 2 power_level
+ 0 DPMSModeOn
+ 1 DPMSModeStandby
+ 2 DPMSModeSuspend
+ 3 DPMSModeOff
+ 2 unused
+=&gt;
+</literallayout>
+
+<literallayout class="monospaced">
+<olink targetdoc='dpmslib' targetptr='DPMSInfo'><function>DPMSInfo</function></olink>
+ 1 CARD8 opcode
+ 1 7 DPMS opcode
+ 2 1 request length
+=&gt;
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 length
+ 2 power_level
+ 0 DPMSModeOn
+ 1 DPMSModeStandby
+ 2 DPMSModeSuspend
+ 3 DPMSModeOff
+ 1 BOOL state
+ 21 unused
+
+</literallayout>
+</chapter>
+</book>
diff --git a/specs/evi.xml b/specs/evi.xml
new file mode 100644
index 0000000..7b661f6
--- /dev/null
+++ b/specs/evi.xml
@@ -0,0 +1,519 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+
+
+<book id="evi">
+
+<bookinfo>
+ <title>Extended Visual Information Extension</title>
+ <subtitle>X Project Team Standard</subtitle>
+ <authorgroup>
+ <author>
+ <firstname>Peter</firstname><surname>Daifuku</surname>
+ <affiliation><orgname>Silicon Graphics, Inc.</orgname></affiliation>
+ </author>
+ </authorgroup>
+ <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
+ <releaseinfo>Version 1.0</releaseinfo>
+ <copyright><year>1986-1997</year><holder>The Open Group</holder></copyright>
+
+<legalnotice>
+
+<para>
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this
+software and associated documentation files (the Software), to use the
+Software without restriction, including, without limitation, the rights to
+copy, modify, merge, publish, distribute and sublicense the Software,
+to make, have made, license and distribute derivative works thereof, 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 the following permission notice shall be
+included in all copies 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 NON-
+INFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER USEABILITIY, WHETHER IN AN ACTION OF
+CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN
+CONNNECTION WITH THE SOFTWARE OR THE USE OF OTHER DEALINGS IN
+THE SOFTWARE.
+</para>
+
+<para>
+Except as contained in this notice, the name of The Open Group shall not
+be used in advertising or otherwise to promote the use or other dealings
+in this Software without prior written authorization from The Open Group.
+</para>
+
+<para>
+X Window System is a trademark of The Open Group.
+</para>
+
+</legalnotice>
+</bookinfo>
+
+<chapter id="Introduction">
+<title>Introduction</title>
+<para>
+EVI (Extended Visual Information extension) allows a client to determine
+information about core X visuals beyond what the core protocol provides.
+</para>
+</chapter>
+
+<chapter id="Goals">
+<title>Goals</title>
+<para>
+As the X Window System has evolved, it has become clear that the information
+returned by the core X protocol regarding Visuals is often insufficient for a
+client to determine which is the most appropriate visual for its needs. This
+extension allows clients to query the X server for additional visual
+information, specifically as regards colormaps and framebuffer levels.
+</para>
+
+<para>
+This extension is meant to address the needs of pure X clients only. It is
+specifically and purposefully not designed to address the needs of X
+extensions. Extensions that have an impact on visual information should provide
+their own mechanisms for delivering that information. For example, the Double
+Buffering Extension (DBE) provides its own mechanism for determining which
+visuals support double-buffering.
+</para>
+</chapter>
+
+<chapter id="Requests">
+<title>Requests</title>
+<para>
+<function>GetVersion</function>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>client_major_version</emphasis>: CARD8
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>client_minor_version</emphasis>: CARD8
+ </entry>
+ </row>
+ <row>
+ <entry>
+=&gt;
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>server_major_version</emphasis>: CARD8
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>server_minor_version</emphasis>: CARD8
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+
+
+<para>
+If supplied, the client_major_version and client_minor_version indicate
+what version of the protocol the client wants the server to implement.
+The server version numbers returned indicate the protocol this extension
+actually supports. This might not equal the version sent by the client.
+An implementation can (but need not) support more than one version
+simultaneously. The server_major_version and the server_minor_version
+are a mechanism to support future revisions of the EVI protocol that
+may be necessary. In general, the major version would increment for
+incompatible changes, and the minor version would increment for small
+upward-compatible changes. Servers that support the protocol defined in
+this document will return a server_major_version of one (1), and a
+server_minor_version of zero (0).
+</para>
+
+<para>
+<function> GetVisualInfo</function>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>visual_list</emphasis>: LISTofVISUALID
+ </entry>
+ </row>
+ <row>
+ <entry>
+=&gt;
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>per_visual_info</emphasis>: LISTofVISUALINFO
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+where:
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+VISUALINFO: [core_visual_id: VISUALID
+ </entry>
+ </row>
+ <row>
+ <entry>
+screen: CARD8
+ </entry>
+ </row>
+ <row>
+ <entry>
+level: INT8
+ </entry>
+ </row>
+ <row>
+ <entry>
+transparency_type: CARD8
+ </entry>
+ </row>
+ <row>
+ <entry>
+unused: CARD8
+ </entry>
+ </row>
+ <row>
+ <entry>
+transparency_value: CARD32
+ </entry>
+ </row>
+ <row>
+ <entry>
+min_hw_colormaps: CARD8
+ </entry>
+ </row>
+ <row>
+ <entry>
+max_hw_colormaps: CARD8
+ </entry>
+ </row>
+ <row>
+ <entry>
+num_colormap_conflicts: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+colormap_conflicts: LISTofVISUALID]
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<itemizedlist>
+ <listitem>
+ <para>
+level is 0 for normal planes, &gt; 0 for overlays, &lt; 0 for underlays.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+transparency_type is 0 for none, 1 for transparent pixel, 2 for
+transparent mask.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+transparency_value: value to get transparent pixel if transparency
+supported.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+min_hw_colormaps: minimum number of hardware colormaps backing up the
+visual.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+max_hw_colormaps: maximum number of hardware colormaps backing up the
+visual.
+ </para>
+ <para>
+ (architectures with static colormap allocation/reallocation would have min
+= max)
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+num_colormap_conflicts: number of elements in colormap_conflicts.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+colormap_conflicts: list of visuals that may conflict with this one. For
+example, if a 12-bit colormap is overloaded to support 8-bit visuals, the
+8-bit visuals would conflict with the 12-bit visuals.
+ </para>
+ </listitem>
+</itemizedlist>
+
+</chapter>
+<chapter id="Events_and_Errors">
+<title>Events and Errors</title>
+<para>
+No new events or errors are defined by this extension.
+</para>
+</chapter>
+
+<chapter id='Changes_to_existing_protocol'>
+<title>Changes to existing protocol.</title>
+<para>
+None.
+</para>
+</chapter>
+
+<chapter id="Encoding">
+<title>Encoding</title>
+<para>
+The name of this extension is "Extended-Visual-Information".
+</para>
+
+<para>
+The conventions used here are the same as those for the core X11
+Protocol Encoding.
+</para>
+
+<literallayout class="monospaced">
+<function>GetVersion</function>
+ 1 CARD8 opcode
+ 1 0 EVI opcode
+ 2 2 request length
+ 2 CARD16 client_major_version
+ 2 CARD16 client_minor_version
+=&gt;
+ 1 1 reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 length
+ 2 CARD16 server_major_version
+ 2 CARD16 server_minor_version
+ 20 unused
+</literallayout>
+
+<literallayout class="monospaced">
+<function>GetVisualInfo</function>
+ 1 CARD8 opcode
+ 1 1 EVI opcode
+ 2 2+n request length
+ 4 CARD32 n_visual
+ 4n CARD32 visual_ids
+=&gt;
+ 1 1 reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 n length
+ 4 CARD32 n_info
+ 4 CARD32 n_conflicts
+ 16 unused
+ 16n LISTofVISUALINFO items
+</literallayout>
+
+<literallayout class="monospaced">
+VISUALINFO
+ 4 VisualID core_visual_id
+ 1 INT8 screen
+ 1 INT8 level
+ 1 CARD8 transparency_type
+ 1 CARD8 unused
+ 4 CARD32 transparency_value
+ 1 CARD8 min_hw_colormaps
+ 1 CARD8 max_hw_colormaps
+ 2 CARD16 num_colormap_conflicts
+</literallayout>
+</chapter>
+
+<chapter id="C_Language_Binding">
+<title>C Language Binding</title>
+<para>
+<!-- .LP -->
+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 deleting Xevi
+at the start of the function. All functions that have return type Status
+will return nonzero for success and zero for failure.
+</para>
+
+<para>
+The include file for this extension is:
+<function>&lt; X11/extensions/XEVI.h&gt;</function>.
+</para>
+
+<funcsynopsis id='XeviQueryVersion'>
+<funcprototype>
+ <funcdef>Bool <function> XeviQueryVersion</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>int<parameter> *major_version_return</parameter></paramdef>
+ <paramdef>int<parameter> *minor_version_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>major_version_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the major version supported by the server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>minor_version_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the minor version supported by the server.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+XeviQueryVersion sets major_version_return and minor_version_return to
+the major and minor EVI protocol version supported by the server. If
+the EVI library is compatible with the version returned by the server,
+it returns nonzero. If dpy does not support the EVI 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
+Xevi functions may be called before this function. If a client violates
+this rule, the effects of all subsequent Xevi calls that it makes are
+undefined.
+</para>
+
+<para>
+To get the extended information for any subset of visuals use
+XeviGetVisualInfo.
+</para>
+
+<funcsynopsis id='XeviGetVisualInfo'>
+<funcprototype>
+ <funcdef>int <function> XeviGetVisualInfo</function></funcdef>
+ <paramdef>Display<parameter> *display</parameter></paramdef>
+ <paramdef>VisualID<parameter> *visual</parameter></paramdef>
+ <paramdef>int<parameter> n_visual</parameter></paramdef>
+ <paramdef>ExtendedVisualInfo<parameter> **evi_return</parameter></paramdef>
+ <paramdef>int<parameter> *n_info_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>visual</emphasis>
+ </term>
+ <listitem>
+ <para>
+If NULL, then information for all visuals of all
+screens is returned. Otherwise, a pointer to a list of visuals for which
+extended visual information is desired.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>n_visual</emphasis>
+ </term>
+ <listitem>
+ <para>
+If 0, then information for all visuals of all screens is returned. Otherwise,
+the number of elements in the array <emphasis remap='I'>visual</emphasis>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>evi_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns a pointer to a list of <emphasis remap='I'>ExtendedVisualInfo</emphasis>. When done, the client
+should free the list using <emphasis remap='I'>XFree</emphasis>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>n_info_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the number of elements in the list of
+<emphasis remap='I'>ExtendedVisualInfo</emphasis>.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+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 Success
+if successful, or an X error otherwise.
+</para>
+
+</chapter>
+</book>
diff --git a/specs/geproto.xml b/specs/geproto.xml
new file mode 100644
index 0000000..4cca9ac
--- /dev/null
+++ b/specs/geproto.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+<book>
+ <bookinfo>
+ <title>X Generic Event Extension</title>
+ <author>
+ <firstname>Peter</firstname>
+ <surname>Hutterer</surname>
+ <email>peter.hutterer@who-t.net</email>
+ </author>
+ <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
+ <releaseinfo>Version 1.0</releaseinfo>
+ <copyright><year>2007</year><holder>Peter Hutterer</holder></copyright>
+
+ <legalnotice>
+ <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 (including the next
+ paragraph) 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
+ 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.
+ </para>
+ </legalnotice>
+
+ </bookinfo>
+
+ <chapter>
+ <title>Introduction</title>
+
+ <para>X was designed to provide 64 event opcodes for all extensions. These
+ events are limited to 32 bytes.</para>
+
+ <para>The Generic Event Extension provides a template event for extensions
+ to re-use a single event opcode. GE only provide headers and the most
+ basic functionality, leaving the extensions to interpret the events in
+ their specific context.</para>
+
+ <para>GenericEvents may be longer than 32 bytes. If so, the number of 4
+ byte units following the initial 32 bytes must be specified in the length
+ field of the event.</para>
+ </chapter>
+
+ <chapter>
+ <title>Extension Initialization</title>
+
+ <para>The name of this extension is "Generic Event Extension"</para>
+
+ <programlisting>GEQueryVersion
+ client-major-version: CARD16
+ client-minor-version: CARD16
+==&gt;
+ major-version: CARD16
+ minor-version: CARD16</programlisting>
+
+ <para>The client sends the highest supported version to the server and the
+ server sends the highest version it supports, but no higher than the
+ requested version. Major versions changes can introduce incompatibilities
+ in existing functionality, minor version changes introduce only backward
+ compatible changes. It is the clients responsibility to ensure that the
+ server supports a version which is compatible with its
+ expectations.</para>
+
+ <para>As of version 1.0, no other requests are provided by this extension.
+ </para>
+ </chapter>
+
+ <chapter>
+ <title>Events</title>
+
+ <para>GE defines a single event, to be used by all extensions. The event's
+ structure is similar to a reply. This is a core protocol event, ID 35, and
+ is not itself an extension event.</para>
+
+ <programlisting>GenericEvent
+ type: BYTE always GenericEvent (35)
+ extension: CARD8 extension offset
+ sequenceNumber: CARD16 low 16 bits of request seq. number
+ length: CARD32 length
+ evtype: CARD16 event type</programlisting>
+
+ <para>The field 'extension' is to be set to the major opcode of the
+ extension. The 'evtype' field is the actual opcode of the event. The
+ length field specifies the number of 4-byte blocks after the initial 32
+ bytes. If length is 0, the event is 32 bytes long.</para>
+ </chapter>
+
+ <chapter>
+ <title>Notes</title>
+
+ <para>Although the wire event is of arbitrary length, the actual size of
+ an XEvent is restricted to sizeof(XEvent) [96 bytes, see Xlib.h]. If an
+ extension converts a wire event to an XEvent &gt; 96 bytes, it will
+ overwrite the space allocated for the event. See struct _XSQEvent in
+ Xlibint.h for details.</para>
+
+ <para>Extensions need to malloc additional data and fill the XEvent
+ structure with pointers to the malloc'd data. The client then needs to
+ free the data, only the XEvent structure will be released by Xlib.</para>
+
+ <para>The server must not send GenericEvents longer than 32 bytes until it
+ has verified that the client is able to interpret these events. If a long
+ event is sent to a client unable to process GenericEvents, future
+ interpretation of replies and events by this client will fail.</para>
+ </chapter>
+</book>
diff --git a/specs/lbx.xml b/specs/lbx.xml
new file mode 100644
index 0000000..87060b7
--- /dev/null
+++ b/specs/lbx.xml
@@ -0,0 +1,6346 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE article
+ PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+
+<article id="lbx">
+
+<articleinfo>
+ <title>Low Bandwidth X Extension</title>
+ <subtitle>X Consortium Standard</subtitle>
+ <authorgroup>
+ <author>
+ <firstname>Donna</firstname>
+ <surname>Converse</surname>
+ </author>
+ <author>
+ <firstname>Jim</firstname>
+ <surname>Fulton</surname>
+ </author>
+ <author>
+ <firstname>David</firstname>
+ <surname>Lemke</surname>
+ </author>
+ <author>
+ <firstname>Ralph</firstname>
+ <surname>Mor</surname>
+ </author>
+ <author>
+ <firstname>Keith</firstname>
+ <surname>Packard</surname>
+ </author>
+ <author>
+ <firstname>Ray</firstname>
+ <surname>Tice</surname>
+ </author>
+ <author>
+ <firstname>Dale</firstname>
+ <surname>Tonogai</surname>
+ </author>
+ </authorgroup>
+ <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
+ <releaseinfo>Version 1.0</releaseinfo>
+ <copyright><year>1996</year><holder>X Consortium</holder></copyright>
+
+<legalnotice>
+<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
+sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+</para>
+<para>
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions
+of the Software.
+</para>
+<para>
+THE SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X
+CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+</para>
+<para>
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise
+to promote the sale, use or other dealings in this Software without prior
+written authorization from the
+X Consortium.
+</para>
+<para>X Window System is a trademark of The OpenGroup.</para>
+</legalnotice>
+</articleinfo>
+
+<sect1 id='introduction'>
+<title>Introduction</title>
+
+<para>
+Low Bandwidth X (LBX) is a network-transparent protocol for running X Window
+System applications over transport channels whose bandwidth and latency are
+significantly worse than that used in local area networks. It combines a
+variety of caching and reencoding techniques to reduce the volume of data that
+must be sent over the wire. It can be used with existing clients by placing a
+proxy between the clients and server, so that the low bandwidth/high latency
+communication occurs between the proxy and server.
+</para>
+
+
+<para>
+This extension was designed and implemented by Jim Fulton, David Lemke, Keith
+Packard, and Dale Tonogai, all of Network Computing Devices (NCD). Chris Kent
+Kantarjiev (Xerox PARC) participated in early design discussions. Ralph Mor (X
+Consortium) designed and implemented additional sections. Donna Converse (X
+Consortium) authored the protocol description and encoding from design notes
+and the implementation. Ray Tice (X Consortium) resolved the open issues in the
+design and specification. Bob Scheifler (X Consortium) helped out in many areas.
+</para>
+
+
+<para>
+The extension name is &quot;LBX&quot;.
+</para>
+
+
+</sect1>
+<sect1 id='description'>
+<title>Description</title>
+
+<para>
+The design center for LBX is to use a proxy as an intermediary between the
+client and server. The proxy reencodes and compresses requests, events, replies
+and errors, as well as the resulting data stream. Additionally, the proxy can
+cache information from the server to provide low-latency replies to clients.
+This reply generation by the proxy is known as short-circuiting. A proxy can
+handle multiple clients for a given server, but does not prevent clients from
+connecting directly to the server. The design allows the proxy to multiplex
+multiple clients into a single data stream to the server.
+</para>
+
+
+<para>
+Much of LBX is implemented as an extension. The compression and reencoding
+changes can be isolated to the transport and dispatch portions of the server,
+while short-circuiting requires minor changes to the server’s colormap and
+property code.
+</para>
+
+
+<para>
+LBX employs several different compression and short-circuiting methods. Use of
+these methods is negotiable, and in some cases, the algorithm used by a given
+method is negotiable as well. LBX also provides for negotiation of extensions
+to LBX.
+</para>
+
+
+<sect2 id='data_flow'>
+<title>Data Flow</title>
+
+<para>
+The LBX data stream goes through a number of layers:
+</para>
+
+
+<orderedlist>
+ <listitem>
+<para>Client requests</para>
+ </listitem>
+ <listitem>
+<para>Read by LBX and potential byte-swapping</para>
+ </listitem>
+ <listitem>
+<para>Request-specific compression</para>
+ </listitem>
+ <listitem>
+<para>Potential byte swapping</para>
+ </listitem>
+ <listitem>
+<para>Multiplexing of client request streams</para>
+ </listitem>
+ <listitem>
+<para>Delta replacement</para>
+ </listitem>
+ <listitem>
+<para>Stream compression</para>
+ </listitem>
+</orderedlist>
+
+<para>
+Transport
+</para>
+
+<!-- FIXME: descending -->
+<orderedlist>
+ <listitem>
+<para>Stream decompression</para>
+ </listitem>
+ <listitem>
+<para>Delta substitution</para>
+ </listitem>
+ <listitem>
+<para>Demultiplexing of client request streams</para>
+ </listitem>
+ <listitem>
+<para>Potential byte swapping</para>
+ </listitem>
+ <listitem>
+<para>Reencoding</para>
+ </listitem>
+ <listitem>
+<para>Request processing</para>
+ </listitem>
+</orderedlist>
+
+<para>
+The reverse process occurs with X server replies, events, and errors.
+</para>
+
+
+</sect2>
+<sect2 id='tags'>
+<title>Tags</title>
+
+<para>
+Tags are used to support caching of large data items that are expected to be
+queried multiple times. Such things as the keyboard map and font metrics are
+often requested by multiple clients. Rather than send the data each time, the
+first time the data is sent it includes a tag. The proxy saves this data, so
+that subsequent requests can send only the tag to refer to that same data. The
+different types of tags are used for connection information, keyboard maps,
+modifier maps, fonts information and properties.
+</para>
+
+
+<para>
+Tag usage is negotiated as a boolean in the <emphasis>
+LbxStartProxy</emphasis>
+ message. The proxy controls how many tags are stored in the proxy. The server
+may wish to observe the proxy’s InvalidateTag behavior to limit how many tags
+are cached at any one time. Tagged data is not shared across types of tags, but
+the number space used for the tag ids is. The tag ids are generated by the
+server.
+</para>
+
+
+<para>
+The X server keeps track of what tags are known to the proxy. The proxy can
+invalidate a tag if no tag bearing replies of that type are pending. The proxy
+sends an <emphasis>
+LbxInvalidateTag</emphasis>
+ message to release the tagged data. The proxy must not invalidate connection
+tags unless instructed to do so by the server.
+</para>
+
+
+<para>
+If the server wishes to discard tagged data, it must either have received an
+<emphasis>
+LbxInvalidateTag</emphasis>
+ request from the proxy or send an <emphasis>
+LbxInvalidateTag</emphasis>
+ event to the proxy for that tag.
+</para>
+
+
+<sect3 id='tag_substitution_in_requests'>
+<title>Tag Substitution in Requests</title>
+
+<para>
+Many substitution requests have a tag field, followed by fields marked
+optional. For these requests, if the optional fields are present, the
+data in them is stored in the indicated tag, unless the tag is 0. If
+the optional fields are absent, the tag field indicates the tag that
+contains the data for the &quot;optional&quot; fields.
+</para>
+
+
+</sect3>
+<sect3 id='property_tags'>
+<title>Property Tags</title>
+
+<para>
+Property data makes special use of tags. A common use of properties is for
+inter-client communication. If both clients use the proxy, it is wasteful to
+send the data to the server and then back, when the server may never need it.
+<emphasis>
+LbxChangeProperty</emphasis>
+ request does the same work as the core <emphasis>
+ChangeProperty</emphasis>
+ request, but it does not send the data. The reply to this request contains a
+tag id corresponding to the data. If the property information is used locally,
+the server responds to <emphasis>
+LbxGetProperty</emphasis>
+ with the tag, and the property data need never be sent to the server. If the
+server does require the data, it can issue an <emphasis>
+LbxQueryTag</emphasis>
+ message. The proxy can also send the data on at any time if it judges it
+appropriate (i.e., when the wire goes idle). Since the proxy owns the property
+data, it must not invalidate the tag before sending the data back to the server
+via an <emphasis>
+LbxTagData</emphasis>
+ request.
+</para>
+
+
+</sect3>
+</sect2>
+<sect2 id='short_circuiting'>
+<title>Short-circuiting</title>
+
+<para>
+Short-circuiting is used to handle constant data. This includes atoms, color
+name/RGB mappings, and <emphasis>
+AllocColor</emphasis>
+ calls. Atoms and color name/RGB mappings stay constant for the life of the
+server. <emphasis>
+AllocColor</emphasis>
+<emphasis>
+ </emphasis>
+replies are constant for each colormap. Short-circuiting replaces round-trip
+requests with one-way requests, and can sometimes use one in place of many.
+</para>
+
+
+<para>
+Atoms are used heavily for ICCCM communication. Once the proxy knows the string
+to atom mapping, it has no need to send subsequent requests for this atom to
+the server.
+</para>
+
+
+<para>
+Colorname/RGB mappings are constant, so once the proxy sees the response from
+<emphasis>
+LookupColor</emphasis>
+, it need not forward any subsequent requests.
+</para>
+
+
+<para>
+Clients often use the same color cells, so once a read-only color allocation
+has occurred, the proxy knows what RGB values should be returned to the client.
+The proxy doesn't need to forward any <emphasis>
+AllocColor</emphasis>
+ requests it can resolve, but it must tell the server to modify the color
+cell's reference count. <emphasis>
+LbxIncrementPixel</emphasis>
+ is used to support this.
+</para>
+
+
+<para>
+For all three classes of short-circuiting, the proxy must still tell the server
+a request has occurred, so that the request sequence numbers stay in sync. This
+is done with <emphasis>
+LbxModifySequence</emphasis>
+.
+</para>
+
+
+<para>
+Sequence numbers cause the major complication with short-circuiting. X
+guarantees that any replies, events or errors generated by a previous request
+will be sent before those of a later request. This means that any requests that
+can be handled by the proxy must have their reply sent after any previous
+events or errors.
+</para>
+
+
+<para>
+If a proxy’s applications do not require strict adherence to the X protocol
+ordering of errors or events, a proxy might provide further optimization by
+avoiding the overhead of maintaining this ordering, however, the resulting
+protocol is not strictly X11 compliant.
+</para>
+
+
+</sect2>
+<sect2 id='graphics_re_encoding'>
+<title>Graphics Re-encoding</title>
+
+<para>
+The LBX proxy attempts to reencode <emphasis>PolyPoint</emphasis>,
+<emphasis>PolyLine</emphasis>, <emphasis>PolySegment</emphasis>,
+<emphasis>PolyRectangle</emphasis>, <emphasis>PolyArc</emphasis>,
+<emphasis>FillPoly</emphasis>, <emphasis>PolyFillRectangle</emphasis>,
+<emphasis>PolyFillArc</emphasis>, <emphasis>CopyArea</emphasis>,
+<emphasis>CopyPlane</emphasis>, <emphasis>PolyText8</emphasis>,
+<emphasis>PolyText16</emphasis>, <emphasis>ImageText8</emphasis>,
+and <emphasis>ImageText16</emphasis> requests. If the request can be
+reencoded, it may be replaced by an equivalent LBX form of the request.
+The requests are reencoded by attempting to reduce 2-byte coordinate,
+length, width and angle fields to 1 byte. Where applicable, the
+coordinate mode is also converted to <emphasis>Previous</emphasis>
+ to improve the compressibility of the resulting data. In image requests,
+the image data may also be compressed.
+</para>
+
+</sect2>
+<sect2 id='motion_events'>
+<title>Motion events</title>
+
+<para>
+To prevent clogging the wire with <emphasis>MotionNotify</emphasis>
+ events, the server and proxy work together to control the number
+of events on the wire. This is done with the
+<emphasis>LbxAllowMotion</emphasis>
+ request. The request adds an amount to an allowed motion count in
+the server, which is kept on a per-proxy basis. Every motion notify
+event sent to the proxy decrements the allowed motion counter. If
+the allowed motion count is less than or equal to zero, motion
+events not required by the X protocol definition are not sent to the
+proxy. The allowed motion counter has a minimum value of -2^31.
+</para>
+
+</sect2>
+<sect2 id='event_squishing'>
+<title>Event Squishing</title>
+
+<para>
+In the core protocol, all events are padded as needed to be 32 bytes long. The
+LBX extension reduces traffic by removing padding at the end of events, and
+implying the event length from its type. This is known as squishing.
+</para>
+
+</sect2>
+<sect2 id='master_client_'>
+<title>Master Client </title>
+
+<para>
+When the initial X connection between the proxy and the server is converted to
+LBX mode, the proxy itself becomes the master client. New client requests and
+some tag messages are sent in the context of the master client.
+</para>
+
+
+</sect2>
+<sect2 id='multiplexing_of_clients'>
+<title>Multiplexing of Clients</title>
+
+<para>
+The LBX proxy multiplexes the data streams of all its clients into one stream,
+and then splits them apart again when they are received. The <emphasis>
+LbxSwitch</emphasis>
+ message is used to tell each end which client is using the wire at the time.
+</para>
+
+
+<para>
+The server should process delta requests in the order that they appear on the
+LBX connection. If the server does not maintain the interclient request order
+for requests sent by the proxy, it must still obey the semantics implied by the
+interclient request order so that the delta cache functions correctly.
+</para>
+
+
+<para>
+The server can affect the multiplexing of clients by the proxy using the
+<emphasis>
+LbxListenToOne</emphasis>
+ and <emphasis>
+LbxListenToAll</emphasis>
+ messages. This is useful during grabs, since the master connection can not be
+blocked during grabs like other clients. The proxy is responsible for tracking
+server grabs issued by its clients so that the proxy can multiplex the client
+streams in an order executable by the server.
+</para>
+
+
+<para>
+Replies must be ordered in the multiplexed data stream from the server to the
+proxy such that the reply carrying tagged data precedes replies that refer to
+that tagged data.
+</para>
+
+
+</sect2>
+<sect2 id='swapping'>
+<title>Swapping</title>
+
+<para>
+Swapping is handled as with any X extension, with one caveat. Since a proxy can
+be supporting clients with different byte orders, and they all share the same
+wire, the length fields of all messages between the server and proxy are
+expressed in the proxy byte order. This prevents any problems with length
+computation that may occur when clients are switched.
+</para>
+
+
+</sect2>
+<sect2 id='delta_cache'>
+<title>Delta cache</title>
+
+<para>
+LBX takes advantage of the fact that an X message may be very similar to one
+that has been previously sent. For example, a <emphasis>
+KeyPress</emphasis>
+ event may differ from a previous <emphasis>
+KeyPress</emphasis>
+ event in just a few bytes. By sending just the bytes that differ (or
+"deltas"), the number of bytes sent over the wire can be substantially reduced.
+Delta compaction is used on requests being sent by the proxy as well as on
+replies and events being sent by the server.
+</para>
+
+
+<para>
+The server and the proxy each keep per-proxy request and response caches. The
+response cache contains events, errors and replies. All messages are saved in
+the appropriate delta cache if they are of an appropriate type and more than 8
+bytes long but fit within the delta cache. The number of entries in the delta
+cache and the maximum saved message size are negotiated in the <emphasis>
+LbxStartProxy</emphasis>
+ request.
+</para>
+
+
+<para>
+The LBX requests that are never stored in the request delta cache are the
+<emphasis>
+LbxQueryVersion</emphasis>
+, <emphasis>
+LbxStartProxy</emphasis>
+, <emphasis>
+LbxSwitch</emphasis>
+, <emphasis>
+LbxNewClient</emphasis>
+, <emphasis>
+LbxAllowMotion</emphasis>
+, <emphasis>
+LbxDelta</emphasis>
+, <emphasis>
+LbxQueryExtension</emphasis>
+, <emphasis>
+LbxPutImage</emphasis>
+, <emphasis>
+LbxGetImage</emphasis>
+, <emphasis>
+LbxBeginLargeRequest</emphasis>
+, <emphasis>
+LbxLargeRequestData</emphasis>
+, <emphasis>
+LbxEndLargeRequest</emphasis>
+ and <emphasis>
+LbxInternAtoms</emphasis>
+ requests. The responses that are never stored in the response cache are
+<emphasis>
+LbxSwitchEvent</emphasis>
+ and <emphasis>
+LbxDeltaResponse</emphasis>
+. The message carried by a <emphasis>
+delta </emphasis>
+message is also cached, if it meets the other requirements. Messages after the
+<emphasis>
+LbxStartProxy</emphasis>
+ request are cached starting at index 0, and incrementing the index, modulo the
+number of entries, thereafter. The request and response caches are
+independently indexed.
+</para>
+
+
+<para>
+If the current message is cachable and the same length as a message in the
+corresponding delta cache, a delta message may be substituted in place of the
+original message in the protocol stream.
+</para>
+
+
+</sect2>
+<sect2 id='stream_compression'>
+<title>Stream Compression</title>
+
+<para>
+Before being passed down to the transport layer messages can be passed through
+a general purpose data compressor. The choice of compression algorithm is
+negotiated with <ulink url="lbx.htm#20870">See LbxStartProxy</ulink>. The proxy
+and server are not required to support any specific stream compressor. As an
+example, however, the X Consortium implementation of a ZLIB based compressor is
+described below.
+</para>
+
+<note><para>
+The XC-ZLIB compressor is presented with a simple byte stream - the X and LBX
+message boundaries are not apparent. The data is broken up into fixed sized
+blocks. Each block is compressed using zlib 1.0 (by Gailly &amp; Adler), then a
+two byte header is prepended, and then the entire packet is transmitted. The
+header has the following information:
+</para></note>
+<para><programlisting>
+ out[0] = (length &amp; 0xfff) &gt;&gt; 8 | ((compflag) ? 0x80 : 0);
+ out[1] = length &amp; 0xff;
+</programlisting></para>
+
+</sect2>
+<sect2 id='authentication_protocols'>
+<title>Authentication Protocols</title>
+
+<para>
+The current version of LBX does not support multipass authentication protocols
+for clients of the proxy. These authentication protocols return an <emphasis>
+Authenticate</emphasis>
+ message in response to a connection setup request, and require additional
+authentication data from the client after the <emphasis>
+LbxNewClient</emphasis>
+ request, and before the reply to <emphasis>
+LbxNewClient</emphasis>
+. One example of such a protocol is XC-QUERY-SECURITY-1.
+</para>
+
+
+</sect2>
+</sect1>
+<sect1 id='c_library_interfaces_'>
+<title>C Library Interfaces </title>
+
+<para>
+The C Library routines for LBX are in the Xext library. The prototypes are
+located in a file named &quot;XLbx.h&quot;.
+</para>
+
+
+<sect2 id='application_library_interfaces'>
+<title>Application Library Interfaces</title>
+
+<para>
+In a proxy environment, applications do not need to call these routines to take
+advantage of LBX. Clients can, however, obtain information about the LBX
+extension to the server using this interface. Use of this routine may be
+altered when connected through a proxy, as described in <ulink
+url="lbx.htm#33319">See C Library Interfaces</ulink>.
+</para>
+
+
+<sect3 id='xlbxqueryversion'>
+<title>XLbxQueryVersion</title>
+
+<para>
+To determine the version of LBX supported by the X server, call <emphasis>
+XLbxQueryVersion</emphasis>
+.
+</para>
+
+<funcsynopsis>
+<funcprototype>
+<funcdef>Bool <function>XLbxQueryVersion</function></funcdef>
+ <paramdef>Display * <parameter>display</parameter></paramdef>
+ <paramdef>int * <parameter>major_version_return</parameter></paramdef>
+ <paramdef>int * <parameter>minor_version_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist>
+ <varlistentry>
+ <term>display</term>
+ <listitem><para>Specifies the connection to the X server.</para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>major_version_return</term>
+ <listitem><para>Returns the extension major version number.</para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>minor_version_return</term>
+ <listitem><para>Returns the extension minor version number.</para></listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+The <emphasis>
+XLbxQueryVersion</emphasis>
+ function determines if the LBX extension is present. If the extension is not
+present, <emphasis>
+XLbxQueryVersion</emphasis>
+ returns <emphasis>
+False</emphasis>
+; otherwise, it returns <emphasis>
+True</emphasis>
+. If the extension is present, <emphasis>
+XLbxQueryVersion</emphasis>
+ returns the major and minor version numbers of the extension as supported by
+the X server.
+</para>
+
+
+</sect3>
+</sect2>
+<sect2 id='proxy_library_interfaces'>
+<title>Proxy Library Interfaces</title>
+
+<para>
+The following interfaces are intended for use by the proxy.
+</para>
+
+<sect3 id='xlbxqueryextension'>
+<title>XLbxQueryExtension</title>
+
+<para>
+To determine the dynamically assigned codes for the extension, use the Xlib
+function <emphasis>
+XQueryExtension</emphasis>
+ or the LBX function <emphasis>
+XLbxQueryExtension</emphasis>
+.</para>
+
+
+<funcsynopsis>
+<funcprototype>
+<funcdef>Bool <function>XLbxQueryExtension</function></funcdef>
+ <paramdef>Display * <parameter>display</parameter></paramdef>
+ <paramdef>int * <parameter>major_opcode_return</parameter></paramdef>
+ <paramdef>int * <parameter>first_event_return</parameter></paramdef>
+ <paramdef>int * <parameter>first_error_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist>
+ <varlistentry>
+ <term>display</term>
+ <listitem><para>Specifies the connection to the X server.</para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>major_opcode_return</term>
+ <listitem><para>Returns the major opcode.</para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>first_event_return</term>
+ <listitem><para>Returns the first event code.</para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>first_error_return</term>
+ <listitem><para>Returns the first error code.</para></listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+The <emphasis>
+XLbxQueryExtension</emphasis>
+ function determines if the LBX extension is present. If the extension is not
+present, <emphasis>
+XLbxQueryExtension</emphasis>
+ returns <emphasis>
+False</emphasis>
+; otherwise, it returns <emphasis>
+True</emphasis>
+. If the extension is present, <emphasis>
+XLbxQueryExtension</emphasis>
+ returns the major opcode for the extension to major_opcode_return, the base
+event type code to first_event_return, and the base error code to
+first_error_return; otherwise, the return values are undefined.
+</para>
+
+</sect3>
+
+<sect3 id='xlbxgeteventbase'>
+<title>XLbxGetEventBase</title>
+<para>
+To determine the base event type code, use the Xlib function <emphasis>
+XQueryExtension</emphasis>
+ or the LBX function <emphasis>
+XLbxGetEventBase</emphasis>.
+</para>
+
+
+<funcsynopsis>
+<funcprototype>
+<funcdef>int <function>XLbxGetEventBase</function></funcdef>
+ <paramdef>Display * <parameter>display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist>
+ <varlistentry>
+ <term>display</term>
+ <listitem><para>Specifies the connection to the X server.</para></listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+The <emphasis>XLbxGetEventBase</emphasis>
+function returns the base event type code if the extension is
+present; otherwise, it returns -1.
+</para>
+
+</sect3>
+</sect2>
+</sect1>
+
+
+<sect1 id='protocol'>
+<title>Protocol</title>
+
+<sect2 id='syntactic_conventions_and_common_types'>
+<title>Syntactic Conventions and Common Types</title>
+
+<para>
+Please refer to the X Window System Protocol specification,
+as this document uses the syntactic conventions established
+there and references types defined there.
+</para>
+
+
+<para>
+The following additional types are defined by this extension:
+</para>
+
+<literallayout>
+<emphasis role='bold'>DIFFITEM</emphasis>
+1 CARD8 offset
+1 CARD8 diff
+</literallayout>
+
+<literallayout>
+<emphasis role='bold'>LBXANGLE: CARD8 or 2 BYTE</emphasis>
+ where (in order of precedence):
+ (0 &lt;= in &lt;= A(95)) &amp;&amp; !(in % A(5)) out = 0x5a + (in /
+A(5))
+ A(105) &lt;= in &lt;= A(360) &amp;&amp; !(in % A(15)) out = 0x67 +
+(in / A(15))
+ -A(100) &lt;= in &lt;= -A(5) &amp;&amp; !(in % A(5)) out = 0xa6 +
+(in / A(5))
+ -A(360) &lt; in &lt;= -A(105) &amp;&amp; !(in % A(15)) out = 0x98 +
+(in / A(15))
+ -A(360) &lt; in &lt;= A(360) out[0] = in &gt;&gt; 8; out[1] = in
+</literallayout>
+
+<literallayout>
+<emphasis role='bold'>LBXARC:</emphasis>
+ [x, y: LBXINT16,
+ width, height: LBXCARD16,
+ angle1, angle2: LBXANGLE]
+</literallayout>
+
+<para>
+Within a list of arcs, after the first arc, x and y are
+relative to the corresponding fields of the prior arc.
+</para>
+
+<literallayout>
+<emphasis role='bold'>LBXCARD16: CARD8 or 2 BYTE</emphasis>
+ where:
+ 0x0000 &lt;= in &lt; 0x00F0 CARD8
+ 0x00F0 &lt;= in &lt; 0x10F0 out[0] = 0xF0 | ((in - 0xF0) &gt;&gt;
+8)
+ out[1] = in - 0xF0
+</literallayout>
+
+<literallayout>
+<emphasis role='bold'>LBXGCANDDRAWENT</emphasis>
+[ gc-cache-index, drawable-cache-index: CARD4 ]
+</literallayout>
+
+<literallayout>
+<emphasis role='bold'>LBXGCANDDRAWUPDATE</emphasis>
+ drawable: DRAWABLE /* present only if
+<emphasis>drawable-cache-index</emphasis>
+ == 0 */
+gc: GC] /* present only if <emphasis>gc-cache-index</emphasis> == 0 */
+</literallayout>
+
+<literallayout>
+<emphasis role='bold'>LBXGCANDDRAWABLE</emphasis>
+ cache-entries: LBXGCANDDRAWENT
+ updates: LBXGCANDDRAWUPDATE
+</literallayout>
+
+<literallayout>
+<emphasis role='bold'>LBXINT16</emphasis>: INT8 or 2 BYTE
+ where:
+ 0xF790 &lt;= in &lt; 0xFF90 out[0] = 0x80 | (((in + 0x70) &gt;&gt;
+8) &amp; 0x0F)
+ out[1] = in + 0x70
+ 0xFF90 &lt;= in &lt; 0x0080 CARD8
+ 0x0080 &lt;= in &lt; 0x0880 out[0] = 0x80 | (((in - 0x80) &gt;&gt;
+8) &amp; 0x0F)
+ out[1] = in - 0x80
+</literallayout>
+
+<literallayout>
+<emphasis role='bold'>LBXPINT16</emphasis>: CARD8 or 2 BYTE /* for
+usually positive numbers */
+ where:
+ 0xFE00 &lt;= in &lt; 0x0000 out[0] = 0xF0 | (((in + 0x1000)
+&gt;&gt; 8) &amp; 0x0F)
+ out[1] = in + 0x1000
+ 0x0000 &lt;= in &lt; 0x00F0 CARD8
+ 0x00F0 &lt;= in &lt; 0x0EF0 out[0] = 0xF0 | ((in - 0xF0) &gt;&gt;8)
+ out[1] = in - 0xF0
+</literallayout>
+
+<literallayout>
+<emphasis role='bold'>LBXPOINT</emphasis>: [x, y: LBXINT16]
+ Within a list of points, after the first rectangle, x and y are
+relative to the corresponding fields of the prior point.
+</literallayout>
+
+<literallayout>
+<emphasis role='bold'>LBXRECTANGLE</emphasis>:
+ [x, y: LBXINT16,
+ width, height: LBXCARD16]
+</literallayout>
+
+<para>
+Within a list of rectangles, after the first rectangle, x and
+y are relative to the corresponding fields of the prior rectangle.
+</para>
+
+<para>
+MASK: CARD8
+</para>
+
+
+</sect2>
+<sect2 id='errors'>
+<title>Errors</title>
+
+<para>
+As with the X11 protocol, when a request terminates with an error,
+the request has no side effects (that is, there is no partial execution).
+</para>
+
+
+<para>
+There is one error, <emphasis>
+LbxClient</emphasis>
+. This error indicates that the client field of an LBX request was invalid, or
+that the proxy’s connection was in an invalid state for a start or stop proxy
+request.
+</para>
+
+
+</sect2>
+<sect2 id='requests'>
+<title>Requests</title>
+
+<para>
+There is one request that is expected to be used only by the client: <emphasis>
+LbxQueryVersion</emphasis>
+</para>
+
+
+<para>
+There is one request that is expected to be used by the client or the proxy:
+<emphasis>
+LbxQueryExtension</emphasis>
+.
+</para>
+
+
+<para>
+The following requests are expected to be used only by the proxy, and are
+instigated by the proxy: <emphasis>
+LbxStartProxy</emphasis>
+, <emphasis>
+LbxStopProxy</emphasis>
+, <emphasis>
+LbxNewClient</emphasis>
+, <emphasis>
+LbxSwitch</emphasis>
+, <emphasis>
+LbxCloseClient</emphasis>
+, <emphasis>
+LbxModifySequence</emphasis>
+, <emphasis>
+LbxAllowMotion</emphasis>
+, <emphasis>
+LbxInvalidateTag</emphasis>
+, <emphasis>
+LbxTagData</emphasis>
+ and <emphasis>
+LbxQueryTag</emphasis>
+.
+</para>
+
+
+<para>
+All other requests are sent by the proxy to the LBX server and are instigated
+by reception of an X request from the client. They replace the X request.
+</para>
+
+
+<sect3 id='requests_initiated_by_the_proxy_or_by_the_client'>
+<title>Requests Initiated by the Proxy or by the Client</title>
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxQueryVersion</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>=&gt;;</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>majorVersion: CARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>minorVersion: CARD16</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request returns the major and minor version numbers of the LBX protocol.
+</para>
+
+
+<para>
+The encoding of this request is on <ulink url="lbx.htm#34166">See
+LbxQueryVersion</ulink>.
+</para>
+
+
+
+</sect3>
+<sect3 id='requests_initiated_or_substituted_by_the_proxy'>
+<title>Requests Initiated or Substituted by the Proxy</title>
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxQueryExtension</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+nbytes</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+name</emphasis>
+: STRING8</entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>num-requests: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>present: BOOL</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>major-opcode: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>first-event: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>first-error: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>reply-mask: LISTofMASK /* optional */</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>event-mask:LISTofMASK /* optional */</entry>
+ </row>
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request is identical to the <emphasis>
+QueryExtension</emphasis>
+ request, with an additional field, and two optional additional fields. When
+the client issues an <emphasis>
+QueryExtension</emphasis>
+ request, the proxy will substitute an <emphasis>
+LbxQueryExtension</emphasis>
+ request.
+</para>
+
+
+<para>
+This request determines if the named extension is present. If so, the major
+opcode for the extension is returned, if it has one. Otherwise, zero is
+returned. Any minor opcode and the request formats are specific to the
+extension. If the extension involves additional event types, the base event
+type code is returned. Otherwise, zero is returned. The format of events is
+specific to the extension. If the extension involves additional error codes,
+the base error code is returned. Otherwise, zero is returned. The format of
+additional data in the errors is specific to the extension.
+</para>
+
+
+<para>
+In addition, the number of requests defined by the named extension is returned.
+If the number of requests is nonzero, and if the information is available,
+reply-mask and event-mask will be included in the reply. The reply-mask
+represents a bit-wise one-to-one correspondence with the extension requests.
+The least significant bit corresponds to the first request, and the next bit
+corresponds to the next request, and so on. Each element in the list contains
+eight meaningful bits, except for the last element, which contains eight or
+fewer meaningful bits. Unused bits are not guaranteed to be zero. The bit
+corresponding to a request is set if the request could generate a reply,
+otherwise it is zero. In the same way, the event-mask represents a bit-wise
+one-to-one correspondence with the extension requests. A bit is set if the
+corresponding request could result in the generation of one or more extension
+or X11 events. If reply-mask is present in the reply, event-mask will also be
+present.
+</para>
+
+
+<para>
+The encoding of this request is on <ulink url="lbx.htm#37117">See
+LbxQueryExtension</ulink>.
+</para>
+
+
+
+</sect3>
+<sect3 id='control_requests_initiated_by_the_proxy'>
+<title>Control Requests Initiated by the Proxy</title>
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxStartProxy</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+options</emphasis>
+: LISTofOPTION</entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>choices: LISTofCHOICE</entry>
+ </row>
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+LbxClient</emphasis>
+, <emphasis>
+Alloc</emphasis>
+</entry>
+ </row>
+ <row>
+ <entry>where:</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>OPTION [optcode: CARD8,</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> len: OPTLEN,</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> option: (See <ulink
+url="lbx.htm#35444">See StartProxy Options</ulink>) ]</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>CHOICE [optcode: CARD8,</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> len: OPTLEN,</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> choice: (See <ulink
+url="lbx.htm#35444">See StartProxy Options</ulink>) ]</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+<!--
+ <row>
+ <entry role='protoargs'> -->
+
+
+<table frame='topbot'>
+ <title>StartProxy Options</title>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='4' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth='1.0*'/>
+ <colspec colname='c2' colwidth='1.5*'/>
+ <colspec colname='c3' colwidth='1.5*'/>
+ <colspec colname='c4' colwidth='1.5*'/>
+<thead>
+<row rowsep='1'>
+ <entry>optcode</entry>
+ <entry>option</entry>
+ <entry>choice</entry>
+ <entry>default</entry>
+</row>
+</thead>
+<tbody>
+<row>
+ <entry>delta-proxy</entry>
+ <entry>DELTAOPT</entry>
+ <entry>DELTACHOICE</entry>
+ <entry>entries=16, maxlen=64</entry>
+</row>
+<row>
+ <entry>delta-server</entry>
+ <entry>DELTAOPT</entry>
+ <entry>DELTACHOICE</entry>
+ <entry>entries=16, maxlen=64</entry>
+</row>
+<row>
+ <entry>stream-comp</entry>
+ <entry>LISTofNAMEDOPT</entry>
+ <entry>INDEXEDCHOICE</entry>
+ <entry>No Compression</entry>
+</row>
+<row>
+ <entry>bitmap-comp</entry>
+ <entry>LISTofSTRING8</entry>
+ <entry>LISTofINDEXEDOPT</entry>
+ <entry>No Compression</entry>
+</row>
+<row>
+ <entry>pixmap-comp</entry>
+ <entry>LISTofPIXMAPMETHOD</entry>
+ <entry>LISTofPIXMAPCHOICE</entry>
+ <entry>No Compression</entry>
+</row>
+<row>
+ <entry>use-squish</entry>
+ <entry>BOOL</entry>
+ <entry>BOOL</entry>
+ <entry>True</entry>
+</row>
+<row>
+ <entry>use-tags</entry>
+ <entry>BOOL</entry>
+ <entry>BOOL</entry>
+ <entry>True</entry>
+</row>
+<row>
+ <entry>colormap</entry>
+ <entry>LISTofSTRING8</entry>
+ <entry>INDEXEDCHOICE</entry>
+ <entry>No Colormap Grabbing</entry>
+</row>
+<row>
+ <entry>extension</entry>
+ <entry>NAMEDOPT</entry>
+ <entry>INDEXEDCHOICE</entry>
+ <entry>Extension Disabled</entry>
+ </row>
+</tbody>
+</tgroup>
+</table>
+<!-- </entry>
+ </row>
+-->
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry role='protoargs'>&nbsp;</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>DELTAOPT [minN, maxN, prefN: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> minMaxMsgLen, maxMaxMsgLen, prefMaxMsgLen:
+CARD8]</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>DELTACHOICE [entries, maxlen:
+CARD8]</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>INDEXEDCHOICE [index: CARD8,</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> data: LISTofBYTE]</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>INDEXEDOPT [index, opcode: CARD8]</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>NAMEDOPT [name: STRING8,</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> detail: LISTofBYTE]</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>OPTLEN 1 or 3 CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> where:</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> (0 &lt; in &lt;= 0xFF): out =
+in</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> (0 &lt;= in&lt;= 0xFFFF): out[0] =
+0; out[1] = in &gt;&gt; 8; out[2] = in&amp; 0xFF;</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>PIXMAPMETHOD [name: STRING8,</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> format-mask: BITMASK,</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> depths: LISTofCARD8]</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>PIXMAPCHOICE [index, opcode: CARD8,</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> format-mask: BITMASK,</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> depths: LISTofCARD8]</entry>
+ </row>
+ <row>
+ <entry role='protoargs'></entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request negotiates LBX protocol options, and switches the proxy-server
+connection from X11 protocol to LBX protocol.
+</para>
+
+
+<para>
+The proxy gives the preferred protocol options in the request. The server
+chooses from the given options and informs the proxy which to use. The options
+may be listed in any order, and the proxy may choose which options to
+negotiate. If an option is not successfully negotiated, the default is used.
+</para>
+
+
+<para>
+The server delta cache and proxy delta caches can be configured for number of
+entries, and the length of entries. (See <ulink url="lbx.htm#22595">See Delta
+cache</ulink> for details.) The delta caches are configured using the <emphasis>
+delta-server</emphasis>
+ and <emphasis>
+delta-proxy</emphasis>
+ options. To configure a cache, the proxy sends the minimum, maximum and
+preferred values for the number of cache entries, (<emphasis>
+minN, maxN, prefN</emphasis>
+), and the length of the cache entries, (<emphasis>
+minMaxMsgLen, maxMaxMsgLen, prefMaxMsgLen</emphasis>
+). The server’s reply fields, <emphasis>
+entries</emphasis>
+ and <emphasis>
+maxlen</emphasis>
+, contains the values to use. These values must be within the ranges specified
+by the proxy. The server may also specify an <emphasis>
+entries</emphasis>
+ value of 0 to disable delta caching. The cache entry lengths are specified in
+units of 4 bytes.
+</para>
+
+
+<para>
+The stream compression algorithm is selected using the <emphasis>
+stream-comp </emphasis>
+option. (Stream compression is described in <ulink url="lbx.htm#11596">See
+Stream Compression</ulink>.) Each algorithm has a name that follows the naming
+conventions in <ulink url="lbx.htm#13570">See Algorithm Naming</ulink>. To
+negotiate using the stream-comp option, the proxy lists its available
+compressors. For each candidate algorithm, the proxy sends the name in the
+<emphasis>
+name</emphasis>
+ field, and uses the <emphasis>
+detail</emphasis>
+ field to send any additional data specific to each compression algorithm. The
+reply contains a 0-based index into the list of algorithms to indicate which
+algorithm to use, followed by data specific to that algorithm.
+</para>
+
+
+<para>
+Bitmap compression is negotiated using the <emphasis>
+bitmap-comp</emphasis>
+ option. The proxy sends a list of names of available algorithms, and the
+server reply lists the algorithms to use. For each bitmap algorithm in the
+reply, a 0-based index into the list of algorithms indicates the algorithm, and
+the <emphasis>
+opcode</emphasis>
+ field gives the value for use in requests. The algorithm names follow the
+conventions in <ulink url="lbx.htm#13570">See Algorithm Naming</ulink>.
+</para>
+
+
+<para>
+Pixmap compression is negotiated using the <emphasis>
+pixmap-comp</emphasis>
+ option. The proxy sends a list of available algorithms. For each algorithm,
+the list includes, the name, a bitmask of supported formats, and a list of
+depths that the format supports. The server reply lists the algorithms to use.
+For each pixmap algorithm in the reply, the reply contains a 0-based index into
+the list of proxy algorithms, the opcode to use in requests when referring to
+this algorithm, a mask of valid formats, and a list of valid depths. Algorithm
+names follow the conventions in <ulink url="lbx.htm#13570">See Algorithm
+Naming</ulink>.
+</para>
+
+
+<para>
+Squishing is negotiated using the use-squish option. If the proxy desires
+squishing, it sends a true value. The reply from the server indicates whether
+to do squishing, and will indicate squishing only if <emphasis>
+use-squish</emphasis>
+ is set to true in the request.
+</para>
+
+
+<para>
+Tag caching, described in <ulink url="lbx.htm#11018">See Tags</ulink>, is
+negotiated using the use-tag option. If the proxy desires tag caching, it sends
+a true value. The reply from the server indicates whether to do tag caching,
+and will demand caching only if <emphasis>
+use-tag</emphasis>
+ is set to true in the request.
+</para>
+
+
+<para>
+The colormap option is used to negotiate what color matching algorithm will be
+used by the proxy when the proxy uses the <emphasis>
+LbxAllocColor</emphasis>
+ request to allocate pixels in a grabbed colormap. To negotiate using the
+colormap option, the proxy lists the names of available colormap algorithms.
+The choice in the reply contains a 0-based index into the list of algorithms to
+indicate which algorithm to use, followed by data specific to that algorithm.
+If no colormap algorithm is successfully negotiated, then the <emphasis>
+LbxAllocColor</emphasis>
+, <emphasis>
+LbxGrabCmap</emphasis>
+, and <emphasis>
+LbxReleaseCmap</emphasis>
+ requests will not be used.
+</para>
+
+
+<para>
+The extension option is used to control extensions to LBX. These extensions
+may, for example, enable other types of compression. To negotiate an extension,
+the name of the extension is sent, followed by any data specific to that
+extension. The extension name follows the conventions in <ulink
+url="lbx.htm#13570">See Algorithm Naming</ulink>. The extension option may
+occur multiple times in the start proxy message, since multiple extensions can
+be negotiated. The reply to an extension option contains the zero-based index
+of the extension option, as counted in the <emphasis>
+LbxStartProxy</emphasis>
+ message. This index is followed by extension-specific information. The server
+does not respond to extensions it does not recognize.
+</para>
+
+
+<para>
+An <emphasis>
+LbxClient</emphasis>
+ error is returned when a client which is already communicating through an LBX
+proxy to the X server sends a <emphasis>
+LbxStartProxy</emphasis>
+ request.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#27452">See
+LbxStartProxy</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxStopProxy</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+LbxClient</emphasis>
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request terminates the connection between the proxy and X server, and
+terminates any clients connected through the proxy.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#23471">See
+LbxStopProxy</ulink>.
+</para>
+
+
+<para>
+An <emphasis>
+LbxClient</emphasis>
+ error is returned if the requesting client is not an LBX proxy.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxNewClient</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+byte-order</emphasis>
+: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+client-id</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+protocol-major-version</emphasis>
+: CARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+protocol-minor-version:</emphasis>
+ CARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+authorization-protocol-name</emphasis>
+: STRING8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+authorization-protocol-data</emphasis>
+: STRING8</entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>Core X reply (if connection is rejected)</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>&nbsp;</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>OR</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>&nbsp;</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>success: BOOL</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>change-type: {NoDeltas, NormalClientDeltas,
+AppGroupDeltas}</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>protocol-major-version: CARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>protocol-minor-version: CARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>tag-id: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>length: CARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>connection-data: CONINFO or CONDIF or
+CONDIFROOT</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>&nbsp;</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>where:</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>CONINFO: (the &quot;additional data&quot;
+portion of the core connection reply for successes)</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>CONDIF: [resource-id-base: CARD32,</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> root-input-masks: LISTofSETofEVENT]</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>CONDIFROOT: [resource-id-base:
+CARD32,</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> root: WINDOW</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> root-visual: VISUALID</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> default-colormap: COLORMAP</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> white-pixel, black-pixel: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> root-input-masks: LISTofSETofEVENT]</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+Errors: LbxClient, Alloc
+</para>
+
+
+<para>
+This request, which is sent by the proxy over the control connection, creates a
+new virtual connection to the server.
+</para>
+
+
+<para>
+Much of the information in the <emphasis>
+LbxNewClient</emphasis>
+ request and reply is identical to the connection setup and reply information
+in the core X protocol.
+</para>
+
+
+<para>
+For the <emphasis>
+LbxNewClient</emphasis>
+ request, the field unique to LBX is client-id. For the <emphasis>
+LbxNewClient</emphasis>
+ reply, <emphasis>
+tag-id</emphasis>
+ and <emphasis>
+change-type</emphasis>
+ are fields unique to LBX, and the contents of connection-data may be different
+in LBX from the core X protocol (see below).
+</para>
+
+
+<para>
+The proxy assigns each virtual connection a unique identifier using the
+<emphasis>
+client-id</emphasis>
+ field in the <emphasis>
+LbxNewClient</emphasis>
+ request. This client-id is used in the LBX protocol to specify the current
+client (see the <emphasis>
+LbxSwitch</emphasis>
+ request and the <emphasis>
+LbxSwitchEvent</emphasis>
+). client-id 0 is reserved for the proxy control connection. An <emphasis>
+LbxClient</emphasis>
+ error will result if the <emphasis>
+LbxNewClient</emphasis>
+ request contains a client-id of 0 or an already in use client-id.
+</para>
+
+
+<para>
+If the server rejects this new virtual connection, the server sends a core X
+connection failure reply to the proxy. The current version of LBX does not
+support the return of an <emphasis>
+Authenticate</emphasis>
+ reply.
+</para>
+
+
+<para>
+If the <emphasis>
+change-type</emphasis>
+ field is set to <emphasis>
+NoDeltas</emphasis>
+, then <emphasis>
+connection-data</emphasis>
+ is sent using the CONINFO structure, which is identical to the additional data
+of the core connection reply. If the <emphasis>
+tag-id</emphasis>
+ is non-zero, then the connection-data is stored by the proxy using this tag
+value. Tagged connection data must be stored by the proxy, and can not be
+invalidated by the proxy until an <emphasis>
+LbxInvalidateTag</emphasis>
+ event is received for that tag.
+</para>
+
+
+<para>
+When the <emphasis>
+change-type</emphasis>
+ field is not set to <emphasis>
+NoDeltas</emphasis>
+, then connection data is sent as changes against connection information
+previously sent to the proxy. The <emphasis>
+tag-id</emphasis>
+ field, if non-zero, has the tag of the previously sent data to apply the
+changes to. A zero tag-id indicates that the changes are with respect to the
+connection information sent when the proxy connected to the server.
+</para>
+
+
+<para>
+If the <emphasis>
+change-type</emphasis>
+ field is set to <emphasis>
+NormalClientDeltas</emphasis>
+, then <emphasis>
+connection-data</emphasis>
+ is sent using the CONDIF structure. The values in the CONDIF structure are
+substituted for the identically named fields of the connection information for
+the new connection.
+</para>
+
+
+<para>
+If the <emphasis>
+change-type</emphasis>
+ field is set to <emphasis>
+AppGroupDeltas</emphasis>
+, then <emphasis>
+connection-data</emphasis>
+ is sent using the CONDIFROOT structure. The <emphasis>
+root</emphasis>
+, <emphasis>
+root-visual</emphasis>
+, and <emphasis>
+default-colormap</emphasis>
+ fields, when nonzero, are substituted for the corresponding fields in the
+reference connection information. The <emphasis>
+white-pixel</emphasis>
+ and <emphasis>
+black-pixel</emphasis>
+ fields are substituted only when the <emphasis>
+default-colormap</emphasis>
+ field of the reply is non-zero. When <emphasis>
+default-colormap</emphasis>
+ field of the reply is zero, so are <emphasis>
+white-pixel</emphasis>
+ and <emphasis>
+black-pixel</emphasis>
+. The first entry in the <emphasis>
+root-input-masks</emphasis>
+ field is the current-input-mask for the default root window. The remaining
+entries in <emphasis>
+root-input-masks</emphasis>
+ are input masks for non-video screens, as defined by the X Print Extension.
+The number of non-video screens is one less than the number of entries in
+<emphasis>
+root-input-masks</emphasis>
+. These screens are at the end of screen list in the reference connection
+information.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#15166">See The
+description of this request is on page 13.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxCloseClient</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+client</emphasis>
+: CARD32</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+LbxClient</emphasis>
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This requests the server to close down the connection represented by the
+specified proxy’s client identifier. If the specified client wasn’t
+previously registered with the server by a <emphasis>
+LbxNewClient</emphasis>
+ request, the server will send the <emphasis>
+LbxClient</emphasis>
+ error.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#21121">See The
+description of this request is on page 12.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxSwitch</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+client</emphasis>
+: CARD32</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+LbxClient</emphasis>
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request causes the X server to treat subsequent requests as being from a
+connection to the X server represented by the specified client identifier.
+</para>
+
+
+<para>
+If the client making the request is not the proxy, or if the client identifier
+sent in the request was not previously sent in a <emphasis>
+LbxNewClient</emphasis>
+ request, an <emphasis>
+LbxClient</emphasis>
+ error is returned.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#36790">See
+LbxSwitch</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxSync</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+The sync request causes the server to send a reply when all requests before the
+sync request have been processed.
+</para>
+
+
+<para>
+The encoding for this client is on <ulink url="lbx.htm#21186">See
+LbxSync</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxModifySequence</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+adjust</emphasis>
+: CARD32</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: None</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request advances the sequence number of the virtual client connection by
+the specified amount. The proxy sends the <emphasis>
+LbxModifySequence</emphasis>
+ request to the server when it replies to a client request without forwarding
+the client request on to the X server.
+</para>
+
+
+<para>
+The encoding for this client is on <ulink url="lbx.htm#10940">See The
+description of this request is on page 13.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxAllowMotion</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+num</emphasis>
+: CARD32</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: None</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request controls the delivery of optional motion notify events, as
+described in <ulink url="lbx.htm#15503">See Motion events</ulink>. The num
+field specifies an increase in the allowed number of motion notify events sent.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#11897">See The
+description of this request is on page 14.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxInvalidateTag</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+tag</emphasis>
+: CARD32</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+The LBX proxy sends this notification to the X server when it refuses to store
+tagged data, or when it releases tagged data which was previously stored and
+which was not invalidated by a notification from the X server.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#37545">See
+LbxInvalidateTag</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxTagData</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+tag</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+real-length</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+data</emphasis>
+: LISTofBYTE</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request specifies the data associated with a previously assigned tag. It
+is sent in two circumstances: in response to receiving a <emphasis>
+SendTagDataEvent</emphasis>
+, and spontaneously, when the proxy must rely on the server to store data which
+was not previously received from the server. The data is carried in the byte
+order and structure as would have originally been sent in the core protocol
+request.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#37174">See
+LbxTagData</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxGrabCmap</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+cmap</emphasis>
+: Colormap </entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+
+ <row>
+ <entry role='protoargs'><emphasis>
+smart-grab</emphasis>
+: BOOL</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+large-pixel: </emphasis>
+BOOL /* optional */</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+auto-release: </emphasis>
+BOOL /* optional */</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+three-channels</emphasis>
+: BOOL /* optional */</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+bits-per-rgb: </emphasis>
+CARD4 /* optional */</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+cells</emphasis>
+: LISTofCHAN /* optional */</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>&nbsp;</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>where:</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>CHAN: LISTofLBXPIXEL</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>LBXPIXEL: PIXELPRIVATE or PIXELPRIVATERANGE
+or </entry>
+ </row>
+ <row>
+ <entry role='protoargs'> PIXELALLOC or PIXELALLOCRANGE </entry>
+ </row>
+ <row>
+ <entry role='protoargs'>PIXEL: CARD8 or CARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>PIXELPRIVATE: [ pixel: PIXEL ]</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>PIXELPRIVATERANGE: [ first-pixel,
+last-pixel: PIXEL]</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>PIXELALLOC: [ pixel: PIXEL,</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> color: COLORSINGLE or COLORTRIPLE]</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>PIXELALLOCRANGE: [ first-pixel,
+last-pixel: PIXEL,</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> colors: LISTofCOLORSINGLE or
+LISTofCOLORTRIPLE]</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>COLORSINGLE: [ value: CARD8 or CARD16
+]</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>COLORTRIPLE: [ r, g, b:
+COLORSINGLE]</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Colormap</emphasis>
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request asks the server for control of allocating new colormap cells in
+the specified colormap. The server grants control by replying to this request.
+If no changes have occurred since the last time this proxy grabbed this
+colormap, then the <emphasis>
+smart-grab</emphasis>
+ field of the reply is set to true, and the optional fields are not sent.
+Otherwise, the current contents of the colormap are placed in the reply, as
+described later in this section.
+</para>
+
+
+<para>
+Once the proxy has received the reply, it can use the <emphasis>
+LbxAllocColor</emphasis>
+ request to allocate new colormap cells without the performance penalty of
+round trips. The proxy is still permitted to use the normal colormap and
+<emphasis>
+LbxIncrementPixel</emphasis>
+ requests while the colormap is grabbed. The grab is valid across all virtual
+connections of the proxy.
+</para>
+
+
+<para>
+The <emphasis>
+LbxGrabCmap</emphasis>
+ request is limited to colormaps for the visual types negotiated as part of the
+colormap algorithm negotiation in the start proxy request at connection setup.
+</para>
+
+
+<para>
+The server and other proxies may not allocate new colormap cells in the
+colormap while the colormap is grabbed by this proxy. If the server or another
+proxy needs to allocate new colormap cells, the server sends a Lbx<emphasis>
+ReleaseCmap</emphasis>
+ event to the proxy holding the grab, which then issues an <emphasis>
+LbxReleaseCmap</emphasis>
+ request.
+</para>
+
+
+<para>
+The server and other proxies may free colormap cells in a colormap grabbed by a
+proxy. The server will send an <emphasis>
+LbxFreeCells</emphasis>
+ event to the proxy that currently has the colormap grabbed when the cell
+reference count reaches 0.
+</para>
+
+
+<para>
+If the colormap is a of a static visual type, such as <emphasis>
+StaticGray</emphasis>
+, <emphasis>
+StaticColor</emphasis>
+, <emphasis>
+GrayScale</emphasis>
+, or <emphasis>
+TrueColor</emphasis>
+, then the proxy’s grab is immediately released by the server, and the proxy
+must use <emphasis>
+LbxIncrementPixel</emphasis>
+ requests in place of <emphasis>
+LbxAllocColor</emphasis>
+ requests for this colormap.
+</para>
+
+
+<para>
+If the cmap field does not refer to a valid colormap or the colormap is already
+grabbed by this proxy then a <emphasis>
+Colormap</emphasis>
+ error is generated.
+</para>
+
+
+<para>
+The reply describes the contents of the colormap via several arguments and a
+descriptive list containing one or three channels, with each channel describing
+allocations in the colormap.
+</para>
+
+
+<para>
+The <emphasis>
+large-pixel</emphasis>
+ argument, if True, specifies that PIXEL indices will be listed as CARD16
+quantities instead of CARD8. The<emphasis>
+ auto-release</emphasis>
+ field, if True, indicates that this colormap is of a static visual type and
+the proxy’s grab is immediately released by the server.
+</para>
+
+
+<para>
+If <emphasis>
+three-channels</emphasis>
+ is False, a single channel is enclosed and color values are described using
+COLORTRIPLE, which has fields for red, green and blue. A single channel is used
+when the visual type is not <emphasis>
+DirectColor</emphasis>
+ or <emphasis>
+TrueColor</emphasis>
+.
+</para>
+
+
+<para>
+If <emphasis>
+three-channels</emphasis>
+ is True, separate red, green and blue channel lists are enclosed, for
+describing a <emphasis>
+DirectColor</emphasis>
+ or <emphasis>
+TrueColor</emphasis>
+ colormap. Color values for entries in each channel are sent using COLORSINGLE
+and the corresponding PIXEL value refers to the RGB subfield of the current
+channel, as defined by the corresponding red-mask, green-mask and blue-mask of
+the visual.
+</para>
+
+
+<para>
+The <emphasis>
+bits-per-rgb</emphasis>
+ value is one less than the bits-per-rgb-value field of the visual that the
+colormap belongs to. If the value is 7 or less, then COLORSINGLE values in the
+descriptive list are sent using CARD8 fields. Otherwise these values are sent
+using CARD16 fields.
+</para>
+
+
+<para>
+The list describing current colormap allocations contains entries of the
+following types:
+</para>
+
+
+<para>
+An LBXPIXELPRIVATE entry indicates that the pixel in the <emphasis>
+pixel </emphasis>
+field is unavailable for allocation.
+</para>
+
+
+<para>
+An LBXPIXELPRIVATERANGE entry indicates that a contiguous range of pixels are
+unavailable for allocation. The range is <emphasis>
+first-pixel</emphasis>
+ to <emphasis>
+last-pixel</emphasis>
+, and includes <emphasis>
+last-pixel</emphasis>
+.
+</para>
+
+
+<para>
+An LBXPIXELALLOC entry indicates that the pixel in the <emphasis>
+pixel </emphasis>
+field is allocated as a read-only pixel. The <emphasis>
+color</emphasis>
+ field carries the color information of the pixel.
+</para>
+
+
+<para>
+An LBXPIXELALLOCRANGE entry indicates that a contiguous range of pixels are
+allocated as read-only. The range starts <emphasis>
+first-pixel</emphasis>
+ to <emphasis>
+last-pixel</emphasis>
+, and includes <emphasis>
+last-pixel</emphasis>
+. These fields are followed by a list of COLORSINGLE or COLORTRIPLE, depending
+on the value of <emphasis>
+three-channels</emphasis>
+.
+</para>
+
+
+<para>
+A NEXTCHANNEL entry indicates that the next channel of the colormap will be
+described.
+</para>
+
+
+<para>
+A LISTEND entry indicates the end of the colormap description.
+</para>
+
+
+<para>
+All pixels not described in the reply are unallocated.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#17198">See
+LbxGrabCmap</ulink>.
+</para>
+
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxReleaseCmap</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+cmap</emphasis>
+: Colormap</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request releases the specified grabbed colormap. If the <emphasis>
+cmap</emphasis>
+ field does not refer to a colormap, a <emphasis>
+BadColormap</emphasis>
+ error is produced.
+</para>
+
+
+<para>
+The proxy must remember the state of the colormap when the <emphasis>
+LbxReleaseCmap</emphasis>
+ request is issued if this proxy may at some future time issue another
+<emphasis>
+LbxGrabCmap</emphasis>
+ request on this colormap before the state of the colormap changes.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#14796">See
+LbxReleaseCmap</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxInternAtoms</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+count</emphasis>
+: CARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+names: LISTofSTRING8</emphasis>
+</entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+
+ <row>
+ <entry role='protoargs'><emphasis>
+atoms</emphasis>
+: LISTofATOM</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request allows the proxy to intern a group of atoms in a single round
+trip. The server will create any atoms that do not exist.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#34140">See
+LbxInternAtoms</ulink>.
+</para>
+
+
+
+</sect3>
+<sect3 id='substitution_requests'>
+<title>Substitution Requests</title>
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxAllocColor</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+cmap</emphasis>
+: Colormap</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+pixel</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+red</emphasis>
+, <emphasis>
+green</emphasis>
+, <emphasis>
+blue</emphasis>
+: CARD16</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request is sent by a proxy that has given colormap grabbed to allocate a
+new read-only cell in the colormap. The proxy may substitute this request for
+the core <emphasis>
+AllocColor</emphasis>
+ and <emphasis>
+AllocNamedColor</emphasis>
+ requests.
+</para>
+
+
+<para>
+The <emphasis>
+pixel</emphasis>
+ field identifies the colormap cell to allocate. The <emphasis>
+red</emphasis>
+, <emphasis>
+green</emphasis>
+, and <emphasis>
+blue</emphasis>
+ fields are the hardware specific color values of the corresponding fields of
+the core <emphasis>
+AllocColor</emphasis>
+ request. The mapping to hardware specific colormap values by the proxy is
+performed using the color algorithm negotiated by <emphasis>
+LbxStartProxy</emphasis>
+.
+</para>
+
+
+<para>
+For colormaps of static visual types, the <emphasis>
+LbxIncrementPixel</emphasis>
+ request is used instead of LBX <emphasis>
+AllocColor</emphasis>
+.
+</para>
+
+
+<para>
+If the <emphasis>
+cmap</emphasis>
+ field does not identify a grabbed colormap then a <emphasis>
+BadAccess</emphasis>
+ error is produced. If the <emphasis>
+pixel</emphasis>
+ field refers to a read-write entry, or the pixel field refers to a pixel
+outside of the range of this colormap, a <emphasis>
+BadAlloc</emphasis>
+ error is produced.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#28429">See
+LbxAllocColor</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxIncrementPixel</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+cmap</emphasis>
+: COLORMAP</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+pixel</emphasis>
+: CARD32</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: None</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+AllocColor</emphasis>
+ request for read-only pixels currently allocated for the current client. If
+the visual type of the colormap is of a static type, this request may be used
+on currently unallocated pixels. The colormap is not required to be grabbed to
+use this request.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#38053">See The
+description of this request is on page 14.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxDelta</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+count</emphasis>
+: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+cache-index</emphasis>
+: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+diffs</emphasis>
+: LISTofDIFFITEM</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request contains a minimal amount of information relative to a similar
+prior request. The information is in the form of a difference comparison to a
+prior request. The prior request is specified by an index to a cache,
+independently maintained by both the proxy and the server.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#39838">See The
+description of this request is on page 18.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxGetModifierMapping</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+
+ <row>
+ <entry role='protoargs'><emphasis>
+keyspermod</emphasis>
+: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+tag</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+keycodes</emphasis>
+: LISTofKEYCODE /* optional */</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request is identical to the core <emphasis>
+GetModifierMapping</emphasis>
+ request, with the addition of a tag being returned in the reply. See <ulink
+url="lbx.htm#26534">See Tag Substitution in Requests</ulink> for a description
+of the <emphasis>
+tag</emphasis>
+ field and optional fields.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#40057">See
+LbxGetModifierMapping</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxGetKeyboardMapping</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+firstKeyCode</emphasis>
+: KEYCODE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+count</emphasis>
+: CARD8</entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+
+ <row>
+ <entry role='protoargs'><emphasis>
+keysperkeycode</emphasis>
+: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+tag</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+keysyms</emphasis>
+: LISTofKEYSYM /* optional */</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Value</emphasis>
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request is identical to the X <emphasis>
+GetKeyboardMapping</emphasis>
+ protocol request, with the addition that a tag is returned in the reply. See
+<ulink url="lbx.htm#26534">See Tag Substitution in Requests</ulink> for a
+description of the <emphasis>
+tag</emphasis>
+ field and optional fields.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#21702">See
+LbxGetKeyboardMapping</ulink>.
+</para>
+
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxGetWinAttrAndGeom</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+window</emphasis>
+: WINDOW</entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+
+ <row>
+ <entry role='protoargs'>visual: VISUALID</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>class: {InputOutput, InputOnly}</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>bit-gravity: BITGRAVITY</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>win-gravity: WINGRAVITY</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>backing-store: {NotUseful, WhenMapped,
+Always}</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>backing-planes: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>backing-pixel: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>save-under: BOOL</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>colormap: COLORMAP or None</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>map-is-installed: BOOL</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>map-state: {Unmapped, Unviewable,
+Viewable}</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>all-event-masks, your-event-mask:
+SETofEVENT</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>do-not-propagate-mask: SETofDEVICEEVENT</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>override-redirect: BOOL</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>root: WINDOW</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>depth: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>x, y: INT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>width, height, border-width: CARD16</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Window</emphasis>
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+<emphasis>
+GetWindowAttributes</emphasis>
+ and <emphasis>
+GetGeometry</emphasis>
+ are frequently used together in the X protocol. <emphasis>
+LbxGetWinAttrAndGeom</emphasis>
+ allows the proxy to request the same information in one round trip.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#41440">See
+LbxGetWinAttrAndGeom</ulink>.
+</para>
+
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxQueryFont</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+font</emphasis>
+: FONTABLE</entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>compression: BOOL</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>tag: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>font-info: FONTINFO /* optional
+*/</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>char-infos: LISTofCHARINFO or LISTofLBXCHARINFO
+ /* optional */</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>where:</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>LBXCHARINFO: [left-side-bearing:
+INT6</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> right-side-bearing: INT7</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> character-width: INT6</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> ascent: INT6</entry>
+ </row>
+ <row>
+ <entry role='protoargs'> descent: INT7]</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Font,Alloc</emphasis>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request is used to replace the core <emphasis>
+QueryFont</emphasis>
+ request and has identical semantics.
+</para>
+
+
+<para>
+See <ulink url="lbx.htm#26534">See Tag Substitution in Requests</ulink> for a
+description of the <emphasis>
+tag</emphasis>
+ field and optional fields.
+</para>
+
+
+<para>
+The <emphasis>
+compression</emphasis>
+ field is True if the <emphasis>
+char-infos</emphasis>
+ field is represented using LBXCHARINFO.
+</para>
+
+
+<para>
+The per-character information will be encoded in an LBXCHARINFO when, for every
+character, the character-width, left-side-bearing, and ascent can each be
+represented in not more than 6 bits, and the right-side-bearing and descent can
+each be represented in not more than 7 bits, and the attributes field is
+identical the attributes field of the max_bounds of the <emphasis>
+font_info</emphasis>
+ field of the font.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#24597">See
+LbxQueryFont</ulink>.
+</para>
+
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxChangeProperty</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+window</emphasis>
+: WINDOW</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+property</emphasis>
+: ATOM</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+type</emphasis>
+: ATOM</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+format</emphasis>
+: {0,8,16,32}</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+mode</emphasis>
+: {Replace, Prepend, Append}</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+nUnits</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>tag: CARD32</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request is sent to the server when the client sends an X <emphasis>
+ChangeProperty </emphasis>
+request through the proxy. The size of the data is sent with this request, but
+not the property data itself. The server reply contains a tag identifier for
+the data, which is stored in the proxy. The proxy must not discard this data
+before it is sent to the server, or invalidated by the server. This means that
+before issuing an <emphasis>
+LbxStopProxy</emphasis>
+ request, or exiting, the proxy must send Lbx<emphasis>
+TagData</emphasis>
+ requests for these items. If the server loses the connection before the
+information is sent back, the server should revert the property value to its
+last known value, if possible.
+</para>
+
+
+<para>
+If the <emphasis>
+mode</emphasis>
+ field is <emphasis>
+Prepend</emphasis>
+ or <emphasis>
+Append</emphasis>
+, the tag refers only to the prepended or appended data.
+</para>
+
+
+<para>
+If the tag in the reply is zero, then the change was ignored by the server, as
+defined in the security extension. The proxy should dump the associated data,
+since the server will never ask for it.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#18013">See
+LbxChangeProperty</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxGetProperty</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+window</emphasis>
+: WINDOW</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+property</emphasis>
+: ATOM</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+type</emphasis>
+: ATOM or AnyPropertyType</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+long-offset</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+long-length</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+delete</emphasis>
+: CARD8</entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+
+ <row>
+ <entry role='protoargs'>type: ATOM or None</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>format: {0, 8, 16, 32}</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>bytes-after: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>nItems: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>tag: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>value: LISTofINT8 or LISTofINT16 or
+LISTofINT32</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request may be used by the proxy as a substitution for a core <emphasis>
+GetProperty</emphasis>
+ request. It allows tags to be used for property data that is unlikely to
+change often in value, but is likely to be fetched by multiple clients.
+</para>
+
+
+<para>
+The <emphasis>
+LbxGetProperty</emphasis>
+ request has the same arguments as the core <emphasis>
+GetProperty</emphasis>
+ request. The reply for <emphasis>
+LbxGetProperty</emphasis>
+ has all of the fields from the core <emphasis>
+GetProperty</emphasis>
+ reply, but has the additional fields of <emphasis>
+nItems</emphasis>
+ and <emphasis>
+tag</emphasis>
+.
+</para>
+
+
+<para>
+In order to utilize tags in <emphasis>
+LbxGetProperty</emphasis>
+ for a specific property, the server must first send the complete property data
+to the proxy and associate this data with a tag. More precisely, the server
+sends an <emphasis>
+LbxGetProperty</emphasis>
+ reply with a new <emphasis>
+tag</emphasis>
+, <emphasis>
+nItems</emphasis>
+ set to the number of items in the property, the size of the property data in
+the reply length field, and the complete property data in value. The proxy
+stores the property data in its tag cache and associates it with the specified
+tag.
+</para>
+
+
+<para>
+In response to future <emphasis>
+LbxGetProperty</emphasis>
+ requests for the same property, if the server thinks that the proxy has the
+actual property data in its tag cache, it may choose to send an <emphasis>
+LbxGetProperty</emphasis>
+ reply without the actual property data. In this case, the reply would include
+a non-zero <emphasis>
+tag</emphasis>
+, a zero reply length, and no data for value.
+</para>
+
+
+<para>
+If the server chooses not to generate a tagged reply to <emphasis>
+LbxGetProperty</emphasis>
+, or for some reason is unable to do so, it would send a reply with a <emphasis>
+tag</emphasis>
+ of zero, the size of the property data in the reply length field, and the
+complete property data in value.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#13863">See
+LbxGetProperty</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxPolyPoint</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+points</emphasis>
+: LISTofLBXPOINT</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+ and those given for the corresponding X request.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+PolyPoint</emphasis>
+ request. Not all <emphasis>
+PolyPoint</emphasis>
+ requests can be represented as <emphasis>
+LbxPolyPoint</emphasis>
+ requests.
+</para>
+
+
+<para>
+The proxy will convert the representation of the points to be relative to the
+previous point, as described by previous coordinate mode in the X protocol.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#29719">See
+LbxPolyPoint</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxPolyLine</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+points</emphasis>
+: LISTofLBXPOINT</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+ and those given for the corresponding X request.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+PolyLine</emphasis>
+ request. Not all <emphasis>
+PolyLine</emphasis>
+ requests can be represented as <emphasis>
+LbxPolyline</emphasis>
+ requests.
+</para>
+
+
+<para>
+The proxy will convert the representation of the points to be relative to the
+previous point, as described by previous coordinate mode in the X protocol.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#31086">See The
+description of this request is on page 21.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxPolySegment</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+segments</emphasis>
+: LISTofLBXSEGMENT</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>&nbsp;</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>where:</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>LBXSEGEMENT; [x1, y1, x2, y2: LBXINT16]</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+ and those given for the corresponding X request.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+PolySegment</emphasis>
+ request. Not all <emphasis>
+PolySegment</emphasis>
+ requests can be represented as <emphasis>
+LbxPolySegment</emphasis>
+ requests.
+</para>
+
+
+<para>
+For segments other than the first segment of the request, [x1, y1] is
+relative to [x1, y1] of the previous segment. For all segments, [x2, y2] is
+relative to that segment’s [x1, y1].
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#27528">See
+LbxPolySegment</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxPolyRectangle</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+rectangles</emphasis>
+: LISTofLBXRECTANGLE</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+ and those given for the corresponding X request.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+PolyRectangle</emphasis>
+ request. Not all <emphasis>
+PolyRectangle</emphasis>
+ requests can be represented as <emphasis>
+LbxPolyRectangle</emphasis>
+ requests.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#33628">See The
+description of this request is on page 22.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxPolyArc</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+arcs</emphasis>
+: LISTofLBXARC</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+ and those given for the corresponding X request.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+PolyArc</emphasis>
+ request. Not all <emphasis>
+PolyArc</emphasis>
+ requests can be represented as <emphasis>
+LbxPolyArc</emphasis>
+ requests.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#25855">See
+LbxPolyArc</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxPolyFillRectangle</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+rectangles</emphasis>
+: LISTofLBXRECTANGLE</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+ and those given for the corresponding X request.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+PolyFillRectangle</emphasis>
+ request. Not all <emphasis>
+PolyFillRectangle</emphasis>
+ requests can be represented as <emphasis>
+LbxPolyFillRectangle</emphasis>
+ requests.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#26399">See
+LbxPolyFillRectangle</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxPolyFillArc</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+arcs</emphasis>
+: LISTofLBXARC</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+ and those given for the corresponding X request.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+PolyFillArc</emphasis>
+ request. Not all <emphasis>
+PolyFillArc</emphasis>
+ requests can be represented as <emphasis>
+LbxPolyFillArc</emphasis>
+ requests.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#19081">See The
+description of this request is on page 22.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxFillPoly</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+shape</emphasis>
+: BYTE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+points</emphasis>
+: LISTofLBXPOINT</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+ and those given for the corresponding X request.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+FillPoly</emphasis>
+ request. Not all <emphasis>
+FillPoly</emphasis>
+ requests can be represented as <emphasis>
+LbxFillPoly</emphasis>
+ requests.
+</para>
+
+
+<para>
+The proxy will convert the representation of the points to be relative to the
+previous point, as described by previous coordinate mode in the X protocol.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#24998">See
+LbxFillPoly</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxCopyArea</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+srcCache</emphasis>
+: CARD8 /* source drawable */</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+src-Drawable</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+src-x</emphasis>
+: LBXPINT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+src-y</emphasis>
+: LBXPINT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+width</emphasis>
+: LBXCARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+height</emphasis>
+: LBXCARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+dst-x</emphasis>
+: LBXPINT16 </entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+dst-y</emphasis>
+: LBXPINT16</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: Those given for the corresponding X
+request.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+CopyArea</emphasis>
+ request for requests within its encoding range.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#10231">See
+LbxCopyArea</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxCopyPlane</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+bit-plane</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+src-cache</emphasis>
+: CARD8 /* cache reference for source drawable */</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+src-drawable</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+src-x</emphasis>
+: LBXPINT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+src-y</emphasis>
+: LBXPINT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+width</emphasis>
+: LBXCARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+height</emphasis>
+: LBXCARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+dst-x</emphasis>
+: LBXPINT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+dst-y</emphasis>
+: LBXPINT16</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: Those given for the corresponding X
+request.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+CopyPlane</emphasis>
+ request for requests within its coding range.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#18847">See
+LbxCopyPlane</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxPolyText8</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+x</emphasis>
+: LBXPINT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+y</emphasis>
+: LBXPINT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+items</emphasis>
+: LISTofTEXTITEM8</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+, and those given for the corresponding X request.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+PolyText8</emphasis>
+ request for requests within its encoding range.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#39640">See The
+description of this request is on page 23.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxPolyText16</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+x:</emphasis>
+ LBXPINT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+y</emphasis>
+: LBXPINT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+items</emphasis>
+: LISTofTEXTITEM16</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+, and those given for the corresponding X request.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+PolyText16</emphasis>
+ request for requests within its encoding range.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#32634">See The
+description of this request is on page 24.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxImageText8</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+nChars</emphasis>
+: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+x</emphasis>
+: LBXPINT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+y</emphasis>
+: LBXPINT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+string</emphasis>
+: STRING8</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+, and those given for the corresponding X request.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+ImageText8</emphasis>
+ request for requests within its encoding range.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#17018">See The
+description of this request is on page 24.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxImageText16</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+nChars</emphasis>
+: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>x: LBXPINT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+y</emphasis>
+: LBXPINT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+string</emphasis>
+: STRING16</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+, and those given for the corresponding X request.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request replaces the <emphasis>
+ImageText16</emphasis>
+ request for requests within its encoding range.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#23910">See The
+description of this request is on page 24.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxPutImage</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+compression-method</emphasis>
+: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+format</emphasis>
+: {<emphasis>
+Bitmap</emphasis>
+, <emphasis>
+XYPixmap</emphasis>
+, <emphasis>
+ZPixmap</emphasis>
+} /* packed */</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+gc-and-drawable: </emphasis>
+LBXGCANDDRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+width</emphasis>
+, <emphasis>
+height</emphasis>
+: LBXCARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+dst-x</emphasis>
+, <emphasis>
+dst-y</emphasis>
+: LBXPINT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+depth</emphasis>
+: CARD8 /* packed */</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+left-pad</emphasis>
+: CARD8 /* packed */</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+pad-bytes</emphasis>
+: CARD8 /* packed */</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+data</emphasis>
+:LISTofBYTE</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+, <emphasis>
+Value</emphasis>
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+When the request can be usefully compressed, this request replaces the
+<emphasis>
+PutImage</emphasis>
+ request. The <emphasis>
+compression-method</emphasis>
+ parameter contains the opcode of a compression method returned in the
+<emphasis>
+LbxStartProxy</emphasis>
+ reply. The <emphasis>
+pad-bytes</emphasis>
+ parameter gives the number of unused pad bytes that follow the compressed
+image data. All other parameters are as in the X request. If the specified
+compression method is not recognized, the server returns a <emphasis>
+Value</emphasis>
+ error.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#12268">See
+LbxPutImage</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxGetImage</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+drawable</emphasis>
+: DRAWABLE</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+x</emphasis>
+, <emphasis>
+y</emphasis>
+: INT16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+width</emphasis>
+, <emphasis>
+height</emphasis>
+: CARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+plane-mask</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+format</emphasis>
+: {XYPixmap, ZPixmap}</entry>
+ </row>
+ <row>
+ <entry>=&gt;</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>depth: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>x-length: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>visual: VISUALID or None</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>compression-method: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'>data: LISTofBYTE</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc,Match,Value</emphasis>
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request can replace the <emphasis>
+GetImage</emphasis>
+ request. The same semantics apply, with the following exceptions.
+</para>
+
+
+<para>
+The <emphasis>
+compression-method</emphasis>
+ field contains the opcode of the compression method used in the reply. The
+compression opcodes are supplied in the <emphasis>
+LbxStartProxy</emphasis>
+ reply. The <emphasis>
+x-length </emphasis>
+field<emphasis>
+ </emphasis>
+contains the length of the uncompressed version of the reply in 4 byte units.
+</para>
+
+
+<para>
+A <emphasis>
+Value</emphasis>
+ error is returned if the format is not recognized by the X server. A <emphasis>
+Match</emphasis>
+ error is returned under the same circumstances as described by the <emphasis>
+GetImage</emphasis>
+ request.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#10066">See
+LbxGetImage</ulink>.
+</para>
+
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxBeginLargeRequest</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+large-request-length</emphasis>
+: CARD32</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request, along with the Lbx<emphasis>
+LargeRequestData</emphasis>
+ and Lbx<emphasis>
+EndLargeRequest</emphasis>
+ requests, is used to transport a large request in pieces. The smaller size of
+the resulting requests allows smoother multiplexing of clients on a single low
+bandwidth connection to the server. The resulting finer-grained multiplexing
+improves responsiveness for the other clients.
+</para>
+
+
+<para>
+After a <emphasis>
+LbxBeginLargeRequest</emphasis>
+ request is sent, multiple <emphasis>
+LbxLargeRequestData</emphasis>
+ requests are sent to transport all of the data in the large request, and
+finally an <emphasis>
+LbxEndLargeRequest</emphasis>
+ request is sent. The large-request-length field expresses the total length of
+the transported large request, expressed as the number of bytes in the
+transported request divided by four.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#22013">See The
+description of this request is on page 25.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxLargeRequestData</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+data</emphasis>
+: LISTofBYTE</entry>
+ </row>
+
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Alloc</emphasis>
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request is used to carry the segments of a larger request, as described in
+the definition of <emphasis>
+LbxBeginLargeRequest</emphasis>
+. The data must be carried in order, starting with the request header, and each
+segment must be multiples of 4 bytes long. If the <emphasis>
+LbxLargeRequestData</emphasis>
+ is not preceded by a corresponding <emphasis>
+LbxBeginLargeRequest</emphasis>
+, a <emphasis>
+BadAlloc</emphasis>
+ error is generated.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#31469">See The
+description of this request is on page 26.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxEndLargeRequest</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoerror'>Errors: <emphasis>
+Length, Alloc</emphasis>
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+As described in the definition of <emphasis>
+LbxBeginLargeRequest</emphasis>
+, <emphasis>
+LbxEndLargeRequest</emphasis>
+ is used to signal the end of a series of <emphasis>
+LargeRequestData</emphasis>
+ requests. If the total length of the data transported by the <emphasis>
+LbxLargeRequestData</emphasis>
+ requests does not match the large-request-length field of the preceding
+<emphasis>
+LbxBeginLargeRequest</emphasis>
+ request, then a <emphasis>
+Length</emphasis>
+ error occurs. If the <emphasis>
+LbxEndLargeRequest</emphasis>
+ is not preceded by a corresponding <emphasis>
+LbxBeginLargeRequest</emphasis>
+, a <emphasis>
+BadAlloc</emphasis>
+ error is generated. The request is executed in order for that client as if it
+were the request after the request preceding <emphasis>
+LbxEndLargeRequest</emphasis>
+.
+</para>
+
+
+<para>
+The encoding for this request is on <ulink url="lbx.htm#31037">See
+LbxEndLargeRequest</ulink>.
+</para>
+
+
+
+</sect3>
+</sect2>
+<sect2 id='events'>
+<title>Events</title>
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxSwitchEvent</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+client</emphasis>
+: CARD32</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+Notify the proxy that the subsequent replies, events, and errors are relative
+to the specified client.
+</para>
+
+
+<para>
+The encoding for this event is on <ulink url="lbx.htm#17348">See
+LbxSwitchEvent</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxCloseEvent</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+client</emphasis>
+: CARD32</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+Notify the proxy that the specified client's connection to the server is closed.
+</para>
+
+
+<para>
+The encoding for this event is on <ulink url="lbx.htm#41814">See The
+description of this event is on page 27.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxInvalidateTagEvent</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+tag</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+tag-type</emphasis>
+: {Modmap, Keymap, Property, Font, ConnInfo}</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This message informs the proxy that the tag and the server data referenced by
+the tag are obsolete, and should be discarded. The tag type may be one of the
+following values: <emphasis>
+LbxTagTypeModmap</emphasis>
+, <emphasis>
+LbxTagTypeKeymap</emphasis>
+, <emphasis>
+LbxTagTypeProperty</emphasis>
+, <emphasis>
+LbxTagTypeFont</emphasis>
+, <emphasis>
+LbxTagTypeConnInfo</emphasis>
+.
+</para>
+
+
+<para>
+The encoding for this event is on <ulink url="lbx.htm#34406">See
+LbxInvalidateTagEvent</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxSendTagDataEvent</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+tag</emphasis>
+: CARD32</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+tag-type</emphasis>
+: {Property}</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+The server sends this event to the proxy to request a copy of tagged data which
+is being stored by the proxy. The request contains a tag which was previously
+assigned to the data by the server. The proxy should respond to <emphasis>
+SendTagData</emphasis>
+ by sending a <emphasis>
+TagData</emphasis>
+ request to the server. The tag type may be one of the following values:
+<emphasis>
+LbxTagTypeProperty</emphasis>
+.
+</para>
+
+
+<para>
+The encoding for this event is on <ulink url="lbx.htm#22353">See
+LbxSendTagDataEvent</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxListenToOne</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+client</emphasis>
+: CARD32 or <emphasis>
+0xffffffff</emphasis>
+</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+When the server is grabbed, <emphasis>
+ListenToOne</emphasis>
+ is sent to the proxy. As an X client, the proxy itself is unaffected by grabs,
+in order that it may respond to requests for data from the X server.
+</para>
+
+
+<para>
+When the client grabbing the server is managed through the proxy, the proxy
+will permit messages from itself and the grabbing client to be sent immediately
+to the server, and may buffer requests from other clients of the proxy. The
+client is identified in the event.
+</para>
+
+
+<para>
+When the client grabbing the server is not managed through the proxy, the
+client field in the event will be <emphasis>
+0xffffffff</emphasis>
+. The proxy will communicate with the server, and it may buffer requests from
+other clients. The proxy will continue to handle new connections while the
+server is grabbed.
+</para>
+
+
+<para>
+The server will send <emphasis>
+ListenToAll</emphasis>
+ to the proxy when the server is ungrabbed. There is no time-out for this
+interval in the protocol.
+</para>
+
+
+<para>
+The encoding for this event is on <ulink url="lbx.htm#18630">See The
+description of this event is on page 27.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry role='protoname'>LbxListenToAll</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+Notify the proxy that the server has been ungrabbed, and that the proxy may now
+send all buffered client requests on to the server.
+</para>
+
+
+<para>
+The encoding for this event is on <ulink url="lbx.htm#30610">See The
+description of this event is on page 27.</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxQuickMotionDeltaEvent</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+deltaTime</emphasis>
+: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+deltaX</emphasis>
+: INT8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+deltaY</emphasis>
+: INT8</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This event is used as a replacement for the <emphasis>
+MotionNotify</emphasis>
+ event when possible. The fields are used as deltas to the most recent
+<emphasis>
+MotionNotify</emphasis>
+ event encoded as a <emphasis>
+MotionNotify</emphasis>
+ event, <emphasis>
+LbxQuickMotionDeltaEvent</emphasis>
+, or <emphasis>
+LbxMotionDeltaEvent</emphasis>
+. Not every <emphasis>
+MotionNotify</emphasis>
+ event can be encoded as a <emphasis>
+LbxQuickMotionDeltaEvent</emphasis>
+.
+</para>
+
+
+<para>
+The encoding for this event is on <ulink url="lbx.htm#35213">See
+LbxQuickMotionDeltaEvent</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxMotionDeltaEvent</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+deltaX</emphasis>
+: INT8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+deltaY</emphasis>
+: INT8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+deltaTime</emphasis>
+: CARD16</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+deltaSequence</emphasis>
+: CARD16</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This event is used as a replacement for the <emphasis>
+MotionNotify</emphasis>
+ event when possible. The fields are used as deltas to the most recent
+<emphasis>
+MotionNotify</emphasis>
+ event encoded as a <emphasis>
+MotionNotify</emphasis>
+ event, <emphasis>
+LbxQuickMotionDeltaEvent</emphasis>
+, or <emphasis>
+LbxMotionDeltaEvent</emphasis>
+. Not every <emphasis>
+MotionNotify</emphasis>
+ event can be encoded as <emphasis>
+a LbxMotionDeltaEvent</emphasis>
+.
+</para>
+
+
+<para>
+The encoding for this event is on <ulink url="lbx.htm#35310">See
+LbxMotionDeltaEvent</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxReleaseCmapEvent</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+colormap</emphasis>
+: Colormap</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This event notifies the proxy that it must release the grab on this colormap
+via the ReleaseCmap request. <ulink url="lbx.htm#34675">See
+LbxReleaseCmap</ulink>
+</para>
+
+
+<para>
+The encoding for this event is on <ulink url="lbx.htm#14052">See
+LbxReleaseCmapEvent</ulink>.
+</para>
+
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxFreeCellsEvent</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+colormap</emphasis>
+: Colormap</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+pixelStart, pixelEnd</emphasis>
+: CARD32</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+The <emphasis>
+LbxFreeCells</emphasis>
+ event is sent to a proxy that has a colormap grabbed to notify the proxy that
+the reference count of the described cells were decremented to zero by the
+server or another proxy. The reference count includes those by this proxy. The
+proxy must update its copy of the colormap state accordingly if the colormap is
+still grabbed, or if the proxy may in the future grab the colormap using
+smart-grab mode. <ulink url="lbx.htm#10922">See LbxGrabCmap</ulink>
+</para>
+
+
+<para>
+The pixelStart and pixelEnd fields of the event denote a continuous range of
+cells that were freed.
+</para>
+
+
+<para>
+The encoding for this event is on <ulink url="lbx.htm#14731">See
+LbxFreeCellsEvent</ulink>.
+</para>
+
+</sect2>
+<sect2 id='responses'>
+<title>Responses</title>
+
+<para>
+Responses are messages from the server to the proxy that not, strictly
+speaking, events, replies or errors.
+</para>
+
+<informaltable frame='none' tabstyle='proto'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <thead>
+ <row>
+ <entry role='protoname'>LbxDeltaResponse</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry role='protoargs'><emphasis>
+count</emphasis>
+: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+cache-index</emphasis>
+: CARD8</entry>
+ </row>
+ <row>
+ <entry role='protoargs'><emphasis>
+diffs</emphasis>
+: LISTofDIFFITEM</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This response carries an event, reply, or error that has been encoded relative
+to a message in the response delta cache. The <emphasis>
+cache-index</emphasis>
+ field is the index into the cache. Each entry in <emphasis>
+diffs</emphasis>
+ provides a byte offset and replacement value to use in reconstructing the
+response.
+</para>
+
+
+<para>
+The encoding for this event is on <ulink url="lbx.htm#17100">See
+LbxDeltaResponse</ulink>.
+</para>
+
+
+</sect2>
+</sect1>
+<sect1 id='algorithm_naming'>
+<title>Algorithm Naming</title>
+
+<para>
+To avoid potential clashes between different but similar algorithms for stream,
+bitmap, and pixmap compression, the following naming scheme will be adhered to:
+</para>
+
+
+<para>
+Each algorithm has a unique name, which is a STRING8, of the following form:
+</para>
+
+
+<para>
+ &lt;organization&gt;-&lt;some-descriptive-name&gt;
+</para>
+
+
+<para>
+The organization field above is the organization name as registered in section
+1 of the X Registry (the registry is provided as a free service by the X
+Consortium.) This prevents conflicts among different vendor’s extensions.
+</para>
+
+
+<para>
+As an example, the X Consortium defines a zlib-based stream compression
+algorithm called XC-ZLIB.
+</para>
+
+
+</sect1>
+<sect1 id='encoding'>
+<title>Encoding</title>
+
+<para>
+The syntax and types used in the encoding are taken from the X protocol
+encoding. Where LBX defines new types, they are defined earlier in this
+document.
+</para>
+
+
+<para>
+As in the X protocol, in various cases, the number of bytes occupied by a
+component will be specified by a lowercase single-letter variable name instead
+of a specific numeric value, and often some other component will have its value
+specified as a simple numeric expression involving these variables. Components
+specified with such expressions are always interpreted as unsigned integers.
+The scope of such variables is always just the enclosing request, reply, error,
+event, or compound type structure.
+</para>
+
+
+<para>
+For unused bytes, the encode-form is:
+</para>
+
+<literallayout>
+N unused
+</literallayout>
+
+<para>
+If the number of unused bytes is variable, the encode-form typically is:
+</para>
+
+<literallayout>
+p unused, p=pad(E)
+</literallayout>
+
+<para>
+where E is some expression, and pad(E) is the number of bytes needed to round E
+up to a multiple of four.
+</para>
+
+
+<para>
+pad(E) = (4 - (E mod 4)) mod 4
+</para>
+
+
+<para>
+In many of the encodings, the length depends on many variable length fields.
+The variable L is used to indicate the number of padded 4 byte units needed to
+carry the request. Similarly, the variable Lpad indicates the number of bytes
+needed to pad the request to a 4 byte boundary.
+</para>
+
+<literallayout>
+For counted lists there is a common encoding of NLISTofFOO:
+</literallayout>
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>NLISTofFOO</emphasis>
+1 m num items
+m LISTofFOO items
+</literallayout>
+
+<para>
+For cached GC and Drawables:
+</para>
+
+<literallayout>
+<emphasis role='bold'>LBXGCANDDRAWUPDATE</emphasis>
+4 or 0 DRAWBLE optional drawable
+4 or 0 GC optional GC
+</literallayout>
+
+
+
+<literallayout>
+<emphasis role='bold'>LBXGCANDDRAWABLE</emphasis>
+8 LBXGCANDDRAWENT cache-entries
+8 unused
+m LBXGCANDDRAWUPDATE optional GC and Drawable
+</literallayout>
+
+
+<sect2 id='errors2'>
+<title>Errors</title>
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxClient</emphasis>
+1 0 Error
+1 CARD8 error-base + 0
+2 CARD16 sequence number
+4 unused
+2 CARD16 lbx opcode
+1 CARD8 major opcode
+21 unused
+</literallayout>
+
+</sect2>
+<sect2 id='requests2'>
+<title>Requests</title>
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxQueryVersion</emphasis>
+1 CARD8 opcode
+1 0 lbx opcode
+2 1 request length
+=&gt;
+1 1 Reply
+1 unused
+2 CARD16 sequence number
+4 0 reply length
+2 CARD16 major version
+2 CARD16 minor version
+20 unused
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#18761">See
+LbxQueryVersion</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxStartProxy</emphasis>
+1 CARD8 opcode
+1 1 lbx opcode
+2 L request length
+n NLISTofOPTION-REQUEST options
+p unused, p=pad(n)
+
+<emphasis role='bold'>OPTION-REQUEST</emphasis>
+1 OPTCODE option-code
+m OPTLEN option-request-byte-length, (b=m+a+1)
+a DELTAOPT or option
+ NLISTofNAMEDOPT or
+ NLISTofSTR or
+ NLISTofPIXMAPMETHOD or
+ BOOL
+</literallayout>
+
+<para>
+The encoding of the option field depends on the option-code.
+See <ulink url="lbx.htm#35444">See StartProxy Options</ulink>.
+</para>
+
+<literallayout class='monospaced'>
+1 OPTCODE option-code
+0 LbxOptionDeltaProxy
+1 LbxOptionDeltaServer
+2 LbxOptionStreamCompression
+3 LbxOptionBitmapCompression
+4 LbxOptionPixmapCompression
+5 LbxOptionMessageCompression /* also known as squishing */
+6 LbxOptionUseTags
+7 LbxOptionColormapAllocation
+255 LbxOptionExtension
+</literallayout>
+
+<para>
+OPTLEN has two possible encodings, depending on the size of the value carried:
+</para>
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>OPTLEN</emphasis>
+1 CARD8 b (0 &lt; b &lt;= 255)
+
+<emphasis role='bold'>OPTLEN</emphasis>
+1 0 long length header
+1 c length0, c = b &gt;&gt; 8
+1 d length1, d= b &amp; #xff
+
+<emphasis role='bold'>DELTAOPT</emphasis>
+1 CARD8 min-cache-size
+1 CARD8 max-cache-size
+1 CARD8 preferred-cache-size
+1 CARD8 min-message-length
+1 CARD8 max-message-length (in 4-byte units)
+1 CARD8 preferred-message-length
+
+<emphasis role='bold'>NAMEDOPT</emphasis>
+f STR type-name
+1 g+1 option-data-length
+g LISTofBYTE option-data (option specific)
+
+<emphasis role='bold'>PIXMAPMETHOD</emphasis>
+h STR name
+1 BITMASK format mask
+1 j depth count
+j LISTofCARD8 depths
+
+=&gt;
+=&gt;
+
+1 1 Reply
+1 CARD8 count
+
+0xff options in request cannot be decoded
+2 CARD16 sequence number
+4 (a+p-32)/4 reply length
+a LISTofCHOICE options-reply
+p unused, if (n&lt;24) p=24-n else p=pad(n)
+
+<emphasis role='bold'>CHOICE</emphasis>
+1 CARD8 request-option-index
+b OPTLEN reply-option-byte-length
+c DELTACHOICE or choice
+ INDEXEDCHOICE or
+ NLISTofINDEXEDOPT or
+ NLISTofPIXMAPCHOICE or
+ BOOL or
+ INDEXEDCHOICE
+</literallayout>
+
+<para>
+The encoding of the choice field depends on the option-code. See <ulink
+url="lbx.htm#35444">See StartProxy Options</ulink>.
+</para>
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>DELTACHOICE</emphasis>
+1 CARD8 preferred cache size
+1 CARD8 preferred message length in 4-byte units
+
+<emphasis role='bold'>INDEXEDCHOICE</emphasis>
+1 CARD8 index
+d LISTofBYTE data
+
+<emphasis role='bold'>PIXMAPCHOICE</emphasis>
+1 CARD8 index
+1 CARD8 opcode
+1 BITMASK format mask
+e NLISTofCARD8 depths
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#20870">See
+LbxStartProxy</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxStopProxy</emphasis>
+1 CARD8 opcode
+1 2 lbx opcode
+2 1 request length
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#27455">See
+LbxStopProxy</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxSwitch</emphasis>
+1 CARD8 opcode
+1 3 lbx opcode
+2 2 request length
+4 CARD32 client
+</literallayout>
+
+<para>
+The description of this request is on
+<ulink url="lbx.htm#33500">See LbxSwitch</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxNewClient</emphasis>
+1 CARD8 opcode
+1 4 lbx opcode
+2 L request length
+4 CARD32 client
+The remaining bytes of the request are the core connection setup.
+=&gt;
+If the connection is rejected, a core connection reply is sent. Otherwise the
+reply has the form:
+1 BOOL success
+1 change type
+ 0 no-deltas
+ 1 normal-client-deltas
+ 2 app-group-deltas
+2 CARD16 major version
+2 CARD16 minor version
+2 1 + a length
+4 CARD32 tag id
+</literallayout>
+
+<para>
+The remaining bytes depend on the value of change-type and length.
+</para>
+
+<para>
+For no-deltas, the remaining bytes are the &quot;additional data&quot;
+bytes of the core reply. (a = length of core reply, in 4 byte quantities).
+</para>
+
+<para>
+For normal-client-deltas, the additional bytes have the form, with a length (a
+= 1 +b):
+</para>
+
+<literallayout class='monospaced'>
+4 CARD32 resource id base
+4b LISTofSETofEVENT root input masks
+</literallayout>
+
+<para>
+For app-group-deltas, the additional bytes have the following form, with a
+length of (a = 1 + 4c):
+</para>
+
+<literallayout class='monospaced'>
+4 CARD32 resource id base
+4 WINDOW root id base
+4 VISUALID visual
+4 COLORMAP colormap
+4 CARD32 white pixel
+4 CARD32 black pixel
+4c LISTofSETofEVENT root input masks
+</literallayout>
+
+<para>
+The description of this request is on
+<ulink url="lbx.htm#17810">See LbxNewClient</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxCloseClient</emphasis>
+1 CARD8 opcode
+1 5 lbx opcode
+2 2 request length
+4 CARD32 client
+</literallayout>
+
+<para>
+The description of this request is on
+<ulink url="lbx.htm#21625">See LbxCloseClient</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxModifySequence</emphasis>
+1 CARD8 opcode
+1 6 lbx opcode
+2 2 request length
+4 CARD32 offset to sequence number
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#36693">See
+LbxModifySequence</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxAllowMotion</emphasis>
+1 CARD8 opcode
+1 7 lbx opcode
+2 2 request length
+4 CARD32 number of MotionNotify events
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#15895">See
+LbxAllowMotion</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxIncrementPixel</emphasis>
+1 CARD8 opcode
+1 8 lbx opcode
+2 3 request length
+4 COLORMAP colormap
+4 CARD32 pixel
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#27227">See
+LbxIncrementPixel</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxDelta</emphasis>
+1 CARD8 opcode
+1 9 lbx opcode
+2 1+(2n +p+2)/4 request length
+1 n count of diffs
+1 CARD8 cache index
+2n LISTofDIFFITEM offsets and differences
+p unused, p=pad(2n + 2)
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#26857">See
+LbxDelta</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxGetModifierMapping</emphasis>
+1 CARD8 opcode
+1 10 lbx opcode
+2 1 request length
+=&gt;
+1 1 Reply
+1 n keycodes-per-modifier
+2 CARD16 sequence number
+4 2n reply length
+4 CARD32 tag
+20 unused
+8n LISTofKEYCODE keycodes
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#37687">See
+LbxGetModifierMapping</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxInvalidateTag</emphasis>
+1 CARD8 opcode
+1 12 lbx opcode
+2 2 request length
+4 CARD32 tag
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#12515">See
+LbxInvalidateTag</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxPolyPoint</emphasis>
+1 CARD8 opcode
+1 13 lbx opcode
+2 1+(m+n+p)/4 request length
+m LBXGCANDDRAWABLE cache entries
+n LISTofLBXPOINT points (n is data-dependent)
+p 0 unused, p=Lpad
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#37179">See
+LbxPolyPoint</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxPolyLine</emphasis>
+1 CARD8 opcode
+1 14 lbx opcode
+2 1+(m+n+p)/4 request length
+m LBXGCANDDRAWABLE cache entries
+n LISTofLBXPOINT points (n is data-dependent)
+p 0 unused, p=Lpad
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#16574">See
+LbxPolyLine</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxPolySegment</emphasis>
+1 CARD8 opcode
+1 15 lbx opcode
+2 1+(m+n+p)/4 request length
+m LBXGCANDDRAWABLE cache entries
+n LISTofLBXSEGMENT segments (n is data-dependent)
+p 0 unused, p=Lpad
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#26077">See
+LbxPolySegment</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxPolyRectangle</emphasis>
+1 CARD8 opcode
+1 16 lbx opcode
+2 1+(m+n+p)/4 request length
+m LBXGCANDDRAWABLE cache entries
+n LISTofLBXRECTANGLE rectangles (n is data-dependent)
+p 0 unused, p=pad(m+n)
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#40958">See
+LbxPolyRectangle</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxPolyArc</emphasis>
+1 CARD8 opcode
+1 17 lbx opcode
+2 1+(m+n+p)/4 request length
+m LBXGCANDDRAWABLE cache entries
+n LISTofLBXARCS arcs (n is data-dependent)
+p 0 unused, p=Lpad
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#15317">See
+LbxPolyArc</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxFillPoly</emphasis>
+1 CARD8 opcode
+1 18 lbx opcode
+2 1+(3+m+n+p)/4 request length
+1 LBXGCANDDRAWENT cache entries
+1 shape
+0 Complex
+1 Nonconvex
+2 Convex
+1 p pad byte count
+m LBXGCANDDRAWUPDATE optional gc and drawable
+n LISTofLBXPOINT points (n is data-dependent)
+p 0 unused, p=Lpad
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#35796">See
+LbxFillPoly</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxPolyFillRectangle</emphasis>
+1 CARD8 opcode
+1 19 lbx opcode
+2 1+(m+n+p)/4 request length
+m LBXGCANDDRAWABLE cache entries
+n LISTofLBXRECTANGLE rectangles (n is data-dependent)
+p 0 unused, p=Lpad
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#25511">See
+LbxPolyFillRectangle</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxPolyFillArc</emphasis>
+1 CARD8 opcode
+1 20 lbx opcode
+2 1+(m+n+p)/4 request length
+m LBXGCANDDRAWABLE cache entries
+n LISTofLBXARC arcs (n is data-dependent)
+p 0 unused, p=Lpad
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#42698">See
+LbxPolyFillArc</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxGetKeyboardMapping</emphasis>
+1 CARD8 opcode
+1 21 lbx opcode
+2 2 request length
+1 KEYCODE first keycode
+1 m count
+2 unused
+=&gt;
+1 1 Reply
+1 n keysyms-per-keycode
+2 CARD16 sequence number
+4 nm reply length (m = count field from the request)
+4 CARD32 tag
+20 unused
+4nm LISTofKEYSYM keysyms
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#33719">See
+LbxGetKeyboardMapping</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxQueryFont</emphasis>
+1 CARD8 opcode
+1 22 lbx opcode
+2 2 request length
+4 FONTABLE font
+=&gt;
+1 1 Reply
+1 BOOL compression
+2 CARD16 sequence number
+4 L reply length
+4 CARD32 tag
+20 unused
+All of the following is conditional:
+12 CHARINFO min-bounds
+4 unused
+12 CHARINFO max-bounds
+4 unused
+2 CARD16 min-char-or-byte2
+2 CARD16 max-char-or-byte2
+2 CARD16 default-char
+2 n number of FONTPROPs in properties
+1 draw-direction
+0 <emphasis>LeftToRight</emphasis>
+1 <emphasis>RightToLeft</emphasis>
+1 CARD8 min-byte1
+1 CARD8 max-byte1
+1 BOOL all-chars-exist
+2 INT16 font-ascent
+2 INT16 font-descent
+4 m number of elements in char-infos
+8n LISTofFONTPROP properties
+and either
+12m LISTofCHARINFO char-infos
+or
+m LISTofLBXCHARINFO char-infos
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#18818">See
+LbxQueryFont</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxChangeProperty</emphasis>
+1 CARD8 opcode
+1 23 lbx opcode
+2 6 request length
+4 WINDOW window
+4 ATOM property
+4 ATOM type
+1 CARD8 format
+1 mode
+0 Replace
+1 Preprend
+2 Append
+2 unused
+4 CARD32 length of data in format units
+ (= n for format = 8)
+ (= n/2 for format = 16)
+ (= n/4 for format = 32)
+=&gt;
+1 1 Reply
+1 unused
+2 CARD16 sequence number
+4 0 reply length
+4 CARD32 tag
+20 unused
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#40098">See
+LbxChangeProperty</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxGetProperty</emphasis>
+1 CARD8 opcode
+1 24 lbx opcode
+2 7 request length
+4 WINDOW window
+4 ATOM property
+4 ATOM type
+0 AnyPropertyType
+1 CARD8 delete
+3 unused
+4 CARD32 long-offset
+4 CARD32 long-length
+=&gt;
+1 1 Reply
+1 CARD8 format
+2 CARD16 sequence number
+4 CARD32 reply length
+4 ATOM type
+0 None
+4 CARD32 bytes-after
+4 CARD32 length of value in format units
+ (= 0 for format = 0)
+ (= n for format = 8)
+ (= n/2 for format = 16)
+ (= n/4 for format = 32)
+4 CARD32 tag
+8 unused
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#31397">See
+LbxGetProperty</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxTagData</emphasis>
+1 CARD8 opcode
+1 25 lbx opcode
+2 3+(n+p)/4 request length
+4 CARD32 tag
+4 CARD32 length of data in bytes
+n LISTofBYTE data
+p unused, p=pad(n)
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#17987">See
+LbxTagData</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxCopyArea</emphasis>
+1 CARD8 opcode
+1 26 lbx opcode
+2 L request length
+1 CARD8 source drawable cache entry
+1 LBXGCANDDRAWENT cache entries
+4 or 0 DRAWABLE optional source drawable
+b LBXGCANDDRAWUPDATE optional gc and dest drawable
+c LBXPINT16 src-x
+d LBXPINT16 src-y
+e LBXPINT16 dst-x
+f LBXPINT16 dst-y
+g LBXCARD16 width
+h LBXCARD16 height
+p unused, p=Lpad
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#11409">See
+LbxCopyArea</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxCopyPlane</emphasis>
+1 CARD8 opcode
+1 27 lbx opcode
+2 L request length
+4 CARD32 bit plane
+1 CARD8 source drawable cache entry
+1 LBXGCANDDRAWENT cache entries
+4 or 0 DRAWABLE optional source drawable
+b LBXGCANDDRAWUPDATE optional gc and dest drawable
+c LBXPINT16 src-x
+d LBXPINT16 src-y
+e LBXPINT16 dst-x
+f LBXPINT16 dst-y
+g LBXCARD16 width
+h LBXCARD16 height
+p unused, p=Lpad
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#36772">See
+LbxCopyPlane</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxPolyText8</emphasis>
+1 CARD8 opcode
+1 28 lbx opcode
+2 L request length
+1 LBXGCANDDRAWENT cache entries
+a LBXGCANDDRAWUPDATE optional gc and drawable
+b LBXPINT16 x
+c LBXPINT16 y
+n LISTofTEXTITEM8 items
+p unused, p=Lpad
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#23201">See
+LbxPolyText8</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxPolyText16</emphasis>
+1 CARD8 opcode
+1 29 lbx opcode
+2 L request length
+1 LBXGCANDDRAWENT cache entries
+a LBXGCANDDRAWUPDATE optional gc and drawable
+b LBXPINT16 x
+c LBXPINT16 y
+2n LISTofTEXTITEM16 items
+p unused, p=Lpad
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#13228">See
+LbxPolyText16</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxImageText8</emphasis>
+1 CARD8 opcode
+1 30 lbx opcode
+2 L request length
+1 LBXGCANDDRAWENT cache entries
+a LBXGCANDDRAWUPDATE optional gc and drawable
+b LBXPINT16 x
+c LBXPINT16 y
+n STRING8 string
+p unused, p=Lpad
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#10990">See
+LbxImageText8</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxImageText16</emphasis>
+1 CARD8 opcode
+1 31 lbx opcode
+2 L request length
+1 LBXGCANDDRAWENT cache entries
+a LBXGCANDDRAWUPDATE optional gc and drawable
+b LBXPINT16 x
+c LBXPINT16 y
+2n STRING16 string
+p unused, p=Lpad
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#39584">See
+LbxImageText16</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxQueryExtension</emphasis>
+1 CARD8 opcode
+1 32 lbx opcode
+2 2+(n+p)/4 request length
+4 n length of extension name
+n STRING8 extension name
+p unused, p=pad(n)
+=&gt;
+1 1 Reply
+1 n number of requests in the extension
+2 CARD16 sequence number
+4 0 or 2*(m + p) reply length, m = (n+7)/8
+1 BOOL present
+1 CARD8 major opcode
+1 CARD8 first event
+1 CARD8 first error
+20 unused
+m LISTofMASK optional reply-mask
+p unused, p=pad(m)
+m LISTofMASK optional event-mask
+p unused, p=pad(m)
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#36662">See
+LbxQueryExtension</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxPutImage</emphasis>
+1 CARD8 opcode
+1 33 lbx opcode
+2 L request length
+1 CARD8 compression method
+1 LBXGCANDDRAWENT cache entries
+a PIPACKED bit-packed
+b LBXGCANDDRAWUPDATE optional gc and drawable
+c LBXCARD16 width
+d LBXCARD16 height
+e LBXPINT16 x
+f LBXPINT16 y
+n LISTofBYTE compressed image data
+p unused, p=Lpad
+</literallayout>
+
+<para>
+If there is no left padding and the depth is less than or equal to nine,
+PIPPACKED is encoded as follows:
+</para>
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>PIPACKED</emphasis>
+1 #x80 | (format &lt;&lt; 5) | ((depth -1) &lt;&lt; 2)
+</literallayout>
+
+<para>
+Otherwise PIPACKED is defined as:
+</para>
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>PIPACKED</emphasis>
+1 (depth -1) &lt;&lt; 2)
+1 (format &lt;&lt; 5) | left-pad
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#21218">See
+LbxPutImage</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxGetImage</emphasis>
+1 CARD8 opcode
+1 34 lbx opcode
+2 6 request length
+4 DRAWABLE drawable
+2 INT16 x
+2 INT16 y
+2 CARD16 width
+2 CARD16 height
+4 CARD32 plane mask
+1 CARD8 format
+3 unused
+=&gt;
+1 1 Reply
+1 CARD8 depth
+2 CARD16 sequence number
+4 (n+p)/4 reply length
+4 (m+p)/4 X reply length; if uncompressed, m=n
+4 VISUALID visual
+0 None
+1 compression method
+15 unused
+n LISTofBYTE data
+p unused, p=pad(n)
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#26896">See
+LbxGetImage</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxBeginLargeRequest</emphasis>
+1 CARD8 opcode
+1 35 lbx opcode
+2 2 request length
+4 CARD32 large request length
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#31209">See
+LbxBeginLargeRequest</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxLargeRequestData</emphasis>
+1 CARD8 opcode
+1 36 lbx opcode
+2 1+n request length
+4n LISTofBYTE data
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#36982">See
+LbxLargeRequestData</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxEndLargeRequest</emphasis>
+1 CARD8 opcode
+1 37 lbx opcode
+2 1 request length
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#31841">See
+LbxEndLargeRequest</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxInternAtoms</emphasis>
+1 CARD8 opcode
+1 38 lbx opcode
+2 1+(2+m+n+p)/4 request length
+2 m num-atoms
+n LISTofLONGSTR names
+p pad p=Lpad
+=&gt;
+1 1 Reply
+1 unused
+2 CARD16 sequence number
+4 a reply length, a = MAX(m - 6, 0)
+4*m LISTofATOM atoms
+p pad p = MAX(0, 4*(6 - m))
+&nbsp;
+LONGSTR
+2 c string length
+c STRING8 string
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#21636">See
+LbxInternAtoms</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxGetWinAttrAndGeom</emphasis>
+1 CARD8 opcode
+1 39 lbx opcode
+2 2 request length
+4 CARD32 window id
+=&gt;
+1 1 Reply
+1 backing store
+0 NotUseful
+1 WhenMapped
+2 Always
+2 CARD16 sequence number
+4 7 reply length
+4 VISUALID visual id
+2 class
+1 InputOutput
+2 InputOnly
+1 BITGRAVITY bit gravity
+1 WINGRAVITY window gravity
+4 CARD32 backing bit planes
+4 CARD32 backing pixel
+1 BOOL save under
+1 BOOL map installed
+1 map state
+0 Unmapped
+1 Unviewable
+2 Viewable
+1 BOOL override
+4 COLORMAP colormap
+4 SETofEVENT all events mask
+4 SETofEVENT your event mask
+2 SETofDEVICEEVENT do not propagate mask
+2 unused
+4 WINDOW root
+2 INT16 x
+2 INT16 y
+2 CARD16 width
+2 CARD16 height
+2 CARD16 border width
+1 CARD8 depth
+1 unused
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#39382">See
+LbxGetWinAttrAndGeom</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxGrabCmap</emphasis>
+1 CARD8 opcode
+1 40 lbx opcode
+2 2 request length
+4 COLORMAP colormap
+=&gt;
+</literallayout>
+
+<para>
+If smart-grab is true, the reply is as follows:
+</para>
+
+<literallayout class='monospaced'>
+1 1 Reply
+1 #x80 flags
+2 CARD16 sequence number
+4 0 reply length
+24 unused
+
+If smart-grab is false, the reply is as follows:
+
+1 1 Reply
+1 flags (set of)
+ #x40 auto-release
+ #x20 three-channels
+ #x10 two-byte-pixels
+lower four bits specifies bits-per-pixel
+2 CARD16 sequence number
+4 L reply length
+m CHAN or CHANNELS cells (CHAN if !three-channels)
+p 0 pad(m)
+
+<emphasis role='bold'>CHANNELS</emphasis>
+a CHAN red
+1 5 next channel
+b CHAN green
+1 5 next channel
+c CHAN blue
+1 0 list end
+
+<emphasis role='bold'>CHAN</emphasis>
+d LISTofLBXPIXEL
+
+<emphasis role='bold'>LBXPIXEL</emphasis>
+e PIXELPRIVATE or
+ PIXELPRIVATERANGE or
+ PIXELALLOC or
+ PIXELALLOCRANGE
+
+<emphasis role='bold'>PIXELPRIVATE</emphasis>
+1 1 pixel-private
+f PIXEL pixel
+
+<emphasis role='bold'>PIXEL</emphasis>
+f CARD8 or CARD16 (CARD8 if !two-byte-pixels)
+
+<emphasis role='bold'>PIXELPRIVATERANGE</emphasis>
+1 2 pixel-private-range
+f PIXEL fist-pixel
+f PIXEL last-pixel
+
+<emphasis role='bold'>PIXELALLOC</emphasis>
+1 3 pixel-private
+f PIXEL pixel
+g COLORSINGLE or COLORTRIPLE color (COLORSINGLE if
+three-channels)
+
+<emphasis role='bold'>COLORSINGLE</emphasis>
+h CARD8 or CARD16 value (CARD8 if bits-per-rgb =&lt; 7)
+
+<emphasis role='bold'>COLORTRIPLE</emphasis>
+h COLORSINGLE red
+h COLORSINGLE green
+h COLORSINGLE blue
+
+<emphasis role='bold'>PIXELALLOCRANGE</emphasis>
+1 4 pixel-private
+f PIXEL first-pixel
+f PIXEL last-pixel
+j LISTofCOLORSINGLE or color (COLORSINGLE if three-channels)
+ LISTofCOLORTRIPLE
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#10922">See
+LbxGrabCmap</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxReleaseCmap</emphasis>
+1 CARD8 opcode
+1 41 lbx opcode
+2 2 request length
+4 COLORMAP cmap
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#34675">See
+LbxReleaseCmap</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxAllocColor</emphasis>
+1 CARD8 opcode
+1 42 lbx opcode
+2 5 request length
+4 COLORMAP colormap
+4 CARD32 pixel
+2 CARD16 red
+2 CARD16 green
+2 CARD16 blue
+2 unused
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#10446">See
+LbxAllocColor</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxSync</emphasis>
+1 CARD8 opcode
+1 43 lbx opcode
+2 1 request length
+=&gt;
+1 1 Reply
+1 n unused
+2 CARD16 sequence number
+4 0 reply length
+24 unused
+</literallayout>
+
+<para>
+The description of this request is on <ulink url="lbx.htm#30719">See
+LbxSync</ulink>.
+</para>
+
+
+
+</sect2>
+<sect2 id='events2'>
+<title>Events</title>
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxSwitchEvent</emphasis>
+1 base + 0 code
+1 0 lbx type
+2 CARD16 sequence number
+4 CARD32 client
+24 unused
+</literallayout>
+
+<para>
+The description of this event is on <ulink url="lbx.htm#33748">See
+LbxSwitchEvent</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxCloseEvent</emphasis>
+1 base + 0 code
+1 1 lbx type
+2 CARD16 sequence number
+4 CARD32 client
+24 unused
+</literallayout>
+
+<para>
+The description of this event is on <ulink url="lbx.htm#17292">See
+LbxCloseEvent</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxInvalidateTagEvent</emphasis>
+1 base + 0 code
+1 3 lbx type
+2 CARD16 sequence number
+4 CARD32 tag
+4 tag-type
+1 <emphasis>LbxTagTypeModmap</emphasis>
+2 <emphasis>LbxTagTypeKeymap</emphasis>
+3 <emphasis>LbxTagTypeProperty</emphasis>
+4 <emphasis>LbxTagTypeFont</emphasis>
+5 <emphasis>LbxTagTypeConnInfo</emphasis>
+20 unused
+</literallayout>
+
+<para>
+The description of this event is on <ulink url="lbx.htm#23016">See
+LbxInvalidateTagEvent</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxSendTagDataEvent</emphasis>
+1 base + 0 code
+1 4 lbx type
+2 CARD16 sequence number
+4 CARD32 tag
+4 tag-type
+3 <emphasis>LbxTagTypeProperty</emphasis>
+20 unused
+</literallayout>
+
+<para>
+The description of this event is on <ulink url="lbx.htm#20373">See
+LbxSendTagDataEvent</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxListenToOne</emphasis>
+1 base + 0 code
+1 5 lbx type
+2 CARD16 sequence number
+4 CARD32 client
+<emphasis>#xFFFFFFFF</emphasis>
+a client not managed by the proxy
+24 unused
+</literallayout>
+
+<para>
+The description of this event is on <ulink url="lbx.htm#25209">See
+LbxListenToOne</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxListenToAll</emphasis>
+1 base + 0 code
+1 6 lbx type
+2 CARD16 sequence number
+28 unused
+</literallayout>
+
+<para>
+The description of this event is on <ulink url="lbx.htm#11095">See
+LbxListenToAll</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxQuickMotionDeltaEvent</emphasis>
+1 base + 1 code
+1 CARD8 delta-time
+1 INT8 delta-x
+1 INT8 delta-y
+</literallayout>
+
+<para>
+This event is not padded to 32 bytes.
+</para>
+
+
+<para>
+The description of this event is on <ulink url="lbx.htm#40268">See
+LbxQuickMotionDeltaEvent</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxMotionDeltaEvent</emphasis>
+1 base + 0 code
+1 7 lbx type
+1 INT8 delta-x
+1 INT8 delta-y
+2 CARD16 delta-time
+2 CARD16 delta-sequence
+</literallayout>
+
+<para>
+This event is not padded to 32 bytes.
+</para>
+
+
+<para>
+The description of this event is on <ulink url="lbx.htm#30033">See
+LbxMotionDeltaEvent</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxReleaseCmapEvent</emphasis>
+1 base + 0 code
+1 8 lbx type
+2 CARD16 sequence number
+4 COLORMAP colormap
+24 unused
+</literallayout>
+
+<para>
+The description of this event is on <ulink url="lbx.htm#19129">See
+LbxReleaseCmapEvent</ulink>.
+</para>
+
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxFreeCellsEvent</emphasis>
+1 base + 0 code
+1 9 lbx type
+2 CARD16 sequence number
+4 COLORMAP colormap
+4 PIXEL pixel start
+4 PIXEL pixel end
+16 unused
+</literallayout>
+
+<para>
+The description of this event is on <ulink url="lbx.htm#38041">See
+LbxFreeCellsEvent</ulink>.
+</para>
+
+
+</sect2>
+<sect2 id='re_encoding_of_x_events'>
+<title>Re-encoding of X Events</title>
+
+<para>
+The X protocol requires all X events to be 32 bytes. The LBX server reduces the
+number of bytes sent between the server and the proxy for some X events by not
+appending unused pad bytes to the event data. The offsets of X event data are
+unchanged. The proxy will pad the events to 32 bytes before passing them on to
+the client.
+</para>
+
+
+<para>
+LBX reencodes X event representations into the following sizes, if squishing is
+enabled:
+</para>
+
+<para><programlisting>
+KeyOrButton 32
+EnterOrLeave 32
+Keymap 32
+Expose 20
+GraphicsExposure 24
+NoExposure 12
+VisibilityNotify 12
+CreateNotify 24
+DestroyNotify 12
+UnmapNotify 16
+MapNotify 16
+MapRequest 12
+Reparent 24
+ConfigureNotify 28
+ConfigureRequest 28
+GravityNotify 16
+ResizeRequest 12
+Circulate 20
+Property Notify 20
+SelectionClear 20
+SelectionRequest 28
+SelectionNotify 24
+Colormap Notify 16
+MappingNotify 8
+ClientMessage 32
+Unknown 32
+</programlisting></para>
+
+</sect2>
+<sect2 id='responses2'>
+<title>Responses</title>
+
+<literallayout class='monospaced'>
+<emphasis role='bold'>LbxDeltaResponse</emphasis>
+1 event_base + 0 event code
+1 2 lbx type
+2 1+(2+2n+p)/4 request length
+1 n count of diffs
+1 CARD8 cache index
+2n LISTofDIFFITEM offsets and differences
+p unused, p=pad(2n)
+</literallayout>
+
+<para>
+The description of this response is on <ulink url="lbx.htm#34042">See
+LbxDeltaResponse</ulink>.
+</para>
+
+</sect2>
+</sect1>
+</article>
diff --git a/specs/multibuf.xml b/specs/multibuf.xml
new file mode 100644
index 0000000..9e2b065
--- /dev/null
+++ b/specs/multibuf.xml
@@ -0,0 +1,1628 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+
+
+<!-- lifted from troff+ms+XMan by doclifter -->
+<book id="multibuf">
+
+<bookinfo>
+ <title>Extending X for Double-Buffering, Multi-Buffering, and Stereo</title>
+ <authorgroup>
+ <othercredit>
+ <firstname>Jeffrey</firstname><surname>Friedberg</surname>
+ </othercredit>
+ <othercredit>
+ <firstname>Larry</firstname><surname>Seiler</surname>
+ </othercredit>
+ <othercredit>
+ <firstname>Jeff</firstname><surname>Vroom</surname>
+ </othercredit>
+ </authorgroup>
+ <copyright><year>1989</year><holder>Digital Equipment Corporation</holder></copyright>
+ <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
+ <releaseinfo>Version 3.3</releaseinfo>
+
+<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 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. This document
+is subject to change.
+</para>
+</legalnotice>
+
+<legalnotice>
+<para role="multiLicensing">Copyright © 1989, 1994 X Consortium</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 &ldquo;AS IS&rdquo;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+</para>
+<para>
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+</para>
+<para>X Window System is a trademark of The OpenGroup.</para>
+
+</legalnotice>
+</bookinfo>
+
+<preface><title>Warning</title>
+<warning><para>
+The <emphasis remap='I'>Multi-Buffering</emphasis> extension described here
+was a draft standard of the X Consortium prior to Release 6.1. It has been
+superseded by the Double Buffer
+Extension (DBE). DBE is an X Consortium Standard as of Release 6.1.
+</para></warning>
+</preface>
+
+<chapter id='Introduction'>
+<title>Introduction</title>
+
+<para>
+Several proposals have been written that address some of the
+issues surrounding the support of double-buffered, multi-buffered,
+and stereo windows in the X Window System:
+</para>
+
+<itemizedlist>
+ <listitem>
+ <para>
+<emphasis remap='I'>Extending X for Double-Buffering,</emphasis>
+Jeffrey Friedberg, Larry Seiler, Randi Rost.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+<emphasis remap='I'>(Proposal for) Double-Buffering Extensions</emphasis>,
+Jeff Vroom.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+<emphasis remap='I'>An Extension to X.11 for Displays with Multiple Buffers,</emphasis>
+David S.H. Rosenthal.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+<emphasis remap='I'>A Multiple Buffering/Stereo Proposal</emphasis>,
+Mark Patrick.
+ </para>
+ </listitem>
+</itemizedlist>
+
+<para>
+The authors of this proposal have tried to unify the above documents
+to yield a proposal that incorporates support for double-buffering,
+multi-buffering, and stereo in a way that is acceptable to all concerned.
+</para>
+</chapter>
+
+<chapter id='Goals'>
+<title>Goals</title>
+
+<para>
+Clients should be able to:
+</para>
+
+<itemizedlist>
+ <listitem>
+ <para>
+Associate multiple buffers with a window.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Paint in any buffer associated with a window.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Display any buffer associated with a window.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Display a series of buffers in a window in rapid succession
+to achieve a <emphasis remap='I'>smooth</emphasis> animation.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Request simultaneous display of different buffers in different windows.
+ </para>
+ </listitem>
+</itemizedlist>
+
+<para>
+In addition, the extension should:
+</para>
+
+<itemizedlist>
+ <listitem>
+ <para>
+Allow existing X applications to run unchanged.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Support a range of implementation methods that can capitalize on
+existing hardware features.
+ </para>
+ </listitem>
+</itemizedlist>
+
+</chapter>
+
+<chapter id='Image_Buffers'>
+<title>Image Buffers</title>
+
+<para>
+Normal windows are created using the standard
+<function>CreateWindow</function> request:
+</para>
+
+<literallayout class="monospaced">
+CreateWindow
+ parent : WINDOW
+ w_id : WINDOW
+ depth : CARD8
+ visual : VISUALID or CopyFromParent
+ x, y : INT16
+ width, height : INT16
+ border_width : INT16
+ value_mask : BITMASK
+ value_list : LISTofVALUE
+</literallayout>
+
+<para>
+This request allocates a set of window attributes and
+a buffer into which an image can be drawn.
+The contents of this <emphasis remap='I'>image buffer</emphasis> will
+be displayed when the window is mapped to the screen.
+</para>
+
+<para>
+To support double-buffering and multi-buffering,
+we introduce the notion that additional image buffers can
+be created and bound together to form groups.
+The following rules will apply:
+</para>
+
+<itemizedlist>
+ <listitem>
+ <para>
+All image buffers in a group will have the same
+visual type, depth, and geometry (ie: width and height).
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Only one image buffer per group can be displayed
+at a time.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Draw operations can occur to any image buffer at
+any time.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Window management requests (<function>MapWindow</function>, <function>DestroyWindow</function>,
+<function>ConfigureWindow</function>, etc...)
+affect all image buffers associated with a window.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Appropriate resize and exposure events will be generated
+for every image buffer that is affected by a window
+management operation.
+ </para>
+ </listitem>
+</itemizedlist>
+
+<para>
+By allowing draw operations to occur on any image buffer at any time,
+a client could, on a multi-threaded multi-processor server,
+simultaneously build up images for display.
+To support this, each buffer must have its own resource ID.
+Since buffers are different than windows and pixmaps
+(buffers are not hierarchical and pixmaps cannot be displayed)
+a new resource, <function>Buffer</function>, is introduced.
+Furthermore, a <function>Buffer</function> is also a <function>Drawable</function>, thus
+draw operations may also be performed on buffers simply
+by passing a buffer ID to the existing pixmap/window
+interface.
+</para>
+
+<para>
+To allow existing X applications to work unchanged, we assume
+a window ID passed in a draw request, for a multi-buffered
+window, will be an <emphasis remap='I'>alias</emphasis> for the ID of the currently
+displayed image buffer. Any draw requests (eq: <function>GetImage</function>) on
+the window will be relative to the displayed image buffer.
+</para>
+
+<para>
+In window management requests, only a window ID will be
+accepted. Requests like <function>QueryTree</function>, will continue to
+return only window ID's. Most events will return
+just the window ID. Some new events, described in a subsequent
+section, will return a buffer ID.
+</para>
+
+<para>
+When a window has backing store the contents of the window
+are saved off-screen. Likewise, when the contents of an image
+buffer of a multi-buffer window is saved off-screen, it is
+said to have backing store. This applies to all image buffers,
+whether or not they are selected for display.
+</para>
+
+<para>
+In some multi-buffer implementations, undisplayed buffers might be
+implemented using pixmaps. Since the contents of pixmaps exist
+off-screen and are not affected by occlusion, these image buffers
+in effect have backing store.
+</para>
+
+<para>
+On the other hand, both the displayed and undisplayed image buffers
+might be implemented using a subset of the on-screen pixels.
+In this case, unless the contents of an image buffer are saved
+off-screen, these image buffers in effect do not have backing store.
+</para>
+
+<para>
+Output to any image buffer of an unmapped multi-buffered window
+that does not have backing store is discarded. Output to any
+image buffer of a mapped multi-buffer window will be performed;
+however, portions of an image buffer may be occluded or clipped.
+</para>
+
+<para>
+When an unmapped multi-buffered window becomes mapped, the contents
+of any image buffer buffer that did not have backing store is
+tiled with the background and zero or more exposure events are
+generated. If no background is defined for the window, then
+the screen contents are not altered and the contents of any
+undisplayed image buffers are undefined. If backing store was
+maintained for an image buffer, then no exposure events are generated.
+</para>
+</chapter>
+
+<chapter id='New_Requests'>
+<title>New Requests</title>
+
+<para>
+The new request, <function>CreateImageBuffers</function>, creates a group of
+image buffers and associates them with a normal X window:
+</para>
+
+<literallayout class="monospaced">
+CreateImageBuffers
+ w_id : WINDOW
+ buffers : LISTofBUFFER
+ update_action : {Undefined,Background,Untouched,Copied}
+ update_hint : {Frequent,Intermittent,Static}
+ =&gt;
+ number_buffers : CARD16
+
+ (Errors: Window, IDChoice, Value)
+</literallayout>
+
+<para>
+One image buffer will be associated with each ID passed in
+<emphasis remap='I'>buffers</emphasis>.
+The first buffer of the list is referred to as buffer[0], the next
+buffer[1], and so on. Each buffer will have the same visual type
+and geometry as the window.
+Buffer[0] will refer to the image buffer already associated
+with the window ID and its contents will not be modified.
+The displayed image buffer attribute is set to buffer[0].
+</para>
+
+<para>
+Image buffers for the remaining ID's (buffer[1],...) are allocated.
+If the window is mapped, or if these image buffers have backing
+store, their contents will be tiled with the window background
+(if no background is defined, the buffer contents are undefined),
+and zero or more expose events will be generated for each of these
+buffers. The contents of an image buffer is undefined when
+the window is unmapped and the buffer does not have backing store.
+</para>
+
+<para>
+If the window already has a group of image buffers
+associated with it (ie: from a previous <function>CreateImageBuffers</function> request)
+the actions described for <function>DestroyImageBuffers</function> are performed first
+(this will delete the association of the previous buffer ID's and
+their buffers as well as de-allocate all buffers except for the
+one already associated with the window ID).
+</para>
+
+<para>
+To allow a server implementation to efficiently allocate the
+buffers, the total number of buffers required and
+the update action (how they will behave during an update)
+is specified "up front" in the request.
+If the server cannot allocate all the buffers requested, the
+total number of buffers actually allocated will be returned.
+No <function>Alloc</function> errors will be generated \- buffer[0] can
+always be associated with the existing displayed image buffer.
+</para>
+
+<para>
+For example, an application that wants to animate a short movie
+loop may request 64 image buffers. The server may only be able to
+support 16 image buffers of this type, size, and depth.
+The application can then decide 16 buffers is sufficient and may
+truncate the movie loop, or it may decide it really needs
+64 and will free the buffers and complain to the user.
+</para>
+
+<para>
+One might be tempted to provide a request that inquires whether
+<emphasis remap='I'>n</emphasis>
+buffers of a particular type, size, and depth
+<emphasis remap='I'>could</emphasis> be allocated.
+But if the query is decoupled from the actual allocation,
+another client could sneak in and take the buffers before the
+original client has allocated them.
+</para>
+
+<para>
+While any buffer of a group can be selected for display,
+some applications may display buffers in a predictable order
+(ie: the movie loop application). The
+<emphasis remap='I'>list order</emphasis>
+(buffer[0], buffer[1], ...) will be used as a hint by the
+server as to which buffer will be displayed next.
+A client displaying buffers in this order may see a
+performance improvement.
+</para>
+
+<para>
+<emphasis remap='I'>update_action</emphasis> indicates what should happen to a previously
+displayed buffer when a different buffer becomes displayed.
+Possible actions are:
+</para>
+
+<variablelist>
+ <varlistentry>
+ <term>Undefined</term>
+ <listitem>
+ <para>
+The contents of the buffer that was
+last displayed will become undefined after the update. This
+is the most efficient action since it allows the implementation
+to trash the contents of the buffer if it needs to.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Background</term>
+ <listitem>
+ <para>
+The contents of the buffer that was
+last displayed will be set to the background of the window after the update.
+The background action allows devices to use a fast clear
+capability during an update.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Untouched</term>
+ <listitem>
+ <para>
+The contents of the buffer that was
+last displayed will be untouched after the update. Used
+primarily when cycling through images that have already
+been drawn.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Copied</term>
+ <listitem>
+ <para>
+The contents of the buffer that was
+last displayed will become the same as those that are being
+displayed after the update. This is useful when incrementally
+adding to an image.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+
+
+<para>
+<emphasis remap='I'>update_hint</emphasis> indicates how often the client will
+request a different buffer to be displayed.
+This hint will allow smart server implementations to choose the
+most efficient means to support a multi-buffered window based
+on the current need of the application (dumb implementations
+may choose to ignore this hint). Possible hints are:
+</para>
+
+<variablelist>
+ <varlistentry>
+ <term>Frequent</term>
+ <listitem>
+ <para>
+An animation or movie loop is
+being attempted and the fastest, most efficient means for
+multi-buffering should be employed.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Intermittent</term>
+ <listitem>
+ <para>
+The displayed image will be
+changed every so often. This is common for images that are
+displayed at a rate slower than a second. For example, a
+clock that is updated only once a minute.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Static</term>
+ <listitem>
+ <para>
+The displayed image buffer will
+not be changed any time soon. Typically set by an application
+whenever there is a pause in the animation.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+To display an image buffer the following request can be used:
+</para>
+
+<literallayout class="monospaced">
+DisplayImageBuffers
+ buffers : LISTofBUFFER
+ min_delay : CARD16
+ max_delay : CARD16
+
+ (Errors: Buffer, Match)
+</literallayout>
+
+<para>
+The image buffers listed will become displayed as simultaneously
+as possible and the update action, bound at
+<function>CreateImageBuffers</function>
+time, will be performed.
+</para>
+
+<para>
+A list of buffers is specified to
+allow the server to efficiently change the display of more than one
+window at a time (ie: when a global screen swap method is used).
+Attempting to simultaneously display
+multiple image buffers from the same window is an error
+(<function>Match</function>) since it violates the rule that only one
+image buffer per group can be displayed at a time.
+</para>
+
+<para>
+If a specified buffer is already displayed,
+any delays and update action will still be
+performed for that buffer. In this instance,
+only the update action of <emphasis remap='I'>Background</emphasis>
+(and possibly
+<emphasis remap='I'>Undefined</emphasis>) will have any affect on the
+contents of the displayed buffer. These semantics allow
+an animation application to successfully execute
+even when there is only a single buffer available
+for a window.
+</para>
+<para>
+<!-- .LP -->
+When a <function>DisplayImageBuffers</function> request is made to an unmapped
+multi-buffered window, the effect of the update action depends
+on whether the image buffers involved have backing store.
+When the target of the update action is an image buffer that
+does not have backing store, output is discarded. When the
+target image buffer does have backing store, the update is performed;
+however, when the source of the update is an image buffer does not
+have backing store (as in the case of update action
+<emphasis remap='I'>Copied</emphasis>), the
+contents of target image buffer will become undefined.
+</para>
+<para>
+<!-- .LP -->
+<emphasis remap='I'>min_delay</emphasis> and
+<emphasis remap='I'>max_delay</emphasis> put a bound on how long the
+server should wait before processing the display request.
+For each of the windows to be updated by this request, at least
+<emphasis remap='I'>min_delay</emphasis> milli-seconds should elapse since
+the last
+time any of the windows were updated; conversely, no window
+should have to wait more than <emphasis remap='I'>max_delay</emphasis>
+milli-seconds before being updated.
+</para>
+
+<para>
+<emphasis remap='I'>min_delay</emphasis> allows an application to
+<emphasis remap='I'>slow down</emphasis> an animation or movie loop so that
+it appears
+synchronized at a rate the server can support given the current load.
+For example, a <emphasis remap='I'>min_delay</emphasis> of 100 indicates the
+server should
+wait at least 1/10 of a second since the last time any of the
+windows were updated. A <emphasis remap='I'>min_delay</emphasis> of zero
+indicates no waiting is necessary.
+</para>
+
+<para>
+<emphasis remap='I'>max_delay</emphasis> can be thought of as an additional
+delay beyond <emphasis remap='I'>min_delay</emphasis> the server is allowed
+to wait
+to facilitate such things as efficient update of multiple windows.
+If <emphasis remap='I'>max_delay</emphasis> would require an update before
+<emphasis remap='I'>min_delay</emphasis>
+is satisfied, then the server should process the display request as
+soon as the <emphasis remap='I'>min_delay</emphasis> requirement is met. A
+typical value for <emphasis remap='I'>max_delay</emphasis> is zero.
+</para>
+
+<para>
+To implement the above functionality, the time since the last
+update by a <function>DisplayImageBuffers</function> request for each
+multi-buffered
+window needs to be saved as state by the server.
+The server may delay execution of the <function>DisplayImageBuffers</function>
+request until the appropriate time (e.g. by requeuing the
+request after computing the timeout);
+however, the entire request must be processed in one operation.
+Request execution indivisibility must be maintained. When
+a server is implemented with internal concurrency, the
+extension must adhere to the same concurrency semantics
+as those defined for the core protocol.
+</para>
+
+<para>
+To explicitly clear a rectangular area of an image buffer to
+the window background, the following request can be used:
+</para>
+
+<literallayout class="monospaced">
+ClearImageBufferArea
+ buffer : BUFFER
+ x, y : INT16
+ w, h : CARD16
+ exposures : BOOL
+
+ (Errors: Buffer, Value)
+</literallayout>
+
+<para>
+Like the X <function>ClearArea</function> request,
+<emphasis remap='I'>x</emphasis> and <emphasis remap='I'>y</emphasis>
+are relative to
+the window's origin and specify the upper-left corner of the rectangle.
+If <emphasis remap='I'>width</emphasis> is zero, it is replaced with the
+current window width
+minus <emphasis remap='I'>x</emphasis>. If
+<emphasis remap='I'>height</emphasis> is zero it is replaced with the current
+window height minus <emphasis remap='I'>y</emphasis>. If the window has a
+defined background tile, the rectangle is tiled with a plane mask of all ones,
+a function of <emphasis remap='I'>Copy</emphasis>, and a subwindow-mode of
+<emphasis remap='I'>ClipByChildren</emphasis>.
+If the window has background <emphasis remap='I'>None</emphasis>, the
+contents of the buffer
+are not changed. In either case, if
+<emphasis remap='I'>exposures</emphasis> is true, then one or
+more exposure events are generated for regions of the rectangle that are
+either visible or are being retained in backing store.
+</para>
+
+<para>
+<!-- .LP -->
+The group of image buffers allocated by a
+<function>CreateImageBuffers</function>
+request can be destroyed with the following request:
+</para>
+
+<literallayout class="monospaced">
+DestroyImageBuffers
+ w_id : WINDOW
+
+ (Error: Window)
+</literallayout>
+
+<para>
+The association between the buffer ID's and their corresponding
+image buffers are deleted. Any image buffers not selected for
+display are de-allocated. If the window is not multi-buffered,
+the request is ignored.
+</para>
+
+</chapter>
+
+<chapter id='Attributes'>
+<title>Attributes</title>
+
+<para>
+The following attributes will be associated with each window that
+is multi-buffered:
+</para>
+
+<literallayout class="monospaced">
+ displayed_buffer : CARD16
+ update_action : {Undefined,Background,Untouched,Copied}
+ update_hint : {Frequent,Intermittent,Static}
+ window_mode : {Mono,Stereo}
+ buffers : LISTofBUFFER
+</literallayout>
+
+<para>
+<emphasis remap='I'>displayed_buffer</emphasis> is set to the
+<emphasis remap='I'>index</emphasis> of the currently
+displayed image buffer (for stereo windows, this will be
+the index of the left buffer \- the index of the right buffer
+is simply <emphasis remap='I'>index</emphasis>+1).
+<emphasis remap='I'>window_mode</emphasis> indicates whether this window is
+<emphasis remap='I'>Mono</emphasis> or <emphasis remap='I'>Stereo</emphasis>.
+The ID for each buffer associated with the window is recorded
+in the <emphasis remap='I'>buffers</emphasis> list.
+The above attributes can be queried with the following request:
+</para>
+
+<literallayout class="monospaced">
+GetMultiBufferAttributes
+ w_id : WINDOW
+ =&gt;
+ displayed_buffer : CARD16
+ update_action : {Undefined,Background,Untouched,Copied}
+ update_hint : {Frequent,Intermittent,Static}
+ window_mode : {Mono,Stereo}
+ buffers : LISTofBUFFER
+
+ (Errors: Window, Access, Value)
+</literallayout>
+
+<para>
+If the window is not multi-buffered, a <function>Access</function> error
+will be generated.
+The only multi-buffer attribute that can be explicitly set
+is <emphasis remap='I'>update_hint</emphasis>. Rather than have a specific
+request to set this attribute, a generic set request is provided to
+allow for future expansion:
+</para>
+
+<literallayout class="monospaced">
+SetMultiBufferAttributes
+ w_id : WINDOW
+ value_mask : BITMASK
+ value_list : LISTofVALUE
+
+ (Errors: Window, Match, Value)
+</literallayout>
+
+<para>
+If the window is not multi-buffered, a <function>Match</function> error
+will be generated.
+The following attributes are maintained for each buffer of a
+multi-buffered window:
+</para>
+
+<literallayout class="monospaced">
+ window : WINDOW
+ event_mask : SETofEVENT
+ index : CARD16
+ side : {Mono,Left,Right}
+</literallayout>
+
+<para>
+<emphasis remap='I'>window</emphasis> indicates the window this buffer is
+associated with.
+<emphasis remap='I'>event_mask</emphasis> specifies which events, relevant to
+buffers, will be sent back to the client via the associated buffer ID
+(initially no events are selected).
+<emphasis remap='I'>index</emphasis> is the list position (0, 1, ...) of the
+buffer.
+<emphasis remap='I'>side</emphasis> indicates whether this buffer is
+associated with
+the left side or right side of a stereo window.
+For non-stereo windows, this attribute will be set to
+<emphasis remap='I'>Mono</emphasis>.
+These attributes can be queried with the following request:
+</para>
+
+<literallayout class="monospaced">
+GetBufferAttributes
+ buffer : BUFFER
+ =&gt;
+ window : WINDOW
+ event_mask : SETofEVENT
+ index : CARD16
+ side : {Mono,Left,Right}
+
+ (Errors: Buffer, Value)
+</literallayout>
+
+<para>
+The only buffer attribute that can be explicitly set
+is <emphasis remap='I'>event_mask</emphasis>.
+The only events that are valid are
+<function>Expose</function> and the new
+<function>ClobberNotify</function> and <function>UpdateNotify</function>
+event (see Events section below). <!-- xref -->
+A <function>Value</function> error will be generated if an event not
+selectable for a buffer is specified in an event mask.
+Rather than have a specific request
+to set this attribute, a generic set request is provided to
+allow for future expansion:
+</para>
+
+<literallayout class="monospaced">
+SetBufferAttributes
+ buffer : BUFFER
+ value_mask : BITMASK
+ value_list : LISTofVALUE
+
+ (Errors: Buffer, Value)
+</literallayout>
+
+<para>
+Clients may want to query the server about basic multi-buffer
+and stereo capability on a per screen basis. The following request
+returns a large list of information
+that would most likely be read once by Xlib for each screen, and used as a
+data base for other Xlib queries:
+</para>
+
+<literallayout class="monospaced">
+GetBufferInfo
+ root : WINDOW
+ =&gt;
+ info : LISTofSCREEN_INFO
+</literallayout>
+
+<para>
+Where <function>SCREEN_INFO</function> and
+<function>BUFFER_INFO</function> are defined as:
+</para>
+
+<literallayout class="monospaced">
+ SCREEN_INFO : [ normal_info : LISTofBUFFER_INFO,
+ stereo_info : LISTofBUFFER_INFO ]
+
+ BUFFER_INFO : [ visual : VISUALID,
+ max_buffers : CARD16,
+ depth : CARD8 ]
+</literallayout>
+
+<para>
+Information regarding multi-buffering of normal (mono) windows
+is returned in the <emphasis remap='I'>normal_info</emphasis> list.
+The <emphasis remap='I'>stereo_info</emphasis>
+list contains information about stereo windows.
+If the <emphasis remap='I'>stereo_info</emphasis> list is empty, stereo
+windows are
+not supported on the screen. If
+<emphasis remap='I'>max_buffers</emphasis> is zero,
+the maximum number of buffers for the depth and visual is
+a function of the size of the created window and current
+memory limitations.
+</para>
+
+<para>
+The following request returns the major and minor version numbers
+of this extension:
+</para>
+
+<literallayout class="monospaced">
+GetBufferVersion
+ =&gt;
+ major_number : CARD8
+ minor_number : CARD8
+</literallayout>
+
+<para>
+The version numbers are an escape hatch in case future revisions of
+the protocol are necessary. In general, the major version would
+increment for incompatible changes, and the minor version would
+increment for small upward compatible changes. Barring changes, the
+major version will be 1, and the minor version will be 1.
+</para>
+</chapter>
+
+<chapter id='Events'>
+<title>Events</title>
+
+<para>
+All events normally generated for single-buffered
+windows are also generated for multi-buffered windows.
+Most of these events (ie: <function>ConfigureNotify</function>) will
+only be generated for the window and not for each buffer.
+These events will return a window ID.
+</para>
+
+<para>
+<function>Expose</function> events will be generated for both the window
+and any buffer affected. When this event is generated for
+a buffer, the same event structure will be used
+but a buffer ID is returned instead of a window ID.
+Clients, when processing these events, will know whether an
+ID returned in an event structure is for a window or a buffer
+by comparing the returned ID to the ones returned when the
+window and buffer were created.
+</para>
+
+<para>
+<function>GraphicsExposure</function> and
+<function>NoExposure</function> are generated
+using whatever ID is specified in the graphics operation.
+If a window ID is specified, the event will contain the
+window ID. If a buffer ID is specified, the event will
+contain the buffer ID.
+</para>
+<para>
+In some implementations, moving a window
+over a multi-buffered window may cause one or more of its buffers
+to get overwritten or become unwritable. To allow a
+client drawing into one of these buffers the opportunity
+to stop drawing until some portion of the buffer is
+writable, the following event is added:
+</para>
+
+<literallayout class="monospaced">
+ClobberNotify
+ buffer : BUFFER
+ state : {Unclobbered,PartiallyClobbered,FullyClobbered}
+</literallayout>
+
+<para>
+The <function>ClobberNotify</function> event is reported to clients selecting
+<emphasis remap='I'>ClobberNotify</emphasis> on a buffer. When a buffer
+that was fully
+or partially clobbered becomes unclobbered, an event with
+<emphasis remap='I'>Unclobbered</emphasis>
+is generated. When a buffer that was unclobbered becomes
+partially clobbered, an event with
+<emphasis remap='I'>PartiallyClobbered</emphasis>
+is generated. When a buffer that was unclobbered or
+partially clobbered becomes fully clobbered, an event with
+<emphasis remap='I'>FullyClobbered</emphasis> is generated.
+</para>
+
+<para>
+<function>ClobberNotify</function> events on a given buffer are
+generated before any <function>Expose</function> events on that buffer,
+but it is not required that all <function>ClobberNotify</function>
+events on all buffers be generated before all
+<function>Expose</function> events on all buffers.
+</para>
+
+<para>
+The ordering of <function>ClobberNotify</function> events with respect
+to <function>VisibilityNotify</function> events is not constrained.
+</para>
+
+<para>
+If multiple buffers were used as an image FIFO between an image
+server and the X display server, then the FIFO manager would like
+to know when a buffer that was previously displayed, has been
+undisplayed and updated, as the side effect of a
+<function>DisplayImageBuffers</function>
+request. This allows the FIFO manager to load up a future frame as
+soon as a buffer becomes available. To support this,
+the following event is added:
+</para>
+
+<literallayout class="monospaced">
+UpdateNotify
+ buffer : BUFFER
+</literallayout>
+
+<para>
+The <function>UpdateNotify</function> event is reported to clients selecting
+<emphasis remap='I'>UpdateNotify</emphasis> on a buffer. Whenever a buffer
+becomes <emphasis remap='I'>updated</emphasis>
+(e.g. its update action is performed as part of a
+<function>DisplayImageBuffers</function>
+request), an <function>UpdateNotify</function> event is generated.
+</para>
+</chapter>
+
+<chapter id='Errors'>
+<title>Errors</title>
+
+<para>
+The following error type has been added to support
+this extension:
+</para>
+
+<sect1 id='Buffer_2'>
+<title>Buffer</title>
+<para>
+A value for a BUFFER argument does not name a defined BUFFER.
+</para>
+</sect1>
+
+<sect1 id='Double_Buffering_Normal_Windows'>
+<title>Double-Buffering Normal Windows</title>
+
+<para>
+The following pseudo-code fragment illustrates how to create and display
+a double-buffered image:
+</para>
+
+<literallayout class="monospaced">
+/*
+ * Create a normal window
+ */
+CreateWindow( W, ... )
+
+/*
+ * Create two image buffers. Assume after display, buffer
+ * contents become "undefined". Assume we will "frequently"
+ * update the display. Abort if we don't get two buffers,
+ */
+n = CreateImageBuffers( W, [B0,B1], Undefined, Frequent )
+if (n != 2) &lt;abort&gt;
+
+/*
+ * Map window to the screen
+ */
+MapWindow( W )
+
+/*
+ * Draw images using alternate buffers, display every
+ * 1/10 of a second. Note we draw B1 first so it will
+ * "pop" on the screen
+ */
+while animating
+{
+ &lt;draw picture using B1&gt;
+ DisplayImageBuffers( [B1], 100, 0 )
+
+ &lt;draw picture using B0&gt;
+ DisplayImageBuffers( [B0], 100, 0 )
+}
+
+/*
+ * Strip image buffers and leave window with
+ * contents of last displayed image buffer.
+ */
+DestroyImageBuffers( W )
+</literallayout>
+
+</sect1>
+
+<sect1 id='Multi_Buffering_Normal_Windows'>
+<title>Multi-Buffering Normal Windows</title>
+
+<para>
+Multi-buffered images are also supported by these requests.
+The following pseudo-code fragment illustrates how to create a
+a multi-buffered image and cycle through the images to
+simulate a movie loop:
+</para>
+
+<literallayout class="monospaced">
+/*
+ * Create a normal window
+ */
+CreateWindow( W, ... )
+
+/*
+ * Create 'N' image buffers. Assume after display, buffer
+ * contents are "untouched". Assume we will "frequently"
+ * update the display. Abort if we don't get all the buffers.
+ */
+n = CreateImageBuffers( W, [B0,B1,...,B(N-1)], Untouched, Frequent )
+if (n != N) &lt;abort&gt;
+
+/*
+ * Map window to screen
+ */
+MapWindow( W )
+
+/*
+ * Draw each frame of movie one per buffer
+ */
+foreach frame
+ &lt;draw frame using B(i)&gt;
+
+/*
+ * Cycle through frames, one frame every 1/10 of a second.
+ */
+while animating
+{
+ foreach frame
+ DisplayImageBuffers( [B(i)], 100, 0 )
+}
+</literallayout>
+
+</sect1>
+
+<sect1 id='Stereo_Windows'>
+<title>Stereo Windows</title>
+<para>
+<emphasis remap='I'>How</emphasis> stereo windows are supported on a server
+is implementation
+dependent. A server may contain specialized hardware that allows
+left and right images to be toggled at field or frame rates. The
+stereo affect may only be perceived with the aid of special
+viewing glasses. The <emphasis remap='I'>display</emphasis> of a
+stereo picture should
+be independent of how often the contents of the picture are
+<emphasis remap='I'>updated</emphasis> by an application. Double and
+multi-buffering
+of images should be possible regardless of whether the image
+is displayed normally or in stereo.
+</para>
+
+<para>
+To achieve this goal, a simple extension to normal windows
+is suggested. Stereo windows are just like normal windows
+except the displayed image is made up of a left image
+buffer and a right image buffer. To create a stereo window,
+a client makes the following request:
+</para>
+
+<literallayout class="monospaced">
+CreateStereoWindow
+ parent : WINDOW
+ w_id : WINDOW
+ left, right : BUFFER
+ depth : CARD8
+ visual : VISUALID or CopyFromParent
+ x, y : INT16
+ width, height : INT16
+ border_width : INT16
+ value_mask : BITMASK
+ value_list : LISTofVALUE
+
+ (Errors: Alloc, Color, Cursor, Match,
+ Pixmap, Value, Window)
+</literallayout>
+
+<para>
+This request, modeled after the <function>CreateWindow</function> request,
+adds just two new parameters: <emphasis remap='I'>left</emphasis> and
+<emphasis remap='I'>right</emphasis>.
+For stereo, it is essential that one can distinguish whether
+a draw operation is to occur on the left image or right image.
+While an internal mode could have been added to achieve this,
+using two buffer ID's allows clients to simultaneously build up
+the left and right components of a stereo image. These
+ID's always refer to (are an alias for) the left and right
+image buffers that are currently <emphasis remap='I'>displayed</emphasis>.
+</para>
+
+<para>
+Like normal windows, the window ID is used whenever a window
+management operation is to be performed. Window queries would
+also return this window ID (eg: <function>QueryTree</function>) as would most
+events. Like the window ID, the left and right buffer ID's
+each have their own event mask. They can be set and queried
+using the <function>Set/GetBufferAttributes</function> requests.
+</para>
+
+<para>
+Using the window ID of a stereo window in a draw request
+(eg: <function>GetImage</function>) results in pixels that are
+<emphasis remap='I'>undefined</emphasis>.
+Possible semantics are that both left and right images get
+drawn, or just a single side is operated on (existing applications
+will have to be re-written to explicitly use the left and right
+buffer ID's in order to successfully create, fetch, and store
+stereo images).
+</para>
+
+<para>
+Having an explicit <function>CreateStereoWindow</function> request is helpful
+in that a server implementation will know from the onset whether
+a stereo window is desired and can return appropriate status
+to the client if it cannot support this functionality.
+</para>
+
+<para>
+Some hardware may support separate stereo and non-stereo modes,
+perhaps with different vertical resolutions. For example, the
+vertical resolution in stereo mode may be half that of non-stereo
+mode. Selecting one mode or the other must be done through some
+means outside of this extension (eg: by providing a separate
+screen for each hardware display mode). The screen attributes
+(ie: x/y resolution) for a screen that supports normal windows,
+may differ from a screen that supports stereo windows;
+however, all windows, regardless of type, displayed on the
+same screen must have the same screen attributes
+(ie: pixel aspect ratio).
+</para>
+
+<para>
+If a screen that supports stereo windows also supports
+normal windows, then the images presented to the left and
+right eyes for normal windows should be the same
+(ie: have no stereo offset).
+</para>
+
+</sect1>
+
+<sect1 id='Single_Buffered_Stereo_Windows'>
+<title>Single-Buffered Stereo Windows</title>
+
+<para>
+The following shows how to create and display a single-buffered
+stereo image:
+</para>
+<literallayout class="monospaced">
+/*
+ * Create the stereo window, map it the screen,
+ * and draw the left and right images
+ */
+CreateStereoWindow( W, L, R, ... )
+
+MapWindow( W )
+
+&lt;draw picture using L,R&gt;
+</literallayout>
+</sect1>
+
+<sect1 id='Double_Buffering_Stereo_Windows'>
+<title>Double-Buffering Stereo Windows</title>
+
+<para>
+Additional image buffers may be added to a stereo window
+to allow double or multi-buffering of stereo images.
+Simply use the the <function>CreateImageBuffers</function> request.
+Even numbered buffers (0,2,...) will be left buffers.
+Odd numbered buffers (1,3,...) will be right buffers.
+Displayable stereo images are formed by consecutive
+left/right pairs of image buffers. For example,
+(buffer[0],buffer[1]) form the first displayable
+stereo image; (buffer[2],buffer[3]) the next;
+and so on.
+</para>
+
+<para>
+The <function>CreateImageBuffers</function> request will only create
+pairs of left and right image buffers for stereo windows.
+By always pairing left and right image
+buffers together, implementations might be able to
+perform some type of optimization. If an odd number
+of buffers is specified, a <function>Value</function> error is generated.
+All the rules mentioned at the start of this proposal
+still apply to the image buffers supported by a stereo window.
+</para>
+
+<para>
+To display a image buffer pair of a multi-buffered stereo image,
+either the left buffer ID or right buffer ID may be specified in a
+<function>DisplayImageBuffers</function> request, but not both.
+</para>
+
+<para>
+To double-buffer a stereo window:
+</para>
+
+<literallayout class="monospaced">
+/*
+ * Create stereo window and map it to the screen
+ */
+CreateStereoWindow( W, L, R, ... )
+
+/*
+ * Create two pairs of image buffers. Assume after display,
+ * buffer contents become "undefined". Assume we will "frequently"
+ * update the display. Abort if we did get all the buffers.
+ */
+n = CreateImageBuffers( W, [L0,R0,L1,R1], Undefined, Frequently )
+if (n != 4) &lt;abort&gt;
+
+/*
+ * Map window to the screen
+ */
+MapWindow( W )
+
+/*
+ * Draw images using alternate buffers,
+ * display every 1/10 of a second.
+ */
+while animating
+{
+ &lt;draw picture using L1,R1&gt;
+ DisplayImageBuffers( [L1], 100, 0 )
+
+ &lt;draw picture using L0,R0&gt;
+ DisplayImageBuffers( [L0], 100, 0 )
+}
+</literallayout>
+
+</sect1>
+
+<sect1 id='Multi_Buffering_Stereo_Windows'>
+<title>Multi-Buffering Stereo Windows</title>
+
+<para>
+To cycle through <emphasis remap='I'>N</emphasis> stereo images:
+</para>
+
+<literallayout class="monospaced">
+/*
+ * Create stereo window
+ */
+CreateStereoWindow( W, L, R, ... )
+
+/*
+ * Create N pairs of image buffers. Assume after display,
+ * buffer contents are "untouched". Assume we will "frequently"
+ * update the display. Abort if we don't get all the buffers.
+ */
+n = CreateImageBuffers( W, [L0,R0,...,L(N-1),R(N-1)], Untouched, Frequently )
+if (n != N*2) &lt;abort&gt;
+
+/*
+ * Map window to screen
+ */
+MapWindow( W )
+
+/*
+ * Draw the left and right halves of each image
+ */
+foreach stereo image
+ &lt;draw picture using L(i),R(i)&gt;
+
+/*
+ * Cycle through images every 1/10 of a second
+ */
+while animating
+{
+ foreach stereo image
+ DisplayImageBuffers( [L(i)], 100, 0 )
+}
+</literallayout>
+</sect1>
+
+<sect1 id='Protocol_Encoding'>
+<title>Protocol Encoding</title>
+
+<para>
+The official name of this extension is "Multi-Buffering".
+When this string passed to <function>QueryExtension</function> the
+information returned should be interpreted as follows:
+</para>
+
+<variablelist>
+ <varlistentry>
+ <term>major-opcode</term>
+ <listitem>
+ <para>
+Specifies the major opcode of this extension.
+The first byte of each extension request should
+specify this value.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>first-event</term>
+ <listitem>
+ <para>
+Specifies the code that will be returned when
+<function>ClobberNotify</function> events are generated.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>first-error</term>
+ <listitem>
+ <para>
+Specifies the code that will be returned when
+<function>Buffer</function> errors are generated.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+The following sections describe the protocol
+encoding for this extension.
+</para>
+</sect1>
+</chapter>
+
+<chapter id='TYPES'>
+<title>TYPES</title>
+
+<literallayout class="monospaced">
+BUFFER_INFO
+
+4 VISUALID visual
+2 CARD16 max-buffers
+1 CARD8 depth
+1 unused
+</literallayout>
+
+<literallayout class="monospaced">
+SETofBUFFER_EVENT
+
+ #x00008000 Exposure
+ #x02000000 ClobberNotify
+ #x04000000 UpdateNotify
+</literallayout>
+
+</chapter>
+
+<chapter id='EVENTS_2'>
+<title>EVENTS</title>
+
+<literallayout class="monospaced">
+<function>ClobberNotify</function>
+1 see <emphasis remap='I'>first-event</emphasis> code
+1 unused
+2 CARD16 sequence number
+4 BUFFER buffer
+1 state
+ 0 Unclobbered
+ 1 PartiallyClobbered
+ 2 FullyClobbered
+23 unused
+</literallayout>
+
+<literallayout class="monospaced">
+<function>UpdateNotify</function>
+1 <emphasis remap='I'>first-event</emphasis>+1 code
+1 unused
+2 CARD16 sequence number
+4 BUFFER buffer
+24 unused
+</literallayout>
+
+</chapter>
+<chapter id='ERRORS_2'>
+<title>ERRORS</title>
+
+<literallayout class="monospaced">
+<function>Buffer</function>
+1 0 Error
+1 see <emphasis remap='I'>first-error</emphasis> code
+2 CARD16 sequence number
+4 CARD32 bad resource id
+2 CARD16 minor-opcode
+1 CARD8 major-opcode
+21 unused
+</literallayout>
+
+</chapter>
+
+<chapter id='Requests'>
+<title>REQUESTS</title>
+
+<literallayout class="monospaced">
+<function>GetBufferVersion</function>
+1 see <emphasis remap='I'>major-opcode</emphasis> major-opcode
+1 0 minor-opcode
+2 1 request length
+-&gt;
+1 1 Reply
+1 unused
+2 CARD16 sequencenumber
+4 0 reply length
+1 CARD8 majorversion number
+1 CARD8 minorversion number
+22 unused
+
+
+<function>CreateImageBuffers</function>
+
+1 see <emphasis remap='I'>major-opcode</emphasis> major-opcode
+1 1 minor-opcode
+2 3+n requestlength
+4 WINDOW wid
+1 update-action
+ 0 Undefined
+ 1 Background
+ 2 Untouched
+ 3 Copied
+1 update-hint
+ 0 Frequent
+ 1 Intermittent
+ 2 Static
+2 unused
+4n LISTofBUFFER buffer-list
+-&gt;
+1 1 Reply
+1 unused
+2 CARD16 sequencenumber
+4 0 reply length
+2 CARD16 number-buffers
+22 unused
+
+
+<function>DestroyImageBuffers</function>
+
+1 see <emphasis remap='I'>major-opcode</emphasis> major-opcode
+1 2 minor-opcode
+2 2 request length
+4 WINDOW wid
+
+
+<function>DisplayImageBuffers</function>
+
+
+1 see <emphasis remap='I'>major-opcode</emphasis> major-opcode
+2 2+n requestlength
+2 CARD16 min-delay
+2 CARD16 max-delay
+4n LISTofBUFFER buffer-list
+
+
+<function>SetMultiBufferAttributes</function>
+
+1 see <emphasis remap='I'>major-opcode</emphasis> major-opcode
+1 4 minor-opcode
+2 3+n requestlength
+4 WINDOW wid
+4 BITMASK value-mask (has n bits set to 1)
+ #x00000001 update-hint
+4n LISTofVALUE value-list
+VALUEs
+1 update-hint
+ 0 Frequent
+ 1 Intermittent
+ 2 Static
+
+
+<function>GetMultiBufferAttributes</function>
+
+1 see <emphasis remap='I'>major-opcode</emphasis> major-opcode
+1 5 minor-opcode
+2 2 request length
+4 WINDOW wid
+1 1 Reply
+1 unused
+2 CARD16 sequencenumber
+4 n reply length
+2 CARD16 displayed-buffer
+1 update-action
+ 0 Undefined
+ 1 Background
+ 2 Untouched
+ 3 Copied
+1 update-hint
+ 0 Frequent
+ 1 Intermittent
+ 2 Static
+1 window-mode
+ 0 Mono
+ 1 Stereo
+19 unused
+4n LISTofBUFFER buffer list
+
+
+<function>SetBufferAttributes</function>
+
+1 see <emphasis remap='I'>major-opcode</emphasis> major-opcode
+1 6 minor-opcode
+2 3+n requestlength
+4 BUFFER buffer
+4 BITMASK value-mask (has n bits set to 1)
+ #x00000001 event-mask
+4n LISTofVALUE value-list
+VALUEs
+4 SETofBUFFER_EVENT event-mask
+
+<function>GetBufferAttributes</function>
+
+1 see <emphasis remap='I'>major-opcode</emphasis> major-opcode
+1 7 minor-opcode
+2 2 request length
+4 BUFFER buffer
+-&gt;
+1 1 Reply
+1 unused
+2 CARD16 sequencenumber
+4 0 reply length
+4 WINDOW wid
+4 SETofBUFFER_EVENT event-mask
+2 CARD16 index
+ 1 side
+ 0 Mono
+ 1 Left
+ 2 Right
+13 unused
+
+<function>GetBufferInfo</function>
+
+1 see <emphasis remap='I'>major-opcode</emphasis> major-opcode
+1 8 minor-opcode
+2 2 request length
+4 WINDOW root
+1 1 Reply
+1 unused
+2 CARD16 sequencenumber
+4 2(n+m) replylength
+2 n number BUFFER_INFO in normal-info
+2 m number BUFFER_INFO in stereo-info
+20 unused
+8n LISTofBUFFER_INFO normal-info
+8m LISTofBUFFER_INFO stereo-info
+
+<function>CreateStereoWindow</function>
+
+1 see <emphasis remap='I'>major-opcode</emphasis> major-opcode
+1 9 minor-opcode
+2 11+n requestlength
+3 unused
+1 CARD8 depth
+4 WINDOW wid
+4 WINDOW parent
+4 BUFFER left
+4 BUFFER right
+2 INT16 x
+2 INT16 y
+2 CARD16 width
+2 CARD16 height
+2 CARD16 border-width
+2 class
+ 0 CopyFromParent
+ 1 InputOutput
+ 2 InputOnly
+4 VISUALID visual
+ 0 CopyFromParent
+4 BITMASK value-mask (has n bits set to 1)
+ encodings are the same
+ as for CreateWindow
+4n LISTofVALUE value-list
+ encodings are the same
+ as for CreateWindow
+
+
+<function>ClearImageBufferArea</function>
+
+1 see major-opcode major-opcode
+1 10 minor-opcode
+2 5 request length
+4 WINDOW buffer
+2 INT16 x
+2 INT16 y
+2 CARD16 width
+2 CARD16 height
+3 unused
+1 BOOL exposures
+
+</literallayout>
+
+</chapter>
+</book>
diff --git a/specs/security.xml b/specs/security.xml
new file mode 100644
index 0000000..93073c5
--- /dev/null
+++ b/specs/security.xml
@@ -0,0 +1,1467 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+<!--translated from security.tex, on 2010-06-27 15:29:00,
+by TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)
+xhtml,docbook,html,refcaption -->
+
+<book id="security">
+
+<bookinfo>
+ <title>Security Extension Specification</title>
+ <subtitle>X Consortium Standard</subtitle>
+ <authorgroup>
+ <author>
+ <firstname>David</firstname><othername>P.</othername><surname>Wiggins</surname>
+ <affiliation><orgname>X Consortium</orgname></affiliation>
+ </author>
+ </authorgroup>
+ <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
+ <releaseinfo>Version 7.1</releaseinfo>
+ <copyright><year>1996</year><holder>X Consortium</holder></copyright>
+
+<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>
+<para>X Window System is a trademark of The OpenGroup.</para>
+</legalnotice>
+
+<pubdate>November 15, 1996</pubdate>
+
+</bookinfo>
+
+<chapter id='Introduction'>
+<title>Introduction</title>
+
+<para>
+The Security extension contains new protocol needed to provide enhanced X
+server security. The Security extension should not be exposed to untrusted
+clients (defined below).
+</para>
+
+</chapter>
+
+<chapter id='Requests'>
+<title>Requests</title>
+
+<sect1 id='SecurityQueryVersion'>
+<title>SecurityQueryVersion</title>
+<para>
+This request returns the major and minor version numbers of this extension.
+</para>
+
+<para>SecurityQueryVersion</para>
+
+<informaltable frame='none'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='2' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <colspec colname='c2' colwidth="1.5*"/>
+ <tbody>
+ <row>
+ <entry>
+ <para>client-major-version</para>
+ </entry>
+ <entry>
+ <para>CARD16</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>client-minor-version</para>
+ </entry>
+ <entry>
+ <para>CARD16</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>=&gt;</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>server-major-version</para>
+ </entry>
+ <entry>
+ <para>CARD16</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>server-minor-version</para>
+ </entry>
+ <entry>
+ <para>CARD16</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+The client-major-version and client-minor-version numbers indicate what
+version of the protocol the client wants the server to implement. The
+server-major-version and the server-minor-version numbers returned
+indicate the protocol this extension actually supports. This might not
+equal the version sent by the client. An implementation can (but need not)
+support more than one version simultaneously. The server-major-version
+and server-minor-version allow the creation of future revisions of the
+Security protocol that may be necessary. In general, the major version
+would increment for incompatible changes, and the minor version would
+increment for small, upward-compatible changes. Servers that support
+the protocol defined in this document will return a server-major-version
+of one (1), and a server-minor-version of zero (0).
+</para>
+
+<para>
+Clients using the Security extension must issue a SecurityQueryVersion
+request before any other Security request in order to negotiate a compatible
+protocol version; otherwise, the client will get undefined behavior
+(Security may or may not work).
+</para>
+</sect1>
+
+<sect1 id='SecurityGenerateAuthorization'>
+<title>SecurityGenerateAuthorization</title>
+
+<para>
+This request causes the server to create and return a new authorization with
+specific characteristics. Clients can subsequently connect using the new
+authorization and will inherit some of the characteristics of the
+authorization.
+</para>
+
+<para>
+SecurityGenerateAuthorization
+</para>
+<informaltable frame='none'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='2' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <colspec colname='c2' colwidth="1.5*"/>
+ <tbody>
+ <row>
+ <entry>
+ <para>authorization-protocol-name</para>
+ </entry>
+ <entry>
+ <para>STRING8</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>authorization-protocol-data</para>
+ </entry>
+ <entry>
+ <para>STRING8</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>value-mask</para>
+ </entry>
+ <entry>
+ <para>BITMASK</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>value-list</para>
+ </entry>
+ <entry>
+ <para>LISTofVALUE</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>=></para>
+ </entry>
+ <entry>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>authorization-id</para>
+ </entry>
+ <entry>
+ <para>AUTHID</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>authorization-data-return</para>
+ </entry>
+ <entry>
+ <para>STRING8</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+Errors: <function>AuthorizationProtocol</function>, <function>Value</function>, <function>Alloc</function>
+</para>
+
+<para>
+authorization-protocol-name is the name of the authorization method for
+which the server should generate a new authorization that subsequent
+clients can use to connect to the server. If the authorization-protocol-name
+is not one that the server supports, or if authorization-protocol-data
+does not make sense for the given authorization-protocol-name, an
+AuthorizationProtocol error results.
+</para>
+
+<para>
+authorization-protocol-data is authorization-method specific data that can
+be used in some way to generate the authorization.
+</para>
+
+<note><para>
+In this version of the extension, the only authorization method
+required to be supported is "MIT-MAGIC-COOKIE-1" with any amount
+of authorization-protocol-data (including none). The server may use the
+authorization-protocol-data as an additional source of randomness used
+to generate the authorization. Other authorization methods can supply
+their own interpretation of authorization-protocol-data.
+</para></note>
+
+<para>
+The value-mask and value-list specify attributes of the authorization
+that are to be explicitly initialized. The possible values are:
+</para>
+
+<informaltable frame='topbot'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='3' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <colspec colname='c2' colwidth="1.0*"/>
+ <colspec colname='c3' colwidth="1.0*"/>
+ <thead>
+ <row rowsep='1'>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry>Default</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>timeout</para>
+ </entry>
+ <entry>
+ <para>CARD32</para>
+ </entry>
+ <entry>
+ <para>60</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>group</para>
+ </entry>
+ <entry>
+ <para>XID or None</para>
+ </entry>
+ <entry>
+ <para>None</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>trust-level</para>
+ </entry>
+ <entry>
+ <para>{SecurityClientTrusted,</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para></para>
+ </entry>
+ <entry>
+ <para>SecurityClientUntrusted}</para>
+ </entry>
+ <entry>
+ <para>SecurityClientUntrusted</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>event-mask</para>
+ </entry>
+ <entry>
+ <para>SecurityAuthorizationRevoked,</para>
+ </entry>
+ </row>
+ <row rowsep="1">
+ <entry>
+ <para></para>
+ </entry>
+ <entry>
+ <para>or None</para>
+ </entry>
+ <entry>
+ <para>None</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+timeout is the timeout period in seconds for this authorization. A
+timeout value of zero means this authorization will never expire. For
+non-zero timeout values, when timeout seconds have elapsed since the
+last time that the authorization entered the state of having no
+connections authorized by it, and if no new connections used the
+authorization during that time, the authorization is automatically purged.
+(Note that when an authorization is created, it enters the state of having no
+connections authorized by it.) Subsequent connection attempts using that
+authorization will fail. This is to facilitate "fire and forget" launching of
+applications.
+</para>
+
+<para>
+group is an application group ID as defined by the Application Group
+extension, or None. Any other values will cause a Value error. When a
+group is destroyed, all authorizations specifying that group are revoked
+as described under the SecurityRevokeAuthorization request. The Application
+Group extension attaches additional semantics to the group.
+</para>
+
+<para>
+trust-level tells whether clients using the authorization are trusted or
+untrusted. If trust-level is not one of the constants SecurityClientTrusted
+or SecurityClientUntrusted, a Value error results.
+</para>
+
+<para>
+event-mask defines which events the client is interested in for this
+authorization. When the authorization expires or is revoked if event-mask
+contains SecurityAuthorizationRevoked a SecurityAuthorizationRevoked event
+is reported to the client.
+</para>
+
+<para>
+The SecurityAuthorizationRevoked event contains the following field:
+</para>
+
+<informaltable frame='topbot'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='2' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <colspec colname='c2' colwidth="1.5*"/>
+ <thead>
+ <row rowsep="1">
+ <entry>Field</entry>
+ <entry>Type</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>authorization-id</para>
+ </entry>
+ <entry>
+ <para>AUTHID</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+where authorization-id is the identification of the authorization that was
+revoked.
+</para>
+<para>
+If an invalid value-mask is specified, a Value error occurs.
+</para>
+
+<para>
+The returned authorization-id is a non-zero value that uniquely identifies
+this authorization for use in other requests. The value space for type
+AUTHID is not required to be disjoint from values spaces of other core
+X types, e.g. resource ids, atoms, visual ids, and keysyms. Thus, a given
+numeric value might be both a valid AUTHID and a valid atom, for example.
+</para>
+
+<para>
+authorization-data-return is the data that a client should use in some
+authorization-method-specific way to make a connection with this
+authorization. For "MIT-MAGIC-COOKIE-1," authorization-data-return should
+be sent as the authorization-protocol-data in the connection setup message.
+It is not required that other authorization methods use
+authorization-data-return this way.
+</para>
+
+</sect1>
+
+<sect1 id='SecurityRevokeAuthorization'>
+<title>SecurityRevokeAuthorization</title>
+
+<para>
+This request deletes an authorization created by SecurityGenerateAuthorization.
+</para>
+
+<para>
+SecurityRevokeAuthorization
+</para>
+
+<informaltable frame='none'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='2' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <colspec colname='c2' colwidth="1.5*"/>
+ <tbody>
+ <row>
+ <entry>
+ <para><emphasis remap='I'>authorization-id</emphasis></para>
+ </entry>
+ <entry>
+ <para>AUTHID</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+Errors: <function>Authorization</function>
+</para>
+
+<para>
+If authorization-id does not name a valid authorization, an Authorization
+error occurs. Otherwise, this request kills all clients currently connected
+using the authorization specified by authorization-id. The authorization is
+deleted from the server's database, so future attempts by clients to connect
+with this authorization will fail.
+</para>
+
+</sect1>
+</chapter>
+
+<chapter id='Changes_to_Core_Requests'>
+<title>Changes to Core Requests</title>
+
+<para>
+A server supporting this extension modifies the handling of some core
+requests in the following ways.
+</para>
+<sect1 id='Resource_ID_Usage'>
+<title>Resource ID Usage</title>
+
+<para>
+If an untrusted client makes a request that specifies a resource ID that is
+not owned by another untrusted client, a protocol error is sent to the
+requesting client indicating that the specified resource does not exist.
+The following exceptions apply. An untrusted client can:
+</para>
+
+<orderedlist>
+ <listitem>
+ <para>
+use the QueryTree, GetGeometry, and TranslateCoordinates requests
+without restriction.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+use colormap IDs that are returned in the default-colormap field of its
+connection setup information in any colormap requests.
+ </para>
+ </listitem>
+ <listitem>
+ <para>specify a root window as:</para>
+ <orderedlist>
+ <listitem>
+ <para>
+the drawable field of CreatePixmap, CreateGC, and QueryBestSize.
+ </para>
+ </listitem>
+ <listitem>
+ <para>the parent field of CreateWindow.</para>
+ </listitem>
+ <listitem>
+ <para>
+the window field of CreateColormap, ListProperties, and GetWindowAttributes.
+ </para>
+ </listitem>
+ <listitem>
+ <para>the grab-window or confine-to fields of GrabPointer.
+ </para>
+ </listitem>
+ <listitem>
+ <para>the grab-window field of UngrabButton.</para>
+ </listitem>
+ <listitem>
+ <para>
+the destination of SendEvent, but only if all of the following are true.
+(These conditions cover all the events that the ICCCM specifies with
+a root window destination.)
+ </para>
+ <orderedlist>
+ <listitem>
+ <para>The propogate field of SendEvent is False.</para>
+ </listitem>
+ <listitem>
+ <para>
+The event-mask field of SendEvent is ColormapChange,
+StructureNotify, or the logical OR of SubstructureRedirect with
+SubstructureNotify.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+The event type being sent is UnmapNotify, ConfigureRequest, or
+ClientMessage.
+ </para>
+ </listitem>
+ </orderedlist>
+ </listitem>
+ <listitem>
+ <para>
+the window field of ChangeWindowAttributes, but only if the value-mask
+contains only event-mask and the corresponding value is StructureNotify,
+PropertyChange, or the logical OR of both.
+ </para>
+ </listitem>
+ </orderedlist>
+ </listitem>
+</orderedlist>
+
+<note>
+<para>
+ISSUE: are root window exceptions needed for these? WarpPointer, ReparentWindow
+(parent), CirculateWindow, QueryPointer (emacs does this), GetMotionEvents.
+</para>
+</note>
+
+</sect1>
+<sect1 id='Extension_Security'>
+<title>Extension Security</title>
+
+<para>
+This extension introduces the notion of secure and insecure extensions. A
+secure extension is believed to be safe to use by untrusted clients; that
+is, there are no significant security concerns known that an untrusted
+client could use to destroy, modify, or steal data of trusted clients. This
+belief may be founded on a careful analysis of the extension protocol,
+its implementation, and measures taken to "harden" the extension to close
+security weaknesses. All extensions not considered secure are called
+insecure. The implementation details of how an extension is identified as
+secure or insecure are beyond the scope of this specification.
+</para>
+
+<para>
+<function>ListExtensions</function> will only return names of secure
+extensions to untrusted clients.
+</para>
+
+<para>
+If an untrusted client uses <function>QueryExtension</function> on an
+insecure extension that the server supports, the reply will have the
+present field set to False and the major-opcode field set to zero to
+indicate that the extension is not supported.
+</para>
+
+<para>
+If an untrusted client successfully guesses the major opcode of an
+insecure extension, attempts by it to execute requests with that major
+opcode will fail with a Request error.
+</para>
+
+</sect1>
+
+<sect1 id='Keyboard_Security'>
+<title>Keyboard Security</title>
+
+
+<para>
+The protocol interpretation changes in this section are intended to prevent
+untrusted applications from stealing keyboard input that was meant for
+trusted clients and to prevent them from interfering with the use of the
+keyboard.
+</para>
+
+<para>
+The behavior of some keyboard-related requests and events is modified when
+the client is untrusted depending on certain server state at the time of
+request execution or event generation. Specifically, if a hypothetical
+keyboard event were generated given the current input focus, pointer
+position, keyboard grab state, and window event selections, and if that
+keyboard event would not be delivered to any untrusted client, the
+following changes apply:
+</para>
+
+<orderedlist>
+ <listitem>
+ <para>
+The bit vector representing the up/down state of the keys returned by
+<function>QueryKeymap</function> and
+<function>KeymapNotify</function> is all zeroes.
+ </para>
+ </listitem>
+ <listitem>
+ <para>GrabKeyboard returns a status of AlreadyGrabbed.</para>
+ </listitem>
+ <listitem>
+ <para>
+<function>SetInputFocus</function> does nothing. Note that this means the
+Globally Active
+Input and WM_TAKE_FOCUS mechanisms specified in the ICCCM will
+not work with untrusted clients.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Passive grabs established by GrabKey that would otherwise have activated
+do not activate.
+ </para>
+ </listitem>
+</orderedlist>
+
+<para>
+If an untrusted client attempts to use any of the following requests, the
+only effect is that the client receives an Access error: SetModifierMapping,
+ChangeKeyboardMapping, ChangeKeyboardControl.
+</para>
+
+<para>
+If an InputOnly window owned by an untrusted client has a parent owned by a
+trusted client, all attempts to map the window will be ignored. This includes
+mapping attempts resulting from MapWindow, MapSubwindows, ReparentWindow,
+and save-set processing.
+</para>
+<para>
+However, if the parent of an InputOnly window owned by an untrusted client
+is the root window, attempts to map that window will be performed as
+expected. This is in line with the root window exceptions above.
+</para>
+</sect1>
+
+<sect1 id='Image_Security'>
+<title>Image Security</title>
+
+<para>
+It should be impossible for an untrusted client to retrieve the image
+contents of a trusted window unless a trusted client takes action to allow
+this. We introduce the following defenses in support of this requirement.
+</para>
+
+<para>
+The restrictions on resource ID usage listed above prevent untrusted clients
+from using GetImage directly on windows not belonging to trusted clients.
+</para>
+
+<para>
+If an untrusted client tries to set the background-pixmap attribute of an
+untrusted window to None, the server will instead use a server-dependent
+background which must be different than None.
+</para>
+
+<para>
+The X protocol description of <function>GetImage</function> states that the
+returned contents of regions of a window obscured by noninferior windows are
+undefined if the window has no backing store. Some implementations return the
+contents of the obscuring windows in these regions. When an untrusted client
+uses <function>GetImage</function>, this behavior is forbidden; the server must
+fill the obscured regions in the returned image with a server-dependent pattern.
+</para>
+
+<para>
+If an untrusted window has trusted inferiors, their contents are vulnerable
+to theft via <function>GetImage</function> on the untrusted parent, as well
+as being vulnerable to destruction via drawing with subwindow-mode
+IncludeInferiors on the untrusted parent. An untrusted window having trusted
+inferiors can only occur at the request of a trusted client. It is expected
+to be an unusual configuration.
+</para>
+
+</sect1>
+
+<sect1 id='Property_Security'>
+<title>Property Security</title>
+
+<para>
+Unlike the other security provisions described in this document, security for
+property access is not amenable to a fixed policy because properties are
+used for inter-client communication in diverse ways and may contain data of
+varying degrees of sensitivity. Therefore, we only list the possible
+restrictions the server may decide to impose on use of properties on trusted
+windows by untrusted clients. How the server chooses which restrictions from
+this list to apply to a particular property access is implementation dependent
+ <footnote><para>
+In the X Consortium server implementation, property access is controlled by
+a configuration file; see the -sp option in the Xserver(1) manual page.
+ </para></footnote>.
+</para>
+
+<para>The X Protocol property requests are
+<function>ChangeProperty</function>,
+<function>GetProperty</function>,
+<function>DeleteProperty</function>,
+<function>RotateProperties</function>, and
+<function>ListProperties</function>. For these requests, the server can
+allow the request to execute normally (as if it had been issued by a
+trusted client), ignore the request completely (as if it were a NoOperation),
+or ignore the request except to send an Atom error to the client. Ignoring
+a <function>ListProperties</function> request means replying that
+the window has no properties. <function>ListProperties</function> may also
+reply with a subset of the existing properties if the server is doing
+property hiding; see below. An ignored <function>GetProperty</function>
+request may reply that the property does not exist, or that it exists but
+contains no data.
+</para>
+
+<para>
+The server may decide to hide certain properties on certain windows from
+untrusted clients
+ <footnote><para>
+The X Consortium server implementation does not currently provide a way to
+hide properties.
+ </para></footnote>.
+If a property is to be hidden, it must be done consistently to avoid
+confusing clients. This means that for untrusted clients:
+</para>
+
+<itemizedlist>
+ <listitem>
+ <para>
+That property should not be returned by
+<function>ListProperties</function>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+<function>PropertyNotify</function> events should not be sent for that
+property.</para>
+ </listitem>
+ <listitem>
+ <para>
+<function>GetProperty</function> on that property should reply that the
+property does not exist (the return type is None, the format and
+bytes-after are zero, and the value is empty).
+ </para>
+ </listitem>
+</itemizedlist>
+
+<para>
+For a property that the server is protecting but not hiding, consistency
+must also be maintained:
+</para>
+
+<itemizedlist>
+ <listitem>
+ <para>
+That property should be returned by <function>ListProperties</function>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+<function>PropertyNotify</function> events should be sent for that property.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+<function>GetProperty</function> on that property should reply that the
+property exists (if it really does) but the value is empty
+(return type and format are their real values, and the "length of value"
+field in the reply is zero).
+ </para>
+ </listitem>
+</itemizedlist>
+
+</sect1>
+
+<sect1 id='Miscellaneous_Security'>
+<title>Miscellaneous Security</title>
+
+<para>
+If an untrusted client attempts to use
+<function>ChangeHosts</function>,
+<function>ListHosts</function>, or
+<function>SetAccessControl</function>,
+the only effect is that the client receives an Access error.
+</para>
+
+<para>
+If an untrusted client attempts to use <function>ConvertSelection</function>
+on a selection with a trusted selection owner window, the server generates
+a SelectionNotify event to the requestor with property None.
+</para>
+</sect1>
+</chapter>
+
+<chapter id='New_Authorization_Method'>
+<title>New Authorization Method</title>
+
+<para>
+This extension includes a new authorization method named
+"XC-QUERY-SECURITY-1". Its purpose is to allow an external agent such as
+the X firewall proxy to probe an X server to determine whether that server
+meets certain security criteria without requiring the agent to have its
+own authorization for that server. The agent may use the returned information
+to make a decision. For example, the X firewall proxy may choose not to
+forward client connections to servers that do not meet the criteria.
+</para>
+
+<para>
+To use this authorization method, the client (or proxy) sends
+"XC-QUERY-SECURITY-1" as the authorization-protocol-name in the initial
+connection setup message. The authorization-protocol-data may be empty or
+may contain additional security criteria desribed below. If the success
+field of the server's reply is Authenticate, the server supports the
+security extension, and the server meets all specified additional security
+criteria. In this case, the client should resend the initial connection
+setup message substituting the authorization protocol name and data
+that should be used to authorize the connection. If the success field of the
+server's reply is anything other than Authenticate, either the server does not
+support the security extension, does not meet (or cannot determine if it
+meets) all of the additional security criteria, or chooses for internal reasons
+not to answer with Authenticate. In this case, the client should close the
+connection.
+</para>
+
+<para>
+If the authorization-protocol-data sent with "XC-QUERY-SECURITY-1" is not
+empty, it specifies additional security criteria for the server to check, as
+follows.
+</para>
+
+<para>
+<function>authorization-protocol-data</function>
+</para>
+
+<informaltable frame='none'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='2' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <colspec colname='c2' colwidth="1.5*"/>
+ <tbody>
+ <row>
+ <entry>
+ <para>policy-mask</para>
+ </entry>
+ <entry>
+ <para>BITMASK</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>policies</para>
+ </entry>
+ <entry>
+ <para>LISTofSECURITYPOLICY</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+The policy-mask field is any logical-OR combination of the constants
+Extensions and SitePolicies. For each bit set in policy-mask, there is a
+SECURITYPOLICY element in policies. The nth element in policies corresponds
+to the nth 1-bit in policy-mask, counting upward from bit 0.
+</para>
+
+<para><function>SECURITYPOLICY</function></para>
+
+<informaltable frame='none'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='2' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <colspec colname='c2' colwidth="1.5*"/>
+ <tbody>
+ <row>
+ <entry>
+ <para>policy-type</para>
+ </entry>
+ <entry>
+ <para>{Disallow, Permit}</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>names</para>
+ </entry>
+ <entry>
+ <para>LISTofSTR</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+For a SECURITYPOLICY corresponding to policy-mask Extensions, if
+policy-type is Disallow the server is required to consider as insecure
+all extensions given in names. No policy is specified for extensions
+not listed in names. If policy-type is Permit the server may consider
+only those extensions given in names to be secure; all other extensions
+must be treated as insecure. If these constraints are not met, the server
+should not return Authenticate in the success field of the reply.
+Servers can but need not dynamically configure themselves in response
+to an Extensions SECURITYPOLICY; a conforming server might simply compare
+the policy with a compiled-in table of extensions and their security status.
+</para>
+
+<para>
+For a SECURITYPOLICY corresponding to policy-mask SitePolicies, policy-type
+Disallow means the server must not have been configured with any of the site
+policies given in names. Policy-type Permit means the server must have
+been configured with at least one of the site policies given in names. If
+these constraints are not met, the server should not return Authenticate in
+the success field of the reply.
+</para>
+
+<para>
+SitePolicies provide a way to express new forms of security-relevant
+information that could not be anticipated at the time of this writing.
+For example, suppose the server is found to have a critical security defect.
+When a fix is developed, a site policy string could be associated with the
+fix. Servers with the fix would advertise that site policy, and the X
+firewall proxy would specify that site policy in a SECURITYPOLICY with
+policy-type Permit.
+</para>
+
+</chapter>
+
+<chapter id='Encoding'>
+<title>Encoding</title>
+
+<para>
+Please refer to the X11 Protocol Encoding document as this section
+uses syntactic conventions and data types established there.
+</para>
+
+<para>
+The name of this extension is "SECURITY".
+</para>
+
+<sect1 id='Types'>
+<title>Types</title>
+<para>
+AUTHID: CARD32
+</para>
+</sect1>
+
+<sect1 id='Request_Encoding'>
+<title>Request Encoding</title>
+
+<para>
+SecurityQueryVersion
+</para>
+<literallayout remap='FD'>
+1 CARD8 major-opcode
+1 0 minor-opcode
+2 2 request length
+2 CARD16 client-major-version
+2 CARD16 client-minor-version
+=>
+1 1 Reply
+1 unused
+2 CARD16 sequence number
+4 0 reply length
+2 CARD16 server-major-version
+2 CARD16 server-minor-version
+20 unused
+</literallayout>
+
+<para>
+<function>SecurityRevokeAuthorization</function>
+</para>
+
+<literallayout remap='FD'>
+1 CARD8 major-opcode
+1 2 minor-opcode
+2 2 request length
+4 AUTHID authorization-id
+</literallayout>
+
+<para>
+SecurityGenerateAuthorization
+</para>
+
+<literallayout remap='FD'>
+1 CARD8 major-opcode
+1 1 minor-opcode
+2 3 + (m+n+3)/4 + s request length
+2 CARD16 m, number of bytes in authorization protocol name
+2 CARD16 n, number of bytes in authorization data
+m STRING8 authorization protocol name
+n STRING8 authorization protocol data
+p unused, p=pad(m+n)
+4 BITMASK value-mask (has s bits set to 1)
+ #x00000001 timeout
+ #x00000002 trust-level
+ #x00000004 group
+ #x00000008 event-mask
+4s LISTofVALUE value-list
+</literallayout>
+
+<para>
+VALUES
+</para>
+<literallayout remap='FD'>
+4 CARD32 timeout
+4 trust-level
+ 0 SecurityClientTrusted
+ 1 SecurityClientUntrusted
+4 XID group
+0 None
+4 CARD32 event-mask
+ #x00000001 SecurityAuthorizationRevoked
+=>
+1 1 Reply
+1 unused
+2 CARD16 sequence number
+4 (q+3)/4 reply length
+4 AUTHID authorization-id
+2 CARD16 data-length
+18 unused
+q STRING8 authorization-data-return
+r unused, r=pad(q)
+</literallayout>
+
+</sect1>
+
+<sect1 id='Event_Encoding'>
+<title>Event Encoding</title>
+<para>
+<function>SecurityAuthorizationRevoked</function>
+</para>
+
+<literallayout remap='FD'>
+1 0+extension event base code
+1 unused
+2 CARD16 sequence number
+4 AUTHID authorization id
+24 unused
+</literallayout>
+
+</sect1>
+
+<sect1 id='Authorization_Method_Encoding'>
+<title>Authorization Method Encoding</title>
+
+<para>
+For authorization-protocol-name "XC-QUERY-SECURITY-1", the
+authorization-protocol-data is interpreted as follows:
+</para>
+
+<para>
+<function>authorization-protocol-data</function>
+</para>
+<literallayout remap='FD'>
+1 BITMASK policy-mask
+ #x00000001 Extensions
+ #x00000002 SitePolicies
+m LISTofSECURITYPOLICY policies
+</literallayout>
+
+<para>
+<function>SECURITYPOLICY</function>
+</para>
+
+<literallayout remap='FD'>
+1 policy-type
+ 0 Permit
+ 1 Disallow
+1 CARD8 number of STRs in names
+n LISTofSTR names
+</literallayout>
+
+<para>
+LISTofSTR has the same encoding as in the X protocol: each STR is a single
+byte length, followed by that many characters, and there is no padding or
+termination between STRs.
+</para>
+</sect1>
+
+</chapter>
+<chapter id='C_Language_Binding'>
+<title>C Language Binding</title>
+
+<para>
+The header for this extension is &lt;X11/extensions/security.h&gt;. All
+identifier names provided by this header begin with XSecurity.
+</para>
+
+<para>
+All functions that have return type Status will return nonzero for
+success and zero for failure.
+</para>
+
+<funcsynopsis id='XSecurityQueryExtension'>
+<funcprototype>
+ <funcdef>Status <function>XSecurityQueryExtension</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>
+<xref linkend='XSecurityQueryExtension' xrefstyle='select: title'/> sets major_version_return and
+minor_version_return to the major and minor Security protocol version
+supported by the server. If the Security library is compatible with the
+version returned by the server, it returns nonzero. If dpy does not support
+the Security 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 XSecurity functions may be called before this
+function. If a client violates this rule, the effects of all subsequent
+XSecurity calls that it makes are undefined.
+</para>
+
+<funcsynopsis id='XSecurityAllocXauth'>
+<funcprototype>
+ <funcdef>Xauth *<function>XSecurityAllocXauth</function></funcdef>
+ <paramdef><parameter>void</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+<para>
+In order to provide for future evolution, Xauth structures are used to
+pass and return authorization data, and the library provides ways to
+allocate and deallocate them.
+</para>
+
+<para>
+<xref linkend='XSecurityAllocXauth' xrefstyle='select: title'/> must be used to allocate the
+Xauth structure that is passed to
+<xref linkend='XSecurityGenerateAuthorization' xrefstyle='select: title'/>.
+</para>
+
+<para>
+For the purposes of the Security extension, the Xauth structure has
+the following fields:
+</para>
+
+<informaltable frame='topbot'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='3' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <colspec colname='c2' colwidth="1.0*"/>
+ <colspec colname='c3' colwidth="3.0*"/>
+ <thead>
+ <row rowsep="1">
+ <entry>Type</entry>
+ <entry>Field name</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>unsigned short</para>
+ </entry>
+ <entry>
+ <para>name_length</para>
+ </entry>
+ <entry>
+ <para>number of bytes in name</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>char *</para>
+ </entry>
+ <entry>
+ <para>name</para>
+ </entry>
+ <entry>
+ <para>authorization protocol name</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>unsigned short</para>
+ </entry>
+ <entry>
+ <para>data_length</para>
+ </entry>
+ <entry>
+ <para>number of bytes in data</para>
+ </entry>
+ </row>
+ <row rowsep="1">
+ <entry>
+ <para>char *</para>
+ </entry>
+ <entry>
+ <para>data</para>
+ </entry>
+ <entry>
+ <para>authorization protocol data</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+<para>
+The Xauth structure returned by this function is initialized as follows:
+name_length and data_length are zero, and name and data are NULL.
+</para>
+
+<funcsynopsis id='XSecurityFreeXauth'>
+<funcprototype>
+ <funcdef>void <function>XSecurityFreeXauth</function></funcdef>
+ <paramdef>Xauth<parameter> *auth</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<xref linkend='XSecurityFreeXauth' xrefstyle='select: title'/> must be used to free Xauth
+structures allocated by
+<xref linkend='XSecurityAllocXauth' xrefstyle='select: title'/> or returned by
+<xref linkend='XSecurityGenerateAuthorization' xrefstyle='select: title'/>. It is the
+caller's responsibility to fill in the name and data fields of Xauth structures
+allocated with <xref linkend='XSecurityAllocXauth' xrefstyle='select: title'/>, so this function
+will not attempt to free them. In contrast, all storage associated with
+Xauth structures returned from
+<xref linkend='XSecurityGenerateAuthorization' xrefstyle='select: title'/> will be freed by this
+function, including the name and data fields.
+</para>
+
+
+<funcsynopsis id='XSecurityRevokeAuthorization'>
+<funcprototype>
+ <funcdef>Bool <function>XSecurityRevokeAuthorization</function></funcdef>
+ <paramdef>Display<parameter> *dpy</parameter></paramdef>
+ <paramdef>XSecurityAuthorization<parameter> auth_id</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<xref linkend='XSecurityRevokeAuthorization' xrefstyle='select: title'/> deletes the authorization
+specified by auth_id, which must be a value returned in the auth_id_return
+parameter of <xref linkend='XSecurityGenerateAuthorization' xrefstyle='select: title'/>. All
+clients that connected with that authorization are be killed. Subsequently,
+clients that attempt to connect using that authorization will be refused.
+</para>
+
+
+<funcsynopsis id='XSecurityGenerateAuthorization'>
+<funcprototype>
+ <funcdef>Xauth *<function>XSecurityGenerateAuthorization</function></funcdef>
+ <paramdef>Display<parameter> *dpy</parameter></paramdef>
+ <paramdef>Xauth<parameter> *auth_in</parameter></paramdef>
+ <paramdef>unsigned long<parameter> valuemask</parameter></paramdef>
+ <paramdef>XSecurityAutorizationAttributes <parameter> *attributes</parameter></paramdef>
+ <paramdef>XSecurityAutorization<parameter> *auth_id_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+<xref linkend='XSecurityGenerateAuthorization' xrefstyle='select: title'/> creates a new
+authorization with the specified attributes. The auth_in argument must be
+allocated by <xref linkend='XSecurityAllocXauth' xrefstyle='select: title'/>. The
+name and name_length fields of auth_in should be initialized to the
+authorization protocol name and its length in characters respectively.
+If there is authorization data, the data and data_length fields of
+auth_in should be initialized to the data and its length in characters
+respectivley. The library does not assume that name and data are
+null-terminated strings. The auth_in argument must be freed with
+<xref linkend='XSecurityFreeXauth' xrefstyle='select: title'/>.
+</para>
+
+<para>
+The XSecurityAuthorizationAttributes structure has the following fields:
+</para>
+
+<informaltable frame='topbot'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='3' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <colspec colname='c2' colwidth="1.0*"/>
+ <colspec colname='c3' colwidth="3.0*"/>
+ <thead>
+ <row rowsep="1">
+ <entry>Type</entry>
+ <entry>Field name</entry>
+ <entry>Mask</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>unsigned int</para>
+ </entry>
+ <entry>
+ <para>trust_level</para>
+ </entry>
+ <entry>
+ <para>XSecurityTrustLevel</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>unsigned int</para>
+ </entry>
+ <entry>
+ <para>timeout</para>
+ </entry>
+ <entry>
+ <para>XSecurityTimeout</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>XID</para>
+ </entry>
+ <entry>
+ <para>group</para>
+ </entry>
+ <entry>
+ <para>XSecurityGroup</para>
+ </entry>
+ </row>
+ <row rowsep="1">
+ <entry>
+ <para>long</para>
+ </entry>
+ <entry>
+ <para>event_mask</para>
+ </entry>
+ <entry>
+ <para>XSecurityEventMask</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+These correspond to the trust-level, timeout, group, and event-mask
+described in the SecurityGenerateAuthorization protocol request. The
+caller can fill in values for any subset of these attributes. The valuemask
+argument must be the bitwise OR of the symbols listed in the Mask column
+for all supplied attributes. The event_mask attribute can be None,
+XSecurityAuthorizationRevokedMask, or XSecurityAllEventMasks. In this
+revision of the protocol specification XSecurityAllEventMasks is equivalent
+to XSecurityAuthorizationRevokedMask. If the caller does not need to
+specify any attributes, the attributes argument can be NULL, and the
+valuemask argument must be zero.
+</para>
+<para>
+If the function fails, NULL is returned and auth_id_return is filled in
+with zero. Otherwise, a pointer to an Xauth structure is returned. The name
+and name_length fields of the returned Xauth structure will be copies of the
+name that was passed in, and the data and data_length fields will be set to
+the authorization data returned by the server. The caller should not assume
+that name and data are null-terminated strings. If no authorization data was
+returned by the server, the data and data_length fields will be set to NULL
+and zero repectively. The returned Xauth structure must be freed with
+<xref linkend='XSecurityFreeXauth' xrefstyle='select: title'/>; the caller should not use any other
+means free the structure or any of its components. The auth_id_return
+argument will be filled in with the non-zero authorization id of the created
+authorization.
+</para>
+
+<para>
+The XSecurityAuthorizationRevokedEvent structure has the following fields:
+</para>
+
+<informaltable frame='topbot'>
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='3' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <colspec colname='c2' colwidth="1.0*"/>
+ <colspec colname='c3' colwidth="3.0*"/>
+ <thead>
+ <row rowsep="1">
+ <entry>Type</entry>
+ <entry>Field name</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <para>int</para>
+ </entry>
+ <entry>
+ <para>type</para>
+ </entry>
+ <entry>
+ <para>event base + XSecurityAuthorizationRevoked</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>unsigned long</para>
+ </entry>
+ <entry>
+ <para>serial</para>
+ </entry>
+ <entry>
+ <para># of last request processed by server</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Bool</para>
+ </entry>
+ <entry>
+ <para>send_event</para>
+ </entry>
+ <entry>
+ <para>true if this came from SendEvent</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <para>Display*</para>
+ </entry>
+ <entry>
+ <para>display</para>
+ </entry>
+ <entry>
+ <para>Display the event was read from</para>
+ </entry>
+ </row>
+ <row rowsep="1">
+ <entry>
+ <para>XSecurityAuthorization</para>
+ </entry>
+ <entry>
+ <para>auth_id</para>
+ </entry>
+ <entry>
+ <para>revoked authorization id</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+</chapter>
+</book>
diff --git a/specs/shape.xml b/specs/shape.xml
new file mode 100644
index 0000000..16751ff
--- /dev/null
+++ b/specs/shape.xml
@@ -0,0 +1,1244 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+
+
+<!-- lifted from troff+ms+XMan by doclifter -->
+<book id="shape">
+
+<bookinfo>
+ <title>X Nonrectangular Window Shape Extension Protocol</title>
+ <subtitle>X.Org Standard</subtitle>
+ <authorgroup>
+ <author>
+ <firstname>Keith</firstname><surname>Packard</surname>
+ <affiliation><orgname>MIT X Consortium</orgname></affiliation>
+ <affiliation><orgname>Intel Corporation</orgname></affiliation>
+ </author>
+ <othercredit>
+ <firstname>Hideki</firstname><surname>Hiura</surname>
+ <affiliation><orgname>SunSoft, Inc.</orgname></affiliation>
+ </othercredit>
+ </authorgroup>
+ <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
+ <releaseinfo>Version 1.1</releaseinfo>
+ <copyright><year>1989</year><year>2004</year><holder>The Open Group</holder></copyright>
+ <copyright><year>2006</year><holder>Keith Packard</holder></copyright>
+<legalnotice>
+
+<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 &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
+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.
+</para>
+<para>
+Except as contained in this notice, the name of the copyright holders
+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
+copyright holders.
+</para>
+</legalnotice>
+</bookinfo>
+
+<chapter id="Overview">
+<title>Overview</title>
+<para>
+<!-- .LP -->
+This extension provides arbitrary window and border shapes within the X11
+protocol.
+</para>
+<para>
+<!-- .LP -->
+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 "drop shadow'' 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>
+<!-- .LP -->
+This extension provides mechanisms for changing both the visible and interactive shape of a
+window to arbitrary, possibly disjoint, nonrectangular forms. 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 three regions: the
+<emphasis remap='I'>bounding region</emphasis>, the <emphasis remap='I'>clip
+region</emphasis> and the <emphasis remap='I'>input 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. The input region is the subset of the
+bounding region that can "contain" the pointer.
+</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); the input
+region will match the bounding region. In this document,
+these areas are referred to as the
+<emphasis remap='I'>default bounding region</emphasis>, the
+<emphasis remap='I'>default clip region</emphasis> and the
+<emphasis remap='I'>default input 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, clip
+and input regions are the rectangles (relative to the window origin):
+</para>
+
+<literallayout class="monospaced">
+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>
+
+input.x = -<emphasis remap='I'>bwidth</emphasis>
+input.y = -<emphasis remap='I'>bwidth</emphasis>
+input.width = <emphasis remap='I'>width</emphasis> + 2 * <emphasis remap='I'>bwidth</emphasis>
+input.height = <emphasis remap='I'>height</emphasis> + 2 * <emphasis remap='I'>bwidth</emphasis>
+</literallayout>
+
+<para>
+This extension allows a client to modify any combination of the bounding,
+clip or input regions by specifying new regions that combine with the default
+regions. These new regions are called the
+<emphasis remap='I'>client bounding region</emphasis>,
+the <emphasis remap='I'>client clip region</emphasis> and the
+<emphasis remap='I'>client input 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>
+The <emphasis remap='I'>effective input region</emphasis> of a window is
+defined to be the intersection of the
+client input region with both the default input region and the client bounding
+region. Any portion of the client input region that is not included in both
+the default input region and the client bounding region will not be included in
+the effective input region on the screen.
+</para>
+<para>
+<!-- .LP -->
+Construction of the effective input region is dynamic; the client input region is
+not mutated to obtain the effective input region. If a client input region is
+specified that extends beyond the current default input region and the
+window or its bounding region is later enlarged, the effective input region will
+be enlarged to include more of the client input region if it is included in
+the effective bounding region.
+</para>
+<para>
+<!-- .LP -->
+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>
+<!-- .LP -->
+An
+<function>InputOnly</function>
+window can have its bounding or input 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>
+<!-- .LP -->
+The server must accept changes to the clip and input regions 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="Types">
+<title>Types</title>
+<para>
+<!-- .LP -->
+The following types are used in the request and event definitions in
+subsequent sections.
+</para>
+
+<para>
+SHAPE_KIND:
+{ <function>Bounding</function>,
+<function>Clip</function>,
+<function>Input</function> }
+</para>
+
+<para>
+SHAPE_OP:
+{ <function>Set</function>,
+<function>Union</function>,
+<function>Intersect</function>,
+<function>Subtract</function>,
+<function>Invert</function> }
+</para>
+
+<para>
+<function>Set</function>
+indicates that the region specified as an explicit source in the request is
+stored unaltered as the new destination client region.
+<function>Union</function>
+indicates that the source and destination regions are unioned together to
+produce the new destination client region.
+<function>Intersect</function>
+indicates that the source and destination regions are intersected together to
+produce the new destination client region.
+<function>Subtract</function>
+indicates that the source region is subtracted from the destination region to
+produce the new destination region.
+<function>Invert</function>
+indicates that the destination region is subtracted from the source region to
+produce the new destination region.
+</para>
+</chapter>
+
+<chapter id="Requests">
+<title>Requests</title>
+<para>
+<function>ShapeQueryVersion</function>
+</para>
+
+<para>
+ =&gt;
+</para>
+
+<para>
+majorVersion: CARD16
+</para>
+<para>
+minorVersion: CARD16
+</para>
+
+<para>
+This request can be used to ensure that the server version of the SHAPE
+extension is usable by the client. This document defines major version one
+(1), minor version one (1).
+</para>
+
+<para>
+<function>ShapeRectangles</function>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry><emphasis remap='I'>dest</emphasis>: WINDOW</entry>
+ </row>
+ <row>
+ <entry><emphasis remap='I'>destKind</emphasis>: SHAPE_KIND</entry>
+ </row>
+ <row>
+ <entry><emphasis remap='I'>op</emphasis>: SHAPE_OP</entry>
+ </row>
+ <row>
+ <entry><emphasis remap='I'>xOff, yOff</emphasis>: INT16</entry>
+ </row>
+ <row>
+ <entry><emphasis remap='I'>rectangles</emphasis>: LISTofRECTANGLES</entry>
+ </row>
+ <row>
+ <entry><emphasis remap='I'>ordering</emphasis>:
+{ <function>UnSorted</function>,
+<function>YSorted</function>,
+<function>YXSorted</function>,
+<function>YXBanded</function> }
+ </entry>
+ </row>
+ <row>
+ <entry>
+Errors:
+<function>Window</function>,
+<function>Length</function>,
+<function>Match</function>,
+<function>Value</function>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request specifies an array of rectangles, relative to the origin of the
+window plus the specified offset (xOff and yOff) that together
+define a region. This region is combined (as specified by the operator
+op) with the existing client region (specified by destKind) of the
+destination window, and the result is stored as the specified client region of
+the destination window. Note that the list of rectangles can be empty,
+specifying an empty region; this is not the same as passing
+<function>None</function> to
+<function>ShapeMask</function>,
+</para>
+
+<para>
+If known by the client,
+ordering relations on the rectangles can be specified with the ordering
+argument.
+This may provide faster operation by the server.
+The meanings of the ordering values are the same as in the core protocol
+<function>SetClipRectangles</function>
+request.
+If an incorrect ordering is specified,
+the server may generate a
+<function>Match </function>
+error, but it is not required to do so.
+If no error is generated,
+the graphics results are undefined.
+Except for
+<function>UnSorted ,</function>
+the rectangles should be nonintersecting, or the resulting region will
+be undefined.
+<function>UnSorted </function>
+means that the rectangles are in arbitrary order.
+<function>YSorted </function>
+means that the rectangles are nondecreasing in their Y origin.
+<function>YXSorted </function>
+additionally constrains
+<function>YSorted </function>
+order in that all rectangles with an equal Y origin are
+nondecreasing in their X origin.
+<function>YXBanded </function>
+additionally constrains
+<function>YXSorted </function>
+by requiring that, for every possible Y scanline,
+all rectangles that include that scanline have identical Y origins and Y
+extents.
+</para>
+
+<para>
+<function>ShapeMask</function>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>dest</emphasis>: WINDOW
+<emphasis remap='I'>destKind</emphasis>: SHAPE_KIND
+<emphasis remap='I'>op</emphasis>: SHAPE_OP
+<emphasis remap='I'>xOff, yOff</emphasis>: INT16
+<emphasis remap='I'>source</emphasis>: PIXMAP or
+<function>None</function>
+ </entry>
+ </row>
+ <row>
+ <entry>
+Errors:
+<function>Window</function>,
+<function>Pixmap</function>,
+<function>Match</function>,
+<function>Value</function>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+The source in this request is a 1-bit deep pixmap, or
+<function>None .</function>
+If source is
+<function>None ,</function>
+the specified client region is removed from the window, causing the effective
+region to revert to the default region. The
+<function>ShapeNotify</function>
+event generated by this request and subsequent
+<function>ShapeQueryExtents</function>
+will report that a client shape has not been specified.
+If a valid pixmap is specified, it is converted
+to a region, with bits set to one included in the region and bits set to
+zero excluded, and an offset from the window origin as specified by
+xOff and yOff. The resulting region is then combined (as
+specified by the operator op) with the existing client region
+(indicated by destKind) of the destination window, and the result is
+stored as the specified client region of the destination window. The source
+pixmap and destination window must have been created on the same screen,
+or else a
+<function>Match</function>
+error results.
+</para>
+
+<para>
+<function>ShapeCombine</function>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>dest</emphasis>: WINDOW
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>destKind</emphasis>: SHAPE_KIND
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>op</emphasis>: SHAPE_OP
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>xOff, yOff</emphasis>: INT16
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>source</emphasis>: WINDOW
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>sourceKind</emphasis>: SHAPE_KIND
+ </entry>
+ </row>
+ <row>
+ <entry>
+Errors:
+<function>Window</function>,
+<function>Match</function>,
+<function>Value</function>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+The client region, indicated by sourceKind, of the source window is
+offset from the window origin by xOff and yOff and combined with
+the client region, indicated by destKind, of the destination window.
+The result is stored as the specified client region of the destination
+window.
+The source and destination windows must be on the same screen, or else a
+<function>Match</function>
+error results.
+</para>
+
+<para>
+<function>ShapeOffset</function>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>dest</emphasis>: WINDOW
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>destKind</emphasis>: SHAPE_KIND
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>xOff, yOff</emphasis>: INT16
+ </entry>
+ </row>
+ <row>
+ <entry>
+Errors:
+<function>Window</function>,
+<function>Match</function>,
+<function>Value</function>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+The client region, indicated by destKind, is moved relative to its
+current position by the amounts xOff and yOff.
+</para>
+
+<para>
+<function>ShapeQueryExtents</function>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>dest</emphasis>: WINDOW
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+ =&gt;
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+boundingShaped: BOOL
+ </entry>
+ </row>
+ <row>
+ <entry>
+clipShaped: BOOL
+ </entry>
+ </row>
+ <row>
+ <entry>
+xBoundingShape: INT16
+ </entry>
+ </row>
+ <row>
+ <entry>
+yBoundingShape: INT16
+ </entry>
+ </row>
+ <row>
+ <entry>
+widthBoundingShape: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+heightBoundingShape: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+xClipShape: INT16
+ </entry>
+ </row>
+ <row>
+ <entry>
+yClipShape: INT16
+ </entry>
+ </row>
+ <row>
+ <entry>
+widthClipShape: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+heightClipShape: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+Errors:
+<function>Window</function>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+The boundingShaped and clipShaped results are
+<function>True</function>
+if the corresponding client regions have been specified, else they are
+<function>False .</function>
+The x, y, width, and height values define the extents of the client regions,
+when a client region has not been specified, the extents of the
+corresponding default region are reported.
+</para>
+
+<para>
+<function>ShapeSelectInput</function>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>window</emphasis>: WINDOW
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>enable</emphasis>: BOOL
+ </entry>
+ </row>
+ <row>
+ <entry>
+Errors:
+<function>Window</function>,
+<function>Value</function>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+Specifying enable as
+<function>True</function>
+causes the server to send the requesting client a
+<function>ShapeNotify</function>
+event whenever the bounding, clip or input region of the specified window is
+altered by any client.
+Specifying enable as
+<function>False</function>
+causes the server to stop sending such events.
+</para>
+
+<para>
+<function>ShapeInputSelected</function>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>window</emphasis>: WINDOW
+ </entry>
+ </row>
+ <row>
+ <entry>
+=&gt;
+enable: BOOL
+ </entry>
+ </row>
+ <row>
+ <entry>
+Errors:
+<function>Window</function>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+If enable is
+<function>True</function>, then
+<function>ShapeNotify</function>
+events for the window are generated for this client.
+</para>
+
+<para>
+<function>ShapeGetRectangles</function>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>window</emphasis>: WINDOW
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>kind</emphasis>: SHAPE_KIND
+ </entry>
+ </row>
+ <row>
+ <entry>
+ =&gt;
+rectangles: LISTofRECTANGLE
+ </entry>
+ </row>
+ <row>
+ <entry>
+ordering:
+{ <function>UnSorted</function>,
+<function>YSorted</function>,
+<function>YXSorted</function>,
+<function>YXBanded</function> }
+ </entry>
+ </row>
+ <row>
+ <entry>
+Errors:
+<function>Window,</function>
+<function>Match</function>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+A list of rectangles describing the region indicated by kind, and the
+ordering of those rectangles, is returned. The meaning of the ordering
+values is the same as in the
+<function>ShapeRectangles</function>
+request.
+</para>
+</chapter>
+
+<chapter id="Events">
+<title>Events</title>
+<para>
+<function>ShapeNotify</function>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>window</emphasis>: WINDOW
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>kind</emphasis>: SHAPE_KIND
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>shaped</emphasis>: BOOL
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>x, y</emphasis>: INT16
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>width</emphasis>,
+<emphasis remap='I'>height</emphasis>: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>time</emphasis>: TIMESTAMP
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+Whenever the client bounding, clip or input shape of a window is modified, a
+<function>ShapeNotify</function>
+event is sent to each client that has used
+<function>ShapeSelectInput</function>
+to request it.
+</para>
+
+<para>
+Kind indicates which client region (bounding or clip) has been modified;
+shaped is
+<function>True</function>
+when the window has a client shape of type kind, and is
+<function>False</function>
+when the window no longer has a client shape of this type.
+The x, y, width, and height indicate the extents of the
+current shape. When shaped is
+<function>False</function>
+these will indicate the extents of the default region. The timestamp
+indicates the server time when the shape was changed.
+</para>
+</chapter>
+
+<chapter id="Encoding">
+<title>Encoding</title>
+<para>
+Please refer to the X11 Protocol Encoding document as this document uses
+conventions established there.
+</para>
+
+<para>
+The name of this extension is "SHAPE".
+</para>
+
+<sect1 id="New_Types">
+<title>New Types</title>
+
+<literallayout class="monospaced">
+SHAPE_KIND
+ 0 Bounding
+ 1 Clip
+ 2 Input
+</literallayout>
+
+<literallayout class="monospaced">
+SHAPE_OP
+ 0 Set
+ 1 Union
+ 2 Intersect
+ 3 Subtract
+ 4 Invert
+</literallayout>
+</sect1>
+
+<sect1 id="Requests_2">
+<title>Requests</title>
+<literallayout class="monospaced">
+<function>ShapeQueryVersion</function>
+ 1 CARD8 opcode
+ 1 0 shape opcode
+ 2 1 request length
+
+=&gt;
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 length
+ 2 CARD16 major version
+ 2 CARD16 minor version
+ 20 unused
+</literallayout>
+
+<literallayout class="monospaced">
+<function>ShapeRectangles</function>
+ 1 CARD8 opcode
+ 1 1 shape opcode
+ 2 4+2n request length
+ 1 SHAPE_OP operation
+ 1 SHAPE_KIND destination kind
+ 1 ordering
+ 0 UnSorted
+ 1 YSorted
+ 2 YXSorted
+ 3 YXBanded
+ 1 unused
+ 4 WINDOW destination window
+ 2 INT16 x offset
+ 2 INT16 y offset
+ 8n LISTofRECTANGLE rectangles
+</literallayout>
+
+
+<literallayout class="monospaced">
+<function>ShapeMask</function>
+ 1 CARD8 opcode
+ 1 2 shape opcode
+ 2 5 request length
+ 1 SHAPE_OP operation
+ 1 SHAPE_KIND destination kind
+ 2 unused
+ 4 WINDOW destination window
+ 2 INT16 x offset
+ 2 INT16 y offset
+ 4 PIXMAP source bitmap
+ 0 None
+</literallayout>
+
+
+<literallayout class="monospaced">
+<function>ShapeCombine</function>
+ 1 CARD8 opcode
+ 1 3 shape opcode
+ 2 5 request length
+ 1 SHAPE_OP operation
+ 1 SHAPE_KIND destination kind
+ 1 SHAPE_KIND source kind
+ 1 unused
+ 4 WINDOW destination window
+ 2 INT16 x offset
+ 2 INT16 y offset
+ 4 WINDOW source window
+</literallayout>
+
+<literallayout class="monospaced">
+<function>ShapeOffset</function>
+ 1 CARD8 opcode
+ 1 4 shape opcode
+ 2 4 request length
+ 1 SHAPE_KIND destination kind
+ 3 unused
+ 4 WINDOW destination window
+ 2 INT16 x offset
+ 2 INT16 y offset
+</literallayout>
+
+<literallayout class="monospaced">
+<function>ShapeQueryExtents</function>
+ 1 CARD8 opcode
+ 1 5 shape opcode
+ 2 2 request length
+ 4 WINDOW destination window
+
+ =&gt;
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 1 BOOL bounding shaped
+ 1 BOOL clip shaped
+ 2 unused
+ 2 INT16 bounding shape extents x
+ 2 INT16 bounding shape extents y
+ 2 CARD16 bounding shape extents width
+ 2 CARD16 bounding shape extents height
+ 2 INT16 clip shape extents x
+ 2 INT16 clip shape extents y
+ 2 CARD16 clip shape extents width
+ 2 CARD16 clip shape extents height
+ 4 unused
+</literallayout>
+
+<literallayout class="monospaced">
+<function>ShapeSelectInput</function>
+ 1 CARD8 opcode
+ 1 6 shape opcode
+ 2 3 request length
+ 4 WINDOW destination window
+ 1 BOOL enable
+ 3 unused
+</literallayout>
+
+<literallayout class="monospaced">
+<function>ShapeInputSelected</function>
+ 1 CARD8 opcode
+ 1 7 shape opcode
+ 2 2 request length
+ 4 WINDOW destination window
+ =&gt;
+ 1 1 Reply
+ 1 BOOL enabled
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 24 unused
+</literallayout>
+
+<literallayout class="monospaced">
+<function>ShapeGetRectangles</function>
+ 1 CARD8 opcode
+ 1 8 shape opcode
+ 2 3 request length
+ 4 WINDOW window
+ 1 SHAPE_KIND source kind
+ 3 unused
+ =&gt;
+ 1 1 Reply
+ 1 ordering
+ 0 UnSorted
+ 1 YSorted
+ 2 YXSorted
+ 3 YXBanded
+ 2 CARD16 sequence number
+ 4 2n reply length
+ 4 CARD32 nrects
+ 20 unused
+ 8n LISTofRECTANGLE rectangles
+</literallayout>
+</sect1>
+
+<sect1 id="Events_2">
+<title>Events</title>
+<literallayout class="monospaced">
+<function>ShapeNotify</function>
+ 1 CARD8 type (0 + extension event base)
+ 1 SHAPE_KIND shape kind
+ 2 CARD16 sequence number
+ 4 WINDOW affected window
+ 2 INT16 x value of extents
+ 2 INT16 y value of extents
+ 2 CARD16 width of extents
+ 2 CARD16 height of extents
+ 4 TIMESTAMP server time
+ 1 BOOL shaped
+ 11 unused
+</literallayout>
+</sect1>
+</chapter>
+
+<glossary id="glossary">
+<title>Glossary</title>
+<glossentry>
+ <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.
+<!-- .KE -->
+ </para>
+ </glossdef>
+</glossentry>
+<glossentry>
+ <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.
+<!-- .KE -->
+ </para>
+ </glossdef>
+</glossentry>
+<glossentry>
+ <glossterm>input region</glossterm>
+ <glossdef>
+<para>
+The subset of the bounding region which can ``contain'' the
+pointer.
+<!-- .KE -->
+ </para>
+ </glossdef>
+</glossentry>
+<glossentry>
+ <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.
+<!-- .KE -->
+ </para>
+ </glossdef>
+</glossentry>
+<glossentry>
+ <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.
+<!-- .KE -->
+ </para>
+ </glossdef>
+</glossentry>
+<glossentry>
+ <glossterm>default input 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.
+<!-- .KE -->
+ </para>
+ </glossdef>
+</glossentry>
+<glossentry>
+ <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.
+<!-- .KE -->
+ </para>
+ </glossdef>
+</glossentry>
+<glossentry>
+ <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.
+<!-- .KE -->
+ </para>
+ </glossdef>
+</glossentry>
+<glossentry>
+ <glossterm>client input region</glossterm>
+ <glossdef>
+<para>
+The region associated with a window that is directly modified via this
+extension when specified by
+<function> ShapeInput . </function>
+This region is used in conjunction with the default input region
+and the client bounding region to produce the effective input region.
+<!-- .KE -->
+ </para>
+ </glossdef>
+</glossentry>
+<glossentry>
+ <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.
+<!-- .KE -->
+ </para>
+ </glossdef>
+</glossentry>
+<glossentry>
+ <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.
+<!-- .KE -->
+ </para>
+ </glossdef>
+</glossentry>
+<glossentry>
+ <glossterm>effective input region</glossterm>
+ <glossdef>
+<para>
+The actual shape of the window on the screen (excluding the
+effects of overlapping windows) which can ``contain'' the pointer.
+When a window has a client input region or
+a client bounding region, the effective input region is the intersection of
+the default input region, the client input region (if any) and the client
+bounding region (if any). Otherwise, the effective input region is the
+same as the default input region.
+<!-- .KE -->
+ </para>
+ </glossdef>
+</glossentry>
+<!--
+Revision History
+.LP
+1.0 - 1989 - Original Revision
+.LP
+1.0.1 - March 2004 - Corrected misnumbering of \fIShapeInputSelected
+and \fIShapeGetRectangles requests in encoding section.
+.LP
+1.1 - February 2006 - Added Input regions.
+-->
+</glossary>
+</book>
diff --git a/specs/shm.xml b/specs/shm.xml
new file mode 100644
index 0000000..f6ad347
--- /dev/null
+++ b/specs/shm.xml
@@ -0,0 +1,476 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+
+
+<!-- lifted from troff+ms+XMan by doclifter -->
+<book id="shm">
+
+<bookinfo>
+ <title>MIT-SHM(The MIT Shared Memory Extension)</title>
+ <subtitle>How the shared memory extension works</subtitle>
+ <authorgroup>
+ <author>
+ <firstname>Jonathan</firstname><surname>Corbet</surname>
+ <affiliation>
+ <orgname>National Center for Atmospheric Research</orgname>
+ <orgdiv>Atmospheric Technology Division</orgdiv>
+ </affiliation>
+ <email>corbet@ncar.ucar.edu</email>
+ </author>
+ <editor>
+ <firstname>Keith</firstname><surname>Packard</surname>
+ <affiliation><orgname>MIT X Consortium</orgname></affiliation>
+ </editor>
+ </authorgroup>
+ <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
+ <releaseinfo>Version 1.0</releaseinfo>
+ <copyright><year>1991</year><holder>X Consortium</holder></copyright>
+
+<legalnotice>
+<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 &ldquo;AS IS&rdquo;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+</para>
+<para>
+Except as contained in this notice, the name of the X Consortium shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from the X Consortium.
+</para>
+<para>X Window System is a trademark of The OpenGroup.</para>
+</legalnotice>
+
+<abstract>
+<para>
+This document briefly describes how to use the MIT-SHM shared memory
+extension. I have tried to make it accurate, but it would not surprise me
+if some errors remained. If you find anything wrong, do let me know and I
+will incorporate the corrections. Meanwhile, please take this document "as
+is" (eman improvement over what was there before, but certainly not the
+definitive word.)
+</para>
+</abstract>
+
+</bookinfo>
+
+<chapter id="REQUIREMENTS">
+<title>REQUIREMENTS</title>
+<para>
+The shared memory extension is provided only by some X servers. To find out
+if your server supports the extension, use xdpyinfo(1). In particular, to
+be able to use this extension, your system must provide the SYSV shared
+memory primitives. There is not an mmap-based version of this extension.
+To use shared memory on Sun systems, you must have built your kernel with
+SYSV shared memory enabled -- which is not the default configuration.
+Additionally, the shared memeory maximum size will need to be increased on
+both Sun and Digital systems; the defaults are far too small for any useful
+work.
+</para>
+</chapter>
+
+<chapter id="WHAT_IS_PROVIDED">
+<title>WHAT IS PROVIDED</title>
+
+<para>
+The basic capability provided is that of shared memory XImages. This is
+essentially a version of the ximage interface where the actual image data
+is stored in a shared memory segment, and thus need not be moved through
+the Xlib interprocess communication channel. For large images, use of this
+facility can result in some real performance increases.
+</para>
+
+<para>
+Additionally, some implementations provided shared memory pixmaps. These
+are 2 dimensional arrays of pixels in a format specified by the X server,
+where the image data is stored in the shared memory segment. Through use of
+shared memory pixmaps, it is possible to change the contents of these
+pixmaps without using any Xlib routines at all. Shared memory pixmaps can
+only be supported when the X server can use regular virtual memory for
+pixmap data; if the pixmaps are stored in some magic graphics hardware, your
+application will not be able to share them with the server. Xdpyinfo(1)
+doesn't print this particular nugget of information.
+</para>
+</chapter>
+
+<chapter id="HOW_TO_USE_THE_SHARED_MEMORY_EXTENSION">
+<title>HOW TO USE THE SHARED MEMORY EXTENSION</title>
+<para>
+Code which uses the shared memory extension must include a number of header
+files:
+</para>
+
+<literallayout class="monospaced">
+#include &lt;X11/Xlib.h&gt; /* of course */
+#include &lt;sys/ipc.h&gt;
+#include &lt;sys/shm.h&gt;
+#include &lt;X11/extensions/XShm.h&gt;
+</literallayout>
+
+<para>
+Of course, if the system you are building on does not support shared
+memory, the file XShm.h may not be present. You may want to make
+liberal use of #ifdefs.
+</para>
+
+<para>
+Any code which uses the shared memory extension should first check to see
+that the server provides the extension. You could always be running over
+the net, or in some other environment where the extension will not work.
+To perform this check, call either
+</para>
+
+<funcsynopsis id='XShmQueryExtension'>
+<funcprototype>
+ <funcdef>Status <function>XShmQueryExtension</function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+or
+</para>
+
+<funcsynopsis id='XShmQueryVersion'>
+<funcprototype>
+ <funcdef>Status <function>XShmQueryVersion</function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+ <paramdef>int <parameter>*major</parameter></paramdef>
+ <paramdef>int <parameter>*minor</parameter></paramdef>
+ <paramdef>Bool <parameter>*pixmaps</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Where "display" is, of course, the display on which you are running. If
+the shared memory extension may be used, the return value from either
+function will be True; otherwise your program should operate using
+conventional Xlib calls. When the extension is available,
+\fCXShmQueryVersion\fP also returns "major" and "minor" which are the
+version numbers of the extension implementation, and "pixmaps" which is
+True iff shared memory pixmaps are supported.
+</para>
+</chapter>
+
+<chapter id="USE_OF_SHARED_MEMORY_XIMAGES">
+<title>USE OF SHARED MEMORY XIMAGES</title>
+<para>
+The basic sequence of operations for shared memory XImages is as follows:
+</para>
+
+<orderedlist>
+ <listitem>
+ <para>
+Create the shared memory XImage structure
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Create a shared memory segment to store the image data
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Inform the server about the shared memory segment
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Use the shared memory XImage, much like a normal one.
+ </para>
+ </listitem>
+</orderedlist>
+
+<para>
+To create a shared memory XImage, use:
+</para>
+
+<funcsynopsis id='XShmCreateImage'>
+<funcprototype>
+ <funcdef>XImage <function>*XShmCreateImage</function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+ <paramdef>Visual <parameter>*visual</parameter></paramdef>
+ <paramdef>unsigned int <parameter>depth</parameter></paramdef>
+ <paramdef>int <parameter>format</parameter></paramdef>
+ <paramdef>char <parameter>*data</parameter></paramdef>
+ <paramdef>XShmSegmentInfo <parameter>*shminfo</parameter></paramdef>
+ <paramdef>unsigned int <parameter>width</parameter></paramdef>
+ <paramdef>unsigned int <parameter>height</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Most of the arguments are the same as for XCreateImage; I will not go
+through them here. Note, however, that there are no "offset", "bitmap_pad",
+or "bytes_per_line" arguments. These quantities will be defined by the
+server itself, and your code needs to abide by them. Unless you have already
+allocated the shared memory segment (see below), you should pass in NULL for
+the "data" pointer.
+</para>
+
+<para>
+There is one additional argument: "shminfo", which is a pointer to a
+structure of type XShmSegmentInfo. You must allocate one of these
+structures such that it will have a lifetime at least as long as that of
+the shared memory XImage. There is no need to initialize this structure
+before the call to XShmCreateImage.
+</para>
+
+<para>
+The return value, if all goes well, will be an XImage structure, which you
+can use for the subsequent steps.
+</para>
+
+<para>
+The next step is to create the shared memory segment. This is
+best done after the creation of the XImage, since you need to make use of
+the information in that XImage to know how much memory to allocate. To
+create the segment, you need a call like:
+</para>
+
+
+<literallayout class="monospaced">
+shminfo.shmid = shmget (IPC_PRIVATE,
+ image-&gt;bytes_per_line * image-&gt;height, IPC_CREAT|0777);
+</literallayout>
+
+<para>
+(assuming that you have called your shared memory XImage "image"). You
+should, of course, follow the Rules and do error checking on all of these
+system calls. Also, be sure to use the bytes_per_line field, not the width
+you used to create the XImage as they may well be different.
+</para>
+
+<para>
+Note that the shared memory ID returned by the system is stored in the
+shminfo structure. The server will need that ID to attach itself to the
+segment.
+</para>
+
+<para>
+Also note that, on many systems for security reasons, the X server
+will only accept to attach to the shared memory segment if it's
+readable and writeable by "other". On systems where the X server is
+able to determine the uid of the X client over a local transport, the
+shared memory segment can be readable and writeable only by the uid of
+the client.
+</para>
+
+<para>
+Next, attach this shared memory segment to your process:
+</para>
+
+<para>
+shminfo.shmaddr = image-&gt;data = shmat (shminfo.shmid, 0, 0);
+</para>
+
+<para>
+The address returned by shmat should be stored in *both* the XImage
+structure and the shminfo structure.
+</para>
+
+<para>
+To finish filling in the shminfo structure, you need to decide how you want
+the server to attach to the shared memory segment, and set the "readOnly"
+field as follows. Normally, you would code:
+</para>
+<para>
+shminfo.readOnly = False;
+</para>
+
+<para>
+If you set it to True, the server will not be able to write to this
+segment, and thus XShmGetImage calls will fail.
+</para>
+
+<para>
+Finally, tell the server to attach to your shared memory segment with:
+</para>
+
+<literallayout class="monospaced">
+Status XShmAttach (display, shminfo);
+</literallayout>
+
+<para>
+If all goes well, you will get a non-zero status back, and your XImage is
+ready for use.
+</para>
+
+<para>
+To write a shared memory XImage into an X drawable, use XShmPutImage:
+</para>
+
+<funcsynopsis id='XShmPutImage'>
+<funcprototype>
+ <funcdef>Status <function>XShmPutImage </function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+ <paramdef>Drawable <parameter>d</parameter></paramdef>
+ <paramdef>GC <parameter>gc</parameter></paramdef>
+ <paramdef>XImage <parameter>*image</parameter></paramdef>
+ <paramdef>int <parameter>src_x</parameter></paramdef>
+ <paramdef>int <parameter>src_y</parameter></paramdef>
+ <paramdef>int <parameter>dest_x</parameter></paramdef>
+ <paramdef>int <parameter>dest_y</parameter></paramdef>
+ <paramdef>unsigned int <parameter>width</parameter></paramdef>
+ <paramdef>unsigned int <parameter>height</parameter></paramdef>
+ <paramdef>bool <parameter>send_event</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+The interface is identical to that of XPutImage, so I will spare my fingers
+and not repeat that documentation here. There is one additional parameter,
+however, called "send_event". If this parameter is passed as True, the
+server will generate a "completion" event when the image write is complete;
+thus your program can know when it is safe to begin manipulating the shared
+memory segment again.
+</para>
+
+<para>
+The completion event has type XShmCompletionEvent, which is defined as the
+following:
+</para>
+
+<literallayout class="monospaced">
+typedef struct {
+ int type; /* of event */
+ unsigned long serial; /* # of last request processed */
+ Bool send_event; /* true if 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 */
+} XShmCompletionEvent;
+</literallayout>
+
+<para>
+The event type value that will be used can be determined at run time with a
+line of the form:
+</para>
+
+<para>
+int CompletionType = XShmGetEventBase (display) + ShmCompletion;
+</para>
+
+<para>
+If you modify the shared memory segment before the arrival of the
+completion event, the results you see on the screen may be inconsistent.
+</para>
+
+<para>
+To read image data into a shared memory XImage, use the following:
+</para>
+
+<funcsynopsis id='XShmGetImage'>
+<funcprototype>
+ <funcdef>Status <function>XShmGetImage </function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+ <paramdef>Drawable <parameter>d</parameter></paramdef>
+ <paramdef>XImage <parameter>*image</parameter></paramdef>
+ <paramdef>int <parameter>x</parameter></paramdef>
+ <paramdef>int <parameter>y</parameter></paramdef>
+ <paramdef>unsigned long <parameter>plane_mask</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+Where "display" is the display of interest, "d" is the source drawable,
+"image" is the destination XImage, "x" and "y" are the offsets within
+"d", and "plane_mask" defines which planes are to be read.
+</para>
+
+<para>
+To destroy a shared memory XImage, you should first instruct the server to
+detach from it, then destroy the segment itself, as follows:
+</para>
+
+<literallayout class="monospaced">
+XShmDetach (display, shminfo);
+XDestroyImage (image);
+shmdt (shminfo.shmaddr);
+shmctl (shminfo.shmid, IPC_RMID, 0);
+</literallayout>
+
+</chapter>
+
+<chapter id="USE_OF_SHARED_MEMORY_PIXMAPS">
+<title>USE OF SHARED MEMORY PIXMAPS</title>
+<para>
+Unlike X images, for which any image format is usable, the shared memory
+extension supports only a single format (i.e. XYPixmap or ZPixmap) for the
+data stored in a shared memory pixmap. This format is independent of the
+depth of the image (for 1-bit pixmaps it doesn't really matter what this
+format is) and independent of the screen. Use XShmPixmapFormat to get the
+format for the server:
+</para>
+
+<funcsynopsis id='XShmPixmapFormat'>
+<funcprototype>
+ <funcdef>int <function>XShmPixmapFormat</function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+If your application can deal with the server pixmap data format (including
+bits-per-pixel et al.), create a shared memory segment and "shminfo"
+structure in exactly the same way as is listed above for shared memory
+XImages. While it is, not strictly necessary to create an XImage first,
+doing so incurs little overhead and will give you an appropriate
+bytes_per_line value to use.
+</para>
+
+<para>
+Once you have your shminfo structure filled in, simply call:
+</para>
+
+<funcsynopsis id='XShmCreatePixmap'>
+<funcprototype>
+ <funcdef>Pixmap <function>XShmCreatePixmap</function></funcdef>
+ <paramdef>Display <parameter>*display</parameter></paramdef>
+ <paramdef>Drawable <parameter>d</parameter></paramdef>
+ <paramdef>char <parameter>*data</parameter></paramdef>
+ <paramdef>XShmSegmentInfo <parameter>*shminfo</parameter></paramdef>
+ <paramdef>unsigned int <parameter>width</parameter></paramdef>
+ <paramdef>unsigned int <parameter>height</parameter></paramdef>
+ <paramdef>unsigned int <parameter>depth</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<para>
+The arguments are all the same as for XCreatePixmap, with two additions:
+"data" and "shminfo". The second of the two is the same old shminfo
+structure that has been used before. The first is the pointer to the shared
+memory segment, and should be the same as the shminfo.shmaddr field. I am
+not sure why this is a separate parameter.
+</para>
+
+<para>
+If everything works, you will get back a pixmap, which you can manipulate in
+all of the usual ways, with the added bonus of being able to tweak its
+contents directly through the shared memory segment. Shared memory pixmaps
+are destroyed in the usual manner with XFreePixmap, though you should detach
+and destroy the shared memory segment itself as shown above.
+</para>
+</chapter>
+</book>
diff --git a/specs/sync.xml b/specs/sync.xml
new file mode 100644
index 0000000..afb0783
--- /dev/null
+++ b/specs/sync.xml
@@ -0,0 +1,1274 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+
+<!--translated from sync.tex, on 2010-06-29 10:52:00,
+by TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/) xhtml,docbook,html,refcaption -->
+
+
+<book id="sync">
+
+<bookinfo>
+ <title>X Synchronization Extension Protocol</title>
+ <subtitle>X Consortium Standard</subtitle>
+ <authorgroup>
+ <author>
+ <firstname>Tim</firstname><surname>Glauert</surname>
+ <affiliation>
+ <orgname>Olivetti Research</orgname>
+ <orgdiv>MultiWorks</orgdiv>
+ </affiliation>
+ </author>
+ <othercredit>
+ <firstname>Dave</firstname>
+ <surname>Carver</surname>
+ <affiliation>
+ <orgname>Digital Equipment Corporation</orgname>
+ <orgdiv>MIT/Project Athena</orgdiv>
+ </affiliation>
+ </othercredit>
+ <othercredit>
+ <firstname>Jim</firstname>
+ <surname>Gettys</surname>
+ <affiliation>
+ <orgname>Digital Equipment Corporation</orgname>
+ <orgdiv>Cambridge Research Laboratory</orgdiv>
+ </affiliation>
+ </othercredit>
+ <othercredit>
+ <firstname>David</firstname>
+ <othername>P.</othername>
+ <surname>Wiggins</surname>
+ <affiliation><orgname>X Consortium, Inc.</orgname></affiliation>
+ </othercredit>
+ <othercredit>
+ <firstname>James</firstname>
+ <surname>Jones</surname>
+ <affiliation><orgname>NVIDIA Corporation</orgname></affiliation>
+ </othercredit>
+ </authorgroup>
+ <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
+ <releaseinfo>Version 3.1</releaseinfo>
+ <copyright><year>1991</year>
+ <holder>Olivetti Research Limited, Cambridge England</holder>
+ <holder>Digital Equipment Corporation, Maynard, Massachusetts</holder>
+ <holder>X Consortium</holder>
+ </copyright>
+ <copyright><year>2010</year><holder>NVIDIA Corporation</holder></copyright>
+
+<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, the
+X Consortium, and NVIDIA 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 &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='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>, <function>Alarm</function>,
+and <function>Fence</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 Await request that waits until one of a set of synchronization
+conditions, called TRIGGERs, becomes TRUE. Alarms generate events when
+counter values go through a specified transition. A fence has two possible
+states: triggered and not triggered. Client requests can put the fence in
+either of these states. A client can block until one of a set of fences
+becomes triggered by sending an AwaitFence request. Fences are bound to a
+particular screen at creation time.
+</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>
+
+<para>
+The <function>CreateFence</function> request allows a client to create a
+<function>Fence</function> that can be triggered and reset using
+<function>TriggerFence</function> and <function>ResetFence</function>
+requests, respectively. <function>CreateFence</function> takes a drawable
+argument that implies which screen the fence should be created on. The
+<function>TriggerFence</function> request changes the fence's state only
+after all previous rendering commands affecting objects owned by the given
+fence's screen have completed. Note that while fence objects are bound
+to a screen and the simple trigger operation provided by this extension
+operates at screen granularity, other extensions may add more fine-grained
+trigger operations based on any number of events. The screen binding
+merely establishes an upper bound for the scope of fence operations.
+</para>
+
+</sect1>
+<sect1 id='Types'>
+<title>Types</title>
+<para>
+Please refer to the X11 Protocol specification as this document uses
+syntactic conventions established there and references types defined there.
+</para>
+
+<para>The following new types are used by the extension.</para>
+
+<literallayout class="monospaced">
+INT64: 64-bit signed integer
+COUNTER: XID
+VALUETYPE: {Absolute,Relative};
+TESTTYPE: {PositiveTransition,NegativeTransition,
+ PositiveComparison,NegativeComparison}
+TRIGGER: [
+ counter:COUNTER,
+ value-type:VALUETYPE,
+ wait-value:INT64,
+ test-type:TESTTYPE
+ ]
+WAITCONDITION: [
+ trigger:TRIGGER,
+ event-threshold:INT64
+ ]
+SYSTEMCOUNTER: [
+ name:STRING8,
+ counter:COUNTER,
+ resolution:INT64
+ ]
+ALARM: XID
+ALARMSTATE: {Active,Inactive,Destroyed}
+FENCE: XID
+</literallayout>
+
+<para>
+The COUNTER type defines the client-side handle on a server
+<function>Counter</function>. The value of a counter is an INT64.
+</para>
+
+<para>
+The TRIGGER type defines a test on a counter that is either TRUE or FALSE. The
+value of the test is determined by the combination of a test value, the value
+of the counter, and the specified test-type.
+</para>
+
+<para>
+The test value for a trigger is calculated using the value-type and
+wait-value fields when the trigger is initialized. If the value-type field
+is not one of the named VALUETYPE constants, the request that initialized the
+trigger will return a <function>Value</function> error. If the value-type
+field is <function>Absolute</function>, the test value is given by the
+wait-value field. If the value-type field is <function>Relative</function>,
+the test value is obtained by adding the wait-value field to the value of the
+counter. If the resulting test value would lie outside the range for an
+INT64, the request that initialized the trigger will return a
+<function>Value</function> error. If counter is <function>None</function>
+and the value-type is <function>Relative</function>, the request that
+initialized the trigger will return a <function>Match</function> error. If
+counter is not None and does not name a valid counter, a Counter error is
+generated.
+</para>
+
+<para>
+If the test-type is <function>PositiveTransition</function>, the trigger is
+initialized to FALSE, and it will become TRUE when the counter changes from
+a value less than the test value to a value greater than or equal to the
+test value. If the test-type is <function>NegativeTransition</function>,
+the trigger is initialize to FALSE, and it will become TRUE when the counter
+changes from a value greater than the test value to a value less than or
+equal to the test value. If the test-type is
+<function>PositiveComparison</function>, the trigger is TRUE if the
+counter is greater than or equal to the test value and FALSE otherwise. If the
+test-type is <function>NegativeComparison</function>, the trigger is TRUE
+if the counter is less than or equal to the test value and FALSE otherwise.
+If the test-type is not one of the named TESTTYPE constants, the request that
+initialized the trigger will return a Value error. A trigger with a counter
+value of <function>None</function> and a valid test-type is always TRUE.
+</para>
+
+<para>
+The WAITCONDITION type is simply a trigger with an associated event-threshold.
+The event threshold is used by the <function>Await</function> request to
+decide whether or not to generate an event to the client after the trigger has
+become TRUE. By setting the event-threshold to an appropriate value, it is
+possible to detect the situation where an <function>Await</function> request
+was processed after the TRIGGER became TRUE, which usually indicates that
+the server is not processing requests as fast as the client expects.
+</para>
+
+<para>
+The SYSTEMCOUNTER type provides the client with information about a
+<function>System</function>Counter. The name field is the textual name of
+the counter that identifies the counter to the client. The counter field
+is the client-side handle that should be used in requests that require a
+counter. The resolution field gives the approximate step size of the system
+counter. This is a hint to the client
+that the extension may not be able to resolve two wait conditions with test
+values that differ by less than this step size. A microsecond clock, for
+example, may advance in steps of 64 microseconds, so a counter based on this
+clock would have a resolution of 64.
+</para>
+
+<para>
+The only system counter that is guaranteed to be present is called SERVERTIME,
+which counts milliseconds from some arbitrary starting point. The least
+significant 32 bits of this counter track the value of Time used by the
+server in Events and Requests. Other system counters may be provided by
+different implementations of the extension. The X Consortium will maintain a
+registry of system counter names to avoid collisions in the name space.
+</para>
+
+<para>
+An ALARM is the client-side handle on an <function>Alarm</function> resource.
+</para>
+
+<para>
+The FENCE type defines the client-side handle on a server
+<function>Fence</function>. A fence can only be in one of two states,
+represented by a BOOL. If the value is TRUE, the fence is in the triggered
+state. Otherwise, the fence is in the not triggered state.
+</para>
+
+</sect1>
+
+<sect1 id='Errors'>
+<title>Errors</title>
+
+<variablelist>
+ <varlistentry>
+ <term>Counter</term>
+ <listitem>
+ <para>
+This error is generated if the value for a COUNTER argument in a request
+does not name a defined COUNTER.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Alarm</term>
+ <listitem>
+ <para>
+This error is generated if the value for an ALARM argument in a request
+does not name a defined ALARM.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Fence</term>
+ <listitem>
+ <para>
+This error is generated if the value for a FENCE argument in a request
+does not name a defined FENCE.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+</sect1>
+<sect1 id='Requests'>
+<title>Requests</title>
+
+<variablelist>
+ <varlistentry>
+ <term>Initialize</term>
+ <listitem>
+<literallayout class="monospaced">
+version-major,version-minor: CARD8
+=>
+version-major,version-minor: CARD8
+</literallayout>
+
+ <para>
+This request must be executed before any other requests for this extension. If a
+client violates this rule, the results of all SYNC requests that it issues are
+undefined. The request takes the version number of the extension that the
+client wishes to use and returns the actual version number being implemented
+by the extension for this client. The extension may return different
+version numbers to a client depending of the version number supplied by
+that client. This request should be executed only once for each client
+connection.
+ </para>
+ <para>
+Given two different versions of the SYNC protocol, v1 and v2, v1 is
+compatible with v2 if and only if v1.version_major = v2.version_major
+and v1.version_minor &lt;= v2.version_minor. Compatible means that the
+functionality is fully supported in an identical fashion in the two versions.
+ </para>
+ <para>
+This document describes major version 3, minor version 1 of the SYNC protocol.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>ListSystemCounters</term>
+ <listitem>
+<literallayout class="monospaced">
+=>
+system-counters: LISTofSYSTEMCOUNTER
+Errors: Alloc
+</literallayout>
+ <para>
+This request returns a list of all the system counters that are available at
+the time the request is executed, which includes the system counters
+that are maintained by other extensions. The list returned by this
+request may change as counters are created and destroyed by other extensions.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>CreateCounter</term>
+ <listitem>
+<literallayout class="monospaced">
+id: COUNTER
+initial-value: INT64
+Errors: IDChoice,Alloc
+</literallayout>
+ <para>
+This request creates a counter and assigns the specified id to it. The counter
+value is initialized to the specified initial-value and there are no clients
+waiting on the counter.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>DestroyCounter</term>
+ <listitem>
+<literallayout class="monospaced">
+counter: COUNTER
+Errors: Counter,Access
+</literallayout>
+ <para>
+This request destroys the given counter and sets the counter fields for all
+triggers that specify this counter to <function>None</function>. All clients
+waiting on the counter are released and a <function>CounterNotify</function>
+event with the destroyed field set to TRUE is sent to each waiting client,
+regardless of the event-threshold. All alarms specifying the counter become
+<function>Inactive</function> and an <function>AlarmNotify</function>
+event with a state field of <function>Inactive</function> is generated. A
+counter is destroyed automatically when the connection to the creating client
+is closed down if the close-down mode is Destroy. An
+<function>Access</function> error is generated if counter is a system
+counter. A <function>Counter</function> error is generated if counter does
+not name a valid counter.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>QueryCounter</term>
+ <listitem>
+<literallayout class="monospaced">
+counter: COUNTER
+=>
+value: INT64
+Errors: <function>Counter</function>
+</literallayout>
+ <para>
+This request returns the current value of the given counter or a generates
+Counter error if counter does not name a valid counter.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Await</term>
+ <listitem>
+<literallayout class="monospaced">
+wait-list: LISTofWAITCONDITION
+Errors: Counter,Alloc,Value
+</literallayout>
+ <para>
+When this request is executed, the triggers in the wait-list are initialized
+using the wait-value and value-type fields, as described in the definition of
+TRIGGER above. The processing of further requests for the client is blocked
+until one or more of the triggers becomes TRUE. This may happen immediately,
+as a result of the initialization, or at some later time, as a result of
+a subsequent <function>SetCounter</function>,
+<function>ChangeCounter</function> or
+<function>DestroyCounter</function> request.
+ </para>
+ <para>
+A Value error is generated if wait-list is empty.
+ </para>
+ <para>
+When the client becomes unblocked, each trigger is checked to determine
+whether a <function>CounterNotify</function> event should be generated.
+The difference between the counter and the test value is calculated by
+subtracting the test value from the value of the counter. If the test-type
+is <function>PositiveTransition</function> or
+<function>PositiveComparison</function>, a
+<function>CounterNotify</function> event is generated if the difference is
+at least event-threshold. If the test-type is
+<function>NegativeTransition</function> or
+<function>NegativeComparison</function>, a
+<function>CounterNotify</function> event is generated if the difference
+is at most event-threshold. If the difference lies outside the range for an
+INT64, an event is not generated.
+ </para>
+ <para>
+This threshold check is made for each trigger in the list and a
+<function>CounterNotify</function> event is generated for every trigger for
+which the check succeeds. The check for
+<function>CounterNotify</function> events is performed even if one of the
+triggers is TRUE when the request is first executed. Note that a
+<function>CounterNotify</function> event may be generated for a trigger
+that is FALSE if there are multiple triggers in the request. A
+<function>CounterNotify</function> event with the destroyed flag set to
+TRUE is always generated if the counter for one of the triggers is
+destroyed.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>ChangeCounter</term>
+ <listitem>
+<literallayout class="monospaced">
+counter: COUNTER
+amount: INT64
+Errors: <function>Counter,Access,Value</function>
+</literallayout>
+ <para>
+This request changes the given counter by adding amount to the current
+counter value. If the change to this counter satisfies a trigger for which a client
+is waiting, that client is unblocked and one or more
+<function>CounterNotify</function> events may be generated. If the change to
+the counter satisfies the trigger for an alarm, an
+<function>AlarmNotify</function> event is generated and the
+alarm is updated. An <function>Access</function> error is generated if
+counter is a system counter. A <function>Counter</function> error is
+generated if counter does not name a valid counter. If the resulting value
+for the counter would be outside the range for an INT64, a
+<function>Value</function> error is generated and the counter is not changed.
+ </para>
+ <para>
+It should be noted that all the clients whose triggers are satisfied by this
+change are unblocked, so this request cannot be used to implement mutual
+exclusion.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>SetCounter</term>
+ <listitem>
+<literallayout class="monospaced">
+counter: COUNTER
+value: INT64
+Errors: <function>Counter,Access</function>
+</literallayout>
+ <para>
+This request sets the value of the given counter to value. The effect is
+equivalent to executing the appropriate ChangeCounter request to change
+the counter value to value. An Access error is generated if counter names a
+system counter. A Counter error is generated if counter does not name a valid
+counter.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>CreateAlarm</term>
+ <listitem>
+<literallayout class="monospaced">
+id: ALARM
+values-mask: CARD32
+values-list: LISTofVALUE
+left">Errors: IDChoice,Counter,Match,Value,Alloc
+</literallayout>
+ <para>
+This request creates an alarm and assigns the identifier id to it. The
+values-mask and values-list specify the attributes that are to be explicitly
+initialized. The attributes for an Alarm and their defaults are:
+ </para>
+ <informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='4' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*" colsep='1'/>
+ <colspec colname='c2' colwidth="1.0*" colsep='1'/>
+ <colspec colname='c3' colwidth="1.0*"/>
+ <colspec colname='c4' colwidth="1.3*"/>
+ <thead>
+ <row rowsep='1'>
+ <entry>Attribute</entry>
+ <entry>Type</entry>
+ <entry namest='c3' nameend='c4'>Default</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>trigger</entry>
+ <entry>TRIGGER</entry>
+ <entry>counter</entry>
+ <entry>None</entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry></entry>
+ <entry>value-type</entry>
+ <entry>Absolute</entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry></entry>
+ <entry>value</entry>
+ <entry>0</entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry></entry>
+ <entry>test-type</entry>
+ <entry>PositiveComparison</entry>
+ </row>
+ <row>
+ <entry>delta</entry>
+ <entry>INT64</entry>
+ <entry>1</entry>
+ </row>
+ <row>
+ <entry>events</entry>
+ <entry>BOOL</entry>
+ <entry>TRUE</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ <para>
+The trigger is initialized as described in the definition of TRIGGER, with an
+error being generated if necessary.
+ </para>
+ <para>
+If the counter is <function>None</function>, the state of the alarm is set
+to <function>Inactive</function>, else it is set to Active.
+ </para>
+ <para>
+Whenever the trigger becomes TRUE, either as a result of this request or as the
+result of a <function>SetCounter</function>,
+<function>ChangeCounter</function>, <function>DestroyCounter</function>, or
+<function>ChangeAlarm</function> request, an
+<function>AlarmNotify</function> event is generated and the alarm is
+updated. The alarm is updated by repeatedly adding delta to the value of the
+trigger and reinitializing it until it becomes FALSE. If this update would
+cause value to fall outside the range for an INT64, or if the counter
+value is <function>None</function>, or if the delta is 0 and test-type
+is <function>PositiveComparison</function> or
+<function>NegativeComparison</function>, no change is made to value and
+the alarm state is changed to <function>Inactive</function> before the
+event is generated. No further events are generated by an
+<function>Inactive</function> alarm until a <function>ChangeAlarm</function>
+or <function>DestroyAlarm </function> request is executed.
+ </para>
+ <para>
+If the test-type is <function>PositiveComparison</function> or
+<function>PositiveTransition and</function> delta is less than zero, or
+if the test-type is <function>NegativeComparison</function> or
+<function>NegativeTransition</function> and delta is greater than zero,
+a <function>Match</function> error is generated.
+ </para>
+ <para>
+The events value enables or disables delivery of
+<function>AlarmNotify</function> events
+to the requesting client. The alarm keeps a separate event flag for
+each client so that other clients may select to receive events from this
+alarm.
+ </para>
+ <para>
+An <function>AlarmNotify</function> event is always generated at some time
+after the execution of a <function>CreateAlarm</function> request. This
+will happen immediately if the trigger is TRUE, or it will happen later
+when the trigger becomes TRUE or the Alarm is destroyed.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>ChangeAlarm</term>
+ <listitem>
+<literallayout class="monospaced">
+id: ALARM
+values-mask: CARD32
+values-list: LISTofVALUE
+Errors: Alarm,Counter,Value,Match
+</literallayout>
+ <para>
+This request changes the parameters of an Alarm. All of the parameters
+specified for the <function>CreateAlarm</function> request may be changed
+using this request. The trigger is reinitialized and an
+<function>AlarmNotify</function> event is generated if appropriate, as
+explained in the description of the <function>CreateAlarm</function> request.
+ </para>
+ <para>
+Changes to the events flag affect the event delivery to the requesting
+client only and may be used by a client to select or deselect event delivery
+from an alarm created by another client.
+ </para>
+ <para>
+The order in which attributes are verified and altered is server-dependent.
+If an error is generated, a subset of the attributes may have been altered.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>DestroyAlarm</term>
+ <listitem>
+<literallayout class="monospaced">
+alarm: ALARM
+Errors: Alarm
+</literallayout>
+ <para>
+This request destroys an alarm. An alarm is automatically destroyed when the
+creating client is closed down if the close-down mode is
+<function>Destroy</function>. When an alarm is destroyed, an
+<function>AlarmNotify</function> event is generated with a state value of
+<function>Destroyed</function>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>QueryAlarm</term>
+ <listitem>
+<literallayout class="monospaced">
+alarm: ALARM
+=>
+trigger: TRIGGER
+delta: INT64
+events: ALARMEVENTMASK
+state: ALARMSTATE
+Errors: <function>Alarm</function>
+</literallayout>
+ <para>This request retrieves the current parameters for an Alarm.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>SetPriority</term>
+ <listitem>
+<literallayout class="monospaced">
+client-resource: XID
+priority: INT32
+Errors: <function>Match</function>
+</literallayout>
+ <para>
+This request changes the scheduling priority of the client that created
+client-resource. If client-resource is <function>None</function>, then
+the priority for the client making the request is changed. A
+<function>Match</function> error is generated if client-resource is not
+<function>None</function> and does not name an existing resource in the
+server. For any two priority values, A and B, A is higher priority if
+and only if A is greater than B.
+ </para>
+ <para>
+The priority of a client is set to 0 when the initial client connection is
+ made.
+ </para>
+ <para>
+The effect of different client priorities depends on the particular
+implementation of the extension, and in some cases it may have no effect at
+all. However, the intention is that higher priority clients will have
+their requests executed before those of lower priority clients.
+ </para>
+ <para>
+For most animation applications, it is desirable that animation clients be
+given priority over nonrealtime clients. This improves the smoothness of the
+animation on a loaded server. Because a server is free to implement very strict
+priorities, processing requests for the highest priority client to the
+exclusion of all others, it is important that a client that may potentially
+monopolize the whole server, such as an animation that produces continuous
+output as fast as it can with no rate control, is run at low rather than high
+priority.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>GetPriority</term>
+ <listitem>
+<literallayout class="monospaced">
+client-resource: XID
+=>
+priority: INT32
+Errors: <function>Match</function>
+</literallayout>
+ <para>
+This request returns the scheduling priority of the client that created
+client-resource. If client-resource is <function>None</function>, then the
+priority for the client making the request is returned. A
+<function>Match</function> error is generated if client-resource is
+not <function>None</function> and does not name an existing resource in the
+server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>CreateFence</term>
+ <listitem>
+<literallayout class="monospaced">
+drawable: DRAWABLE
+id: FENCE
+initially-triggered: BOOL
+Errors: <function>IDChoice</function>,<function>Alloc</function>
+</literallayout>
+ <para>
+This request creates a fence on the screen associated with drawable and
+assigns the specified id to it. The fence is in the triggered state iff
+initially-triggered is TRUE. There are no clients waiting on the fence.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>TriggerFence</term>
+ <listitem>
+<literallayout class="monospaced">
+fence: FENCE
+Errors: <function>Fence</function>
+</literallayout>
+ <para>
+This request puts the given fence in the triggered state after all rendering
+from previous requests that affects resources owned by the fence's screen has
+completed. This includes requests from other clients if those requests have
+been dispatched. This request has no visible effects if the fence was already
+in the triggered state. A <function>Fence</function> error is generated if
+fence does not name a valid fence.
+ </para>
+ <para>
+Note that the given fence's state is not necessarily directly modified by this
+request. The state change need only be queued to occur after the required
+rendering has completed. Clients should take care to not assume the fence will
+be in the triggered state in subsequent requests, such as those that operate
+on the given fence immediately. <function>AwaitFence</function> should first
+be issued if subsequent requests require the fence to be in the triggered
+state.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>ResetFence</term>
+ <listitem>
+<literallayout class="monospaced">
+fence: FENCE
+Errors: <function>Fence</function>,<function>Match</function>
+</literallayout>
+ <para>
+This request immediately puts the given fence in the not triggered state.
+A <function>Match</function> error is generated if the fence is not in the
+triggered state. A <function>Fence</function> error is generated if fence
+does not name a valid fence.
+ </para>
+ <para>
+See the warnings above regarding <function>TriggerFence</function>'s delayed
+effect. In particular, a <function>TriggerFence</function> request
+immediately followed by a <function>ResetFence</function> request is likely
+to result in a <function>Match</function> error. An
+<function>AwaitFence</function> request should be issued between the two.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>DestroyFence</term>
+ <listitem>
+<literallayout class="monospaced">
+fence: FENCE
+Errors: <function>Fence</function>
+</literallayout>
+ <para>
+This request destroys the given fence. All clients waiting on this fence are
+released. A fence is destroyed automatically when the connection to the client
+that created the fence is closed if the close-down mode is
+<function>DestroyAll</function>. A <function>Fence</function> error is
+generated if fence does not name a valid fence.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>QueryFence</term>
+ <listitem>
+<literallayout class="monospaced">
+fence: FENCE
+=>
+triggered: BOOL
+Errors: <function>Fence</function>
+</literallayout>
+ <para>
+This request returns TRUE if the given fence is triggered, or FALSE if it
+is not triggered. A <function>Fence</function> error is generated if
+fence does not name a valid fence.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>AwaitFence</term>
+ <listitem>
+<literallayout class="monospaced">
+fence-list: LISTofFENCE
+Errors: <function>Fence</function>,<function>Alloc</function>
+</literallayout>
+ <para>
+When this request is executed, the processing of further requests for the
+client is blocked until one or more of the fences in fence-list reaches the
+triggered state. If any of the fences are already in the triggered state,
+request processing resumes immediately. A <function>Fence</function> error
+is generated if any member of fence-list does not name a valid fence.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</sect1>
+
+<sect1 id='Events'>
+<title>Events</title>
+
+<variablelist>
+ <varlistentry>
+ <term>CounterNotify</term>
+ <listitem>
+<literallayout class="monospaced">
+counter: COUNTER
+wait-value: INT64
+counter-value: INT64
+time: TIME
+count: CARD16
+destroyed: BOOL
+</literallayout>
+ <para>
+<function>CounterNotify</function> events may be generated when a client
+becomes unblocked after an <function>Await</function> request has been
+processed. The wait-value is the value being waited for, and counter-value
+is the actual value of the counter at the time the event was generated.
+The destroyed flag is TRUE if this request was generated as the result of
+the destruction of the counter and FALSE otherwise. The time is the server
+time at which the event was generated.
+ </para>
+ <para>
+When a client is unblocked, all the <function>CounterNotify</function>
+events for the Await request are generated contiguously. If count is 0,
+there are no more events to follow for this request. If count is n,
+there are at least n more events to follow.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>AlarmNotify</term>
+ <listitem>
+<literallayout class="monospaced">
+alarm: ALARM
+counter-value: INT64
+alarm-value: INT64
+state: ALARMSTATE
+time: TIME
+</literallayout>
+ <para>
+An <function>AlarmNotify</function> event is generated when an alarm is
+triggered. alarm-value is the test value of the trigger in the alarm when
+it was triggered, counter-value is the value of the counter that triggered
+the alarm, and time is the server time at which the event was generated.
+The state is the new state of the alarm. If state is
+<function>Inactive</function>, no more events will be generated by this
+alarm until a <function>ChangeAlarm</function> request is executed, the alarm
+is destroyed, or the counter for the alarm is destroyed.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</sect1>
+</chapter>
+
+<chapter id='Encoding'>
+<title>Encoding</title>
+<para>
+Please refer to the X11 Protocol Encoding document as this section uses
+syntactic conventions established there and references types defined there.
+</para>
+<para>The name of this extension is "SYNC".</para>
+
+<sect1 id='Encoding_New_Types'>
+<title>Encoding New Types</title>
+<para>
+The following new types are used by the extension.
+</para>
+
+<literallayout class="monospaced">
+ALARM: CARD32
+ALARMSTATE:
+ 0 Active
+ 1 Inactive
+ 2 Destroyed
+COUNTER: CARD32
+INT64: 64-bit signed integer
+SYSTEMCOUNTER:
+ 4 COUNTER counter
+ 8 INT64 resolution
+ 2 n length of name in bytes
+ n STRING8 name
+ p pad,p=pad(n+2)
+TESTTYPE:
+ 0 PositiveTransition
+ 1 NegativeTransition
+ 2 PositiveComparison
+ 3 NegativeComparison
+TRIGGER:
+ 4 COUNTER counter
+ 4 VALUETYPE wait-type
+ 8 INT64 wait-value
+ 4 TESTTYPE test-type VALUETYPE:
+ 0 Absolute
+ 1 Relative
+WAITCONDITION:
+ 20 TRIGGER trigger
+ 8 INT64 event threshold
+FENCE: CARD32
+</literallayout>
+
+<para>
+An INT64 is encoded in 8 bytes with the most significant 4 bytes
+first followed by the least significant 4 bytes. Within these 4-byte
+groups, the byte ordering determined during connection setup is used.
+</para>
+</sect1>
+
+<sect1 id='Encoding_Errors'>
+<title>Encoding Errors</title>
+<literallayout class="monospaced">
+<function>Counter</function>
+ 1 0 Error
+ 1 Base + 0 code
+ 2 CARD16 sequence number
+ 4 CARD32 bad counter
+ 2 CARD16 minor opcode
+ 1 CARD8 major opcode
+ 21 unused
+<function>Alarm</function>
+ 1 0 Error
+ 1 Base + 1 code
+ 2 CARD16 sequence number
+ 4 CARD32 bad alarm
+ 2 CARD16 minor opcode
+ 1 CARD8 major opcode
+ 21 unused
+<function>Fence</function>
+ 1 0 Error
+ 1 Base + 2 code
+ 2 CARD16 sequence number
+ 4 CARD32 bad fence
+ 2 CARD16 minor opcode
+ 1 CARD8 major opcode
+ 21 unused
+</literallayout>
+
+</sect1>
+
+<sect1 id='Encoding_Requests'>
+<title>Encoding Requests</title>
+
+<literallayout class="monospaced">
+<function>Initialize</function>
+ 1 CARD8 major opcode
+ 1 0 minor opcode
+ 2 2 request length
+ 1 CARD8 major version
+ 1 CARD8 minor version
+ 2 unused
+=>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 1 CARD8 major version
+ 1 CARD8 minor version
+ 2 unused
+ 20 unused
+
+<function>ListSystemCounters</function>
+ 1 CARD8 major opcode
+ 1 1 minor opcode
+ 2 1 request length
+=>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 INT32 list length
+ 20 unused
+ 4n list of SYSTEMCOUNTER system counters
+
+<function>CreateCounter</function>
+ 1 CARD8 major opcode
+ 1 2 minor opcode
+ 2 4 request length
+ 4 COUNTER id
+ 8 INT64 initial value
+
+<function>DestroyCounter</function>
+ 1 CARD8 major opcode
+ 1 6 minor opcode<footnote><para>A previous version of this document gave an incorrect minor opcode</para></footnote>
+ 2 2 request length
+ 4 COUNTER counter
+=>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 8 INT64 counter value
+ 16 unused
+
+Await
+ 1 CARD8 major opcode
+ 1 7 minor opcode<footnote><para>A previous version of this document gave an incorrect minor opcode.</para></footnote>
+ 2 1 + 7*n request length
+ 28n LISTofWAITCONDITION wait conditions
+
+ChangeCounter
+ 1 CARD8 major opcode
+ 1 4 minor opcode<footnote><para>A previous version of this document gave an incorrect minor opcode.</para></footnote>
+ 2 4 request length
+ 4 COUNTER counter
+ 8 INT64 amount
+
+SetCounter
+ 1 CARD8 major opcode
+ 1 3 minor opcode<footnote><para>A previous version of this document gave an incorrect minor opcode.</para></footnote>
+ 2 4 request length
+ 4 COUNTER counter
+ 8 INT64 value
+
+CreateAlarm
+ 1 CARD8 major opcode
+ 1 8 minor opcode
+ 2 3+n request length
+ 4 ALARM id
+ 4 BITMASK values mask
+
+ #x00000001 counter
+ #x00000002 value-type
+ #x00000004 value
+ #x00000008 test-type
+ #x00000010 delta
+ #x00000020 events
+
+ 4n LISTofVALUE values
+
+VALUES
+ 4 COUNTER counter
+ 4 VALUETYPE value-type
+ 8 INT64 value
+ 4 TESTTYPE test-type
+ 8 INT64 delta
+ 4 BOOL events
+
+ChangeAlarm
+ 1 CARD8 major opcode
+ 1 9 minor opcode
+ 2 3+n request length
+ 4 ALARM id
+ 4 BITMASK values mask
+ encodings as for <function>CreateAlarm</function>
+ 4n LISTofVALUE values
+ encodings as for <function>CreateAlarm</function>
+
+DestroyAlarm
+ 1 CARD8 major opcode
+ 1 11 minor opcode<footnote><para>A previous version of this document gave an incorrect minor opcode.</para></footnote>
+ 2 2 request length
+ 4 ALARM alarm
+
+QueryAlarm
+ 1 CARD8 major opcode
+ 1 10 minor opcode<footnote><para>A previous version of this document gave an incorrect minor opcode.</para></footnote>
+ 2 2 request length
+ 4 ALARM alarm
+=>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 2 reply length
+ 20 TRIGGER trigger
+ 8 INT64 delta
+ 1 BOOL events
+ 1 ALARMSTATE state
+ 2 unused
+
+SetPriority
+ 1 CARD8 major opcode
+ 1 12 minor opcode
+ 2 3 request length
+ 4 CARD32 id
+ 4 INT32 priority
+
+GetPriority
+ 1 CARD8 major opcode
+ 1 13 minor opcode
+ 2 1 request length
+ 4 CARD32 id
+=>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 4 INT32 priority
+ 20 unused
+
+CreateFence
+ 1 CARD8 major opcode
+ 1 14 minor opcode
+ 2 4 request length
+ 4 DRAWABLE drawable
+ 4 FENCE id
+ 1 BOOL initially triggered
+ 3 unused
+
+TriggerFence
+ 1 CARD8 major opcode
+ 1 15 minor opcode
+ 2 2 request length
+ 4 FENCE id
+
+ResetFence
+ 1 CARD8 major opcode
+ 1 16 minor opcode
+ 2 2 request length
+ 4 FENCE id
+
+DestroyFence
+ 1 CARD8 major opcode
+ 1 17 minor opcode
+ 2 2 request length
+ 4 FENCE id
+
+QueryFence
+ 1 CARD8 major opcode
+ 1 18 minor opcode
+ 2 2 request length
+ 4 FENCE id
+=>
+ 1 1 Reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 1 BOOL triggered
+ 23 unused
+
+AwaitFence
+ 1 CARD8 major opcode
+ 1 19 minor opcode
+ 2 1 + n request length
+ 4*n LISTofFENCE wait conditions
+
+</literallayout>
+
+</sect1>
+
+<sect1 id='Encoding_Events'>
+<title>Encoding Events</title>
+
+<literallayout class="monospaced">
+<function>CounterNotify</function>
+ 1 Base + 0 code
+ 1 0 kind
+ 2 CARD16 sequence number
+ 4 COUNTER counter
+ 8 INT64 wait value
+ 8 INT64 counter value
+ 4 TIME timestamp
+ 2 CARD16 count
+ 1 BOOL destroyed
+ 1 unused
+
+<function>AlarmNotify</function>
+ 1 Base + 1 code
+ 1 1 kind
+ 2 CARD16 sequence number
+ 4 ALARM alarm
+ 8 INT64 counter value
+ 8 INT64 alarm value
+ 4 TIME timestamp
+ 1 ALARMSTATE state
+ 3 unused
+</literallayout>
+</sect1>
+</chapter>
+</book>
diff --git a/specs/tog-cup.xml b/specs/tog-cup.xml
new file mode 100644
index 0000000..a35ff8c
--- /dev/null
+++ b/specs/tog-cup.xml
@@ -0,0 +1,564 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+
+
+<book id="tog-cup">
+
+<bookinfo>
+ <title>Colormap Utilization Policy and Extension</title>
+ <subtitle>X Project Team Standard</subtitle>
+ <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
+ <releaseinfo>Version 1.0</releaseinfo>
+ <authorgroup>
+ <author>
+ <firstname>Kaleb</firstname>
+ <othername>S.</othername>
+ <surname>Keithley</surname>
+ <affiliation><orgname>The Open Group</orgname></affiliation>
+ </author>
+ </authorgroup>
+ <copyright><year>1986-1997</year><holder>The Open Group</holder></copyright>
+
+<legalnotice>
+
+<para>
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this
+software and associated documentation files (the Software), to use the
+Software
+without restriction, including, without limitation, the rights to copy,
+modify, merge,
+publish, distribute and sublicense the Software, to make, have made,
+license and
+distribute derivative works thereof, 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 the following permission notice shall be
+included in all copies 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 NON-
+INFRINGEMENT. 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
+CONNNECTION WITH THE SOFTWARE OR THE USE OF OTHER DEALINGS IN
+THE SOFTWARE.
+</para>
+<para>
+Except as contained in this notice, the name of The Open Group shall not be
+used in
+advertising or otherwise to promote the use or other dealings in this
+Software without prior written authorization from The Open Group.
+</para>
+<para>
+X Window System is a trademark of The Open Group.
+</para>
+
+</legalnotice>
+</bookinfo>
+
+<chapter id="Overview">
+<title>Overview</title>
+<para>
+This extension has three purposes: a) to provide mechanism for a special
+application (a colormap manager) to discover any special colormap
+requirements, e.g. the colormap entries that are nominally reserved for
+desktop colors in the MS-Windows environment and initialize the default
+colormap so that it can be more easily shared; and b) to encourage colormap
+sharing and reduce colormap flashing on low-end 8-bit frame buffers by
+providing a policy for sharing; and c) when colormaps aren't shared,
+define a behavior in the X server color allocation scheme to reduce
+colormap flashing.
+</para>
+
+<para>
+To encourage colormap sharing and accomodate special colormap requirements
+two new protocols are defined: the first provides a way to query the
+server for a list of reserved colormap entries, and the second is a way
+to initialize read-only (shareable) colormap entries at specific locations
+in a colormap.
+</para>
+
+<para>
+To minimize colormap flashing when the root window's default visual is one
+of GrayScale, PseudoColor, or DirectColor, and a private colormap for the
+default visual is being used, a minor (but compatible) change to the
+server implementation of the AllocColor and AllocNamedColor requests is
+required. Where the core protocol says nothing about the pixel values
+returned, when this extension is in effect, the AllocColor and AllocNamedColor
+requests will first look for a matching color in the default colormap, and,
+if a match is found and the same cell in the private colormap has not
+already been allocated, the color will be allocated in the private colormap
+at the same locaton as in the default colormap (instead of in the first
+available location.)
+</para>
+</chapter>
+
+<chapter id="Requests">
+<title>Requests</title>
+<para>
+<function>QueryVersion</function>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+client_major_version: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+client_minor_version: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+=&gt;
+ </entry>
+ </row>
+ <row>
+ <entry>
+server_major_version: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+server_minor_version: CARD16
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+If supplied, the client_major_version and client_minor_version indicate
+what version of the protocol the client wants the server to implement.
+The server version numbers returned indicate the protocol this extension
+actually supports. This might not equal the version sent by the client.
+An implementation can (but need not) support more than one version
+simultaneously. The server_major_version and the server_minor_version
+are a mechanism to support future revisions of the TOG-CUP protocol that
+may be necessary. In general, the major version would increment for
+incompatible changes, and the minor version would increment for small
+upward-compatible changes. Servers that support the protocol defined in
+this document will return a server_major_version of one (1), and a
+server_minor_version of zero (0).
+</para>
+
+<para>
+<function>GetReservedColormapEntries</function>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+screen: CARD32
+ </entry>
+ </row>
+ <row>
+ <entry>
+=&gt;
+ </entry>
+ </row>
+ <row>
+ <entry>
+entries: LISTofCOLORITEM
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request returns a list of colormap entries (pixels) that are reserved
+by the system, e.g. MS-Windows reserved desktop colors. This list will, at a
+minimum, contain entries for the BlackPixel and WhitePixel of the specified
+screen. The do-red, do-green, and do-blue elements of the COLORITEMs are
+unused in this reply.
+</para>
+
+<para>
+Rationale: There are colormap entries (pixels) that, e.g., MS-Windows
+desktop reserves as desktop colors, that should not be altered. If they
+are altered then X programs will cause colormap flashing between X and
+MS-Windows applications running/displaying on the same desktop.
+</para>
+
+<para>
+<function>StoreColors</function>
+</para>
+
+<informaltable frame="none">
+ <?dbfo keep-together="always" ?>
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+cmap: COLORMAP
+ </entry>
+ </row>
+ <row>
+ <entry>
+items: LISTofCOLORITEM
+ </entry>
+ </row>
+ <row>
+ <entry>
+=&gt;
+ </entry>
+ </row>
+ <row>
+ <entry>
+items: LISTofCOLORITEM
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request changes the colormap entries of the specified pixels. The
+colormap entries are allocated as if by an AllocColor request. The do-red,
+do-green, and do-blue elements of the COLORITEMs are unused in this request.
+A boolean alloc-ok element (a bit) is returned indicating whether the
+particular pixel was successfully allocated or not. If successfully
+allocated the RGB and pixel are returned.
+</para>
+
+<para>
+A Value error is generated if a pixel is not a valid index into cmap. A
+BadMatch error is generated if if cmap does not belong to a GrayScale,
+PseudoColor, or DirectColor visual.
+</para>
+
+</chapter>
+
+<chapter id="Events_and_Errors">
+<title>Events and Errors</title>
+<para>
+No new events or errors are defined by this extension.
+</para>
+
+</chapter>
+<chapter id='Changes_to_existing_protocol'>
+<title>Changes to existing protocol.</title>
+<para>
+None.
+</para>
+</chapter>
+
+<chapter id="Encoding">
+<title>Encoding</title>
+<para>
+The name of this extension is "TOG-CUP".
+</para>
+
+<para>
+The conventions used here are the same as those for the core X11
+Protocol Encoding.
+</para>
+
+<literallayout class="monospaced">
+<function>QueryVersion</function>
+ 1 CARD8 opcode
+ 1 0 TOG-CUP opcode
+ 2 2 request length
+ 2 CARD16 client_major_version
+ 2 CARD16 client_minor_version
+=&gt;
+ 1 1 reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 0 length
+ 2 CARD16 server_major_version
+ 2 CARD16 server_minor_number
+ 20 unused
+</literallayout>
+
+<literallayout class="monospaced">
+<function>GetReservedColormapEntries</function>
+ 1 CARD8 opcode
+ 1 1 TOG-CUP opcode
+ 2 2 request length
+ 4 CARD32 screen
+=&gt;
+ 1 1 reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 3n length
+ 24 unused
+ 12n LISTofCOLORITEM items
+</literallayout>
+
+<literallayout class="monospaced">
+<function>StoreColors</function>
+ 1 CARD8 opcode
+ 1 2 TOG-CUP opcode
+ 2 2+3n request length
+ 4 COLORMAP cmap
+ 12n LISTofCOLORITEM items
+=&gt;
+ 1 1 reply
+ 1 unused
+ 2 CARD16 sequence number
+ 4 3n length
+ 24 unused
+ 12n LISTofCOLORITEM items
+</literallayout>
+
+<para>
+(The definition of COLORITEM here is only for the purpose of defining the
+additional alloc-ok member in the CUPStoreColors reply.)
+</para>
+
+<literallayout class="monospaced">
+ COLORITEM
+ 4 CARD32 pixel
+ 2 CARD16 red
+ 2 CARD16 green
+ 2 CARD16 blue
+ 1 alloc-ok
+ #x07 unused
+ #x08 alloc-ok (1 is True, 0 is False)
+ #xF0 unused
+ 1 unused
+</literallayout>
+</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. For complete details on the effects of these functions, refer
+to the appropriate protocol request, which can be derived by deleting XCup
+at the start of the function. All functions that have return type Status
+will return nonzero for success and zero for failure.
+</para>
+
+<para>
+The include file for this extension is
+<function>&lt;X11/extensions/Xcup.h&gt;</function>.
+</para>
+
+<funcsynopsis id='XCupQueryVersion'>
+<funcprototype>
+ <funcdef>Status <function> XCupQueryVersion</function></funcdef>
+ <paramdef>Display*<parameter> display</parameter></paramdef>
+ <paramdef>int*<parameter> major_version_return</parameter></paramdef>
+ <paramdef>int*<parameter> minor_version_return</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>major_version_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the major version supported by the server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>minor_version_return</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the minor version supported by the server.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+
+<para>
+XCupQueryVersions sets major_version_return and 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 dpy does not support the TOG-CUP 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
+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.
+</para>
+
+<para>
+To get the list of reserved colormap entries, use
+XCupGetReservedColormapEntries.
+</para>
+
+<funcsynopsis id='XCupGetReservedColormapEntries'>
+<funcprototype>
+ <funcdef>Status <function> XCupGetReservedColormapEntries</function></funcdef>
+ <paramdef>Display*<parameter> display</parameter></paramdef>
+ <paramdef>int<parameter> screen</parameter></paramdef>
+ <paramdef>XColor**<parameter> colors_out</parameter></paramdef>
+ <paramdef>int*<parameter> ncolors</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>colors_out</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the values reserved by the server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>ncolors</emphasis>
+ </term>
+ <listitem>
+ <para>
+Returns the number of items in colors_out.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+The XCupGetReservedColormapEntries function gets system specific colormap
+entries. E.g. the MS-Windows desktop uses N colormap entries at the beginning
+(0..N) and end (256-N..255) of the colormap. Use XFree to free colors_out.
+</para>
+
+<para>
+To allocate one or more read-only color cells with RGB values, use
+XCupStoreColors.
+</para>
+
+<funcsynopsis id='XCupStoreColors'>
+<funcprototype>
+ <funcdef>Status <function> XCupStoreColors</function></funcdef>
+ <paramdef>Display*<parameter> display</parameter></paramdef>
+ <paramdef>Colormap<parameter> colormap</parameter></paramdef>
+ <paramdef>XColor*<parameter> colors_in_out</parameter></paramdef>
+ <paramdef>int<parameter> ncolors</parameter></paramdef>
+</funcprototype>
+</funcsynopsis>
+
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>display</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the connection to the X server.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>colormap</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the colormap.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>colors_in_out</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies and returns the values actually used in the colormap.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>ncolors</emphasis>
+ </term>
+ <listitem>
+ <para>
+Specifies the number of items in colors_in_out.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+The XCupStoreColors function changes the colormap entries of the pixel
+values specified in the pixel members of the XColor structures. The colormap
+entries are allocated as if an AllocColor had been used instead, i.e. the
+colors are read-only (shareable). XCupStoreColors returns the number of
+colors that were successfully allocated in the colormap.
+</para>
+
+</chapter>
+
+<chapter id="Using_the_TOG_CUP_extension_and_Colormap_Utilization_Policy">
+<title>Using the TOG-CUP extension and Colormap Utilization Policy</title>
+<para>
+The X server preallocates any hardware or desktop special colors in the
+default colormap; e.g. UNIX X servers preallocate Black and White pixels.
+PC X servers should also preallocate the MS-Windows desktop colors. (Note
+to implementors: in the Sample Implementation special colors are allocated
+in the default colormap in cfbCreateDefColormap for dumb memory framebuffers.)
+</para>
+
+<para>
+To minimize colormap flash an application which installs its own private
+colormap should query the special colors by calling
+XCupGetReservedColormapEntries, and can then store those entries (in the
+proper location) in its private colormap using XCupStoreColors.
+</para>
+
+<para>
+Applications which allocate many colors in a screen's default colormap, e.g.
+a color-cube or a gray-ramp, should allocate them with 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.
+</para>
+</chapter>
+
+</book>
diff --git a/specs/xtest.xml b/specs/xtest.xml
new file mode 100644
index 0000000..4893b88
--- /dev/null
+++ b/specs/xtest.xml
@@ -0,0 +1,723 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+[
+<!ENTITY % defs SYSTEM "defs.ent"> %defs;
+]>
+
+<book id="xtest">
+
+<bookinfo>
+ <title>XTEST Extension Protocol</title>
+ <subtitle>X Consortium Standard</subtitle>
+ <authorgroup>
+ <author>
+ <firstname>Kieron</firstname><surname>Drake</surname>
+ <affiliation><orgname>UniSoft Ltd.</orgname></affiliation>
+ </author>
+ </authorgroup>
+ <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
+ <releaseinfo>Version 2.2</releaseinfo>
+ <copyright><year>1992</year><holder>UniSoft Group Ltd.</holder></copyright>
+ <copyright><year>1992</year><year>1994</year><holder>X Consortium</holder></copyright>
+
+<legalnotice>
+<para>
+Permission to use, copy, modify, and distribute this documentation for any
+purpose and without fee is hereby granted, provided that the above copyright
+notice and this permission notice appear in all copies. UniSoft makes no
+representations about the suitability for any purpose of the information in
+this document. This documentation is provided "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 &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 is a minimal set of client and server extensions
+required to completely test the X11 server with no user intervention.
+</para>
+
+<para>
+This extension is not intended to support general journaling and
+playback of user actions. This is a difficult area [XTrap, 89] as it attempts
+to synchronize synthetic user interactions with their effects; it is at the
+higher level of dialogue recording/playback rather than at the strictly lexical
+level. We are interested only in the latter, simpler, case. A more detailed
+discussion and justification of the extension functionality is given in
+[Drake, 91].
+</para>
+
+<para>
+We are aiming only to provide a minimum set of facilities that
+solve immediate testing and validation problems. The testing extension
+itself needs testing, where possible, and so should be as simple as possible.
+</para>
+
+<para>
+We have also tried to:
+</para>
+
+<itemizedlist>
+ <listitem>
+ <para>
+Confine the extension to an appropriate high level within the server
+to minimize portability problems. In practice this means that the extension
+should be at the DIX level or use the DIX/DDX interface, or both. This
+has effects, in particular, on the level at which "input synthesis"
+can occur.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Minimize the changes required in the rest of the server.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Minimize performance penalties on normal server operation.
+ </para>
+ </listitem>
+</itemizedlist>
+</chapter>
+
+<chapter id="Description">
+<title>Description</title>
+<para>
+The functions provided by this extension fall into two groups:
+</para>
+
+<variablelist>
+ <varlistentry>
+ <term>Client Operations</term>
+ <listitem>
+ <para>
+These routines manipulate otherwise hidden client-side behavior. The
+actual implementation will depend on the details of the actual language
+binding and what degree of request buffering, GContext caching, and so on, is
+provided.
+In the C binding, defined in "XTEST Extension Library", routines are
+provided to access the internals of two opaque data structures
+-- <function>GC</function>s
+and
+<function>Visual</function>s --
+and to discard any requests pending within the
+output buffer of a connection. The exact details can be expected to differ for
+other language bindings.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Server Requests</term>
+ <listitem>
+ <para>
+The first of these requests is similar to that provided in most
+extensions: it allows a client to specify a major and minor version
+number to the server and for the server to respond with major and minor
+versions of its own. The remaining two requests allow the following:
+<!-- .RS -->
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>
+Access to an otherwise "write-only" server resource: the cursor
+associated with a given window
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+Perhaps most importantly, limited synthesis of input device events,
+almost as if a cooperative user had moved the pointing device
+or pressed a key or button.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+</chapter>
+
+<chapter id="Types">
+<title>Types</title>
+<para>
+The following types are used in the request and event definitions in
+subsequent sections:
+</para>
+
+<informaltable frame="none">
+ <tgroup cols='2' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <colspec colname='c2' colwidth="3.0*"/>
+ <tbody>
+ <row>
+ <entry namest="c1" nameend="c2">
+FAKE_EVENT_TYPE
+{ <function>KeyPress</function>,
+<function>KeyRelease</function>,
+<function>MotionNotify</function>,
+<function>ButtonPress</function>,
+<function>ButtonRelease</function> }
+ </entry>
+ </row>
+ <row>
+ <entry></entry>
+ </row>
+ <row>
+ <entry>FAKE_EVENT</entry>
+ <entry>[type: FAKE_EVENT_TYPE,</entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry>detail: BYTE,</entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry>time: TIME,</entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry>root: WINDOW,</entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry>rootX, rootY: INT16]</entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+CURSOR { <function>CurrentCursor</function>, <function> None</function> }
+or a cursor as defined by the X11 Protocol.
+</para>
+
+</chapter>
+
+<chapter id="Client_Operations">
+<title>Client Operations</title>
+
+<para>
+These are abstract definitions of functionality. They refer to client-side
+objects such as "GC" and "VISUAL" that are quoted to
+denote their abstract nature. Concrete versions of these functions are
+defined only for particular language bindings. In some circumstances
+a particular language binding may not implement the relevant abstract
+type or may provide it as a transparent, rather than opaque, type, with
+the result that the corresponding function does not make sense or is
+not required, respectively.
+</para>
+
+<para>
+<olink targetdoc='xtestlib' targetptr='XTestSetGContextOfGC'><function>XTestSetGContextOfGC</function></olink>
+</para>
+
+<informaltable frame="none">
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>gc</emphasis>: "GC"
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>gid</emphasis>: GCONTEXT
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+Sets the GCONTEXT within the "GC" gc to have
+the value specified by gid.
+</para>
+
+<para>
+<olink targetdoc='xtestlib' targetptr='XTestSetVisualIDOfVisual'><function>XTestSetVisualIDOfVisual</function></olink>
+</para>
+
+<informaltable frame="none">
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>visual</emphasis>: "VISUAL"
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>visualid</emphasis>: VISUALID
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+Sets the VISUALID within the "VISUAL" visual to have
+the value specified by visualid.
+</para>
+
+<para>
+<olink targetdoc='xtestlib' targetptr='XTestDiscard'><function>XTestDiscard</function></olink>
+</para>
+
+<informaltable frame="none">
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>dpy</emphasis>: "CONNECTION"
+ </entry>
+ </row>
+ <row>
+ <entry>
+=&gt;
+ </entry>
+ </row>
+ <row>
+ <entry>
+status: BOOL
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+Discards any requests that are present in the request buffer associated with
+the "CONNECTION" dpy.
+The status returned is
+<function>True</function>
+if there were one or more requests
+in the buffer and
+<function>False</function>
+otherwise.
+</para>
+</chapter>
+
+<chapter id="Server_Requests">
+<title>Server Requests</title>
+<para>
+<function>XTestGetVersion</function>
+</para>
+
+<informaltable frame="none">
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>clientMajorVersion</emphasis>: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>clientMinorVersion</emphasis>: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+ =&gt;
+ </entry>
+ </row>
+ <row>
+ <entry>
+serverMajorVersion: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+serverMinorVersion: CARD16
+ </entry>
+ </row>
+ <row>
+ <entry>
+Errors: <function>Length</function>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+
+<para>
+This request can be used to ensure that the server version of the XTEST
+extension is usable by the client. This document defines major version two
+(2), minor version one (1).
+</para>
+
+<para>
+<function>XTestCompareCursor</function>
+</para>
+
+<informaltable frame="none">
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>window</emphasis>: WINDOW
+ </entry>
+ </row>
+ <row>
+ <entry>
+<emphasis remap='I'>cursor-id</emphasis>: CURSOR or
+<function>CurrentCursor</function>
+or
+<function>None</function>
+ </entry>
+ </row>
+ <row>
+ <entry>
+=&gt;
+ </entry>
+ </row>
+ <row>
+ <entry>
+same: BOOL
+ </entry>
+ </row>
+ <row>
+ <entry>
+Errors:
+<function>Window</function>,
+<function>Length</function>,
+<function>Cursor</function>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request looks up the cursor associated with the window and
+compares it with either the null cursor if cursor-id is
+<function>None ,</function>
+or the current cursor (that is, the one being displayed),
+or the cursor whose ID is cursor-id, and returns
+the result of the comparison in same.
+</para>
+
+<para>
+<function>XTestFakeInput</function>
+</para>
+
+<informaltable frame="none">
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>events</emphasis>: LISTofFAKE_EVENT
+ </entry>
+ </row>
+ <row>
+ <entry>
+Errors:
+<function>Window</function>,
+<function>Length</function>,
+<function>Alloc</function>,
+<function>Value</function>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+This request simulates the limited set of core protocol
+events within the set FAKE_EVENT_TYPE. Only the following event fields,
+defined in FAKE_EVENT, are interpreted:
+</para>
+
+<variablelist>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>type</emphasis>
+ </term>
+ <listitem>
+ <para>
+This must be one of
+<function>KeyPress</function>,
+<function>KeyRelease</function>,
+<function>MotionNotify</function>,
+<function>ButtonPress</function>,
+or
+<function>ButtonRelease</function>,
+or else a
+<function>Value</function>
+error occurs.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>detail</emphasis>
+ </term>
+ <listitem>
+ <para>
+For key events, this field is interpreted as the physical keycode.
+If the keycode is less than min-keycode or greater than max-keycode,
+as returned in the connection setup, then a
+<function>Value</function>
+error occurs.
+For button events, this field is interpreted as the physical (or core) button,
+meaning it will be mapped to the corresponding logical button according to
+the most recent
+<function>SetPointerMapping</function>
+request.
+If the button number is less than one or greater than the number of physical
+buttons, then a
+<function>Value</function>
+error occurs.
+For motion events, if this field is
+<function>True ,</function>
+then rootX and rootY
+are relative distances from the current pointer location; if this field is
+<function>False,</function>
+then they are absolute positions.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>time</emphasis>
+ </term>
+ <listitem>
+ <para>
+This is either
+<function>CurrentTime</function>
+(meaning no delay)
+or the delay in milliseconds that the server should wait before
+simulating this event. No other requests from this client will be
+processed until this delay, if any, has expired and subsequent processing
+of the simulated event has been completed.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>root</emphasis>
+ </term>
+ <listitem>
+ <para>
+In the case of motion events this field is the ID of the root window on
+which the new motion is to take place. If
+<function>None</function>
+is specified, the root window of the screen the pointer is currently on
+is used instead.
+If this field is not a valid window, then a
+<function>Window</function>
+error occurs.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <emphasis remap='I'>rootX</emphasis> &amp;
+ <emphasis remap='I'>rootY</emphasis>
+ </term>
+ <listitem>
+ <para>
+In the case of motion events these fields indicate relative distance or
+absolute pointer coordinates, according to the setting of detail.
+If the specified coordinates are off-screen, the closest on-screen
+coordinates will be substituted.
+ </para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+
+<para>
+When the simulated event(s) are processed, they cause event propagation,
+passive grab activation, and so on, just as if the corresponding input device
+action had occurred. However, motion events might not be recorded in the
+motion history buffer.
+</para>
+
+<para>
+For the currently supported event types, the event list must have length one,
+otherwise a
+<function>BadLength</function>
+error occurs.
+</para>
+
+<para>
+<olink targetdoc='xtestlib' targetptr='XTestGrabControl'><function>XTestGrabControl</function></olink>
+</para>
+
+<informaltable frame="none">
+ <tgroup cols='1' align='left' colsep='0' rowsep='0'>
+ <colspec colname='c1' colwidth="1.0*"/>
+ <tbody>
+ <row>
+ <entry>
+<emphasis remap='I'>impervious</emphasis>: BOOL
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+</informaltable>
+
+<para>
+If impervious is
+<function>True</function>,
+then the executing client becomes impervious to server grabs;
+that is, it can continue executing requests even if another client
+grabs the server.
+If impervious is
+<function>False</function>,
+then the executing client returns to the normal state of being
+susceptible to server grabs.
+</para>
+</chapter>
+
+<chapter id="Encoding">
+<title>Encoding</title>
+<para>
+Please refer to the X11 Protocol Encoding document as this document uses
+conventions established there.
+</para>
+
+<para>
+The name of this extension is "XTEST".
+</para>
+
+<sect1 id="New_Types">
+<title>New Types</title>
+<literallayout class="monospaced">
+FAKE_EVENT_TYPE
+ 2 KeyPress
+ 3 KeyRelease
+ 4 ButtonPress
+ 5 ButtonRelease
+ 6 MotionNotify
+</literallayout>
+
+<para>
+NOTE that the above values are defined to be the same as those for
+the corresponding core protocol event types.
+</para>
+</sect1>
+
+<sect1 id="Requests">
+<title>Requests</title>
+
+<literallayout class="monospaced">
+<function>XTestGetVersion</function>
+ 1 CARD8 opcode
+ 1 0 xtest opcode
+ 2 2 request length
+ 1 CARD8 client major version
+ 1 unused
+ 2 CARD16 client minor version
+=&gt;
+ 1 1 Reply
+ 1 CARD8 server major version
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 2 CARD16 server minor version
+ 22 unused
+</literallayout>
+
+<literallayout class="monospaced">
+<function>XTestCompareCursor</function>
+ 1 CARD8 opcode
+ 1 1 xtest opcode
+ 2 3 request length
+ 4 WINDOW window
+ 4 CURSOR cursor-id
+ 0 None
+ 1 CurrentCursor
+=&gt;
+ 1 1 Reply
+ 1 BOOL cursors are the same
+ 2 CARD16 sequence number
+ 4 0 reply length
+ 24 unused
+</literallayout>
+
+<literallayout class="monospaced">
+<function>XTestFakeInput</function>
+ 1 CARD8 opcode
+ 1 2 xtest opcode
+ 2 1+(1*8) request length
+ 1 FAKE_EVENT_TYPE fake device event type
+ 1 BYTE detail: button or keycode
+ 2 unused
+ 4 TIME delay (milliseconds)
+ 0 CurrentTime
+ 4 WINDOW root window for MotionNotify
+ 0 None
+ 8 unused
+ 2 INT16 x position for MotionNotify
+ 2 INT16 y position for MotionNotify
+ 8 unused
+</literallayout>
+
+<literallayout class="monospaced">
+<olink targetdoc='xtestlib' targetptr='XTestGrabControl'><function>XTestGrabControl</function></olink>
+ 1 CARD8 opcode
+ 1 3 xtest opcode
+ 2 2 request length
+ 1 BOOL impervious
+ 3 unused
+</literallayout>
+</sect1>
+</chapter>
+
+<chapter id="References">
+<title>References</title>
+<para>
+Annicchiarico, D., et al.,
+<emphasis remap='I'>XTrap: The XTrap Architecture</emphasis>.
+Digital Equipment Corporation, July 1991.
+</para>
+
+<para>
+Drake, K. J.,
+<emphasis remap='I'>Some Proposals for a
+Minimum X11 Testing Extension</emphasis>.
+UniSoft Ltd., June 1991.
+</para>
+</chapter>
+
+</book>
diff --git a/syncconst.h b/syncconst.h
new file mode 100644
index 0000000..3acc387
--- /dev/null
+++ b/syncconst.h
@@ -0,0 +1,181 @@
+/*
+
+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 _SYNCCONST_H_
+#define _SYNCCONST_H_
+
+#define SYNC_NAME "SYNC"
+
+#define SYNC_MAJOR_VERSION 3
+#define SYNC_MINOR_VERSION 1
+
+
+#define XSyncCounterNotify 0
+#define XSyncAlarmNotify 1
+#define XSyncAlarmNotifyMask (1L << XSyncAlarmNotify)
+
+#define XSyncNumberEvents 2L
+
+#define XSyncBadCounter 0L
+#define XSyncBadAlarm 1L
+#define XSyncBadFence 2L
+#define XSyncNumberErrors (XSyncBadFence + 1)
+
+/*
+ * Flags for Alarm Attributes
+ */
+#define XSyncCACounter (1L<<0)
+#define XSyncCAValueType (1L<<1)
+#define XSyncCAValue (1L<<2)
+#define XSyncCATestType (1L<<3)
+#define XSyncCADelta (1L<<4)
+#define XSyncCAEvents (1L<<5)
+
+/* The _XSync macros below are for library internal use only. They exist
+ * so that if we have to make a fix, we can change it in this one place
+ * and have both the macro and function variants inherit the fix.
+ */
+
+#define _XSyncIntToValue(pv, i) ((pv)->hi=((i<0)?~0:0),(pv)->lo=(i))
+#define _XSyncIntsToValue(pv, l, h) ((pv)->lo = (l), (pv)->hi = (h))
+#define _XSyncValueGreaterThan(a, b)\
+ ((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>(b).lo))
+#define _XSyncValueLessThan(a, b)\
+ ((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<(b).lo))
+#define _XSyncValueGreaterOrEqual(a, b)\
+ ((a).hi>(b).hi || ((a).hi==(b).hi && (a).lo>=(b).lo))
+#define _XSyncValueLessOrEqual(a, b)\
+ ((a).hi<(b).hi || ((a).hi==(b).hi && (a).lo<=(b).lo))
+#define _XSyncValueEqual(a, b) ((a).lo==(b).lo && (a).hi==(b).hi)
+#define _XSyncValueIsNegative(v) (((v).hi & 0x80000000) ? 1 : 0)
+#define _XSyncValueIsZero(a) ((a).lo==0 && (a).hi==0)
+#define _XSyncValueIsPositive(v) (((v).hi & 0x80000000) ? 0 : 1)
+#define _XSyncValueLow32(v) ((v).lo)
+#define _XSyncValueHigh32(v) ((v).hi)
+#define _XSyncValueAdd(presult,a,b,poverflow) {\
+ int t = (a).lo;\
+ Bool signa = XSyncValueIsNegative(a);\
+ Bool signb = XSyncValueIsNegative(b);\
+ ((presult)->lo = (a).lo + (b).lo);\
+ ((presult)->hi = (a).hi + (b).hi);\
+ if (t>(presult)->lo) (presult)->hi++;\
+ *poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\
+ }
+#define _XSyncValueSubtract(presult,a,b,poverflow) {\
+ int t = (a).lo;\
+ Bool signa = XSyncValueIsNegative(a);\
+ Bool signb = XSyncValueIsNegative(b);\
+ ((presult)->lo = (a).lo - (b).lo);\
+ ((presult)->hi = (a).hi - (b).hi);\
+ if (t<(presult)->lo) (presult)->hi--;\
+ *poverflow = ((signa == signb) && !(signa == XSyncValueIsNegative(*presult)));\
+ }
+#define _XSyncMaxValue(pv) ((pv)->hi = 0x7fffffff, (pv)->lo = 0xffffffff)
+#define _XSyncMinValue(pv) ((pv)->hi = 0x80000000, (pv)->lo = 0)
+
+/*
+ * These are the publically usable macros. If you want the function version
+ * of one of these, just #undef the macro to uncover the function.
+ * (This is the same convention that the ANSI C library uses.)
+ */
+
+#define XSyncIntToValue(pv, i) _XSyncIntToValue(pv, i)
+#define XSyncIntsToValue(pv, l, h) _XSyncIntsToValue(pv, l, h)
+#define XSyncValueGreaterThan(a, b) _XSyncValueGreaterThan(a, b)
+#define XSyncValueLessThan(a, b) _XSyncValueLessThan(a, b)
+#define XSyncValueGreaterOrEqual(a, b) _XSyncValueGreaterOrEqual(a, b)
+#define XSyncValueLessOrEqual(a, b) _XSyncValueLessOrEqual(a, b)
+#define XSyncValueEqual(a, b) _XSyncValueEqual(a, b)
+#define XSyncValueIsNegative(v) _XSyncValueIsNegative(v)
+#define XSyncValueIsZero(a) _XSyncValueIsZero(a)
+#define XSyncValueIsPositive(v) _XSyncValueIsPositive(v)
+#define XSyncValueLow32(v) _XSyncValueLow32(v)
+#define XSyncValueHigh32(v) _XSyncValueHigh32(v)
+#define XSyncValueAdd(presult,a,b,poverflow) _XSyncValueAdd(presult,a,b,poverflow)
+#define XSyncValueSubtract(presult,a,b,poverflow) _XSyncValueSubtract(presult,a,b,poverflow)
+#define XSyncMaxValue(pv) _XSyncMaxValue(pv)
+#define XSyncMinValue(pv) _XSyncMinValue(pv)
+
+/*
+ * Constants for the value_type argument of various requests
+ */
+typedef enum {
+ XSyncAbsolute,
+ XSyncRelative
+} XSyncValueType;
+
+/*
+ * Alarm Test types
+ */
+typedef enum {
+ XSyncPositiveTransition,
+ XSyncNegativeTransition,
+ XSyncPositiveComparison,
+ XSyncNegativeComparison
+} XSyncTestType;
+
+/*
+ * Alarm state constants
+ */
+typedef enum {
+ XSyncAlarmActive,
+ XSyncAlarmInactive,
+ XSyncAlarmDestroyed
+} XSyncAlarmState;
+
+
+typedef XID XSyncCounter;
+typedef XID XSyncAlarm;
+typedef XID XSyncFence;
+typedef struct _XSyncValue {
+ int hi;
+ unsigned int lo;
+} XSyncValue;
+#endif /* _SYNCCONST_H_ */
diff --git a/syncproto.h b/syncproto.h
new file mode 100644
index 0000000..1453e44
--- /dev/null
+++ b/syncproto.h
@@ -0,0 +1,474 @@
+/*
+
+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 _SYNCPROTO_H_
+#define _SYNCPROTO_H_
+
+#include <X11/extensions/syncconst.h>
+
+#define X_SyncInitialize 0
+#define X_SyncListSystemCounters 1
+#define X_SyncCreateCounter 2
+#define X_SyncSetCounter 3
+#define X_SyncChangeCounter 4
+#define X_SyncQueryCounter 5
+#define X_SyncDestroyCounter 6
+#define X_SyncAwait 7
+#define X_SyncCreateAlarm 8
+#define X_SyncChangeAlarm 9
+#define X_SyncQueryAlarm 10
+#define X_SyncDestroyAlarm 11
+#define X_SyncSetPriority 12
+#define X_SyncGetPriority 13
+#define X_SyncCreateFence 14
+#define X_SyncTriggerFence 15
+#define X_SyncResetFence 16
+#define X_SyncDestroyFence 17
+#define X_SyncQueryFence 18
+#define X_SyncAwaitFence 19
+
+/* cover up types from sync.h to make sure they're the right size for
+ * protocol packaging. These will be undef'ed after all the protocol
+ * structures are defined.
+ */
+#define XSyncCounter CARD32
+#define XSyncAlarm CARD32
+#define XSyncFence CARD32
+#define Drawable CARD32
+
+/*
+ * Initialize
+ */
+typedef struct _xSyncInitialize {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ CARD8 majorVersion;
+ CARD8 minorVersion;
+ CARD16 pad B16;
+} xSyncInitializeReq;
+#define sz_xSyncInitializeReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 unused;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD8 majorVersion;
+ CARD8 minorVersion;
+ CARD16 pad B16;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+} xSyncInitializeReply;
+#define sz_xSyncInitializeReply 32
+
+/*
+ * ListSystemCounters
+ */
+typedef struct _xSyncListSystemCounters
+{
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+} xSyncListSystemCountersReq;
+#define sz_xSyncListSystemCountersReq 4
+
+typedef struct {
+ BYTE type;
+ CARD8 unused;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ INT32 nCounters B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+} xSyncListSystemCountersReply;
+#define sz_xSyncListSystemCountersReply 32
+
+typedef struct {
+ XSyncCounter counter B32;
+ INT32 resolution_hi B32;
+ CARD32 resolution_lo B32;
+ CARD16 name_length B16;
+} xSyncSystemCounter;
+#define sz_xSyncSystemCounter 14
+
+/*
+ * Create Counter
+ */
+typedef struct _xSyncCreateCounterReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ XSyncCounter cid B32;
+ INT32 initial_value_hi B32;
+ CARD32 initial_value_lo B32;
+} xSyncCreateCounterReq;
+#define sz_xSyncCreateCounterReq 16
+
+/*
+ * Change Counter
+ */
+typedef struct _xSyncChangeCounterReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ XSyncCounter cid B32;
+ INT32 value_hi B32;
+ CARD32 value_lo B32;
+} xSyncChangeCounterReq;
+#define sz_xSyncChangeCounterReq 16
+
+/*
+ * Set Counter
+ */
+typedef struct _xSyncSetCounterReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ XSyncCounter cid B32;
+ INT32 value_hi B32;
+ CARD32 value_lo B32;
+} xSyncSetCounterReq;
+#define sz_xSyncSetCounterReq 16
+
+/*
+ * Destroy Counter
+ */
+typedef struct _xSyncDestroyCounterReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ XSyncCounter counter B32;
+} xSyncDestroyCounterReq;
+#define sz_xSyncDestroyCounterReq 8
+
+/*
+ * Query Counter
+ */
+typedef struct _xSyncQueryCounterReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ XSyncCounter counter B32;
+} xSyncQueryCounterReq;
+#define sz_xSyncQueryCounterReq 8
+
+
+typedef struct {
+ BYTE type;
+ CARD8 unused;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ INT32 value_hi B32;
+ CARD32 value_lo B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+} xSyncQueryCounterReply;
+#define sz_xSyncQueryCounterReply 32
+
+/*
+ * Await
+ */
+typedef struct _xSyncAwaitReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+} xSyncAwaitReq;
+#define sz_xSyncAwaitReq 4
+
+typedef struct _xSyncWaitCondition {
+ XSyncCounter counter B32;
+ CARD32 value_type B32;
+ INT32 wait_value_hi B32;
+ CARD32 wait_value_lo B32;
+ CARD32 test_type B32;
+ INT32 event_threshold_hi B32;
+ CARD32 event_threshold_lo B32;
+} xSyncWaitCondition;
+#define sz_xSyncWaitCondition 28
+
+/*
+ * Create Alarm
+ */
+typedef struct _xSyncCreateAlarmReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ XSyncAlarm id B32;
+ CARD32 valueMask B32;
+} xSyncCreateAlarmReq;
+#define sz_xSyncCreateAlarmReq 12
+
+/*
+ * Destroy Alarm
+ */
+typedef struct _xSyncDestroyAlarmReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ XSyncAlarm alarm B32;
+} xSyncDestroyAlarmReq;
+#define sz_xSyncDestroyAlarmReq 8
+
+/*
+ * Query Alarm
+ */
+typedef struct _xSyncQueryAlarmReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ XSyncAlarm alarm B32;
+} xSyncQueryAlarmReq;
+#define sz_xSyncQueryAlarmReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 unused;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ XSyncCounter counter B32;
+ CARD32 value_type B32;
+ INT32 wait_value_hi B32;
+ CARD32 wait_value_lo B32;
+ CARD32 test_type B32;
+ INT32 delta_hi B32;
+ CARD32 delta_lo B32;
+ BOOL events;
+ BYTE state;
+ BYTE pad0;
+ BYTE pad1;
+} xSyncQueryAlarmReply;
+#define sz_xSyncQueryAlarmReply 40
+
+/*
+ * Change Alarm
+ */
+typedef struct _xSyncChangeAlarmReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ XSyncAlarm alarm B32;
+ CARD32 valueMask B32;
+} xSyncChangeAlarmReq;
+#define sz_xSyncChangeAlarmReq 12
+
+/*
+ * SetPriority
+ */
+typedef struct _xSyncSetPriority{
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ CARD32 id B32;
+ INT32 priority B32;
+} xSyncSetPriorityReq;
+#define sz_xSyncSetPriorityReq 12
+
+/*
+ * Get Priority
+ */
+typedef struct _xSyncGetPriority{
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ CARD32 id B32; /*XXX XID? */
+} xSyncGetPriorityReq;
+#define sz_xSyncGetPriorityReq 8
+
+typedef struct {
+ BYTE type;
+ CARD8 unused;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ INT32 priority B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+} xSyncGetPriorityReply;
+#define sz_xSyncGetPriorityReply 32
+
+/*
+ * Create Fence
+ */
+typedef struct _xSyncCreateFenceReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ Drawable d B32;
+ XSyncFence fid B32;
+ BOOL initially_triggered;
+ CARD8 pad0;
+ CARD16 pad1;
+} xSyncCreateFenceReq;
+#define sz_xSyncCreateFenceReq 16
+
+/*
+ * Put a fence object in the "triggered" state.
+ */
+typedef struct _xSyncTriggerFenceReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ XSyncFence fid B32;
+} xSyncTriggerFenceReq;
+#define sz_xSyncTriggerFenceReq 8
+
+/*
+ * Put a fence in the "untriggered" state.
+ */
+typedef struct _xSyncResetFenceReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ XSyncFence fid B32;
+} xSyncResetFenceReq;
+#define sz_xSyncResetFenceReq 8
+
+/*
+ * Destroy a fence object
+ */
+typedef struct _xSyncDestroyFenceReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ XSyncFence fid B32;
+} xSyncDestroyFenceReq;
+#define sz_xSyncDestroyFenceReq 8
+
+/*
+ * Query a fence object
+ */
+typedef struct _xSyncQueryFenceReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+ XSyncFence fid B32;
+} xSyncQueryFenceReq;
+#define sz_xSyncQueryFenceReq 8
+
+/*
+ * Wait for any of a list of fence sync objects
+ * to reach the "triggered" state.
+ */
+typedef struct _xSyncAwaitFenceReq {
+ CARD8 reqType;
+ CARD8 syncReqType;
+ CARD16 length B16;
+} xSyncAwaitFenceReq;
+#define sz_xSyncAwaitFenceReq 4
+
+typedef struct {
+ BYTE type;
+ CARD8 unused;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ BOOL triggered;
+ BYTE pad0;
+ CARD16 pad1 B16;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xSyncQueryFenceReply;
+#define sz_xSyncQueryFenceReply 32
+
+/*
+ * Events
+ */
+
+typedef struct _xSyncCounterNotifyEvent {
+ BYTE type;
+ BYTE kind;
+ CARD16 sequenceNumber B16;
+ XSyncCounter counter B32;
+ INT32 wait_value_hi B32;
+ CARD32 wait_value_lo B32;
+ INT32 counter_value_hi B32;
+ CARD32 counter_value_lo B32;
+ CARD32 time B32;
+ CARD16 count B16;
+ BOOL destroyed;
+ BYTE pad0;
+} xSyncCounterNotifyEvent;
+
+typedef struct _xSyncAlarmNotifyEvent {
+ BYTE type;
+ BYTE kind;
+ CARD16 sequenceNumber B16;
+ XSyncAlarm alarm B32;
+ INT32 counter_value_hi B32;
+ CARD32 counter_value_lo B32;
+ INT32 alarm_value_hi B32;
+ CARD32 alarm_value_lo B32;
+ CARD32 time B32;
+ CARD8 state;
+ BYTE pad0;
+ BYTE pad1;
+ BYTE pad2;
+} xSyncAlarmNotifyEvent;
+
+#undef XSyncCounter
+#undef XSyncAlarm
+#undef XSyncFence
+#undef Drawable
+
+
+#endif /* _SYNCPROTO_H_ */
diff --git a/syncstr.h b/syncstr.h
new file mode 100644
index 0000000..25a4827
--- /dev/null
+++ b/syncstr.h
@@ -0,0 +1,182 @@
+/*
+
+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 _SYNCSTR_H_
+#define _SYNCSTR_H_
+
+#include <X11/extensions/syncproto.h>
+
+#ifdef _SYNC_SERVER
+
+#define CARD64 XSyncValue /* XXX temporary! need real 64 bit values for Alpha */
+
+typedef struct _SyncCounter {
+ ClientPtr client; /* Owning client. 0 for system counters */
+ XSyncCounter id; /* resource ID */
+ CARD64 value; /* counter value */
+ struct _SyncTriggerList *pTriglist; /* list of triggers */
+ Bool beingDestroyed; /* in process of going away */
+ struct _SysCounterInfo *pSysCounterInfo; /* NULL if not a system counter */
+} SyncCounter;
+
+/*
+ * The System Counter interface
+ */
+
+typedef enum {
+ XSyncCounterNeverChanges,
+ XSyncCounterNeverIncreases,
+ XSyncCounterNeverDecreases,
+ XSyncCounterUnrestricted
+} SyncCounterType;
+
+typedef struct _SysCounterInfo {
+ char *name;
+ CARD64 resolution;
+ CARD64 bracket_greater;
+ CARD64 bracket_less;
+ SyncCounterType counterType; /* how can this counter change */
+ void (*QueryValue)(
+ pointer /*pCounter*/,
+ CARD64 * /*freshvalue*/
+);
+ void (*BracketValues)(
+ pointer /*pCounter*/,
+ CARD64 * /*lessthan*/,
+ CARD64 * /*greaterthan*/
+);
+} SysCounterInfo;
+
+
+
+typedef struct _SyncTrigger {
+ SyncCounter *pCounter;
+ CARD64 wait_value; /* wait value */
+ unsigned int value_type; /* Absolute or Relative */
+ unsigned int test_type; /* transition or Comparision type */
+ CARD64 test_value; /* trigger event threshold value */
+ Bool (*CheckTrigger)(
+ struct _SyncTrigger * /*pTrigger*/,
+ CARD64 /*newval*/
+ );
+ void (*TriggerFired)(
+ struct _SyncTrigger * /*pTrigger*/
+ );
+ void (*CounterDestroyed)(
+ struct _SyncTrigger * /*pTrigger*/
+ );
+} SyncTrigger;
+
+typedef struct _SyncTriggerList {
+ SyncTrigger *pTrigger;
+ struct _SyncTriggerList *next;
+} SyncTriggerList;
+
+typedef struct _SyncAlarmClientList {
+ ClientPtr client;
+ XID delete_id;
+ struct _SyncAlarmClientList *next;
+} SyncAlarmClientList;
+
+typedef struct _SyncAlarm {
+ SyncTrigger trigger;
+ ClientPtr client;
+ XSyncAlarm alarm_id;
+ CARD64 delta;
+ int events;
+ int state;
+ SyncAlarmClientList *pEventClients;
+} SyncAlarm;
+
+typedef struct {
+ ClientPtr client;
+ CARD32 delete_id;
+ int num_waitconditions;
+} SyncAwaitHeader;
+
+typedef struct {
+ SyncTrigger trigger;
+ CARD64 event_threshold;
+ SyncAwaitHeader *pHeader;
+} SyncAwait;
+
+typedef union {
+ SyncAwaitHeader header;
+ SyncAwait await;
+} SyncAwaitUnion;
+
+
+extern pointer SyncCreateSystemCounter(
+ char * /* name */,
+ CARD64 /* inital_value */,
+ CARD64 /* resolution */,
+ SyncCounterType /* change characterization */,
+ void (* /*QueryValue*/ ) (
+ pointer /* pCounter */,
+ CARD64 * /* pValue_return */), /* XXX prototype */
+ void (* /*BracketValues*/) (
+ pointer /* pCounter */,
+ CARD64 * /* pbracket_less */,
+ CARD64 * /* pbracket_greater */)
+);
+
+extern void SyncChangeCounter(
+ SyncCounter * /* pCounter*/,
+ CARD64 /* new_value */
+);
+
+extern void SyncDestroySystemCounter(
+ pointer pCounter
+);
+extern void InitServertime(void);
+
+#endif /* _SYNC_SERVER */
+
+#endif /* _SYNCSTR_H_ */
diff --git a/xextproto.pc.in b/xextproto.pc.in
new file mode 100644
index 0000000..e85200f
--- /dev/null
+++ b/xextproto.pc.in
@@ -0,0 +1,9 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: XExtProto
+Description: XExt extension headers
+Version: @PACKAGE_VERSION@
+Cflags: -I${includedir}
diff --git a/xtestconst.h b/xtestconst.h
new file mode 100644
index 0000000..e74b904
--- /dev/null
+++ b/xtestconst.h
@@ -0,0 +1,41 @@
+/*
+
+Copyright 1992, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _XTEST_CONST_H_
+#define _XTEST_CONST_H_
+
+#define XTestNumberEvents 0
+
+#define XTestNumberErrors 0
+
+#define XTestCurrentCursor ((Cursor)1)
+
+#define XTestMajorVersion 2
+#define XTestMinorVersion 2
+
+#define XTestExtensionName "XTEST"
+
+#endif
diff --git a/xtestext1const.h b/xtestext1const.h
new file mode 100644
index 0000000..656edc6
--- /dev/null
+++ b/xtestext1const.h
@@ -0,0 +1,160 @@
+/*
+ * 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 _XTESTEXT1CONST_H
+#define _XTESTEXT1CONST_H 1
+
+#define XTestMAX_ACTION_LIST_SIZE 64
+#define XTestACTIONS_SIZE 28
+
+
+/*
+ * used in the XTestPressButton and XTestPressKey functions
+ */
+#define XTestPRESS 1 << 0
+#define XTestRELEASE 1 << 1
+#define XTestSTROKE 1 << 2
+
+/*
+ * When doing a key or button stroke, the number of milliseconds
+ * to delay between the press and the release of a key or button
+ * in the XTestPressButton and XTestPressKey functions.
+ */
+
+#define XTestSTROKE_DELAY_TIME 10
+
+/*
+ * used in the XTestGetInput function
+ */
+#define XTestEXCLUSIVE 1 << 0
+#define XTestPACKED_ACTIONS 1 << 1
+#define XTestPACKED_MOTION 1 << 2
+
+/*
+ * used in the XTestFakeInput function
+ */
+#define XTestFAKE_ACK_NOT_NEEDED 0
+#define XTestFAKE_ACK_REQUEST 1
+
+/*
+ * used in the XTest extension initialization routine
+ */
+#define XTestEXTENSION_NAME "XTestExtension1"
+#define XTestEVENT_COUNT 2
+
+/*
+ * This is the definition for the format of the header byte
+ * in the input action structures.
+ */
+#define XTestACTION_TYPE_MASK 0x03 /* bits 0 and 1 */
+#define XTestKEY_STATE_MASK 0x04 /* bit 2 (key action) */
+#define XTestX_SIGN_BIT_MASK 0x04 /* bit 2 (motion action) */
+#define XTestY_SIGN_BIT_MASK 0x08 /* bit 3 (motion action) */
+#define XTestDEVICE_ID_MASK 0xf0 /* bits 4 through 7 */
+
+#define XTestMAX_DEVICE_ID 0x0f
+#define XTestPackDeviceID(x) (((x) & XTestMAX_DEVICE_ID) << 4)
+#define XTestUnpackDeviceID(x) (((x) & XTestDEVICE_ID_MASK) >> 4)
+
+/*
+ * These are the possible action types.
+ */
+#define XTestDELAY_ACTION 0
+#define XTestKEY_ACTION 1
+#define XTestMOTION_ACTION 2
+#define XTestJUMP_ACTION 3
+
+/*
+ * These are the definitions for key/button motion input actions.
+ */
+#define XTestKEY_UP 0x04
+#define XTestKEY_DOWN 0x00
+
+/*
+ * These are the definitions for pointer relative motion input
+ * actions.
+ *
+ * The sign bits for the x and y relative motions are contained
+ * in the header byte. The x and y relative motions are packed
+ * into one byte to make things fit in 32 bits. If the relative
+ * motion range is larger than +/-15, use the pointer jump action.
+ */
+#define XTestMOTION_MAX 15
+#define XTestMOTION_MIN -15
+
+#define XTestX_NEGATIVE 0x04
+#define XTestY_NEGATIVE 0x08
+
+#define XTestX_MOTION_MASK 0x0f
+#define XTestY_MOTION_MASK 0xf0
+
+#define XTestPackXMotionValue(x) ((x) & XTestX_MOTION_MASK)
+#define XTestPackYMotionValue(x) (((x) << 4) & XTestY_MOTION_MASK)
+
+#define XTestUnpackXMotionValue(x) ((x) & XTestX_MOTION_MASK)
+#define XTestUnpackYMotionValue(x) (((x) & XTestY_MOTION_MASK) >> 4)
+/*
+ * These are the definitions for a long delay input action. It is
+ * used when more than XTestSHORT_DELAY_TIME milliseconds of delay
+ * (approximately one minute) is needed.
+ *
+ * The device ID for a delay is always set to XTestDELAY_DEVICE_ID.
+ * This guarantees that a header byte with a value of 0 is not
+ * a valid header, so it can be used as a flag to indicate that
+ * there are no more input actions in an XTestInputAction event.
+ */
+
+#define XTestSHORT_DELAY_TIME 0xffff
+#define XTestDELAY_DEVICE_ID 0x0f
+
+#endif /* _XTESTEXT1CONST_H */
diff --git a/xtestext1proto.h b/xtestext1proto.h
new file mode 100644
index 0000000..e9bdee0
--- /dev/null
+++ b/xtestext1proto.h
@@ -0,0 +1,221 @@
+/*
+ * 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 _XTESTEXT1PROTO_H
+#define _XTESTEXT1PROTO_H 1
+
+#include <X11/extensions/xtestext1const.h>
+
+/*
+ * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h
+ */
+
+/*
+ * XTest request type values
+ *
+ * used in the XTest extension protocol requests
+ */
+#define X_TestFakeInput 1
+#define X_TestGetInput 2
+#define X_TestStopInput 3
+#define X_TestReset 4
+#define X_TestQueryInputSize 5
+
+/*
+ * This defines the maximum size of a list of input actions
+ * to be sent to the server. It should always be a multiple of
+ * 4 so that the entire xTestFakeInputReq structure size is a
+ * multiple of 4.
+ */
+
+typedef struct {
+ CARD8 reqType; /* always XTestReqCode */
+ CARD8 XTestReqType; /* always X_TestFakeInput */
+ CARD16 length B16; /* 2 + XTestMAX_ACTION_LIST_SIZE/4 */
+ CARD32 ack B32;
+ CARD8 action_list[XTestMAX_ACTION_LIST_SIZE];
+} xTestFakeInputReq;
+#define sz_xTestFakeInputReq (XTestMAX_ACTION_LIST_SIZE + 8)
+
+typedef struct {
+ CARD8 reqType; /* always XTestReqCode */
+ CARD8 XTestReqType; /* always X_TestGetInput */
+ CARD16 length B16; /* 2 */
+ CARD32 mode B32;
+} xTestGetInputReq;
+#define sz_xTestGetInputReq 8
+
+typedef struct {
+ CARD8 reqType; /* always XTestReqCode */
+ CARD8 XTestReqType; /* always X_TestStopInput */
+ CARD16 length B32; /* 1 */
+} xTestStopInputReq;
+#define sz_xTestStopInputReq 4
+
+typedef struct {
+ CARD8 reqType; /* always XTestReqCode */
+ CARD8 XTestReqType; /* always X_TestReset */
+ CARD16 length B16; /* 1 */
+} xTestResetReq;
+#define sz_xTestResetReq 4
+
+typedef struct {
+ CARD8 reqType; /* always XTestReqCode */
+ CARD8 XTestReqType; /* always X_TestQueryInputSize */
+ CARD16 length B16; /* 1 */
+} xTestQueryInputSizeReq;
+#define sz_xTestQueryInputSizeReq 4
+
+/*
+ * This is the definition of the reply for the xTestQueryInputSize
+ * request. It should remain the same minimum size as other replies
+ * (32 bytes).
+ */
+typedef struct {
+ CARD8 type; /* always X_Reply */
+ CARD8 pad1;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32; /* always 0 */
+ CARD32 size_return B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+ CARD32 pad6 B32;
+} xTestQueryInputSizeReply;
+
+/*
+ * This is the definition for the input action wire event structure.
+ * This event is sent to the client when the server has one or
+ * more user input actions to report to the client. It must
+ * remain the same size as all other wire events (32 bytes).
+ */
+typedef struct {
+ CARD8 type; /* always XTestInputActionType */
+ CARD8 pad00;
+ CARD16 sequenceNumber B16;
+ CARD8 actions[XTestACTIONS_SIZE];
+} xTestInputActionEvent;
+
+/*
+ * This is the definition for the xTestFakeAck wire event structure.
+ * This event is sent to the client when the server has completely
+ * processed its input action buffer, and is ready for more.
+ * It must remain the same size as all other wire events (32 bytes).
+ */
+typedef struct {
+ CARD8 type; /* always XTestFakeAckType */
+ CARD8 pad00;
+ CARD16 sequenceNumber B16;
+ CARD32 pad02 B32;
+ CARD32 pad03 B32;
+ CARD32 pad04 B32;
+ CARD32 pad05 B32;
+ CARD32 pad06 B32;
+ CARD32 pad07 B32;
+ CARD32 pad08 B32;
+} xTestFakeAckEvent;
+
+/*
+ * These are the definitions for key/button motion input actions.
+ */
+typedef struct {
+ CARD8 header; /* which device, key up/down */
+ CARD8 keycode; /* which key/button to move */
+ CARD16 delay_time B16; /* how long to delay (in ms) */
+} XTestKeyInfo;
+
+/*
+ * This is the definition for pointer jump input actions.
+ */
+typedef struct {
+ CARD8 header; /* which pointer */
+ CARD8 pad1; /* unused padding byte */
+ CARD16 jumpx B16; /* x coord to jump to */
+ CARD16 jumpy B16; /* y coord to jump to */
+ CARD16 delay_time B16; /* how long to delay (in ms) */
+} XTestJumpInfo;
+
+/*
+ * These are the definitions for pointer relative motion input
+ * actions.
+ *
+ * The sign bits for the x and y relative motions are contained
+ * in the header byte. The x and y relative motions are packed
+ * into one byte to make things fit in 32 bits. If the relative
+ * motion range is larger than +/-15, use the pointer jump action.
+ */
+
+typedef struct {
+ CARD8 header; /* which pointer */
+ CARD8 motion_data; /* x,y relative motion */
+ CARD16 delay_time B16; /* how long to delay (in ms) */
+} XTestMotionInfo;
+
+/*
+ * These are the definitions for a long delay input action. It is
+ * used when more than XTestSHORT_DELAY_TIME milliseconds of delay
+ * (approximately one minute) is needed.
+ *
+ * The device ID for a delay is always set to XTestDELAY_DEVICE_ID.
+ * This guarantees that a header byte with a value of 0 is not
+ * a valid header, so it can be used as a flag to indicate that
+ * there are no more input actions in an XTestInputAction event.
+ */
+
+typedef struct {
+ CARD8 header; /* always XTestDELAY_DEVICE_ID */
+ CARD8 pad1; /* unused padding byte */
+ CARD16 pad2 B16; /* unused padding word */
+ CARD32 delay_time B32; /* how long to delay (in ms) */
+} XTestDelayInfo;
+
+#endif /* _XTESTEXT1PROTO_H */
diff --git a/xtestproto.h b/xtestproto.h
new file mode 100644
index 0000000..4f8db26
--- /dev/null
+++ b/xtestproto.h
@@ -0,0 +1,124 @@
+/*
+
+Copyright 1992, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+*/
+
+#ifndef _XTESTPROTO_H_
+#define _XTESTPROTO_H_
+
+#include <X11/extensions/xtestconst.h>
+
+#define Window CARD32
+#define Time CARD32
+#define Cursor CARD32
+
+#define X_XTestGetVersion 0
+#define X_XTestCompareCursor 1
+#define X_XTestFakeInput 2
+#define X_XTestGrabControl 3
+
+typedef struct {
+ CARD8 reqType; /* always XTestReqCode */
+ CARD8 xtReqType; /* always X_XTestGetVersion */
+ CARD16 length B16;
+ CARD8 majorVersion;
+ CARD8 pad;
+ CARD16 minorVersion B16;
+} xXTestGetVersionReq;
+#define sz_xXTestGetVersionReq 8
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ CARD8 majorVersion;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD16 minorVersion B16;
+ CARD16 pad0 B16;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xXTestGetVersionReply;
+#define sz_xXTestGetVersionReply 32
+
+typedef struct {
+ CARD8 reqType; /* always XTestReqCode */
+ CARD8 xtReqType; /* always X_XTestCompareCursor */
+ CARD16 length B16;
+ Window window B32;
+ Cursor cursor B32;
+} xXTestCompareCursorReq;
+#define sz_xXTestCompareCursorReq 12
+
+typedef struct {
+ BYTE type; /* X_Reply */
+ BOOL same;
+ CARD16 sequenceNumber B16;
+ CARD32 length B32;
+ CARD32 pad0 B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ CARD32 pad3 B32;
+ CARD32 pad4 B32;
+ CARD32 pad5 B32;
+} xXTestCompareCursorReply;
+#define sz_xXTestCompareCursorReply 32
+
+/* used only on the client side */
+typedef struct {
+ CARD8 reqType; /* always XTestReqCode */
+ CARD8 xtReqType; /* always X_XTestFakeInput */
+ CARD16 length B16;
+ BYTE type;
+ BYTE detail;
+ CARD16 pad0 B16;
+ Time time B32;
+ Window root B32;
+ CARD32 pad1 B32;
+ CARD32 pad2 B32;
+ INT16 rootX B16, rootY B16;
+ CARD32 pad3 B32;
+ CARD16 pad4 B16;
+ CARD8 pad5;
+ CARD8 deviceid;
+} xXTestFakeInputReq;
+#define sz_xXTestFakeInputReq 36
+
+typedef struct {
+ CARD8 reqType; /* always XTestReqCode */
+ CARD8 xtReqType; /* always X_XTestGrabControl */
+ CARD16 length B16;
+ BOOL impervious;
+ CARD8 pad0;
+ CARD8 pad1;
+ CARD8 pad2;
+} xXTestGrabControlReq;
+#define sz_xXTestGrabControlReq 8
+
+#undef Window
+#undef Time
+#undef Cursor
+
+#endif /* _XTESTPROTO_H_ */