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