]> git.sesse.net Git - rdpsrv/blob - Xserver/include/extensions/xtestext1.h
Support RDP5 logon packets.
[rdpsrv] / Xserver / include / extensions / xtestext1.h
1 /*
2  * xtestext1.h
3  *
4  * X11 Input Synthesis Extension include file
5  */
6
7 /*
8
9
10 Copyright (c) 1986, 1987, 1988   X Consortium
11
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:
18
19 The above copyright notice and this permission notice shall be included in
20 all copies or substantial portions of the Software.
21
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.
28
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.
32
33
34 Copyright 1986, 1987, 1988 by Hewlett-Packard Corporation
35
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.
44
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.
48
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.
52
53 */
54
55 /*
56  * the typedefs for CARD8, CARD16, and CARD32 are defined in Xmd.h
57  */
58
59 /*
60  * used in the XTestPressButton and XTestPressKey functions
61  */
62 #define XTestPRESS                      1 << 0
63 #define XTestRELEASE                    1 << 1
64 #define XTestSTROKE                     1 << 2
65
66 /*
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.
70  */
71
72 #define XTestSTROKE_DELAY_TIME          10
73
74 /*
75  * used in the XTestGetInput function
76  */
77 #define XTestEXCLUSIVE                  1 << 0
78 #define XTestPACKED_ACTIONS             1 << 1
79 #define XTestPACKED_MOTION              1 << 2
80
81 /*
82  * used in the XTestFakeInput function
83  */
84 #define XTestFAKE_ACK_NOT_NEEDED        0
85 #define XTestFAKE_ACK_REQUEST           1
86
87 /*
88  * used in the XTest extension initialization routine
89  */
90 #define XTestEXTENSION_NAME             "XTestExtension1"
91 #define XTestEVENT_COUNT                2
92
93 /*
94  * XTest request type values 
95  *
96  * used in the XTest extension protocol requests
97  */
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
103
104 /*
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
108  * multiple of 4.
109  */
110 #define XTestMAX_ACTION_LIST_SIZE       64
111
112 typedef struct {
113         CARD8   reqType;        /* always XTestReqCode             */
114         CARD8   XTestReqType;   /* always X_TestFakeInput           */
115         CARD16  length B16;     /* 2 + XTestMAX_ACTION_LIST_SIZE/4 */
116         CARD32  ack B32;
117         CARD8   action_list[XTestMAX_ACTION_LIST_SIZE];
118 } xTestFakeInputReq;
119 #define sz_xTestFakeInputReq (XTestMAX_ACTION_LIST_SIZE + 8)
120
121 typedef struct {
122         CARD8   reqType;        /* always XTestReqCode  */
123         CARD8   XTestReqType;   /* always X_TestGetInput */
124         CARD16  length B16;     /* 2                    */
125         CARD32  mode B32;
126 } xTestGetInputReq;
127 #define sz_xTestGetInputReq 8
128
129 typedef struct {
130         CARD8   reqType;        /* always XTestReqCode   */
131         CARD8   XTestReqType;   /* always X_TestStopInput */
132         CARD16  length B32;     /* 1                     */
133 } xTestStopInputReq;
134 #define sz_xTestStopInputReq 4
135
136 typedef struct {
137         CARD8   reqType;        /* always XTestReqCode */
138         CARD8   XTestReqType;   /* always X_TestReset   */
139         CARD16  length B16;     /* 1                   */
140 } xTestResetReq;
141 #define sz_xTestResetReq 4
142
143 typedef struct {
144         CARD8   reqType;        /* always XTestReqCode        */
145         CARD8   XTestReqType;   /* always X_TestQueryInputSize */
146         CARD16  length B16;     /* 1                          */
147 } xTestQueryInputSizeReq;
148 #define sz_xTestQueryInputSizeReq 4
149
150 /*
151  * This is the definition of the reply for the xTestQueryInputSize
152  * request.  It should remain the same minimum size as other replies
153  * (32 bytes).
154  */
155 typedef struct {
156         CARD8   type;           /* always X_Reply  */
157         CARD8   pad1;
158         CARD16  sequenceNumber B16;
159         CARD32  length B32;     /* always 0 */
160         CARD32  size_return B32;
161         CARD32  pad2 B32;
162         CARD32  pad3 B32;
163         CARD32  pad4 B32;
164         CARD32  pad5 B32;
165         CARD32  pad6 B32;
166 } xTestQueryInputSizeReply;
167
168 /*
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).
173  */
174 #define XTestACTIONS_SIZE       28
175
176 typedef struct {
177         CARD8   type;           /* always XTestInputActionType */
178         CARD8   pad00;
179         CARD16  sequenceNumber B16;
180         CARD8   actions[XTestACTIONS_SIZE];
181 } xTestInputActionEvent;
182
183 /*
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).
188  */
189 typedef struct {
190         CARD8   type;           /* always XTestFakeAckType */
191         CARD8   pad00;
192         CARD16  sequenceNumber B16;
193         CARD32  pad02 B32;
194         CARD32  pad03 B32;
195         CARD32  pad04 B32;
196         CARD32  pad05 B32;
197         CARD32  pad06 B32;
198         CARD32  pad07 B32;
199         CARD32  pad08 B32;
200 } xTestFakeAckEvent;
201
202 /*
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.
206  */
207 #ifndef XTestSERVER_SIDE
208 /*
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.
212  */
213 typedef struct {
214         int     type;           /* always XTestInputActionType */
215         Display *display;
216         Window  window;
217         CARD8   actions[XTestACTIONS_SIZE];
218 } XTestInputActionEvent;
219
220 /*
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.
224  */
225 typedef struct {
226         int     type;           /* always XTestFakeAckType */
227         Display *display;
228         Window  window;
229 } XTestFakeAckEvent;
230 #endif
231
232 /*
233  * This is the definition for the format of the header byte
234  * in the input action structures.
235  */
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      */
241
242 #define XTestMAX_DEVICE_ID      0x0f
243 #define XTestPackDeviceID(x)    (((x) & XTestMAX_DEVICE_ID) << 4)
244 #define XTestUnpackDeviceID(x)  (((x) & XTestDEVICE_ID_MASK) >> 4)
245
246 /*
247  * These are the possible action types.
248  */
249 #define XTestDELAY_ACTION       0
250 #define XTestKEY_ACTION         1
251 #define XTestMOTION_ACTION      2
252 #define XTestJUMP_ACTION        3
253
254 /*
255  * These are the definitions for key/button motion input actions.
256  */
257 #define XTestKEY_UP             0x04
258 #define XTestKEY_DOWN           0x00
259
260 typedef struct {
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) */
264 } XTestKeyInfo;
265
266 /*
267  * This is the definition for pointer jump input actions.
268  */
269 typedef struct {
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) */
275 } XTestJumpInfo;
276
277 /*
278  * These are the definitions for pointer relative motion input
279  * actions.
280  *
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.
285  */
286 #define XTestMOTION_MAX            15
287 #define XTestMOTION_MIN            -15
288
289 #define XTestX_NEGATIVE            0x04
290 #define XTestY_NEGATIVE            0x08
291
292 #define XTestX_MOTION_MASK         0x0f
293 #define XTestY_MOTION_MASK         0xf0
294
295 #define XTestPackXMotionValue(x)   ((x) & XTestX_MOTION_MASK)
296 #define XTestPackYMotionValue(x)   (((x) << 4) & XTestY_MOTION_MASK)
297
298 #define XTestUnpackXMotionValue(x) ((x) & XTestX_MOTION_MASK)
299 #define XTestUnpackYMotionValue(x) (((x) & XTestY_MOTION_MASK) >> 4)
300
301 typedef struct {
302         CARD8   header;         /* which pointer             */
303         CARD8   motion_data;    /* x,y relative motion       */
304         CARD16  delay_time B16; /* how long to delay (in ms) */
305 } XTestMotionInfo;
306
307 /*
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.
311  *
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.
316  */
317
318 #define XTestSHORT_DELAY_TIME   0xffff
319 #define XTestDELAY_DEVICE_ID    0x0f   
320
321 typedef struct {
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)   */
326 } XTestDelayInfo;