4 * X11 Input Synthesis Extension include file
10 Copyright (c) 1986, 1987, 1988 X Consortium
12 Permission is hereby granted, free of charge, to any person obtaining a copy
13 of this software and associated documentation files (the "Software"), to deal
14 in the Software without restriction, including without limitation the rights
15 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16 copies of the Software, and to permit persons to whom the Software is
17 furnished to do so, subject to the following conditions:
19 The above copyright notice and this permission notice shall be included in
20 all copies or substantial portions of the Software.
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
27 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 Except as contained in this notice, the name of the X Consortium shall not be
30 used in advertising or otherwise to promote the sale, use or other dealings
31 in this Software without prior written authorization from the X Consortium.
34 Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
36 Permission to use, copy, modify, and distribute this
37 software and its documentation for any purpose and without
38 fee is hereby granted, provided that the above copyright
39 notice appear in all copies and that both that copyright
40 notice and this permission notice appear in supporting
41 documentation, and that the name of Hewlett-Packard not be used in
42 advertising or publicity pertaining to distribution of the
43 software without specific, written prior permission.
45 Hewlett-Packard makes no representations about the
46 suitability of this software for any purpose. It is provided
47 "as is" without express or implied warranty.
49 This software is not subject to any license of the American
50 Telephone and Telegraph Company or of the Regents of the
51 University of California.
56 * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h
60 * used in the XTestPressButton and XTestPressKey functions
62 #define XTestPRESS 1 << 0
63 #define XTestRELEASE 1 << 1
64 #define XTestSTROKE 1 << 2
67 * When doing a key or button stroke, the number of milliseconds
68 * to delay between the press and the release of a key or button
69 * in the XTestPressButton and XTestPressKey functions.
72 #define XTestSTROKE_DELAY_TIME 10
75 * used in the XTestGetInput function
77 #define XTestEXCLUSIVE 1 << 0
78 #define XTestPACKED_ACTIONS 1 << 1
79 #define XTestPACKED_MOTION 1 << 2
82 * used in the XTestFakeInput function
84 #define XTestFAKE_ACK_NOT_NEEDED 0
85 #define XTestFAKE_ACK_REQUEST 1
88 * used in the XTest extension initialization routine
90 #define XTestEXTENSION_NAME "XTestExtension1"
91 #define XTestEVENT_COUNT 2
94 * XTest request type values
96 * used in the XTest extension protocol requests
98 #define X_TestFakeInput 1
99 #define X_TestGetInput 2
100 #define X_TestStopInput 3
101 #define X_TestReset 4
102 #define X_TestQueryInputSize 5
105 * This defines the maximum size of a list of input actions
106 * to be sent to the server. It should always be a multiple of
107 * 4 so that the entire xTestFakeInputReq structure size is a
110 #define XTestMAX_ACTION_LIST_SIZE 64
113 CARD8 reqType; /* always XTestReqCode */
114 CARD8 XTestReqType; /* always X_TestFakeInput */
115 CARD16 length B16; /* 2 + XTestMAX_ACTION_LIST_SIZE/4 */
117 CARD8 action_list[XTestMAX_ACTION_LIST_SIZE];
119 #define sz_xTestFakeInputReq (XTestMAX_ACTION_LIST_SIZE + 8)
122 CARD8 reqType; /* always XTestReqCode */
123 CARD8 XTestReqType; /* always X_TestGetInput */
124 CARD16 length B16; /* 2 */
127 #define sz_xTestGetInputReq 8
130 CARD8 reqType; /* always XTestReqCode */
131 CARD8 XTestReqType; /* always X_TestStopInput */
132 CARD16 length B32; /* 1 */
134 #define sz_xTestStopInputReq 4
137 CARD8 reqType; /* always XTestReqCode */
138 CARD8 XTestReqType; /* always X_TestReset */
139 CARD16 length B16; /* 1 */
141 #define sz_xTestResetReq 4
144 CARD8 reqType; /* always XTestReqCode */
145 CARD8 XTestReqType; /* always X_TestQueryInputSize */
146 CARD16 length B16; /* 1 */
147 } xTestQueryInputSizeReq;
148 #define sz_xTestQueryInputSizeReq 4
151 * This is the definition of the reply for the xTestQueryInputSize
152 * request. It should remain the same minimum size as other replies
156 CARD8 type; /* always X_Reply */
158 CARD16 sequenceNumber B16;
159 CARD32 length B32; /* always 0 */
160 CARD32 size_return B32;
166 } xTestQueryInputSizeReply;
169 * This is the definition for the input action wire event structure.
170 * This event is sent to the client when the server has one or
171 * more user input actions to report to the client. It must
172 * remain the same size as all other wire events (32 bytes).
174 #define XTestACTIONS_SIZE 28
177 CARD8 type; /* always XTestInputActionType */
179 CARD16 sequenceNumber B16;
180 CARD8 actions[XTestACTIONS_SIZE];
181 } xTestInputActionEvent;
184 * This is the definition for the xTestFakeAck wire event structure.
185 * This event is sent to the client when the server has completely
186 * processed its input action buffer, and is ready for more.
187 * It must remain the same size as all other wire events (32 bytes).
190 CARD8 type; /* always XTestFakeAckType */
192 CARD16 sequenceNumber B16;
203 * The server side of this extension does not (and should not) have
204 * definitions for Display and Window. The ifndef allows the server
205 * side of the extension to ignore the following typedefs.
207 #ifndef XTestSERVER_SIDE
209 * This is the definition for the input action host format event structure.
210 * This is the form that a client using this extension will see when
211 * it receives an input action event.
214 int type; /* always XTestInputActionType */
217 CARD8 actions[XTestACTIONS_SIZE];
218 } XTestInputActionEvent;
221 * This is the definition for the xTestFakeAck host format event structure.
222 * This is the form that a client using this extension will see when
223 * it receives an XTestFakeAck event.
226 int type; /* always XTestFakeAckType */
233 * This is the definition for the format of the header byte
234 * in the input action structures.
236 #define XTestACTION_TYPE_MASK 0x03 /* bits 0 and 1 */
237 #define XTestKEY_STATE_MASK 0x04 /* bit 2 (key action) */
238 #define XTestX_SIGN_BIT_MASK 0x04 /* bit 2 (motion action) */
239 #define XTestY_SIGN_BIT_MASK 0x08 /* bit 3 (motion action) */
240 #define XTestDEVICE_ID_MASK 0xf0 /* bits 4 through 7 */
242 #define XTestMAX_DEVICE_ID 0x0f
243 #define XTestPackDeviceID(x) (((x) & XTestMAX_DEVICE_ID) << 4)
244 #define XTestUnpackDeviceID(x) (((x) & XTestDEVICE_ID_MASK) >> 4)
247 * These are the possible action types.
249 #define XTestDELAY_ACTION 0
250 #define XTestKEY_ACTION 1
251 #define XTestMOTION_ACTION 2
252 #define XTestJUMP_ACTION 3
255 * These are the definitions for key/button motion input actions.
257 #define XTestKEY_UP 0x04
258 #define XTestKEY_DOWN 0x00
261 CARD8 header; /* which device, key up/down */
262 CARD8 keycode; /* which key/button to move */
263 CARD16 delay_time B16; /* how long to delay (in ms) */
267 * This is the definition for pointer jump input actions.
270 CARD8 header; /* which pointer */
271 CARD8 pad1; /* unused padding byte */
272 CARD16 jumpx B16; /* x coord to jump to */
273 CARD16 jumpy B16; /* y coord to jump to */
274 CARD16 delay_time B16; /* how long to delay (in ms) */
278 * These are the definitions for pointer relative motion input
281 * The sign bits for the x and y relative motions are contained
282 * in the header byte. The x and y relative motions are packed
283 * into one byte to make things fit in 32 bits. If the relative
284 * motion range is larger than +/-15, use the pointer jump action.
286 #define XTestMOTION_MAX 15
287 #define XTestMOTION_MIN -15
289 #define XTestX_NEGATIVE 0x04
290 #define XTestY_NEGATIVE 0x08
292 #define XTestX_MOTION_MASK 0x0f
293 #define XTestY_MOTION_MASK 0xf0
295 #define XTestPackXMotionValue(x) ((x) & XTestX_MOTION_MASK)
296 #define XTestPackYMotionValue(x) (((x) << 4) & XTestY_MOTION_MASK)
298 #define XTestUnpackXMotionValue(x) ((x) & XTestX_MOTION_MASK)
299 #define XTestUnpackYMotionValue(x) (((x) & XTestY_MOTION_MASK) >> 4)
302 CARD8 header; /* which pointer */
303 CARD8 motion_data; /* x,y relative motion */
304 CARD16 delay_time B16; /* how long to delay (in ms) */
308 * These are the definitions for a long delay input action. It is
309 * used when more than XTestSHORT_DELAY_TIME milliseconds of delay
310 * (approximately one minute) is needed.
312 * The device ID for a delay is always set to XTestDELAY_DEVICE_ID.
313 * This guarantees that a header byte with a value of 0 is not
314 * a valid header, so it can be used as a flag to indicate that
315 * there are no more input actions in an XTestInputAction event.
318 #define XTestSHORT_DELAY_TIME 0xffff
319 #define XTestDELAY_DEVICE_ID 0x0f
322 CARD8 header; /* always XTestDELAY_DEVICE_ID */
323 CARD8 pad1; /* unused padding byte */
324 CARD16 pad2 B16; /* unused padding word */
325 CARD32 delay_time B32; /* how long to delay (in ms) */