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