1<?xml version="1.0" encoding="UTF-8" ?> 2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" 4[ 5<!ENTITY % defs SYSTEM "defs.ent"> %defs; 6]> 7 8 9<!-- lifted from troff+ms+XMan by doclifter --> 10<book id="xtestlib"> 11 12<bookinfo> 13 <title>XTEST Extension Library</title> 14 <subtitle>X Consortium Standard</subtitle> 15 <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo> 16 <releaseinfo>Version 2.2</releaseinfo> 17 <authorgroup> 18 <author> 19 <firstname>Kieron</firstname><surname>Drake</surname> 20 <affiliation><orgname>UniSoft Ltd.</orgname></affiliation> 21 </author> 22 </authorgroup> 23 <copyright><year>1992</year><holder>UniSoft Group Ltd.</holder></copyright> 24 25<legalnotice> 26<para> 27Permission to use, copy, modify, and distribute this documentation for 28any purpose and without fee is hereby granted, provided that the above 29copyright notice and this permission notice appear in all copies. UniSoft 30makes no representations about the suitability for any purpose of the 31information in this document. This documentation is provided 32“as is” without express or implied warranty. 33</para> 34</legalnotice> 35 36<legalnotice> 37<para role="multiLicensing">Copyright © 1992,1994 X Consortium</para> 38<para> 39Permission is hereby granted, free of charge, to any person obtaining a copy 40of this software and associated documentation files 41(the “Software”), to deal in the Software without restriction, 42including without limitation the rights to use, copy, modify, merge, publish, 43distribute, sublicense, and/or sell copies of the Software, and to permit 44persons to whom the Software is furnished to do so, subject to the following 45conditions: 46</para> 47<para> 48The above copyright notice and this permission notice shall be included in all 49copies or substantial portions of the Software. 50</para> 51<para> 52THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 53EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 54MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 55NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 56LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 57OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 58THE SOFTWARE. 59</para> 60<para> 61Except as contained in this notice, the name of the X Consortium shall not 62be used in advertising or otherwise to promote the sale, use or other dealings 63in this Software without prior written authorization from the X Consortium. 64</para> 65<para>X Window System is a trademark of The Open Group.</para> 66</legalnotice> 67</bookinfo> 68 69<chapter id='Overview'> 70<title>Overview</title> 71 72<para> 73This extension is a minimal set of client and server extensions 74required to completely test the X11 server with no user intervention. 75</para> 76 77<para> 78This extension is not intended to support general journaling and 79playback of user actions. This is a difficult area [XTrap, 89] as it attempts 80to synchronize synthetic user interactions with their effects; it is at the 81higher level of dialogue recording/playback rather than at the strictly lexical 82level. We are interested only in the latter, simpler, case. A more detailed 83discussion and justification of the extension functionality is given in 84[Drake, 91]. 85</para> 86 87<para> 88We are aiming only to provide a minimum set of facilities that 89solve immediate testing and validation problems. The testing extension 90itself needs testing, where possible, and so should be as simple as possible. 91</para> 92 93<para>We have also tried to:</para> 94<itemizedlist mark='bullet'> 95 <listitem> 96 <para> 97Confine the extension to an appropriate high level 98within the server to minimize portability problems. In practice this 99means that the extension should be at the DIX level or use the 100DIX/DDX interface, or both. This has effects, in particular, on the 101level at which "input synthesis" can occur. 102 </para> 103 </listitem> 104 <listitem> 105 <para> 106Minimize the changes required in the rest of the server. 107 </para> 108 </listitem> 109 <listitem> 110 <para> 111Minimize performance penalties on normal server operation. 112 </para> 113 </listitem> 114</itemizedlist> 115</chapter> 116 117<chapter id='Description'> 118<title>Description</title> 119 120<para>The functions provided by this extension fall into two groups:</para> 121 122<itemizedlist> 123 <listitem> 124 <para>Client Operations</para> 125 <para> 126These routines manipulate otherwise hidden client-side behavior. 127The actual implementation will depend on the details of the actual language 128binding and what degree of request buffering, GContext caching, and so on, is 129provided. In the C binding, defined in section 7, routines are provided 130to access the internals of two opaque data structures - 131<symbol role='Pn'>GC</symbol>s 132and 133<function>Visual</function>s - and to discard any requests pending within the 134output buffer of a connection. The exact details can be expected to differ for 135other language bindings. 136 </para> 137 </listitem> 138 <listitem> 139 <para>Server Requests</para> 140 <para> 141The first of these requests is similar to that provided in most 142extensions: it allows a client to specify a major and minor version 143number to the server and for the server to respond with major and minor 144versions of its own. The remaining two requests allow the following: 145 </para> 146 </listitem> 147 <listitem> 148 <itemizedlist> 149 <listitem> 150 <para> 151Access to an otherwise "write-only" server resource: the 152cursor associated with a given window 153 </para> 154 </listitem> 155 <listitem> 156 <para> 157Perhaps most importantly, limited synthesis of input 158device events, almost as if a cooperative user had moved the pointing device 159or pressed a key or button. 160 </para> 161 </listitem> 162 </itemizedlist> 163 </listitem> 164</itemizedlist> 165</chapter> 166 167<chapter id='C_Language_Binding'> 168<title>C Language Binding</title> 169 170<para> 171The C functions either provide direct access to the protocol and add no 172additional semantics to those defined in section 5 or they correspond 173directly to the abstract descriptions of client operations in section 4. 174</para> 175 176<para> 177All XTEST extension functions and procedures, and all manifest constants 178and macros, will start with the string "XTest". All operations are 179classified as server/client (Server) or client-only (Client). 180All routines that have return type Status will return nonzero for 181"success" and zero for "failure." Even if the XTEST extension is 182supported, the server may withdraw such facilities arbitrarily; in which case 183they will subsequently return zero. 184</para> 185 186<para> 187The include file for this extension is 188<<symbol role='Pn'>X11/extensions/XTest.h</symbol>>. 189</para> 190 191<funcsynopsis id='XTestQueryExtension'> 192<funcprototype> 193<funcdef>Bool<function> XTestQueryExtension</function></funcdef> 194<paramdef>Display<parameter> *display</parameter></paramdef> 195<paramdef>int<parameter> *event_base</parameter></paramdef> 196<paramdef>int<parameter> *error_base</parameter></paramdef> 197<paramdef>int<parameter> *major_version</parameter></paramdef> 198<paramdef>int<parameter> *minor_version</parameter></paramdef> 199</funcprototype> 200</funcsynopsis> 201 202<para> 203<xref linkend='XTestQueryExtension' xrefstyle='select: title'/> 204returns 205<function>True</function> 206if the specified display supports the XTEST extension, else 207<function>False</function> 208If the extension is supported, *event_base would be set to the event number 209for the first event for this extension and *error_base would be set to the 210error number for the first error for this extension. As no errors or 211events are defined for this version of the extension, the values returned 212here are not defined (nor useful). If the extension is supported, 213*major_version and *minor_version are set to the major and minor version 214numbers of the extension supported by the display. Otherwise, none of 215the arguments are set. 216</para> 217 218<funcsynopsis id='XTestCompareCursorWithWindow'> 219<funcprototype> 220<funcdef>Bool<function> XTestCompareCursorWithWindow</function></funcdef> 221<paramdef>Display<parameter> *display</parameter></paramdef> 222<paramdef>Window<parameter> *window</parameter></paramdef> 223<paramdef>Cursor<parameter> cursor</parameter></paramdef> 224</funcprototype> 225</funcsynopsis> 226 227<para>If the extension is supported, 228<xref linkend='XTestCompareCursorWithWindow' xrefstyle='select: title'/> 229performs a comparison of the cursor whose ID is specified by cursor (which 230may be 231<function>None</function> 232with the cursor of the window specified by window returning 233<function>True</function> 234if they are the same and 235<function>False</function> 236otherwise. If the extension is not supported, then the request is ignored and 237zero is returned. 238</para> 239 240<funcsynopsis id='XTestCompareCurrentCursorWithWindow'> 241<funcprototype> 242<funcdef>Bool<function>XTestCompareCurrentCursorWithWindow</function></funcdef> 243<paramdef>Display<parameter> *display</parameter></paramdef> 244<paramdef>Window<parameter> window</parameter></paramdef> 245</funcprototype> 246</funcsynopsis> 247 248<para>If the extension is supported, 249<xref linkend='XTestCompareCurrentCursorWithWindow' xrefstyle='select: title'/> 250performs a comparison of the current cursor with the cursor of the specified 251window returning 252<function>True</function> 253if they are the same and 254<function>False</function> 255otherwise. If the extension is not supported, then the request is ignored and 256zero is returned. 257</para> 258 259<funcsynopsis id='XTestFakeKeyEvent'> 260<funcprototype> 261<funcdef><function>XTestFakeKeyEvent</function></funcdef> 262<paramdef>Display<parameter> *display</parameter></paramdef> 263<paramdef>unsigned int<parameter> keycode</parameter></paramdef> 264<paramdef>Bool<parameter> is_press</parameter></paramdef> 265<paramdef>unsigned long<parameter> delay</parameter></paramdef> 266</funcprototype> 267</funcsynopsis> 268 269<para>If the extension is supported, 270<xref linkend='XTestFakeKeyEvent' xrefstyle='select: title'/> 271requests the server to simulate either a 272<function>KeyPress</function> 273(if is_press is 274<function>True</function> 275or a 276<function>KeyRelease</function> 277(if is_press is 278<function>False</function> 279of the key with the specified keycode; otherwise, the request is ignored. 280</para> 281 282<para> 283If the extension is supported, the simulated event will not be processed 284until delay milliseconds after the request is received (if delay is 285<function>CurrentTime</function> 286then this is interpreted as no delay at all). No other requests from 287this client will be processed until this delay, if any, has expired 288and subsequent processing of the simulated event has been completed. 289</para> 290 291<funcsynopsis id='XTestFakeButtonEvent'> 292<funcprototype> 293<funcdef><function>XTestFakeButtonEvent</function></funcdef> 294<paramdef>Display<parameter> *display</parameter></paramdef> 295<paramdef>unsigned int<parameter> button</parameter></paramdef> 296<paramdef>Bool<parameter> is_press</parameter></paramdef> 297<paramdef>unsigned long<parameter> delay</parameter></paramdef> 298</funcprototype> 299</funcsynopsis> 300 301<para>If the extension is supported, 302<xref linkend='XTestFakeButtonEvent' xrefstyle='select: title'/> 303requests the server to simulate either a 304<function>ButtonPress</function> 305(if is_press is 306<function>True</function> 307or a 308<function>ButtonRelease</function> 309(if is_press is 310<function>False</function> 311of the logical button numbered by the specified button; otherwise, the 312request is ignored. 313</para> 314 315<para>If the extension is supported, 316the simulated event will not be processed until delay milliseconds 317after the request is received (if delay is 318<function>CurrentTime</function> 319then this is interpreted as no delay at all). No other requests from 320this client will be processed until this delay, if any, has expired 321and subsequent processing of the simulated event has been completed. 322</para> 323 324<funcsynopsis id='XTestFakeMotionEvent'> 325<funcprototype> 326<funcdef><function>XTestFakeMotionEvent</function></funcdef> 327<paramdef>Display<parameter> *display</parameter></paramdef> 328<paramdef>int<parameter> screen_number</parameter></paramdef> 329<paramdef>int<parameter> x</parameter></paramdef> 330<paramdef>int<parameter> y</parameter></paramdef> 331<paramdef>unsigned long<parameter> delay</parameter></paramdef> 332</funcprototype> 333</funcsynopsis> 334 335<para>If the extension is supported, 336<xref linkend='XTestFakeMotionEvent' xrefstyle='select: title'/> 337requests the server to simulate a movement of the pointer to the specified 338position (x, y) on the root window of screen_number; otherwise, the request 339is ignored. If screen_number is -1, the current screen (that the pointer 340is on) is used. 341</para> 342 343<para> 344If the extension is supported, the simulated event will not be processed 345until delay milliseconds after the request is received (if delay is 346<function>CurrentTime</function> 347then this is interpreted as no delay at all). No other requests from 348this client will be processed until this delay, if any, has expired 349and subsequent processing of the simulated event has been completed. 350</para> 351 352<funcsynopsis id='XTestFakeRelativeMotionEvent'> 353<funcprototype> 354<funcdef><function>XTestFakeRelativeMotionEvent</function></funcdef> 355<paramdef>Display<parameter> *display</parameter></paramdef> 356<paramdef>int<parameter> screen_number</parameter></paramdef> 357<paramdef>int<parameter> x</parameter></paramdef> 358<paramdef>int<parameter> y</parameter></paramdef> 359<paramdef>unsigned long<parameter> delay</parameter></paramdef> 360</funcprototype> 361</funcsynopsis> 362 363<para> 364If the extension is supported, 365<xref linkend='XTestFakeRelativeMotionEvent' xrefstyle='select: title'/> 366requests the server to simulate a movement of the pointer by the specified 367offsets (x, y) relative to the current pointer position on screen_number; 368otherwise, the request is ignored. If screen_number is -1, the 369current screen (that the pointer is on) is used. 370</para> 371 372<para> 373If the extension is supported, the simulated event will not be processed 374until delay milliseconds after the request is received (if delay is 375<function>CurrentTime</function> 376then this is interpreted as no delay at all). No other requests from 377this client will be processed until this delay, if any, has expired 378and subsequent processing of the simulated event has been completed. 379</para> 380 381<funcsynopsis id='XTestGrabControl'> 382<funcprototype> 383<funcdef><function>XTestGrabControl</function></funcdef> 384<paramdef>Display<parameter> *display</parameter></paramdef> 385<paramdef>Bool<parameter> impervious</parameter></paramdef> 386</funcprototype> 387</funcsynopsis> 388 389<para>If impervious is 390<function>True</function> 391then the executing client becomes impervious to server grabs. If impervious is 392<function>False</function> 393then the executing client returns to the normal state of being susceptible 394to server grabs. 395</para> 396 397<funcsynopsis id='XTestSetGContextOfGC'> 398<funcprototype> 399<funcdef>Bool<function> XTestSetGContextOfGC</function></funcdef> 400<paramdef>GC<parameter> gc</parameter></paramdef> 401<paramdef>GContext<parameter> gid</parameter></paramdef> 402</funcprototype> 403</funcsynopsis> 404 405<para> 406<xref linkend='XTestSetGContextOfGC' xrefstyle='select: title'/> 407sets the GContext within the opaque datatype referenced by gc to 408be that specified by gid. 409</para> 410 411<funcsynopsis id='XTestSetVisualIDOfVisual'> 412<funcprototype> 413<funcdef><function>XTestSetVisualIDOfVisual</function></funcdef> 414<paramdef>Visual<parameter> *visual</parameter></paramdef> 415<paramdef>VisualID<parameter> visualid</parameter></paramdef> 416</funcprototype> 417</funcsynopsis> 418 419<para> 420<xref linkend='XTestSetVisualIDOfVisual' xrefstyle='select: title'/> 421sets the VisualID within the opaque datatype referenced by visual to 422be that specified by visualid. 423</para> 424 425<funcsynopsis id='XTestDiscard'> 426<funcprototype> 427<funcdef>Bool<function> XTestDiscard</function></funcdef> 428<paramdef>Display<parameter> *display</parameter></paramdef> 429</funcprototype> 430</funcsynopsis> 431 432<para> 433<xref linkend='XTestDiscard' xrefstyle='select: title'/> 434discards any requests within the output buffer for the specified display. 435It returns 436<function>True</function> 437if any requests were discarded; otherwise, it returns 438<function>False</function> 439</para> 440</chapter> 441 442<chapter id='References'> 443<title>References</title> 444 445<para> 446Annicchiarico, D., et al., <emphasis remap='I'>XTrap: The XTrap 447Architecture</emphasis>. 448Digital Equipment Corporation, July 1991. 449</para> 450 451<para> 452Drake, K. J., <emphasis remap='I'>Some Proposals for a Minimum X11 453Testing Extension</emphasis>. 454UniSoft Ltd., June 1991. 455</para> 456 457</chapter> 458</book> 459