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