xtest.xml revision ea1d6981
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<book id="xtest"> 9 10<bookinfo> 11 <title>XTEST Extension Protocol</title> 12 <subtitle>X Consortium Standard</subtitle> 13 <authorgroup> 14 <author> 15 <firstname>Kieron</firstname><surname>Drake</surname> 16 <affiliation><orgname>UniSoft Ltd.</orgname></affiliation> 17 </author> 18 </authorgroup> 19 <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo> 20 <releaseinfo>Version 2.2</releaseinfo> 21 <copyright><year>1992</year><holder>UniSoft Group Ltd.</holder></copyright> 22 <copyright><year>1992</year><year>1994</year><holder>X Consortium</holder></copyright> 23 24<legalnotice> 25<para> 26Permission to use, copy, modify, and distribute this documentation for any 27purpose and without fee is hereby granted, provided that the above copyright 28notice and this permission notice appear in all copies. UniSoft makes no 29representations about the suitability for any purpose of the information in 30this document. This documentation is provided "as is" without express or 31implied warranty. 32</para> 33 34<para> 35Permission is hereby granted, free of charge, to any person obtaining a copy 36of this software and associated documentation files (the "Software"), to deal 37in the Software without restriction, including without limitation the rights 38to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 39copies of the Software, and to permit persons to whom the Software is 40furnished to do so, subject to the following conditions: 41</para> 42 43<para> 44The above copyright notice and this permission notice shall be included in 45all copies or substantial portions of the Software. 46</para> 47 48<para> 49THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 50IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 51FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 52X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 53AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 54CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 55</para> 56 57<para> 58Except as contained in this notice, the name of the X Consortium shall not be 59used in advertising or otherwise to promote the sale, use or other dealings 60in this Software without prior written authorization from the X Consortium. 61</para> 62</legalnotice> 63</bookinfo> 64 65 66<chapter id="Overview"> 67<title>Overview</title> 68<para> 69This extension is a minimal set of client and server extensions 70required to completely test the X11 server with no user intervention. 71</para> 72 73<para> 74This extension is not intended to support general journaling and 75playback of user actions. This is a difficult area [XTrap, 89] as it attempts 76to synchronize synthetic user interactions with their effects; it is at the 77higher level of dialogue recording/playback rather than at the strictly lexical 78level. We are interested only in the latter, simpler, case. A more detailed 79discussion and justification of the extension functionality is given in 80[Drake, 91]. 81</para> 82 83<para> 84We are aiming only to provide a minimum set of facilities that 85solve immediate testing and validation problems. The testing extension 86itself needs testing, where possible, and so should be as simple as possible. 87</para> 88 89<para> 90We have also tried to: 91</para> 92 93<itemizedlist> 94 <listitem> 95 <para> 96Confine the extension to an appropriate high level within the server 97to minimize portability problems. In practice this means that the extension 98should be at the DIX level or use the DIX/DDX interface, or both. This 99has effects, in particular, on the level at which "input synthesis" 100can occur. 101 </para> 102 </listitem> 103 <listitem> 104 <para> 105Minimize the changes required in the rest of the server. 106 </para> 107 </listitem> 108 <listitem> 109 <para> 110Minimize performance penalties on normal server operation. 111 </para> 112 </listitem> 113</itemizedlist> 114</chapter> 115 116<chapter id="Description"> 117<title>Description</title> 118<para> 119The functions provided by this extension fall into two groups: 120</para> 121 122<variablelist> 123 <varlistentry> 124 <term>Client Operations</term> 125 <listitem> 126 <para> 127These routines manipulate otherwise hidden client-side behavior. The 128actual implementation will depend on the details of the actual language 129binding and what degree of request buffering, GContext caching, and so on, is 130provided. 131In the C binding, defined in "XTEST Extension Library", routines are 132provided to access the internals of two opaque data structures 133-- <function>GC</function>s 134and 135<function>Visual</function>s -- 136and to discard any requests pending within the 137output buffer of a connection. The exact details can be expected to differ for 138other language bindings. 139 </para> 140 </listitem> 141 </varlistentry> 142 <varlistentry> 143 <term>Server Requests</term> 144 <listitem> 145 <para> 146The first of these requests is similar to that provided in most 147extensions: it allows a client to specify a major and minor version 148number to the server and for the server to respond with major and minor 149versions of its own. The remaining two requests allow the following: 150<!-- .RS --> 151 </para> 152 <itemizedlist> 153 <listitem> 154 <para> 155Access to an otherwise "write-only" server resource: the cursor 156associated with a given window 157 </para> 158 </listitem> 159 <listitem> 160 <para> 161Perhaps most importantly, limited synthesis of input device events, 162almost as if a cooperative user had moved the pointing device 163or pressed a key or button. 164 </para> 165 </listitem> 166 </itemizedlist> 167 </listitem> 168 </varlistentry> 169</variablelist> 170 171</chapter> 172 173<chapter id="Types"> 174<title>Types</title> 175<para> 176The following types are used in the request and event definitions in 177subsequent sections: 178</para> 179 180<informaltable frame="none"> 181 <tgroup cols='2' align='left' colsep='0' rowsep='0'> 182 <colspec colname='c1' colwidth="1.0*"/> 183 <colspec colname='c2' colwidth="3.0*"/> 184 <tbody> 185 <row> 186 <entry namest="c1" nameend="c2"> 187FAKE_EVENT_TYPE 188{ <function>KeyPress</function>, 189<function>KeyRelease</function>, 190<function>MotionNotify</function>, 191<function>ButtonPress</function>, 192<function>ButtonRelease</function> } 193 </entry> 194 </row> 195 <row> 196 <entry></entry> 197 </row> 198 <row> 199 <entry>FAKE_EVENT</entry> 200 <entry>[type: FAKE_EVENT_TYPE,</entry> 201 </row> 202 <row> 203 <entry></entry> 204 <entry>detail: BYTE,</entry> 205 </row> 206 <row> 207 <entry></entry> 208 <entry>time: TIME,</entry> 209 </row> 210 <row> 211 <entry></entry> 212 <entry>root: WINDOW,</entry> 213 </row> 214 <row> 215 <entry></entry> 216 <entry>rootX, rootY: INT16]</entry> 217 </row> 218 </tbody> 219 </tgroup> 220</informaltable> 221 222<para> 223CURSOR { <function>CurrentCursor</function>, <function> None</function> } 224or a cursor as defined by the X11 Protocol. 225</para> 226 227</chapter> 228 229<chapter id="Client_Operations"> 230<title>Client Operations</title> 231 232<para> 233These are abstract definitions of functionality. They refer to client-side 234objects such as "GC" and "VISUAL" that are quoted to 235denote their abstract nature. Concrete versions of these functions are 236defined only for particular language bindings. In some circumstances 237a particular language binding may not implement the relevant abstract 238type or may provide it as a transparent, rather than opaque, type, with 239the result that the corresponding function does not make sense or is 240not required, respectively. 241</para> 242 243<para> 244<olink targetdoc='xtestlib' targetptr='XTestSetGContextOfGC'><function>XTestSetGContextOfGC</function></olink> 245</para> 246 247<informaltable frame="none"> 248 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 249 <colspec colname='c1' colwidth="1.0*"/> 250 <tbody> 251 <row> 252 <entry> 253<emphasis remap='I'>gc</emphasis>: "GC" 254 </entry> 255 </row> 256 <row> 257 <entry> 258<emphasis remap='I'>gid</emphasis>: GCONTEXT 259 </entry> 260 </row> 261 </tbody> 262 </tgroup> 263</informaltable> 264 265<para> 266Sets the GCONTEXT within the "GC" gc to have 267the value specified by gid. 268</para> 269 270<para> 271<olink targetdoc='xtestlib' targetptr='XTestSetVisualIDOfVisual'><function>XTestSetVisualIDOfVisual</function></olink> 272</para> 273 274<informaltable frame="none"> 275 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 276 <colspec colname='c1' colwidth="1.0*"/> 277 <tbody> 278 <row> 279 <entry> 280<emphasis remap='I'>visual</emphasis>: "VISUAL" 281 </entry> 282 </row> 283 <row> 284 <entry> 285<emphasis remap='I'>visualid</emphasis>: VISUALID 286 </entry> 287 </row> 288 </tbody> 289 </tgroup> 290</informaltable> 291 292<para> 293Sets the VISUALID within the "VISUAL" visual to have 294the value specified by visualid. 295</para> 296 297<para> 298<olink targetdoc='xtestlib' targetptr='XTestDiscard'><function>XTestDiscard</function></olink> 299</para> 300 301<informaltable frame="none"> 302 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 303 <colspec colname='c1' colwidth="1.0*"/> 304 <tbody> 305 <row> 306 <entry> 307<emphasis remap='I'>dpy</emphasis>: "CONNECTION" 308 </entry> 309 </row> 310 <row> 311 <entry> 312=> 313 </entry> 314 </row> 315 <row> 316 <entry> 317status: BOOL 318 </entry> 319 </row> 320 </tbody> 321 </tgroup> 322</informaltable> 323 324<para> 325Discards any requests that are present in the request buffer associated with 326the "CONNECTION" dpy. 327The status returned is 328<function>True</function> 329if there were one or more requests 330in the buffer and 331<function>False</function> 332otherwise. 333</para> 334</chapter> 335 336<chapter id="Server_Requests"> 337<title>Server Requests</title> 338<para> 339<function>XTestGetVersion</function> 340</para> 341 342<informaltable frame="none"> 343 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 344 <colspec colname='c1' colwidth="1.0*"/> 345 <tbody> 346 <row> 347 <entry> 348<emphasis remap='I'>clientMajorVersion</emphasis>: CARD16 349 </entry> 350 </row> 351 <row> 352 <entry> 353<emphasis remap='I'>clientMinorVersion</emphasis>: CARD16 354 </entry> 355 </row> 356 <row> 357 <entry> 358 => 359 </entry> 360 </row> 361 <row> 362 <entry> 363serverMajorVersion: CARD16 364 </entry> 365 </row> 366 <row> 367 <entry> 368serverMinorVersion: CARD16 369 </entry> 370 </row> 371 <row> 372 <entry> 373Errors: <function>Length</function> 374 </entry> 375 </row> 376 </tbody> 377 </tgroup> 378</informaltable> 379 380 381<para> 382This request can be used to ensure that the server version of the XTEST 383extension is usable by the client. This document defines major version two 384(2), minor version one (1). 385</para> 386 387<para> 388<function>XTestCompareCursor</function> 389</para> 390 391<informaltable frame="none"> 392 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 393 <colspec colname='c1' colwidth="1.0*"/> 394 <tbody> 395 <row> 396 <entry> 397<emphasis remap='I'>window</emphasis>: WINDOW 398 </entry> 399 </row> 400 <row> 401 <entry> 402<emphasis remap='I'>cursor-id</emphasis>: CURSOR or 403<function>CurrentCursor</function> 404or 405<function>None</function> 406 </entry> 407 </row> 408 <row> 409 <entry> 410=> 411 </entry> 412 </row> 413 <row> 414 <entry> 415same: BOOL 416 </entry> 417 </row> 418 <row> 419 <entry> 420Errors: 421<function>Window</function>, 422<function>Length</function>, 423<function>Cursor</function> 424 </entry> 425 </row> 426 </tbody> 427 </tgroup> 428</informaltable> 429 430<para> 431This request looks up the cursor associated with the window and 432compares it with either the null cursor if cursor-id is 433<function>None ,</function> 434or the current cursor (that is, the one being displayed), 435or the cursor whose ID is cursor-id, and returns 436the result of the comparison in same. 437</para> 438 439<para> 440<function>XTestFakeInput</function> 441</para> 442 443<informaltable frame="none"> 444 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 445 <colspec colname='c1' colwidth="1.0*"/> 446 <tbody> 447 <row> 448 <entry> 449<emphasis remap='I'>events</emphasis>: LISTofFAKE_EVENT 450 </entry> 451 </row> 452 <row> 453 <entry> 454Errors: 455<function>Window</function>, 456<function>Length</function>, 457<function>Alloc</function>, 458<function>Value</function> 459 </entry> 460 </row> 461 </tbody> 462 </tgroup> 463</informaltable> 464 465<para> 466This request simulates the limited set of core protocol 467events within the set FAKE_EVENT_TYPE. Only the following event fields, 468defined in FAKE_EVENT, are interpreted: 469</para> 470 471<variablelist> 472 <varlistentry> 473 <term> 474 <emphasis remap='I'>type</emphasis> 475 </term> 476 <listitem> 477 <para> 478This must be one of 479<function>KeyPress</function>, 480<function>KeyRelease</function>, 481<function>MotionNotify</function>, 482<function>ButtonPress</function>, 483or 484<function>ButtonRelease</function>, 485or else a 486<function>Value</function> 487error occurs. 488 </para> 489 </listitem> 490 </varlistentry> 491 <varlistentry> 492 <term> 493 <emphasis remap='I'>detail</emphasis> 494 </term> 495 <listitem> 496 <para> 497For key events, this field is interpreted as the physical keycode. 498If the keycode is less than min-keycode or greater than max-keycode, 499as returned in the connection setup, then a 500<function>Value</function> 501error occurs. 502For button events, this field is interpreted as the physical (or core) button, 503meaning it will be mapped to the corresponding logical button according to 504the most recent 505<function>SetPointerMapping</function> 506request. 507If the button number is less than one or greater than the number of physical 508buttons, then a 509<function>Value</function> 510error occurs. 511For motion events, if this field is 512<function>True ,</function> 513then rootX and rootY 514are relative distances from the current pointer location; if this field is 515<function>False,</function> 516then they are absolute positions. 517 </para> 518 </listitem> 519 </varlistentry> 520 <varlistentry> 521 <term> 522 <emphasis remap='I'>time</emphasis> 523 </term> 524 <listitem> 525 <para> 526This is either 527<function>CurrentTime</function> 528(meaning no delay) 529or the delay in milliseconds that the server should wait before 530simulating this event. No other requests from this client will be 531processed until this delay, if any, has expired and subsequent processing 532of the simulated event has been completed. 533 </para> 534 </listitem> 535 </varlistentry> 536 <varlistentry> 537 <term> 538 <emphasis remap='I'>root</emphasis> 539 </term> 540 <listitem> 541 <para> 542In the case of motion events this field is the ID of the root window on 543which the new motion is to take place. If 544<function>None</function> 545is specified, the root window of the screen the pointer is currently on 546is used instead. 547If this field is not a valid window, then a 548<function>Window</function> 549error occurs. 550 </para> 551 </listitem> 552 </varlistentry> 553 <varlistentry> 554 <term> 555 <emphasis remap='I'>rootX</emphasis> & 556 <emphasis remap='I'>rootY</emphasis> 557 </term> 558 <listitem> 559 <para> 560In the case of motion events these fields indicate relative distance or 561absolute pointer coordinates, according to the setting of detail. 562If the specified coordinates are off-screen, the closest on-screen 563coordinates will be substituted. 564 </para> 565 </listitem> 566 </varlistentry> 567</variablelist> 568 569<para> 570When the simulated event(s) are processed, they cause event propagation, 571passive grab activation, and so on, just as if the corresponding input device 572action had occurred. However, motion events might not be recorded in the 573motion history buffer. 574</para> 575 576<para> 577For the currently supported event types, the event list must have length one, 578otherwise a 579<function>BadLength</function> 580error occurs. 581</para> 582 583<para> 584<olink targetdoc='xtestlib' targetptr='XTestGrabControl'><function>XTestGrabControl</function></olink> 585</para> 586 587<informaltable frame="none"> 588 <tgroup cols='1' align='left' colsep='0' rowsep='0'> 589 <colspec colname='c1' colwidth="1.0*"/> 590 <tbody> 591 <row> 592 <entry> 593<emphasis remap='I'>impervious</emphasis>: BOOL 594 </entry> 595 </row> 596 </tbody> 597 </tgroup> 598</informaltable> 599 600<para> 601If impervious is 602<function>True</function>, 603then the executing client becomes impervious to server grabs; 604that is, it can continue executing requests even if another client 605grabs the server. 606If impervious is 607<function>False</function>, 608then the executing client returns to the normal state of being 609susceptible to server grabs. 610</para> 611</chapter> 612 613<chapter id="Encoding"> 614<title>Encoding</title> 615<para> 616Please refer to the X11 Protocol Encoding document as this document uses 617conventions established there. 618</para> 619 620<para> 621The name of this extension is "XTEST". 622</para> 623 624<sect1 id="New_Types"> 625<title>New Types</title> 626<literallayout class="monospaced"> 627FAKE_EVENT_TYPE 628 2 KeyPress 629 3 KeyRelease 630 4 ButtonPress 631 5 ButtonRelease 632 6 MotionNotify 633</literallayout> 634 635<para> 636NOTE that the above values are defined to be the same as those for 637the corresponding core protocol event types. 638</para> 639</sect1> 640 641<sect1 id="Requests"> 642<title>Requests</title> 643 644<literallayout class="monospaced"> 645<function>XTestGetVersion</function> 646 1 CARD8 opcode 647 1 0 xtest opcode 648 2 2 request length 649 1 CARD8 client major version 650 1 unused 651 2 CARD16 client minor version 652=> 653 1 1 Reply 654 1 CARD8 server major version 655 2 CARD16 sequence number 656 4 0 reply length 657 2 CARD16 server minor version 658 22 unused 659</literallayout> 660 661<literallayout class="monospaced"> 662<function>XTestCompareCursor</function> 663 1 CARD8 opcode 664 1 1 xtest opcode 665 2 3 request length 666 4 WINDOW window 667 4 CURSOR cursor-id 668 0 None 669 1 CurrentCursor 670=> 671 1 1 Reply 672 1 BOOL cursors are the same 673 2 CARD16 sequence number 674 4 0 reply length 675 24 unused 676</literallayout> 677 678<literallayout class="monospaced"> 679<function>XTestFakeInput</function> 680 1 CARD8 opcode 681 1 2 xtest opcode 682 2 1+(1*8) request length 683 1 FAKE_EVENT_TYPE fake device event type 684 1 BYTE detail: button or keycode 685 2 unused 686 4 TIME delay (milliseconds) 687 0 CurrentTime 688 4 WINDOW root window for MotionNotify 689 0 None 690 8 unused 691 2 INT16 x position for MotionNotify 692 2 INT16 y position for MotionNotify 693 8 unused 694</literallayout> 695 696<literallayout class="monospaced"> 697<olink targetdoc='xtestlib' targetptr='XTestGrabControl'><function>XTestGrabControl</function></olink> 698 1 CARD8 opcode 699 1 3 xtest opcode 700 2 2 request length 701 1 BOOL impervious 702 3 unused 703</literallayout> 704</sect1> 705</chapter> 706 707<chapter id="References"> 708<title>References</title> 709<para> 710Annicchiarico, D., et al., 711<emphasis remap='I'>XTrap: The XTrap Architecture</emphasis>. 712Digital Equipment Corporation, July 1991. 713</para> 714 715<para> 716Drake, K. J., 717<emphasis remap='I'>Some Proposals for a 718Minimum X11 Testing Extension</emphasis>. 719UniSoft Ltd., June 1991. 720</para> 721</chapter> 722 723</book> 724