1/*
2 *	$Xorg: Xproto.h,v 1.4 2001/02/09 02:03:23 xorgcvs Exp $
3 */
4
5/* Definitions for the X window system used by server and c bindings */
6
7/*
8 * This packet-construction scheme makes the following assumptions:
9 *
10 * 1. The compiler is able
11 * to generate code which addresses one- and two-byte quantities.
12 * In the worst case, this would be done with bit-fields.  If bit-fields
13 * are used it may be necessary to reorder the request fields in this file,
14 * depending on the order in which the machine assigns bit fields to
15 * machine words.  There may also be a problem with sign extension,
16 * as K+R specify that bitfields are always unsigned.
17 *
18 * 2. 2- and 4-byte fields in packet structures must be ordered by hand
19 * such that they are naturally-aligned, so that no compiler will ever
20 * insert padding bytes.
21 *
22 * 3. All packets are hand-padded to a multiple of 4 bytes, for
23 * the same reason.
24 */
25
26#ifndef XPROTO_H
27#define XPROTO_H
28
29/***********************************************************
30
31Copyright 1987, 1998  The Open Group
32
33Permission to use, copy, modify, distribute, and sell this software and its
34documentation for any purpose is hereby granted without fee, provided that
35the above copyright notice appear in all copies and that both that
36copyright notice and this permission notice appear in supporting
37documentation.
38
39The above copyright notice and this permission notice shall be included in
40all copies or substantial portions of the Software.
41
42THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
45OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
46AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
47CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
48
49Except as contained in this notice, the name of The Open Group shall not be
50used in advertising or otherwise to promote the sale, use or other dealings
51in this Software without prior written authorization from The Open Group.
52
53
54Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
55
56                        All Rights Reserved
57
58Permission to use, copy, modify, and distribute this software and its
59documentation for any purpose and without fee is hereby granted,
60provided that the above copyright notice appear in all copies and that
61both that copyright notice and this permission notice appear in
62supporting documentation, and that the name of Digital not be
63used in advertising or publicity pertaining to distribution of the
64software without specific, written prior permission.
65
66DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
67ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
68DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
69ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
70WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
71ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
72SOFTWARE.
73
74******************************************************************/
75
76#include <X11/Xmd.h>
77#include <X11/Xprotostr.h>
78
79/*
80 * Define constants for the sizes of the network packets.  The sz_ prefix is
81 * used instead of something more descriptive so that the symbols are no more
82 * than 32 characters in length (which causes problems for some compilers).
83 */
84#define sz_xSegment 8
85#define sz_xPoint 4
86#define sz_xRectangle 8
87#define sz_xArc 12
88#define sz_xConnClientPrefix 12
89#define sz_xConnSetupPrefix 8
90#define sz_xConnSetup 32
91#define sz_xPixmapFormat 8
92#define sz_xDepth 8
93#define sz_xVisualType 24
94#define sz_xWindowRoot 40
95#define sz_xTimecoord 8
96#define sz_xHostEntry 4
97#define sz_xCharInfo 12
98#define sz_xFontProp 8
99#define sz_xTextElt 2
100#define sz_xColorItem 12
101#define sz_xrgb 8
102#define sz_xGenericReply 32
103#define sz_xGetWindowAttributesReply 44
104#define sz_xGetGeometryReply 32
105#define sz_xQueryTreeReply 32
106#define sz_xInternAtomReply 32
107#define sz_xGetAtomNameReply 32
108#define sz_xGetPropertyReply 32
109#define sz_xListPropertiesReply 32
110#define sz_xGetSelectionOwnerReply 32
111#define sz_xGrabPointerReply 32
112#define sz_xQueryPointerReply 32
113#define sz_xGetMotionEventsReply 32
114#define sz_xTranslateCoordsReply 32
115#define sz_xGetInputFocusReply 32
116#define sz_xQueryKeymapReply 40
117#define sz_xQueryFontReply 60
118#define sz_xQueryTextExtentsReply 32
119#define sz_xListFontsReply 32
120#define sz_xGetFontPathReply 32
121#define sz_xGetImageReply 32
122#define sz_xListInstalledColormapsReply 32
123#define sz_xAllocColorReply 32
124#define sz_xAllocNamedColorReply 32
125#define sz_xAllocColorCellsReply 32
126#define sz_xAllocColorPlanesReply 32
127#define sz_xQueryColorsReply 32
128#define sz_xLookupColorReply 32
129#define sz_xQueryBestSizeReply 32
130#define sz_xQueryExtensionReply 32
131#define sz_xListExtensionsReply 32
132#define sz_xSetMappingReply 32
133#define sz_xGetKeyboardControlReply 52
134#define sz_xGetPointerControlReply 32
135#define sz_xGetScreenSaverReply 32
136#define sz_xListHostsReply 32
137#define sz_xSetModifierMappingReply 32
138#define sz_xError 32
139#define sz_xEvent 32
140#define sz_xKeymapEvent 32
141#define sz_xReq 4
142#define sz_xResourceReq 8
143#define sz_xCreateWindowReq 32
144#define sz_xChangeWindowAttributesReq 12
145#define sz_xChangeSaveSetReq 8
146#define sz_xReparentWindowReq 16
147#define sz_xConfigureWindowReq 12
148#define sz_xCirculateWindowReq 8
149#define sz_xInternAtomReq 8
150#define sz_xChangePropertyReq 24
151#define sz_xDeletePropertyReq 12
152#define sz_xGetPropertyReq 24
153#define sz_xSetSelectionOwnerReq 16
154#define sz_xConvertSelectionReq 24
155#define sz_xSendEventReq 44
156#define sz_xGrabPointerReq 24
157#define sz_xGrabButtonReq 24
158#define sz_xUngrabButtonReq 12
159#define sz_xChangeActivePointerGrabReq 16
160#define sz_xGrabKeyboardReq 16
161#define sz_xGrabKeyReq 16
162#define sz_xUngrabKeyReq 12
163#define sz_xAllowEventsReq 8
164#define sz_xGetMotionEventsReq 16
165#define sz_xTranslateCoordsReq 16
166#define sz_xWarpPointerReq 24
167#define sz_xSetInputFocusReq 12
168#define sz_xOpenFontReq 12
169#define sz_xQueryTextExtentsReq 8
170#define sz_xListFontsReq 8
171#define sz_xSetFontPathReq 8
172#define sz_xCreatePixmapReq 16
173#define sz_xCreateGCReq 16
174#define sz_xChangeGCReq 12
175#define sz_xCopyGCReq 16
176#define sz_xSetDashesReq 12
177#define sz_xSetClipRectanglesReq 12
178#define sz_xCopyAreaReq 28
179#define sz_xCopyPlaneReq 32
180#define sz_xPolyPointReq 12
181#define sz_xPolySegmentReq 12
182#define sz_xFillPolyReq 16
183#define sz_xPutImageReq 24
184#define sz_xGetImageReq 20
185#define sz_xPolyTextReq 16
186#define sz_xImageTextReq 16
187#define sz_xCreateColormapReq 16
188#define sz_xCopyColormapAndFreeReq 12
189#define sz_xAllocColorReq 16
190#define sz_xAllocNamedColorReq 12
191#define sz_xAllocColorCellsReq 12
192#define sz_xAllocColorPlanesReq 16
193#define sz_xFreeColorsReq 12
194#define sz_xStoreColorsReq 8
195#define sz_xStoreNamedColorReq 16
196#define sz_xQueryColorsReq 8
197#define sz_xLookupColorReq 12
198#define sz_xCreateCursorReq 32
199#define sz_xCreateGlyphCursorReq 32
200#define sz_xRecolorCursorReq 20
201#define sz_xQueryBestSizeReq 12
202#define sz_xQueryExtensionReq 8
203#define sz_xChangeKeyboardControlReq 8
204#define sz_xBellReq 4
205#define sz_xChangePointerControlReq 12
206#define sz_xSetScreenSaverReq 12
207#define sz_xChangeHostsReq 8
208#define sz_xListHostsReq 4
209#define sz_xChangeModeReq 4
210#define sz_xRotatePropertiesReq 12
211#define sz_xReply 32
212#define sz_xGrabKeyboardReply 32
213#define sz_xListFontsWithInfoReply 60
214#define sz_xSetPointerMappingReply 32
215#define sz_xGetKeyboardMappingReply 32
216#define sz_xGetPointerMappingReply 32
217#define sz_xGetModifierMappingReply 32
218#define sz_xListFontsWithInfoReq 8
219#define sz_xPolyLineReq 12
220#define sz_xPolyArcReq 12
221#define sz_xPolyRectangleReq 12
222#define sz_xPolyFillRectangleReq 12
223#define sz_xPolyFillArcReq 12
224#define sz_xPolyText8Req 16
225#define sz_xPolyText16Req 16
226#define sz_xImageText8Req 16
227#define sz_xImageText16Req 16
228#define sz_xSetPointerMappingReq 4
229#define sz_xForceScreenSaverReq 4
230#define sz_xSetCloseDownModeReq 4
231#define sz_xClearAreaReq 16
232#define sz_xSetAccessControlReq 4
233#define sz_xGetKeyboardMappingReq 8
234#define sz_xSetModifierMappingReq 4
235#define sz_xPropIconSize 24
236#define sz_xChangeKeyboardMappingReq 8
237
238
239/* For the purpose of the structure definitions in this file,
240we must redefine the following types in terms of Xmd.h's types, which may
241include bit fields.  All of these are #undef'd at the end of this file,
242restoring the definitions in X.h.  */
243
244#define Window CARD32
245#define Drawable CARD32
246#define Font CARD32
247#define Pixmap CARD32
248#define Cursor CARD32
249#define Colormap CARD32
250#define GContext CARD32
251#define Atom CARD32
252#define VisualID CARD32
253#define Time CARD32
254#define KeyCode CARD8
255#define KeySym CARD32
256
257#define X_TCP_PORT 6000     /* add display number */
258
259#define xTrue        1
260#define xFalse       0
261
262
263typedef CARD16 KeyButMask;
264
265/*****************
266   connection setup structure.  This is followed by
267   numRoots xWindowRoot structs.
268*****************/
269
270typedef struct {
271    CARD8	byteOrder;
272    BYTE	pad;
273    CARD16	majorVersion B16, minorVersion B16;
274    CARD16	nbytesAuthProto B16;	/* Authorization protocol */
275    CARD16	nbytesAuthString B16;	/* Authorization string */
276    CARD16	pad2 B16;
277} xConnClientPrefix;
278
279typedef struct {
280    CARD8          success;
281    BYTE           lengthReason; /*num bytes in string following if failure */
282    CARD16         majorVersion B16,
283                   minorVersion B16;
284    CARD16         length B16;  /* 1/4 additional bytes in setup info */
285} xConnSetupPrefix;
286
287
288typedef struct {
289    CARD32         release B32;
290    CARD32         ridBase B32,
291                   ridMask B32;
292    CARD32         motionBufferSize B32;
293    CARD16         nbytesVendor B16;  /* number of bytes in vendor string */
294    CARD16         maxRequestSize B16;
295    CARD8          numRoots;          /* number of roots structs to follow */
296    CARD8          numFormats;        /* number of pixmap formats */
297    CARD8          imageByteOrder;        /* LSBFirst, MSBFirst */
298    CARD8          bitmapBitOrder;        /* LeastSignificant, MostSign...*/
299    CARD8          bitmapScanlineUnit,     /* 8, 16, 32 */
300                   bitmapScanlinePad;     /* 8, 16, 32 */
301    KeyCode	   minKeyCode, maxKeyCode;
302    CARD32	   pad2 B32;
303} xConnSetup;
304
305typedef struct {
306    CARD8          depth;
307    CARD8          bitsPerPixel;
308    CARD8          scanLinePad;
309    CARD8          pad1;
310    CARD32	   pad2 B32;
311} xPixmapFormat;
312
313/* window root */
314
315typedef struct {
316    CARD8 	depth;
317    CARD8 	pad1;
318    CARD16	nVisuals B16;  /* number of xVisualType structures following */
319    CARD32	pad2 B32;
320    } xDepth;
321
322typedef struct {
323    VisualID visualID B32;
324#if defined(__cplusplus) || defined(c_plusplus)
325    CARD8 c_class;
326#else
327    CARD8 class;
328#endif
329    CARD8 bitsPerRGB;
330    CARD16 colormapEntries B16;
331    CARD32 redMask B32, greenMask B32, blueMask B32;
332    CARD32 pad B32;
333    } xVisualType;
334
335typedef struct {
336    Window         windowId B32;
337    Colormap       defaultColormap B32;
338    CARD32         whitePixel B32, blackPixel B32;
339    CARD32         currentInputMask B32;
340    CARD16         pixWidth B16, pixHeight B16;
341    CARD16         mmWidth B16, mmHeight B16;
342    CARD16         minInstalledMaps B16, maxInstalledMaps B16;
343    VisualID       rootVisualID B32;
344    CARD8          backingStore;
345    BOOL           saveUnders;
346    CARD8          rootDepth;
347    CARD8          nDepths;  /* number of xDepth structures following */
348} xWindowRoot;
349
350
351/*****************************************************************
352 * Structure Defns
353 *   Structures needed for replies
354 *****************************************************************/
355
356/* Used in GetMotionEvents */
357
358typedef struct {
359    CARD32 time B32;
360    INT16 x B16, y B16;
361} xTimecoord;
362
363typedef struct {
364    CARD8 family;
365    BYTE pad;
366    CARD16 length B16;
367} xHostEntry;
368
369typedef struct {
370    INT16 leftSideBearing B16,
371	  rightSideBearing B16,
372	  characterWidth B16,
373	  ascent B16,
374	  descent B16;
375    CARD16 attributes B16;
376} xCharInfo;
377
378typedef struct {
379    Atom name B32;
380    CARD32 value B32;
381} xFontProp;
382
383/*
384 * non-aligned big-endian font ID follows this struct
385 */
386typedef struct {           /* followed by string */
387    CARD8 len;	/* number of *characters* in string, or FontChange (255)
388		   for font change, or 0 if just delta given */
389    INT8 delta;
390} xTextElt;
391
392
393typedef struct {
394    CARD32 pixel B32;
395    CARD16 red B16, green B16, blue B16;
396    CARD8 flags;  /* DoRed, DoGreen, DoBlue booleans */
397    CARD8 pad;
398} xColorItem;
399
400
401typedef struct {
402    CARD16 red B16, green B16, blue B16, pad B16;
403} xrgb;
404
405typedef CARD8 KEYCODE;
406
407
408/*****************
409 * XRep:
410 *    meant to be 32 byte quantity
411 *****************/
412
413/* GenericReply is the common format of all replies.  The "data" items
414   are specific to each individual reply type. */
415
416typedef struct {
417    BYTE type;              /* X_Reply */
418    BYTE data1;             /* depends on reply type */
419    CARD16 sequenceNumber B16;  /* of last request received by server */
420    CARD32 length B32;      /* 4 byte quantities beyond size of GenericReply */
421    CARD32 data00 B32;
422    CARD32 data01 B32;
423    CARD32 data02 B32;
424    CARD32 data03 B32;
425    CARD32 data04 B32;
426    CARD32 data05 B32;
427    } xGenericReply;
428
429/* Individual reply formats. */
430
431typedef struct {
432    BYTE type;  /* X_Reply */
433    CARD8 backingStore;
434    CARD16 sequenceNumber B16;
435    CARD32 length B32;	/* NOT 0; this is an extra-large reply */
436    VisualID visualID B32;
437#if defined(__cplusplus) || defined(c_plusplus)
438    CARD16 c_class B16;
439#else
440    CARD16 class B16;
441#endif
442    CARD8 bitGravity;
443    CARD8 winGravity;
444    CARD32 backingBitPlanes B32;
445    CARD32 backingPixel B32;
446    BOOL saveUnder;
447    BOOL mapInstalled;
448    CARD8 mapState;
449    BOOL override;
450    Colormap colormap B32;
451    CARD32 allEventMasks B32;
452    CARD32 yourEventMask B32;
453    CARD16 doNotPropagateMask B16;
454    CARD16 pad B16;
455    } xGetWindowAttributesReply;
456
457typedef struct {
458    BYTE type;   /* X_Reply */
459    CARD8 depth;
460    CARD16 sequenceNumber B16;
461    CARD32 length B32;  /* 0 */
462    Window root B32;
463    INT16 x B16, y B16;
464    CARD16 width B16, height B16;
465    CARD16 borderWidth B16;
466    CARD16 pad1 B16;
467    CARD32 pad2 B32;
468    CARD32 pad3 B32;
469    } xGetGeometryReply;
470
471typedef struct {
472    BYTE type;  /* X_Reply */
473    BYTE pad1;
474    CARD16 sequenceNumber B16;
475    CARD32 length B32;
476    Window root B32, parent B32;
477    CARD16 nChildren B16;
478    CARD16 pad2 B16;
479    CARD32 pad3 B32;
480    CARD32 pad4 B32;
481    CARD32 pad5 B32;
482    } xQueryTreeReply;
483
484typedef struct {
485    BYTE type;  /* X_Reply */
486    BYTE pad1;
487    CARD16 sequenceNumber B16;
488    CARD32 length B32; /* 0 */
489    Atom atom B32;
490    CARD32 pad2 B32;
491    CARD32 pad3 B32;
492    CARD32 pad4 B32;
493    CARD32 pad5 B32;
494    CARD32 pad6 B32;
495    } xInternAtomReply;
496
497typedef struct {
498    BYTE type;  /* X_Reply */
499    BYTE pad1;
500    CARD16 sequenceNumber B16;
501    CARD32 length B32;  /* of additional bytes */
502    CARD16 nameLength B16;  /* # of characters in name */
503    CARD16 pad2 B16;
504    CARD32 pad3 B32;
505    CARD32 pad4 B32;
506    CARD32 pad5 B32;
507    CARD32 pad6 B32;
508    CARD32 pad7 B32;
509    } xGetAtomNameReply;
510
511typedef struct {
512    BYTE type;  /* X_Reply */
513    CARD8 format;
514    CARD16 sequenceNumber B16;
515    CARD32 length B32; /* of additional bytes */
516    Atom propertyType B32;
517    CARD32 bytesAfter B32;
518    CARD32 nItems B32; /* # of 8, 16, or 32-bit entities in reply */
519    CARD32 pad1 B32;
520    CARD32 pad2 B32;
521    CARD32 pad3 B32;
522    } xGetPropertyReply;
523
524typedef struct {
525    BYTE type;  /* X_Reply */
526    BYTE pad1;
527    CARD16 sequenceNumber B16;
528    CARD32 length B32;
529    CARD16 nProperties B16;
530    CARD16 pad2 B16;
531    CARD32 pad3 B32;
532    CARD32 pad4 B32;
533    CARD32 pad5 B32;
534    CARD32 pad6 B32;
535    CARD32 pad7 B32;
536    } xListPropertiesReply;
537
538typedef struct {
539    BYTE type;  /* X_Reply */
540    BYTE pad1;
541    CARD16 sequenceNumber B16;
542    CARD32 length B32;  /* 0 */
543    Window owner B32;
544    CARD32 pad2 B32;
545    CARD32 pad3 B32;
546    CARD32 pad4 B32;
547    CARD32 pad5 B32;
548    CARD32 pad6 B32;
549    } xGetSelectionOwnerReply;
550
551typedef struct {
552    BYTE type;  /* X_Reply */
553    BYTE status;
554    CARD16 sequenceNumber B16;
555    CARD32 length B32;  /* 0 */
556    CARD32 pad1 B32;
557    CARD32 pad2 B32;
558    CARD32 pad3 B32;
559    CARD32 pad4 B32;
560    CARD32 pad5 B32;
561    CARD32 pad6 B32;
562    } xGrabPointerReply;
563
564typedef xGrabPointerReply xGrabKeyboardReply;
565
566typedef struct {
567    BYTE type;  /* X_Reply */
568    BOOL sameScreen;
569    CARD16 sequenceNumber B16;
570    CARD32 length B32;  /* 0 */
571    Window root B32, child B32;
572    INT16 rootX B16, rootY B16, winX B16, winY B16;
573    CARD16 mask B16;
574    CARD16 pad1 B16;
575    CARD32 pad B32;
576    } xQueryPointerReply;
577
578typedef struct {
579    BYTE type;  /* X_Reply */
580    BYTE pad1;
581    CARD16 sequenceNumber B16;
582    CARD32 length B32;
583    CARD32 nEvents B32;
584    CARD32 pad2 B32;
585    CARD32 pad3 B32;
586    CARD32 pad4 B32;
587    CARD32 pad5 B32;
588    CARD32 pad6 B32;
589    } xGetMotionEventsReply;
590
591typedef struct {
592    BYTE type;  /* X_Reply */
593    BOOL sameScreen;
594    CARD16 sequenceNumber B16;
595    CARD32 length B32; /* 0 */
596    Window child B32;
597    INT16 dstX B16, dstY B16;
598    CARD32 pad2 B32;
599    CARD32 pad3 B32;
600    CARD32 pad4 B32;
601    CARD32 pad5 B32;
602    } xTranslateCoordsReply;
603
604typedef struct {
605    BYTE type;  /* X_Reply */
606    CARD8 revertTo;
607    CARD16 sequenceNumber B16;
608    CARD32 length B32;  /* 0 */
609    Window focus B32;
610    CARD32 pad1 B32;
611    CARD32 pad2 B32;
612    CARD32 pad3 B32;
613    CARD32 pad4 B32;
614    CARD32 pad5 B32;
615    } xGetInputFocusReply;
616
617typedef struct {
618    BYTE type;  /* X_Reply */
619    BYTE pad1;
620    CARD16 sequenceNumber B16;
621    CARD32 length B32;  /* 2, NOT 0; this is an extra-large reply */
622    BYTE map[32];
623    } xQueryKeymapReply;
624
625/* Warning: this MUST match (up to component renaming) xListFontsWithInfoReply */
626typedef struct _xQueryFontReply {
627    BYTE type;  /* X_Reply */
628    BYTE pad1;
629    CARD16 sequenceNumber B16;
630    CARD32 length B32;  /* definitely > 0, even if "nCharInfos" is 0 */
631    xCharInfo minBounds;
632#ifndef WORD64
633    CARD32 walign1 B32;
634#endif
635    xCharInfo maxBounds;
636#ifndef WORD64
637    CARD32 walign2 B32;
638#endif
639    CARD16 minCharOrByte2 B16, maxCharOrByte2 B16;
640    CARD16 defaultChar B16;
641    CARD16 nFontProps B16;  /* followed by this many xFontProp structures */
642    CARD8 drawDirection;
643    CARD8 minByte1, maxByte1;
644    BOOL allCharsExist;
645    INT16 fontAscent B16, fontDescent B16;
646    CARD32 nCharInfos B32; /* followed by this many xCharInfo structures */
647} xQueryFontReply;
648
649typedef struct {
650    BYTE type;  /* X_Reply */
651    CARD8 drawDirection;
652    CARD16 sequenceNumber B16;
653    CARD32 length B32;  /* 0 */
654    INT16 fontAscent B16, fontDescent B16;
655    INT16 overallAscent B16, overallDescent B16;
656    INT32 overallWidth B32, overallLeft B32, overallRight B32;
657    CARD32 pad B32;
658    } xQueryTextExtentsReply;
659
660typedef struct {
661    BYTE type;  /* X_Reply */
662    BYTE pad1;
663    CARD16 sequenceNumber B16;
664    CARD32 length B32;
665    CARD16 nFonts B16;
666    CARD16 pad2 B16;
667    CARD32 pad3 B32;
668    CARD32 pad4 B32;
669    CARD32 pad5 B32;
670    CARD32 pad6 B32;
671    CARD32 pad7 B32;
672    } xListFontsReply;
673
674/* Warning: this MUST match (up to component renaming) xQueryFontReply */
675typedef struct {
676    BYTE type;  /* X_Reply */
677    CARD8 nameLength;  /* 0 indicates end-of-reply-sequence */
678    CARD16 sequenceNumber B16;
679    CARD32 length B32;  /* definitely > 0, even if "nameLength" is 0 */
680    xCharInfo minBounds;
681#ifndef WORD64
682    CARD32 walign1 B32;
683#endif
684    xCharInfo maxBounds;
685#ifndef WORD64
686    CARD32 walign2 B32;
687#endif
688    CARD16 minCharOrByte2 B16, maxCharOrByte2 B16;
689    CARD16 defaultChar B16;
690    CARD16 nFontProps B16;  /* followed by this many xFontProp structures */
691    CARD8 drawDirection;
692    CARD8 minByte1, maxByte1;
693    BOOL allCharsExist;
694    INT16 fontAscent B16, fontDescent B16;
695    CARD32 nReplies B32;   /* hint as to how many more replies might be coming */
696} xListFontsWithInfoReply;
697
698typedef struct {
699    BYTE type;  /* X_Reply */
700    BYTE pad1;
701    CARD16 sequenceNumber B16;
702    CARD32 length B32;
703    CARD16 nPaths B16;
704    CARD16 pad2 B16;
705    CARD32 pad3 B32;
706    CARD32 pad4 B32;
707    CARD32 pad5 B32;
708    CARD32 pad6 B32;
709    CARD32 pad7 B32;
710    } xGetFontPathReply;
711
712typedef struct {
713    BYTE type;  /* X_Reply */
714    CARD8 depth;
715    CARD16 sequenceNumber B16;
716    CARD32 length B32;
717    VisualID visual B32;
718    CARD32 pad3 B32;
719    CARD32 pad4 B32;
720    CARD32 pad5 B32;
721    CARD32 pad6 B32;
722    CARD32 pad7 B32;
723    } xGetImageReply;
724
725typedef struct {
726    BYTE type;  /* X_Reply */
727    BYTE pad1;
728    CARD16 sequenceNumber B16;
729    CARD32 length B32;
730    CARD16 nColormaps B16;
731    CARD16 pad2 B16;
732    CARD32 pad3 B32;
733    CARD32 pad4 B32;
734    CARD32 pad5 B32;
735    CARD32 pad6 B32;
736    CARD32 pad7 B32;
737    } xListInstalledColormapsReply;
738
739typedef struct {
740    BYTE type; /* X_Reply */
741    BYTE pad1;
742    CARD16 sequenceNumber B16;
743    CARD32 length B32;   /* 0 */
744    CARD16 red B16, green B16, blue B16;
745    CARD16 pad2 B16;
746    CARD32 pixel B32;
747    CARD32 pad3 B32;
748    CARD32 pad4 B32;
749    CARD32 pad5 B32;
750    } xAllocColorReply;
751
752typedef struct {
753    BYTE type; /* X_Reply */
754    BYTE pad1;
755    CARD16 sequenceNumber B16;
756    CARD32 length B32;  /* 0 */
757    CARD32 pixel B32;
758    CARD16 exactRed B16, exactGreen B16, exactBlue B16;
759    CARD16 screenRed B16, screenGreen B16, screenBlue B16;
760    CARD32 pad2 B32;
761    CARD32 pad3 B32;
762    } xAllocNamedColorReply;
763
764typedef struct {
765    BYTE type;  /* X_Reply */
766    BYTE pad1;
767    CARD16 sequenceNumber B16;
768    CARD32 length B32;
769    CARD16 nPixels B16, nMasks B16;
770    CARD32 pad3 B32;
771    CARD32 pad4 B32;
772    CARD32 pad5 B32;
773    CARD32 pad6 B32;
774    CARD32 pad7 B32;
775    } xAllocColorCellsReply;
776
777typedef struct {
778    BYTE type; /* X_Reply */
779    BYTE pad1;
780    CARD16 sequenceNumber B16;
781    CARD32 length B32;
782    CARD16 nPixels B16;
783    CARD16 pad2 B16;
784    CARD32 redMask B32, greenMask B32, blueMask B32;
785    CARD32 pad3 B32;
786    CARD32 pad4 B32;
787    } xAllocColorPlanesReply;
788
789typedef struct {
790    BYTE type; /* X_Reply */
791    BYTE pad1;
792    CARD16 sequenceNumber B16;
793    CARD32 length B32;
794    CARD16 nColors B16;
795    CARD16 pad2 B16;
796    CARD32 pad3 B32;
797    CARD32 pad4 B32;
798    CARD32 pad5 B32;
799    CARD32 pad6 B32;
800    CARD32 pad7 B32;
801    } xQueryColorsReply;
802
803typedef struct {
804    BYTE type;  /* X_Reply */
805    BYTE pad1;
806    CARD16 sequenceNumber B16;
807    CARD32 length B32;  /* 0 */
808    CARD16 exactRed B16, exactGreen B16, exactBlue B16;
809    CARD16 screenRed B16, screenGreen B16, screenBlue B16;
810    CARD32 pad3 B32;
811    CARD32 pad4 B32;
812    CARD32 pad5 B32;
813    } xLookupColorReply;
814
815typedef struct {
816    BYTE type;  /* X_Reply */
817    BYTE pad1;
818    CARD16 sequenceNumber B16;
819    CARD32 length B32;  /* 0 */
820    CARD16 width B16, height B16;
821    CARD32 pad3 B32;
822    CARD32 pad4 B32;
823    CARD32 pad5 B32;
824    CARD32 pad6 B32;
825    CARD32 pad7 B32;
826    } xQueryBestSizeReply;
827
828typedef struct {
829    BYTE type;  /* X_Reply */
830    BYTE pad1;
831    CARD16 sequenceNumber B16;
832    CARD32 length B32; /* 0 */
833    BOOL  present;
834    CARD8 major_opcode;
835    CARD8 first_event;
836    CARD8 first_error;
837    CARD32 pad3 B32;
838    CARD32 pad4 B32;
839    CARD32 pad5 B32;
840    CARD32 pad6 B32;
841    CARD32 pad7 B32;
842    } xQueryExtensionReply;
843
844typedef struct {
845    BYTE type;  /* X_Reply */
846    CARD8 nExtensions;
847    CARD16 sequenceNumber B16;
848    CARD32 length B32;
849    CARD32 pad2 B32;
850    CARD32 pad3 B32;
851    CARD32 pad4 B32;
852    CARD32 pad5 B32;
853    CARD32 pad6 B32;
854    CARD32 pad7 B32;
855    } xListExtensionsReply;
856
857
858typedef struct {
859    BYTE   type;  /* X_Reply */
860    CARD8  success;
861    CARD16 sequenceNumber B16;
862    CARD32 length B32;
863    CARD32 pad2 B32;
864    CARD32 pad3 B32;
865    CARD32 pad4 B32;
866    CARD32 pad5 B32;
867    CARD32 pad6 B32;
868    CARD32 pad7 B32;
869    } xSetMappingReply;
870typedef xSetMappingReply xSetPointerMappingReply;
871typedef xSetMappingReply xSetModifierMappingReply;
872
873typedef struct {
874    BYTE type;  /* X_Reply */
875    CARD8 nElts;  /* how many elements does the map have */
876    CARD16 sequenceNumber B16;
877    CARD32 length B32;
878    CARD32 pad2 B32;
879    CARD32 pad3 B32;
880    CARD32 pad4 B32;
881    CARD32 pad5 B32;
882    CARD32 pad6 B32;
883    CARD32 pad7 B32;
884    } xGetPointerMappingReply;
885
886typedef struct {
887    BYTE type;
888    CARD8 keySymsPerKeyCode;
889    CARD16 sequenceNumber B16;
890    CARD32 length B32;
891    CARD32 pad2 B32;
892    CARD32 pad3 B32;
893    CARD32 pad4 B32;
894    CARD32 pad5 B32;
895    CARD32 pad6 B32;
896    CARD32 pad7 B32;
897} xGetKeyboardMappingReply;
898
899typedef struct {
900    BYTE type;
901    CARD8 numKeyPerModifier;
902    CARD16 sequenceNumber B16;
903    CARD32 length B32;
904    CARD32 pad1 B32;
905    CARD32 pad2 B32;
906    CARD32 pad3 B32;
907    CARD32 pad4 B32;
908    CARD32 pad5 B32;
909    CARD32 pad6 B32;
910} xGetModifierMappingReply;
911
912typedef struct {
913    BYTE type;  /* X_Reply */
914    BOOL globalAutoRepeat;
915    CARD16 sequenceNumber B16;
916    CARD32 length B32;  /* 5 */
917    CARD32 ledMask B32;
918    CARD8 keyClickPercent, bellPercent;
919    CARD16 bellPitch B16, bellDuration B16;
920    CARD16 pad B16;
921    BYTE map[32];  /* bit masks start here */
922    } xGetKeyboardControlReply;
923
924typedef struct {
925    BYTE type;  /* X_Reply */
926    BYTE pad1;
927    CARD16 sequenceNumber B16;
928    CARD32 length B32;  /* 0 */
929    CARD16 accelNumerator B16, accelDenominator B16;
930    CARD16 threshold B16;
931    CARD16 pad2 B16;
932    CARD32 pad3 B32;
933    CARD32 pad4 B32;
934    CARD32 pad5 B32;
935    CARD32 pad6 B32;
936    } xGetPointerControlReply;
937
938typedef struct {
939    BYTE type;  /* X_Reply */
940    BYTE pad1;
941    CARD16 sequenceNumber B16;
942    CARD32 length B32;  /* 0 */
943    CARD16 timeout B16, interval B16;
944    BOOL preferBlanking;
945    BOOL allowExposures;
946    CARD16 pad2 B16;
947    CARD32 pad3 B32;
948    CARD32 pad4 B32;
949    CARD32 pad5 B32;
950    CARD32 pad6 B32;
951    } xGetScreenSaverReply;
952
953typedef struct {
954    BYTE type;  /* X_Reply */
955    BOOL enabled;
956    CARD16 sequenceNumber B16;
957    CARD32 length B32;
958    CARD16 nHosts B16;
959    CARD16 pad1 B16;
960    CARD32 pad3 B32;
961    CARD32 pad4 B32;
962    CARD32 pad5 B32;
963    CARD32 pad6 B32;
964    CARD32 pad7 B32;
965    } xListHostsReply;
966
967
968
969
970/*****************************************************************
971 * Xerror
972 *    All errors  are 32 bytes
973 *****************************************************************/
974
975typedef struct {
976    BYTE type;                  /* X_Error */
977    BYTE errorCode;
978    CARD16 sequenceNumber B16;       /* the nth request from this client */
979    CARD32 resourceID B32;
980    CARD16 minorCode B16;
981    CARD8 majorCode;
982    BYTE pad1;
983    CARD32 pad3 B32;
984    CARD32 pad4 B32;
985    CARD32 pad5 B32;
986    CARD32 pad6 B32;
987    CARD32 pad7 B32;
988} xError;
989
990/*****************************************************************
991 * xEvent
992 *    All events are 32 bytes
993 *****************************************************************/
994
995typedef struct _xEvent {
996    union {
997	struct {
998	    BYTE type;
999	    BYTE detail;
1000	    CARD16 sequenceNumber B16;
1001	    } u;
1002	struct {
1003            CARD32 pad00 B32;
1004	    Time time B32;
1005	    Window root B32, event B32, child B32;
1006	    INT16 rootX B16, rootY B16, eventX B16, eventY B16;
1007	    KeyButMask state B16;
1008	    BOOL sameScreen;
1009	    BYTE pad1;
1010	} keyButtonPointer;
1011	struct {
1012            CARD32 pad00 B32;
1013            Time time B32;
1014	    Window root B32, event B32, child B32;
1015	    INT16 rootX B16, rootY B16, eventX B16, eventY B16;
1016	    KeyButMask state B16;
1017	    BYTE mode; 			/* really XMode */
1018	    BYTE flags;		/* sameScreen and focus booleans, packed together */
1019#define ELFlagFocus        (1<<0)
1020#define ELFlagSameScreen   (1<<1)
1021	} enterLeave;
1022	struct {
1023            CARD32 pad00 B32;
1024	    Window window B32;
1025	    BYTE mode; 			/* really XMode */
1026	    BYTE pad1, pad2, pad3;
1027	} focus;
1028	struct {
1029            CARD32 pad00 B32;
1030	    Window window B32;
1031	    CARD16 x B16, y B16, width B16, height B16;
1032	    CARD16 count B16;
1033	    CARD16 pad2 B16;
1034	} expose;
1035	struct {
1036            CARD32 pad00 B32;
1037	    Drawable drawable B32;
1038	    CARD16 x B16, y B16, width B16, height B16;
1039	    CARD16 minorEvent B16;
1040	    CARD16 count B16;
1041	    BYTE majorEvent;
1042	    BYTE pad1, pad2, pad3;
1043	} graphicsExposure;
1044	struct {
1045            CARD32 pad00 B32;
1046	    Drawable drawable B32;
1047	    CARD16 minorEvent B16;
1048	    BYTE majorEvent;
1049	    BYTE bpad;
1050	} noExposure;
1051	struct {
1052            CARD32 pad00 B32;
1053	    Window window B32;
1054	    CARD8 state;
1055	    BYTE pad1, pad2, pad3;
1056	} visibility;
1057	struct {
1058            CARD32 pad00 B32;
1059	    Window parent B32, window B32;
1060	    INT16 x B16, y B16;
1061	    CARD16 width B16, height B16, borderWidth B16;
1062	    BOOL override;
1063	    BYTE bpad;
1064        } createNotify;
1065/*
1066 * The event fields in the structures for DestroyNotify, UnmapNotify,
1067 * MapNotify, ReparentNotify, ConfigureNotify, CirculateNotify, GravityNotify,
1068 * must be at the same offset because server internal code is depending upon
1069 * this to patch up the events before they are delivered.
1070 * Also note that MapRequest, ConfigureRequest and CirculateRequest have
1071 * the same offset for the event window.
1072 */
1073	struct {
1074            CARD32 pad00 B32;
1075	    Window event B32, window B32;
1076	} destroyNotify;
1077	struct {
1078            CARD32 pad00 B32;
1079	    Window event B32, window B32;
1080	    BOOL fromConfigure;
1081	    BYTE pad1, pad2, pad3;
1082        } unmapNotify;
1083	struct {
1084            CARD32 pad00 B32;
1085	    Window event B32, window B32;
1086	    BOOL override;
1087	    BYTE pad1, pad2, pad3;
1088        } mapNotify;
1089	struct {
1090            CARD32 pad00 B32;
1091	    Window parent B32, window B32;
1092        } mapRequest;
1093	struct {
1094            CARD32 pad00 B32;
1095	    Window event B32, window B32, parent B32;
1096	    INT16 x B16, y B16;
1097	    BOOL override;
1098	    BYTE pad1, pad2, pad3;
1099	} reparent;
1100	struct {
1101            CARD32 pad00 B32;
1102	    Window event B32, window B32, aboveSibling B32;
1103	    INT16 x B16, y B16;
1104	    CARD16 width B16, height B16, borderWidth B16;
1105	    BOOL override;
1106	    BYTE bpad;
1107	} configureNotify;
1108	struct {
1109            CARD32 pad00 B32;
1110	    Window parent B32, window B32, sibling B32;
1111	    INT16 x B16, y B16;
1112	    CARD16 width B16, height B16, borderWidth B16;
1113	    CARD16 valueMask B16;
1114	    CARD32 pad1 B32;
1115	} configureRequest;
1116	struct {
1117            CARD32 pad00 B32;
1118	    Window event B32, window B32;
1119	    INT16 x B16, y B16;
1120	    CARD32 pad1 B32, pad2 B32, pad3 B32, pad4 B32;
1121	} gravity;
1122	struct {
1123            CARD32 pad00 B32;
1124	    Window window B32;
1125	    CARD16 width B16, height B16;
1126	} resizeRequest;
1127	struct {
1128/* The event field in the circulate record is really the parent when this
1129   is used as a CirculateRequest instead of a CirculateNotify */
1130            CARD32 pad00 B32;
1131	    Window event B32, window B32, parent B32;
1132	    BYTE place;			/* Top or Bottom */
1133	    BYTE pad1, pad2, pad3;
1134	} circulate;
1135	struct {
1136            CARD32 pad00 B32;
1137	    Window window B32;
1138	    Atom atom B32;
1139	    Time time B32;
1140	    BYTE state;			/* NewValue or Deleted */
1141	    BYTE pad1;
1142	    CARD16 pad2 B16;
1143	} property;
1144	struct {
1145            CARD32 pad00 B32;
1146            Time time B32;
1147	    Window window B32;
1148	    Atom atom B32;
1149	} selectionClear;
1150	struct {
1151            CARD32 pad00 B32;
1152            Time time B32;
1153	    Window owner B32, requestor B32;
1154	    Atom selection B32, target B32, property B32;
1155	} selectionRequest;
1156	struct {
1157            CARD32 pad00 B32;
1158            Time time B32;
1159	    Window requestor B32;
1160	    Atom selection B32, target B32, property B32;
1161	} selectionNotify;
1162	struct {
1163            CARD32 pad00 B32;
1164	    Window window B32;
1165	    Colormap colormap B32;
1166#if defined(__cplusplus) || defined(c_plusplus)
1167	    BOOL c_new;
1168#else
1169	    BOOL new;
1170#endif
1171	    BYTE state;			/* Installed or UnInstalled */
1172	    BYTE pad1, pad2;
1173	} colormap;
1174	struct {
1175	    CARD32 pad00 B32;
1176	    CARD8 request;
1177	    KeyCode firstKeyCode;
1178	    CARD8 count;
1179	    BYTE pad1;
1180	} mappingNotify;
1181	struct {
1182            CARD32 pad00 B32;
1183	    Window window B32;
1184	    union {
1185		struct {
1186		    Atom type B32;
1187		    INT32 longs0 B32;
1188		    INT32 longs1 B32;
1189		    INT32 longs2 B32;
1190		    INT32 longs3 B32;
1191		    INT32 longs4 B32;
1192		} l;
1193		struct {
1194		    Atom type B32;
1195		    INT16 shorts0 B16;
1196		    INT16 shorts1 B16;
1197		    INT16 shorts2 B16;
1198		    INT16 shorts3 B16;
1199		    INT16 shorts4 B16;
1200		    INT16 shorts5 B16;
1201		    INT16 shorts6 B16;
1202		    INT16 shorts7 B16;
1203		    INT16 shorts8 B16;
1204		    INT16 shorts9 B16;
1205		} s;
1206		struct {
1207		    Atom type B32;
1208		    INT8 bytes[20];
1209		} b;
1210	    } u;
1211	} clientMessage;
1212    } u;
1213} xEvent;
1214
1215/* KeymapNotify events are not included in the above union because they
1216   are different from all other events: they do not have a "detail"
1217   or "sequenceNumber", so there is room for a 248-bit key mask. */
1218
1219typedef struct {
1220    BYTE type;
1221    BYTE map[31];
1222    } xKeymapEvent;
1223
1224#define XEventSize (sizeof(xEvent))
1225
1226/* XReply is the union of all the replies above whose "fixed part"
1227fits in 32 bytes.  It does NOT include GetWindowAttributesReply,
1228QueryFontReply, QueryKeymapReply, or GetKeyboardControlReply
1229ListFontsWithInfoReply */
1230
1231typedef union {
1232    xGenericReply generic;
1233    xGetGeometryReply geom;
1234    xQueryTreeReply tree;
1235    xInternAtomReply atom;
1236    xGetAtomNameReply atomName;
1237    xGetPropertyReply property;
1238    xListPropertiesReply listProperties;
1239    xGetSelectionOwnerReply selection;
1240    xGrabPointerReply grabPointer;
1241    xGrabKeyboardReply grabKeyboard;
1242    xQueryPointerReply pointer;
1243    xGetMotionEventsReply motionEvents;
1244    xTranslateCoordsReply coords;
1245    xGetInputFocusReply inputFocus;
1246    xQueryTextExtentsReply textExtents;
1247    xListFontsReply fonts;
1248    xGetFontPathReply fontPath;
1249    xGetImageReply image;
1250    xListInstalledColormapsReply colormaps;
1251    xAllocColorReply allocColor;
1252    xAllocNamedColorReply allocNamedColor;
1253    xAllocColorCellsReply colorCells;
1254    xAllocColorPlanesReply colorPlanes;
1255    xQueryColorsReply colors;
1256    xLookupColorReply lookupColor;
1257    xQueryBestSizeReply bestSize;
1258    xQueryExtensionReply extension;
1259    xListExtensionsReply extensions;
1260    xSetModifierMappingReply setModifierMapping;
1261    xGetModifierMappingReply getModifierMapping;
1262    xSetPointerMappingReply setPointerMapping;
1263    xGetKeyboardMappingReply getKeyboardMapping;
1264    xGetPointerMappingReply getPointerMapping;
1265    xGetPointerControlReply pointerControl;
1266    xGetScreenSaverReply screenSaver;
1267    xListHostsReply hosts;
1268    xError error;
1269    xEvent event;
1270} xReply;
1271
1272
1273
1274/*****************************************************************
1275 * REQUESTS
1276 *****************************************************************/
1277
1278
1279/* Request structure */
1280
1281typedef struct _xReq {
1282	CARD8 reqType;
1283	CARD8 data;            /* meaning depends on request type */
1284	CARD16 length B16;         /* length in 4 bytes quantities
1285				  of whole request, including this header */
1286} xReq;
1287
1288/*****************************************************************
1289 *  structures that follow request.
1290 *****************************************************************/
1291
1292/* ResourceReq is used for any request which has a resource ID
1293   (or Atom or Time) as its one and only argument.  */
1294
1295typedef struct {
1296    CARD8 reqType;
1297    BYTE pad;
1298    CARD16 length B16;
1299    CARD32 id B32;  /* a Window, Drawable, Font, GContext, Pixmap, etc. */
1300    } xResourceReq;
1301
1302typedef struct {
1303    CARD8 reqType;
1304    CARD8 depth;
1305    CARD16 length B16;
1306    Window wid B32, parent B32;
1307    INT16 x B16, y B16;
1308    CARD16 width B16, height B16, borderWidth B16;
1309#if defined(__cplusplus) || defined(c_plusplus)
1310    CARD16 c_class B16;
1311#else
1312    CARD16 class B16;
1313#endif
1314    VisualID visual B32;
1315    CARD32 mask B32;
1316} xCreateWindowReq;
1317
1318typedef struct {
1319    CARD8 reqType;
1320    BYTE pad;
1321    CARD16 length B16;
1322    Window window B32;
1323    CARD32 valueMask B32;
1324} xChangeWindowAttributesReq;
1325
1326typedef struct {
1327    CARD8 reqType;
1328    BYTE mode;
1329    CARD16 length B16;
1330    Window window B32;
1331} xChangeSaveSetReq;
1332
1333typedef struct {
1334    CARD8 reqType;
1335    BYTE pad;
1336    CARD16 length B16;
1337    Window window B32, parent B32;
1338    INT16 x B16, y B16;
1339} xReparentWindowReq;
1340
1341typedef struct {
1342    CARD8 reqType;
1343    CARD8 pad;
1344    CARD16 length B16;
1345    Window window B32;
1346    CARD16 mask B16;
1347    CARD16 pad2 B16;
1348} xConfigureWindowReq;
1349
1350typedef struct {
1351    CARD8 reqType;
1352    CARD8 direction;
1353    CARD16 length B16;
1354    Window window B32;
1355} xCirculateWindowReq;
1356
1357typedef struct {    /* followed by padded string */
1358    CARD8 reqType;
1359    BOOL onlyIfExists;
1360    CARD16 length B16;
1361    CARD16 nbytes  B16;    /* number of bytes in string */
1362    CARD16 pad B16;
1363} xInternAtomReq;
1364
1365typedef struct {
1366    CARD8 reqType;
1367    CARD8 mode;
1368    CARD16 length B16;
1369    Window window B32;
1370    Atom property B32, type B32;
1371    CARD8 format;
1372    BYTE pad[3];
1373    CARD32 nUnits B32;     /* length of stuff following, depends on format */
1374} xChangePropertyReq;
1375
1376typedef struct {
1377    CARD8 reqType;
1378    BYTE pad;
1379    CARD16 length B16;
1380    Window window B32;
1381    Atom property B32;
1382} xDeletePropertyReq;
1383
1384typedef struct {
1385    CARD8 reqType;
1386#if defined(__cplusplus) || defined(c_plusplus)
1387    BOOL c_delete;
1388#else
1389    BOOL delete;
1390#endif
1391    CARD16 length B16;
1392    Window window B32;
1393    Atom property B32, type B32;
1394    CARD32 longOffset B32;
1395    CARD32 longLength B32;
1396} xGetPropertyReq;
1397
1398typedef struct {
1399    CARD8 reqType;
1400    BYTE pad;
1401    CARD16 length B16;
1402    Window window B32;
1403    Atom selection B32;
1404    Time time B32;
1405} xSetSelectionOwnerReq;
1406
1407typedef struct {
1408    CARD8 reqType;
1409    BYTE pad;
1410    CARD16 length B16;
1411    Window requestor B32;
1412    Atom selection B32, target B32, property B32;
1413    Time time B32;
1414    } xConvertSelectionReq;
1415
1416typedef struct {
1417    CARD8 reqType;
1418    BOOL propagate;
1419    CARD16 length B16;
1420    Window destination B32;
1421    CARD32 eventMask B32;
1422#ifdef WORD64
1423    /* the structure should have been quad-aligned */
1424    BYTE eventdata[SIZEOF(xEvent)];
1425#else
1426    xEvent event;
1427#endif /* WORD64 */
1428} xSendEventReq;
1429
1430typedef struct {
1431    CARD8 reqType;
1432    BOOL ownerEvents;
1433    CARD16 length B16;
1434    Window grabWindow B32;
1435    CARD16 eventMask B16;
1436    BYTE pointerMode, keyboardMode;
1437    Window confineTo B32;
1438    Cursor cursor B32;
1439    Time time B32;
1440} xGrabPointerReq;
1441
1442typedef struct {
1443    CARD8 reqType;
1444    BOOL ownerEvents;
1445    CARD16 length B16;
1446    Window grabWindow B32;
1447    CARD16 eventMask B16;
1448    BYTE pointerMode, keyboardMode;
1449    Window confineTo B32;
1450    Cursor cursor B32;
1451    CARD8 button;
1452    BYTE pad;
1453    CARD16 modifiers B16;
1454} xGrabButtonReq;
1455
1456typedef struct {
1457    CARD8 reqType;
1458    CARD8 button;
1459    CARD16 length B16;
1460    Window grabWindow B32;
1461    CARD16 modifiers B16;
1462    CARD16 pad B16;
1463} xUngrabButtonReq;
1464
1465typedef struct {
1466    CARD8 reqType;
1467    BYTE pad;
1468    CARD16 length B16;
1469    Cursor cursor B32;
1470    Time time B32;
1471    CARD16 eventMask B16;
1472    CARD16 pad2 B16;
1473} xChangeActivePointerGrabReq;
1474
1475typedef struct {
1476    CARD8 reqType;
1477    BOOL ownerEvents;
1478    CARD16 length B16;
1479    Window grabWindow B32;
1480    Time time B32;
1481    BYTE pointerMode, keyboardMode;
1482    CARD16 pad B16;
1483} xGrabKeyboardReq;
1484
1485typedef struct {
1486    CARD8 reqType;
1487    BOOL ownerEvents;
1488    CARD16 length B16;
1489    Window grabWindow B32;
1490    CARD16 modifiers B16;
1491    CARD8 key;
1492    BYTE pointerMode, keyboardMode;
1493    BYTE pad1, pad2, pad3;
1494} xGrabKeyReq;
1495
1496typedef struct {
1497    CARD8 reqType;
1498    CARD8 key;
1499    CARD16 length B16;
1500    Window grabWindow B32;
1501    CARD16 modifiers B16;
1502    CARD16 pad B16;
1503} xUngrabKeyReq;
1504
1505typedef struct {
1506    CARD8 reqType;
1507    CARD8 mode;
1508    CARD16 length B16;
1509    Time time B32;
1510} xAllowEventsReq;
1511
1512typedef struct {
1513    CARD8 reqType;
1514    BYTE pad;
1515    CARD16 length B16;
1516    Window window B32;
1517    Time start B32, stop B32;
1518} xGetMotionEventsReq;
1519
1520typedef struct {
1521    CARD8 reqType;
1522    BYTE pad;
1523    CARD16 length B16;
1524    Window srcWid B32, dstWid B32;
1525    INT16 srcX B16, srcY B16;
1526} xTranslateCoordsReq;
1527
1528typedef struct {
1529    CARD8 reqType;
1530    BYTE pad;
1531    CARD16 length B16;
1532    Window srcWid B32, dstWid B32;
1533    INT16 srcX B16, srcY B16;
1534    CARD16 srcWidth B16, srcHeight B16;
1535    INT16 dstX B16, dstY B16;
1536} xWarpPointerReq;
1537
1538typedef struct {
1539    CARD8 reqType;
1540    CARD8 revertTo;
1541    CARD16 length B16;
1542    Window focus B32;
1543    Time time B32;
1544} xSetInputFocusReq;
1545
1546typedef struct {
1547    CARD8 reqType;
1548    BYTE pad;
1549    CARD16 length B16;
1550    Font fid B32;
1551    CARD16 nbytes B16;
1552    BYTE pad1, pad2;	/* string follows on word boundary */
1553} xOpenFontReq;
1554
1555typedef struct {
1556    CARD8 reqType;
1557    BOOL oddLength;
1558    CARD16 length B16;
1559    Font fid B32;
1560    } xQueryTextExtentsReq;
1561
1562typedef struct {
1563    CARD8 reqType;
1564    BYTE pad;
1565    CARD16 length B16;
1566    CARD16 maxNames B16;
1567    CARD16 nbytes B16;  /* followed immediately by string bytes */
1568} xListFontsReq;
1569
1570typedef xListFontsReq xListFontsWithInfoReq;
1571
1572typedef struct {
1573    CARD8 reqType;
1574    BYTE pad;
1575    CARD16 length B16;
1576    CARD16 nFonts B16;
1577    BYTE pad1, pad2;	/* LISTofSTRING8 follows on word boundary */
1578} xSetFontPathReq;
1579
1580typedef struct {
1581    CARD8 reqType;
1582    CARD8 depth;
1583    CARD16 length B16;
1584    Pixmap pid B32;
1585    Drawable drawable B32;
1586    CARD16 width B16, height B16;
1587} xCreatePixmapReq;
1588
1589typedef struct {
1590    CARD8 reqType;
1591    BYTE pad;
1592    CARD16 length B16;
1593    GContext gc B32;
1594    Drawable drawable B32;
1595    CARD32 mask B32;
1596} xCreateGCReq;
1597
1598typedef struct {
1599    CARD8 reqType;
1600    BYTE pad;
1601    CARD16 length B16;
1602    GContext gc B32;
1603    CARD32 mask B32;
1604} xChangeGCReq;
1605
1606typedef struct {
1607    CARD8 reqType;
1608    BYTE pad;
1609    CARD16 length B16;
1610    GContext srcGC B32, dstGC B32;
1611    CARD32 mask B32;
1612} xCopyGCReq;
1613
1614typedef struct {
1615    CARD8 reqType;
1616    BYTE pad;
1617    CARD16 length B16;
1618    GContext gc B32;
1619    CARD16 dashOffset B16;
1620    CARD16 nDashes B16;        /* length LISTofCARD8 of values following */
1621} xSetDashesReq;
1622
1623typedef struct {
1624    CARD8 reqType;
1625    BYTE ordering;
1626    CARD16 length B16;
1627    GContext gc B32;
1628    INT16 xOrigin B16, yOrigin B16;
1629} xSetClipRectanglesReq;
1630
1631typedef struct {
1632    CARD8 reqType;
1633    BOOL exposures;
1634    CARD16 length B16;
1635    Window window B32;
1636    INT16 x B16, y B16;
1637    CARD16 width B16, height B16;
1638} xClearAreaReq;
1639
1640typedef struct {
1641    CARD8 reqType;
1642    BYTE pad;
1643    CARD16 length B16;
1644    Drawable srcDrawable B32, dstDrawable B32;
1645    GContext gc B32;
1646    INT16 srcX B16, srcY B16, dstX B16, dstY B16;
1647    CARD16 width B16, height B16;
1648} xCopyAreaReq;
1649
1650typedef struct {
1651    CARD8 reqType;
1652    BYTE pad;
1653    CARD16 length B16;
1654    Drawable srcDrawable B32, dstDrawable B32;
1655    GContext gc B32;
1656    INT16 srcX B16, srcY B16, dstX B16, dstY B16;
1657    CARD16 width B16, height B16;
1658    CARD32 bitPlane B32;
1659} xCopyPlaneReq;
1660
1661typedef struct {
1662    CARD8 reqType;
1663    BYTE coordMode;
1664    CARD16 length B16;
1665    Drawable drawable B32;
1666    GContext gc B32;
1667} xPolyPointReq;
1668
1669typedef xPolyPointReq xPolyLineReq;  /* same request structure */
1670
1671/* The following used for PolySegment, PolyRectangle, PolyArc, PolyFillRectangle, PolyFillArc */
1672
1673typedef struct {
1674    CARD8 reqType;
1675    BYTE pad;
1676    CARD16 length B16;
1677    Drawable drawable B32;
1678    GContext gc B32;
1679} xPolySegmentReq;
1680
1681typedef xPolySegmentReq xPolyArcReq;
1682typedef xPolySegmentReq xPolyRectangleReq;
1683typedef xPolySegmentReq xPolyFillRectangleReq;
1684typedef xPolySegmentReq xPolyFillArcReq;
1685
1686typedef struct _FillPolyReq {
1687    CARD8 reqType;
1688    BYTE pad;
1689    CARD16 length B16;
1690    Drawable drawable B32;
1691    GContext gc B32;
1692    BYTE shape;
1693    BYTE coordMode;
1694    CARD16 pad1 B16;
1695} xFillPolyReq;
1696
1697
1698typedef struct _PutImageReq {
1699    CARD8 reqType;
1700    CARD8 format;
1701    CARD16 length B16;
1702    Drawable drawable B32;
1703    GContext gc B32;
1704    CARD16 width B16, height B16;
1705    INT16 dstX B16, dstY B16;
1706    CARD8 leftPad;
1707    CARD8 depth;
1708    CARD16 pad B16;
1709} xPutImageReq;
1710
1711typedef struct {
1712    CARD8 reqType;
1713    CARD8 format;
1714    CARD16 length B16;
1715    Drawable drawable B32;
1716    INT16 x B16, y B16;
1717    CARD16 width B16, height B16;
1718    CARD32 planeMask B32;
1719} xGetImageReq;
1720
1721/* the following used by PolyText8 and PolyText16 */
1722
1723typedef struct {
1724    CARD8 reqType;
1725    CARD8 pad;
1726    CARD16 length B16;
1727    Drawable drawable B32;
1728    GContext gc B32;
1729    INT16 x B16, y B16;		/* items (xTextElt) start after struct */
1730} xPolyTextReq;
1731
1732typedef xPolyTextReq xPolyText8Req;
1733typedef xPolyTextReq xPolyText16Req;
1734
1735typedef struct {
1736    CARD8 reqType;
1737    BYTE nChars;
1738    CARD16 length B16;
1739    Drawable drawable B32;
1740    GContext gc B32;
1741    INT16 x B16, y B16;
1742} xImageTextReq;
1743
1744typedef xImageTextReq xImageText8Req;
1745typedef xImageTextReq xImageText16Req;
1746
1747typedef struct {
1748    CARD8 reqType;
1749    BYTE alloc;
1750    CARD16 length B16;
1751    Colormap mid B32;
1752    Window window B32;
1753    VisualID visual B32;
1754} xCreateColormapReq;
1755
1756typedef struct {
1757    CARD8 reqType;
1758    BYTE pad;
1759    CARD16 length B16;
1760    Colormap mid B32;
1761    Colormap srcCmap B32;
1762} xCopyColormapAndFreeReq;
1763
1764typedef struct {
1765    CARD8 reqType;
1766    BYTE pad;
1767    CARD16 length B16;
1768    Colormap cmap B32;
1769    CARD16 red B16, green B16, blue B16;
1770    CARD16 pad2 B16;
1771} xAllocColorReq;
1772
1773typedef struct {
1774    CARD8 reqType;
1775    BYTE pad;
1776    CARD16 length B16;
1777    Colormap cmap B32;
1778    CARD16 nbytes B16;  /* followed by structure */
1779    BYTE pad1, pad2;
1780} xAllocNamedColorReq;
1781
1782typedef struct {
1783    CARD8 reqType;
1784    BOOL contiguous;
1785    CARD16 length B16;
1786    Colormap cmap B32;
1787    CARD16 colors B16, planes B16;
1788} xAllocColorCellsReq;
1789
1790typedef struct {
1791    CARD8 reqType;
1792    BOOL contiguous;
1793    CARD16 length B16;
1794    Colormap cmap B32;
1795    CARD16 colors B16, red B16, green B16, blue B16;
1796} xAllocColorPlanesReq;
1797
1798typedef struct {
1799    CARD8 reqType;
1800    BYTE pad;
1801    CARD16 length B16;
1802    Colormap cmap B32;
1803    CARD32 planeMask B32;
1804} xFreeColorsReq;
1805
1806typedef struct {
1807    CARD8 reqType;
1808    BYTE pad;
1809    CARD16 length B16;
1810    Colormap cmap B32;
1811} xStoreColorsReq;
1812
1813typedef struct {
1814    CARD8 reqType;
1815    CARD8 flags;   /* DoRed, DoGreen, DoBlue, as in xColorItem */
1816    CARD16 length B16;
1817    Colormap cmap B32;
1818    CARD32 pixel B32;
1819    CARD16 nbytes B16;  /* number of name string bytes following structure */
1820    BYTE pad1, pad2;
1821    } xStoreNamedColorReq;
1822
1823typedef struct {
1824    CARD8 reqType;
1825    BYTE pad;
1826    CARD16 length B16;
1827    Colormap cmap B32;
1828} xQueryColorsReq;
1829
1830typedef struct {    /* followed  by string of length len */
1831    CARD8 reqType;
1832    BYTE pad;
1833    CARD16 length B16;
1834    Colormap cmap B32;
1835    CARD16 nbytes B16;  /* number of string bytes following structure*/
1836    BYTE pad1, pad2;
1837} xLookupColorReq;
1838
1839typedef struct {
1840    CARD8 reqType;
1841    BYTE pad;
1842    CARD16 length B16;
1843    Cursor cid B32;
1844    Pixmap source B32, mask B32;
1845    CARD16 foreRed B16, foreGreen B16, foreBlue B16;
1846    CARD16 backRed B16, backGreen B16, backBlue B16;
1847    CARD16 x B16, y B16;
1848} xCreateCursorReq;
1849
1850typedef struct {
1851    CARD8 reqType;
1852    BYTE pad;
1853    CARD16 length B16;
1854    Cursor cid B32;
1855    Font source B32, mask B32;
1856    CARD16 sourceChar B16, maskChar B16;
1857    CARD16 foreRed B16, foreGreen B16, foreBlue B16;
1858    CARD16 backRed B16, backGreen B16, backBlue B16;
1859} xCreateGlyphCursorReq;
1860
1861typedef struct {
1862    CARD8 reqType;
1863    BYTE pad;
1864    CARD16 length B16;
1865    Cursor cursor B32;
1866    CARD16 foreRed B16, foreGreen B16, foreBlue B16;
1867    CARD16 backRed B16, backGreen B16, backBlue B16;
1868} xRecolorCursorReq;
1869
1870typedef struct {
1871    CARD8 reqType;
1872#if defined(__cplusplus) || defined(c_plusplus)
1873    CARD8 c_class;
1874#else
1875    CARD8 class;
1876#endif
1877    CARD16 length B16;
1878    Drawable drawable B32;
1879    CARD16 width B16, height B16;
1880} xQueryBestSizeReq;
1881
1882typedef struct {
1883    CARD8 reqType;
1884    BYTE pad;
1885    CARD16 length B16;
1886    CARD16 nbytes B16;  /* number of string bytes following structure */
1887    BYTE pad1, pad2;
1888} xQueryExtensionReq;
1889
1890typedef struct {
1891    CARD8   reqType;
1892    CARD8   numKeyPerModifier;
1893    CARD16  length B16;
1894} xSetModifierMappingReq;
1895
1896typedef struct {
1897    CARD8 reqType;
1898    CARD8 nElts;  /* how many elements in the map */
1899    CARD16 length B16;
1900} xSetPointerMappingReq;
1901
1902typedef struct {
1903    CARD8 reqType;
1904    BYTE pad;
1905    CARD16 length B16;
1906    KeyCode firstKeyCode;
1907    CARD8 count;
1908    CARD16 pad1 B16;
1909} xGetKeyboardMappingReq;
1910
1911typedef struct {
1912    CARD8 reqType;
1913    CARD8 keyCodes;
1914    CARD16 length B16;
1915    KeyCode firstKeyCode;
1916    CARD8 keySymsPerKeyCode;
1917    CARD16 pad1 B16;
1918} xChangeKeyboardMappingReq;
1919
1920typedef struct {
1921    CARD8 reqType;
1922    BYTE pad;
1923    CARD16 length B16;
1924    CARD32 mask B32;
1925} xChangeKeyboardControlReq;
1926
1927typedef struct {
1928    CARD8 reqType;
1929    INT8 percent;  /* -100 to 100 */
1930    CARD16 length B16;
1931} xBellReq;
1932
1933typedef struct {
1934    CARD8 reqType;
1935    BYTE pad;
1936    CARD16 length B16;
1937    INT16 accelNum B16, accelDenum B16;
1938    INT16 threshold B16;
1939    BOOL doAccel, doThresh;
1940} xChangePointerControlReq;
1941
1942typedef struct {
1943    CARD8 reqType;
1944    BYTE pad;
1945    CARD16 length B16;
1946    INT16 timeout B16, interval B16;
1947    BYTE preferBlank, allowExpose;
1948    CARD16 pad2 B16;
1949} xSetScreenSaverReq;
1950
1951typedef struct {
1952    CARD8 reqType;
1953    BYTE mode;
1954    CARD16 length B16;
1955    CARD8 hostFamily;
1956    BYTE pad;
1957    CARD16 hostLength B16;
1958} xChangeHostsReq;
1959
1960typedef struct {
1961    CARD8 reqType;
1962    BYTE pad;
1963    CARD16 length B16;
1964    } xListHostsReq;
1965
1966typedef struct {
1967    CARD8 reqType;
1968    BYTE mode;
1969    CARD16 length B16;
1970    } xChangeModeReq;
1971
1972typedef xChangeModeReq xSetAccessControlReq;
1973typedef xChangeModeReq xSetCloseDownModeReq;
1974typedef xChangeModeReq xForceScreenSaverReq;
1975
1976typedef struct { /* followed by LIST of ATOM */
1977    CARD8 reqType;
1978    BYTE pad;
1979    CARD16 length B16;
1980    Window window B32;
1981    CARD16 nAtoms B16;
1982    INT16 nPositions B16;
1983    } xRotatePropertiesReq;
1984
1985
1986
1987/* Reply codes */
1988
1989#define X_Reply		1		/* Normal reply */
1990#define X_Error		0		/* Error */
1991
1992/* Request codes */
1993
1994#define X_CreateWindow                  1
1995#define X_ChangeWindowAttributes        2
1996#define X_GetWindowAttributes           3
1997#define X_DestroyWindow                 4
1998#define X_DestroySubwindows             5
1999#define X_ChangeSaveSet                 6
2000#define X_ReparentWindow                7
2001#define X_MapWindow                     8
2002#define X_MapSubwindows                 9
2003#define X_UnmapWindow                  10
2004#define X_UnmapSubwindows              11
2005#define X_ConfigureWindow              12
2006#define X_CirculateWindow              13
2007#define X_GetGeometry                  14
2008#define X_QueryTree                    15
2009#define X_InternAtom                   16
2010#define X_GetAtomName                  17
2011#define X_ChangeProperty               18
2012#define X_DeleteProperty               19
2013#define X_GetProperty                  20
2014#define X_ListProperties               21
2015#define X_SetSelectionOwner            22
2016#define X_GetSelectionOwner            23
2017#define X_ConvertSelection             24
2018#define X_SendEvent                    25
2019#define X_GrabPointer                  26
2020#define X_UngrabPointer                27
2021#define X_GrabButton                   28
2022#define X_UngrabButton                 29
2023#define X_ChangeActivePointerGrab      30
2024#define X_GrabKeyboard                 31
2025#define X_UngrabKeyboard               32
2026#define X_GrabKey                      33
2027#define X_UngrabKey                    34
2028#define X_AllowEvents                  35
2029#define X_GrabServer                   36
2030#define X_UngrabServer                 37
2031#define X_QueryPointer                 38
2032#define X_GetMotionEvents              39
2033#define X_TranslateCoords              40
2034#define X_WarpPointer                  41
2035#define X_SetInputFocus                42
2036#define X_GetInputFocus                43
2037#define X_QueryKeymap                  44
2038#define X_OpenFont                     45
2039#define X_CloseFont                    46
2040#define X_QueryFont                    47
2041#define X_QueryTextExtents             48
2042#define X_ListFonts                    49
2043#define X_ListFontsWithInfo    	       50
2044#define X_SetFontPath                  51
2045#define X_GetFontPath                  52
2046#define X_CreatePixmap                 53
2047#define X_FreePixmap                   54
2048#define X_CreateGC                     55
2049#define X_ChangeGC                     56
2050#define X_CopyGC                       57
2051#define X_SetDashes                    58
2052#define X_SetClipRectangles            59
2053#define X_FreeGC                       60
2054#define X_ClearArea                    61
2055#define X_CopyArea                     62
2056#define X_CopyPlane                    63
2057#define X_PolyPoint                    64
2058#define X_PolyLine                     65
2059#define X_PolySegment                  66
2060#define X_PolyRectangle                67
2061#define X_PolyArc                      68
2062#define X_FillPoly                     69
2063#define X_PolyFillRectangle            70
2064#define X_PolyFillArc                  71
2065#define X_PutImage                     72
2066#define X_GetImage                     73
2067#define X_PolyText8                    74
2068#define X_PolyText16                   75
2069#define X_ImageText8                   76
2070#define X_ImageText16                  77
2071#define X_CreateColormap               78
2072#define X_FreeColormap                 79
2073#define X_CopyColormapAndFree          80
2074#define X_InstallColormap              81
2075#define X_UninstallColormap            82
2076#define X_ListInstalledColormaps       83
2077#define X_AllocColor                   84
2078#define X_AllocNamedColor              85
2079#define X_AllocColorCells              86
2080#define X_AllocColorPlanes             87
2081#define X_FreeColors                   88
2082#define X_StoreColors                  89
2083#define X_StoreNamedColor              90
2084#define X_QueryColors                  91
2085#define X_LookupColor                  92
2086#define X_CreateCursor                 93
2087#define X_CreateGlyphCursor            94
2088#define X_FreeCursor                   95
2089#define X_RecolorCursor                96
2090#define X_QueryBestSize                97
2091#define X_QueryExtension               98
2092#define X_ListExtensions               99
2093#define X_ChangeKeyboardMapping        100
2094#define X_GetKeyboardMapping           101
2095#define X_ChangeKeyboardControl        102
2096#define X_GetKeyboardControl           103
2097#define X_Bell                         104
2098#define X_ChangePointerControl         105
2099#define X_GetPointerControl            106
2100#define X_SetScreenSaver               107
2101#define X_GetScreenSaver               108
2102#define X_ChangeHosts                  109
2103#define X_ListHosts                    110
2104#define X_SetAccessControl             111
2105#define X_SetCloseDownMode             112
2106#define X_KillClient                   113
2107#define X_RotateProperties	       114
2108#define X_ForceScreenSaver	       115
2109#define X_SetPointerMapping            116
2110#define X_GetPointerMapping            117
2111#define X_SetModifierMapping	       118
2112#define X_GetModifierMapping	       119
2113#define X_NoOperation                  127
2114
2115/* restore these definitions back to the typedefs in X.h */
2116#undef Window
2117#undef Drawable
2118#undef Font
2119#undef Pixmap
2120#undef Cursor
2121#undef Colormap
2122#undef GContext
2123#undef Atom
2124#undef VisualID
2125#undef Time
2126#undef KeyCode
2127#undef KeySym
2128
2129#endif /* XPROTO_H */
2130