Debian Codegraph @

specs/recordlib.xml

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