home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / doc / extensions / xtest1.mm < prev    next >
Encoding:
Text File  |  1988-09-03  |  16.6 KB  |  495 lines

  1. .tr ~
  2. .SA 0
  3. .TL
  4. X11 INPUT SYNTHESIS EXTENSION PROPOSAL
  5. .AF "Hewlett Packard"
  6. .ds ZZ Corvallis~Workstation~Operation
  7. .AU "Larry Woestman" "" ZZ
  8. .AT "Member of Technical Staff"
  9. .AS
  10. This is a proposal for an extension to the X11 server and Xlib.
  11. It provides two capabilities:
  12. .BL
  13. .LI
  14. It allows a client to generate user input actions in the server without
  15. requiring a user to be present.
  16. .LI
  17. It also allows a client to control the
  18. handling of user input actions by the server.
  19. .LE
  20. .P
  21. The capability
  22. to allow a client to generate user input actions in the server
  23. will be used by some of the X Testing Consortium Xlib tests.
  24. Both capabilities will be used by the X Testing Consortium client exerciser
  25. program.
  26. These capabilities may also be useful in other programs.
  27. .P
  28. This extension requires modification to device-dependent code in the
  29. server.  Therefore it is not a `portable' extension as defined by the
  30. X11 Server Extensions document.  However, the majority of the code
  31. and functionality of this extension will be implementation-independent.
  32. .AE
  33. .MT 4
  34. .nr Cl 4
  35. .PH "'X11 Input Synthesis Extension Proposal''Page \\\\nP'"
  36. .PF "''\\\\*(DT''"
  37. .SK 1
  38. .H 1 Conventions~Used~In~This~Document
  39. The naming conventions used in the Xlib documentation are followed 
  40. with these additions:
  41. .BL
  42. .LI
  43. The names of all functions defined in this extension begin with `XTest',
  44. with the first letter of each additional word capitalized.
  45. .LI
  46. The names of the protocol request structures follow the Xlib convention
  47. of `x<name>Req'.
  48. .LI
  49. The names of the protocol request minor type codes follow the Xlib convention
  50. of `X_<name>'.
  51. .LI
  52. The names of all other constants defined in this extension begin with `XTest',
  53. with the rest of the name in upper case letters.
  54. .LI
  55. All constants and structures defined in this extension will have their
  56. values specified in the `xtestext1.h' file (listed in section 5).
  57. .LE
  58. .H 1 Definition~Of~Terms
  59. .H 2 Input~Actions
  60. Input actions are pointer movements, button presses and releases,
  61. and key presses and releases.  They can be generated by a user or by a client
  62. (using functions in this extension).
  63. .H 2 User~Input~Actions
  64. User input actions are input actions that are generated by the user
  65. moving a pointing device (typically a mouse), pressing and releasing buttons on
  66. the pointing device, and pressing and releasing keys on the keyboard.
  67. .SK
  68. .H 1 What~Does~This~Extension~Do?
  69. Without this extension, user input actions are processed by the server,
  70. and are converted into normal X events that are sent to the
  71. appropriate client or clients.
  72. .P
  73. This extension adds the following capabilities:
  74. .BL
  75. .LI
  76. Input actions may be sent from a client to the server to be
  77. processed just as if the user had physically performed them.
  78. The input actions are provided to the server in the form of X protocol
  79. requests defined by this extension.
  80. The information provided to the server includes what action should be
  81. performed, and how long to delay before processing the action in the server.
  82. .LI
  83. User input actions may be diverted to a client before being processed by the
  84. server.
  85. The effect on the server is as if the user had performed no input action.
  86. The user input actions are provided to the client in the form of X events
  87. defined by this extension.
  88. The information provided to the client includes what user input action
  89. occurred and the delay between this user input action and the previous user
  90. input action.
  91. The client may then do anything it wishes with this information.
  92. .LI
  93. User input actions may be copied, with one copy going to the server in the
  94. normal way, and the other copy being sent to a client as described above.
  95. .LE
  96. .SK
  97. .H 1 Functions~In~This~Extension
  98. .H 2 High~Level~Functions
  99. These functions are built on top of the low level functions described later.
  100. .H 3 XTestMovePointer
  101. .DS
  102. int
  103. XTestMovePointer(\fIdisplay\fR, \fIdevice_id\fR, \fIdelay\fR, \fIx\fR, \fIy\fR, \fIcount\fR)
  104.         Display \(**\fIdisplay\fR;
  105.         int \fIdevice_id\fR;
  106.         unsigned long \fIdelay\fR[];
  107.         int \fIx\fR[];
  108.         int \fIy\fR[];
  109.         unsigned int \fIcount\fR;
  110. .DE
  111. .VL 11 "" 1
  112. .LI ~
  113. .LI \fIdisplay\fR
  114. Specifies the connection to the X server.
  115. .LI ~
  116. .LI \fIdevice_id\fR
  117. Specifies which pointer device was supposed to have caused the input action.
  118. This is a provision for future support of multiple (distinguishable) pointer
  119. devices, and should always be set to 0 for now.
  120. .LI ~
  121. .LI \fIdelay\fR
  122. Specifies the time (in milliseconds) to wait before each movement
  123. of the pointer.
  124. .LI ~
  125. .LI \fIx\fR
  126. .LI \fIy\fR
  127. Specifies the x and y coordinates to move the pointer to relative to the
  128. root window for the specified display.
  129. .LI ~
  130. .LI \fIcount\fR
  131. Specifies the number of `delay, x, y' triplets contained in the \fIdelay\fR,
  132. \fIx\fR and \fIy\fR arrays.
  133. .LE
  134. .P
  135. The
  136. .I XTestMovePointer
  137. function creates input actions to be sent to the the server.
  138. The input actions will be accumulated in a request defined by this extension
  139. until the request is full or the XTestFlush function is called.
  140. They will then be sent to the server.
  141. When the input actions are sent to the server, the input actions will cause
  142. the server to think that the pointer was moved to the specified position(s),
  143. with the specified delay before each input action.
  144. .P
  145. The
  146. .I XTestMovePointer
  147. function will return -1 if there is an error, and 0 otherwise.
  148. .SK
  149. .H 3 XTestPressButton
  150. .DS
  151. int
  152. XTestPressButton(\fIdisplay\fR, \fIdevice_id\fR, \fIdelay\fR, \fIbutton_number\fR,
  153.                  \fIbutton_action\fR)
  154.         Display \(**\fIdisplay\fR;
  155.         int \fIdevice_id\fR;
  156.         unsigned long \fIdelay\fR;
  157.         unsigned int \fIbutton_number\fR;
  158.         unsigned int \fIbutton_action\fR;
  159. .DE
  160. .VL 15
  161. .LI \fIdisplay\fR
  162. Specifies the connection to the X server.
  163. .LI \fIdevice_id\fR
  164. Specifies which button device was supposed to have caused the input action.
  165. This is a provision for future support of multiple (distinguishable) button
  166. devices, and should always be set to 0 for now.
  167. .LI \fIdelay\fR
  168. Specifies the time (in milliseconds) to wait before the input action.
  169. .LI \fIbutton_number\fR
  170. Specifies which button is being acted upon.
  171. .LI \fIbutton_action\fR
  172. Specifies the action to be performed (one of 
  173. \fIXTestPRESS\fR, \fIXTestRELEASE\fR, or \fIXTestSTROKE\fR).
  174. .LE
  175. .P
  176. The
  177. .I XTestPressButton
  178. function creates input actions to be sent to the the server.
  179. The input actions will be accumulated in a request defined by this extension
  180. until the request is full or the XTestFlush function is called.
  181. They will then be sent to the server.
  182. When the input actions are sent to the server, the input actions will cause
  183. the server to think that the specified button was moved as specified.
  184. .P
  185. The
  186. .I XTestPressButton
  187. function will return -1 if there is an error, and 0 otherwise.
  188. .SK
  189. .H 3 XTestPressKey
  190. .DS
  191. int
  192. XTestPressKey(\fIdisplay\fR, \fIdevice_id\fR, \fIdelay\fR, \fIkeycode\fR, \fIkey_action\fR)
  193.         Display \(**\fIdisplay\fR;
  194.         int \fIdevice_id\fR;
  195.         unsigned long \fIdelay\fR;
  196.         unsigned int \fIkeycode\fR;
  197.         unsigned int \fIkey_action\fR;
  198. .DE
  199. .VL 12
  200. .LI \fIdisplay\fR
  201. Specifies the connection to the X server.
  202. .LI \fIdevice_id\fR
  203. Specifies which keyboard device was supposed to have caused the input action.
  204. This is a provision for future support of multiple (distinguishable) keyboard
  205. devices, and should always be set to 0 for now.
  206. .LI \fIdelay\fR
  207. Specifies the time (in milliseconds) to wait before the input action.
  208. .LI \fIkeycode\fR
  209. Specifies which keycode is being acted upon.
  210. .LI \fIkey_action\fR
  211. Specifies the action to be performed (one of 
  212. \fIXTestPRESS\fR, \fIXTestRELEASE\fR, or \fIXTestSTROKE\fR).
  213. .LE
  214. .P
  215. The
  216. .I XTestPressKey
  217. function creates input actions to be sent to the the server.
  218. The input actions will be accumulated in a request defined by this extension
  219. until the request is full or the XTestFlush function is called.
  220. They will then be sent to the server.
  221. When the input actions are sent to the server, the input actions will cause
  222. the server to think that the specified key on the keyboard was moved as
  223. specified.
  224. .P
  225. The
  226. .I XTestPressKey
  227. function will return -1 if there is an error, and 0 otherwise.
  228. .SK
  229. .H 3 XTestFlush
  230. .DS
  231. int
  232. XTestFlush(\fIdisplay\fR)
  233.         Display \(**\fIdisplay\fR;
  234. .DE
  235. .VL 9
  236. .LI \fIdisplay\fR
  237. Specifies the connection to the X server.
  238. .LE
  239. .P
  240. The
  241. .I XTestFlush
  242. will send any remaining input actions to the server.
  243. .P
  244. The
  245. .I XTestFlush
  246. function will return -1 if there is an error, and 0 otherwise.
  247. .SK
  248. .H 2 Low~Level~Functions
  249. .H 3 XTestGetInput
  250. .DS
  251. int
  252. XTestGetInput(\fIdisplay\fR, \fIaction_handling\fR)
  253.         Display \(**\fIdisplay\fR;
  254.         int \fIaction_handling\fR;
  255. .DE
  256. .VL 17
  257. .LI \fIdisplay\fR
  258. Specifies the connection to the X server.
  259. .LI \fIaction_handling\fR
  260. Specifies to the server what to do with the user input actions.  (one of
  261. 0, \fIXTestPACKED_MOTION\fR or \fIXTestPACKED_ACTIONS\fR; optionally `or'ed
  262. with \fIXTestEXCLUSIVE\fR).
  263. .LE
  264. .P
  265. The
  266. .I XTestGetInput
  267. function tells the server to begin putting information about user input actions
  268. into events to be sent to the client that called this function.  These events
  269. can be read via the Xlib \fIXNextEvent\fR function.
  270. .P
  271. The server assigns an event type of \fIXTestInputActionType\fR to these events
  272. to distinguish them from other events. 
  273. Since the actual value of the event type may vary depending on how many
  274. extensions are included with an X11 implementation,
  275. \fIXTestInputActionType\fR is a variable that will be contained in the Xlib
  276. part of this extension.  It may be referenced as follows:
  277. .DS
  278. extern int XTestInputActionType;
  279. .DE
  280. .P
  281. An \fIaction_handling\fR value of 0 causes the server
  282. to send one user input action in each \fIXTestInputActionType\fR event.
  283. This can sometimes cause performance problems.
  284. .P
  285. An \fIaction_handling\fR value of \fIXTestPACKED_ACTIONS\fR causes the server
  286. to pack as many user input actions as possible into a
  287. \fIXTestInputActionType\fR event.
  288. This is needed if user input actions are happening rapidly (such as
  289. when the user moves the pointer) to keep performance at a reasonable level.
  290. .P
  291. An \fIaction_handling\fR value of \fIXTestPACKED_MOTION\fR causes the server
  292. to pack only user input actions associated with moving the pointer.
  293. This allows the
  294. client to receive button and key motions as they happen without waiting for the
  295. event to fill up, while still keeping performance at a reasonable level.
  296. .P
  297. An \fIaction_handling\fR value with \fIXTestEXCLUSIVE\fR `or'ed in 
  298. causes the server to send user input actions only to the client.
  299. The effect on the server is as if the user had performed no input actions.
  300. .P
  301. An \fIaction_handling\fR value without \fIXTestEXCLUSIVE\fR
  302. causes the server to copy user input actions, sending one copy to the 
  303. client, and handling the other copy normally (as it would if this extension
  304. were not installed).
  305. .P
  306. There are four types of input actions that are passed from the server
  307. to the client.  They are:
  308. .VL 25
  309. .LI key/button~state~change
  310. This type of input action contains the keycode of the key or button that
  311. changed state;
  312. whether the key or button is up or down,
  313. and the time delay between this input action and the previous input action.
  314. .LI pointer~motions
  315. This type of input action contains information about the motion of the
  316. pointer when the pointer has only moved a short distance.
  317. If the pointer has moved a long distance,
  318. the pointer jump input action is used.
  319. .LI pointer~jumps
  320. This type of input action contains information about the motion of the
  321. pointer when the pointer has moved a long distance.
  322. .LI delays
  323. This type of input action is used when the delay between input actions is too
  324. large to be held in the other input actions.
  325. .LE
  326. .P
  327. The
  328. .I XTestGetInput
  329. function will return -1 if there is an error, and 0 otherwise.
  330. .P
  331. An error code of \fIBadAccess\fR means that another client has already
  332. requested that user input actions be sent to it.
  333. .SK
  334. .H 3 XTestStopInput
  335. .DS
  336. int
  337. XTestStopInput(\fIdisplay\fR)
  338.         Display \(**\fIdisplay\fR;
  339. .DE
  340. .VL 9
  341. .LI \fIdisplay\fR
  342. Specifies the connection to the X server.
  343. .LE
  344. .P
  345. The
  346. .I XTestStopInput
  347. function tells the server to stop putting information about user input actions
  348. into events.
  349. The server will process user input actions normally (as it would
  350. if this extension were not in the server).
  351. .P
  352. The
  353. .I XTestStopInput
  354. function will return -1 if there is an error, and 0 otherwise.
  355. .P
  356. An error code of \fIBadAccess\fR means that a request was made to stop input
  357. when input has never been started.
  358. .SK
  359. .H 3 XTestFakeInput
  360. .DS
  361. int
  362. XTestFakeInput(\fIdisplay\fR, \fIaction_list_addr\fR, \fIaction_list_size\fR,
  363.            \fIack_flag\fR)
  364.         Display \(**\fIdisplay\fR;
  365.     char \(**\fIaction_list_addr\fR;
  366.         int \fIaction_list_size\fR;
  367.         int \fIack_flag\fR;
  368. .DE
  369. .VL 18
  370. .LI \fIdisplay\fR
  371. Specifies the connection to the X server.
  372. .LI \fIaction_list_addr\fR
  373. Specifies the address of an list of input actions to be sent to the server.
  374. .LI \fIaction_list_size\fR
  375. Specifies the size (in bytes) of the list of input actions.
  376. It may be no larger than \fIXTestMAX_ACTION_LIST_SIZE\fR bytes.
  377. .LI \fIack_flag\fR
  378. Specifies whether the server needs to send an event to indicate that its
  379. input action buffer is empty (one of
  380. \fIXTestFAKE_ACK_NOT_NEEDED\fR or \fIXTestFAKE_ACK_REQUEST\fR).
  381. .LE
  382. .P
  383. The
  384. .I XTestFakeInput
  385. function tells the server to take the specified user input actions and process
  386. them as if the user had physically performed them.  
  387. .P
  388. The server can only accept a limited number of input actions at one
  389. time.  This limit can be determined by the \fIXTestQueryInputSize\fR function
  390. in this extension.
  391. .P
  392. The client should set \fIack_flag\fR to \fIXTestFAKE_ACK_NOT_NEEDED\fR
  393. on calls to \fIXTestFakeInput\fR that do not reach this limit.
  394. .P
  395. The client should set \fIack_flag\fR to \fIXTestFAKE_ACK_REQUEST\fR
  396. on the call to \fIXTestFakeInput\fR that reaches this limit.
  397. .P
  398. When the server sees an \fIack_flag\fR value of \fIXTestFAKE_ACK_REQUEST\fR
  399. it finishes processing its input action buffer, then sends an event with
  400. type \fIXTestFakeAckType\fR to the client.
  401. When the client reads this event, it knows that it is safe to resume
  402. sending input actions to the server.
  403. .P
  404. Since the actual value of the event type may vary depending on how many
  405. extensions are included with an X11 implementation,
  406. \fIXTestFakeAckType\fR is a variable that is contained in the Xlib part of
  407. this extension.  It may be referenced as follows:
  408. .DS
  409. extern int XTestFakeAckType;
  410. .DE
  411. .P
  412. There are four types of input actions that are passed from the client
  413. to the server.  They are:
  414. .VL 25
  415. .LI key/button~state~change
  416. This type of input action contains the keycode of the key or button that
  417. is to change state;
  418. whether the key or button is to be up or down,
  419. and the time to delay before changing the state of the key or button.
  420. .LI pointer~motions
  421. This type of input action contains information about the motion of the
  422. pointer when the pointer is to be moved a short distance,
  423. and the time to delay before moving the pointer.
  424. If the pointer is to be moved a long distance,
  425. the pointer jump input action must be used.
  426. .LI pointer~jumps
  427. This type of input action contains information about the motion of the
  428. pointer when the pointer is to be moved a long distance,
  429. and the time to delay before moving the pointer.
  430. .LI delays
  431. This type of input action is used when the delay between input actions is too
  432. large to be held in the other input actions.
  433. .LE
  434. .P
  435. The
  436. .I XTestFakeInput
  437. function will return -1 if there is an error, and 0 otherwise.
  438. .P
  439. An error code of \fIBadAccess\fR means that another client has already
  440. sent user input actions to the server, and the server has not finished
  441. processing the user input actions.
  442. .SK
  443. .H 3 XTestQueryInputSize
  444. .DS
  445. int
  446. XTestQueryInputSize(\fIdisplay\fR, \fIsize_return\fR)
  447.         Display \(**\fIdisplay\fR;
  448.         unsigned long \(**\fIsize_return\fR;
  449. .DE
  450. .VL 13
  451. .LI \fIdisplay\fR
  452. Specifies the connection to the X server.
  453. .LI \fIsize_return\fR
  454. Returns the number of input actions that the server's input action buffer can
  455. hold.
  456. .LE
  457. .P
  458. The
  459. .I XTestQueryInputSize
  460. function asks the server to return the number of input actions that it can hold
  461. in its input action buffer in the unsigned long pointed to by \fIsize_return\fR.
  462. .P
  463. The
  464. .I XTestQueryInputSize
  465. function will return -1 if there is an error, and 0 otherwise.
  466. .SK
  467. .H 3 XTestReset
  468. .DS
  469. int
  470. XTestReset(\fIdisplay\fR)
  471.         Display \(**\fIdisplay\fR;
  472. .DE
  473. .VL 9
  474. .LI \fIdisplay\fR
  475. Specifies the connection to the X server.
  476. .LE
  477. .P
  478. The
  479. .I XTestReset
  480. function tells the server to set everything having to do with this extension
  481. back to its initial state.  After this call the server will act as if this
  482. extension were not installed until one of the extension functions is called by
  483. a client.  This function is not normally needed, but is included in case a
  484. client wishes to clean up the server state, such as after a serious error.
  485. .P
  486. The
  487. .I XTestReset
  488. function will return -1 if there is an error, and 0 otherwise.
  489. .SK
  490. .H 1 `xtestext1.h'~File~Listing
  491. .DS
  492. .so xtestext1.h
  493. .DE
  494. .TC 1 1 4
  495.