1 module x11.X;
2 import core.stdc.config;
3 
4 extern (C) nothrow:
5 
6 const uint X_PROTOCOL           = 11;   /* current protocol version */
7 const uint X_PROTOCOL_REVISION  = 0;    /* current minor version    */
8 
9 alias c_ulong XID;
10 alias c_ulong Mask;
11 alias c_ulong Atom;
12 alias c_ulong VisualID;
13 alias c_ulong Time;
14 alias XID   Window;
15 alias XID   Drawable;
16 alias XID   Font;
17 alias XID   Pixmap;
18 alias XID   Cursor;
19 alias XID   Colormap;
20 alias XID   GContext;
21 alias XID   KeySym;
22 alias ubyte KeyCode;
23 
24 /*****************************************************************
25  * RESERVED RESOURCE AND CONSTANT DEFINITIONS
26  *****************************************************************/
27 const XID       None            = 0;    /* universal null resource or null atom                                             */
28 const XID       ParentRelative  = 1;    /* background pixmap in CreateWindow and ChangeWindowAttributes                     */
29 const XID       CopyFromParent  = 0;    /* border pixmap in CreateWindow and ChangeWindowAttributes special VisualID and
30                                        special window class passed to CreateWindow                                      */
31 
32 const Window    PointerWindow   = 0;    /* destination window in SendEvent                                              */
33 const Window    InputFocus      = 1;    /* destination window in SendEvent                                              */
34 const Window    PointerRoot     = 1;    /* focus window in SetInputFocus                                                */
35 const Atom      AnyPropertyType = 0;    /* special Atom, passed to GetProperty                                          */
36 const KeyCode   AnyKey          = 0;    /* special Key Code, passed to GrabKey                                          */
37 const c_long    AnyButton       = 0;    /* special Button Code, passed to GrabButton                                    */
38 const XID       AllTemporary    = 0;    /* special Resource ID passed to KillClient                                     */
39 const Time      CurrentTime     = 0;    /* special Time                                                                 */
40 const KeySym    NoSymbol        = 0;    /* special KeySym                                                               */
41 
42 /*****************************************************************
43  * EVENT DEFINITIONS
44  *****************************************************************/
45 
46 /* Input Event Masks. Used as event-mask window attribute and as arguments
47    to Grab requests.  Not to be confused with event names.  */
48 
49 enum {
50     NoEventMask             = 0,
51     KeyPressMask            = 1<<0,
52     KeyReleaseMask          = 1<<1,
53     ButtonPressMask         = 1<<2,
54     ButtonReleaseMask       = 1<<3,
55     EnterWindowMask         = 1<<4,
56     LeaveWindowMask         = 1<<5,
57     PointerMotionMask       = 1<<6,
58     PointerMotionHintMask   = 1<<7,
59     Button1MotionMask       = 1<<8,
60     Button2MotionMask       = 1<<9,
61     Button3MotionMask       = 1<<10,
62     Button4MotionMask       = 1<<11,
63     Button5MotionMask       = 1<<12,
64     ButtonMotionMask        = 1<<13,
65     KeymapStateMask         = 1<<14,
66     ExposureMask            = 1<<15,
67     VisibilityChangeMask    = 1<<16,
68     StructureNotifyMask     = 1<<17,
69     ResizeRedirectMask      = 1<<18,
70     SubstructureNotifyMask  = 1<<19,
71     SubstructureRedirectMask= 1<<20,
72     FocusChangeMask         = 1<<21,
73     PropertyChangeMask      = 1<<22,
74     ColormapChangeMask      = 1<<23,
75     OwnerGrabButtonMask     = 1<<24
76 }
77 
78 /* Event names.  Used in "type" field in XEvent structures.  Not to be
79 confused with event masks above.  They start from 2 because 0 and 1
80 are reserved in the protocol for errors and replies. */
81 
82 enum {
83     KeyPress            = 2,
84     KeyRelease          = 3,
85     ButtonPress         = 4,
86     ButtonRelease       = 5,
87     MotionNotify        = 6,
88     EnterNotify         = 7,
89     LeaveNotify         = 8,
90     FocusIn             = 9,
91     FocusOut            = 10,
92     KeymapNotify        = 11,
93     Expose              = 12,
94     GraphicsExpose      = 13,
95     NoExpose            = 14,
96     VisibilityNotify    = 15,
97     CreateNotify        = 16,
98     DestroyNotify       = 17,
99     UnmapNotify         = 18,
100     MapNotify           = 19,
101     MapRequest          = 20,
102     ReparentNotify      = 21,
103     ConfigureNotify     = 22,
104     ConfigureRequest    = 23,
105     GravityNotify       = 24,
106     ResizeRequest       = 25,
107     CirculateNotify     = 26,
108     CirculateRequest    = 27,
109     PropertyNotify      = 28,
110     SelectionClear      = 29,
111     SelectionRequest    = 30,
112     SelectionNotify     = 31,
113     ColormapNotify      = 32,
114     ClientMessage       = 33,
115     MappingNotify       = 34,
116     GenericEvent        = 35,
117     LASTEvent           = 36 /* must be bigger than any event # */
118 }
119 
120 /* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer,
121    state in various key-, mouse-, and button-related events. */
122 
123 enum {
124     ShiftMask   = 1<<0,
125     LockMask    = 1<<1,
126     ControlMask = 1<<2,
127     Mod1Mask    = 1<<3,
128     Mod2Mask    = 1<<4,
129     Mod3Mask    = 1<<5,
130     Mod4Mask    = 1<<6,
131     Mod5Mask    = 1<<7
132 }
133 /* modifier names.  Used to build a SetModifierMapping request or
134    to read a GetModifierMapping request.  These correspond to the
135    masks defined above. */
136 
137 enum {
138     ShiftMapIndex   = 0,
139     LockMapIndex    = 1,
140     ControlMapIndex = 2,
141     Mod1MapIndex    = 3,
142     Mod2MapIndex    = 4,
143     Mod3MapIndex    = 5,
144     Mod4MapIndex    = 6,
145     Mod5MapIndex    = 7
146 }
147 
148 /* button masks.  Used in same manner as Key masks above. Not to be confused
149    with button names below. */
150 
151 enum {
152     Button1Mask = 1<<8,
153     Button2Mask = 1<<9,
154     Button3Mask = 1<<10,
155     Button4Mask = 1<<11,
156     Button5Mask = 1<<12,
157     AnyModifier = 1<<15 /* used in GrabButton, GrabKey */
158 }
159 
160 enum {
161     ShiftMap    = 1<<0,
162     LockMap     = 1<<1,
163     ControlMap  = 1<<2,
164     Mod1Map     = 1<<3,
165     Mod2Map     = 1<<4,
166     Mod3Map     = 1<<5,
167     Mod4Map     = 1<<6,
168     Mod5Map     = 1<<7,
169 }
170 
171 /* button names. Used as arguments to GrabButton and as detail in ButtonPress
172    and ButtonRelease events.  Not to be confused with button masks above.
173    Note that 0 is already defined above as "AnyButton".  */
174 
175 enum {
176     Button1 = 1,
177     Button2 = 2,
178     Button3 = 3,
179     Button4 = 4,
180     Button5 = 5
181 }
182 
183 /* Notify modes */
184 enum {
185     NotifyNormal        = 0,
186     NotifyGrab          = 1,
187     NotifyUngrab        = 2,
188     NotifyWhileGrabbed  = 3
189 }
190 const int NotifyHint    = 1; /* for MotionNotify events */
191 
192 /* Notify detail */
193 enum {
194     NotifyAncestor          = 0,
195     NotifyVirtual           = 1,
196     NotifyInferior          = 2,
197     NotifyNonlinear         = 3,
198     NotifyNonlinearVirtual  = 4,
199     NotifyPointer           = 5,
200     NotifyPointerRoot       = 6,
201     NotifyDetailNone        = 7
202 }
203 
204 /* Visibility notify */
205 
206 enum {
207     VisibilityUnobscured        = 0,
208     VisibilityPartiallyObscured = 1,
209     VisibilityFullyObscured     = 2
210 }
211 
212 /* Circulation request */
213 enum {
214     PlaceOnTop      = 0,
215     PlaceOnBottom   = 1
216 }
217 
218 /* protocol families */
219 enum {
220     FamilyInternet          = 0, /* IPv4 */
221     FamilyDECnet            = 1,
222     FamilyChaos             = 2,
223     FamilyServerInterpreted = 5, /* authentication families not tied to a specific protocol */
224     FamilyInternet6         = 6  /* IPv6 */
225 }
226 
227 /* Property notification */
228 enum {
229     PropertyNewValue    = 0,
230     PropertyDelete      = 1
231 }
232 
233 /* Color Map notification */
234 enum {
235     ColormapUninstalled = 0,
236     ColormapInstalled   = 1
237 }
238 
239 /* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */
240 enum {
241     GrabModeSync    = 0,
242     GrabModeAsync   = 1
243 }
244 
245 /* GrabPointer, GrabKeyboard reply status */
246 enum {
247     GrabSuccess         = 0,
248     AlreadyGrabbed      = 1,
249     GrabInvalidTime     = 2,
250     GrabNotViewable     = 3,
251     GrabFrozen          = 4
252 }
253 
254 /* AllowEvents modes */
255 enum {
256     AsyncPointer    = 0,
257     SyncPointer     = 1,
258     ReplayPointer   = 2,
259     AsyncKeyboard   = 3,
260     SyncKeyboard    = 4,
261     ReplayKeyboard  = 5,
262     AsyncBoth       = 6,
263     SyncBoth        = 7
264 }
265 
266 /* Used in SetInputFocus, GetInputFocus */
267 enum {
268     RevertToNone        = None,
269     RevertToPointerRoot = PointerRoot,
270     RevertToParent      = 2
271 }
272 
273 /*****************************************************************
274  * ERROR CODES
275  *****************************************************************/
276 
277 enum XErrorCode:int
278 {
279     Success             = 0,    /* everything's okay                        */
280     BadRequest          = 1,    /* bad request code                         */
281     BadValue            = 2,    /* int parameter out of range               */
282     BadWindow           = 3,    /* parameter not a Window                   */
283     BadPixmap           = 4,    /* parameter not a Pixmap                   */
284     BadAtom             = 5,    /* parameter not an Atom                    */
285     BadCursor           = 6,    /* parameter not a Cursor                   */
286     BadFont             = 7,    /* parameter not a Font                     */
287     BadMatch            = 8,    /* parameter mismatch                       */
288     BadDrawable         = 9,    /* parameter not a Pixmap or Window         */
289     BadAccess           = 10,   /* depending on context:
290                                    - key/button already grabbed
291                                    - attempt to free an illegal
292                                        cmap entry
293                                    - attempt to store into a read-only
294                                        color map entry.
295                                    - attempt to modify the access control
296                                        list from other than the local host. */
297     BadAlloc            = 11,   /* insufficient resources                   */
298     BadColor            = 12,   /* no such colormap                         */
299     BadGC               = 13,   /* parameter not a GC                       */
300     BadIDChoice         = 14,   /* choice not in range or already used      */
301     BadName             = 15,   /* font or color name doesn't exist         */
302     BadLength           = 16,   /* Request length incorrect                 */
303     BadImplementation   = 17,   /* server is defective                      */
304 
305     FirstExtensionError = 128,
306     LastExtensionError  = 255
307 }
308 /*****************************************************************
309  * WINDOW DEFINITIONS
310  *****************************************************************/
311 
312 /* Window classes used by CreateWindow                      */
313 /* Note that CopyFromParent is already defined as 0 above   */
314 
315 enum {
316     InputOutput     = 1,
317     InputOnly       = 2
318 }
319 
320 /* Window attributes for CreateWindow and ChangeWindowAttributes */
321 enum {
322     CWBackPixmap        = 1<<0,
323     CWBackPixel         = 1<<1,
324     CWBorderPixmap      = 1<<2,
325     CWBorderPixel       = 1<<3,
326     CWBitGravity        = 1<<4,
327     CWWinGravity        = 1<<5,
328     CWBackingStore      = 1<<6,
329     CWBackingPlanes     = 1<<7,
330     CWBackingPixel      = 1<<8,
331     CWOverrideRedirect  = 1<<9,
332     CWSaveUnder         = 1<<10,
333     CWEventMask         = 1<<11,
334     CWDontPropagate     = 1<<12,
335     CWColormap          = 1<<13,
336     CWCursor            = 1<<14
337 }
338 
339 /* ConfigureWindow structure */
340 enum {
341     CWX             = 1<<0,
342     CWY             = 1<<1,
343     CWWidth         = 1<<2,
344     CWHeight        = 1<<3,
345     CWBorderWidth   = 1<<4,
346     CWSibling       = 1<<5,
347     CWStackMode     = 1<<6
348 }
349 /* Bit Gravity */
350 enum {
351     ForgetGravity       = 0,
352     NorthWestGravity    = 1,
353     NorthGravity        = 2,
354     NorthEastGravity    = 3,
355     WestGravity         = 4,
356     CenterGravity       = 5,
357     EastGravity         = 6,
358     SouthWestGravity    = 7,
359     SouthGravity        = 8,
360     SouthEastGravity    = 9,
361     StaticGravity       = 10
362 }
363 
364 /* Window gravity + bit gravity above */
365 
366 const uint UnmapGravity= 0;
367 
368 /* Used in CreateWindow for backing-store hint */
369 enum {
370     NotUseful   = 0,
371     WhenMapped  = 1,
372     Always      = 2
373 }
374 /* Used in GetWindowAttributes reply */
375 enum {
376     IsUnmapped      = 0,
377     IsUnviewable    = 1,
378     IsViewable      = 2
379 }
380 /* Used in ChangeSaveSet */
381 enum {
382     SetModeInsert   = 0,
383     SetModeDelete   = 1
384 }
385 /* Used in ChangeCloseDownMode */
386 enum CloseDownMode:int
387 {
388     DestroyAll      = 0,
389     RetainPermanent = 1,
390     RetainTemporary = 2
391 }
392 
393 /* Window stacking method (in configureWindow) */
394 enum {
395     Above       = 0,
396     Below       = 1,
397     TopIf       = 2,
398     BottomIf    = 3,
399     Opposite    = 4
400 }
401 
402 /* Circulation direction */
403 enum {
404     RaiseLowest     = 0,
405     LowerHighest    = 1
406 }
407 
408 /* Property modes */
409 enum {
410     PropModeReplace = 0,
411     PropModePrepend = 1,
412     PropModeAppend  = 2
413 }
414 /*****************************************************************
415  * GRAPHICS DEFINITIONS
416  *****************************************************************/
417 
418 /* graphics functions, as in GC.alu */
419 enum {
420     GXclear         = 0x0,       /* 0 */
421     GXand           = 0x1,       /* src AND dst */
422     GXandReverse    = 0x2,       /* src AND NOT dst */
423     GXcopy          = 0x3,       /* src */
424     GXandInverted   = 0x4,       /* NOT src AND dst */
425     GXnoop          = 0x5,       /* dst */
426     GXxor           = 0x6,       /* src XOR dst */
427     GXor            = 0x7,       /* src OR dst */
428     GXnor           = 0x8,       /* NOT src AND NOT dst */
429     GXequiv         = 0x9,       /* NOT src XOR dst */
430     GXinvert        = 0xa,       /* NOT dst */
431     GXorReverse     = 0xb,       /* src OR NOT dst */
432     GXcopyInverted  = 0xc,       /* NOT src */
433     GXorInverted    = 0xd,       /* NOT src OR dst */
434     GXnand          = 0xe,       /* NOT src OR NOT dst */
435     GXset           = 0xf        /* 1 */
436 }
437 
438 /* LineStyle */
439 enum {
440     LineSolid       = 0,
441     LineOnOffDash   = 1,
442     LineDoubleDash  = 2
443 }
444 /* capStyle */
445 enum {
446     CapNotLast      = 0,
447     CapButt         = 1,
448     CapRound        = 2,
449     CapProjecting   = 3
450 }
451 /* joinStyle */
452 enum {
453     JoinMiter       = 0,
454     JoinRound       = 1,
455     JoinBevel       = 2
456 }
457 /* fillStyle */
458 enum {
459     FillSolid           = 0,
460     FillTiled           = 1,
461     FillStippled        = 2,
462     FillOpaqueStippled  = 3
463 }
464 /* fillRule */
465 enum {
466     EvenOddRule     = 0,
467     WindingRule     = 1
468 }
469 /* subwindow mode */
470 enum {
471     ClipByChildren      = 0,
472     IncludeInferiors    = 1
473 }
474 /* SetClipRectangles ordering */
475 enum {
476     Unsorted        = 0,
477     YSorted         = 1,
478     YXSorted        = 2,
479     YXBanded        = 3
480 }
481 /* CoordinateMode for drawing routines */
482 enum {
483     CoordModeOrigin     = 0, /* relative to the origin */
484     CoordModePrevious   = 1  /* relative to previous point */
485 }
486 /* Polygon shapes */
487 enum {
488     Complex         = 0, /* paths may intersect */
489     Nonconvex       = 1, /* no paths intersect, but not convex */
490     Convex          = 2  /* wholly convex */
491 }
492 
493 /* Arc modes for PolyFillArc */
494 enum {
495     ArcChord        = 0, /* join endpoints of arc */
496     ArcPieSlice     = 1  /* join endpoints to center of arc */
497 }
498 /* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into
499    GC.stateChanges */
500 enum {
501     GCFunction          = 1<<0,
502     GCPlaneMask         = 1<<1,
503     GCForeground        = 1<<2,
504     GCBackground        = 1<<3,
505     GCLineWidth         = 1<<4,
506     GCLineStyle         = 1<<5,
507     GCCapStyle          = 1<<6,
508     GCJoinStyle         = 1<<7,
509     GCFillStyle         = 1<<8,
510     GCFillRule          = 1<<9,
511     GCTile              = 1<<10,
512     GCStipple           = 1<<11,
513     GCTileStipXOrigin   = 1<<12,
514     GCTileStipYOrigin   = 1<<13,
515     GCFont              = 1<<14,
516     GCSubwindowMode     = 1<<15,
517     GCGraphicsExposures = 1<<16,
518     GCClipXOrigin       = 1<<17,
519     GCClipYOrigin       = 1<<18,
520     GCClipMask          = 1<<19,
521     GCDashOffset        = 1<<20,
522     GCDashList          = 1<<21,
523     GCArcMode           = 1<<22,
524 }
525 const uint GCLastBit    = 22;
526 /*****************************************************************
527  * FONTS
528  *****************************************************************/
529 
530 /* used in QueryFont -- draw direction */
531 enum {
532     FontLeftToRight     = 0,
533     FontRightToLeft     = 1,
534     FontChange          = 255
535 }
536 /*****************************************************************
537  *  IMAGING
538  *****************************************************************/
539 
540 /* ImageFormat -- PutImage, GetImage */
541 enum {
542     XYBitmap    = 0, /* depth 1, XYFormat */
543     XYPixmap    = 1, /* depth == drawable depth */
544     ZPixmap = 2  /* depth == drawable depth */
545 }
546 
547 /*****************************************************************
548  *  COLOR MAP STUFF
549  *****************************************************************/
550 
551 /* For CreateColormap */
552 enum {
553     AllocNone   = 0, /* create map with no entries */
554     AllocAll    = 1  /* allocate entire map writeable */
555 }
556 
557 /* Flags used in StoreNamedColor, StoreColors */
558 enum {
559     DoRed   = 1<<0,
560     DoGreen = 1<<1,
561     DoBlue  = 1<<2
562 }
563 
564 /*****************************************************************
565  * CURSOR STUFF
566  *****************************************************************/
567 
568 /* QueryBestSize Class */
569 enum {
570     CursorShape     = 0, /* largest size that can be displayed */
571     TileShape       = 1, /* size tiled fastest */
572     StippleShape    = 2  /* size stippled fastest */
573 }
574 
575 /*****************************************************************
576  * KEYBOARD/POINTER STUFF
577  *****************************************************************/
578 
579 enum {
580     AutoRepeatModeOff       = 0,
581     AutoRepeatModeOn        = 1,
582     AutoRepeatModeDefault   = 2
583 }
584 
585 enum {
586     LedModeOff      = 0,
587     LedModeOn       = 1
588 }
589 /* masks for ChangeKeyboardControl */
590 
591 enum {
592     KBKeyClickPercent   = 1<<0,
593     KBBellPercent       = 1<<1,
594     KBBellPitch         = 1<<2,
595     KBBellDuration      = 1<<3,
596     KBLed               = 1<<4,
597     KBLedMode           = 1<<5,
598     KBKey               = 1<<6,
599     KBAutoRepeatMode    = 1<<7
600 }
601 
602 enum {
603     MappingSuccess      = 0,
604     MappingBusy         = 1,
605     MappingFailed       = 2
606 }
607 
608 enum {
609     MappingModifier     = 0,
610     MappingKeyboard     = 1,
611     MappingPointer      = 2
612 }
613 
614 /*****************************************************************
615  * SCREEN SAVER STUFF
616  *****************************************************************/
617 
618 enum {
619     DontPreferBlanking  = 0,
620     PreferBlanking      = 1,
621     DefaultBlanking     = 2
622 }
623 
624 enum {
625     DisableScreenSaver      = 0,
626     DisableScreenInterval   = 0
627 }
628 
629 enum {
630     DontAllowExposures  = 0,
631     AllowExposures      = 1,
632     DefaultExposures    = 2
633 }
634 
635 /* for ForceScreenSaver */
636 
637 enum {
638     ScreenSaverReset    = 0,
639     ScreenSaverActive   = 1
640 }
641 
642 /*****************************************************************
643  * HOSTS AND CONNECTIONS
644  *****************************************************************/
645 
646 /* for ChangeHosts */
647 
648 enum {
649     HostInsert      = 0,
650     HostDelete      = 1
651 }
652 
653 /* for ChangeAccessControl */
654 
655 enum {
656     EnableAccess    = 1,
657     DisableAccess   = 0
658 }
659 
660 /* Display classes  used in opening the connection
661  * Note that the statically allocated ones are even numbered and the
662  * dynamically changeable ones are odd numbered */
663 
664 enum {
665     StaticGray      = 0,
666     GrayScale       = 1,
667     StaticColor     = 2,
668     PseudoColor     = 3,
669     TrueColor       = 4,
670     DirectColor     = 5
671 }
672 
673 /* Byte order  used in imageByteOrder and bitmapBitOrder */
674 
675 enum {
676     LSBFirst        = 0,
677     MSBFirst        = 1
678 }