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">
8 <title>XTEST Extension Protocol</title>
9 <subtitle>X Consortium Standard</subtitle>
10 <releaseinfo>Version 2.2</releaseinfo>
13 <firstname>Kieron</firstname><surname>Drake</surname>
14 <affiliation><orgname>UniSoft Ltd.</orgname></affiliation>
17 <copyright><year>1992</year><holder>UniSoft Group Ltd.</holder></copyright>
18 <copyright><year>1992,1994</year><holder>X Consortium</holder></copyright>
22 Permission to use, copy, modify, and distribute this documentation for any
23 purpose and without fee is hereby granted, provided that the above copyright
24 notice and this permission notice appear in all copies. UniSoft makes no
25 representations about the suitability for any purpose of the information in
26 this document. This documentation is provided "as is" without express or
31 Permission is hereby granted, free of charge, to any person obtaining a copy
32 of this software and associated documentation files (the "Software"), to deal
33 in the Software without restriction, including without limitation the rights
34 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35 copies of the Software, and to permit persons to whom the Software is
36 furnished to do so, subject to the following conditions:
40 The above copyright notice and this permission notice shall be included in
41 all copies or substantial portions of the Software.
45 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
46 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
47 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
48 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
49 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
50 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
54 Except as contained in this notice, the name of the X Consortium shall not be
55 used in advertising or otherwise to promote the sale, use or other dealings
56 in this Software without prior written authorization from the X Consortium.
66 <title>Overview</title>
68 This extension is a minimal set of client and server extensions
69 required to completely test the X11 server with no user intervention.
73 This extension is not intended to support general journaling and
74 playback of user actions. This is a difficult area [XTrap, 89] as it attempts
75 to synchronize synthetic user interactions with their effects; it is at the
76 higher level of dialogue recording/playback rather than at the strictly lexical
77 level. We are interested only in the latter, simpler, case. A more detailed
78 discussion and justification of the extension functionality is given in
83 We are aiming only to provide a minimum set of facilities that
84 solve immediate testing and validation problems. The testing extension
85 itself needs testing, where possible, and so should be as simple as possible.
89 We have also tried to:
95 Confine the extension to an appropriate high level within the server
96 to minimize portability problems. In practice this means that the extension
97 should be at the DIX level or use the DIX/DDX interface, or both. This
98 has effects, in particular, on the level at which "input synthesis"
104 Minimize the changes required in the rest of the server.
109 Minimize performance penalties on normal server operation.
115 <sect1 id="Description">
116 <title>Description</title>
118 The functions provided by this extension fall into two groups:
123 <term>Client Operations</term>
126 These routines manipulate otherwise hidden client-side behavior. The
127 actual implementation will depend on the details of the actual language
128 binding and what degree of request buffering, GContext caching, and so on, is
130 In the C binding, defined in "XTEST Extension Library", routines are
131 provided to access the internals of two opaque data structures
132 -- <function>GC</function>s
134 <function>Visual</function>s --
135 and to discard any requests pending within the
136 output buffer of a connection. The exact details can be expected to differ for
137 other language bindings.
142 <term>Server Requests</term>
145 The first of these requests is similar to that provided in most
146 extensions: it allows a client to specify a major and minor version
147 number to the server and for the server to respond with major and minor
148 versions of its own. The remaining two requests allow the following:
154 Access to an otherwise "write-only" server resource: the cursor
155 associated with a given window
160 Perhaps most importantly, limited synthesis of input device events,
161 almost as if a cooperative user had moved the pointing device
162 or pressed a key or button.
175 The following types are used in the request and event definitions in
179 <informaltable frame="none">
180 <tgroup cols='2' align='left'>
181 <colspec colname='c1' colsep="0" colwidth="1*"/>
182 <colspec colname='c2' colsep="0" colwidth="1*"/>
185 <entry namest="c1" nameend="c2">
187 { <function>KeyPress</function>,
188 <function>KeyRelease</function>,
189 <function>MotionNotify</function>,
190 <function>ButtonPress</function>,
191 <function>ButtonRelease</function> }
198 <entry>FAKE_EVENT</entry>
199 <entry>[type: FAKE_EVENT_TYPE,</entry>
203 <entry>detail: BYTE,</entry>
207 <entry>time: TIME,</entry>
211 <entry>root: WINDOW,</entry>
215 <entry>rootX, rootY: INT16]</entry>
222 CURSOR { <function>CurrentCursor</function>, <function> None</function> }
223 or a cursor as defined by the X11 Protocol.
228 <sect1 id="Client_Operations">
229 <title>Client Operations</title>
232 These are abstract definitions of functionality. They refer to client-side
233 objects such as "GC" and "VISUAL" that are quoted to
234 denote their abstract nature. Concrete versions of these functions are
235 defined only for particular language bindings. In some circumstances
236 a particular language binding may not implement the relevant abstract
237 type or may provide it as a transparent, rather than opaque, type, with
238 the result that the corresponding function does not make sense or is
239 not required, respectively.
243 <function>XTestSetGContextOfGC</function>
246 <informaltable frame="none">
247 <tgroup cols='1' align='left'>
248 <colspec colname='c1' colsep="0" colwidth="1*"/>
252 <emphasis remap='I'>gc</emphasis>: "GC"
257 <emphasis remap='I'>gid</emphasis>: GCONTEXT
265 Sets the GCONTEXT within the "GC" gc to have
266 the value specified by gid.
270 <function>XTestSetVisualIDOfVisual</function>
273 <informaltable frame="none">
274 <tgroup cols='1' align='left'>
275 <colspec colname='c1' colsep="0" colwidth="1*"/>
279 <emphasis remap='I'>visual</emphasis>: "VISUAL"
284 <emphasis remap='I'>visualid</emphasis>: VISUALID
292 Sets the VISUALID within the "VISUAL" visual to have
293 the value specified by visualid.
297 <function>XTestDiscard</function>
300 <informaltable frame="none">
301 <tgroup cols='1' align='left'>
302 <colspec colname='c1' colsep="0" colwidth="1*"/>
306 <emphasis remap='I'>dpy</emphasis>: "CONNECTION"
324 Discards any requests that are present in the request buffer associated with
325 the "CONNECTION" dpy.
326 The status returned is
327 <function>True</function>
328 if there were one or more requests
330 <function>False</function>
335 <sect1 id="Server_Requests">
336 <title>Server Requests</title>
338 <function>XTestGetVersion</function>
341 <informaltable frame="none">
342 <tgroup cols='1' align='left'>
343 <colspec colname='c1' colsep="0" colwidth="1*"/>
347 <emphasis remap='I'>clientMajorVersion</emphasis>: CARD16
352 <emphasis remap='I'>clientMinorVersion</emphasis>: CARD16
362 serverMajorVersion: CARD16
367 serverMinorVersion: CARD16
372 Errors: <function>Length</function>
381 This request can be used to ensure that the server version of the XTEST
382 extension is usable by the client. This document defines major version two
383 (2), minor version one (1).
387 <function>XTestCompareCursor</function>
390 <informaltable frame="none">
391 <tgroup cols='1' align='left'>
392 <colspec colname='c1' colsep="0" colwidth="1*"/>
396 <emphasis remap='I'>window</emphasis>: WINDOW
401 <emphasis remap='I'>cursor-id</emphasis>: CURSOR or
402 <function>CurrentCursor</function>
404 <function>None</function>
420 <function>Window</function>,
421 <function>Length</function>,
422 <function>Cursor</function>
430 This request looks up the cursor associated with the window and
431 compares it with either the null cursor if cursor-id is
432 <function>None ,</function>
433 or the current cursor (that is, the one being displayed),
434 or the cursor whose ID is cursor-id, and returns
435 the result of the comparison in same.
439 <function>XTestFakeInput</function>
442 <informaltable frame="none">
443 <tgroup cols='1' align='left'>
444 <colspec colname='c1' colsep="0" colwidth="1*"/>
448 <emphasis remap='I'>events</emphasis>: LISTofFAKE_EVENT
454 <function>Window</function>,
455 <function>Length</function>,
456 <function>Alloc</function>,
457 <function>Value</function>
465 This request simulates the limited set of core protocol
466 events within the set FAKE_EVENT_TYPE. Only the following event fields,
467 defined in FAKE_EVENT, are interpreted:
473 <emphasis remap='I'>type</emphasis>
478 <function>KeyPress</function>,
479 <function>KeyRelease</function>,
480 <function>MotionNotify</function>,
481 <function>ButtonPress</function>,
483 <function>ButtonRelease</function>,
485 <function>Value</function>
492 <emphasis remap='I'>detail</emphasis>
496 For key events, this field is interpreted as the physical keycode.
497 If the keycode is less than min-keycode or greater than max-keycode,
498 as returned in the connection setup, then a
499 <function>Value</function>
501 For button events, this field is interpreted as the physical (or core) button,
502 meaning it will be mapped to the corresponding logical button according to
504 <function>SetPointerMapping</function>
506 If the button number is less than one or greater than the number of physical
508 <function>Value</function>
510 For motion events, if this field is
511 <function>True ,</function>
513 are relative distances from the current pointer location; if this field is
514 <function>False,</function>
515 then they are absolute positions.
521 <emphasis remap='I'>time</emphasis>
526 <function>CurrentTime</function>
528 or the delay in milliseconds that the server should wait before
529 simulating this event. No other requests from this client will be
530 processed until this delay, if any, has expired and subsequent processing
531 of the simulated event has been completed.
537 <emphasis remap='I'>root</emphasis>
541 In the case of motion events this field is the ID of the root window on
542 which the new motion is to take place. If
543 <function>None</function>
544 is specified, the root window of the screen the pointer is currently on
546 If this field is not a valid window, then a
547 <function>Window</function>
554 <emphasis remap='I'>rootX</emphasis> &
555 <emphasis remap='I'>rootY</emphasis>
559 In the case of motion events these fields indicate relative distance or
560 absolute pointer coordinates, according to the setting of detail.
561 If the specified coordinates are off-screen, the closest on-screen
562 coordinates will be substituted.
569 When the simulated event(s) are processed, they cause event propagation,
570 passive grab activation, and so on, just as if the corresponding input device
571 action had occurred. However, motion events might not be recorded in the
572 motion history buffer.
576 For the currently supported event types, the event list must have length one,
578 <function>BadLength</function>
583 <function>XTestGrabControl</function>
586 <informaltable frame="none">
587 <tgroup cols='1' align='left'>
588 <colspec colname='c1' colsep="0" colwidth="1*"/>
592 <emphasis remap='I'>impervious</emphasis>: BOOL
601 <function>True</function>,
602 then the executing client becomes impervious to server grabs;
603 that is, it can continue executing requests even if another client
606 <function>False</function>,
607 then the executing client returns to the normal state of being
608 susceptible to server grabs.
612 <sect1 id="Encoding">
613 <title>Encoding</title>
615 Please refer to the X11 Protocol Encoding document as this document uses
616 conventions established there.
620 The name of this extension is "XTEST".
623 <sect2 id="New_Types">
624 <title>New Types</title>
625 <literallayout class="monospaced">
635 NOTE that the above values are defined to be the same as those for
636 the corresponding core protocol event types.
640 <sect2 id="Requests">
641 <title>Requests</title>
643 <literallayout class="monospaced">
644 <function>XTestGetVersion</function>
648 1 CARD8 client major version
650 2 CARD16 client minor version
653 1 CARD8 server major version
654 2 CARD16 sequence number
656 2 CARD16 server minor version
660 <literallayout class="monospaced">
661 <function>XTestCompareCursor</function>
671 1 BOOL cursors are the same
672 2 CARD16 sequence number
677 <literallayout class="monospaced">
678 <function>XTestFakeInput</function>
681 2 1+(1*8) request length
682 1 FAKE_EVENT_TYPE fake device event type
683 1 BYTE detail: button or keycode
685 4 TIME delay (milliseconds)
687 4 WINDOW root window for MotionNotify
690 2 INT16 x position for MotionNotify
691 2 INT16 y position for MotionNotify
695 <literallayout class="monospaced">
696 <function>XTestGrabControl</function>
706 <sect1 id="References">
707 <title>References</title>
709 Annicchiarico, D., et al.,
710 <emphasis remap='I'>XTrap: The XTrap Architecture</emphasis>.
711 Digital Equipment Corporation, July 1991.
716 <emphasis remap='I'>Some Proposals for a
717 Minimum X11 Testing Extension</emphasis>.
718 UniSoft Ltd., June 1991.