lbx.html   [plain text]


<HTML>
<H1><A NAME="MMM0"><HR>Low Bandwidth X Extension
</A></H1>

Protocol Version 1.0
<P>

X Consortium Standard
<P>

<P ALIGN=CENTER>D. Converse, J. Fulton, C. Kantarjiev, D. Lemke, R. Mor, K. Packard, R. Tice, D. Tonogai
</P><P ALIGN=CENTER>$Xorg: lbx.html,v 1.3 2000/08/17 19:41:53 cpqbld Exp $
</P>       Copyright (c) 1996 X Consortium
<P>

       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 limita
       tion 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:
<P>

       The above copyright notice and this permission notice shall be included in all copies or substantial portions 
       of the Software.
<P>

       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
       IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT
       NESS 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 CONNEC
       TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
<P>

       Except as contained in this notice, the name of the X Consortium shall not be used in advertising or other
       wise to promote the sale, use or other dealings in this Software without prior written authorization from the 
       X Consortium.
<P>

<H1><A NAME="MMM1">1      Introduction
</A><A HREF="lbxTOC.html">..</A><HR></H1>

       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 net
       works. 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.
<P>

       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 imple
       mentation. Ray Tice (X Consortium) resolved the open issues in the design and specification. Bob Scheifler 
       (X Consortium) helped out in many areas.
<P>

       The extension name is "LBX".
<P>

<H1><A NAME="MMM2">2      Description
</A><A HREF="lbxTOC.html">..</A><HR></H1>

       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. Addition
       ally, 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.
<P>

       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.
<P>

       LBX employs several different compression and short-circuiting methods. Use of these methods is negotia
       ble, and in some cases, the algorithm used by a given method is negotiable as well. LBX also provides for 
       negotiation of extensions to LBX.
<P>

<H2><A NAME="MMM3">2.1    Data Flow
</A></H2>

       The LBX data stream goes through a number of layers:
<P>

       0.     Client requests
<P>
       1.     Read by LBX and potential byte-swapping
<P>
       2.     Request-specific compression
<P>
       3.     Potential byte swapping
<P>
       4.     Multiplexing of client request streams
<P>
       5.     Delta replacement
<P>
       6.     Stream compression
<P>
       Transport
<P>

       6.     Stream decompression
<P>
       5.     Delta substitution
<P>
       4.     Demultiplexing of client request streams
<P>
       3.     Potential byte swapping
<P>
       2.     Reencoding
<P>
       1.     Request processing
<P>
       The reverse process occurs with X server replies, events, and errors.
<P>

<H2>2.2    <A NAME="11018">Tags</A>
</H2>

       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.
<P>

       Tag usage is negotiated as a boolean in the LbxStartProxy 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.
<P>

       The X server keeps track of what tags are known to the proxy. The proxy can invalidate a tag if no tag bear
       ing replies of that type are pending. The proxy sends an LbxInvalidateTag message to release the 
       tagged data. The proxy must not invalidate connection tags unless instructed to do so by the server. 
<P>

       If the server wishes to discard tagged data, it must either have received an LbxInvalidateTag request 
       from the proxy or send an LbxInvalidateTag event to the proxy for that tag. 
<P>

<H3>2.2.1     <A NAME="26534">Tag Substitution in Requests</A>
</H3>

       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 "optional" fields.
<P>

<H3><A NAME="MMM4">2.2.2     Property Tags
</A></H3>

       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. LbxChangeProperty request does the same work as the core ChangeProperty 
       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 LbxGetProperty 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 LbxQue
       ryTag 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 LbxTagData request.
<P>

<H2><A NAME="MMM5">2.3    Short-circuiting
</A></H2>

       Short-circuiting is used to handle constant data. This includes atoms, color name/RGB mappings, and 
       AllocColor calls. Atoms and color name/RGB mappings stay constant for the life of the server. Alloc
       Color 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.
<P>

       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.
<P>

       Colorname/RGB mappings are constant, so once the proxy sees the response from LookupColor, it need 
       not forward any subsequent requests.
<P>

       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 AllocColor 
       requests it can resolve, but it must tell the server to modify the color cell's reference count. LbxIncre
       mentPixel is used to support this.
<P>

       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 LbxModifySequence.
<P>

       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. 
<P>

       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.
<P>

<H2><A NAME="MMM6">2.4    Graphics Re-encoding
</A></H2>

       The LBX proxy attempts to reencode PolyPoint, PolyLine, PolySegment, PolyRectangle, 
       PolyArc, FillPoly, PolyFillRectangle, PolyFillArc, CopyArea, CopyPlane, 
       PolyText8, PolyText16, ImageText8, and ImageText16 requests. If the request can be reen
       coded, it may be replaced by an equivalent LBX form of the request. The requests are reencoded by attempt
       ing to reduce 2-byte coordinate, length, width and angle fields to 1 byte. Where applicable, the coordinate 
       mode is also converted to Previous to improve the compressibility of the resulting data. In image 
       requests, the image data may also be compressed.
<P>

<H2>2.5    <A NAME="15503">Motion events</A>
</H2>

       To prevent clogging the wire with MotionNotify events, the server and proxy work together to control 
       the number of events on the wire. This is done with the LbxAllowMotion 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.
<P>

<H2><A NAME="MMM7">2.6    Event Squishing
</A></H2>

       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.
<P>

<H2><A NAME="MMM8">2.7    Master Client 
</A></H2>

       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.
<P>

<H2><A NAME="MMM9">2.8    Multiplexing of Clients
</A></H2>

       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 LbxSwitch message is used to tell each end which client is using the 
       wire at the time.
<P>

       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.
<P>

       The server can affect the multiplexing of clients by the proxy using the LbxListenToOne and LbxLis
       tenToAll 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. 
<P>

       Replies must be ordered in the multiplexed data stream from the server to the proxy such that the reply car
       rying tagged data precedes replies that refer to that tagged data.
<P>

<H2><A NAME="MMM10">2.9    Swapping
</A></H2>

       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.
<P>

<H2>2.10   <A NAME="22595">Delta cache</A>
</H2>

       LBX takes advantage of the fact that an X message may be very similar to one that has been previously sent. 
       For example, a KeyPress event may differ from a previous KeyPress event in just a few bytes. By send
       ing 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.
<P>

       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 LbxStartProxy request. 
<P>

       The LBX requests that are never stored in the request delta cache are the LbxQueryVersion, Lbx
       StartProxy, LbxSwitch, LbxNewClient, LbxAllowMotion, LbxDelta, LbxQueryExten
       sion, LbxPutImage, LbxGetImage, LbxBeginLargeRequest, LbxLargeRequestData, 
       LbxEndLargeRequest and LbxInternAtoms requests. The responses that are never stored in the 
       response cache are LbxSwitchEvent and LbxDeltaResponse. The message carried by a delta 
       message is also cached, if it meets the other requirements. Messages after the LbxStartProxy 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.
<P>

       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. 
<P>

<H2>2.11   Stream <A NAME="11596">Compression</A>
</H2>

       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 <A HREF="#20870">"LbxStartProxy" on page 9</A>. The proxy 
       and server are not required to support any specific stream compressor. As an example, however, the X Con
       sortium implementation of a ZLIB based compressor is described below.
<P>

<BLOCKQUOTE>                 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:
</BLOCKQUOTE><BLOCKQUOTE>                  out[0] = (length &amp; 0xfff) &gt;&gt; 8 | ((compflag) ? 0x80 : 0);
</BLOCKQUOTE><BLOCKQUOTE>                  out[1] = length &amp; 0xff;
</BLOCKQUOTE><H2><A NAME="MMM11">2.12   Authentication Protocols
</A></H2>

       The current version of LBX does not support multipass authentication protocols for clients of the proxy. 
       These authentication protocols return an Authenticate message in response to a connection setup 
       request, and require additional authentication data from the client after the LbxNewClient request, and 
       before the reply to LbxNewClient. One example of such a protocol is XC-QUERY-SECURITY-1. 
<P>

<H1>3      <A NAME="33319">C Library Interfaces </A>
<A HREF="lbxTOC.html">..</A><HR></H1>

       The C Library routines for LBX are in the Xext library. The prototypes are located in a file named "XLbx.h". 
<P>

<H2><A NAME="MMM12">3.1    Application Library Interfaces
</A></H2>

       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 rou
       tine may be altered when connected through a proxy, as described in <A HREF="#33319">"C Library Interfaces" on page 5</A>.
<P>

<H3><A NAME="MMM13">3.1.1     XLbxQueryVersion
</A></H3>

       To determine the version of LBX supported by the X server, call XLbxQueryVersion.
<P>

<PRE>       Bool XLbxQueryVersion(display, major_version_return, minor_version_return)
          Display * display;
          int * major_version_return;
          int * minor_version_return;
       display                     Specifies the connection to the X server.
       major_version_return        Returns the extension major version number.
       minor_version_return        Returns the extension minor version number.
</PRE>

       The XLbxQueryVersion function determines if the LBX extension is present. If the extension is not 
       present, XLbxQueryVersion returns False; otherwise, it returns True. If the extension is present, 
       XLbxQueryVersion returns the major and minor version numbers of the extension as supported by the X 
       server.
<P>

<H2><A NAME="MMM14">3.2    Proxy Library Interfaces
</A></H2>

       The following interfaces are intended for use by the proxy.
<P>

<H3><A NAME="MMM15">3.2.1     XLbxQueryExtension
</A></H3>

         To determine the dynamically assigned codes for the extension, use the Xlib function XQueryExtension 
       or the LBX function XLbxQueryExtension.
<P>

<PRE>       Bool XLbxQueryExtension(display, major_opcode_return, first_event_return, first_error_return)
          Display * display;       Specifies the connection to the X server.
          int * major_opcode_return; Returns the major opcode.
          int * first_event_return; Returns the first event code.
          int * first_error_return; Returns the first error code.
</PRE>

       The XLbxQueryExtension function determines if the LBX extension is present. If the extension is not 
       present, XLbxQueryExtension returns False; otherwise, it returns True. If the extension is present, 
       XLbxQueryExtension 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 val
       ues are undefined.
<P>

<H3><A NAME="MMM16">3.2.2     XLbxGetEventBase
</A></H3>

         To determine the base event type code, use the Xlib function XQueryExtension or the LBX function 
       XLbxGetEventBase.
<P>

<PRE>       int XLbxGetEventBase(display)
          Display * display;       Specifies the connection to the X server.
</PRE>

       The XLbxGetEventBase function returns the base event type code if the extension is present; otherwise, 
       it returns -1.
<P>

<H1><A NAME="MMM17">4      Protocol
</A><A HREF="lbxTOC.html">..</A><HR></H1>

<H2><A NAME="MMM18">4.1    Syntactic Conventions and Common Types
</A></H2>

       Please refer to the X Window System Protocol specification, as this document uses the syntactic conventions 
       established there and references types defined there.
<P>

       The following additional types are defined by this extension:
<P>

       DIFFITEM
<P>

<UL>
<P>       1    CARD8                                 offset
<P>       1    CARD8                                 diff
</UL>
       LBXANGLE: CARD8 or 2 BYTE
<P>

<UL>
<P>            where (in order of precedence):
<P>            (0 &lt;= in &lt;= A(95)) &amp;&amp; !(in % A(5))  out = 0x5a + (in / A(5))
<P>            A(105) &lt;= in &lt;= A(360) &amp;&amp; !(in % A(15)) out = 0x67 + (in / A(15))
<P>            -A(100) &lt;= in &lt;= -A(5) &amp;&amp; !(in % A(5)) out = 0xa6 + (in / A(5))
<P>            -A(360) &lt; in &lt;= -A(105) &amp;&amp; !(in % A(15)) out = 0x98 + (in / A(15))
<P>            -A(360) &lt; in &lt;= A(360)          out[0] = in &gt;&gt; 8; out[1] = in
</UL>
       LBXARC: 
<P>

<UL>
<P>            [x, y: LBXINT16,
<P>            width, height: LBXCARD16,
<P>            angle1, angle2: LBXANGLE]
<P>       
<P>            Within a list of arcs, after the first arc, x and y are relative to the corresponding fields of the prior arc.
</UL>
       LBXCARD16: CARD8 or 2 BYTE
<P>

<UL>
<P>            where: 
<P>            0x0000 &lt;= in &lt; 0x00F0           CARD8
<P>            0x00F0 &lt;= in &lt; 0x10F0           out[0] = 0xF0 | ((in - 0xF0) &gt;&gt; 8)
<P>                                                  out[1] = in - 0xF0
</UL>
       LBXGCANDDRAWENT
<P>

<UL>
<P>            [ gc-cache-index, drawable-cache-index: CARD4 ]
</UL>
       LBXGCANDDRAWUPDATE
<P>

<UL>
<P>            drawable: DRAWABLE                    /* present only if drawable-cache-index == 0 */
<P>            gc: GC]                               /* present only if gc-cache-index == 0 */
</UL>
       LBXGCANDDRAWABLE
<P>

<UL>
<P>            cache-entries: LBXGCANDDRAWENT
<P>            updates: LBXGCANDDRAWUPDATE
</UL>
       LBXINT16     : INT8 or 2 BYTE
<P>

<UL>
<P>            where:
<P>            0xF790 &lt;= in &lt; 0xFF90           out[0] = 0x80 | (((in + 0x70) &gt;&gt; 8) &amp; 0x0F)
<P>                                                  out[1] = in + 0x70
<P>            0xFF90 &lt;= in &lt; 0x0080           CARD8
<P>            0x0080 &lt;= in &lt; 0x0880           out[0] = 0x80 | (((in - 0x80) &gt;&gt; 8) &amp; 0x0F)
<P>                                                  out[1] = in - 0x80
</UL>
       LBXPINT16 : CARD8 or 2 BYTE  /* for usually positive numbers */ 
<P>

<UL>
<P>            where:
<P>            0xFE00 &lt;= in &lt; 0x0000           out[0] = 0xF0 | (((in + 0x1000) &gt;&gt; 8) &amp; 0x0F)
<P>                                                  out[1] = in + 0x1000
<P>            0x0000 &lt;= in &lt; 0x00F0           CARD8
<P>            0x00F0 &lt;= in &lt; 0x0EF0           out[0] = 0xF0 | ((in - 0xF0) &gt;&gt;8)
<P>                                                  out[1] = in - 0xF0
</UL>
       LBXPOINT : [x, y: LBXINT16]
<P>

<UL>
<P>            Within a list of points, after the first rectangle, x and y are relative to the corresponding fields of the 
            prior point. 
</UL>
       LBXRECTANGLE : 
<P>

<UL>
<P>            [x, y: LBXINT16,
<P>            width, height: LBXCARD16]             
<P>       
<P>            Within a list of rectangles, after the first rectangle, x and y are relative to the corresponding fields of 
            the prior rectangle.
</UL>
       MASK: CARD8
<P>

<H2><A NAME="MMM19">4.2    Errors
</A></H2>

       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).
<P>

       There is one error, LbxClient. 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.
<P>

<H2><A NAME="MMM20">4.3    Requests
</A></H2>

       There is one request that is expected to be used only by the client: LbxQueryVersion
<P>

       There is one request that is expected to be used by the client or the proxy: LbxQueryExtension.
<P>

       The following requests are expected to be used only by the proxy, and are instigated by the proxy: Lbx
       StartProxy, LbxStopProxy, LbxNewClient, LbxSwitch, LbxCloseClient, LbxModify
       Sequence, LbxAllowMotion, LbxInvalidateTag, LbxTagData and LbxQueryTag.
<P>

       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.
<P>

<H3><A NAME="MMM21">4.3.1     Requests Initiated by the Proxy or by the Client
</A></H3>

<H4>       <A NAME="18761">LbxQueryVersion</A>
</H4>

<P>       -->
<UL>
<P>          majorVersion: CARD16
<P>          minorVersion: CARD16
</UL>
       This request returns the major and minor version numbers of the LBX protocol.
<P>

       The encoding of this request is on <A HREF="#34166">page 30</A>.
<P>

<H3><A NAME="MMM22">4.3.2     Requests Initiated or Substituted by the Proxy
</A></H3>

<H4>       <A NAME="36662">LbxQueryExtension</A>
</H4>

<UL>
<P>          nbytes: CARD32
<P>          name: STRING8
</UL>
<P>       -->
<UL>
<P>          num-requests: CARD8
<P>          present: BOOL
<P>          major-opcode: CARD8
<P>          first-event: CARD8
<P>          first-error: CARD8
<P>          reply-mask: LISTofMASK   /* optional */
<P>          event-mask:LISTofMASK    /* optional */
<P>          Errors: Alloc
</UL>
       This request is identical to the QueryExtension request, with an additional field, and two optional addi
       tional fields. When the client issues an QueryExtension request, the proxy will substitute an LbxQue
       ryExtension request.
<P>

       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. Other
       wise, 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.
<P>

       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 signifi
       cant bit corresponds to the first request, and the next bit corresponds to the next request, and so on. Each ele
       ment 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.
<P>

       The encoding of this request is on <A HREF="#37117">page 41</A>.
<P>

<H3><A NAME="MMM23">4.3.3     Control Requests Initiated by the Proxy
</A></H3>

<H4>       <A NAME="20870">LbxStartProxy</A>
</H4>

<UL>
<P>          <A NAME="StartProxy Request">options</A>: LISTofOPTION
</UL>
<P>       -->
<UL>
<P>          choices: LISTofCHOICE
<P>          Errors: LbxClient, Alloc
</UL>
       where:
<P>

<UL>
<P>          OPTION                   [optcode: CARD8,
<P>                                   len: OPTLEN,
<P>                                   option:   (See <A HREF="#35444">Table 1, "StartProxy Options," on page 10</A>) ]
<P>          CHOICE                   [optcode: CARD8,
<P>                                   len: OPTLEN,
<P>                                   choice:    (See <A HREF="#35444">Table 1, "StartProxy Options," on page 10</A>) ]
<P>          
</UL>
  TABLE 1. <A NAME="35444"><PRE>--------------------------------------------------------------------------------------
| optcode       | option              | choice              | default                |
======================================================================================
| delta-proxy   | DELTAOPT            | DELTACHOICE         | entries=16, maxlen=64  |
--------------------------------------------------------------------------------------
| delta-server  | DELTAOPT            | DELTACHOICE         | entries=16, maxlen=64  |
--------------------------------------------------------------------------------------
| stream-comp   | LISTofNAMEDOPT      | INDEXEDCHOICE       | No Compression         |
--------------------------------------------------------------------------------------
| bitmap-comp   | LISTofSTRING8       | LISTofINDEXEDOPT    | No Compression         |
--------------------------------------------------------------------------------------
| pixmap-comp   | LISTofPIXMAPMETHOD  | LISTofPIXMAPCHOICE  | No Compression         |
--------------------------------------------------------------------------------------
| use-squish    | BOOL                | BOOL                | True                   |
--------------------------------------------------------------------------------------
| use-tags      | BOOL                | BOOL                | True                   |
--------------------------------------------------------------------------------------
| colormap      | LISTofSTRING8       | INDEXEDCHOICE       | No Colormap Grabbing   |
--------------------------------------------------------------------------------------
| extension     | NAMEDOPT            | INDEXEDCHOICE       | Extension Disabled     |
--------------------------------------------------------------------------------------
</PRE>
StartProxy Options</A>
<P>

<UL>
<P>          
<P>          DELTAOPT                 [minN, maxN, prefN: CARD8
<P>                                   minMaxMsgLen, maxMaxMsgLen, prefMaxMsgLen: CARD8]
<P>          DELTACHOICE              [entries, maxlen: CARD8]
<P>          INDEXEDCHOICE            [index: CARD8,
<P>                                   data: LISTofBYTE]
<P>          INDEXEDOPT               [index, opcode: CARD8]
<P>          NAMEDOPT                 [name: STRING8,
<P>                                   detail: LISTofBYTE]
<P>          OPTLEN                   1 or 3 CARD8
<P>                                   where:
<P>                                   (0 &lt; in &lt;= 0xFF):  out = in
<P>                                   (0 &lt;= in&lt;= 0xFFFF):  out[0] = 0; out[1] = in &gt;&gt; 8; out[2] = in&amp; 0xFF;
<P>          PIXMAPMETHOD             [name: STRING8,
<P>                                   format-mask: BITMASK,
<P>                                   depths: LISTofCARD8]
<P>          PIXMAPCHOICE             [index, opcode: CARD8,
<P>                                   format-mask: BITMASK,
<P>                                   depths: LISTofCARD8]
<P>          
</UL>
       This request negotiates LBX protocol options, and switches the proxy-server connection from X11 protocol 
       to LBX protocol.
<P>

       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.
<P>

       The server delta cache and proxy delta caches can be configured for number of entries, and the length of 
       entries. (See <A HREF="#22595">"Delta cache" on page 4</A> for details.) The delta caches are configured using the delta-server and 
       delta-proxy options. To configure a cache, the proxy sends the minimum, maximum and preferred values for 
       the number of cache entries, (minN, maxN, prefN), and the length of the cache entries, (minMaxMsgLen, 
       maxMaxMsgLen, prefMaxMsgLen). The server's reply fields, entries and maxlen, contains the values to use. 
       These values must be within the ranges specified by the proxy. The server may also specify an entries value 
       of 0 to disable delta caching. The cache entry lengths are specified in units of 4 bytes.
<P>

       The stream compression algorithm is selected using the stream-comp option. (Stream compression is 
       described in <A HREF="#11596">"Stream Compression" on page 5</A>.) Each algorithm has a name that follows the naming conven
       tions in <A HREF="#13570">"Algorithm Naming" on page 29</A>. To negotiate using the stream-comp option, the proxy lists its 
       available compressors. For each candidate algorithm, the proxy sends the name in the name field, and uses 
       the detail 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. 
<P>

       Bitmap compression is negotiated using the bitmap-comp option. The proxy sends a list of names of avail
       able 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 opcode field gives the value for use in 
       requests. The algorithm names follow the conventions in <A HREF="#13570">"Algorithm Naming" on page 29</A>.
<P>

       Pixmap compression is negotiated using the pixmap-comp option. The proxy sends a list of available algo
       rithms. 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 refer
       ring to this algorithm, a mask of valid formats, and a list of valid depths. Algorithm names follow the con
       ventions in <A HREF="#13570">"Algorithm Naming" on page 29</A>. 
<P>

       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 use-squish is set 
       to true in the request. 
<P>

       Tag caching, described in <A HREF="#11018">"Tags" on page 2</A>, 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 use-tag is set to true in the request.
<P>

       The colormap option is used to negotiate what color matching algorithm will be used by the proxy when the 
       proxy uses the LbxAllocColor 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 con
       tains 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 LbxAllocColor, 
       LbxGrabCmap, and LbxReleaseCmap requests will not be used.
<P>

       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 spe
       cific to that extension. The extension name follows the conventions in <A HREF="#13570">"Algorithm Naming" on page 29</A>. 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 LbxStartProxy message. This index is followed by extension-specific information. The 
       server does not respond to extensions it does not recognize.
<P>

       An LbxClient error is returned when a client which is already communicating through an LBX proxy to 
       the X server sends a LbxStartProxy request.
<P>

       The encoding for this request is on <A HREF="#27452">page 31</A>.
<P>

<H4>       <A NAME="27455">LbxStopProxy</A>
</H4>

<UL>
<P>          Errors: LbxClient
</UL>
       This request terminates the connection between the proxy and X server, and terminates any clients con
       nected through the proxy.
<P>

       The encoding for this request is on <A HREF="#23471">page 33</A>.
<P>

       An LbxClient error is returned if the requesting client is not an LBX proxy.
<P>

<H4>       <A NAME="17810">LbxNewClient</A>
</H4>

<UL>
<P>          byte-order: CARD8
<P>          client-id: CARD32
<P>          protocol-major-version: CARD16
<P>          protocol-minor-version: CARD16
<P>          authorization-protocol-name: STRING8
<P>          authorization-protocol-data: STRING8
</UL>
<P>       -->
<UL>
<P>          Core X reply (if connection is rejected)
<P>          
<P>          OR
<P>          
<P>          success: BOOL
<P>          change-type: {NoDeltas, NormalClientDeltas, AppGroupDeltas}
<P>          protocol-major-version: CARD16
<P>          protocol-minor-version: CARD16
<P>          tag-id: CARD32
<P>          length: CARD16
<P>          connection-data: CONINFO or CONDIF or CONDIFROOT
<P>          
<P>          where:
<P>          CONINFO:                 (the "additional data" portion of the core connection reply for successes)
<P>          CONDIF:                  [resource-id-base: CARD32,
<P>                                   root-input-masks: LISTofSETofEVENT]
<P>          CONDIFROOT:              [resource-id-base: CARD32,
<P>                                   root: WINDOW
<P>                                   root-visual: VISUALID
<P>                                   default-colormap: COLORMAP
<P>                                   white-pixel, black-pixel: CARD32
<P>                                   root-input-masks: LISTofSETofEVENT]
</UL>
       Errors: LbxClient, Alloc
<P>

       This request, which is sent by the proxy over the control connection, creates a new virtual connection to the 
       server.
<P>

       Much of the information in the LbxNewClient request and reply is identical to the connection setup and 
       reply information in the core X protocol.
<P>

       For the LbxNewClient request, the field unique to LBX is client-id. For the LbxNewClient reply, tag-
       id and change-type are fields unique to LBX, and the contents of connection-data may be different in LBX 
       from the core X protocol (see below).
<P>

       The proxy assigns each virtual connection a unique identifier using the client-id field in the LbxNewCli
       ent request. This client-id is used in the LBX protocol to specify the current client (see the LbxSwitch 
       request and the LbxSwitchEvent). client-id 0 is reserved for the proxy control connection. An LbxCli
       ent error will result if the LbxNewClient request contains a client-id of 0 or an already in use client-id.
<P>

       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 Authenticate reply.
<P>

       If the change-type field is set to NoDeltas, then connection-data is sent using the CONINFO structure, 
       which is identical to the additional data of the core connection reply. If the tag-id is non-zero, then the con
       nection-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 LbxInvalidateTag event is received for that tag.
<P>

       When the change-type field is not set to NoDeltas, then connection data is sent as changes against connec
       tion information previously sent to the proxy. The tag-id 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 infor
       mation sent when the proxy connected to the server.
<P>

       If the change-type field is set to NormalClientDeltas, then connection-data is sent using the CONDIF 
       structure. The values in the CONDIF structure are substituted for the identically named fields of the connec
       tion information for the new connection.
<P>

       If the change-type field is set to AppGroupDeltas, then connection-data is sent using the CONDI
       FROOT structure. The root, root-visual, and default-colormap fields, when nonzero, are substituted for the 
       corresponding fields in the reference connection information. The white-pixel and black-pixel fields are sub
       stituted only when the default-colormap field of the reply is non-zero. When default-colormap field of the 
       reply is zero, so are white-pixel and black-pixel. The first entry in the root-input-masks field is the current-
       input-mask for the default root window. The remaining entries in root-input-masks 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 root-input-masks. These screens are at the end of screen list in the reference connection 
       information.
<P>

       The encoding for this request is on <A HREF="#15166">page 33</A>.
<P>

<H4>       <A NAME="21625">LbxCloseClient</A>
</H4>

<UL>
<P>          client: CARD32
<P>          Errors: LbxClient
</UL>
       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 LbxNewClient request, the server 
       will send the LbxClient error.
<P>

       The encoding for this request is on <A HREF="#21121">page 34</A>.
<P>

<H4>       <A NAME="33500">LbxSwitch</A>
</H4>

<UL>
<P>          client: CARD32
<P>          Errors: LbxClient
</UL>
       This request causes the X server to treat subsequent requests as being from a connection to the X server rep
       resented by the specified client identifier.
<P>

       If the client making the request is not the proxy, or if the client identifier sent in the request was not previ
       ously sent in a LbxNewClient request, an LbxClient error is returned.
<P>

       The encoding for this request is on <A HREF="#36790">page 33</A>.
<P>

<H4>       <A NAME="30719">LbxSync</A>
</H4>

<P>       -->
       The sync request causes the server to send a reply when all requests before the sync request have been pro
       cessed.
<P>

       The encoding for this client is on <A HREF="#21186">page 46</A>.
<P>

<H4>       <A NAME="36693">LbxModifySequence</A>
</H4>

<UL>
<P>          adjust: CARD32
<P>          Errors: None
</UL>
       This request advances the sequence number of the virtual client connection by the specified amount. The 
       proxy sends the LbxModifySequence request to the server when it replies to a client request without for
       warding the client request on to the X server.
<P>

       The encoding for this client is on <A HREF="#10940">page 34</A>.
<P>

<H4>       <A NAME="15895">LbxAllowMotion</A>
</H4>

<UL>
<P>          num: CARD32
<P>          Errors: None
</UL>
       This request controls the delivery of optional motion notify events, as described in <A HREF="#15503">"Motion events" on 
       page 3</A>. The num field specifies an increase in the allowed number of motion notify events sent.
<P>

       The encoding for this request is on <A HREF="#11897">page 34</A>.
<P>

<H4>       <A NAME="12515">LbxInvalidateTag</A>
</H4>

<UL>
<P>          tag: CARD32
</UL>
       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.
<P>

       The encoding for this request is on <A HREF="#37545">page 35</A>.
<P>

<H4>       <A NAME="17987">LbxTagData</A>
</H4>

<UL>
<P>          tag: CARD32
<P>          real-length: CARD32
<P>          data: LISTofBYTE
</UL>
       This request specifies the data associated with a previously assigned tag. It is sent in two circumstances: in 
       response to receiving a SendTagDataEvent, 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.
<P>

       The encoding for this request is on <A HREF="#37174">page 39</A>.
<P>

<H4>       <A NAME="10922">LbxGrabCmap</A>
</H4>

<UL>
<P>          cmap: Colormap 
</UL>
<P>       -&gt;
<UL>
<P>          smart-grab: BOOL
<P>          large-pixel: BOOL        /* optional */
<P>          auto-release: BOOL       /* optional */
<P>          three-channels: BOOL     /* optional */
<P>          bits-per-rgb: CARD4      /* optional */
<P>          cells: LISTofCHAN        /* optional */
<P>          
<P>          where:
<P>          CHAN:                    LISTofLBXPIXEL
<P>          LBXPIXEL:                PIXELPRIVATE or PIXELPRIVATERANGE or 
<P>                                   PIXELALLOC or PIXELALLOCRANGE 
<P>          PIXEL:                   CARD8 or CARD16
<P>          PIXELPRIVATE:            [ pixel: PIXEL ]
<P>          PIXELPRIVATERANGE:       [ first-pixel, last-pixel: PIXEL]
<P>          PIXELALLOC:              [ pixel: PIXEL,
<P>                                   color: COLORSINGLE or COLORTRIPLE]
<P>          PIXELALLOCRANGE:         [ first-pixel, last-pixel: PIXEL,
<P>                                   colors: LISTofCOLORSINGLE or LISTofCOLORTRIPLE]
<P>          COLORSINGLE:             [ value: CARD8 or CARD16 ]
<P>          COLORTRIPLE:             [ r, g, b: COLORSINGLE]
<P>          Errors: Colormap
</UL>
       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 smart-grab 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 sec
       tion.
<P>

       Once the proxy has received the reply, it can use the LbxAllocColor request to allocate new colormap 
       cells without the performance penalty of round trips. The proxy is still permitted to use the normal colormap 
       and LbxIncrementPixel requests while the colormap is grabbed. The grab is valid across all virtual 
       connections of the proxy.
<P>

       The LbxGrabCmap 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. 
<P>

       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 
       LbxReleaseCmap event to the proxy holding the grab, which then issues an LbxReleaseCmap request.
<P>

       The server and other proxies may free colormap cells in a colormap grabbed by a proxy. The server will send 
       an LbxFreeCells event to the proxy that currently has the colormap grabbed when the cell reference 
       count reaches 0.
<P>

       If the colormap is a of a static visual type, such as StaticGray, StaticColor, GrayScale, or 
       TrueColor, then the proxy's grab is immediately released by the server, and the proxy must use LbxIn
       crementPixel requests in place of LbxAllocColor requests for this colormap.
<P>

       If the cmap field does not refer to a valid colormap or the colormap is already grabbed by this proxy then a 
       Colormap error is generated.
<P>

       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. 
<P>

       The large-pixel argument, if True, specifies that PIXEL indices will be listed as CARD16 quantities instead 
       of CARD8. The auto-release field, if True, indicates that this colormap is of a static visual type and the 
       proxy's grab is immediately released by the server.
<P>

       If three-channels is False, a single channel is enclosed and color values are described using COLORTRI
       PLE, which has fields for red, green and blue. A single channel is used when the visual type is not Direct
       Color or TrueColor.
<P>

       If three-channels is True, separate red, green and blue channel lists are enclosed, for describing a Direct
       Color or TrueColor 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 cor
       responding red-mask, green-mask and blue-mask of the visual. 
<P>

       The bits-per-rgb 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.
<P>

       The list describing current colormap allocations contains entries of the following types:
<P>

       An LBXPIXELPRIVATE entry indicates that the pixel in the pixel field is unavailable for allocation.
<P>

       An LBXPIXELPRIVATERANGE entry indicates that a contiguous range of pixels are unavailable for allo
       cation. The range is first-pixel to last-pixel, and includes last-pixel.
<P>

       An LBXPIXELALLOC entry indicates that the pixel in the pixel field is allocated as a read-only pixel. The 
       color field carries the color information of the pixel.
<P>

       An LBXPIXELALLOCRANGE entry indicates that a contiguous range of pixels are allocated as read-only. 
       The range starts first-pixel to last-pixel, and includes last-pixel. These fields are followed by a list of COL
       ORSINGLE or COLORTRIPLE, depending on the value of three-channels.
<P>

       A NEXTCHANNEL entry indicates that the next channel of the colormap will be described.
<P>

       A LISTEND entry indicates the end of the colormap description.
<P>

       All pixels not described in the reply are unallocated.
<P>

       The encoding for this request is on <A HREF="#17198">page 44</A>.
<P>

<H4>       <A NAME="34675">LbxReleaseCmap</A>
</H4>

<UL>
<P>          cmap: Colormap
</UL>
       This request releases the specified grabbed colormap. If the cmap field does not refer to a colormap, a Bad
       Colormap error is produced.
<P>

       The proxy must remember the state of the colormap when the LbxReleaseCmap request is issued if this 
       proxy may at some future time issue another LbxGrabCmap request on this colormap before the state of 
       the colormap changes.
<P>

       The encoding for this request is on <A HREF="#14796">page 46</A>.
<P>

<H4>       <A NAME="21636">LbxInternAtoms</A>
</H4>

<UL>
<P>          count: CARD16
<P>          names: LISTofSTRING8
</UL>
<P>       -->
<UL>
<P>          atoms: LISTofATOM
<P>          Errors: Alloc
</UL>
       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.
<P>

       The encoding for this request is on <A HREF="#34140">page 43</A>.
<P>

<H3><A NAME="MMM24">4.3.4     Substitution Requests
</A></H3>

<H4>       <A NAME="10446">LbxAllocColor</A>
</H4>

<UL>
<P>          cmap: Colormap
<P>          pixel: CARD32
<P>          red, green, blue: CARD16
</UL>
       This request is sent by a proxy that has given colormap grabbed to allocate a new read-only cell in the color
       map. The proxy may substitute this request for the core AllocColor and AllocNamedColor requests. 
<P>

       The pixel field identifies the colormap cell to allocate. The red, green, and blue fields are the hardware spe
       cific color values of the corresponding fields of the core AllocColor request. The mapping to hardware 
       specific colormap values by the proxy is performed using the color algorithm negotiated by LbxStart
       Proxy.
<P>

       For colormaps of static visual types, the LbxIncrementPixel request is used instead of LBX Alloc
       Color.
<P>

       If the cmap field does not identify a grabbed colormap then a BadAccess error is produced. If the pixel 
       field refers to a read-write entry, or the pixel field refers to a pixel outside of the range of this colormap, a 
       BadAlloc error is produced.
<P>

       The encoding for this request is on <A HREF="#28429">page 46</A>.
<P>

<H4>       <A NAME="27227">LbxIncrementPixel</A>
</H4>

<UL>
<P>          cmap: COLORMAP
<P>          pixel: CARD32
<P>          Errors: None
</UL>
       This request replaces the AllocColor request for read-only pixels currently allocated for the current cli
       ent. 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.
<P>

       The encoding for this request is on <A HREF="#38053">page 34</A>.
<P>

<H4>       <A NAME="26857">LbxDelta</A>
</H4>

<UL>
<P>          count: CARD8
<P>          cache-index: CARD8
<P>          diffs: LISTofDIFFITEM
</UL>
       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.
<P>

       The encoding for this request is on <A HREF="#39838">page 34</A>.
<P>

<H4>       <A NAME="37687">LbxGetModifierMapping</A>
</H4>

<P>       -->
<UL>
<P>          keyspermod: CARD8
<P>          tag: CARD32
<P>          keycodes: LISTofKEYCODE            /* optional */
</UL>
       This request is identical to the core GetModifierMapping request, with the addition of a tag being 
       returned in the reply. See <A HREF="#26534">"Tag Substitution in Requests" on page 2</A> for a description of the tag field and 
       optional fields.
<P>

       The encoding for this request is on <A HREF="#40057">page 35</A>.
<P>

<H4>       <A NAME="33719">LbxGetKeyboardMapping</A>
</H4>

<UL>
<P>          firstKeyCode: KEYCODE
<P>          count: CARD8
</UL>
<P>       -->
<UL>
<P>          keysperkeycode: CARD8
<P>          tag: CARD32
<P>          keysyms: LISTofKEYSYM    /* optional */
<P>          Errors: Value
</UL>
       This request is identical to the X GetKeyboardMapping protocol request, with the addition that a tag is 
       returned in the reply. See <A HREF="#26534">"Tag Substitution in Requests" on page 2</A> for a description of the tag field and 
       optional fields.
<P>

       The encoding for this request is on <A HREF="#21702">page 37</A>.
<P>

<H4>       <A NAME="39382">LbxGetWinAttrAndGeom</A>
</H4>

<UL>
<P>          window: WINDOW
</UL>
<P>       -->
<UL>
<P>          visual: VISUALID
<P>          class: {InputOutput, InputOnly}
<P>          bit-gravity: BITGRAVITY
<P>          win-gravity: WINGRAVITY
<P>          backing-store: {NotUseful, WhenMapped, Always}
<P>          backing-planes: CARD32
<P>          backing-pixel: CARD32
<P>          save-under: BOOL
<P>          colormap: COLORMAP or None
<P>          map-is-installed: BOOL
<P>          map-state: {Unmapped, Unviewable, Viewable}
<P>          all-event-masks, your-event-mask: SETofEVENT
<P>          do-not-propagate-mask: SETofDEVICEEVENT
<P>          override-redirect: BOOL
<P>          root: WINDOW
<P>          depth: CARD8
<P>          x, y: INT16
<P>          width, height, border-width: CARD16
<P>          Errors: Window
</UL>
       GetWindowAttributes and GetGeometry are frequently used together in the X protocol. 
       LbxGetWinAttrAndGeom allows the proxy to request the same information in one round trip.
<P>

       <A NAME="32802">.</A>The encoding for this request is on <A HREF="#41440">page 43</A>.
<P>

<H4>       <A NAME="18818">LbxQueryFont</A>
</H4>

<UL>
<P>          font: FONTABLE
</UL>
<P>       -->
<UL>
<P>          compression: BOOL
<P>          tag: CARD32
<P>          font-info: FONTINFO                                  /* optional */
<P>          char-infos: LISTofCHARINFO or LISTofLBXCHARINFO      /* optional */
<P>          where:
<P>          LBXCHARINFO:             [left-side-bearing: INT6
<P>                                   right-side-bearing: INT7
<P>                                   character-width: INT6
<P>                                   ascent: INT6
<P>                                   descent: INT7]
<P>          Errors: Font,Alloc
</UL>
       This request is used to replace the core QueryFont request and has identical semantics.
<P>

       See <A HREF="#26534">"Tag Substitution in Requests" on page 2</A> for a description of the tag field and optional fields.
<P>

       The compression field is True if the char-infos field is represented using LBXCHARINFO.
<P>

       The per-character information will be encoded in an LBXCHARINFO when, for every character, the charac
       ter-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 font_info field of the font.
<P>

       The encoding for this request is on <A HREF="#24597">page 37</A>.
<P>

<H4>       <A NAME="40098">LbxChangeProperty</A>
</H4>

<UL>
<P>          window: WINDOW
<P>          property: ATOM
<P>          type: ATOM
<P>          format: {0,8,16,32}
<P>          mode: {Replace, Prepend, Append}
<P>          nUnits: CARD32
</UL>
<P>       -->
<UL>
<P>          tag: CARD32
</UL>
       This request is sent to the server when the client sends an X ChangeProperty 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 LbxStopProxy request, or exit
       ing, the proxy must send LbxTagData 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.
<P>

       If the mode field is Prepend or Append, the tag refers only to the prepended or appended data.
<P>

       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.
<P>

       The encoding for this request is on <A HREF="#18013">page 38</A>.
<P>

<H4>       <A NAME="31397">LbxGetProperty</A>
</H4>

<UL>
<P>          window: WINDOW
<P>          property: ATOM
<P>          type: ATOM or AnyPropertyType
<P>          long-offset: CARD32
<P>          long-length: CARD32
<P>          delete: CARD8
</UL>
<P>       -->
<UL>
<P>          type: ATOM or None
<P>          format: {0, 8, 16, 32}
<P>          bytes-after: CARD32
<P>          nItems: CARD32
<P>          tag: CARD32
<P>          value: LISTofINT8 or LISTofINT16 or LISTofINT32
</UL>
       This request may be used by the proxy as a substitution for a core GetProperty 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 cli
       ents.
<P>

       The LbxGetProperty request has the same arguments as the core GetProperty request. The reply for 
       LbxGetProperty has all of the fields from the core GetProperty reply, but has the additional fields of 
       nItems and tag.
<P>

       In order to utilize tags in LbxGetProperty 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 LbxGet
       Property reply with a new tag, nItems 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.
<P>

       In response to future LbxGetProperty 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 LbxGetProperty reply without the 
       actual property data. In this case, the reply would include a non-zero tag, a zero reply length, and no data for 
       value.
<P>

       If the server chooses not to generate a tagged reply to LbxGetProperty, or for some reason is unable to 
       do so, it would send a reply with a tag of zero, the size of the property data in the reply length field, and the 
       complete property data in value.
<P>

       The encoding for this request is on <A HREF="#13863">page 38</A>.
<P>

<H4>       <A NAME="37179">LbxPolyPoint</A>
</H4>

<UL>
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          points: LISTofLBXPOINT
<P>          Errors: Alloc and those given for the corresponding X request.
</UL>
       This request replaces the PolyPoint request. Not all PolyPoint requests can be represented as Lbx
       PolyPoint requests.
<P>

       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.
<P>

       The encoding for this request is on <A HREF="#29719">page 35</A>.
<P>

<H4>       <A NAME="16574">LbxPolyLine</A>
</H4>

<UL>
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          points: LISTofLBXPOINT
<P>          Errors: Alloc and those given for the corresponding X request.
</UL>
       This request replaces the PolyLine request. Not all PolyLine requests can be represented as Lbx
       Polyline requests.
<P>

       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.
<P>

       The encoding for this request is on <A HREF="#31086">page 35</A>.
<P>

<H4>       <A NAME="26077">LbxPolySegment</A>
</H4>

<UL>
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          segments: LISTofLBXSEGMENT
<P>          
<P>          where:
<P>          LBXSEGEMENT; [x1, y1, x2, y2: LBXINT16]
<P>          Errors: Alloc and those given for the corresponding X request.
</UL>
       This request replaces the PolySegment request. Not all PolySegment requests can be represented as 
       LbxPolySegment requests. 
<P>

       For segments other than the first segment of the request, [x1, y1] is relative to [x1, y1] of the previous seg
       ment. For all segments, [x2, y2] is relative to that segment's [x1, y1].
<P>

       The encoding for this request is on <A HREF="#27528">page 35</A>.
<P>

<H4>       <A NAME="40958">LbxPolyRectangle</A>
</H4>

<UL>
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          rectangles: LISTofLBXRECTANGLE
<P>          Errors: Alloc and those given for the corresponding X request.
</UL>
       This request replaces the PolyRectangle request. Not all PolyRectangle requests can be repre
       sented as LbxPolyRectangle requests.
<P>

       The encoding for this request is on <A HREF="#33628">page 36</A>.
<P>

<H4>       <A NAME="15317">LbxPolyArc</A>
</H4>

<UL>
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          arcs: LISTofLBXARC
<P>          Errors: Alloc and those given for the corresponding X request.
</UL>
       This request replaces the PolyArc request. Not all PolyArc requests can be represented as LbxPol
       yArc requests.
<P>

       The encoding for this request is on <A HREF="#25855">page 36</A>.
<P>

<H4>       <A NAME="25511">LbxPolyFillRectangle</A>
</H4>

<UL>
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          rectangles: LISTofLBXRECTANGLE
<P>          Errors: Alloc and those given for the corresponding X request.
</UL>
       This request replaces the PolyFillRectangle request. Not all PolyFillRectangle requests can 
       be represented as LbxPolyFillRectangle requests.
<P>

       The encoding for this request is on <A HREF="#26399">page 36</A>.
<P>

<H4>       <A NAME="42698">LbxPolyFillArc</A>
</H4>

<UL>
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          arcs: LISTofLBXARC
<P>          Errors: Alloc and those given for the corresponding X request.
</UL>
       This request replaces the PolyFillArc request. Not all PolyFillArc requests can be represented as 
       LbxPolyFillArc requests.
<P>

       The encoding for this request is on <A HREF="#19081">page 37</A>.
<P>

<H4>       <A NAME="35796">LbxFillPoly</A>
</H4>

<UL>
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          shape: BYTE
<P>          points: LISTofLBXPOINT
<P>          Errors: Alloc and those given for the corresponding X request.
</UL>
       This request replaces the FillPoly request. Not all FillPoly requests can be represented as Lbx
       FillPoly requests.
<P>

       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.
<P>

       The encoding for this request is on <A HREF="#24998">page 36</A>.
<P>

<H4>       <A NAME="11409">LbxCopyArea</A>
</H4>

<UL>
<P>          srcCache: CARD8          /* source drawable */
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          src-Drawable: CARD32
<P>          src-x: LBXPINT16
<P>          src-y: LBXPINT16
<P>          width: LBXCARD16
<P>          height: LBXCARD16
<P>          dst-x: LBXPINT16 
<P>          dst-y: LBXPINT16
<P>          Errors: Those given for the corresponding X request.
</UL>
       This request replaces the CopyArea request for requests within its encoding range.
<P>

       The encoding for this request is on <A HREF="#10231">page 39</A>.
<P>

<H4>       <A NAME="36772">LbxCopyPlane</A>
</H4>

<UL>
<P>          bit-plane: CARD32
<P>          src-cache: CARD8         /* cache reference for source drawable */
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          src-drawable: CARD32
<P>          src-x: LBXPINT16
<P>          src-y: LBXPINT16
<P>          width: LBXCARD16
<P>          height: LBXCARD16
<P>          dst-x: LBXPINT16
<P>          dst-y: LBXPINT16
<P>          Errors: Those given for the corresponding X request.
</UL>
       This request replaces the CopyPlane request for requests within its coding range.
<P>

       The encoding for this request is on <A HREF="#18847">page 40</A>.
<P>

<H4>       <A NAME="23201">LbxPolyText8</A>
</H4>

<UL>
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          x: LBXPINT16
<P>          y: LBXPINT16
<P>          items: LISTofTEXTITEM8
<P>          Errors: Alloc, and those given for the corresponding X request.
</UL>
       This request replaces the PolyText8 request for requests within its encoding range.
<P>

       The encoding for this request is on <A HREF="#39640">page 40</A>.
<P>

<H4>       <A NAME="13228">LbxPolyText16</A>
</H4>

<UL>
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          x: LBXPINT16
<P>          y: LBXPINT16
<P>          items: LISTofTEXTITEM16
<P>          Errors: Alloc, and those given for the corresponding X request.
</UL>
       This request replaces the PolyText16 request for requests within its encoding range.
<P>

       The encoding for this request is on <A HREF="#32634">page 40</A>.
<P>

<H4>       <A NAME="10990">LbxImageText8</A>
</H4>

<UL>
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          nChars: CARD8
<P>          x: LBXPINT16
<P>          y: LBXPINT16
<P>          string: STRING8
<P>          Errors: Alloc, and those given for the corresponding X request.
</UL>
       This request replaces the ImageText8 request for requests within its encoding range.
<P>

       The encoding for this request is on <A HREF="#17018">page 40</A>.
<P>

<H4>       <A NAME="39584">LbxImageText16</A>
</H4>

<UL>
<P>          nChars: CARD8
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          x: LBXPINT16
<P>          y: LBXPINT16
<P>          string: STRING16
<P>          Errors: Alloc, and those given for the corresponding X request.
</UL>
       This request replaces the ImageText16 request for requests within its encoding range.
<P>

       The encoding for this request is on <A HREF="#23910">page 41</A>.
<P>

<H4>       <A NAME="21218">LbxPutImage</A>
</H4>

<UL>
<P>          compression-method: CARD8
<P>          format: {Bitmap, XYPixmap, ZPixmap}                  /* packed */
<P>          gc-and-drawable: LBXGCANDDRAWABLE
<P>          width, height: LBXCARD16
<P>          dst-x, dst-y: LBXPINT16
<P>          depth: CARD8                                         /* packed */
<P>          left-pad: CARD8                                      /* packed */
<P>          pad-bytes: CARD8                                     /* packed */
<P>          data:LISTofBYTE
<P>          Errors: Alloc, Value
</UL>
       When the request can be usefully compressed, this request replaces the PutImage request. The compres
       sion-method parameter contains the opcode of a compression method returned in the LbxStartProxy 
       reply. The pad-bytes 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 Value error.
<P>

       The encoding for this request is on <A HREF="#12268">page 41</A>.
<P>

<H4>       <A NAME="26896">LbxGetImage</A>
</H4>

<UL>
<P>          drawable: DRAWABLE
<P>          x, y: INT16
<P>          width, height: CARD16
<P>          plane-mask: CARD32
<P>          format: {XYPixmap, ZPixmap}
</UL>
<P>       -->
<UL>
<P>          depth: CARD8
<P>          x-length: CARD32
<P>          visual: VISUALID or None
<P>          compression-method: CARD8
<P>          data: LISTofBYTE
<P>          Errors: Alloc,Match,Value
</UL>
       This request can replace the GetImage request. The same semantics apply, with the following exceptions.
<P>

       The compression-method field contains the opcode of the compression method used in the reply. The com
       pression opcodes are supplied in the LbxStartProxy reply. The x-length field contains the length of the 
       uncompressed version of the reply in 4 byte units.
<P>

       A Value error is returned if the format is not recognized by the X server. A Match error is returned under 
       the same circumstances as described by the GetImage request.
<P>

       The encoding for this request is on <A HREF="#10066">page 42</A>.
<P>

<H4>       <A NAME="31209">LbxBeginLargeRequest</A>
</H4>

<UL>
<P>          large-request-length: CARD32
<P>          Errors: Alloc
</UL>
       This request, along with the LbxLargeRequestData and LbxEndLargeRequest 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.
<P>

       After a LbxBeginLargeRequest request is sent, multiple LbxLargeRequestData requests are sent 
       to transport all of the data in the large request, and finally an LbxEndLargeRequest 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.
<P>

       The encoding for this request is on <A HREF="#22013">page 42</A>.
<P>

<H4>       <A NAME="36982">LbxLargeRequestData</A>
</H4>

<UL>
<P>          data: LISTofBYTE
<P>          Errors: Alloc
</UL>
       This request is used to carry the segments of a larger request, as described in the definition of LbxBegin
       LargeRequest. The data must be carried in order, starting with the request header, and each segment 
       must be multiples of 4 bytes long. If the LbxLargeRequestData is not preceded by a corresponding 
       LbxBeginLargeRequest, a BadAlloc error is generated.
<P>

       The encoding for this request is on <A HREF="#31469">page 43</A>.
<P>

<H4>       <A NAME="31841">LbxEndLargeRequest</A>
</H4>

<UL>
<P>          Errors: Length, Alloc
</UL>
       As described in the definition of LbxBeginLargeRequest, LbxEndLargeRequest is used to signal 
       the end of a series of LargeRequestData requests. If the total length of the data transported by the 
       LbxLargeRequestData requests does not match the large-request-length field of the preceding Lbx
       BeginLargeRequest request, then a Length error occurs. If the LbxEndLargeRequest is not pre
       ceded by a corresponding LbxBeginLargeRequest, a BadAlloc error is generated. The request is 
       executed in order for that client as if it were the request after the request preceding LbxEndLargeRe
       quest.
<P>

       The encoding for this request is on <A HREF="#31037">page 43</A>.
<P>

<H2><A NAME="MMM25">4.4    Events
</A></H2>

<H4>       <A NAME="33748">LbxSwitchEvent</A>
</H4>

<UL>
<P>          client: CARD32
</UL>
       Notify the proxy that the subsequent replies, events, and errors are relative to the specified client.
<P>

       The encoding for this event is on <A HREF="#17348">page 46</A>.
<P>

<H4>       <A NAME="17292">LbxCloseEvent</A>
</H4>

<UL>
<P>          client: CARD32
</UL>
       Notify the proxy that the specified client's connection to the server is closed.
<P>

       The encoding for this event is on <A HREF="#41814">page 47</A>.
<P>

<H4>       <A NAME="23016">LbxInvalidateTagEvent</A>
</H4>

<UL>
<P>          tag: CARD32
<P>          tag-type: {Modmap, Keymap, Property, Font, ConnInfo}
</UL>
       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: LbxTagTypeModmap, LbxTag
       TypeKeymap, LbxTagTypeProperty, LbxTagTypeFont, LbxTagTypeConnInfo.
<P>

       The encoding for this event is on <A HREF="#34406">page 47</A>.
<P>

<H4>       <A NAME="20373">LbxSendTagDataEvent</A>
</H4>

<UL>
<P>          tag: CARD32
<P>          tag-type: {Property}
</UL>
       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 SendTagData by sending a TagData request to the server. The tag type may be one of the 
       following values: LbxTagTypeProperty.
<P>

       The encoding for this event is on <A HREF="#22353">page 47</A>.
<P>

<H4>       <A NAME="25209">LbxListenToOne</A>
</H4>

<UL>
<P>          client: CARD32 or 0xffffffff
</UL>
       When the server is grabbed, ListenToOne is sent to the proxy. As an X client, the proxy itself is unaf
       fected by grabs, in order that it may respond to requests for data from the X server.
<P>

       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.
<P>

       When the client grabbing the server is not managed through the proxy, the client field in the event will be 
       0xffffffff. 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.
<P>

       The server will send ListenToAll to the proxy when the server is ungrabbed. There is no time-out for 
       this interval in the protocol.
<P>

       The encoding for this event is on <A HREF="#18630">page 47</A>.
<P>

<H4>       <A NAME="11095">LbxListenToAll</A>
</H4>

       Notify the proxy that the server has been ungrabbed, and that the proxy may now send all buffered client 
       requests on to the server.
<P>

       The encoding for this event is on <A HREF="#30610">page 47</A>.
<P>

<H4>       <A NAME="40268">LbxQuickMotionDeltaEvent</A>
</H4>

<UL>
<P>          deltaTime: CARD8
<P>          deltaX: INT8
<P>          deltaY: INT8
</UL>
       This event is used as a replacement for the MotionNotify event when possible. The fields are used as 
       deltas to the most recent MotionNotify event encoded as a MotionNotify event, LbxQuickMo
       tionDeltaEvent, or LbxMotionDeltaEvent. Not every MotionNotify event can be encoded as 
       a LbxQuickMotionDeltaEvent.
<P>

       The encoding for this event is on <A HREF="#35213">page 48</A>.
<P>

<H4>       <A NAME="30033">LbxMotionDeltaEvent</A>
</H4>

<UL>
<P>          deltaX: INT8
<P>          deltaY: INT8
<P>          deltaTime: CARD16
<P>          deltaSequence: CARD16
</UL>
       This event is used as a replacement for the MotionNotify event when possible. The fields are used as 
       deltas to the most recent MotionNotify event encoded as a MotionNotify event, LbxQuickMo
       tionDeltaEvent, or LbxMotionDeltaEvent. Not every MotionNotify event can be encoded as 
       a LbxMotionDeltaEvent.
<P>

       <A NAME="33682">.</A>The encoding for this event is on <A HREF="#35310">page 48</A>.
<P>

<H4>       <A NAME="19129">LbxReleaseCmapEvent</A>
</H4>

<UL>
<P>          colormap: Colormap
</UL>
       This event notifies the proxy that it must release the grab on this colormap via the ReleaseCmap request. <A HREF="#34675">See 
       "LbxReleaseCmap" on page 17.</A>
<P>

       The encoding for this event is on <A HREF="#14052">page 48</A>.
<P>

<H4>       <A NAME="38041">LbxFreeCellsEvent</A>
</H4>

<UL>
<P>          colormap: Colormap
<P>          pixelStart, pixelEnd: CARD32
</UL>
       The LbxFreeCells event is sent to a proxy that has a colormap grabbed to notify the proxy that the refer
       ence 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. <A HREF="#10922">See 
       "LbxGrabCmap" on page 15.</A>
<P>

       The pixelStart and pixelEnd fields of the event denote a continuous range of cells that were freed.
<P>

       The encoding for this event is on <A HREF="#14731">page 48</A>.
<P>

<H2><A NAME="MMM26">4.5    Responses
</A></H2>

       Responses are messages from the server to the proxy that not, strictly speaking, events, replies or errors.
<P>

<H4>       <A NAME="34042">.</A>LbxDeltaResponse
</H4>

<UL>
<P>          count: CARD8
<P>          cache-index: CARD8
<P>          diffs: LISTofDIFFITEM
</UL>
       This response carries an event, reply, or error that has been encoded relative to a message in the response 
       delta cache. The cache-index field is the index into the cache. Each entry in diffs provides a byte offset and 
       replacement value to use in reconstructing the response.
<P>

       The encoding for this event is on <A HREF="#17100">page 49</A>.
<P>

<H1>5      <A NAME="13570">Algorithm Naming</A>
<A HREF="lbxTOC.html">..</A><HR></H1>

       To avoid potential clashes between different but similar algorithms for stream, bitmap, and pixmap compres
       sion, the following naming scheme will be adhered to:
<P>

       Each algorithm has a unique name, which is a STRING8, of the following form: 
<P>

          &lt;organization&gt;-&lt;some-descriptive-name&gt; 
<P>

       The organization field above is the organization name as registered in section 1 of the X Registry (the regis
       try is provided as a free service by the X Consortium.) This prevents conflicts among different vendor's 
       extensions.
<P>

       As an example, the X Consortium defines a zlib-based stream compression algorithm called XC-ZLIB.
<P>

<H1><A NAME="MMM27">6      Encoding
</A><A HREF="lbxTOC.html">..</A><HR></H1>

       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. 
<P>

       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.
<P>

       For unused bytes, the encode-form is:
<P>

<UL>
<P>       N                                          unused
</UL>
       If the number of unused bytes is variable, the encode-form typically is:
<P>

<UL>
<P>       p                                          unused, p=pad(E)
</UL>
       where E is some expression, and pad(E) is the number of bytes needed to round E up to a multiple of four.
<P>

       pad(E) = (4 - (E mod 4)) mod 4
<P>

       In many of the encodings, the length depends on many variable length fields. The variable L is used to indi
       cate 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.
<P>

       For counted lists there is a common encoding of NLISTofFOO:
<P>

       NLISTofFOO
<P>

<UL>
<P>       1    m                                     num items
<P>       m    LISTofFOO                             items
</UL>
       For cached GC and Drawables:
<P>

<UL>
<P>       LBXGCANDDRAWUPDATE
<P>       4 or 0 DRAWBLE                             optional drawable
<P>       4 or 0 GC                                  optional GC
<P>       
<P>       LBXGCANDDRAWABLE
<P>       8    LBXGCANDDRAWENT                       cache-entries
<P>       8                                          unused
<P>       m    LBXGCANDDRAWUPDATE                    optional GC and Drawable
</UL>
<H2><A NAME="MMM28">6.1    Errors
</A></H2>

<H4><A NAME="MMM29">       LbxClient
</A></H4>

<UL>
<P>       1    0                                     Error
<P>       1    CARD8                                 error-base + 0
<P>       2    CARD16                                sequence number
<P>       4                                          unused
<P>       2    CARD16                                lbx opcode
<P>       1    CARD8                                 major opcode
<P>       21                                         unused
</UL>
<H2><A NAME="MMM30">6.2    Requests
</A></H2>

<H4>       <A NAME="34166">LbxQueryVersion</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    0                                     lbx opcode
<P>       2    1                                     request length
</UL>
<P>     -->
<UL>
<P>       1    1                                     Reply
<P>       1                                          unused
<P>       2    CARD16                                sequence number
<P>       4    0                                     reply length
<P>       2    CARD16                                major version
<P>       2    CARD16                                minor version
<P>       20                                         unused
</UL>
       The description of this request is on <A HREF="#18761">page 8</A>.
<P>

<H4>       <A NAME="27452">LbxStartProxy</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    1                                     lbx opcode
<P>       2    L                                     request length
<P>       n    NLISTofOPTION-REQUEST                 options
<P>       p                                          unused, p=pad(n)
</UL>
       OPTION-REQUEST
<P>

<UL>
<P>       1    OPTCODE                               option-code
<P>       m    OPTLEN                                option-request-byte-length, (b=m+a+1)
<P>       a    DELTAOPT or                           option 
<P>            NLISTofNAMEDOPT or 
<P>            NLISTofSTR or 
<P>            NLISTofPIXMAPMETHOD or 
<P>            BOOL
<P>       
</UL>
       The encoding of the option field depends on the option-code. See <A HREF="#35444">Table 1, "StartProxy Options," on page 10</A>.
<P>

<UL>
<P>       1    OPTCODE                               option-code
<UL>
<P>            0    LbxOptionDeltaProxy
<P>            1    LbxOptionDeltaServer
<P>            2    LbxOptionStreamCompression
<P>            3    LbxOptionBitmapCompression
<P>            4    LbxOptionPixmapCompression
<P>            5    LbxOptionMessageCompression    /* also known as squishing */
<P>            6    LbxOptionUseTags
<P>            7    LbxOptionColormapAllocation
<P>            255  LbxOptionExtension
</UL>
</UL>
       OPTLEN has two possible encodings, depending on the size of the value carried:
<P>

<UL>
<P>       OPTLEN
<P>       1    CARD8                                 b (0 &lt; b &lt;= 255)
<P>       
<P>       OPTLEN
<P>       1    0                                     long length header
<P>       1    c                                     length0, c = b &gt;&gt; 8
<P>       1    d                                     length1, d= b &amp; #xff
</UL>
       DELTAOPT
<P>

<UL>
<P>       1    CARD8                                 min-cache-size
<P>       1    CARD8                                 max-cache-size
<P>       1    CARD8                                 preferred-cache-size
<P>       1    CARD8                                 min-message-length
<P>       1    CARD8                                 max-message-length (in 4-byte units)
<P>       1    CARD8                                 preferred-message-length
</UL>
       NAMEDOPT
<P>

<UL>
<P>       f    STR                                   type-name
<P>       1    g+1                                   option-data-length
<P>       g    LISTofBYTE                            option-data (option specific)
</UL>
       PIXMAPMETHOD
<P>

<UL>
<P>       h    STR                                   name
<P>       1    BITMASK                               format mask
<P>       1    j                                     depth count
<P>       j    LISTofCARD8                           depths
</UL>
<P>     
<P>     -->
<UL>
<P>       1    1                                     Reply
<P>       1    CARD8                                 count
<UL>
<P>            0xff options in request cannot be decoded
</UL>
<P>       2    CARD16                                sequence number
<P>       4    (a+p-32)/4                            reply length
<P>       a    LISTofCHOICE                          options-reply
<P>       p                                          unused, if (n&lt;24) p=24-n else p=pad(n)
</UL>
       CHOICE
<P>

<UL>
<P>       1    CARD8                                 request-option-index
<P>       b    OPTLEN                                reply-option-byte-length
<P>       c    DELTACHOICE or                        choice
<P>            INDEXEDCHOICE or 
<P>            NLISTofINDEXEDOPT or
<P>            NLISTofPIXMAPCHOICE or 
<P>            BOOL or
<P>            INDEXEDCHOICE
</UL>
       The encoding of the choice field depends on the option-code. See <A HREF="#35444">Table 1, "StartProxy Options," on page 10</A>.
<P>

       DELTACHOICE
<P>

<UL>
<P>       1    CARD8                                 preferred cache size
<P>       1    CARD8                                 preferred message length in 4-byte units
</UL>
       INDEXEDCHOICE
<P>

<UL>
<P>       1    CARD8                                 index
<P>       d    LISTofBYTE                            data
</UL>
       PIXMAPCHOICE
<P>

<UL>
<P>       1    CARD8                                 index
<P>       1    CARD8                                 opcode
<P>       1    BITMASK                               format mask
<P>       e    NLISTofCARD8                          depths
</UL>
       The description of this request is on <A HREF="#20870">page 9</A>.
<P>

<H4>       <A NAME="23471">LbxStopProxy</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    2                                     lbx opcode
<P>       2    1                                     request length
</UL>
       The description of this request is on <A HREF="#27455">page 12</A>.
<P>

<H4>       <A NAME="36790">LbxSwitch</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    3                                     lbx opcode
<P>       2    2                                     request length
<P>       4    CARD32                                client
</UL>
       <A NAME="15166">.</A>The description of this request is on <A HREF="#33500">page 13</A>.
<P>

<H4><A NAME="MMM31">       LbxNewClient
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    4                                     lbx opcode
<P>       2    L                                     request length
<P>       4    CARD32                                client
<P>       The remaining bytes of the request are the core connection setup.
</UL>
<P>     -->
<UL>
<P>       If the connection is rejected, a core connection reply is sent. Otherwise the reply has the form:
<P>       1    BOOL                                  success
<P>       1                                          change type
<P>            0                                     no-deltas
<P>            1                                     normal-client-deltas
<P>            2                                     app-group-deltas
<P>       2    CARD16                                major version
<P>       2    CARD16                                minor version
<P>       2    1 + a                                 length 
<P>       4    CARD32                                tag id
</UL>
       The remaining bytes depend on the value of change-type and length. 
<P>

       For no-deltas, the remaining bytes are the "additional data" bytes of the core reply. (a = length of core reply, 
       in 4 byte quantities).
<P>

       For normal-client-deltas, the additional bytes have the form, with a length (a = 1 +b):
<P>

<UL>
<P>       4    CARD32                                resource id base
<P>       4b   LISTofSETofEVENT                      root input masks
</UL>
       For app-group-deltas, the additional bytes have the following form, with a length of (a = 1 + 4c):
<P>

<UL>
<P>       4    CARD32                                resource id base
<P>       4    WINDOW                                root id base
<P>       4    VISUALID                              visual
<P>       4    COLORMAP                              colormap
<P>       4    CARD32                                white pixel
<P>       4    CARD32                                black pixel
<P>       4c   LISTofSETofEVENT                      root input masks
</UL>
       <A NAME="21121">.</A>The description of this request is on <A HREF="#17810">page 12</A>.
<P>

<H4><A NAME="MMM32">       LbxCloseClient
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    5                                     lbx opcode
<P>       2    2                                     request length
<P>       4    CARD32                                client
</UL>
       <A NAME="10940">.</A>The description of this request is on <A HREF="#21625">page 13</A>.
<P>

<H4><A NAME="MMM33">       LbxModifySequence
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    6                                     lbx opcode
<P>       2    2                                     request length
<P>       4    CARD32                                offset to sequence number
</UL>
       <A NAME="11897">.</A>The description of this request is on <A HREF="#36693">page 14</A>.
<P>

<H4><A NAME="MMM34">       LbxAllowMotion
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    7                                     lbx opcode
<P>       2    2                                     request length
<P>       4    CARD32                                number of MotionNotify events
</UL>
       <A NAME="38053">.</A>The description of this request is on <A HREF="#15895">page 14</A>.
<P>

<H4><A NAME="MMM35">       LbxIncrementPixel
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    8                                     lbx opcode
<P>       2    3                                     request length
<P>       4    COLORMAP                              colormap
<P>       4    CARD32                                pixel
</UL>
       <A NAME="39838">.</A>The description of this request is on <A HREF="#27227">page 18</A>.
<P>

<H4><A NAME="MMM36">       LbxDelta
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    9                                     lbx opcode
<P>       2    1+(2n +p+2)/4                         request length
<P>       1    n                                     count of diffs
<P>       1    CARD8                                 cache index
<P>       2n   LISTofDIFFITEM                        offsets and differences
<P>       p                                          unused, p=pad(2n + 2)
</UL>
       The description of this request is on <A HREF="#26857">page 18</A>.
<P>

<H4>       <A NAME="40057">LbxGetModifierMapping</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    10                                    lbx opcode
<P>       2    1                                     request length
</UL>
<P>     -->
<UL>
<P>       1    1                                     Reply
<P>       1    n                                     keycodes-per-modifier
<P>       2    CARD16                                sequence number
<P>       4    2n                                    reply length
<P>       4    CARD32                                tag
<P>       20                                         unused
<P>       8n   LISTofKEYCODE                         keycodes
</UL>
       The description of this request is on <A HREF="#37687">page 18</A>.
<P>

<H4>       <A NAME="37545">LbxInvalidateTag</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    12                                    lbx opcode
<P>       2    2                                     request length
<P>       4    CARD32                                tag
</UL>
       The description of this request is on <A HREF="#12515">page 14</A>.
<P>

<H4>       <A NAME="29719">LbxPolyPoint</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    13                                    lbx opcode
<P>       2    1+(m+n+p)/4                           request length
<P>       m    LBXGCANDDRAWABLE                      cache entries
<P>       n    LISTofLBXPOINT                        points (n is data-dependent)
<P>       p    0                                     unused, p=Lpad
</UL>
       <A NAME="31086">.</A>The description of this request is on <A HREF="#37179">page 21</A>.
<P>

<H4><A NAME="MMM37">       LbxPolyLine
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    14                                    lbx opcode
<P>       2    1+(m+n+p)/4                           request length
<P>       m    LBXGCANDDRAWABLE                      cache entries
<P>       n    LISTofLBXPOINT                        points (n is data-dependent)
<P>       p    0                                     unused, p=Lpad
</UL>
       The description of this request is on <A HREF="#16574">page 21</A>.
<P>

<H4>       <A NAME="27528">LbxPolySegment</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    15                                    lbx opcode
<P>       2    1+(m+n+p)/4                           request length
<P>       m    LBXGCANDDRAWABLE                      cache entries
<P>       n    LISTofLBXSEGMENT                      segments (n is data-dependent)
<P>       p    0                                     unused, p=Lpad
</UL>
       <A NAME="33628">.</A>The description of this request is on <A HREF="#26077">page 22</A>.
<P>

<H4><A NAME="MMM38">       LbxPolyRectangle
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    16                                    lbx opcode
<P>       2    1+(m+n+p)/4                           request length 
<P>       m    LBXGCANDDRAWABLE                      cache entries
<P>       n    LISTofLBXRECTANGLE                    rectangles (n is data-dependent)
<P>       p    0                                     unused, p=pad(m+n)
</UL>
       The description of this request is on <A HREF="#40958">page 22</A>.
<P>

<H4>       <A NAME="25855">LbxPolyArc</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    17                                    lbx opcode
<P>       2    1+(m+n+p)/4                           request length 
<P>       m    LBXGCANDDRAWABLE                      cache entries
<P>       n    LISTofLBXARCS                         arcs (n is data-dependent)
<P>       p    0                                     unused, p=Lpad
</UL>
       The description of this request is on <A HREF="#15317">page 22</A>.
<P>

<H4>       <A NAME="24998">LbxFillPoly</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    18                                    lbx opcode
<P>       2    1+(3+m+n+p)/4                         request length
<P>       1    LBXGCANDDRAWENT                       cache entries
<P>       1                                          shape
<UL>
<P>            0    Complex
<P>            1    Nonconvex
<P>            2    Convex
</UL>
<P>       1    p                                     pad byte count
<P>       m    LBXGCANDDRAWUPDATE                    optional gc and drawable
<P>       n    LISTofLBXPOINT                        points (n is data-dependent)
<P>       p    0                                     unused, p=Lpad
</UL>
       The description of this request is on <A HREF="#35796">page 23</A>.
<P>

<H4>       <A NAME="26399">LbxPolyFillRectangle</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    19                                    lbx opcode
<P>       2    1+(m+n+p)/4                           request length
<P>       m    LBXGCANDDRAWABLE                      cache entries
<P>       n    LISTofLBXRECTANGLE                    rectangles (n is data-dependent)
<P>       p    0                                     unused, p=Lpad
</UL>
       <A NAME="19081">.</A>The description of this request is on <A HREF="#25511">page 22</A>.
<P>

<H4><A NAME="MMM39">       LbxPolyFillArc
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    20                                    lbx opcode
<P>       2    1+(m+n+p)/4                           request length
<P>       m    LBXGCANDDRAWABLE                      cache entries
<P>       n    LISTofLBXARC                          arcs (n is data-dependent)
<P>       p    0                                     unused, p=Lpad
</UL>
       The description of this request is on <A HREF="#42698">page 23</A>.
<P>

<H4>       <A NAME="21702">LbxGetKeyboardMapping</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    21                                    lbx opcode
<P>       2    2                                     request length
<P>       1    KEYCODE                               first keycode
<P>       1    m                                     count
<P>       2                                          unused
</UL>
<P>     -->
<UL>
<P>       1    1                                     Reply
<P>       1    n                                     keysyms-per-keycode
<P>       2    CARD16                                sequence number
<P>       4    nm                                    reply length (m = count field from the request)
<P>       4    CARD32                                tag
<P>       20                                         unused
<P>       4nm  LISTofKEYSYM                          keysyms
</UL>
       The description of this request is on <A HREF="#33719">page 18</A>.
<P>

<H4>       <A NAME="24597">LbxQueryFont</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    22                                    lbx opcode
<P>       2    2                                     request length
<P>       4    FONTABLE                              font
</UL>
<P>     -->
<UL>
<P>       1    1                                     Reply
<P>       1    BOOL                                  compression
<P>       2    CARD16                                sequence number
<P>       4    L                                     reply length
<P>       4    CARD32                                tag
<P>       20                                         unused
<P>       All of the following is conditional:
<P>       12   CHARINFO                              min-bounds
<P>       4                                          unused
<P>       12   CHARINFO                              max-bounds
<P>       4                                          unused
<P>       2    CARD16                                min-char-or-byte2
<P>       2    CARD16                                max-char-or-byte2
<P>       2    CARD16                                default-char
<P>       2    n                                     number of FONTPROPs in properties
<P>       1                                          draw-direction
<UL>
<P>            0    LeftToRight
<P>            1    RightToLeft
</UL>
<P>       1    CARD8                                 min-byte1
<P>       1    CARD8                                 max-byte1
<P>       1    BOOL                                  all-chars-exist
<P>       2    INT16                                 font-ascent
<P>       2    INT16                                 font-descent
<P>       4    m                                     number of elements in char-infos
<P>       8n   LISTofFONTPROP                        properties
<P>       and either
<P>       12m  LISTofCHARINFO                        char-infos
<P>       or
<P>       m    LISTofLBXCHARINFO                     char-infos
</UL>
       The description of this request is on <A HREF="#18818">page 19</A>.
<P>

<H4>       <A NAME="18013">LbxChangeProperty</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    23                                    lbx opcode
<P>       2    6                                     request length
<P>       4    WINDOW                                window
<P>       4    ATOM                                  property
<P>       4    ATOM                                  type
<P>       1    CARD8                                 format
<P>       1                                          mode
<UL>
<P>            0    Replace
<P>            1    Preprend
<P>            2    Append
</UL>
<P>       2                                          unused
<P>       4    CARD32                                length of data in format units
<P>                                                  (= n for format = 8)
<P>                                                  (= n/2 for format = 16)
<P>                                                  (= n/4 for format = 32)
</UL>
<P>     -->
<UL>
<P>       1    1                                     Reply
<P>       1                                          unused
<P>       2    CARD16                                sequence number
<P>       4    0                                     reply length
<P>       4    CARD32                                tag
<P>       20                                         unused
</UL>
       The description of this request is on <A HREF="#40098">page 20</A>.
<P>

<H4>       <A NAME="13863">LbxGetProperty</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    24                                    lbx opcode
<P>       2    7                                     request length
<P>       4    WINDOW                                window
<P>       4    ATOM                                  property
<P>       4    ATOM                                  type
<UL>
<P>            0    AnyPropertyType
</UL>
<P>       1    CARD8                                 delete
<P>       3                                          unused
<P>       4    CARD32                                long-offset
<P>       4    CARD32                                long-length
</UL>
<P>     -->
<UL>
<P>       1    1                                     Reply
<P>       1    CARD8                                 format
<P>       2    CARD16                                sequence number
<P>       4    CARD32                                reply length
<P>       4    ATOM                                  type
<UL>
<P>            0    None
</UL>
<P>       4    CARD32                                bytes-after
<P>       4    CARD32                                length of value in format units
<P>                                                  (= 0 for format = 0)
<P>                                                  (= n for format = 8)
<P>                                                  (= n/2 for format = 16)
<P>                                                  (= n/4 for format = 32)
<P>       4    CARD32                                tag
<P>       8                                          unused
</UL>
       The description of this request is on <A HREF="#31397">page 20</A>.
<P>

<H4>       <A NAME="37174">LbxTagData</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    25                                    lbx opcode
<P>       2    3+(n+p)/4                             request length
<P>       4    CARD32                                tag
<P>       4    CARD32                                length of data in bytes
<P>       n    LISTofBYTE                            data
<P>       p                                          unused, p=pad(n)
</UL>
       The description of this request is on <A HREF="#17987">page 14</A>.
<P>

<H4>       <A NAME="10231">LbxCopyArea</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    26                                    lbx opcode
<P>       2    L                                     request length
<P>       1    CARD8                                 source drawable cache entry
<P>       1    LBXGCANDDRAWENT                       cache entries
<P>       4 or 0 DRAWABLE                            optional source drawable
<P>       b    LBXGCANDDRAWUPDATE                    optional gc and dest drawable
<P>       c    LBXPINT16                             src-x
<P>       d    LBXPINT16                             src-y
<P>       e    LBXPINT16                             dst-x
<P>       f    LBXPINT16                             dst-y
<P>       g    LBXCARD16                             width
<P>       h    LBXCARD16                             height
<P>       p                                          unused, p=Lpad
</UL>
       The description of this request is on <A HREF="#11409">page 23</A>.
<P>

<H4>       <A NAME="18847">LbxCopyPlane</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    27                                    lbx opcode
<P>       2    L                                     request length
<P>       4    CARD32                                bit plane
<P>       1    CARD8                                 source drawable cache entry
<P>       1    LBXGCANDDRAWENT                       cache entries
<P>       4 or 0 DRAWABLE                            optional source drawable
<P>       b    LBXGCANDDRAWUPDATE                    optional gc and dest drawable
<P>       c    LBXPINT16                             src-x
<P>       d    LBXPINT16                             src-y
<P>       e    LBXPINT16                             dst-x
<P>       f    LBXPINT16                             dst-y
<P>       g    LBXCARD16                             width
<P>       h    LBXCARD16                             height
<P>       p                                          unused, p=Lpad
</UL>
       <A NAME="39640">.</A>The description of this request is on <A HREF="#36772">page 23</A>.
<P>

<H4><A NAME="MMM40">       LbxPolyText8
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    28                                    lbx opcode
<P>       2    L                                     request length
<P>       1    LBXGCANDDRAWENT                       cache entries
<P>       a    LBXGCANDDRAWUPDATE                    optional gc and drawable
<P>       b    LBXPINT16                             x
<P>       c    LBXPINT16                             y
<P>       n    LISTofTEXTITEM8                       items
<P>       p                                          unused, p=Lpad
</UL>
       <A NAME="32634">.</A>The description of this request is on <A HREF="#23201">page 24</A>.
<P>

<H4><A NAME="MMM41">       LbxPolyText16
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    29                                    lbx opcode
<P>       2    L                                     request length
<P>       1    LBXGCANDDRAWENT                       cache entries
<P>       a    LBXGCANDDRAWUPDATE                    optional gc and drawable
<P>       b    LBXPINT16                             x
<P>       c    LBXPINT16                             y
<P>       2n   LISTofTEXTITEM16                      items
<P>       p                                          unused, p=Lpad
</UL>
       <A NAME="17018">.</A>The description of this request is on <A HREF="#13228">page 24</A>.
<P>

<H4><A NAME="MMM42">       LbxImageText8
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    30                                    lbx opcode
<P>       2    L                                     request length
<P>       1    LBXGCANDDRAWENT                       cache entries
<P>       a    LBXGCANDDRAWUPDATE                    optional gc and drawable
<P>       b    LBXPINT16                             x
<P>       c    LBXPINT16                             y
<P>       n    STRING8                               string
<P>       p                                          unused, p=Lpad
</UL>
       <A NAME="23910">.</A>The description of this request is on <A HREF="#10990">page 24</A>.
<P>

<H4><A NAME="MMM43">       LbxImageText16
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    31                                    lbx opcode
<P>       2    L                                     request length
<P>       1    LBXGCANDDRAWENT                       cache entries
<P>       a    LBXGCANDDRAWUPDATE                    optional gc and drawable
<P>       b    LBXPINT16                             x
<P>       c    LBXPINT16                             y
<P>       2n   STRING16                              string
<P>       p                                          unused, p=Lpad
</UL>
       The description of this request is on <A HREF="#39584">page 25</A>.
<P>

<H4>       <A NAME="37117">LbxQueryExtension</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    32                                    lbx opcode
<P>       2    2+(n+p)/4                             request length
<P>       4    n                                     length of extension name
<P>       n    STRING8                               extension name
<P>       p                                          unused, p=pad(n)
</UL>
<P>     -->
<UL>
<P>       1    1                                     Reply
<P>       1    n                                     number of requests in the extension
<P>       2    CARD16                                sequence number
<P>       4    0 or 2*(m + p)                        reply length, m = (n+7)/8
<P>       1    BOOL                                  present
<P>       1    CARD8                                 major opcode
<P>       1    CARD8                                 first event
<P>       1    CARD8                                 first error
<P>       20                                         unused
<P>       m    LISTofMASK                            optional reply-mask
<P>       p                                          unused, p=pad(m)
<P>       m    LISTofMASK                            optional event-mask
<P>       p                                          unused, p=pad(m)
</UL>
       The description of this request is on <A HREF="#36662">page 9</A>.
<P>

<H4>       <A NAME="12268">LbxPutImage</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    33                                    lbx opcode
<P>       2    L                                     request length
<P>       1    CARD8                                 compression method
<P>       1    LBXGCANDDRAWENT                       cache entries
<P>       a    PIPACKED                               bit-packed
<P>       b    LBXGCANDDRAWUPDATE                    optional gc and drawable
<P>       c    LBXCARD16                             width
<P>       d    LBXCARD16                             height
<P>       e    LBXPINT16                             x
<P>       f    LBXPINT16                             y
<P>       n    LISTofBYTE                            compressed image data
<P>       p                                          unused, p=Lpad
</UL>
       If there is no left padding and the depth is less than or equal to nine, PIPPACKED is encoded as follows:
<P>

<UL>
<P>       PIPACKED
<P>       1    #x80 | (format &lt;&lt; 5) | ((depth -1) &lt;&lt; 2)
</UL>
       Otherwise PIPACKED is defined as:
<P>

<UL>
<P>       PIPACKED
<P>       1    (depth -1) &lt;&lt; 2)
<P>       1    (format &lt;&lt; 5) | left-pad
</UL>
       The description of this request is on <A HREF="#21218">page 25</A>.
<P>

<H4>       <A NAME="10066">LbxGetImage</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    34                                    lbx opcode
<P>       2    6                                     request length
<P>       4    DRAWABLE                              drawable
<P>       2    INT16                                 x
<P>       2    INT16                                 y
<P>       2    CARD16                                width
<P>       2    CARD16                                height
<P>       4    CARD32                                plane mask
<P>       1    CARD8                                 format
<P>       3                                          unused
</UL>
<P>     -->
<UL>
<P>       1    1                                     Reply
<P>       1    CARD8                                 depth
<P>       2    CARD16                                sequence number
<P>       4    (n+p)/4                               reply length
<P>       4    (m+p)/4                               X reply length; if uncompressed, m=n
<P>       4    VISUALID                              visual
<UL>
<P>            0    None
</UL>
<P>       1                                          compression method
<P>       15                                         unused
<P>       n    LISTofBYTE                            data
<P>       p                                          unused, p=pad(n)
</UL>
       <A NAME="22013">.</A>The description of this request is on <A HREF="#26896">page 25</A>.
<P>

<H4><A NAME="MMM44">       LbxBeginLargeRequest
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    35                                    lbx opcode
<P>       2    2                                     request length
<P>       4    CARD32                                large request length
</UL>
       <A NAME="31469">.</A>The description of this request is on <A HREF="#31209">page 26</A>.
<P>

<H4><A NAME="MMM45">       LbxLargeRequestData
</A></H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    36                                    lbx opcode
<P>       2    1+n                                   request length
<P>       4n   LISTofBYTE                            data
</UL>
       The description of this request is on <A HREF="#36982">page 26</A>.
<P>

<H4>       <A NAME="31037">LbxEndLargeRequest</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    37                                    lbx opcode
<P>       2    1                                     request length
</UL>
       The description of this request is on <A HREF="#31841">page 26</A>.
<P>

<H4>       <A NAME="34140">LbxInternAtoms</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    38                                    lbx opcode
<P>       2    1+(2+m+n+p)/4                         request length
<P>       2    m                                     num-atoms
<P>       n    LISTofLONGSTR                         names
<P>       p                                          pad p=Lpad
</UL>
<P>     -->
<UL>
<P>       1    1                                     Reply
<P>       1                                          unused
<P>       2    CARD16                                sequence number
<P>       4    a                                     reply length, a = MAX(m - 6, 0)
<P>       4*m  LISTofATOM                            atoms
<P>       p                                          pad p = MAX(0, 4*(6 - m))
<P>       
<P>       LONGSTR
<P>       2    c                                     string length
<P>       c    STRING8                               string
</UL>
       The description of this request is on <A HREF="#21636">page 17</A>.
<P>

<H4>       <A NAME="41440">LbxGetWinAttrAndGeom</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    39                                    lbx opcode
<P>       2    2                                     request length
<P>       4    CARD32                                window id
</UL>
<P>     -->
<UL>
<P>       
<P>       1    1                                     Reply
<P>       1                                          backing store
<UL>
<P>            0    NotUseful
<P>            1    WhenMapped
<P>            2    Always
</UL>
<P>       2    CARD16                                sequence number
<P>       4    7                                     reply length
<P>       4    VISUALID                              visual id
<P>       2                                          class
<UL>
<P>            1    InputOutput
<P>            2    InputOnly
</UL>
<P>       1    BITGRAVITY                            bit gravity
<P>       1    WINGRAVITY                            window gravity
<P>       4    CARD32                                backing bit planes
<P>       4    CARD32                                backing pixel
<P>       1    BOOL                                  save under
<P>       1    BOOL                                  map installed 
<P>       1                                          map state
<UL>
<P>            0    Unmapped
<P>            1    Unviewable
<P>            2    Viewable
</UL>
<P>       1    BOOL                                  override
<P>       4    COLORMAP                              colormap
<P>       4    SETofEVENT                            all events mask
<P>       4    SETofEVENT                            your event mask
<P>       2    SETofDEVICEEVENT                      do not propagate mask
<P>       2                                          unused
<P>       4    WINDOW                                root
<P>       2    INT16                                 x
<P>       2    INT16                                 y
<P>       2    CARD16                                width
<P>       2    CARD16                                height
<P>       2    CARD16                                border width
<P>       1    CARD8                                 depth
<P>       1                                          unused
</UL>
       The description of this request is on <A HREF="#39382">page 19</A>.
<P>

<H4>       <A NAME="17198">LbxGrabCmap</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    40                                    lbx opcode
<P>       2    2                                     request length
<P>       4    COLORMAP                              colormap
</UL>
<P>     -->
       If smart-grab is true, the reply is as follows:
<P>

<UL>
<P>       1    1                                     Reply
<P>       1    #x80                                  flags
<P>       2    CARD16                                sequence number
<P>       4    0                                     reply length
<P>       24                                         unused 
<P>       
<P>       If smart-grab is false, the reply is as follows:
<P>       
<P>       1    1                                     Reply
<P>       1                                          flags (set of)
<UL>
<P>            #x40 auto-release
<P>            #x20 three-channels
<P>            #x10 two-byte-pixels
<P>            lower four bits specifies bits-per-pixel
</UL>
<P>       2    CARD16                                sequence number
<P>       4    L                                     reply length
<P>       m    CHAN or CHANNELS                      cells (CHAN if !three-channels)
<P>       p    0                                     pad(m)
<P>       
<P>       CHANNELS
<P>       a    CHAN                                  red
<P>       1    5                                      next channel
<P>       b    CHAN                                  green
<P>       1    5                                     next channel
<P>       c    CHAN                                  blue
<P>       1    0                                     list end
<P>       
<P>       CHAN
<P>       d    LISTofLBXPIXEL                        
<P>       
<P>       LBXPIXEL
<P>       e    PIXELPRIVATE or 
<P>            PIXELPRIVATERANGE or 
<P>            PIXELALLOC or 
<P>            PIXELALLOCRANGE
<P>       
<P>       PIXELPRIVATE
<P>       1    1                                     pixel-private
<P>       f    PIXEL                                 pixel
<P>       
<P>       PIXEL
<P>       f    CARD8 or CARD16                       (CARD8 if !two-byte-pixels)
<P>       
<P>       PIXELPRIVATERANGE
<P>       1    2                                     pixel-private-range
<P>       f    PIXEL                                 fist-pixel
<P>       f    PIXEL                                 last-pixel
<P>       
<P>       PIXELALLOC
<P>       1    3                                     pixel-private
<P>       f    PIXEL                                 pixel
<P>       g    COLORSINGLE or COLORTRIPLE            color  (COLORSINGLE if three-channels)
<P>       
<P>       COLORSINGLE
<P>       h    CARD8 or CARD16                       value (CARD8  if bits-per-rgb =&lt; 7)
<P>       
<P>       COLORTRIPLE
<P>       h    COLORSINGLE                           red
<P>       h    COLORSINGLE                           green
<P>       h    COLORSINGLE                           blue
<P>       
<P>       PIXELALLOCRANGE
<P>       1    4                                     pixel-private
<P>       f    PIXEL                                 first-pixel
<P>       f    PIXEL                                 last-pixel
<P>       j    LISTofCOLORSINGLE or                  color  (COLORSINGLE if three-channels)
<P>            LISTofCOLORTRIPLE
</UL>
       The description of this request is on <A HREF="#10922">page 15</A>.
<P>

<H4>       <A NAME="14796">LbxReleaseCmap</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    41                                    lbx opcode
<P>       2    2                                     request length
<P>       4    COLORMAP                              cmap
</UL>
       The description of this request is on <A HREF="#34675">page 17</A>.
<P>

<H4>       <A NAME="28429">LbxAllocColor</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    42                                    lbx opcode
<P>       2    5                                     request length
<P>       4    COLORMAP                              colormap
<P>       4    CARD32                                pixel
<P>       2    CARD16                                red
<P>       2    CARD16                                green
<P>       2    CARD16                                 blue
<P>       2                                          unused
</UL>
       The description of this request is on <A HREF="#10446">page 17</A>.
<P>

<H4>       <A NAME="21186">LbxSync</A>
</H4>

<UL>
<P>       1    CARD8                                 opcode
<P>       1    43                                    lbx opcode
<P>       2    1                                     request length
</UL>
<P>     -->
<UL>
<P>       1    1                                     Reply
<P>       1    n                                     unused
<P>       2    CARD16                                sequence number
<P>       4    0                                     reply length
<P>       24                                         unused
</UL>
       The description of this request is on <A HREF="#30719">page 14</A>.
<P>

<H2><A NAME="MMM46">6.3    Events
</A></H2>

<H4>       <A NAME="17348">LbxSwitchEvent</A>
</H4>

<UL>
<P>       1    base + 0                              code
<P>       1    0                                     lbx type
<P>       2    CARD16                                sequence number
<P>       4    CARD32                                client
<P>       24                                         unused
</UL>
       <A NAME="41814">.</A>The description of this event is on <A HREF="#33748">page 27</A>.
<P>

<H4><A NAME="MMM47">       LbxCloseEvent
</A></H4>

<UL>
<P>       1    base + 0                              code
<P>       1    1                                     lbx type
<P>       2    CARD16                                sequence number
<P>       4    CARD32                                client
<P>       24                                         unused
</UL>
       The description of this event is on <A HREF="#17292">page 27</A>.
<P>

<H4>       <A NAME="34406">LbxInvalidateTagEvent</A>
</H4>

<UL>
<P>       1    base + 0                              code
<P>       1    3                                     lbx type
<P>       2    CARD16                                sequence number
<P>       4    CARD32                                tag
<P>       4                                          tag-type
<UL>
<P>            1    LbxTagTypeModmap
<P>            2    LbxTagTypeKeymap
<P>            3    LbxTagTypeProperty
<P>            4    LbxTagTypeFont
<P>            5    LbxTagTypeConnInfo
</UL>
<P>       20                                         unused
</UL>
       The description of this event is on <A HREF="#23016">page 27</A>.
<P>

<H4>       <A NAME="22353">LbxSendTagDataEvent</A>
</H4>

<UL>
<P>       1    base + 0                              code
<P>       1    4                                     lbx type
<P>       2    CARD16                                sequence number
<P>       4    CARD32                                tag
<P>       4                                          tag-type
<UL>
<P>            3    LbxTagTypeProperty
</UL>
<P>       20                                         unused
</UL>
       <A NAME="18630">.</A>The description of this event is on <A HREF="#20373">page 27</A>.
<P>

<H4><A NAME="MMM48">       LbxListenToOne
</A></H4>

<UL>
<P>       1    base + 0                              code
<P>       1    5                                     lbx type
<P>       2    CARD16                                sequence number
<P>       4    CARD32                                client
<UL>
<P>            #xFFFFFFFF      a client not managed by the proxy
</UL>
<P>       24                                         unused
</UL>
       <A NAME="30610">.</A>The description of this event is on <A HREF="#25209">page 27</A>.
<P>

<H4><A NAME="MMM49">       LbxListenToAll
</A></H4>

<UL>
<P>       1    base + 0                              code
<P>       1    6                                     lbx type
<P>       2    CARD16                                sequence number
<P>       28                                         unused
</UL>
       The description of this event is on <A HREF="#11095">page 28</A>.
<P>

<H4>       Lbx<A NAME="35213">QuickMotionDeltaEvent</A>
</H4>

<UL>
<P>       1    base + 1                              code
<P>       1    CARD8                                 delta-time
<P>       1    INT8                                  delta-x
<P>       1    INT8                                  delta-y
</UL>
       This event is not padded to 32 bytes.
<P>

       The description of this event is on <A HREF="#40268">page 28</A>.
<P>

<H4>       <A NAME="35310">LbxMotionDeltaEvent</A>
</H4>

<UL>
<P>       1    base + 0                              code
<P>       1    7                                       lbx type
<P>       1    INT8                                  delta-x
<P>       1    INT8                                  delta-y
<P>       2    CARD16                                delta-time
<P>       2    CARD16                                delta-sequence
</UL>
       This event is not padded to 32 bytes.
<P>

       The description of this event is on <A HREF="#30033">page 28</A>.
<P>

<H4>       <A NAME="14052">LbxReleaseCmapEvent</A>
</H4>

<UL>
<P>       1    base + 0                              code
<P>       1    8                                       lbx type
<P>       2    CARD16                                sequence number
<P>       4    COLORMAP                              colormap
<P>       24                                         unused
</UL>
       The description of this event is on <A HREF="#19129">page 28</A>.
<P>

<H4>       <A NAME="14731">LbxFreeCellsEvent</A>
</H4>

<UL>
<P>       1    base + 0                              code
<P>       1    9                                       lbx type
<P>       2    CARD16                                sequence number
<P>       4    COLORMAP                              colormap
<P>       4    PIXEL                                 pixel start
<P>       4    PIXEL                                 pixel end
<P>       16                                         unused
</UL>
       The description of this event is on <A HREF="#38041">page 28</A>.
<P>

<H2><A NAME="MMM50">6.4    Re-encoding of X Events
</A></H2>

       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.
<P>

       LBX reencodes X event representations into the following sizes, if squishing is enabled:
<P>

<PRE>       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
</PRE>

<H2><A NAME="MMM51">6.5    Responses
</A></H2>

<H4>       <A NAME="17100">LbxDeltaResponse</A>
</H4>

<UL>
<P>       1    event_base + 0                        event code
<P>       1    2                                     lbx type
<P>       2    1+(2+2n+p)/4                          request length
<P>       1    n                                     count of diffs
<P>       1    CARD8                                 cache index
<P>       2n   LISTofDIFFITEM                        offsets and differences
<P>       p                                          unused, p=pad(2n)
</UL>
       The description of this response is on <A HREF="#34042">page 29</A>.
<P>