home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 45 / cda45.iso / Linux / XFree86-4.0 / doc / recordlib.TXT < prev    next >
Encoding:
Text File  |  2000-03-09  |  35.8 KB  |  1,255 lines

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