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