XTest.xml revision a253d6ae
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
4<!-- lifted from troff+man by doclifter -->
5<refentry id='XTest.man'>
6<!--  
7Copyright &copy; 1992 by UniSoft Group Ltd.
8Permission to use, copy, modify, and distribute this documentation for
9any purpose and without fee is hereby granted, provided that the above
10copyright notice and this permission notice appear in all copies.  
11UniSoft makes no representations about the suitability for any purpose of 
12the information in this document.  This documentation is provided "as is"
13without express or implied warranty.
14
15Copyright &copy; 1992, 1994 X Consortium
16
17Permission is hereby granted, free of charge, to any person obtaining a 
18copy of this software and associated documentation files (the "Software"),
19to deal in the Software without restriction, including without limitation
20the rights to use, copy, modify, merge, publish, distribute, sublicense, 
21and/or sell copies of the Software, and to permit persons to whom the 
22Software is furnished to do so, subject to the following conditions:
23
24The above copyright notice and this permission notice shall be included in
25all copies or substantial portions of the Software.
26
27THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL 
30THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
31WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
32OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
33SOFTWARE.
34
35Except as contained in this notice, the name of the X Consortium shall not
36be used in advertising or otherwise to promote the sale, use or other 
37dealings in this Software without prior written authorization from the 
38X Consortium.
39 -->
40
41<!-- edited for DP edits and code consistency w/ core protocol/xlib 4/2/96 -->
42<!-- Converted from xorg-docs/specs/Xext/xtestlib.ms 6/6/07 -->
43<!-- $Xorg: xtestlib.ms,v 1.3 2000/08/17 19:42:37 cpqbld Exp $ -->
44 <refentryinfo>
45  <productname>__vendorversion__</productname>
46  <pubdate>6 June 2007</pubdate>
47   <author><firstname>Kieron</firstname><surname>Drake</surname>
48   <affiliation><orgname>UniSoft Ltd.</orgname></affiliation>
49   </author>
50 </refentryinfo>
51<refmeta>
52<refentrytitle>XTest</refentrytitle>
53<manvolnum>__libmansuffix__</manvolnum>
54<refmiscinfo class='source'>__xorgversion__</refmiscinfo>
55<refmiscinfo class='manual'>XTST FUNCTIONS</refmiscinfo>
56</refmeta>
57<refnamediv id='name'>
58<refname>XTestQueryExtension</refname>
59<refname>XTestCompareCursorWithWindow</refname>
60<refname>XTestCompareCurrentCursorWithWindow</refname>
61<refname>XTestFakeKeyEvent</refname>
62<refname>XTestFakeButtonEvent</refname>
63<refname>XTestFakeMotionEvent</refname>
64<refname>XTestFakeRelativeMotionEvent</refname>
65<refname>XTestGrabControl</refname>
66<refname>XTestSetGContextOfGC</refname>
67<refname>XTestSetVisualIDOfVisual</refname>
68<refname>XTestDiscard</refname>
69<refpurpose>XTest extension functions</refpurpose>
70</refnamediv>
71<!-- body begins here -->
72<refsynopsisdiv id='synopsis'>
73<funcsynopsis>
74<funcsynopsisinfo>
75cc [ flag ... ] file ... -lXtst  [ library ... ]
76</funcsynopsisinfo>
77<funcsynopsisinfo>
78#include &lt;X11/extensions/XTest.h&gt;
79</funcsynopsisinfo>
80<funcprototype>
81<funcdef><function>Bool</function> XTestQueryExtension</funcdef>
82<paramdef><parameter>display</parameter></paramdef>
83<paramdef><parameter>event_base</parameter></paramdef>
84<paramdef><parameter>error_base</parameter></paramdef>
85<paramdef><parameter>major_version</parameter></paramdef>
86<paramdef><parameter>minor_version</parameter></paramdef>
87</funcprototype>
88<funcsynopsisinfo>
89 Display *display;
90 int *event_base;
91 int *error_base;
92 int *major_version;
93 int *minor_version;
94</funcsynopsisinfo>
95<funcprototype>
96<funcdef><function>Bool</function> XTestCompareCursorWithWindow</funcdef>
97<paramdef><parameter>display</parameter></paramdef>
98<paramdef><parameter>window</parameter></paramdef>
99<paramdef><parameter>cursor</parameter></paramdef>
100</funcprototype>
101<funcsynopsisinfo>
102 Display *display;
103 Window window;
104 Cursor cursor;
105</funcsynopsisinfo>
106<funcprototype>
107<funcdef><function>Bool</function> XTestCompareCurrentCursorWithWindow</funcdef>
108<paramdef><parameter>display</parameter></paramdef>
109<paramdef><parameter>window</parameter></paramdef>
110</funcprototype>
111<funcsynopsisinfo>
112 Display *display;
113 Window window;
114</funcsynopsisinfo>
115<funcprototype>
116<funcdef>int <function>XTestFakeKeyEvent</function></funcdef>
117<paramdef><parameter>display</parameter></paramdef>
118<paramdef><parameter>keycode</parameter></paramdef>
119<paramdef><parameter>is_press</parameter></paramdef>
120<paramdef><parameter>delay</parameter></paramdef>
121</funcprototype>
122<funcsynopsisinfo>
123 Display *display;
124 unsigned int keycode;
125 Bool is_press;
126 unsigned long delay;
127</funcsynopsisinfo>
128<funcprototype>
129<funcdef>int <function>XTestFakeButtonEvent</function></funcdef>
130<paramdef><parameter>display</parameter></paramdef>
131<paramdef><parameter>button</parameter></paramdef>
132<paramdef><parameter>is_press</parameter></paramdef>
133<paramdef><parameter>delay</parameter></paramdef>
134</funcprototype>
135<funcsynopsisinfo>
136 Display *display;
137 unsigned int button;
138 Bool is_press;
139 unsigned long delay;
140</funcsynopsisinfo>
141<funcprototype>
142<funcdef>int <function>XTestFakeMotionEvent</function></funcdef>
143<paramdef><parameter>display</parameter></paramdef>
144<paramdef><parameter>screen_number</parameter></paramdef>
145<paramdef><parameter>x</parameter></paramdef>
146<paramdef><parameter>y</parameter></paramdef>
147<paramdef><parameter>delay</parameter></paramdef>
148</funcprototype>
149<funcsynopsisinfo>
150 Display *display;
151 int screen_number;
152 int x, y;
153 unsigned long delay;
154</funcsynopsisinfo>
155<funcprototype>
156<funcdef>int <function>XTestFakeRelativeMotionEvent</function></funcdef>
157<paramdef><parameter>display</parameter></paramdef>
158<paramdef><parameter>screen_number</parameter></paramdef>
159<paramdef><parameter>x</parameter></paramdef>
160<paramdef><parameter>y</parameter></paramdef>
161<paramdef><parameter>delay</parameter></paramdef>
162</funcprototype>
163<funcsynopsisinfo>
164 Display *display;
165 int screen_number;
166 int x, y;
167 unsigned long delay;
168</funcsynopsisinfo>
169<funcprototype>
170<funcdef>int <function>XTestGrabControl</function></funcdef>
171<paramdef><parameter>display</parameter></paramdef>
172<paramdef><parameter>impervious</parameter></paramdef>
173</funcprototype>
174<funcsynopsisinfo>
175 Display *display;
176 Bool impervious;
177</funcsynopsisinfo>
178<funcprototype>
179<funcdef>void <function>XTestSetGContextOfGC</function></funcdef>
180<paramdef><parameter>gc</parameter></paramdef>
181<paramdef><parameter>gid</parameter></paramdef>
182</funcprototype>
183<funcsynopsisinfo>
184 GC gc;
185 GContext gid;
186</funcsynopsisinfo>
187<funcprototype>
188<funcdef>void <function>XTestSetVisualIDOfVisual</function></funcdef>
189<paramdef><parameter>visual</parameter></paramdef>
190<paramdef><parameter>visualid</parameter></paramdef>
191</funcprototype>
192<funcsynopsisinfo>
193 Visual *visual;
194 VisualID visualid;
195</funcsynopsisinfo>
196<funcprototype>
197<funcdef><function>Status</function> XTestDiscard</funcdef>
198<paramdef><parameter>display</parameter></paramdef>
199</funcprototype>
200<funcsynopsisinfo>
201 Display *display;
202</funcsynopsisinfo>
203</funcsynopsis>
204</refsynopsisdiv>
205
206
207<refsect1 id='description'><title>DESCRIPTION</title>
208<para>This extension is a minimal set of client and server extensions
209required to completely test the X11 server with no user intervention.
210This extension is not intended to support general journaling and
211playback of user actions.</para> 
212
213<para>The functions provided by this extension fall into two groups:</para>
214<variablelist remap='IP'>
215  <varlistentry>
216  <term><emphasis remap='B'>Client Operations</emphasis></term>
217  <listitem>
218<para>These routines manipulate otherwise hidden client-side behavior.  The
219actual implementation will depend on the details of the actual language
220binding and what degree of request buffering, GContext caching, and so on, is
221provided.  In the C binding, routines are provided
222to access the internals of two opaque data structures 
223&mdash; <structname>GC</structname>s
224and
225<structname>Visual</structname>s &mdash;
226and to discard any requests pending within the
227output buffer of a connection.  The exact details can be expected to differ for
228other language bindings.</para>
229  </listitem>
230  </varlistentry>
231  <varlistentry>
232  <term><emphasis remap='B'>Server Requests</emphasis></term>
233  <listitem>
234<para>The first of these requests is similar to that provided in most
235extensions: it allows a client to specify a major and minor version
236number to the server and for the server to respond with major and minor
237versions of its own.  The remaining two requests allow the following:</para>
238 <itemizedlist>
239  <listitem>
240<para>Access to an otherwise <emphasis>write-only</emphasis> server resource: 
241the cursor associated with a given window</para>
242  </listitem>
243  <listitem>
244<para>Perhaps most importantly, limited synthesis of input device events,
245almost as if a cooperative user had moved the pointing device
246or pressed a key or button.</para>
247  </listitem>
248 </itemizedlist>
249  </listitem>
250  </varlistentry>
251</variablelist>
252
253<para>All XTEST extension functions and procedures, and all manifest
254constants and macros, will start with the string <emphasis>XTest</emphasis>.
255All operations are classified as
256server/client (Server) or client-only (Client).</para>
257
258<para><function>XTestQueryExtension</function>
259returns
260<returnvalue>True</returnvalue>
261if the specified display supports the XTEST extension, else
262<returnvalue>False</returnvalue>.
263If the extension is supported, *event_base would be set to the event number for
264the first event for this extension and
265*error_base would be set to the error number for the first error for
266this extension.  As no errors or events are defined for this version of the extension,
267the values returned here are not defined (nor useful).
268If the extension is supported, *major_version and *minor_version are set to
269the major and minor version numbers of the extension supported by the
270display.  Otherwise, none of the arguments are set.</para>
271
272
273<para>If the extension is supported,
274<function>XTestCompareCursorWithWindow</function>
275performs a comparison of the cursor
276whose ID is specified by cursor (which may be
277<emphasis remap='B'>None</emphasis>)
278with the cursor of the window specified by window returning
279<returnvalue>True</returnvalue>
280if they are the same and
281<returnvalue>False</returnvalue>
282otherwise. 
283If the extension is not supported, then the request is ignored and
284zero is returned.</para>
285
286
287<para>If the extension is supported, 
288<function>XTestCompareCurrentCursorWithWindow</function>
289performs a comparison of the current cursor
290with the cursor of the specified window returning
291<returnvalue>True</returnvalue>
292if they are the same and
293<returnvalue>False</returnvalue>
294otherwise.
295If the extension is not supported, then the request is ignored and
296zero is returned.</para>
297
298
299<para>If the extension is supported,
300<function>XTestFakeKeyEvent</function>
301requests the server to simulate either a
302<emphasis remap='B'>KeyPress</emphasis>
303(if is_press is
304<returnvalue>True</returnvalue>)
305or a
306<emphasis remap='B'>KeyRelease</emphasis>
307(if is_press is
308<returnvalue>False</returnvalue>)
309of the key with the specified keycode;
310otherwise, the request is ignored.</para>
311
312<para>If the extension is supported,
313the simulated event will not be processed until delay milliseconds
314after the request is received (if delay is
315<emphasis remap='B'>CurrentTime</emphasis>,
316then this is interpreted as no delay at all).  No other requests from
317this client will be processed until this delay, if any, has expired
318and subsequent processing of the simulated event has been completed.</para>
319
320
321<para>If the extension is supported,
322<function>XTestFakeButtonEvent</function>
323requests the server to simulate either
324a
325<emphasis remap='B'>ButtonPress</emphasis>
326(if is_press is
327<returnvalue>True</returnvalue>)
328or a
329<emphasis remap='B'>ButtonRelease</emphasis>
330(if is_press is
331<returnvalue>False</returnvalue>)
332of the logical button numbered by the specified button;
333otherwise, the request is ignored.</para>
334
335<para>If the extension is supported,
336the simulated event will not be processed until delay milliseconds
337after the request is received (if delay is
338<emphasis remap='B'>CurrentTime</emphasis>,
339then this is interpreted as no delay at all).  No other requests from
340this client will be processed until this delay, if any, has expired
341and subsequent processing of the simulated event has been completed.</para>
342
343
344<para>If the extension is supported,
345<function>XTestFakeMotionEvent</function>
346requests the server to simulate
347a movement of the pointer to the specified position (x, y) on the
348root window of screen_number;
349otherwise, the request is ignored.  If screen_number is -1, the
350current screen (that the pointer is on) is used.</para>
351
352<para>If the extension is supported,
353the simulated event will not be processed until delay milliseconds
354after the request is received (if delay is
355<emphasis remap='B'>CurrentTime</emphasis>,
356then this is interpreted as no delay at all).  No other requests from
357this client will be processed until this delay, if any, has expired
358and subsequent processing of the simulated event has been completed.</para>
359
360
361<para>If the extension is supported,
362<function>XTestFakeRelativeMotionEvent</function>
363requests the server to simulate
364a movement of the pointer by the specified offsets (x, y) relative
365to the current pointer position on screen_number;
366otherwise, the request is ignored.  If screen_number is -1, the
367current screen (that the pointer is on) is used.</para>
368
369<para>If the extension is supported,
370the simulated event will not be processed until delay milliseconds
371after the request is received (if delay is
372<emphasis remap='B'>CurrentTime</emphasis>,
373then this is interpreted as no delay at all).  No other requests from
374this client will be processed until this delay, if any, has expired
375and subsequent processing of the simulated event has been completed.</para>
376
377
378
379<para>If impervious is
380<returnvalue>True</returnvalue>,
381then the executing client becomes impervious to server grabs.
382If impervious is
383<returnvalue>False</returnvalue>,
384then the executing client returns to the normal state of being
385susceptible to server grabs.</para>
386
387
388<para><function>XTestSetGContextOfGC</function>
389sets the GContext within the opaque datatype referenced by gc to
390be that specified by gid.</para>
391
392
393<para><function>XTestSetVisualIDOfVisual</function>
394sets the VisualID within the opaque datatype referenced by visual to
395be that specified by visualid.</para>
396
397
398<para><function>XTestDiscard</function>
399discards any requests within the output buffer for the specified display.
400It returns
401<returnvalue>True</returnvalue>
402if any requests were discarded; otherwise, it returns
403<returnvalue>False</returnvalue>.</para>
404
405</refsect1>
406
407<refsect1 id='return_values'><title>RETURN VALUES</title>
408<para>All routines that have return type Status will return nonzero for
409success and zero for failure.  Even if the XTEST extension is
410supported, the server may withdraw such facilities arbitrarily; in which case
411they will subsequently return zero.</para>
412</refsect1>
413</refentry>
414
415