125b89263Smrg<?xml version="1.0" encoding="UTF-8" ?>
206f32fbeSmrg<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
306f32fbeSmrg                   "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
406f32fbeSmrg[
506f32fbeSmrg<!ENTITY % defs SYSTEM "defs.ent"> %defs;
606f32fbeSmrg]>
725b89263Smrg
825b89263Smrg
925b89263Smrg<!-- lifted from troff+ms+XMan by doclifter -->
1025b89263Smrg<book id="recordlib">
1125b89263Smrg
1225b89263Smrg<bookinfo>
1325b89263Smrg   <title>X Record Extension Library</title>
1425b89263Smrg   <subtitle>X Consortium Standard</subtitle>
1506f32fbeSmrg   <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
1606f32fbeSmrg   <releaseinfo>Version 1.13</releaseinfo>
1725b89263Smrg   <authorgroup>
1825b89263Smrg      <author>
1925b89263Smrg         <firstname>Martha</firstname><surname>Zimet</surname>
2006f32fbeSmrg         <affiliation><orgname>Network Computing Devices, Inc.</orgname></affiliation>
2125b89263Smrg      </author>
2206f32fbeSmrg      <editor>
2325b89263Smrg         <firstname>Stephen</firstname><surname>Gildea</surname>
2425b89263Smrg         <affiliation><orgname>X Consortium</orgname></affiliation>
2506f32fbeSmrg      </editor>
2606f32fbeSmrg   </authorgroup>
2706f32fbeSmrg   <copyright><year>1994</year><holder>Network Computing Devices, Inc.</holder></copyright>
2825b89263Smrg
2925b89263Smrg<legalnotice>
3025b89263Smrg<para>
3125b89263SmrgPermission to use, copy, modify, distribute, and sell this
3225b89263Smrgdocumentation for any purpose is hereby granted without fee,
3325b89263Smrgprovided that the above copyright notice and this permission
3425b89263Smrgnotice appear in all copies.  Network Computing Devices, Inc.
3525b89263Smrgmakes no representations about the suitability for any purpose
3625b89263Smrgof the information in this document.  This documentation is
3725b89263Smrgprovided "as is" without express or implied warranty.
3825b89263Smrg</para>
3906f32fbeSmrg</legalnotice>
4025b89263Smrg
4106f32fbeSmrg<legalnotice>
4206f32fbeSmrg<para role="multiLicensing">Copyright © 1995 X Consortium</para>
4325b89263Smrg<para>
4425b89263SmrgPermission is hereby granted, free of charge, to any person obtaining
4525b89263Smrga copy of this software and associated documentation files
4606f32fbeSmrg(the &ldquo;Software&rdquo;), to deal in the Software without
4725b89263Smrgrestriction, including without limitation the rights to use, copy,
4825b89263Smrgmodify, merge, publish, distribute, sublicense, and/or sell copies of
4925b89263Smrgthe Software, and to permit persons to whom the Software is furnished
5025b89263Smrgto do so, subject to the following conditions:
5125b89263Smrg</para>
5206f32fbeSmrg<para>THE SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo;, WITHOUT WARRANTY OF ANY KIND,
5325b89263SmrgEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
5425b89263SmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
5525b89263SmrgIN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
5625b89263SmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
5725b89263SmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
5825b89263SmrgOTHER DEALINGS IN THE SOFTWARE.
5925b89263Smrg</para>
6025b89263Smrg<para>
6125b89263SmrgExcept as contained in this notice, the name of the X Consortium shall
6225b89263Smrgnot be used in advertising or otherwise to promote the sale, use or other
6325b89263Smrgdealings in this Software without prior written authorization from the
6425b89263SmrgX Consortium.
6525b89263Smrg</para>
6625b89263Smrg<para>X Window System is a trademark of The Open Group.</para>
6725b89263Smrg</legalnotice>
6825b89263Smrg</bookinfo>
6925b89263Smrg
7006f32fbeSmrg<chapter id='Record_Extension_Overview'>
7125b89263Smrg<title>Record Extension Overview</title>
7225b89263Smrg<para>
7325b89263SmrgThe purpose of this extension is to support the recording and reporting of
7425b89263Smrgall core X protocol and arbitrary X extension protocol. This first section
7525b89263Smrggives an overview of the Record extension. The following sections describe
7625b89263Smrghow to use the Record extension library.
7725b89263Smrg</para>
7825b89263Smrg
7906f32fbeSmrg<sect1 id='Synchronous_Playback'>
8025b89263Smrg<title>Synchronous Playback</title>
8125b89263Smrg<para>
8225b89263SmrgEnvironment information is generally provided to an X-based playback
8325b89263Smrgmechanism, which might use the XTest extension to synthesize input
8425b89263Smrgevents. This synchronization information defines the X state prior to
8525b89263Smrgevent synthesis (for example, location of the cursor, window locations
8625b89263Smrgand sizes, installed colormap, window manager running, and so on) and
8725b89263Smrgthe consequences that occur after the playback mechanism synthesizes
8825b89263Smrgthe event. If the user moves the mouse into the icon window and presses
8925b89263Smrgand releases a mouse button, the device events
9025b89263Smrg<function>MotionNotify</function>, <function>ButtonPress</function>,
9125b89263Smrgand <function>ButtonRelease</function> are generated by the X server.
9225b89263SmrgBecause X follows an
9325b89263Smrgevent-driven model, there are consequences that follow from the user
9425b89263Smrgactions, or device events, that are in the form of X protocol. As a result
9525b89263Smrgof the previous user actions, the client could generate requests such as
9625b89263Smrg<function>ImageText8</function> and <function>PolyLine</function> to the
9725b89263SmrgX server, or the X server could send non-device events such as
9825b89263Smrg<function>Expose</function> and <function>MapNotify</function> to the
9925b89263Smrgclient window. Both the
10025b89263Smrgrequests and non-device events that result from user actions are known
10125b89263Smrgas consequences, which can be used as a synchronization, or control point,
10225b89263Smrgduring playback. That is, the playback mechanism does not generate a specific
10325b89263Smrgsynthesized event until its matching synchronization condition occurs
10425b89263Smrg(for example, the window is mapped or unmapped, the cursor changes, a text
10525b89263Smrgstring displays, and so on)
10625b89263Smrg</para>
10725b89263Smrg<para>
10825b89263SmrgBecause it cannot be predicted what synchronization information is required
10925b89263Smrgduring playback, the Record extension makes no assumptions about the intended
11025b89263Smrguse of the recorded data. Facilities exist to record any core X protocol or
11125b89263SmrgX extension protocol. Therefore, Record does not enforce a specific
11225b89263Smrgsynchronization methodology.
11325b89263Smrg</para>
11425b89263Smrg</sect1>
11525b89263Smrg
11606f32fbeSmrg<sect1 id='Design_Approach'>
11725b89263Smrg<title>Design Approach</title>
11825b89263Smrg<para>
11925b89263SmrgThe design approach of the extension is to record core X protocol and
12025b89263Smrgarbitrary X extension protocol entirely within the X server itself. When
12125b89263Smrgthe extension has been requested to record specific protocol by one or more
12225b89263Smrgrecording clients, the protocol data is formatted and returned to the
12325b89263Smrgrecording clients. The extension provides a mechanism for capturing all
12425b89263Smrgevents, including input device events that do not go to any clients.
12525b89263Smrg</para>
12625b89263Smrg</sect1>
12725b89263Smrg
12806f32fbeSmrg<sect1 id='Record_Clients'>
12925b89263Smrg<title>Record Clients</title>
13025b89263Smrg<para>
13125b89263SmrgThe recommended communication model for a Record application is to open two
13225b89263Smrgconnections to the server—one connection for recording control and one
13325b89263Smrgconnection for reading recorded protocol data.
13425b89263Smrg</para>
13525b89263Smrg<para>
13625b89263SmrgInformation about recording (for example, what clients to record, what
13725b89263Smrgprotocol to record for each client, and so on) is stored in resources
13825b89263Smrgcalled record contexts (type <function>XRecordContext</function>). Most
13925b89263SmrgRecord extension functions take a record context as an argument. Although
14025b89263Smrgin theory it is possible to share record contexts between applications,
14125b89263Smrgit is expected that applications will use their own context when performing
14225b89263Smrgrecording operations.
14325b89263Smrg</para>
14425b89263Smrg<para>
14525b89263SmrgA client that wishes to record X protocol does so through the library
14625b89263Smrgfunctions defined in
14706f32fbeSmrg<xref linkend='Library_Extension_Requests' xrefstyle='select: title'/>
14825b89263SmrgA typical sequence of requests that a client would make is as follows:
14925b89263Smrg</para>
15025b89263Smrg<itemizedlist>
15125b89263Smrg  <listitem>
15225b89263Smrg    <para>
15306f32fbeSmrg<xref linkend='XRecordQueryVersion' xrefstyle='select: title'/>
15425b89263Smrg    </para>
15525b89263Smrg    <para>
15625b89263Smrgquery the extension protocol version.
15725b89263Smrg    </para>
15825b89263Smrg</listitem>
15925b89263Smrg<listitem>
16025b89263Smrg    <para>
16106f32fbeSmrg<xref linkend='XRecordCreateContext' xrefstyle='select: title'/>
16225b89263Smrg    </para>
16325b89263Smrg    <para>
16425b89263Smrgrequest that the server create a record context for access by this client,
16525b89263Smrgand express interest in clients and protocol to be recorded. This request
16625b89263Smrgreturns an <function>XRecord-Context</function>, which is an XID that is
16725b89263Smrgused by most other extension requests to identify the specified context.
16825b89263Smrg    </para>
16925b89263Smrg  </listitem>
17025b89263Smrg  <listitem>
17125b89263Smrg    <para>
17206f32fbeSmrg<xref linkend='XRecordEnableContext' xrefstyle='select: title'/>
17325b89263Smrg    </para>
17425b89263Smrg    <para>
17525b89263Smrgbegin the recording and reporting of protocol data.
17625b89263Smrg    </para>
17725b89263Smrg  </listitem>
17825b89263Smrg  <listitem>
17925b89263Smrg    <para>
18006f32fbeSmrg<xref linkend='XRecordDisableContext' xrefstyle='select: title'/>
18125b89263Smrg    </para>
18225b89263Smrg    <para>
18325b89263Smrgend the recording and reporting of protocol data.
18425b89263Smrg    </para>
18525b89263Smrg  </listitem>
18625b89263Smrg  <listitem>
18725b89263Smrg    <para>
18806f32fbeSmrg<xref linkend='XRecordFreeContext' xrefstyle='select: title'/>
18925b89263Smrg    </para>
19025b89263Smrg    <para>
19125b89263Smrgfree the record context.
19225b89263Smrg    </para>
19325b89263Smrg  </listitem>
19425b89263Smrg</itemizedlist>
19525b89263Smrg
19625b89263Smrg<para>
19725b89263SmrgThe header for this library is
19825b89263Smrg&lt;<function>X11/extensions/record.h</function>&gt;. All identifiers defined
19925b89263Smrgin the interface are supplied by this header and are prefixed with "XRecord".
20025b89263SmrgThe <function>Xtst</function> library contains the
20125b89263Smrg<function>XRecord</function> functions.
20225b89263Smrg</para>
20325b89263Smrg
20425b89263Smrg</sect1>
20525b89263Smrg</chapter>
20625b89263Smrg
20706f32fbeSmrg<chapter id='Common_Arguments'>
20825b89263Smrg<title>Common Arguments</title>
20925b89263Smrg<para>
21006f32fbeSmrgThe Record extension functions <xref linkend='XRecordCreateContext' xrefstyle='select: title'/>
21106f32fbeSmrg and <xref linkend='XRecordRegisterClients' xrefstyle='select: title'/> allow applications to
21225b89263Smrgspecify the following:
21325b89263Smrg</para>
21425b89263Smrg<itemizedlist>
21525b89263Smrg  <listitem>
21625b89263Smrg    <para>
21725b89263SmrgIndividual clients or sets of clients to record
21825b89263Smrg    </para>
21925b89263Smrg  </listitem>
22025b89263Smrg  <listitem>
22125b89263Smrg    <para>
22225b89263SmrgRanges of core X protocol and X extension protocol to record for each client
22325b89263Smrg    </para>
22425b89263Smrg  </listitem>
22525b89263Smrg</itemizedlist>
22625b89263Smrg<para>
22725b89263SmrgProtocol in the ranges specified by the recording client will be recorded
22825b89263Smrgby the server. The device_events protocol type can be specified by a
22925b89263Smrgrecording client although it may not be sent to a recorded client. The
23025b89263Smrgdevice_events type differs from delivered_events, which also can be
23125b89263Smrgspecified by a recording client; delivered_events are actually delivered to
23225b89263Smrgone or more clients. These event types are discussed in
23306f32fbeSmrg<xref linkend='Protocol_Ranges' xrefstyle='select: title'/>
23425b89263Smrg</para>
23525b89263Smrg
23625b89263Smrg
23725b89263Smrg<para>
23806f32fbeSmrgThe Record extension functions <xref linkend='XRecordCreateContext' xrefstyle='select: title'/>
23906f32fbeSmrg and <xref linkend='XRecordRegisterClients' xrefstyle='select: title'/> have the common arguments
24025b89263Smrgdatum_flags, clients, and ranges, which specify whether server time
24125b89263Smrgand/or client sequence number should precede protocol elements, the
24225b89263Smrgclients or client set to record, and the protocol ranges to record,
24325b89263Smrgrespectively. These are discussed in the following sections.
24425b89263Smrg</para>
24525b89263Smrg
24606f32fbeSmrg<sect1 id='Datum_Flags'>
24725b89263Smrg<title>Datum Flags</title>
24825b89263Smrg<para>
24925b89263SmrgThe datum_flags argument is a set of flags OR’ed together to specify options
25025b89263Smrgfor the record context.  Specify zero to disable all the options.
25125b89263Smrg</para>
25225b89263Smrg
25325b89263Smrg<para>
25425b89263SmrgThe <function>XRecordFromServerTime</function> flag specifies that
25525b89263Smrg<function>XRecordInterceptData</function> structures with a category of
25625b89263Smrg<function>XRecordFromServer</function> will have a server_time field specific to each
25725b89263Smrgprotocol element.
25825b89263Smrg</para>
25925b89263Smrg
26025b89263Smrg<para>
26125b89263SmrgThe <function>XRecordFromClientTime</function> flag specifies that
26225b89263Smrg<function>XRecordInterceptData</function> structures with a category of
26325b89263Smrg<function>XRecordFromClient</function> will have a server_time field specific
26425b89263Smrgto each protocol element.
26525b89263Smrg</para>
26625b89263Smrg
26725b89263Smrg<para>
26825b89263SmrgThe <function>XRecordFromClientSequence</function> flag specifies that
26925b89263Smrg<function>XRecordInterceptData</function> structures with a category of
27025b89263Smrg<function>XRecordFromClient</function> or
27125b89263Smrg<function>XRecordClientDied</function> will have a valid client_seq field.
27225b89263Smrg</para>
27325b89263Smrg</sect1>
27425b89263Smrg
27506f32fbeSmrg<sect1 id='Selecting_Clients'>
27625b89263Smrg<title>Selecting Clients</title>
27725b89263Smrg
27825b89263Smrg<para>
27925b89263SmrgThe clients argument is a pointer to an array of
28025b89263Smrg<function>XRecordClientSpec</function>.
28125b89263Smrg<function>XRecordClientSpec</function> is an integral type that holds a
28225b89263Smrgresource ID, a client resource ID base, or one of the client set constants
28325b89263Smrgdefined below.
28425b89263Smrg</para>
28525b89263Smrg<para>
28625b89263SmrgDuplicate elements in the array are ignored by the functions, and if any
28725b89263Smrgelement in the array is not valid, a
28825b89263Smrg<function>BadMatch</function>
28925b89263Smrgerror results. A resource ID references the client that created that
29025b89263Smrgresource. The client set may be one of the following constants:
29125b89263Smrg<function>XRecordCurrentClients</function>,
29225b89263Smrg<function>XRecordFutureClients</function>, or
29325b89263Smrg<function>XRecordAllClients</function>.
29425b89263Smrg</para>
29525b89263Smrg<para>
29625b89263SmrgIf the element in the array identifies a particular client, protocol
29725b89263Smrgspecified by the ranges argument will be recorded by the server. The
29825b89263Smrgrecorded protocol data will not be returned to the recording client until
29925b89263Smrgthe record context has been enabled. This is described in
30006f32fbeSmrg<xref linkend='Data_Transfer' xrefstyle='select: title'/>
30125b89263Smrg</para>
30225b89263Smrg<para>
30325b89263SmrgIf the element is <function>XRecordCurrentClients</function>, the protocol
30425b89263Smrgranges specified by the ranges argument, except for device_events, are
30525b89263Smrgassociated with each current client connection. If the element is
30625b89263Smrg<function>XRecordFutureClients</function>, the
30725b89263Smrgprotocol ranges specified by the ranges argument are associated with each new
30825b89263Smrgclient connection. If the element is
30925b89263Smrg<function>XRecordAllClients</function>,
31025b89263Smrgthe protocol ranges specified by the ranges argument are associated with
31125b89263Smrgeach current client connection and with each new client connection.
31225b89263SmrgWhen the context is enabled, the data connection is unregistered if it
31325b89263Smrgwas registered. If the context is enabled,
31425b89263Smrg<function>XRecordCurrentClients</function> and
31525b89263Smrg<function>XRecordAllClients</function>
31625b89263Smrgsilently exclude the recording data connection. It is an error to explicitly
31725b89263Smrgregister the data connection.
31825b89263Smrg</para>
31925b89263Smrg</sect1>
32006f32fbeSmrg<sect1 id='Protocol_Ranges'>
32125b89263Smrg<title>Protocol Ranges</title>
32225b89263Smrg
32325b89263Smrg<para>
32406f32fbeSmrgThe functions <xref linkend='XRecordCreateContext' xrefstyle='select: title'/> and
32506f32fbeSmrg<xref linkend='XRecordRegisterClients' xrefstyle='select: title'/> have another common argument,
32625b89263Smrgranges, which is an array of pointers to <function>XRecordRange</function>
32725b89263Smrgstructures. Each structure contains ranges of numeric values for each of
32825b89263Smrgthe protocol types that can be specified and recorded individually by the
32925b89263SmrgRecord extension. An <function>XRecordRange</function> structure must be
33025b89263Smrgallocated by the Record library using the
33125b89263Smrg<function>XRecordAllocRange</function> function.
33225b89263Smrg</para>
33325b89263Smrg<para>
33425b89263SmrgThe <function>XRecordRange</function> typedef is a structure with the
33525b89263Smrgfollowing members:
33625b89263Smrg</para>
33725b89263Smrg
33825b89263Smrg<literallayout remap='Ds'>
33925b89263SmrgXRecordRange:
34025b89263Smrg     XRecordRange8 core_requests     /* core X requests */
34125b89263Smrg     XRecordRange8 core_replies      /* core X replies */
34225b89263Smrg     XRecordExtRange ext_requests    /* extension requests */
34325b89263Smrg     XRecordExtRange ext_replies     /* extension replies */
34425b89263Smrg     XRecordRange8 delivered_events  /* delivered core and ext events */
34525b89263Smrg     XRecordRange8 device_events     /* all core and ext device events */
34625b89263Smrg     XRecordRange8 errors            /* core X and X ext errors */
34725b89263Smrg     Bool client_started             /* connection setup reply from server */
34825b89263Smrg     Bool client_died                /* notification of client disconnect */
34925b89263Smrg</literallayout>
35025b89263Smrg
35125b89263Smrg<para>
35225b89263SmrgThe types used in
35325b89263Smrg<function>XRecordRange</function>
35425b89263Smrgmembers are defined as follows.  The
35525b89263Smrg<function>XRecordRange8</function>
35625b89263Smrgtypedef is a structure with the following members:
35725b89263Smrg</para>
35825b89263Smrg
35925b89263Smrg<literallayout remap='Ds'>
36025b89263SmrgXRecordRange8:
36125b89263Smrg     unsigned char first
36225b89263Smrg     unsigned char last
36325b89263Smrg</literallayout>
36425b89263Smrg
36525b89263Smrg<para>
36625b89263SmrgThe
36725b89263Smrg<function>XRecordRange16</function>
36825b89263Smrgtypedef is a structure with the following members:
36925b89263Smrg</para>
37025b89263Smrg
37125b89263Smrg<literallayout remap='Ds'>
37225b89263SmrgXRecordRange16:
37325b89263Smrg     unsigned short first
37425b89263Smrg     unsigned short last
37525b89263Smrg</literallayout>
37625b89263Smrg
37725b89263Smrg<para>
37825b89263SmrgThe
37925b89263Smrg<function>XRecordExtRange</function>
38025b89263Smrgtypedef is a structure with the following members:
38125b89263Smrg</para>
38225b89263Smrg
38325b89263Smrg<literallayout remap='Ds'>
38425b89263SmrgXRecordExtRange:
38525b89263Smrg     XRecordRange8  ext_major
38625b89263Smrg     XRecordRange16 ext_minor
38725b89263Smrg</literallayout>
38825b89263Smrg
38925b89263Smrg<para>
39025b89263SmrgIf any of the values specified in
39125b89263Smrg<function>XRecordRange</function>
39225b89263Smrgis invalid, a
39325b89263Smrg<function>BadValue</function>
39425b89263Smrgerror results.
39525b89263Smrg</para>
39625b89263Smrg
39725b89263Smrg<para>
39825b89263SmrgThe core_requests member specifies the range of core X protocol
39925b89263Smrgrequests to record.  Core X protocol requests with a major opcode
40025b89263Smrgthat is between first and last, inclusive, will be
40125b89263Smrgrecorded.  A
40225b89263Smrg<function>BadValue</function>
40325b89263Smrgerror results if the value of first is greater than the value of last.
40425b89263SmrgIf the values of both first and last are zero, no core
40525b89263SmrgX protocol requests will be recorded.
40625b89263Smrg</para>
40725b89263Smrg
40825b89263Smrg<para>
40925b89263SmrgThe core_replies member specifies the range of replies resulting
41025b89263Smrgfrom core X protocol requests to record.  Replies that result from
41125b89263Smrgcore X protocol requests with a major opcode between first
41225b89263Smrgand last, inclusive, will be recorded.  A
41325b89263Smrg<function>BadValue</function>
41425b89263Smrgerror results if the value of first is greater than the value of last.
41525b89263SmrgIf the values of both first and last are zero, no core X protocol
41625b89263Smrgreplies will be recorded.
41725b89263Smrg</para>
41825b89263Smrg
41925b89263Smrg<para>
42025b89263SmrgThe ext_requests member specifies the range of X extension
42125b89263Smrgrequests to record.  X extension requests with a major opcode
42225b89263Smrgbetween ext_major.first and ext_major.last, and with a
42325b89263Smrgminor opcode
42425b89263Smrgbetween ext_minor.first and ext_minor.last, inclusive, will be
42525b89263Smrgrecorded.  A
42625b89263Smrg<function>BadValue</function>
42725b89263Smrgerror results
42825b89263Smrgif the value of ext_major.first is greater than the value of
42925b89263Smrgext_major.last or if the value of ext_minor.first is
43025b89263Smrggreater than the value of ext_minor.last.  If the values of both
43125b89263Smrgext_major.first
43225b89263Smrgand ext_major.last are zero,
43325b89263Smrgno X extension requests will be recorded.
43425b89263Smrg</para>
43525b89263Smrg
43625b89263Smrg<para>
43725b89263SmrgThe ext_replies member specifies the range of replies resulting
43825b89263Smrgfrom X extension requests to record.  Replies that result from an X
43925b89263Smrgextension request with a major opcode between
44025b89263Smrgext_major.first and
44125b89263Smrgext_major.last, and a minor opcode that is between
44225b89263Smrgext_minor.first and ext_minor.last will be recorded.  A
44325b89263Smrg<function>BadValue</function>
44425b89263Smrgerror results
44525b89263Smrgif the value of ext_major.first is greater than the value of
44625b89263Smrgext_major.last or if the value of ext_minor.first is greater than
44725b89263Smrgthe value of ext_minor.last.  If the values of both
44825b89263Smrgext_major.first and ext_major.last are zero, no X extension
44925b89263Smrgreplies will be recorded.
45025b89263Smrg</para>
45125b89263Smrg
45225b89263Smrg<para>
45325b89263SmrgThe delivered_events member specifies the range of both core
45425b89263SmrgX events and X extension events to record.  These events are
45525b89263Smrgdelivered to at least one client.  Core X events and X extension events
45625b89263Smrgwith a code value between first and last inclusive will be recorded.  A
45725b89263Smrg<function>BadValue</function>
45825b89263Smrgerror results if the value of first is greater than the value of last.
45925b89263SmrgIf the values of first and last are zero, no events will be recorded.
46025b89263Smrg</para>
46125b89263Smrg
46225b89263Smrg<para>
46325b89263SmrgThe device_events member specifies the range of both core X device
46425b89263Smrgevents and X extension device events to record.  These events may or
46525b89263Smrgmay not be delivered to a client.  Core X device events and X extension
46625b89263Smrgdevice events with a code value between first and last inclusive that
46725b89263Smrgare not delivered to any clients will be recorded.  A
46825b89263Smrg<function>BadValue</function>
46925b89263Smrgerror results if the value of first is greater than the value of last.  A
47025b89263Smrg<function>BadValue</function>
47125b89263Smrgerror results if first is less than two or last is less than two, except
47225b89263Smrgthat if first and last are zero, no events will be recorded.
47325b89263Smrg</para>
47425b89263Smrg
47525b89263Smrg<para>
47625b89263SmrgThe errors member specifies the range of both core X errors and X
47725b89263Smrgextension errors to record.  Core X errors and X extension errors with
47825b89263Smrga code value between first and last inclusive will be
47925b89263Smrgrecorded.  A
48025b89263Smrg<function>BadValue</function>
48125b89263Smrgerror results if the value of first is greater than the value of last.
48225b89263SmrgIf the values of first and last are zero, no errors will be recorded.
48325b89263Smrg</para>
48425b89263Smrg
48525b89263Smrg<para>
48625b89263SmrgA value of
48725b89263Smrg<function>True</function>
48825b89263Smrgfor the client_started member specifies the
48925b89263Smrgconnection setup reply from the server to new clients.  If
49025b89263Smrg<function>False</function>
49125b89263Smrgthe connection setup reply is not specified by this
49225b89263Smrg<function>XRecordRange</function>
49325b89263Smrg</para>
49425b89263Smrg
49525b89263Smrg<para>
49625b89263SmrgA value of
49725b89263Smrg<function>True</function>
49825b89263Smrgfor the client_died member specifies
49925b89263Smrgnotification when a client disconnects.  If
50025b89263Smrg<function>False</function>
50125b89263Smrgnotification when a client disconnects is not specified by this
50225b89263Smrg<function>XRecordRange</function>
50325b89263Smrg</para>
50425b89263Smrg</sect1>
50525b89263Smrg</chapter>
50625b89263Smrg
50706f32fbeSmrg<chapter id='Library_Extension_Requests'>
50825b89263Smrg<title>Library Extension Requests</title>
50925b89263Smrg
51025b89263Smrg<para>
51125b89263SmrgRecording operations are accessed by programs through the use of
51225b89263Smrgnew protocol requests.  The following functions are provided as extensions
51325b89263Smrgto Xlib.  An Xlib error results if
51425b89263Smrgan extension request is made to an X server that does not support the
51525b89263SmrgRecord extension.  Note that any of the extension protocol requests may generate
51625b89263Smrg<function>BadAlloc</function>
51725b89263Smrgor
51825b89263Smrg<function>BadLength</function>
51925b89263Smrgerrors.
52025b89263Smrg</para>
52125b89263Smrg
52206f32fbeSmrg<sect1 id='Query_Extension_Version'>
52325b89263Smrg<title>Query Extension Version</title>
52425b89263Smrg
52525b89263Smrg<para>
52625b89263SmrgAn application uses the
52706f32fbeSmrg<xref linkend='XRecordQueryVersion' xrefstyle='select: title'/>
52825b89263Smrgfunction to determine
52925b89263Smrgthe version of the Record extension protocol supported by an X server.
53025b89263Smrg</para>
53125b89263Smrg
53206f32fbeSmrg<funcsynopsis id='XRecordQueryVersion'>
53325b89263Smrg<funcprototype>
53425b89263Smrg  <funcdef>Status <function>XRecordQueryVersion</function></funcdef>
53525b89263Smrg    <paramdef>Display <parameter> *display</parameter></paramdef>
53625b89263Smrg    <paramdef>int <parameter> cmajor_return</parameter></paramdef>
53725b89263Smrg    <paramdef>int <parameter> cminor_return</parameter></paramdef>
53825b89263Smrg</funcprototype>
53925b89263Smrg</funcsynopsis>
54025b89263Smrg
54125b89263Smrg<variablelist remap='IP'>
54225b89263Smrg  <varlistentry>
54325b89263Smrg    <term><emphasis remap='I'>display</emphasis></term>
54425b89263Smrg    <listitem><para>Returns the connection to the X server.</para></listitem>
54525b89263Smrg  </varlistentry>
54625b89263Smrg  <varlistentry>
54725b89263Smrg    <term><emphasis remap='I'>cmajor_return</emphasis></term>
54825b89263Smrg    <listitem><para>Returns the extension protocol major version in use.</para></listitem>
54925b89263Smrg  </varlistentry>
55025b89263Smrg  <varlistentry>
55125b89263Smrg    <term><emphasis remap='I'>cminor_return</emphasis></term>
55225b89263Smrg    <listitem><para>Returns the extension protocol minor version in use.</para></listitem>
55325b89263Smrg  </varlistentry>
55425b89263Smrg</variablelist>
55525b89263Smrg
55625b89263Smrg<para>
55725b89263SmrgThe
55806f32fbeSmrg<xref linkend='XRecordQueryVersion' xrefstyle='select: title'/>
55925b89263Smrgfunction returns the major and minor protocol version numbers supported by
56025b89263Smrgthe server.
56106f32fbeSmrg<xref linkend='XRecordQueryVersion' xrefstyle='select: title'/>
56225b89263Smrgreturns nonzero (success) only if the returned version numbers are
56325b89263Smrgcommon to both the library and the server; otherwise, it returns zero.
56425b89263Smrg</para>
56525b89263Smrg</sect1>
56625b89263Smrg
56706f32fbeSmrg<sect1 id='Create_and_Modify_Context'>
56825b89263Smrg<title>Create and Modify Context</title>
56925b89263Smrg
57025b89263Smrg<para>
57125b89263SmrgAn application uses the
57206f32fbeSmrg<xref linkend='XRecordCreateContext' xrefstyle='select: title'/>
57325b89263Smrgfunction to create a record context.  At the time the record context is
57425b89263Smrgcreated by the recording client, the clients to be recorded and the
57525b89263Smrgprotocol to record for each client may be specified.
57625b89263Smrg</para>
57725b89263Smrg
57806f32fbeSmrg<funcsynopsis id='XRecordCreateContext'>
57925b89263Smrg<funcprototype>
58025b89263Smrg  <funcdef>XRecordContext <function>XRecordCreateContext</function></funcdef>
58125b89263Smrg    <paramdef>Display <parameter> *display</parameter></paramdef>
58225b89263Smrg    <paramdef>int <parameter> datum_flags</parameter></paramdef>
58325b89263Smrg    <paramdef>XRecordClientSpec <parameter> *clients</parameter></paramdef>
58425b89263Smrg    <paramdef>int <parameter> nclients</parameter></paramdef>
58525b89263Smrg    <paramdef>XRecordRange <parameter> *ranges</parameter></paramdef>
58625b89263Smrg    <paramdef>int <parameter> nranges</parameter></paramdef>
58725b89263Smrg</funcprototype>
58825b89263Smrg</funcsynopsis>
58925b89263Smrg
59025b89263Smrg<variablelist remap='IP'>
59125b89263Smrg  <varlistentry>
59225b89263Smrg    <term><emphasis remap='I'>display</emphasis></term>
59325b89263Smrg    <listitem><para>Returns the connection to the X server.</para></listitem>
59425b89263Smrg  </varlistentry>
59525b89263Smrg  <varlistentry>
59625b89263Smrg    <term><emphasis remap='I'>datum_flags</emphasis></term>
59725b89263Smrg    <listitem><para>Specifies whether detailed time or sequence info should be sent.</para></listitem>
59825b89263Smrg  </varlistentry>
59925b89263Smrg  <varlistentry>
60025b89263Smrg    <term><emphasis remap='I'>clients</emphasis></term>
60125b89263Smrg    <listitem><para>Specifies the clients to record.</para></listitem>
60225b89263Smrg  </varlistentry>
60325b89263Smrg  <varlistentry>
60425b89263Smrg    <term><emphasis remap='I'>nclients</emphasis></term>
60525b89263Smrg    <listitem><para>Specifies the number of clients.</para></listitem>
60625b89263Smrg  </varlistentry>
60725b89263Smrg  <varlistentry>
60825b89263Smrg    <term><emphasis remap='I'>ranges</emphasis></term>
60925b89263Smrg    <listitem><para>Specifies the protocol ranges to record.</para></listitem>
61025b89263Smrg  </varlistentry>
61125b89263Smrg  <varlistentry>
61225b89263Smrg    <term><emphasis remap='I'>nranges</emphasis></term>
61325b89263Smrg    <listitem><para>Specifies the number of protocol ranges.</para></listitem>
61425b89263Smrg  </varlistentry>
61525b89263Smrg</variablelist>
61625b89263Smrg
61725b89263Smrg<para>
61825b89263SmrgThe
61906f32fbeSmrg<xref linkend='XRecordCreateContext' xrefstyle='select: title'/>
62025b89263Smrgfunction creates a record context and returns an
62125b89263Smrg<function>XRecordContext</function>
62225b89263Smrgwhich is then used in the other Record library calls.  This request is
62325b89263Smrgtypically executed by the recording client over its control connection to
62425b89263Smrgthe X server.  The datum_flags specifies whether server time and/or client
62525b89263Smrgsequence number should precede protocol elements recorded by context (
62606f32fbeSmrg<xref linkend='Datum_Flags' xrefstyle='select: title'/>
62725b89263Smrg).  When a clients element identifies a particular client, the client is added
62825b89263Smrgto the context and the protocol to record for that client is set to the
62925b89263Smrgunion of all ranges.  When a clients element is
63025b89263Smrg<function>XRecordCurrentClients</function>
63125b89263Smrg<function>XRecordFutureClients</function>
63225b89263Smrgor
63325b89263Smrg<function>XRecordAllClients</function>
63425b89263Smrgthe actions described in
63506f32fbeSmrg<xref linkend='Selecting_Clients' xrefstyle='select: title'/>
63625b89263Smrgare performed.
63725b89263Smrg</para>
63825b89263Smrg
63925b89263Smrg<para>
64006f32fbeSmrg<xref linkend='XRecordCreateContext' xrefstyle='select: title'/>
64125b89263Smrgreturns zero if the request failed.
64206f32fbeSmrg<xref linkend='XRecordCreateContext' xrefstyle='select: title'/>
64325b89263Smrgcan generate
64425b89263Smrg<function>BadIDChoice</function>
64525b89263Smrg<function>BadMatch</function>
64625b89263Smrgand
64725b89263Smrg<function>BadValue</function>
64825b89263Smrgerrors.
64925b89263Smrg</para>
65025b89263Smrg
65125b89263Smrg<para>The ranges argument is an
65225b89263Smrg<function>XRecordRange</function>
65325b89263Smrgarray, that is, an array
65425b89263Smrgof pointers.  The structures the elements point to shall be allocated
65525b89263Smrgby calling
65625b89263Smrg<function>XRecordAllocRange</function></para>
65725b89263Smrg
65825b89263Smrg<literallayout remap='FD'>
65925b89263SmrgXRecordRange *
66025b89263SmrgXRecordAllocRange(void)
66125b89263Smrg</literallayout> <!-- remap='FN' -->
66225b89263Smrg
66325b89263Smrg<para>
66425b89263SmrgThe
66525b89263Smrg<function>XRecordAllocRange</function>
66625b89263Smrgfunction
66725b89263Smrgallocates and returns an
66825b89263Smrg<function>XRecordRange</function>
66925b89263Smrgstructure.
67025b89263SmrgThe structure is initialized to specify no protocol.
67125b89263SmrgThe function returns NULL if the structure allocation fails.
67225b89263SmrgThe application can free the structure by calling
67306f32fbeSmrg<olink targetdoc='libX11' targetptr='XFree'><function>XFree</function></olink>
67425b89263Smrg</para>
67525b89263Smrg
67606f32fbeSmrg<sect2 id='Additions'>
67725b89263Smrg<title>Additions</title>
67825b89263Smrg
67925b89263Smrg<para>
68025b89263SmrgAn application uses the
68106f32fbeSmrg<xref linkend='XRecordRegisterClients' xrefstyle='select: title'/>
68225b89263Smrgfunction to modify a previously created
68325b89263Smrgrecord context, by adding clients or modifying the recorded protocol,
68425b89263Smrgtypically over its control connection to the X server.
68525b89263Smrg</para>
68625b89263Smrg
68706f32fbeSmrg<funcsynopsis id='XRecordRegisterClients'>
68825b89263Smrg<funcprototype>
68925b89263Smrg  <funcdef>Status <function>XRecordRegisterClients</function></funcdef>
69025b89263Smrg    <paramdef>Display <parameter> *display</parameter></paramdef>
69125b89263Smrg    <paramdef>XRecordContext <parameter> context</parameter></paramdef>
69225b89263Smrg    <paramdef>int <parameter> datum_flags</parameter></paramdef>
69325b89263Smrg    <paramdef>XRecordClientSpec <parameter> *clients</parameter></paramdef>
69425b89263Smrg    <paramdef>int <parameter> nclients</parameter></paramdef>
69525b89263Smrg    <paramdef>XRecordRange <parameter> *ranges</parameter></paramdef>
69625b89263Smrg    <paramdef>int <parameter> nranges</parameter></paramdef>
69725b89263Smrg</funcprototype>
69825b89263Smrg</funcsynopsis>
69925b89263Smrg
70025b89263Smrg<variablelist remap='IP'>
70125b89263Smrg  <varlistentry>
70225b89263Smrg    <term><emphasis remap='I'>display</emphasis></term>
70325b89263Smrg    <listitem><para>Returns the connection to the X server.</para></listitem>
70425b89263Smrg  </varlistentry>
70525b89263Smrg  <varlistentry>
70625b89263Smrg    <term><emphasis remap='I'>context</emphasis></term>
70725b89263Smrg    <listitem><para>Specifies the record context to modify.</para></listitem>
70825b89263Smrg  </varlistentry>
70925b89263Smrg  <varlistentry>
71025b89263Smrg    <term><emphasis remap='I'>datum_flags</emphasis></term>
71125b89263Smrg    <listitem><para>Specifies whether detailed time or sequence info should be sent.</para></listitem>
71225b89263Smrg  </varlistentry>
71325b89263Smrg  <varlistentry>
71425b89263Smrg    <term><emphasis remap='I'>clients</emphasis></term>
71525b89263Smrg    <listitem><para>Specifies the clients to record.</para></listitem>
71625b89263Smrg  </varlistentry>
71725b89263Smrg  <varlistentry>
71825b89263Smrg    <term><emphasis remap='I'>nclients</emphasis></term>
71925b89263Smrg    <listitem><para>Specifies the number of clients.</para></listitem>
72025b89263Smrg  </varlistentry>
72125b89263Smrg  <varlistentry>
72225b89263Smrg    <term><emphasis remap='I'>ranges</emphasis></term>
72325b89263Smrg    <listitem><para>Specifies the protocol ranges to record.</para></listitem>
72425b89263Smrg  </varlistentry>
72525b89263Smrg  <varlistentry>
72625b89263Smrg    <term><emphasis remap='I'>nranges</emphasis></term>
72725b89263Smrg    <listitem><para>Specifies the number of protocol ranges.</para></listitem>
72825b89263Smrg  </varlistentry>
72925b89263Smrg</variablelist>
73025b89263Smrg
73125b89263Smrg<para>
73225b89263SmrgThe datum_flags specifies whether server time and/or client sequence number
73325b89263Smrgshould precede protocol elements for all clients recorded by context (See
73406f32fbeSmrg<xref linkend='Datum_Flags' xrefstyle='select: title'/>
73525b89263Smrg).  When a clients element identifies a particular client and the client is
73625b89263Smrgnot yet targeted for recording in the given context, the client is added
73725b89263Smrgto the set of clients to record, and the protocol to record for that client
73825b89263Smrgis set to the union of all ranges.  When the client is
73925b89263Smrgalready targeted for recording, the protocol to record for that client
74025b89263Smrgis set to the union of all ranges.  When the element is
74125b89263Smrg<function>XRecordCurrentClients</function>
74225b89263Smrg<function>XRecordFutureClients</function>
74325b89263Smrgor
74425b89263Smrg<function>XRecordAllClients</function>
74525b89263Smrgthe actions described in
74606f32fbeSmrg<xref linkend='Selecting_Clients' xrefstyle='select: title'/>
74725b89263Smrgare performed.
74825b89263Smrg</para>
74925b89263Smrg
75025b89263Smrg<para>
75106f32fbeSmrg<xref linkend='XRecordRegisterClients' xrefstyle='select: title'/>
75225b89263Smrgreturns zero if the request failed; otherwise, it
75325b89263Smrgreturns nonzero.
75425b89263Smrg</para>
75525b89263Smrg
75625b89263Smrg<para>
75706f32fbeSmrg<xref linkend='XRecordRegisterClients' xrefstyle='select: title'/>
75825b89263Smrgcan generate
75925b89263Smrg<function>XRecordBadContext</function>
76025b89263Smrg<function>BadMatch</function>
76125b89263Smrgand
76225b89263Smrg<function>BadValue</function>
76325b89263Smrgerrors.
76425b89263Smrg</para>
76525b89263Smrg</sect2>
76625b89263Smrg
76706f32fbeSmrg<sect2 id='Deletions'>
76825b89263Smrg<title>Deletions</title>
76925b89263Smrg
77025b89263Smrg<para>
77125b89263SmrgAn application uses the
77225b89263Smrg<function>XRecordUnregisterClients</function>
77325b89263Smrgfunction to delete clients from a previously created
77425b89263Smrgrecord context, typically over its control connection to the X server.
77525b89263Smrg</para>
77625b89263Smrg
77706f32fbeSmrg<funcsynopsis id='XRecordUnRegisterClients'>
77825b89263Smrg<funcprototype>
77925b89263Smrg  <funcdef>Status <function>XRecordUnRegisterClients</function></funcdef>
78025b89263Smrg    <paramdef>Display <parameter> *display</parameter></paramdef>
78125b89263Smrg    <paramdef>XRecordContext <parameter> context</parameter></paramdef>
78225b89263Smrg    <paramdef>XRecordClientSpec <parameter> *clients</parameter></paramdef>
78325b89263Smrg    <paramdef>int <parameter> nclients</parameter></paramdef>
78425b89263Smrg</funcprototype>
78525b89263Smrg</funcsynopsis>
78625b89263Smrg
78725b89263Smrg<variablelist remap='IP'>
78825b89263Smrg  <varlistentry>
78925b89263Smrg    <term><emphasis remap='I'>display</emphasis></term>
79025b89263Smrg    <listitem><para>Returns the connection to the X server.</para></listitem>
79125b89263Smrg  </varlistentry>
79225b89263Smrg  <varlistentry>
79325b89263Smrg    <term><emphasis remap='I'>context</emphasis></term>
79425b89263Smrg    <listitem><para>Specifies the record context to modify.</para></listitem>
79525b89263Smrg  </varlistentry>
79625b89263Smrg  <varlistentry>
79725b89263Smrg    <term><emphasis remap='I'>clients</emphasis></term>
79825b89263Smrg    <listitem><para>Specifies the clients to stop recording.</para></listitem>
79925b89263Smrg  </varlistentry>
80025b89263Smrg  <varlistentry>
80125b89263Smrg    <term><emphasis remap='I'>nclients</emphasis></term>
80225b89263Smrg    <listitem><para>Specifies the number of clients.</para></listitem>
80325b89263Smrg  </varlistentry>
80425b89263Smrg</variablelist>
80525b89263Smrg
80625b89263Smrg<para>
80725b89263SmrgWhen an element in clients identifies a particular client, and the
80825b89263Smrgspecified client is already targeted for recording in the given
80925b89263Smrgcontext, the client and the set of protocol to record for that
81025b89263Smrgclient are deleted from the context.  If the specified client is not
81125b89263Smrgtargeted for recording, then no action is performed.
81225b89263Smrg</para>
81325b89263Smrg
81425b89263Smrg<para>
81525b89263SmrgWhen the element is
81625b89263Smrg<function>XRecordCurrentClients</function>
81725b89263Smrgall clients currently targeted for recording in context and their
81825b89263Smrgcorresponding sets of protocol to record are deleted from context.
81925b89263Smrg</para>
82025b89263Smrg
82125b89263Smrg<para>
82225b89263SmrgWhen the item is
82325b89263Smrg<function>XRecordFutureClients</function>
82425b89263Smrgany future client connections will not automatically be targeted for
82525b89263Smrgrecording in context.
82625b89263Smrg</para>
82725b89263Smrg
82825b89263Smrg<para>
82925b89263SmrgWhen the element is
83025b89263Smrg<function>XRecordAllClients</function>
83125b89263Smrgall clients currently targeted for recording in context and their
83225b89263Smrgcorresponding sets of protocol to record are deleted from context.
83325b89263SmrgAny future client connections will not automatically be targeted
83425b89263Smrgfor recording in context.
83525b89263Smrg</para>
83625b89263Smrg
83725b89263Smrg<para>
83825b89263Smrg<function>XRecordUnregisterClients</function>
83925b89263Smrgreturns zero if the request failed; otherwise, it returns nonzero.
84025b89263Smrg</para>
84125b89263Smrg
84225b89263Smrg<para>
84325b89263Smrg<function>XRecordUnregisterClients</function>
84425b89263Smrgcan generate
84525b89263Smrg<function>XRecordBadContext</function>
84625b89263Smrg<function>BadMatch</function>
84725b89263Smrgand
84825b89263Smrg<function>BadValue</function>
84925b89263Smrgerrors.</para>
85025b89263Smrg</sect2>
85125b89263Smrg</sect1>
85225b89263Smrg
85306f32fbeSmrg<sect1 id='Query_Context_State'>
85425b89263Smrg<title>Query Context State</title>
85525b89263Smrg
85625b89263Smrg<para>
85725b89263SmrgAn application uses the
85806f32fbeSmrg<xref linkend='XRecordGetContext' xrefstyle='select: title'/>
85925b89263Smrgfunction to query the current state of a record context, typically over
86025b89263Smrgits control connection to the X server.
86125b89263Smrg</para>
86225b89263Smrg
86306f32fbeSmrg<funcsynopsis id='XRecordGetContext'>
86425b89263Smrg<funcprototype>
86525b89263Smrg  <funcdef>Status <function>XRecordGetContext</function></funcdef>
86625b89263Smrg    <paramdef>Display <parameter> *display</parameter></paramdef>
86725b89263Smrg    <paramdef>XRecordContext <parameter> context</parameter></paramdef>
86825b89263Smrg    <paramdef>XRecordState <parameter> **state_return</parameter></paramdef>
86925b89263Smrg</funcprototype>
87025b89263Smrg</funcsynopsis>
87125b89263Smrg
87225b89263Smrg<variablelist remap='IP'>
87325b89263Smrg  <varlistentry>
87425b89263Smrg    <term><emphasis remap='I'>display</emphasis></term>
87525b89263Smrg    <listitem><para>Specifies the connection to the X server.</para></listitem>
87625b89263Smrg  </varlistentry>
87725b89263Smrg  <varlistentry>
87825b89263Smrg    <term><emphasis remap='I'>context</emphasis></term>
87925b89263Smrg    <listitem><para>Specifies the record context to query.</para></listitem>
88025b89263Smrg  </varlistentry>
88125b89263Smrg  <varlistentry>
88225b89263Smrg    <term><emphasis remap='I'>state_return</emphasis></term>
88325b89263Smrg    <listitem><para>Specifies the address of a variable into which
88425b89263Smrgthe function stores a pointer to the current state of the record context.
88525b89263Smrg    </para></listitem>
88625b89263Smrg  </varlistentry>
88725b89263Smrg</variablelist>
88825b89263Smrg
88925b89263Smrg<para>
89025b89263SmrgThe
89125b89263Smrg<function>XRecordState</function>
89225b89263Smrgtypedef returned by
89306f32fbeSmrg<xref linkend='XRecordGetContext' xrefstyle='select: title'/>
89425b89263Smrgis a structure with the following members:
89525b89263Smrg</para>
89625b89263Smrg
89725b89263Smrg<literallayout remap='Ds'>
89825b89263SmrgXRecordState:
89925b89263Smrg     Bool              enabled
90025b89263Smrg     int               datum_flags
90125b89263Smrg     unsigned long     nclients
90225b89263Smrg     XRecordClientInfo **client_info
90325b89263Smrg</literallayout>
90425b89263Smrg
90525b89263Smrg<para>
90625b89263SmrgThe enabled member is set to the state of data transfer and is
90725b89263Smrg<function>True</function>
90825b89263Smrgwhen the recording client has asked that recorded data be sent;
90925b89263Smrgotherwise it is
91025b89263Smrg<function>False</function>
91125b89263SmrgThe datum_flags member is set to the value of these flags for this context.
91225b89263SmrgThe nclients member is set to the number of
91325b89263Smrg<function>XRecordClientInfo</function>
91425b89263Smrgstructures returned.  The client_info member is an array of pointers to
91525b89263Smrg<function>XRecordClientInfo</function>
91625b89263Smrgstructures that contain the protocol to record for each targeted client.  The
91725b89263Smrg<function>XRecordClientInfo</function>
91825b89263Smrgtypedef is a structure with the following members:
91925b89263Smrg</para>
92025b89263Smrg
92125b89263Smrg<literallayout remap='Ds'>
92225b89263SmrgXRecordClientInfo:
92325b89263Smrg     XRecordClientSpec client
92425b89263Smrg     unsigned long nranges
92525b89263Smrg     XRecordRange **ranges
92625b89263Smrg</literallayout>
92725b89263Smrg
92825b89263Smrg<para>
92925b89263SmrgThe client member either identifies a client targeted for recording
93025b89263Smrgor is set to
93125b89263Smrg<function>XRecordFutureClients</function>
93225b89263Smrgto describe how future clients will be automatically targeted for recording.
93325b89263SmrgThe nranges member is set to the number of protocol
93425b89263Smrgranges to be recorded for the specified client.  The ranges member
93525b89263Smrgis an array of pointers to
93625b89263Smrg<function>XRecordRange</function>
93725b89263Smrgstructures, which specify the protocol ranges to record.
93825b89263Smrg</para>
93925b89263Smrg
94025b89263Smrg<para>
94106f32fbeSmrg<xref linkend='XRecordGetContext' xrefstyle='select: title'/>
94225b89263Smrgreturns zero if the request failed; otherwise, it returns nonzero.
94325b89263SmrgThe context argument must specify a valid
94425b89263Smrg<function>XRecordContext</function>
94525b89263Smrgor a
94625b89263Smrg<function>XRecordBadContext</function>
94725b89263Smrgerror results.
94825b89263Smrg</para>
94925b89263Smrg
95025b89263Smrg<para>
95125b89263SmrgRecording clients should use the
95206f32fbeSmrg<xref linkend='XRecordFreeState' xrefstyle='select: title'/>
95325b89263Smrgfunction to free the state data returned by
95406f32fbeSmrg<xref linkend='XRecordGetContext' xrefstyle='select: title'/>
95525b89263Smrg</para>
95625b89263Smrg
95706f32fbeSmrg<funcsynopsis id='XRecordFreeState'>
95825b89263Smrg<funcprototype>
95925b89263Smrg  <funcdef>void <function>XRecordFreeState</function></funcdef>
96025b89263Smrg    <paramdef>XRecordState <parameter> *state</parameter></paramdef>
96125b89263Smrg</funcprototype>
96225b89263Smrg</funcsynopsis>
96325b89263Smrg
96425b89263Smrg<variablelist remap='IP'>
96525b89263Smrg  <varlistentry>
96625b89263Smrg    <term><emphasis remap='I'>state</emphasis></term>
96725b89263Smrg    <listitem><para>Specifies the structure that is to be freed.</para></listitem>
96825b89263Smrg  </varlistentry>
96925b89263Smrg</variablelist>
97025b89263Smrg
97125b89263Smrg<para>
97206f32fbeSmrg<xref linkend='XRecordFreeState' xrefstyle='select: title'/>
97325b89263Smrgfrees the data pointed to by state.  If the argument does not match an
97425b89263Smrg<function>XRecordState</function>
97525b89263Smrgpointer returned from a successful call to
97606f32fbeSmrg<xref linkend='XRecordGetContext' xrefstyle='select: title'/>
97725b89263Smrgor if
97806f32fbeSmrg<xref linkend='XRecordFreeState' xrefstyle='select: title'/>
97925b89263Smrghas already been called with it, the behavior is undefined.
98025b89263Smrg</para>
98125b89263Smrg</sect1>
98225b89263Smrg
98306f32fbeSmrg<sect1 id='Data_Transfer'>
98425b89263Smrg<title>Data Transfer</title>
98525b89263Smrg
98625b89263Smrg<para>
98725b89263SmrgAn application uses the
98806f32fbeSmrg<xref linkend='XRecordEnableContext' xrefstyle='select: title'/>
98925b89263Smrgand
99006f32fbeSmrg<xref linkend='XRecordDisableContext' xrefstyle='select: title'/>
99125b89263Smrgfunctions to change the state of data transfer
99225b89263Smrgbetween the X server and the recording client.  These functions allow
99325b89263Smrgthe application to start recording and reporting of protocol data
99425b89263Smrgand to stop recording and reporting of protocol data, respectively.
99525b89263Smrg</para>
99625b89263Smrg
99706f32fbeSmrg<sect2 id='Enable_Context'>
99825b89263Smrg<title>Enable Context</title>
99925b89263Smrg
100025b89263Smrg<para>
100125b89263SmrgTo direct the X server to record and report protocol, a program uses
100206f32fbeSmrg<xref linkend='XRecordEnableContext' xrefstyle='select: title'/>
100325b89263Smrgtypically over its data connection to the X
100425b89263Smrgserver.  The reporting of recorded protocol back to the recording client
100525b89263Smrgis handled by the following data structures and procedure definitions.
100625b89263SmrgEach recorded protocol element is reported to the recording client through an
100725b89263Smrg<function>XRecordInterceptData</function>
100825b89263Smrgtypedef, a structure with the following members:
100925b89263Smrg</para>
101025b89263Smrg
101125b89263Smrg<literallayout remap='Ds'>
101225b89263SmrgXRecordInterceptData:
101325b89263Smrg     XID              id_base
101425b89263Smrg     Time             server_time
101525b89263Smrg     unsigned long    client_seq
101625b89263Smrg     int              category
101725b89263Smrg     Bool             client_swapped
101825b89263Smrg     unsigned char    *data
101925b89263Smrg     unsigned long    data_len
102025b89263Smrg</literallayout>
102125b89263Smrg
102225b89263Smrg<para>
102325b89263SmrgThe id_base member is set to the resource identifier base sent to the
102425b89263Smrgclient in the connection setup reply and therefore identifies the client
102525b89263Smrgbeing recorded, except when the recorded protocol data is a device
102625b89263Smrgevent that may have not been delivered to a client.  In this case,
102725b89263Smrgid_base is set to zero.  The server_time member
102825b89263Smrgis set to the time of the server when the protocol was recorded.
102925b89263SmrgIt is the time that was attached to this protocol element in the reply,
103025b89263Smrgif so specified by datum_flags,
103125b89263Smrgor else the time from the header of the reply that contained
103225b89263Smrgthis protocol element.
103325b89263SmrgThe client_seq member is the sequence number of the recorded
103425b89263Smrgclient's most recent request processed by the server at the time this
103525b89263Smrgprotocol element was recorded, if this information were included in the
103625b89263Smrgrecorded data; otherwise client_seq is 0.
103725b89263SmrgThe category member is set to one of the following values:
103825b89263Smrg<function>XRecordStartOfData</function>
103925b89263Smrg<function>XRecordFromServer</function>
104025b89263Smrg<function>XRecordFromClient</function>
104125b89263Smrg<function>XRecordClientStarted</function>
104225b89263Smrg<function>XRecordClientDied</function>
104325b89263Smrgor
104425b89263Smrg<function>XRecordEndOfData</function>
104525b89263Smrg<function>XRecordStartOfData</function>
104625b89263Smrgis immediately sent as the first reply to confirm that the context is enabled.
104725b89263Smrg<function>XRecordFromClient</function>
104825b89263Smrgindicates the protocol
104925b89263Smrgdata is from the recorded client to the server (requests).
105025b89263Smrg<function>XRecordFromServer</function>
105125b89263Smrgindicates the protocol data is from the server to the recorded client
105225b89263Smrg(replies, errors, events, or device events).
105325b89263Smrg<function>XRecordClientStarted</function>
105425b89263Smrgindicates that the protocol data is the connection setup reply from the server.
105525b89263Smrg<function>XRecordClientDied</function>
105625b89263Smrgindicates that the recorded client has closed its connection
105725b89263Smrgto the X server; there is no protocol data.
105825b89263Smrg<function>XRecordEndOfData</function>
105925b89263Smrgindicates that the context has been disabled and that
106025b89263Smrgthis is the last datum.  It does not correspond to any protocol or
106125b89263Smrgstate change in a recorded client.  There is no protocol data.
106225b89263Smrg</para>
106325b89263Smrg
106425b89263Smrg<para>
106525b89263SmrgThe client_swapped member is set to
106625b89263Smrg<function>True</function>
106725b89263Smrgif the byte order of the client being recorded is swapped relative to
106825b89263Smrgthe recording client; otherwise, it is set to
106925b89263Smrg<function>False</function>
107025b89263SmrgAll recorded protocol data is returned in the byte order of the recorded
107125b89263Smrgclient.  Therefore, recording clients are responsible for all byte swapping,
107225b89263Smrgif required.  Device events are in the byte order of the recording client.
107325b89263SmrgFor replies of category
107425b89263Smrg<function>XRecordStartOfData</function>
107525b89263Smrgand
107625b89263Smrg<function>XRecordEndOfData</function>
107725b89263Smrgclient_swapped is set according
107825b89263Smrgto the byte order of the server relative to the recording client.
107925b89263Smrg</para>
108025b89263Smrg
108125b89263Smrg<para>
108225b89263SmrgThe data member contains the actual recorded protocol data.
108325b89263SmrgWhen category is set to
108425b89263Smrg<function>XRecordStartOfData</function>
108525b89263Smrg<function>XRecordClientDied</function>
108625b89263Smrgor
108725b89263Smrg<function>XRecordEndOfData</function>
108825b89263Smrgno protocol data are contained in data.
108925b89263Smrg</para>
109025b89263Smrg
109125b89263Smrg
109225b89263Smrg<!--  copied exactly from the protocol document -->
109325b89263Smrg<para>
109425b89263SmrgFor the core X events
109525b89263Smrg<function>KeyPress</function>
109625b89263Smrg<function>KeyRelease</function>
109725b89263Smrg<function>ButtonPress</function>
109825b89263Smrgand
109925b89263Smrg<function>ButtonRelease</function>,
110025b89263Smrgthe fields of a device event that contain
110125b89263Smrgvalid information are time and detail.  For the core X event
110225b89263Smrg<function>MotionNotify</function>
110325b89263Smrgthe fields of a device event that contain valid information are time, root,
110425b89263Smrgroot-x and root-y.
110525b89263SmrgThe time field refers to the time the event was generated by the device.
110625b89263Smrg</para>
110725b89263Smrg
110825b89263Smrg<para>For the extension input device events
110925b89263Smrg<function>DeviceKeyPress</function>
111025b89263Smrg<function>DeviceKeyRelease</function>
111125b89263Smrg<function>DeviceButtonPress</function>
111225b89263Smrgand
111325b89263Smrg<function>DeviceButtonRelease</function>
111425b89263Smrgthe fields of a device event that contain valid information are
111525b89263Smrgdevice, time, and detail.  For
111625b89263Smrg<function>DeviceMotionNotify</function>
111725b89263Smrgthe valid device event fields are device and time.
111825b89263SmrgFor the extension input device events
111925b89263Smrg<function>ProximityIn</function>
112025b89263Smrgand
112125b89263Smrg<function>ProximityOut</function>
112225b89263Smrgthe fields of a device event that contain valid
112325b89263Smrginformation are device and time.  For the extension input device event
112425b89263Smrg<function>DeviceValuator</function>
112525b89263Smrgthe fields of a device event that contain valid information are
112625b89263Smrgdevice, num_valuators, first_valuator, and valuators.
112725b89263SmrgThe time field refers to the time the event was generated by the device.
112825b89263Smrg</para>
112925b89263Smrg
113025b89263Smrg
113125b89263Smrg<para>
113225b89263SmrgThe data_len member is set to the length of the actual recorded protocol
113325b89263Smrgdata in 4-byte units.
113425b89263Smrg</para>
113525b89263Smrg
113625b89263Smrg<para>
113725b89263SmrgWhen the context has been enabled, protocol data the recording client has
113825b89263Smrgpreviously expressed interest in is recorded and returned to the
113925b89263Smrgrecording client via multiple replies.  Because the X server batches
114025b89263Smrgthe recorded data, more than one protocol element may be contained
114125b89263Smrgin the same reply packet.  When a reply is received, a procedure of type
114225b89263Smrg<function>XRecordInterceptProc</function>
114325b89263Smrgis called for each protocol element in the reply.
114425b89263Smrg</para>
114525b89263Smrg
114606f32fbeSmrg<funcsynopsis id='XRecordInterceptProc'>
114725b89263Smrg<funcprototype>
114825b89263Smrg  <funcdef>typedef void <function>(*XRecordInterceptProc)</function></funcdef>
114925b89263Smrg    <paramdef>XPointer<parameter> closure</parameter></paramdef>
115025b89263Smrg    <paramdef>XRecordInterceptData<parameter> *recorded_data</parameter></paramdef>
115125b89263Smrg</funcprototype>
115225b89263Smrg</funcsynopsis>
115325b89263Smrg
115425b89263Smrg<variablelist remap='IP'>
115525b89263Smrg  <varlistentry>
115625b89263Smrg    <term><emphasis remap='I'>closure</emphasis></term>
115725b89263Smrg    <listitem><para>Pointer that was passed in when the context was enabled.</para></listitem>
115825b89263Smrg  </varlistentry>
115925b89263Smrg  <varlistentry>
116025b89263Smrg    <term><emphasis remap='I'>recorded_data</emphasis></term>
116125b89263Smrg    <listitem><para>A protocol element recorded by the server extension.</para></listitem>
116225b89263Smrg  </varlistentry>
116325b89263Smrg</variablelist>
116425b89263Smrg
116525b89263Smrg<para>
116625b89263SmrgThis callback may use the control display connection (or any display
116725b89263Smrgconnection other than the data connection).
116825b89263Smrg</para>
116925b89263Smrg
117025b89263Smrg<para>
117125b89263SmrgRecording clients should use the
117206f32fbeSmrg<xref linkend='XRecordFreeData' xrefstyle='select: title'/>
117325b89263Smrgfunction to free the
117425b89263Smrg<function>XRecordInterceptData</function>
117525b89263Smrgstructure.
117625b89263Smrg</para>
117725b89263Smrg
117806f32fbeSmrg<funcsynopsis id='XRecordEnableContext'>
117925b89263Smrg<funcprototype>
118025b89263Smrg  <funcdef>Status <function>XRecordEnableContext</function></funcdef>
118125b89263Smrg    <paramdef>Display<parameter> *display</parameter></paramdef>
118225b89263Smrg    <paramdef>XRecordContext<parameter> context</parameter></paramdef>
118325b89263Smrg    <paramdef>XRecordInterceptProc<parameter> callback</parameter></paramdef>
118425b89263Smrg    <paramdef>XPointer<parameter> closure</parameter></paramdef>
118525b89263Smrg</funcprototype>
118625b89263Smrg</funcsynopsis>
118725b89263Smrg
118825b89263Smrg<variablelist remap='IP'>
118925b89263Smrg  <varlistentry>
119025b89263Smrg    <term><emphasis remap='I'>display</emphasis></term>
119125b89263Smrg    <listitem><para>Specifies the connection to the X server.</para></listitem>
119225b89263Smrg  </varlistentry>
119325b89263Smrg  <varlistentry>
119425b89263Smrg    <term><emphasis remap='I'>context</emphasis></term>
119525b89263Smrg    <listitem><para>Specifies the record context to enable.</para></listitem>
119625b89263Smrg  </varlistentry>
119725b89263Smrg  <varlistentry>
119825b89263Smrg    <term><emphasis remap='I'>callback</emphasis></term>
119925b89263Smrg    <listitem><para>Specifies the function to be called for each protocol element received.</para></listitem>
120025b89263Smrg  </varlistentry>
120125b89263Smrg  <varlistentry>
120225b89263Smrg    <term><emphasis remap='I'>closure</emphasis></term>
120325b89263Smrg    <listitem><para>Specifies data passed to callback.</para></listitem>
120425b89263Smrg  </varlistentry>
120525b89263Smrg</variablelist>
120625b89263Smrg
120725b89263Smrg
120825b89263Smrg<para>
120906f32fbeSmrg<xref linkend='XRecordEnableContext' xrefstyle='select: title'/>
121025b89263Smrgenables data transfer between the recording client and
121125b89263Smrgthe X server.  All core and extension protocol received from or sent to
121225b89263Smrgtargeted clients that the recording client has expressed
121325b89263Smrginterest in will be recorded and reported to the recording client.
121425b89263Smrg</para>
121525b89263Smrg
121625b89263Smrg<para>
121706f32fbeSmrg<xref linkend='XRecordEnableContext' xrefstyle='select: title'/>
121825b89263Smrgreturns zero if the request failed; otherwise, it
121925b89263Smrgreturns nonzero.  The context argument must specify a valid
122025b89263Smrg<function>XRecordContext</function>
122125b89263Smrgor a
122225b89263Smrg<function>XRecordBadContext</function>
122325b89263Smrgerror results.  The error
122425b89263Smrg<function>BadMatch</function>
122525b89263Smrgresults when data transfer is already enabled on the given context.
122625b89263Smrg</para>
122725b89263Smrg</sect2>
122825b89263Smrg
122906f32fbeSmrg<sect2 id='Enable_Context_Asynchronously'>
123025b89263Smrg<title>Enable Context Asynchronously</title>
123125b89263Smrg
123225b89263Smrg<para>Because
123306f32fbeSmrg<xref linkend='XRecordEnableContext' xrefstyle='select: title'/>
123425b89263Smrgdoes not return until
123506f32fbeSmrg<xref linkend='XRecordDisableContext' xrefstyle='select: title'/>
123625b89263Smrgis executed on the control connection, a nonblocking interface in
123725b89263Smrgaddition to
123806f32fbeSmrg<xref linkend='XRecordEnableContext' xrefstyle='select: title'/>
123925b89263Smrgis provided.  This interface also
124025b89263Smrgenables data transfer; however, it does not block.
124125b89263Smrg</para>
124225b89263Smrg
124325b89263Smrg<para>
124425b89263SmrgThis interface is defined as follows:
124525b89263Smrg</para>
124625b89263Smrg
124706f32fbeSmrg<funcsynopsis id='XRecordEnableContextAsync'>
124825b89263Smrg<funcprototype>
124925b89263Smrg  <funcdef>Status <function>XRecordEnableContextAsync</function></funcdef>
125025b89263Smrg    <paramdef>Display<parameter> *display</parameter></paramdef>
125125b89263Smrg    <paramdef>XRecordContext<parameter> context</parameter></paramdef>
125225b89263Smrg    <paramdef>XRecordInterceptProc<parameter> callback</parameter></paramdef>
125325b89263Smrg    <paramdef>XPointer<parameter> closure</parameter></paramdef>
125425b89263Smrg</funcprototype>
125525b89263Smrg</funcsynopsis>
125625b89263Smrg
125725b89263Smrg<variablelist remap='IP'>
125825b89263Smrg  <varlistentry>
125925b89263Smrg    <term><emphasis remap='I'>display</emphasis></term>
126025b89263Smrg    <listitem><para>Specifies the connection to the X server.</para></listitem>
126125b89263Smrg  </varlistentry>
126225b89263Smrg  <varlistentry>
126325b89263Smrg    <term><emphasis remap='I'>context</emphasis></term>
126425b89263Smrg    <listitem><para>Specifies the record context to enable.</para></listitem>
126525b89263Smrg  </varlistentry>
126625b89263Smrg  <varlistentry>
126725b89263Smrg    <term><emphasis remap='I'>callback</emphasis></term>
126825b89263Smrg    <listitem><para>Specifies the function to be called for each protocol element received.</para></listitem>
126925b89263Smrg  </varlistentry>
127025b89263Smrg  <varlistentry>
127125b89263Smrg    <term><emphasis remap='I'>closure</emphasis></term>
127225b89263Smrg    <listitem><para>Specifies data passed to callback.</para></listitem>
127325b89263Smrg  </varlistentry>
127425b89263Smrg</variablelist>
127525b89263Smrg
127625b89263Smrg<para>
127706f32fbeSmrg<xref linkend='XRecordEnableContextAsync' xrefstyle='select: title'/>
127825b89263Smrgenables data transfer between the recording
127925b89263Smrgclient and the X server just as
128006f32fbeSmrg<xref linkend='XRecordEnableContext' xrefstyle='select: title'/>
128125b89263Smrgdoes.  Unlike
128206f32fbeSmrg<xref linkend='XRecordEnableContext' xrefstyle='select: title'/>
128325b89263Smrgit does not wait for the context to be disabled
128425b89263Smrgbefore returning;
128506f32fbeSmrg<xref linkend='XRecordEnableContextAsync' xrefstyle='select: title'/>
128625b89263Smrgreturns as soon as the
128725b89263Smrg<function>XRecordStartOfData</function>
128825b89263Smrgreply has been received and processed.
128925b89263Smrg</para>
129025b89263Smrg
129125b89263Smrg<para>
129206f32fbeSmrg<xref linkend='XRecordEnableContextAsync' xrefstyle='select: title'/>
129325b89263Smrgreturns zero if it could not allocate the
129425b89263Smrgnecessary memory and nonzero if it sent the request successfully to
129525b89263Smrgthe server.  The context argument must specify a valid
129625b89263Smrg<function>XRecordContext</function>
129725b89263Smrgor a
129825b89263Smrg<function>XRecordBadContext</function>
129925b89263Smrgerror results.  The error
130025b89263Smrg<function>BadMatch</function>
130125b89263Smrgresults when data transfer is already enabled.
130225b89263Smrg</para>
130325b89263Smrg
130425b89263Smrg<para>
130525b89263SmrgEach time it reads data from the server connection, Xlib will check
130625b89263Smrgfor incoming replies and call <emphasis remap='I'>callback</emphasis>
130725b89263Smrgas necessary.  The application may direct Xlib explicitly to check
130825b89263Smrgfor Record data with the
130906f32fbeSmrg<xref linkend='XRecordProcessReplies' xrefstyle='select: title'/>
131025b89263Smrgfunction.
131125b89263Smrg</para>
131225b89263Smrg
131306f32fbeSmrg<funcsynopsis id='XRecordProcessReplies'>
131425b89263Smrg<funcprototype>
131525b89263Smrg  <funcdef>void <function>XRecordProcessReplies</function></funcdef>
131625b89263Smrg    <paramdef>Display<parameter> *display</parameter></paramdef>
131725b89263Smrg</funcprototype>
131825b89263Smrg</funcsynopsis>
131925b89263Smrg
132025b89263Smrg<variablelist remap='IP'>
132125b89263Smrg  <varlistentry>
132225b89263Smrg    <term><emphasis remap='I'>display</emphasis></term>
132325b89263Smrg    <listitem><para>Specifies the connection to the X server.</para></listitem>
132425b89263Smrg  </varlistentry>
132525b89263Smrg</variablelist>
132625b89263Smrg
132725b89263Smrg<para>
132806f32fbeSmrg<xref linkend='XRecordProcessReplies' xrefstyle='select: title'/>
132925b89263Smrgwill check for any replies that have not yet
133025b89263Smrgbeen processed by the application.  The asynchronous callback will be called
133125b89263Smrgas appropriate.
133206f32fbeSmrg<xref linkend='XRecordProcessReplies' xrefstyle='select: title'/>
133325b89263Smrgreturns when all immediately
133425b89263Smrgavailable replies have been processed.  It does not block.
133525b89263Smrg</para>
133625b89263Smrg
133725b89263Smrg<para>To free the data passed to the
133825b89263Smrg<function>XRecordInterceptProc</function>
133925b89263Smrgcallback, use
134006f32fbeSmrg<xref linkend='XRecordFreeData' xrefstyle='select: title'/></para>
134125b89263Smrg
134206f32fbeSmrg<funcsynopsis id='XRecordFreeData'>
134325b89263Smrg<funcprototype>
134425b89263Smrg  <funcdef>void <function>XRecordFreeData</function></funcdef>
134525b89263Smrg    <paramdef>XRecordInterceptData<parameter> *data</parameter></paramdef>
134625b89263Smrg</funcprototype>
134725b89263Smrg</funcsynopsis>
134825b89263Smrg
134925b89263Smrg<variablelist remap='IP'>
135025b89263Smrg  <varlistentry>
135125b89263Smrg    <term><emphasis remap='I'>data</emphasis></term>
135225b89263Smrg    <listitem><para>Specifies the structure that is to be freed.</para></listitem>
135325b89263Smrg  </varlistentry>
135425b89263Smrg</variablelist>
135525b89263Smrg
135625b89263Smrg
135725b89263Smrg<para>
135806f32fbeSmrg<xref linkend='XRecordFreeData' xrefstyle='select: title'/>
135925b89263Smrgfrees the data pointed to by data.  If the argument does not match an
136025b89263Smrg<function>XRecordInterceptData</function>
136125b89263Smrgpointer earlier passed to an
136225b89263Smrg<function>XRecordInterceptProc</function>
136325b89263Smrgcallback or if
136406f32fbeSmrg<xref linkend='XRecordFreeData' xrefstyle='select: title'/>
136525b89263Smrghas already been called with it, the behavior is undefined.
136625b89263Smrg</para>
136725b89263Smrg</sect2>
136825b89263Smrg
136906f32fbeSmrg<sect2 id='Disable_Context'>
137025b89263Smrg<title>Disable Context</title>
137125b89263Smrg
137225b89263Smrg<para>
137325b89263SmrgTo direct the X server to halt the reporting of recorded protocol, the
137425b89263Smrgprogram executes
137506f32fbeSmrg<xref linkend='XRecordDisableContext' xrefstyle='select: title'/>
137625b89263Smrgtypically over its control connection to the X server.
137725b89263Smrg</para>
137825b89263Smrg
137906f32fbeSmrg<funcsynopsis id='XRecordDisableContext'>
138025b89263Smrg<funcprototype>
138125b89263Smrg  <funcdef>Status <function>XRecordDisableContext</function></funcdef>
138225b89263Smrg    <paramdef>Display<parameter> *display</parameter></paramdef>
138325b89263Smrg    <paramdef>XRecordContext<parameter> context</parameter></paramdef>
138425b89263Smrg</funcprototype>
138525b89263Smrg</funcsynopsis>
138625b89263Smrg
138725b89263Smrg<variablelist remap='IP'>
138825b89263Smrg  <varlistentry>
138925b89263Smrg    <term><emphasis remap='I'>display</emphasis></term>
139025b89263Smrg    <listitem><para>Specifies the connection to the X server.</para></listitem>
139125b89263Smrg  </varlistentry>
139225b89263Smrg  <varlistentry>
139325b89263Smrg    <term><emphasis remap='I'>context</emphasis></term>
139425b89263Smrg    <listitem><para>Specifies the record context to disable.</para></listitem>
139525b89263Smrg  </varlistentry>
139625b89263Smrg</variablelist>
139725b89263Smrg
139825b89263Smrg
139925b89263Smrg<para>
140025b89263SmrgThe
140106f32fbeSmrg<xref linkend='XRecordDisableContext' xrefstyle='select: title'/>
140225b89263Smrgfunction disables context, stopping all recording over its data connection.
140325b89263SmrgAny complete protocol elements for context that were buffered in the
140425b89263Smrgserver will be sent to the recording client rather than being discarded.
140525b89263SmrgIf a program attempts to disable an
140625b89263Smrg<function>XRecordContext</function>
140725b89263Smrgthat has not been enabled, no action will take place.
140825b89263Smrg</para>
140925b89263Smrg
141025b89263Smrg<para>
141106f32fbeSmrg<xref linkend='XRecordDisableContext' xrefstyle='select: title'/>
141225b89263Smrgreturns zero if the request failed; otherwise, it
141325b89263Smrgreturns nonzero.  The context argument must specify a valid
141425b89263Smrg<function>XRecordContext</function>
141525b89263Smrgor an
141625b89263Smrg<function>XRecordBadContext</function>
141725b89263Smrgerror results.
141825b89263Smrg</para>
141925b89263Smrg</sect2>
142025b89263Smrg</sect1>
142125b89263Smrg
142206f32fbeSmrg<sect1 id='ID_Base_Mask'>
142306f32fbeSmrg<title>ID Base Mask</title>
142425b89263Smrg
142525b89263Smrg<para>
142625b89263SmrgTo determine the mask the server uses for the client ID base, use
142706f32fbeSmrg<xref linkend='XRecordIdBaseMask' xrefstyle='select: title'/></para>
142825b89263Smrg
142906f32fbeSmrg<funcsynopsis id='XRecordIdBaseMask'>
143025b89263Smrg<funcprototype>
143125b89263Smrg  <funcdef>XID <function>XRecordIdBaseMask</function></funcdef>
143225b89263Smrg    <paramdef>Display<parameter> *display</parameter></paramdef>
143325b89263Smrg</funcprototype>
143425b89263Smrg</funcsynopsis>
143525b89263Smrg
143625b89263Smrg<variablelist remap='IP'>
143725b89263Smrg  <varlistentry>
143825b89263Smrg    <term><emphasis remap='I'>display</emphasis></term>
143925b89263Smrg    <listitem><para>Specifies the connection to the X server.</para></listitem>
144025b89263Smrg  </varlistentry>
144125b89263Smrg</variablelist>
144225b89263Smrg
144325b89263Smrg<para>
144425b89263SmrgThe
144506f32fbeSmrg<xref linkend='XRecordIdBaseMask' xrefstyle='select: title'/>
144625b89263Smrgfunction returns the resource ID mask passed to the client by the
144725b89263Smrgserver at connection setup.
144825b89263Smrg</para>
144925b89263Smrg
145025b89263Smrg</sect1>
145125b89263Smrg
145206f32fbeSmrg<sect1 id='Free_Context'>
145325b89263Smrg<title>Free Context</title>
145425b89263Smrg
145525b89263Smrg<para>
145625b89263SmrgBefore terminating, the program should request that the server
145725b89263Smrgfree the record context.  This is done with the
145806f32fbeSmrg<xref linkend='XRecordFreeContext' xrefstyle='select: title'/>
145925b89263Smrgfunction, typically over the record client's control connection
146025b89263Smrgto the X server.
146125b89263Smrg</para>
146225b89263Smrg
146306f32fbeSmrg<funcsynopsis id='XRecordFreeContext'>
146425b89263Smrg<funcprototype>
146525b89263Smrg  <funcdef>Status <function>XRecordFreeContext</function></funcdef>
146625b89263Smrg    <paramdef>Display<parameter> *display</parameter></paramdef>
146725b89263Smrg    <paramdef>XRecordContext<parameter> context</parameter></paramdef>
146825b89263Smrg</funcprototype>
146925b89263Smrg</funcsynopsis>
147025b89263Smrg
147125b89263Smrg<variablelist remap='IP'>
147225b89263Smrg  <varlistentry>
147325b89263Smrg    <term><emphasis remap='I'>display</emphasis></term>
147425b89263Smrg    <listitem><para>Specifies the connection to the X server.</para></listitem>
147525b89263Smrg  </varlistentry>
147625b89263Smrg  <varlistentry>
147725b89263Smrg    <term><emphasis remap='I'>context</emphasis></term>
147825b89263Smrg    <listitem><para>Specifies the record context to free.</para></listitem>
147925b89263Smrg  </varlistentry>
148025b89263Smrg</variablelist>
148125b89263Smrg
148225b89263Smrg<para>
148325b89263SmrgThe
148406f32fbeSmrg<xref linkend='XRecordFreeContext' xrefstyle='select: title'/>
148525b89263Smrgfunction frees the given context for the
148625b89263Smrgrequesting client.  Freeing a record context releases the clients
148725b89263Smrgtargeted for recording and their respective protocol ranges to
148825b89263Smrgrecord.  If protocol data is being reported to the recording client,
148925b89263Smrggenerally over the data connection to the X server, the reporting
149025b89263Smrgceases as if
149106f32fbeSmrg<xref linkend='XRecordDisableContext' xrefstyle='select: title'/>
149225b89263Smrghad been called on the given context.  When a program terminates
149325b89263Smrgwithout freeing its record context, the X server will automatically
149425b89263Smrgfree that context on behalf of the client.
149525b89263Smrg</para>
149625b89263Smrg
149725b89263Smrg<para>
149806f32fbeSmrg<xref linkend='XRecordFreeContext' xrefstyle='select: title'/>
149925b89263Smrgreturns zero if the request failed; otherwise,it
150025b89263Smrgreturns nonzero.  The context argument must specify a valid
150125b89263Smrg<function>XRecordContext</function>
150225b89263Smrgor a
150325b89263Smrg<function>XRecordBadContext</function>
150425b89263Smrgerror results.
150525b89263Smrg</para>
150625b89263Smrg
150725b89263Smrg</sect1>
150825b89263Smrg</chapter>
150925b89263Smrg</book>
1510