home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 August - Disc 2 / chip_20018102_hu.iso / linux / X-4.1.0 / doc / xtestlib.txt < prev    next >
Text File  |  2001-06-27  |  12KB  |  529 lines

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