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