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