Git init
[framework/uifw/xorg/proto/x11proto-xext.git] / specs / xtest.xml
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 <book id="xtest">
6
7 <bookinfo>
8    <title>XTEST Extension Protocol</title>
9    <subtitle>X Consortium Standard</subtitle>
10    <releaseinfo>Version 2.2</releaseinfo>
11    <authorgroup>
12       <author>
13          <firstname>Kieron</firstname><surname>Drake</surname>
14          <affiliation><orgname>UniSoft Ltd.</orgname></affiliation>
15       </author>
16    </authorgroup>
17    <copyright><year>1992</year><holder>UniSoft Group Ltd.</holder></copyright>
18    <copyright><year>1992,1994</year><holder>X Consortium</holder></copyright>
19
20 <legalnotice>
21 <para>
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
27 implied warranty.
28 </para>
29
30 <para>
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:
37 </para>
38
39 <para>
40 The above copyright notice and this permission notice shall be included in
41 all copies or substantial portions of the Software.
42 </para>
43
44 <para>
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.
51 </para>
52
53 <para>
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.
57 </para>
58 </legalnotice>
59 </bookinfo>
60
61
62 <chapter>
63 <title>TITLE</title>
64
65 <sect1 id="Overview">
66 <title>Overview</title>
67 <para>
68 This extension is a minimal set of client and server extensions
69 required to completely test the X11 server with no user intervention.
70 </para>
71
72 <para>
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
79 [Drake, 91].
80 </para>
81
82 <para>
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.
86 </para>
87
88 <para>
89 We have also tried to:
90 </para>
91
92 <itemizedlist>
93   <listitem>
94     <para>
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"
99 can occur.
100     </para>
101   </listitem>
102   <listitem>
103     <para>
104 Minimize the changes required in the rest of the server.
105     </para>
106   </listitem>
107   <listitem>
108     <para>
109 Minimize performance penalties on normal server operation.
110     </para>
111   </listitem>
112 </itemizedlist>
113 </sect1>
114
115 <sect1 id="Description">
116 <title>Description</title>
117 <para>
118 The functions provided by this extension fall into two groups:
119 </para>
120
121 <variablelist>
122   <varlistentry>
123     <term>Client Operations</term>
124     <listitem>
125       <para>
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
129 provided.
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
133 and
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.
138       </para>
139     </listitem>
140   </varlistentry>
141   <varlistentry>
142     <term>Server Requests</term>
143     <listitem>
144       <para>
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:
149 <!-- .RS -->
150       </para>
151       <itemizedlist>
152         <listitem>
153           <para>
154 Access to an otherwise "write-only" server resource: the cursor
155 associated with a given window
156           </para>
157         </listitem>
158         <listitem>
159           <para>
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.
163           </para>
164         </listitem>
165       </itemizedlist>
166     </listitem>
167   </varlistentry>
168 </variablelist>
169
170 </sect1>
171
172 <sect1 id="Types">
173 <title>Types</title>
174 <para>
175 The following types are used in the request and event definitions in
176 subsequent sections:
177 </para>
178
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*"/>
183   <tbody>
184     <row rowsep="0">
185       <entry namest="c1" nameend="c2">
186 FAKE_EVENT_TYPE
187 { <function>KeyPress</function>,
188 <function>KeyRelease</function>,
189 <function>MotionNotify</function>,
190 <function>ButtonPress</function>,
191 <function>ButtonRelease</function> }
192       </entry>
193     </row>
194     <row rowsep="0">
195       <entry></entry>
196     </row>
197     <row>
198       <entry>FAKE_EVENT</entry>
199       <entry>[type: FAKE_EVENT_TYPE,</entry>
200     </row>
201     <row rowsep="0">
202       <entry></entry>
203       <entry>detail: BYTE,</entry>
204     </row>
205     <row rowsep="0">
206       <entry></entry>
207       <entry>time: TIME,</entry>
208     </row>
209     <row rowsep="0">
210       <entry></entry>
211       <entry>root: WINDOW,</entry>
212     </row>
213     <row rowsep="0">
214       <entry></entry>
215       <entry>rootX, rootY: INT16]</entry>
216     </row>
217   </tbody>
218   </tgroup>
219 </informaltable>
220
221 <para>
222 CURSOR { <function>CurrentCursor</function>, <function> None</function> }
223 or a cursor as defined by the X11 Protocol.
224 </para>
225
226 </sect1>
227
228 <sect1 id="Client_Operations">
229 <title>Client Operations</title>
230
231 <para>
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.
240 </para>
241
242 <para>
243 <function>XTestSetGContextOfGC</function>
244 </para>
245
246 <informaltable frame="none">
247   <tgroup cols='1' align='left'>
248   <colspec colname='c1' colsep="0" colwidth="1*"/>
249   <tbody>
250     <row rowsep="0">
251       <entry>
252 <emphasis remap='I'>gc</emphasis>: "GC"
253       </entry>
254     </row>
255     <row rowsep="0">
256       <entry>
257 <emphasis remap='I'>gid</emphasis>: GCONTEXT
258       </entry>
259     </row>
260   </tbody>
261   </tgroup>
262 </informaltable>
263
264 <para>
265 Sets the GCONTEXT within the "GC" gc to have
266 the value specified by gid.
267 </para>
268
269 <para>
270 <function>XTestSetVisualIDOfVisual</function>
271 </para>
272
273 <informaltable frame="none">
274   <tgroup cols='1' align='left'>
275   <colspec colname='c1' colsep="0" colwidth="1*"/>
276   <tbody>
277     <row rowsep="0">
278       <entry>
279 <emphasis remap='I'>visual</emphasis>: "VISUAL"
280       </entry>
281     </row>
282     <row rowsep="0">
283       <entry>
284 <emphasis remap='I'>visualid</emphasis>: VISUALID
285       </entry>
286     </row>
287   </tbody>
288   </tgroup>
289 </informaltable>
290
291 <para>
292 Sets the VISUALID within the "VISUAL" visual to have
293 the value specified by visualid.
294 </para>
295
296 <para>
297 <function>XTestDiscard</function>
298 </para>
299
300 <informaltable frame="none">
301   <tgroup cols='1' align='left'>
302   <colspec colname='c1' colsep="0" colwidth="1*"/>
303   <tbody>
304     <row rowsep="0">
305       <entry>
306 <emphasis remap='I'>dpy</emphasis>: "CONNECTION"
307       </entry>
308     </row>
309     <row rowsep="0">
310       <entry>
311 =&gt;
312       </entry>
313     </row>
314     <row rowsep="0">
315       <entry>
316 status: BOOL
317       </entry>
318     </row>
319   </tbody>
320   </tgroup>
321 </informaltable>
322
323 <para>
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
329 in the buffer and
330 <function>False</function>
331 otherwise.
332 </para>
333 </sect1>
334
335 <sect1 id="Server_Requests">
336 <title>Server Requests</title>
337 <para>
338 <function>XTestGetVersion</function>
339 </para>
340
341 <informaltable frame="none">
342   <tgroup cols='1' align='left'>
343   <colspec colname='c1' colsep="0" colwidth="1*"/>
344   <tbody>
345     <row rowsep="0">
346       <entry>
347 <emphasis remap='I'>clientMajorVersion</emphasis>: CARD16
348       </entry>
349     </row>
350     <row rowsep="0">
351       <entry>
352 <emphasis remap='I'>clientMinorVersion</emphasis>: CARD16
353       </entry>
354     </row>
355     <row rowsep="0">
356       <entry>
357    =&gt;
358       </entry>
359     </row>
360     <row rowsep="0">
361       <entry>
362 serverMajorVersion: CARD16
363       </entry>
364     </row>
365     <row rowsep="0">
366       <entry>
367 serverMinorVersion: CARD16
368       </entry>
369     </row>
370     <row rowsep="0">
371       <entry>
372 Errors: <function>Length</function>
373       </entry>
374     </row>
375   </tbody>
376   </tgroup>
377 </informaltable>
378
379
380 <para>
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).
384 </para>
385
386 <para>
387 <function>XTestCompareCursor</function>
388 </para>
389
390 <informaltable frame="none">
391   <tgroup cols='1' align='left'>
392   <colspec colname='c1' colsep="0" colwidth="1*"/>
393   <tbody>
394     <row rowsep="0">
395       <entry>
396 <emphasis remap='I'>window</emphasis>: WINDOW
397       </entry>
398     </row>
399     <row rowsep="0">
400       <entry>
401 <emphasis remap='I'>cursor-id</emphasis>: CURSOR or
402 <function>CurrentCursor</function>
403 or
404 <function>None</function>
405       </entry>
406     </row>
407     <row rowsep="0">
408       <entry>
409 =&gt;
410       </entry>
411     </row>
412     <row rowsep="0">
413       <entry>
414 same: BOOL
415       </entry>
416     </row>
417     <row rowsep="0">
418       <entry>
419 Errors:
420 <function>Window</function>,
421 <function>Length</function>,
422 <function>Cursor</function>
423       </entry>
424     </row>
425   </tbody>
426   </tgroup>
427 </informaltable>
428
429 <para>
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.
436 </para>
437
438 <para>
439 <function>XTestFakeInput</function>
440 </para>
441
442 <informaltable frame="none">
443   <tgroup cols='1' align='left'>
444   <colspec colname='c1' colsep="0" colwidth="1*"/>
445   <tbody>
446     <row rowsep="0">
447       <entry>
448 <emphasis remap='I'>events</emphasis>: LISTofFAKE_EVENT
449       </entry>
450     </row>
451     <row rowsep="0">
452       <entry>
453 Errors:
454 <function>Window</function>,
455 <function>Length</function>,
456 <function>Alloc</function>,
457 <function>Value</function>
458       </entry>
459     </row>
460   </tbody>
461   </tgroup>
462 </informaltable>
463
464 <para>
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:
468 </para>
469
470 <variablelist>
471   <varlistentry>
472     <term>
473       <emphasis remap='I'>type</emphasis>
474     </term>
475     <listitem>
476       <para>
477 This must be one of
478 <function>KeyPress</function>,
479 <function>KeyRelease</function>,
480 <function>MotionNotify</function>,
481 <function>ButtonPress</function>,
482 or
483 <function>ButtonRelease</function>,
484 or else a
485 <function>Value</function>
486 error occurs.
487       </para>
488     </listitem>
489   </varlistentry>
490   <varlistentry>
491     <term>
492       <emphasis remap='I'>detail</emphasis>
493     </term>
494     <listitem>
495       <para>
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>
500 error occurs.
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
503 the most recent
504 <function>SetPointerMapping</function>
505 request.
506 If the button number is less than one or greater than the number of physical
507 buttons, then a
508 <function>Value</function>
509 error occurs.
510 For motion events, if this field is
511 <function>True ,</function>
512 then rootX and rootY
513 are relative distances from the current pointer location; if this field is
514 <function>False,</function>
515 then they are absolute positions.
516       </para>
517     </listitem>
518   </varlistentry>
519   <varlistentry>
520     <term>
521       <emphasis remap='I'>time</emphasis>
522     </term>
523     <listitem>
524       <para>
525 This is either
526 <function>CurrentTime</function>
527 (meaning no delay)
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.
532       </para>
533     </listitem>
534   </varlistentry>
535   <varlistentry>
536     <term>
537       <emphasis remap='I'>root</emphasis>
538     </term>
539     <listitem>
540       <para>
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
545 is used instead.
546 If this field is not a valid window, then a
547 <function>Window</function>
548 error occurs.
549       </para>
550     </listitem>
551   </varlistentry>
552   <varlistentry>
553     <term>
554       <emphasis remap='I'>rootX</emphasis> &amp;
555       <emphasis remap='I'>rootY</emphasis>
556     </term>
557     <listitem>
558       <para>
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.
563     </para>
564   </listitem>
565   </varlistentry>
566 </variablelist>
567
568 <para>
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.
573 </para>
574
575 <para>
576 For the currently supported event types, the event list must have length one,
577 otherwise a
578 <function>BadLength</function>
579 error occurs.
580 </para>
581
582 <para>
583 <function>XTestGrabControl</function>
584 </para>
585
586 <informaltable frame="none">
587   <tgroup cols='1' align='left'>
588   <colspec colname='c1' colsep="0" colwidth="1*"/>
589   <tbody>
590     <row rowsep="0">
591       <entry>
592 <emphasis remap='I'>impervious</emphasis>: BOOL
593       </entry>
594     </row>
595   </tbody>
596   </tgroup>
597 </informaltable>
598
599 <para>
600 If impervious is
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
604 grabs the server.
605 If impervious is
606 <function>False</function>,
607 then the executing client returns to the normal state of being
608 susceptible to server grabs.
609 </para>
610 </sect1>
611
612 <sect1 id="Encoding">
613 <title>Encoding</title>
614 <para>
615 Please refer to the X11 Protocol Encoding document as this document uses
616 conventions established there.
617 </para>
618
619 <para>
620 The name of this extension is "XTEST".
621 </para>
622
623 <sect2 id="New_Types">
624 <title>New Types</title>
625 <literallayout class="monospaced">
626 FAKE_EVENT_TYPE
627      2     KeyPress
628      3     KeyRelease
629      4     ButtonPress
630      5     ButtonRelease
631      6     MotionNotify
632 </literallayout>
633
634 <para>
635 NOTE that the above values are defined to be the same as those for
636 the corresponding core protocol event types.
637 </para>
638 </sect2>
639
640 <sect2 id="Requests">
641 <title>Requests</title>
642
643 <literallayout class="monospaced">
644 <function>XTestGetVersion</function>
645      1     CARD8               opcode
646      1     0                   xtest opcode
647      2     2                   request length
648      1     CARD8               client major version
649      1                         unused
650      2     CARD16              client minor version
651 =&gt;
652      1     1                   Reply
653      1     CARD8               server major version
654      2     CARD16              sequence number
655      4     0                   reply length
656      2     CARD16              server minor version
657      22                        unused
658 </literallayout>
659
660 <literallayout class="monospaced">
661 <function>XTestCompareCursor</function>
662      1     CARD8               opcode
663      1     1                   xtest opcode
664      2     3                   request length
665      4     WINDOW              window
666      4     CURSOR              cursor-id
667            0     None
668            1     CurrentCursor
669 =&gt;
670      1     1                   Reply
671      1     BOOL                cursors are the same
672      2     CARD16              sequence number
673      4     0                   reply length
674      24                        unused
675 </literallayout>
676
677 <literallayout class="monospaced">
678 <function>XTestFakeInput</function>
679      1     CARD8               opcode
680      1     2                   xtest opcode
681      2     1+(1*8)             request length
682      1     FAKE_EVENT_TYPE     fake device event type
683      1     BYTE                detail: button or keycode
684      2                         unused
685      4     TIME                delay (milliseconds)
686            0     CurrentTime
687      4     WINDOW              root window for MotionNotify
688            0     None
689      8                         unused
690      2     INT16               x position for MotionNotify
691      2     INT16               y position for MotionNotify
692      8                         unused
693 </literallayout>
694
695 <literallayout class="monospaced">
696 <function>XTestGrabControl</function>
697      1     CARD8               opcode
698      1     3                   xtest opcode
699      2     2                   request length
700      1     BOOL                impervious
701      3                         unused
702 </literallayout>
703 </sect2>
704 </sect1>
705
706 <sect1 id="References">
707 <title>References</title>
708 <para>
709 Annicchiarico, D., et al.,
710 <emphasis remap='I'>XTrap: The XTrap Architecture</emphasis>.
711 Digital Equipment Corporation, July 1991.
712 </para>
713
714 <para>
715 Drake, K. J.,
716 <emphasis remap='I'>Some Proposals for a
717 Minimum X11 Testing Extension</emphasis>.
718 UniSoft Ltd., June 1991.
719 </para>
720 </sect1>
721 </chapter>
722 </book>