recordlib.xml revision 25b89263
1<?xml version="1.0" encoding="UTF-8" ?> 2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> 4 5 6<!-- lifted from troff+ms+XMan by doclifter --> 7<book id="recordlib"> 8 9<bookinfo> 10 <title>X Record Extension Library</title> 11 <subtitle>X Consortium Standard</subtitle> 12 <releaseinfo>X Version 11, Release 6.7</releaseinfo> 13 <authorgroup> 14 <author> 15 <firstname>Martha</firstname><surname>Zimet</surname> 16 </author> 17 </authorgroup> 18 <corpname>Network Computing Devices, Inc.</corpname> 19 <copyright><year>1994</year><holder>Network Computing Devices, Inc.</holder></copyright> 20 <copyright><year>1995</year><holder>X Consortium</holder></copyright> 21 <releaseinfo>Version 1.13</releaseinfo> 22 <affiliation><orgname>X Consortium</orgname></affiliation> 23 <productnumber>X Version 11, Release 6.7</productnumber> 24 <editor> 25 <firstname>Stephen</firstname><surname>Gildea</surname> 26 <affiliation><orgname>X Consortium</orgname></affiliation> 27 </editor> 28 29<legalnotice> 30 31<para> 32Permission to use, copy, modify, distribute, and sell this 33documentation for any purpose is hereby granted without fee, 34provided that the above copyright notice and this permission 35notice appear in all copies. Network Computing Devices, Inc. 36makes no representations about the suitability for any purpose 37of the information in this document. This documentation is 38provided "as is" without express or implied warranty. 39</para> 40 41<para> 42Permission is hereby granted, free of charge, to any person obtaining 43a copy of this software and associated documentation files 44(the "Software"), to deal in the Software without 45restriction, including without limitation the rights to use, copy, 46modify, merge, publish, distribute, sublicense, and/or sell copies of 47the Software, and to permit persons to whom the Software is furnished 48to do so, subject to the following conditions: 49</para> 50 51<para>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 52EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 53MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 54IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 55OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 56ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 57OTHER DEALINGS IN THE SOFTWARE. 58</para> 59 60<para> 61Except as contained in this notice, the name of the X Consortium shall 62not be used in advertising or otherwise to promote the sale, use or other 63dealings in this Software without prior written authorization from the 64X Consortium. 65</para> 66 67<para>X Window System is a trademark of The Open Group.</para> 68</legalnotice> 69</bookinfo> 70 71<chapter id="record_extension_overview"> 72<title>Record Extension Overview</title> 73<para> 74The purpose of this extension is to support the recording and reporting of 75all core X protocol and arbitrary X extension protocol. This first section 76gives an overview of the Record extension. The following sections describe 77how to use the Record extension library. 78</para> 79 80<sect1 id="synchronous_playback"> 81<title>Synchronous Playback</title> 82<para> 83Environment information is generally provided to an X-based playback 84mechanism, which might use the XTest extension to synthesize input 85events. This synchronization information defines the X state prior to 86event synthesis (for example, location of the cursor, window locations 87and sizes, installed colormap, window manager running, and so on) and 88the consequences that occur after the playback mechanism synthesizes 89the event. If the user moves the mouse into the icon window and presses 90and releases a mouse button, the device events 91<function>MotionNotify</function>, <function>ButtonPress</function>, 92and <function>ButtonRelease</function> are generated by the X server. 93Because X follows an 94event-driven model, there are consequences that follow from the user 95actions, or device events, that are in the form of X protocol. As a result 96of the previous user actions, the client could generate requests such as 97<function>ImageText8</function> and <function>PolyLine</function> to the 98X server, or the X server could send non-device events such as 99<function>Expose</function> and <function>MapNotify</function> to the 100client window. Both the 101requests and non-device events that result from user actions are known 102as consequences, which can be used as a synchronization, or control point, 103during playback. That is, the playback mechanism does not generate a specific 104synthesized event until its matching synchronization condition occurs 105(for example, the window is mapped or unmapped, the cursor changes, a text 106string displays, and so on) 107</para> 108<para> 109Because it cannot be predicted what synchronization information is required 110during playback, the Record extension makes no assumptions about the intended 111use of the recorded data. Facilities exist to record any core X protocol or 112X extension protocol. Therefore, Record does not enforce a specific 113synchronization methodology. 114</para> 115</sect1> 116 117<sect1 id="design_approach"> 118<title>Design Approach</title> 119<para> 120The design approach of the extension is to record core X protocol and 121arbitrary X extension protocol entirely within the X server itself. When 122the extension has been requested to record specific protocol by one or more 123recording clients, the protocol data is formatted and returned to the 124recording clients. The extension provides a mechanism for capturing all 125events, including input device events that do not go to any clients. 126</para> 127</sect1> 128 129<sect1 id="record_clients"> 130<title>Record Clients</title> 131<para> 132The recommended communication model for a Record application is to open two 133connections to the server—one connection for recording control and one 134connection for reading recorded protocol data. 135</para> 136<para> 137Information about recording (for example, what clients to record, what 138protocol to record for each client, and so on) is stored in resources 139called record contexts (type <function>XRecordContext</function>). Most 140Record extension functions take a record context as an argument. Although 141in theory it is possible to share record contexts between applications, 142it is expected that applications will use their own context when performing 143recording operations. 144</para> 145<para> 146A client that wishes to record X protocol does so through the library 147functions defined in 148<link linkend="library_extension_requests"> 149<xref linkend="library_extension_requests"></xref></link> 150A typical sequence of requests that a client would make is as follows: 151</para> 152<itemizedlist> 153 <listitem> 154 <para> 155<function>XRecordQueryVersion</function> 156 </para> 157 <para> 158query the extension protocol version. 159 </para> 160</listitem> 161<listitem> 162 <para> 163<function>XRecordCreateContext</function> 164 </para> 165 <para> 166request that the server create a record context for access by this client, 167and express interest in clients and protocol to be recorded. This request 168returns an <function>XRecord-Context</function>, which is an XID that is 169used by most other extension requests to identify the specified context. 170 </para> 171 </listitem> 172 <listitem> 173 <para> 174<function>XRecordEnableContext</function> 175 </para> 176 <para> 177begin the recording and reporting of protocol data. 178 </para> 179 </listitem> 180 <listitem> 181 <para> 182<function>XRecordDisableContext</function> 183 </para> 184 <para> 185end the recording and reporting of protocol data. 186 </para> 187 </listitem> 188 <listitem> 189 <para> 190<function>XRecordFreeContext</function> 191 </para> 192 <para> 193free the record context. 194 </para> 195 </listitem> 196</itemizedlist> 197 198<para> 199The header for this library is 200<<function>X11/extensions/record.h</function>>. All identifiers defined 201in the interface are supplied by this header and are prefixed with "XRecord". 202The <function>Xtst</function> library contains the 203<function>XRecord</function> functions. 204</para> 205 206</sect1> 207</chapter> 208 209<chapter id="common_arguments"> 210<title>Common Arguments</title> 211<para> 212The Record extension functions <function>XRecordCreateContext</function> 213 and <function>XRecordRegisterClients</function> allow applications to 214specify the following: 215</para> 216<itemizedlist> 217 <listitem> 218 <para> 219Individual clients or sets of clients to record 220 </para> 221 </listitem> 222 <listitem> 223 <para> 224Ranges of core X protocol and X extension protocol to record for each client 225 </para> 226 </listitem> 227</itemizedlist> 228<para> 229Protocol in the ranges specified by the recording client will be recorded 230by the server. The device_events protocol type can be specified by a 231recording client although it may not be sent to a recorded client. The 232device_events type differs from delivered_events, which also can be 233specified by a recording client; delivered_events are actually delivered to 234one or more clients. These event types are discussed in 235<link linkend="protocol_ranges"> 236<xref linkend="protocol_ranges"></xref></link> 237</para> 238 239 240<para> 241The Record extension functions <function>XRecordCreateContext</function> 242 and <function>XRecordRegisterClients</function> have the common arguments 243datum_flags, clients, and ranges, which specify whether server time 244and/or client sequence number should precede protocol elements, the 245clients or client set to record, and the protocol ranges to record, 246respectively. These are discussed in the following sections. 247</para> 248 249<sect1 id="datum_flags"> 250<title>Datum Flags</title> 251<para> 252The datum_flags argument is a set of flags OR’ed together to specify options 253for the record context. Specify zero to disable all the options. 254</para> 255 256<para> 257The <function>XRecordFromServerTime</function> flag specifies that 258<function>XRecordInterceptData</function> structures with a category of 259<function>XRecordFromServer</function> will have a server_time field specific to each 260protocol element. 261</para> 262 263<para> 264The <function>XRecordFromClientTime</function> flag specifies that 265<function>XRecordInterceptData</function> structures with a category of 266<function>XRecordFromClient</function> will have a server_time field specific 267to each protocol element. 268</para> 269 270<para> 271The <function>XRecordFromClientSequence</function> flag specifies that 272<function>XRecordInterceptData</function> structures with a category of 273<function>XRecordFromClient</function> or 274<function>XRecordClientDied</function> will have a valid client_seq field. 275</para> 276</sect1> 277 278<sect1 id="selecting_clients"> 279<title>Selecting Clients</title> 280 281<para> 282The clients argument is a pointer to an array of 283<function>XRecordClientSpec</function>. 284<function>XRecordClientSpec</function> is an integral type that holds a 285resource ID, a client resource ID base, or one of the client set constants 286defined below. 287</para> 288<para> 289Duplicate elements in the array are ignored by the functions, and if any 290element in the array is not valid, a 291<function>BadMatch</function> 292error results. A resource ID references the client that created that 293resource. The client set may be one of the following constants: 294<function>XRecordCurrentClients</function>, 295<function>XRecordFutureClients</function>, or 296<function>XRecordAllClients</function>. 297</para> 298<para> 299If the element in the array identifies a particular client, protocol 300specified by the ranges argument will be recorded by the server. The 301recorded protocol data will not be returned to the recording client until 302the record context has been enabled. This is described in 303<link linkend="data_transfer"> 304<xref linkend="data_transfer"></xref></link> 305</para> 306<para> 307If the element is <function>XRecordCurrentClients</function>, the protocol 308ranges specified by the ranges argument, except for device_events, are 309associated with each current client connection. If the element is 310<function>XRecordFutureClients</function>, the 311protocol ranges specified by the ranges argument are associated with each new 312client connection. If the element is 313<function>XRecordAllClients</function>, 314the protocol ranges specified by the ranges argument are associated with 315each current client connection and with each new client connection. 316When the context is enabled, the data connection is unregistered if it 317was registered. If the context is enabled, 318<function>XRecordCurrentClients</function> and 319<function>XRecordAllClients</function> 320silently exclude the recording data connection. It is an error to explicitly 321register the data connection. 322</para> 323</sect1> 324<sect1 id="protocol_ranges"> 325<title>Protocol Ranges</title> 326 327<para> 328The functions <function>XRecordCreateContext</function> and 329<function>XRecordRegisterClients</function> have another common argument, 330ranges, which is an array of pointers to <function>XRecordRange</function> 331structures. Each structure contains ranges of numeric values for each of 332the protocol types that can be specified and recorded individually by the 333Record extension. An <function>XRecordRange</function> structure must be 334allocated by the Record library using the 335<function>XRecordAllocRange</function> function. 336</para> 337<para> 338The <function>XRecordRange</function> typedef is a structure with the 339following members: 340</para> 341 342<literallayout remap='Ds'> 343XRecordRange: 344 XRecordRange8 core_requests /* core X requests */ 345 XRecordRange8 core_replies /* core X replies */ 346 XRecordExtRange ext_requests /* extension requests */ 347 XRecordExtRange ext_replies /* extension replies */ 348 XRecordRange8 delivered_events /* delivered core and ext events */ 349 XRecordRange8 device_events /* all core and ext device events */ 350 XRecordRange8 errors /* core X and X ext errors */ 351 Bool client_started /* connection setup reply from server */ 352 Bool client_died /* notification of client disconnect */ 353</literallayout> 354 355<para> 356The types used in 357<function>XRecordRange</function> 358members are defined as follows. The 359<function>XRecordRange8</function> 360typedef is a structure with the following members: 361</para> 362 363<literallayout remap='Ds'> 364XRecordRange8: 365 unsigned char first 366 unsigned char last 367</literallayout> 368 369<para> 370The 371<function>XRecordRange16</function> 372typedef is a structure with the following members: 373</para> 374 375<literallayout remap='Ds'> 376XRecordRange16: 377 unsigned short first 378 unsigned short last 379</literallayout> 380 381<para> 382The 383<function>XRecordExtRange</function> 384typedef is a structure with the following members: 385</para> 386 387<literallayout remap='Ds'> 388XRecordExtRange: 389 XRecordRange8 ext_major 390 XRecordRange16 ext_minor 391</literallayout> 392 393<para> 394If any of the values specified in 395<function>XRecordRange</function> 396is invalid, a 397<function>BadValue</function> 398error results. 399</para> 400 401<para> 402The core_requests member specifies the range of core X protocol 403requests to record. Core X protocol requests with a major opcode 404that is between first and last, inclusive, will be 405recorded. A 406<function>BadValue</function> 407error results if the value of first is greater than the value of last. 408If the values of both first and last are zero, no core 409X protocol requests will be recorded. 410</para> 411 412<para> 413The core_replies member specifies the range of replies resulting 414from core X protocol requests to record. Replies that result from 415core X protocol requests with a major opcode between first 416and last, inclusive, will be recorded. A 417<function>BadValue</function> 418error results if the value of first is greater than the value of last. 419If the values of both first and last are zero, no core X protocol 420replies will be recorded. 421</para> 422 423<para> 424The ext_requests member specifies the range of X extension 425requests to record. X extension requests with a major opcode 426between ext_major.first and ext_major.last, and with a 427minor opcode 428between ext_minor.first and ext_minor.last, inclusive, will be 429recorded. A 430<function>BadValue</function> 431error results 432if the value of ext_major.first is greater than the value of 433ext_major.last or if the value of ext_minor.first is 434greater than the value of ext_minor.last. If the values of both 435ext_major.first 436and ext_major.last are zero, 437no X extension requests will be recorded. 438</para> 439 440<para> 441The ext_replies member specifies the range of replies resulting 442from X extension requests to record. Replies that result from an X 443extension request with a major opcode between 444ext_major.first and 445ext_major.last, and a minor opcode that is between 446ext_minor.first and ext_minor.last will be recorded. A 447<function>BadValue</function> 448error results 449if the value of ext_major.first is greater than the value of 450ext_major.last or if the value of ext_minor.first is greater than 451the value of ext_minor.last. If the values of both 452ext_major.first and ext_major.last are zero, no X extension 453replies will be recorded. 454</para> 455 456<para> 457The delivered_events member specifies the range of both core 458X events and X extension events to record. These events are 459delivered to at least one client. Core X events and X extension events 460with a code value between first and last inclusive will be recorded. A 461<function>BadValue</function> 462error results if the value of first is greater than the value of last. 463If the values of first and last are zero, no events will be recorded. 464</para> 465 466<para> 467The device_events member specifies the range of both core X device 468events and X extension device events to record. These events may or 469may not be delivered to a client. Core X device events and X extension 470device events with a code value between first and last inclusive that 471are not delivered to any clients will be recorded. A 472<function>BadValue</function> 473error results if the value of first is greater than the value of last. A 474<function>BadValue</function> 475error results if first is less than two or last is less than two, except 476that if first and last are zero, no events will be recorded. 477</para> 478 479<para> 480The errors member specifies the range of both core X errors and X 481extension errors to record. Core X errors and X extension errors with 482a code value between first and last inclusive will be 483recorded. A 484<function>BadValue</function> 485error results if the value of first is greater than the value of last. 486If the values of first and last are zero, no errors will be recorded. 487</para> 488 489<para> 490A value of 491<function>True</function> 492for the client_started member specifies the 493connection setup reply from the server to new clients. If 494<function>False</function> 495the connection setup reply is not specified by this 496<function>XRecordRange</function> 497</para> 498 499<para> 500A value of 501<function>True</function> 502for the client_died member specifies 503notification when a client disconnects. If 504<function>False</function> 505notification when a client disconnects is not specified by this 506<function>XRecordRange</function> 507</para> 508</sect1> 509</chapter> 510 511<chapter id='library_extension_requests'> 512<title>Library Extension Requests</title> 513 514<para> 515Recording operations are accessed by programs through the use of 516new protocol requests. The following functions are provided as extensions 517to Xlib. An Xlib error results if 518an extension request is made to an X server that does not support the 519Record extension. Note that any of the extension protocol requests may generate 520<function>BadAlloc</function> 521or 522<function>BadLength</function> 523errors. 524</para> 525 526<sect1 id='query_extension_version'> 527<title>Query Extension Version</title> 528 529<para> 530An application uses the 531<function>XRecordQueryVersion</function> 532function to determine 533the version of the Record extension protocol supported by an X server. 534</para> 535 536<funcsynopsis> 537<funcprototype> 538 <funcdef>Status <function>XRecordQueryVersion</function></funcdef> 539 <paramdef>Display <parameter> *display</parameter></paramdef> 540 <paramdef>int <parameter> cmajor_return</parameter></paramdef> 541 <paramdef>int <parameter> cminor_return</parameter></paramdef> 542</funcprototype> 543</funcsynopsis> 544 545<variablelist remap='IP'> 546 <varlistentry> 547 <term><emphasis remap='I'>display</emphasis></term> 548 <listitem><para>Returns the connection to the X server.</para></listitem> 549 </varlistentry> 550 <varlistentry> 551 <term><emphasis remap='I'>cmajor_return</emphasis></term> 552 <listitem><para>Returns the extension protocol major version in use.</para></listitem> 553 </varlistentry> 554 <varlistentry> 555 <term><emphasis remap='I'>cminor_return</emphasis></term> 556 <listitem><para>Returns the extension protocol minor version in use.</para></listitem> 557 </varlistentry> 558</variablelist> 559 560<para> 561The 562<function>XRecordQueryVersion</function> 563function returns the major and minor protocol version numbers supported by 564the server. 565<function>XRecordQueryVersion</function> 566returns nonzero (success) only if the returned version numbers are 567common to both the library and the server; otherwise, it returns zero. 568</para> 569</sect1> 570 571<sect1 id='create_and_modify_context'> 572<title>Create and Modify Context</title> 573 574<para> 575An application uses the 576<function>XRecordCreateContext</function> 577function to create a record context. At the time the record context is 578created by the recording client, the clients to be recorded and the 579protocol to record for each client may be specified. 580</para> 581 582<funcsynopsis> 583<funcprototype> 584 <funcdef>XRecordContext <function>XRecordCreateContext</function></funcdef> 585 <paramdef>Display <parameter> *display</parameter></paramdef> 586 <paramdef>int <parameter> datum_flags</parameter></paramdef> 587 <paramdef>XRecordClientSpec <parameter> *clients</parameter></paramdef> 588 <paramdef>int <parameter> nclients</parameter></paramdef> 589 <paramdef>XRecordRange <parameter> *ranges</parameter></paramdef> 590 <paramdef>int <parameter> nranges</parameter></paramdef> 591</funcprototype> 592</funcsynopsis> 593 594<variablelist remap='IP'> 595 <varlistentry> 596 <term><emphasis remap='I'>display</emphasis></term> 597 <listitem><para>Returns the connection to the X server.</para></listitem> 598 </varlistentry> 599 <varlistentry> 600 <term><emphasis remap='I'>datum_flags</emphasis></term> 601 <listitem><para>Specifies whether detailed time or sequence info should be sent.</para></listitem> 602 </varlistentry> 603 <varlistentry> 604 <term><emphasis remap='I'>clients</emphasis></term> 605 <listitem><para>Specifies the clients to record.</para></listitem> 606 </varlistentry> 607 <varlistentry> 608 <term><emphasis remap='I'>nclients</emphasis></term> 609 <listitem><para>Specifies the number of clients.</para></listitem> 610 </varlistentry> 611 <varlistentry> 612 <term><emphasis remap='I'>ranges</emphasis></term> 613 <listitem><para>Specifies the protocol ranges to record.</para></listitem> 614 </varlistentry> 615 <varlistentry> 616 <term><emphasis remap='I'>nranges</emphasis></term> 617 <listitem><para>Specifies the number of protocol ranges.</para></listitem> 618 </varlistentry> 619</variablelist> 620 621<para> 622The 623<function>XRecordCreateContext</function> 624function creates a record context and returns an 625<function>XRecordContext</function> 626which is then used in the other Record library calls. This request is 627typically executed by the recording client over its control connection to 628the X server. The datum_flags specifies whether server time and/or client 629sequence number should precede protocol elements recorded by context ( 630<link linkend="datum_flags"> 631<xref linkend="datum_flags"></xref></link> 632). When a clients element identifies a particular client, the client is added 633to the context and the protocol to record for that client is set to the 634union of all ranges. When a clients element is 635<function>XRecordCurrentClients</function> 636<function>XRecordFutureClients</function> 637or 638<function>XRecordAllClients</function> 639the actions described in 640<link linkend="selecting_clients"> 641<xref linkend="selecting_clients"></xref></link> 642are performed. 643</para> 644 645<para> 646<function>XRecordCreateContext</function> 647returns zero if the request failed. 648<function>XRecordCreateContext</function> 649can generate 650<function>BadIDChoice</function> 651<function>BadMatch</function> 652and 653<function>BadValue</function> 654errors. 655</para> 656 657<para>The ranges argument is an 658<function>XRecordRange</function> 659array, that is, an array 660of pointers. The structures the elements point to shall be allocated 661by calling 662<function>XRecordAllocRange</function></para> 663 664<literallayout remap='FD'> 665XRecordRange * 666XRecordAllocRange(void) 667</literallayout> <!-- remap='FN' --> 668 669<para> 670The 671<function>XRecordAllocRange</function> 672function 673allocates and returns an 674<function>XRecordRange</function> 675structure. 676The structure is initialized to specify no protocol. 677The function returns NULL if the structure allocation fails. 678The application can free the structure by calling 679<function>XFree</function> 680</para> 681 682<sect2 id='additions'> 683<title>Additions</title> 684 685<para> 686An application uses the 687<function>XRecordRegisterClients</function> 688function to modify a previously created 689record context, by adding clients or modifying the recorded protocol, 690typically over its control connection to the X server. 691</para> 692 693<funcsynopsis> 694<funcprototype> 695 <funcdef>Status <function>XRecordRegisterClients</function></funcdef> 696 <paramdef>Display <parameter> *display</parameter></paramdef> 697 <paramdef>XRecordContext <parameter> context</parameter></paramdef> 698 <paramdef>int <parameter> datum_flags</parameter></paramdef> 699 <paramdef>XRecordClientSpec <parameter> *clients</parameter></paramdef> 700 <paramdef>int <parameter> nclients</parameter></paramdef> 701 <paramdef>XRecordRange <parameter> *ranges</parameter></paramdef> 702 <paramdef>int <parameter> nranges</parameter></paramdef> 703</funcprototype> 704</funcsynopsis> 705 706<variablelist remap='IP'> 707 <varlistentry> 708 <term><emphasis remap='I'>display</emphasis></term> 709 <listitem><para>Returns the connection to the X server.</para></listitem> 710 </varlistentry> 711 <varlistentry> 712 <term><emphasis remap='I'>context</emphasis></term> 713 <listitem><para>Specifies the record context to modify.</para></listitem> 714 </varlistentry> 715 <varlistentry> 716 <term><emphasis remap='I'>datum_flags</emphasis></term> 717 <listitem><para>Specifies whether detailed time or sequence info should be sent.</para></listitem> 718 </varlistentry> 719 <varlistentry> 720 <term><emphasis remap='I'>clients</emphasis></term> 721 <listitem><para>Specifies the clients to record.</para></listitem> 722 </varlistentry> 723 <varlistentry> 724 <term><emphasis remap='I'>nclients</emphasis></term> 725 <listitem><para>Specifies the number of clients.</para></listitem> 726 </varlistentry> 727 <varlistentry> 728 <term><emphasis remap='I'>ranges</emphasis></term> 729 <listitem><para>Specifies the protocol ranges to record.</para></listitem> 730 </varlistentry> 731 <varlistentry> 732 <term><emphasis remap='I'>nranges</emphasis></term> 733 <listitem><para>Specifies the number of protocol ranges.</para></listitem> 734 </varlistentry> 735</variablelist> 736 737<para> 738The datum_flags specifies whether server time and/or client sequence number 739should precede protocol elements for all clients recorded by context (See 740<link linkend="datum_flags"> 741<xref linkend="datum_flags"></xref></link> 742). When a clients element identifies a particular client and the client is 743not yet targeted for recording in the given context, the client is added 744to the set of clients to record, and the protocol to record for that client 745is set to the union of all ranges. When the client is 746already targeted for recording, the protocol to record for that client 747is set to the union of all ranges. When the element is 748<function>XRecordCurrentClients</function> 749<function>XRecordFutureClients</function> 750or 751<function>XRecordAllClients</function> 752the actions described in 753<link linkend="selecting_clients"> 754<xref linkend="selecting_clients"></xref></link> 755are performed. 756</para> 757 758<para> 759<function>XRecordRegisterClients</function> 760returns zero if the request failed; otherwise, it 761returns nonzero. 762</para> 763 764<para> 765<function>XRecordRegisterClients</function> 766can generate 767<function>XRecordBadContext</function> 768<function>BadMatch</function> 769and 770<function>BadValue</function> 771errors. 772</para> 773</sect2> 774 775<sect2 id='deletions'> 776<title>Deletions</title> 777 778<para> 779An application uses the 780<function>XRecordUnregisterClients</function> 781function to delete clients from a previously created 782record context, typically over its control connection to the X server. 783</para> 784 785<funcsynopsis> 786<funcprototype> 787 <funcdef>Status <function>XRecordUnRegisterClients</function></funcdef> 788 <paramdef>Display <parameter> *display</parameter></paramdef> 789 <paramdef>XRecordContext <parameter> context</parameter></paramdef> 790 <paramdef>XRecordClientSpec <parameter> *clients</parameter></paramdef> 791 <paramdef>int <parameter> nclients</parameter></paramdef> 792</funcprototype> 793</funcsynopsis> 794 795<variablelist remap='IP'> 796 <varlistentry> 797 <term><emphasis remap='I'>display</emphasis></term> 798 <listitem><para>Returns the connection to the X server.</para></listitem> 799 </varlistentry> 800 <varlistentry> 801 <term><emphasis remap='I'>context</emphasis></term> 802 <listitem><para>Specifies the record context to modify.</para></listitem> 803 </varlistentry> 804 <varlistentry> 805 <term><emphasis remap='I'>clients</emphasis></term> 806 <listitem><para>Specifies the clients to stop recording.</para></listitem> 807 </varlistentry> 808 <varlistentry> 809 <term><emphasis remap='I'>nclients</emphasis></term> 810 <listitem><para>Specifies the number of clients.</para></listitem> 811 </varlistentry> 812</variablelist> 813 814<para> 815When an element in clients identifies a particular client, and the 816specified client is already targeted for recording in the given 817context, the client and the set of protocol to record for that 818client are deleted from the context. If the specified client is not 819targeted for recording, then no action is performed. 820</para> 821 822<para> 823When the element is 824<function>XRecordCurrentClients</function> 825all clients currently targeted for recording in context and their 826corresponding sets of protocol to record are deleted from context. 827</para> 828 829<para> 830When the item is 831<function>XRecordFutureClients</function> 832any future client connections will not automatically be targeted for 833recording in context. 834</para> 835 836<para> 837When the element is 838<function>XRecordAllClients</function> 839all clients currently targeted for recording in context and their 840corresponding sets of protocol to record are deleted from context. 841Any future client connections will not automatically be targeted 842for recording in context. 843</para> 844 845<para> 846<function>XRecordUnregisterClients</function> 847returns zero if the request failed; otherwise, it returns nonzero. 848</para> 849 850<para> 851<function>XRecordUnregisterClients</function> 852can generate 853<function>XRecordBadContext</function> 854<function>BadMatch</function> 855and 856<function>BadValue</function> 857errors.</para> 858</sect2> 859</sect1> 860 861<sect1 id='query_context_state'> 862<title>Query Context State</title> 863 864<para> 865An application uses the 866<function>XRecordGetContext</function> 867function to query the current state of a record context, typically over 868its control connection to the X server. 869</para> 870 871<funcsynopsis> 872<funcprototype> 873 <funcdef>Status <function>XRecordGetContext</function></funcdef> 874 <paramdef>Display <parameter> *display</parameter></paramdef> 875 <paramdef>XRecordContext <parameter> context</parameter></paramdef> 876 <paramdef>XRecordState <parameter> **state_return</parameter></paramdef> 877</funcprototype> 878</funcsynopsis> 879 880<variablelist remap='IP'> 881 <varlistentry> 882 <term><emphasis remap='I'>display</emphasis></term> 883 <listitem><para>Specifies the connection to the X server.</para></listitem> 884 </varlistentry> 885 <varlistentry> 886 <term><emphasis remap='I'>context</emphasis></term> 887 <listitem><para>Specifies the record context to query.</para></listitem> 888 </varlistentry> 889 <varlistentry> 890 <term><emphasis remap='I'>state_return</emphasis></term> 891 <listitem><para>Specifies the address of a variable into which 892the function stores a pointer to the current state of the record context. 893 </para></listitem> 894 </varlistentry> 895</variablelist> 896 897<para> 898The 899<function>XRecordState</function> 900typedef returned by 901<function>XRecordGetContext</function> 902is a structure with the following members: 903</para> 904 905<literallayout remap='Ds'> 906XRecordState: 907 Bool enabled 908 int datum_flags 909 unsigned long nclients 910 XRecordClientInfo **client_info 911</literallayout> 912 913<para> 914The enabled member is set to the state of data transfer and is 915<function>True</function> 916when the recording client has asked that recorded data be sent; 917otherwise it is 918<function>False</function> 919The datum_flags member is set to the value of these flags for this context. 920The nclients member is set to the number of 921<function>XRecordClientInfo</function> 922structures returned. The client_info member is an array of pointers to 923<function>XRecordClientInfo</function> 924structures that contain the protocol to record for each targeted client. The 925<function>XRecordClientInfo</function> 926typedef is a structure with the following members: 927</para> 928 929<literallayout remap='Ds'> 930XRecordClientInfo: 931 XRecordClientSpec client 932 unsigned long nranges 933 XRecordRange **ranges 934</literallayout> 935 936<para> 937The client member either identifies a client targeted for recording 938or is set to 939<function>XRecordFutureClients</function> 940to describe how future clients will be automatically targeted for recording. 941The nranges member is set to the number of protocol 942ranges to be recorded for the specified client. The ranges member 943is an array of pointers to 944<function>XRecordRange</function> 945structures, which specify the protocol ranges to record. 946</para> 947 948<para> 949<function>XRecordGetContext</function> 950returns zero if the request failed; otherwise, it returns nonzero. 951The context argument must specify a valid 952<function>XRecordContext</function> 953or a 954<function>XRecordBadContext</function> 955error results. 956</para> 957 958<para> 959Recording clients should use the 960<function>XRecordFreeState</function> 961function to free the state data returned by 962<function>XRecordGetContext</function> 963</para> 964 965<funcsynopsis> 966<funcprototype> 967 <funcdef>void <function>XRecordFreeState</function></funcdef> 968 <paramdef>XRecordState <parameter> *state</parameter></paramdef> 969</funcprototype> 970</funcsynopsis> 971 972<variablelist remap='IP'> 973 <varlistentry> 974 <term><emphasis remap='I'>state</emphasis></term> 975 <listitem><para>Specifies the structure that is to be freed.</para></listitem> 976 </varlistentry> 977</variablelist> 978 979<para> 980<function>XRecordFreeState</function> 981frees the data pointed to by state. If the argument does not match an 982<function>XRecordState</function> 983pointer returned from a successful call to 984<function>XRecordGetContext</function> 985or if 986<function>XRecordFreeState</function> 987has already been called with it, the behavior is undefined. 988</para> 989</sect1> 990 991<sect1 id='data_transfer'> 992<title>Data Transfer</title> 993 994<para> 995An application uses the 996<function>XRecordEnableContext</function> 997and 998<function>XRecordDisableContext</function> 999functions to change the state of data transfer 1000between the X server and the recording client. These functions allow 1001the application to start recording and reporting of protocol data 1002and to stop recording and reporting of protocol data, respectively. 1003</para> 1004 1005<sect2 id='enable_context'> 1006<title>Enable Context</title> 1007 1008<para> 1009To direct the X server to record and report protocol, a program uses 1010<function>XRecordEnableContext</function> 1011typically over its data connection to the X 1012server. The reporting of recorded protocol back to the recording client 1013is handled by the following data structures and procedure definitions. 1014Each recorded protocol element is reported to the recording client through an 1015<function>XRecordInterceptData</function> 1016typedef, a structure with the following members: 1017</para> 1018 1019<literallayout remap='Ds'> 1020XRecordInterceptData: 1021 XID id_base 1022 Time server_time 1023 unsigned long client_seq 1024 int category 1025 Bool client_swapped 1026 unsigned char *data 1027 unsigned long data_len 1028</literallayout> 1029 1030<para> 1031The id_base member is set to the resource identifier base sent to the 1032client in the connection setup reply and therefore identifies the client 1033being recorded, except when the recorded protocol data is a device 1034event that may have not been delivered to a client. In this case, 1035id_base is set to zero. The server_time member 1036is set to the time of the server when the protocol was recorded. 1037It is the time that was attached to this protocol element in the reply, 1038if so specified by datum_flags, 1039or else the time from the header of the reply that contained 1040this protocol element. 1041The client_seq member is the sequence number of the recorded 1042client's most recent request processed by the server at the time this 1043protocol element was recorded, if this information were included in the 1044recorded data; otherwise client_seq is 0. 1045The category member is set to one of the following values: 1046<function>XRecordStartOfData</function> 1047<function>XRecordFromServer</function> 1048<function>XRecordFromClient</function> 1049<function>XRecordClientStarted</function> 1050<function>XRecordClientDied</function> 1051or 1052<function>XRecordEndOfData</function> 1053<function>XRecordStartOfData</function> 1054is immediately sent as the first reply to confirm that the context is enabled. 1055<function>XRecordFromClient</function> 1056indicates the protocol 1057data is from the recorded client to the server (requests). 1058<function>XRecordFromServer</function> 1059indicates the protocol data is from the server to the recorded client 1060(replies, errors, events, or device events). 1061<function>XRecordClientStarted</function> 1062indicates that the protocol data is the connection setup reply from the server. 1063<function>XRecordClientDied</function> 1064indicates that the recorded client has closed its connection 1065to the X server; there is no protocol data. 1066<function>XRecordEndOfData</function> 1067indicates that the context has been disabled and that 1068this is the last datum. It does not correspond to any protocol or 1069state change in a recorded client. There is no protocol data. 1070</para> 1071 1072<para> 1073The client_swapped member is set to 1074<function>True</function> 1075if the byte order of the client being recorded is swapped relative to 1076the recording client; otherwise, it is set to 1077<function>False</function> 1078All recorded protocol data is returned in the byte order of the recorded 1079client. Therefore, recording clients are responsible for all byte swapping, 1080if required. Device events are in the byte order of the recording client. 1081For replies of category 1082<function>XRecordStartOfData</function> 1083and 1084<function>XRecordEndOfData</function> 1085client_swapped is set according 1086to the byte order of the server relative to the recording client. 1087</para> 1088 1089<para> 1090The data member contains the actual recorded protocol data. 1091When category is set to 1092<function>XRecordStartOfData</function> 1093<function>XRecordClientDied</function> 1094or 1095<function>XRecordEndOfData</function> 1096no protocol data are contained in data. 1097</para> 1098 1099 1100<!-- copied exactly from the protocol document --> 1101<para> 1102For the core X events 1103<function>KeyPress</function> 1104<function>KeyRelease</function> 1105<function>ButtonPress</function> 1106and 1107<function>ButtonRelease</function>, 1108the fields of a device event that contain 1109valid information are time and detail. For the core X event 1110<function>MotionNotify</function> 1111the fields of a device event that contain valid information are time, root, 1112root-x and root-y. 1113The time field refers to the time the event was generated by the device. 1114</para> 1115 1116<para>For the extension input device events 1117<function>DeviceKeyPress</function> 1118<function>DeviceKeyRelease</function> 1119<function>DeviceButtonPress</function> 1120and 1121<function>DeviceButtonRelease</function> 1122the fields of a device event that contain valid information are 1123device, time, and detail. For 1124<function>DeviceMotionNotify</function> 1125the valid device event fields are device and time. 1126For the extension input device events 1127<function>ProximityIn</function> 1128and 1129<function>ProximityOut</function> 1130the fields of a device event that contain valid 1131information are device and time. For the extension input device event 1132<function>DeviceValuator</function> 1133the fields of a device event that contain valid information are 1134device, num_valuators, first_valuator, and valuators. 1135The time field refers to the time the event was generated by the device. 1136</para> 1137 1138 1139<para> 1140The data_len member is set to the length of the actual recorded protocol 1141data in 4-byte units. 1142</para> 1143 1144<para> 1145When the context has been enabled, protocol data the recording client has 1146previously expressed interest in is recorded and returned to the 1147recording client via multiple replies. Because the X server batches 1148the recorded data, more than one protocol element may be contained 1149in the same reply packet. When a reply is received, a procedure of type 1150<function>XRecordInterceptProc</function> 1151is called for each protocol element in the reply. 1152</para> 1153 1154<funcsynopsis> 1155<funcprototype> 1156 <funcdef>typedef void <function>(*XRecordInterceptProc)</function></funcdef> 1157 <paramdef>XPointer<parameter> closure</parameter></paramdef> 1158 <paramdef>XRecordInterceptData<parameter> *recorded_data</parameter></paramdef> 1159</funcprototype> 1160</funcsynopsis> 1161 1162<variablelist remap='IP'> 1163 <varlistentry> 1164 <term><emphasis remap='I'>closure</emphasis></term> 1165 <listitem><para>Pointer that was passed in when the context was enabled.</para></listitem> 1166 </varlistentry> 1167 <varlistentry> 1168 <term><emphasis remap='I'>recorded_data</emphasis></term> 1169 <listitem><para>A protocol element recorded by the server extension.</para></listitem> 1170 </varlistentry> 1171</variablelist> 1172 1173<para> 1174This callback may use the control display connection (or any display 1175connection other than the data connection). 1176</para> 1177 1178<para> 1179Recording clients should use the 1180<function>XRecordFreeData</function> 1181function to free the 1182<function>XRecordInterceptData</function> 1183structure. 1184</para> 1185 1186<funcsynopsis> 1187<funcprototype> 1188 <funcdef>Status <function>XRecordEnableContext</function></funcdef> 1189 <paramdef>Display<parameter> *display</parameter></paramdef> 1190 <paramdef>XRecordContext<parameter> context</parameter></paramdef> 1191 <paramdef>XRecordInterceptProc<parameter> callback</parameter></paramdef> 1192 <paramdef>XPointer<parameter> closure</parameter></paramdef> 1193</funcprototype> 1194</funcsynopsis> 1195 1196<variablelist remap='IP'> 1197 <varlistentry> 1198 <term><emphasis remap='I'>display</emphasis></term> 1199 <listitem><para>Specifies the connection to the X server.</para></listitem> 1200 </varlistentry> 1201 <varlistentry> 1202 <term><emphasis remap='I'>context</emphasis></term> 1203 <listitem><para>Specifies the record context to enable.</para></listitem> 1204 </varlistentry> 1205 <varlistentry> 1206 <term><emphasis remap='I'>callback</emphasis></term> 1207 <listitem><para>Specifies the function to be called for each protocol element received.</para></listitem> 1208 </varlistentry> 1209 <varlistentry> 1210 <term><emphasis remap='I'>closure</emphasis></term> 1211 <listitem><para>Specifies data passed to callback.</para></listitem> 1212 </varlistentry> 1213</variablelist> 1214 1215 1216<para> 1217<function>XRecordEnableContext</function> 1218enables data transfer between the recording client and 1219the X server. All core and extension protocol received from or sent to 1220targeted clients that the recording client has expressed 1221interest in will be recorded and reported to the recording client. 1222</para> 1223 1224<para> 1225<function>XRecordEnableContext</function> 1226returns zero if the request failed; otherwise, it 1227returns nonzero. The context argument must specify a valid 1228<function>XRecordContext</function> 1229or a 1230<function>XRecordBadContext</function> 1231error results. The error 1232<function>BadMatch</function> 1233results when data transfer is already enabled on the given context. 1234</para> 1235</sect2> 1236 1237<sect2 id='enable_context_asynchronously'> 1238<title>Enable Context Asynchronously</title> 1239 1240<para>Because 1241<function>XRecordEnableContext</function> 1242does not return until 1243<function>XRecordDisableContext</function> 1244is executed on the control connection, a nonblocking interface in 1245addition to 1246<function>XRecordEnableContext</function> 1247is provided. This interface also 1248enables data transfer; however, it does not block. 1249</para> 1250 1251<para> 1252This interface is defined as follows: 1253</para> 1254 1255<funcsynopsis> 1256<funcprototype> 1257 <funcdef>Status <function>XRecordEnableContextAsync</function></funcdef> 1258 <paramdef>Display<parameter> *display</parameter></paramdef> 1259 <paramdef>XRecordContext<parameter> context</parameter></paramdef> 1260 <paramdef>XRecordInterceptProc<parameter> callback</parameter></paramdef> 1261 <paramdef>XPointer<parameter> closure</parameter></paramdef> 1262</funcprototype> 1263</funcsynopsis> 1264 1265<variablelist remap='IP'> 1266 <varlistentry> 1267 <term><emphasis remap='I'>display</emphasis></term> 1268 <listitem><para>Specifies the connection to the X server.</para></listitem> 1269 </varlistentry> 1270 <varlistentry> 1271 <term><emphasis remap='I'>context</emphasis></term> 1272 <listitem><para>Specifies the record context to enable.</para></listitem> 1273 </varlistentry> 1274 <varlistentry> 1275 <term><emphasis remap='I'>callback</emphasis></term> 1276 <listitem><para>Specifies the function to be called for each protocol element received.</para></listitem> 1277 </varlistentry> 1278 <varlistentry> 1279 <term><emphasis remap='I'>closure</emphasis></term> 1280 <listitem><para>Specifies data passed to callback.</para></listitem> 1281 </varlistentry> 1282</variablelist> 1283 1284<para> 1285<function>XRecordEnableContextAsync</function> 1286enables data transfer between the recording 1287client and the X server just as 1288<function>XRecordEnableContext</function> 1289does. Unlike 1290<function>XRecordEnableContext</function> 1291it does not wait for the context to be disabled 1292before returning; 1293<function>XRecordEnableContextAsync</function> 1294returns as soon as the 1295<function>XRecordStartOfData</function> 1296reply has been received and processed. 1297</para> 1298 1299<para> 1300<function>XRecordEnableContextAsync</function> 1301returns zero if it could not allocate the 1302necessary memory and nonzero if it sent the request successfully to 1303the server. The context argument must specify a valid 1304<function>XRecordContext</function> 1305or a 1306<function>XRecordBadContext</function> 1307error results. The error 1308<function>BadMatch</function> 1309results when data transfer is already enabled. 1310</para> 1311 1312<para> 1313Each time it reads data from the server connection, Xlib will check 1314for incoming replies and call <emphasis remap='I'>callback</emphasis> 1315as necessary. The application may direct Xlib explicitly to check 1316for Record data with the 1317<function>XRecordProcessReplies</function> 1318function. 1319</para> 1320 1321<funcsynopsis> 1322<funcprototype> 1323 <funcdef>void <function>XRecordProcessReplies</function></funcdef> 1324 <paramdef>Display<parameter> *display</parameter></paramdef> 1325</funcprototype> 1326</funcsynopsis> 1327 1328<variablelist remap='IP'> 1329 <varlistentry> 1330 <term><emphasis remap='I'>display</emphasis></term> 1331 <listitem><para>Specifies the connection to the X server.</para></listitem> 1332 </varlistentry> 1333</variablelist> 1334 1335<para> 1336<function>XRecordProcessReplies</function> 1337will check for any replies that have not yet 1338been processed by the application. The asynchronous callback will be called 1339as appropriate. 1340<function>XRecordProcessReplies</function> 1341returns when all immediately 1342available replies have been processed. It does not block. 1343</para> 1344 1345<para>To free the data passed to the 1346<function>XRecordInterceptProc</function> 1347callback, use 1348<function>XRecordFreeData</function></para> 1349 1350<funcsynopsis> 1351<funcprototype> 1352 <funcdef>void <function>XRecordFreeData</function></funcdef> 1353 <paramdef>XRecordInterceptData<parameter> *data</parameter></paramdef> 1354</funcprototype> 1355</funcsynopsis> 1356 1357<variablelist remap='IP'> 1358 <varlistentry> 1359 <term><emphasis remap='I'>data</emphasis></term> 1360 <listitem><para>Specifies the structure that is to be freed.</para></listitem> 1361 </varlistentry> 1362</variablelist> 1363 1364 1365<para> 1366<function>XRecordFreeData</function> 1367frees the data pointed to by data. If the argument does not match an 1368<function>XRecordInterceptData</function> 1369pointer earlier passed to an 1370<function>XRecordInterceptProc</function> 1371callback or if 1372<function>XRecordFreeData</function> 1373has already been called with it, the behavior is undefined. 1374</para> 1375</sect2> 1376 1377<sect2 id='disable_context'> 1378<title>Disable Context</title> 1379 1380<para> 1381To direct the X server to halt the reporting of recorded protocol, the 1382program executes 1383<function>XRecordDisableContext</function> 1384typically over its control connection to the X server. 1385</para> 1386 1387<funcsynopsis> 1388<funcprototype> 1389 <funcdef>Status <function>XRecordDisableContext</function></funcdef> 1390 <paramdef>Display<parameter> *display</parameter></paramdef> 1391 <paramdef>XRecordContext<parameter> context</parameter></paramdef> 1392</funcprototype> 1393</funcsynopsis> 1394 1395<variablelist remap='IP'> 1396 <varlistentry> 1397 <term><emphasis remap='I'>display</emphasis></term> 1398 <listitem><para>Specifies the connection to the X server.</para></listitem> 1399 </varlistentry> 1400 <varlistentry> 1401 <term><emphasis remap='I'>context</emphasis></term> 1402 <listitem><para>Specifies the record context to disable.</para></listitem> 1403 </varlistentry> 1404</variablelist> 1405 1406 1407<para> 1408The 1409<function>XRecordDisableContext</function> 1410function disables context, stopping all recording over its data connection. 1411Any complete protocol elements for context that were buffered in the 1412server will be sent to the recording client rather than being discarded. 1413If a program attempts to disable an 1414<function>XRecordContext</function> 1415that has not been enabled, no action will take place. 1416</para> 1417 1418<para> 1419<function>XRecordDisableContext</function> 1420returns zero if the request failed; otherwise, it 1421returns nonzero. The context argument must specify a valid 1422<function>XRecordContext</function> 1423or an 1424<function>XRecordBadContext</function> 1425error results. 1426</para> 1427</sect2> 1428</sect1> 1429 1430<sect1 id='id_base_mask'><title>ID Base Mask</title> 1431 1432<para> 1433To determine the mask the server uses for the client ID base, use 1434<function>XRecordIdBaseMask</function></para> 1435 1436<funcsynopsis> 1437<funcprototype> 1438 <funcdef>XID <function>XRecordIdBaseMask</function></funcdef> 1439 <paramdef>Display<parameter> *display</parameter></paramdef> 1440</funcprototype> 1441</funcsynopsis> 1442 1443<variablelist remap='IP'> 1444 <varlistentry> 1445 <term><emphasis remap='I'>display</emphasis></term> 1446 <listitem><para>Specifies the connection to the X server.</para></listitem> 1447 </varlistentry> 1448</variablelist> 1449 1450<para> 1451The 1452<function>XRecordIdBaseMask</function> 1453function returns the resource ID mask passed to the client by the 1454server at connection setup. 1455</para> 1456 1457</sect1> 1458 1459<sect1 id='free_context'> 1460<title>Free Context</title> 1461 1462<para> 1463Before terminating, the program should request that the server 1464free the record context. This is done with the 1465<function>XRecordFreeContext</function> 1466function, typically over the record client's control connection 1467to the X server. 1468</para> 1469 1470<funcsynopsis> 1471<funcprototype> 1472 <funcdef>Status <function>XRecordFreeContext</function></funcdef> 1473 <paramdef>Display<parameter> *display</parameter></paramdef> 1474 <paramdef>XRecordContext<parameter> context</parameter></paramdef> 1475</funcprototype> 1476</funcsynopsis> 1477 1478<variablelist remap='IP'> 1479 <varlistentry> 1480 <term><emphasis remap='I'>display</emphasis></term> 1481 <listitem><para>Specifies the connection to the X server.</para></listitem> 1482 </varlistentry> 1483 <varlistentry> 1484 <term><emphasis remap='I'>context</emphasis></term> 1485 <listitem><para>Specifies the record context to free.</para></listitem> 1486 </varlistentry> 1487</variablelist> 1488 1489<para> 1490The 1491<function>XRecordFreeContext</function> 1492function frees the given context for the 1493requesting client. Freeing a record context releases the clients 1494targeted for recording and their respective protocol ranges to 1495record. If protocol data is being reported to the recording client, 1496generally over the data connection to the X server, the reporting 1497ceases as if 1498<function>XRecordDisableContext</function> 1499had been called on the given context. When a program terminates 1500without freeing its record context, the X server will automatically 1501free that context on behalf of the client. 1502</para> 1503 1504<para> 1505<function>XRecordFreeContext</function> 1506returns zero if the request failed; otherwise,it 1507returns nonzero. The context argument must specify a valid 1508<function>XRecordContext</function> 1509or a 1510<function>XRecordBadContext</function> 1511error results. 1512</para> 1513 1514</sect1> 1515</chapter> 1516</book> 1517