VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/XFree86-4.3/X11/extensions/xtrapdi.h@ 99743

Last change on this file since 99743 was 69098, checked in by vboxsync, 7 years ago

Clean up XFree86 driver header files.
bugref:3810: X11 Guest Additions maintenance
Over the years we have cleaned up the layout in the tree of the X.Org
header files we use to build drivers. The XFree86 ones were still in their
original, rather sub-optimal layout. This change fixes that.

  • Property svn:eol-style set to native
File size: 19.3 KB
Line 
1/* $XFree86: xc/include/extensions/xtrapdi.h,v 1.1 2001/11/02 23:29:26 dawes Exp $ */
2#ifndef __XTRAPDI__
3#define __XTRAPDI__
4
5/*****************************************************************************
6Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1994 by Digital Equipment Corp.,
7Maynard, MA
8
9Permission to use, copy, modify, and distribute this software and its
10documentation for any purpose and without fee is hereby granted,
11provided that the above copyright notice appear in all copies and that
12both that copyright notice and this permission notice appear in
13supporting documentation, and that the name of Digital not be
14used in advertising or publicity pertaining to distribution of the
15software without specific, written prior permission.
16
17DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
18ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
19DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
20ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
22ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
23SOFTWARE.
24
25*****************************************************************************/
26/*
27 *
28 * CONTRIBUTORS:
29 *
30 * Dick Annicchiarico
31 * Robert Chesler
32 * Dan Coutu
33 * Gene Durso
34 * Marc Evans
35 * Alan Jamison
36 * Mark Henry
37 * Ken Miller
38 *
39 * DESCRIPTION:
40 * This header file defines the common structures/constants
41 * between the XTrap extension and clients. All protocol
42 * definitions between XTrap extension/clients can be found
43 * here.
44 */
45
46#define NEED_REPLIES
47#define NEED_EVENTS
48#ifndef IN_MODULE
49#include <stdio.h>
50#endif
51#include <X11/X.h>
52#include <X11/Xmd.h>
53#ifdef SMT
54#define NEED_EVENTS
55#define NEED_REPLIES
56#endif
57#include <X11/Xproto.h>
58#include <X11/extensions/xtrapbits.h>
59#define XTrapExtName "DEC-XTRAP"
60/* Current Release, Version, and Revision of the XTrap Extension */
61#define XETrapRelease 3L
62#define XETrapVersion 4L
63#ifndef XETrapRevision /* Changed from the Makefile by users */
64# define XETrapRevision 0L
65#endif /* XETrapRevision */
66#define XETrapProtocol 32L
67
68#ifndef SIZEOF
69# ifdef __STDC__
70# define SIZEOF(x) sz_##x
71# else
72# define SIZEOF(x) sz_/**/x
73# endif /* if ANSI C compiler else not */
74#endif
75#ifndef sz_CARD32
76#define sz_CARD32 4L
77#endif
78#ifndef sz_CARD8
79#define sz_CARD8 1L
80#endif
81#ifndef True
82# define True 1L
83# define False 0L
84#endif
85
86typedef int (*int_function)();
87typedef void (*void_function)();
88
89/* This is used as flags to indicate desired request traps
90 * Note: This has been padded to a CARD32 to keep structure aligned
91 */
92#define XETrapMaxRequest (((SIZEOF(CARD32)+((256L-1L) / \
93 (BitsInByte*SIZEOF(CARD8))))/SIZEOF(CARD32))*SIZEOF(CARD32))
94typedef CARD8 ReqFlags[XETrapMaxRequest];
95
96/* This is used as flags to indicate desired event traps
97 * Until events become *fully vectored*, we'll have to fake it
98 * by defining an array of 5 events (KeyPress, KeyRelease,
99 * ButtonPress, ButtonRelease, and MotionNotify. The extra 2
100 * are required as the event types start with "2" (errors and
101 * replies are 0 & 1). The event type is the index into the
102 * bits.
103 * Note: This has been padded to a longword to keep structure aligned
104 */
105#ifndef VECTORED_EVENTS
106#define XETrapCoreEvents (2L+5L)
107#else
108#define XETrapCoreEvents 128L
109#endif
110#define XETrapMaxEvent (((SIZEOF(CARD32)+((XETrapCoreEvents-1L) / \
111 (BitsInByte*SIZEOF(CARD8))))/SIZEOF(CARD32))*SIZEOF(CARD32))
112typedef CARD8 EventFlags[XETrapMaxEvent];
113
114/* This structure is used in a request to specify the types of
115 * configuration information that should be changed or updated.
116 */
117typedef struct
118{
119 CARD8 valid[4L]; /* Bits TRUE indicates data field is used */
120 CARD8 data[4L]; /* Bits looked at if corresponding valid bit set */
121 ReqFlags req; /* Bits coorespond to core requests */
122 EventFlags event; /* Bits correspond to core events */
123} XETrapFlags;
124
125/* Bit definitions for the above XETrapFlags structure. */
126#define XETrapTimestamp 0L /* hdr timestamps desired */
127#define XETrapCmd 1L /* command key specified */
128#define XETrapCmdKeyMod 2L /* cmd key is a modifier */
129#define XETrapRequest 3L /* output requests array */
130#define XETrapEvent 4L /* future output events array */
131#define XETrapMaxPacket 5L /* Maximum packet length set */
132#define XETrapTransOut 6L /* obsolete */
133#define XETrapStatistics 7L /* collect counts on requests */
134#define XETrapWinXY 8L /* Fill in Window (X,Y) in hdr */
135#define XETrapTransIn 9L /* obsolete */
136#define XETrapCursor 10L /* Trap cursor state changes */
137#define XETrapXInput 11L /* Use XInput extension */
138#define XETrapVectorEvents 12L /* Use Vectored Events (128) */
139#define XETrapColorReplies 13L /* Return replies with Color Req's */
140#define XETrapGrabServer 14L /* Disables client GrabServers */
141
142typedef struct /* used by XEConfigRequest */
143{
144 XETrapFlags flags; /* Flags to specify what should be chg'd */
145 CARD16 max_pkt_size B16; /* Maximum number of bytes in a packet */
146 CARD8 cmd_key; /* Keyboard command_key (KeyCode) */
147/*
148 * cmd_key is intentionally *not* defined KeyCode since it's definition is
149 * ambiguous (int in Intrinsic.h and unsigned char in X.h.
150 */
151 CARD8 pad[1L]; /* pad out to a quadword */
152} XETrapCfg;
153
154/* These structures are used within the Xtrap request structure for
155 * the various types of xtrap request
156 */
157#ifndef _XINPUT
158/* (see the definition of XEvent as a reference) */
159typedef struct /* used by XESimulateXEventRequest for synthesizing core evts */
160{
161 CARD8 type; /* (must be first) as in XEvent */
162 CARD8 detail; /* Detail keycode/button as in XEvent */
163 CARD8 screen; /* screen number (0 to n) */
164 CARD8 pad; /* pad to longword */
165 INT16 x B16; /* X & Y coord as in XEvent */
166 INT16 y B16;
167} XETrapInputReq;
168#endif
169
170/* These are constants that refer to the extension request vector table.
171 * A request will use these values as minor opcodes.
172 */
173#define XETrap_Reset 0L /* set to steady state */
174#define XETrap_GetAvailable 1L /* get available funct from ext */
175#define XETrap_Config 2L /* configure extension */
176#define XETrap_StartTrap 3L /* use Trapping */
177#define XETrap_StopTrap 4L /* stop using Trapping */
178#define XETrap_GetCurrent 5L /* get current info from ext */
179#define XETrap_GetStatistics 6L /* get count statistics from ext */
180#ifndef _XINPUT
181#define XETrap_SimulateXEvent 7L /* async input simulation */
182#endif
183#define XETrap_GetVersion 8L /* Get (Just) Version */
184#define XETrap_GetLastInpTime 9L /* Get Timestamp of last client input */
185
186/* The following are formats of a request to the XTRAP
187 * extension. The data-less XTrap requests all use xXTrapReq
188 */
189typedef struct
190{
191 CARD8 reqType;
192 CARD8 minor_opcode;
193 CARD16 length B16;
194 CARD32 pad B32; /* Maintain quadword alignment */
195} xXTrapReq;
196/* the following works because all fields are defined as bit (Bnn) fields */
197#define sz_xXTrapReq (sizeof(xXTrapReq))
198/* For retrieving version/available info (passes lib-side protocol number) */
199typedef struct
200{
201 CARD8 reqType;
202 CARD8 minor_opcode;
203 CARD16 length B16;
204 CARD16 protocol B16; /* The xtrap extension protocol number */
205 CARD16 pad B16; /* Maintain quadword alignment */
206} xXTrapGetReq;
207/* the following works because all fields are defined as bit (Bnn) fields */
208#define sz_xXTrapGetReq (sizeof(xXTrapGetReq))
209
210typedef struct
211{
212 CARD8 reqType;
213 CARD8 minor_opcode;
214 CARD16 length B16;
215 /*
216 * The follwing is done so that structure padding wont be
217 * a problem. The request structure contains a shadow for
218 * the XETrapCfg structure. Since the XETrapCfg also has a
219 * substructure (XETrapFlags) this structure is also shadowed.
220 *
221 * The following are a shadow of the XETrapFlags
222 * structure.
223 */
224 CARD8 config_flags_valid[4L];
225 CARD8 config_flags_data[4L];
226 ReqFlags config_flags_req;
227 EventFlags config_flags_event;
228 /* End Shadow (XETrapFlags)*/
229 CARD16 config_max_pkt_size B16; /* Max number of bytes in a packet */
230 CARD8 config_cmd_key; /* Keyboard command_key (KeyCode) */
231/*
232 * cmd_key is intentionally *not* defined KeyCode since it's definition is
233 * ambiguous (int in Intrinsic.h and unsigned char in X.h.
234 */
235 CARD8 config_pad[1L]; /* pad out to a quadword */
236 /* End Shadow (XETrapCfg) */
237 CARD32 pad B32; /* Maintain quadword alignment */
238} xXTrapConfigReq;
239/* the following works because all fields are defined as bit (Bnn) fields */
240#define sz_xXTrapConfigReq (sizeof(xXTrapConfigReq))
241
242#ifndef _XINPUT
243typedef struct
244{
245 CARD8 reqType;
246 CARD8 minor_opcode;
247 CARD16 length B16;
248 CARD32 pad B32; /* Maintain quadword alignment */
249 XETrapInputReq input;
250} xXTrapInputReq;
251/* the following works because all fields are defined as bit (Bnn) fields */
252#define sz_xXTrapInputReq (sizeof(xXTrapInputReq))
253#endif
254
255
256/* The following structures are used by the server extension to send
257 * information and replies to the client.
258 */
259
260/* header for all X replies */
261typedef struct
262{
263 CARD8 type;
264 CARD8 detail;
265 CARD16 sequenceNumber B16;
266 CARD32 length B32;
267} XETrapRepHdr;
268
269/* Structure of Get Available Functionality reply */
270typedef struct
271{
272 CARD32 pf_ident B32; /* Contains constant identifying the platform */
273 CARD16 xtrap_release B16; /* The xtrap extension release number */
274 CARD16 xtrap_version B16; /* The xtrap extension version number */
275 CARD16 xtrap_revision B16; /* The xtrap extension revision number */
276 CARD16 max_pkt_size B16; /* Maximum number of bytes in a packet */
277 CARD8 valid[4]; /* What specific configuration flags are valid */
278 CARD32 major_opcode B32; /* The major opcode identifying xtrap */
279 CARD32 event_base B32; /* The event value we start at */
280 CARD32 pad0 B32; /* obsolete field */
281 CARD16 pad1 B16, pad2 B16, pad3 B16; /* obsolete field */
282 CARD16 xtrap_protocol B16; /* The xtrap extension protocol number */
283 INT16 cur_x B16; /* Current X & Y coord for relative motion */
284 INT16 cur_y B16;
285} XETrapGetAvailRep;
286
287typedef struct
288{
289 CARD16 xtrap_release B16; /* The xtrap extension release number */
290 CARD16 xtrap_version B16; /* The xtrap extension version number */
291 CARD16 xtrap_revision B16; /* The xtrap extension revision number */
292 CARD16 xtrap_protocol B16; /* The xtrap extension protocol number */
293} XETrapGetVersRep;
294
295typedef struct
296{
297 CARD32 last_time B32; /* Timestamp of last input time */
298} XETrapGetLastInpTimeRep;
299
300/* Structure of Get Current Configuration Information reply */
301typedef struct
302{
303 CARD8 state_flags[2]; /* Miscelaneous flags, see below #define's */
304 CARD16 pad0 B16; /* Assure quadword alignment */
305 XETrapCfg config; /* Current Config information */
306 CARD32 pad1 B32;
307} XETrapGetCurRep;
308
309/* Mask definitions for the above flags. */
310#define XETrapTrapActive 0L /* If sending/receiving between client/ext */
311
312/* Structure of Get Statistics Information reply */
313typedef struct
314{
315 CARD32 requests[256L]; /* Array containing request counts if trapped */
316 CARD32 events[XETrapCoreEvents]; /* Array containing event stats */
317#ifndef VECTORED_EVENTS
318 CARD32 pad B32; /* Pad out to a quadword */
319#endif
320} XETrapGetStatsRep;
321
322#define PF_Other 0L /* server not one of the below */
323#define PF_Apollo 10L /* server on Apollo system */
324#define PF_ATT 20L /* server on AT&T system */
325#define PF_Cray1 30L /* server on Cray 1 system */
326#define PF_Cray2 31L /* server on Cray 2 system */
327#define PF_DECUltrix 40L /* server on DEC ULTRIX system */
328#define PF_DECVMS 41L /* server on DEC VMS system */
329#define PF_DECVT1000 42L /* server on DEC-VT1000-terminal */
330#define PF_DECXTerm 43L /* server on DEC-X-terminal */
331#define PF_DECELN 44L /* server on DEC VAXELN X terminal */
332#define PF_DECOSF1 45L /* server on DEC's OSF/1 system */
333#define PF_HP9000s800 50L /* server on HP 9000/800 system */
334#define PF_HP9000s300 51L /* server on HP 9000/300 system */
335#define PF_IBMAT 60L /* server on IBM/AT system */
336#define PF_IBMRT 61L /* server on IBM/RT system */
337#define PF_IBMPS2 62L /* server on IBM/PS2 system */
338#define PF_IBMRS 63L /* server on IBM/RS system */
339#define PF_MacII 70L /* server on Mac II system */
340#define PF_Pegasus 80L /* server on Tektronix Pegasus system */
341#define PF_SGI 90L /* server on Silicon Graphcis system */
342#define PF_Sony 100L /* server on Sony system */
343#define PF_Sun3 110L /* server on Sun 3 system */
344#define PF_Sun386i 111L /* server on Sun 386i system */
345#define PF_SunSparc 112L /* server on Sun Sparc system */
346
347/* reply sent back by XETrapGetAvailable request */
348typedef struct
349{
350 XETrapRepHdr hdr;
351 XETrapGetAvailRep data;
352} xXTrapGetAvailReply;
353/* the following works because all fields are defined as bit (Bnn) fields */
354#define sz_xXTrapGetAvailReply sizeof(xXTrapGetAvailReply)
355
356/* reply sent back by XETrapGetVersion request */
357typedef struct
358{
359 XETrapRepHdr hdr;
360 XETrapGetVersRep data;
361 CARD32 pad0 B32; /* pad out to 32 bytes */
362 CARD32 pad1 B32;
363 CARD32 pad2 B32;
364 CARD32 pad3 B32;
365} xXTrapGetVersReply;
366/* the following works because all fields are defined as bit (Bnn) fields */
367#define sz_xXTrapGetVersReply sizeof(xXTrapGetVersReply)
368
369/* reply sent back by XETrapGetLastInpTime request */
370typedef struct
371{
372 XETrapRepHdr hdr;
373 /*
374 * The following is a shadow of the XETrapGetLastInpTimeRep
375 * structure. This is done to avoid structure padding.
376 */
377 CARD32 data_last_time B32; /* Timestamp of last input time */
378 CARD32 pad0 B32; /* pad out to 32 bytes */
379 CARD32 pad1 B32;
380 CARD32 pad2 B32;
381 CARD32 pad3 B32;
382 CARD32 pad4 B32;
383} xXTrapGetLITimReply;
384/* the following works because all fields are defined as bit (Bnn) fields */
385#define sz_xXTrapGetLITimReply sizeof(xXTrapGetLITimReply)
386
387/* reply sent back by XETrapGetCurrent request */
388typedef struct
389{
390 XETrapRepHdr hdr;
391 /*
392 * The following is a shadow of the XETrapGetCurRep
393 * structure. This is done to avoid structure padding.
394 * Since the XETrapGetCurRep structure contains a sub-structure
395 * (XETrapCfg) there is a shadow for that as well.*/
396 CARD8 data_state_flags[2]; /* Misc flags, see below #define's */
397 CARD16 data_pad0 B16; /* Assure quadword alignment */
398 /* XETrapCfg Shadow Starts */
399 CARD8 data_config_flags_valid[4L];
400 CARD8 data_config_flags_data[4L];
401 ReqFlags data_config_flags_req;
402 EventFlags data_config_flags_event;
403 CARD16 data_config_max_pkt_size B16; /* Max num of bytes in a pkt */
404 CARD8 data_config_cmd_key; /* Keyboard cmd_key (KeyCode) */
405/*
406 * cmd_key is intentionally *not* defined KeyCode since it's definition is
407 * ambiguous (int in Intrinsic.h and unsigned char in X.h.
408 */
409 CARD8 data_config_pad[1L]; /* pad out to a quadword */
410 /* End Shadow (XETrapCfg) */
411 CARD32 pad1 B32;
412} xXTrapGetCurReply;
413/* the following works because all fields are defined as bit (Bnn) fields */
414#define sz_xXTrapGetCurReply sizeof(xXTrapGetCurReply)
415
416/* reply sent back by XETrapGetStatistics request */
417/* Note:
418 * The following does *not* use the standard XETrapRepHdr, but instead
419 * one which is padded out to 32-bytes. This is because Cray's have a problem
420 * reading arrays of CARD32s without using the _Read32 macro (see XERqsts.c).
421 * This requires that none of the data be in the _Reply area.
422 */
423typedef struct
424{
425 CARD8 type;
426 CARD8 detail;
427 CARD16 sequenceNumber B16;
428 CARD32 length B32;
429 CARD32 pad0 B32;
430 CARD32 pad1 B32;
431 CARD32 pad2 B32;
432 CARD32 pad3 B32;
433 CARD32 pad4 B32;
434 CARD32 pad5 B32;
435 XETrapGetStatsRep data;
436} xXTrapGetStatsReply;
437#define sz_xXTrapGetStatsReply 1088
438
439typedef struct /* the XTrap Output header (for output from ext to client) */
440{ /* this must be quadword aligned for portability */
441 CARD32 count B32; /* Length including this header */
442 CARD32 timestamp B32; /* timestamp if desired */
443 CARD8 type; /* event id, request id, special id */
444 CARD8 screen; /* screen number (0 to n) */
445 INT16 win_x B16; /* X coord of drawable, if any */
446 INT16 win_y B16; /* X coord of drawable, if any */
447 CARD16 client B16; /* to distinguish requests */
448} XETrapHeader;
449/* the following works because all fields are defined as bit (Bnn) fields */
450#define sz_XETrapHeader sizeof(XETrapHeader)
451
452#define XETrapHeaderIsEvent(phdr) (XETrapGetHeaderType(phdr) == 0x1L)
453#define XETrapHeaderIsRequest(phdr) (XETrapGetHeaderType(phdr) == 0x2L)
454#define XETrapHeaderIsSpecial(phdr) (XETrapGetHeaderType(phdr) == 0x3L)
455#define XETrapHeaderIsCursor(phdr) (XETrapGetHeaderType(phdr) == 0x4L)
456#define XETrapHeaderIsReply(phdr) (XETrapGetHeaderType(phdr) == 0x5L)
457
458/* Define a structure used for reading/writing datum of type XTrap */
459typedef struct
460{
461 XETrapHeader hdr;
462 union
463 {
464 xEvent event;
465 xResourceReq req;
466 xGenericReply reply;
467 /* special? */
468 } u;
469} XETrapDatum;
470
471/* this doesn't get picked up for VMS server builds (different Xproto.h) */
472#ifndef sz_xEvent
473#define sz_xEvent 32
474#endif
475/* Minimum size of a packet from the server extension */
476#define XETrapMinPktSize (SIZEOF(XETrapHeader) + SIZEOF(xEvent))
477
478/* Constants used with the XLIB transport */
479#define XETrapDataStart 0L /* Used in the detail field */
480#define XETrapDataContinued 1L /* Used in the detail field */
481#define XETrapDataLast 2L /* Used in the detail field */
482#define XETrapData 0L /* Used in the type field */
483#define XETrapNumberEvents 1L
484/* This is the representation on the wire(see also XLib.h) */
485#define sz_EventData 24L /* 32 bytes - type, detail, seq, index */
486typedef struct {
487 CARD8 type;
488 CARD8 detail;
489 CARD16 sequenceNumber B16;
490 CARD32 idx B32;
491 CARD8 data[sz_EventData];
492} xETrapDataEvent;
493
494/* Error message indexes added to X for extension */
495#define BadIO 2L /* Can't read/write */
496#define BadStatistics 4L /* Stat's not avail. */
497#define BadDevices 5L /* Devices not vectored */
498#define BadScreen 7L /* Can't send event to given screen */
499#define BadSwapReq 8L /* Can't send swapped extension requests */
500#define XETrapNumErrors (BadSwapReq + 1)
501
502
503#define XEKeyIsClear 0
504#define XEKeyIsEcho 1
505#define XEKeyIsOther 2
506
507#endif /* __XTRAPDI__ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette