1 /// C declarations for the X11 windowing system
2 module glfw3.x11_header;
3 /*
4 I started out using https://github.com/nomad-software/x11/, but I had some problems with it:
5 - many headers GLFW needs were missing
6 - missing @nogc / nothrow annotations
7 - I prefer to not have a dub dependency
8 So I fixed the existing files, added the missing files, concatenated the files, stripped comments,
9 and let Dustmite reduce it a bit (going from 20K lines to 5K), resulting in this single file.
10 Still a bit of a mess, but good enough for compiling GLFW in its current state.
11 */
12 import core.stdc.config: c_ulong, c_long;
13 import core.stdc.stddef: wchar_t;
14 import core.stdc.stdio: fopen;
15 import core.stdc.stdlib: free, malloc, calloc, realloc;
16 
17 extern(C)
18 nothrow:
19 @nogc:
20 
21 const uint X_PROTOCOL = 11;
22 const uint X_PROTOCOL_REVISION = 0;
23 alias XID = c_ulong;
24 alias Mask = XID;
25 alias Atom = XID;
26 alias VisualID = XID;
27 alias Time = XID;
28 alias Window = XID;
29 alias Drawable = XID;
30 alias Font = XID;
31 alias Pixmap = XID;
32 alias Cursor = XID;
33 alias Colormap = XID;
34 alias GContext = XID;
35 alias KeySym = XID;
36 alias KeyCode = ubyte;
37 const XID None = 0;
38 const XID ParentRelative = 1;
39 const XID CopyFromParent = 0;
40 const Window PointerWindow = 0;
41 const Window InputFocus = 1;
42 const Window PointerRoot = 1;
43 const Atom AnyPropertyType = 0;
44 const KeyCode AnyKey = 0;
45 enum c_long AnyButton = 0;
46 const XID AllTemporary = 0;
47 const Time CurrentTime = 0;
48 const KeySym NoSymbol = 0;
49 
50 enum {
51     NoEventMask = 0,
52     KeyPressMask = 1 << 0,
53     KeyReleaseMask = 1 << 1,
54     ButtonPressMask = 1 << 2,
55     ButtonReleaseMask = 1 << 3,
56     EnterWindowMask = 1 << 4,
57     LeaveWindowMask = 1 << 5,
58     PointerMotionMask = 1 << 6,
59     PointerMotionHintMask = 1 << 7,
60     Button1MotionMask = 1 << 8,
61     Button2MotionMask = 1 << 9,
62     Button3MotionMask = 1 << 10,
63     Button4MotionMask = 1 << 11,
64     Button5MotionMask = 1 << 12,
65     ButtonMotionMask = 1 << 13,
66     KeymapStateMask = 1 << 14,
67     ExposureMask = 1 << 15,
68     VisibilityChangeMask = 1 << 16,
69     StructureNotifyMask = 1 << 17,
70     ResizeRedirectMask = 1 << 18,
71     SubstructureNotifyMask = 1 << 19,
72     SubstructureRedirectMask = 1 << 20,
73     FocusChangeMask = 1 << 21,
74     PropertyChangeMask = 1 << 22,
75     ColormapChangeMask = 1 << 23,
76     OwnerGrabButtonMask = 1 << 24
77 }
78 enum {
79     KeyPress = 2,
80     KeyRelease = 3,
81     ButtonPress = 4,
82     ButtonRelease = 5,
83     MotionNotify = 6,
84     EnterNotify = 7,
85     LeaveNotify = 8,
86     FocusIn = 9,
87     FocusOut = 10,
88     KeymapNotify = 11,
89     Expose = 12,
90     GraphicsExpose = 13,
91     NoExpose = 14,
92     VisibilityNotify = 15,
93     CreateNotify = 16,
94     DestroyNotify = 17,
95     UnmapNotify = 18,
96     MapNotify = 19,
97     MapRequest = 20,
98     ReparentNotify = 21,
99     ConfigureNotify = 22,
100     ConfigureRequest = 23,
101     GravityNotify = 24,
102     ResizeRequest = 25,
103     CirculateNotify = 26,
104     CirculateRequest = 27,
105     PropertyNotify = 28,
106     SelectionClear = 29,
107     SelectionRequest = 30,
108     SelectionNotify = 31,
109     ColormapNotify = 32,
110     ClientMessage = 33,
111     MappingNotify = 34,
112     GenericEvent = 35,
113     LASTEvent = 36
114 }
115 enum {
116     ShiftMask = 1 << 0,
117     LockMask = 1 << 1,
118     ControlMask = 1 << 2,
119     Mod1Mask = 1 << 3,
120     Mod2Mask = 1 << 4,
121     Mod3Mask = 1 << 5,
122     Mod4Mask = 1 << 6,
123     Mod5Mask = 1 << 7
124 }
125 enum {
126     ShiftMapIndex = 0,
127     LockMapIndex = 1,
128     ControlMapIndex = 2,
129     Mod1MapIndex = 3,
130     Mod2MapIndex = 4,
131     Mod3MapIndex = 5,
132     Mod4MapIndex = 6,
133     Mod5MapIndex = 7
134 }
135 enum {
136     Button1Mask = 1 << 8,
137     Button2Mask = 1 << 9,
138     Button3Mask = 1 << 10,
139     Button4Mask = 1 << 11,
140     Button5Mask = 1 << 12,
141     AnyModifier = 1 << 15
142 }
143 enum {
144     ShiftMap = 1 << 0,
145     LockMap = 1 << 1,
146     ControlMap = 1 << 2,
147     Mod1Map = 1 << 3,
148     Mod2Map = 1 << 4,
149     Mod3Map = 1 << 5,
150     Mod4Map = 1 << 6,
151     Mod5Map = 1 << 7,
152 }
153 enum {
154     Button1 = 1,
155     Button2 = 2,
156     Button3 = 3,
157     Button4 = 4,
158     Button5 = 5
159 }
160 enum {
161     NotifyNormal = 0,
162     NotifyGrab = 1,
163     NotifyUngrab = 2,
164     NotifyWhileGrabbed = 3
165 }
166 enum int NotifyHint = 1;
167 enum {
168     NotifyAncestor = 0,
169     NotifyVirtual = 1,
170     NotifyInferior = 2,
171     NotifyNonlinear = 3,
172     NotifyNonlinearVirtual = 4,
173     NotifyPointer = 5,
174     NotifyPointerRoot = 6,
175     NotifyDetailNone = 7
176 }
177 enum {
178     VisibilityUnobscured = 0,
179     VisibilityPartiallyObscured = 1,
180     VisibilityFullyObscured = 2
181 }
182 enum {
183     PlaceOnTop = 0,
184     PlaceOnBottom = 1
185 }
186 enum {
187     FamilyInternet = 0,
188     FamilyDECnet = 1,
189     FamilyChaos = 2,
190     FamilyServerInterpreted = 5,
191     FamilyInternet6 = 6
192 }
193 enum {
194     PropertyNewValue = 0,
195     PropertyDelete = 1
196 }
197 enum {
198     ColormapUninstalled = 0,
199     ColormapInstalled = 1
200 }
201 enum {
202     GrabModeSync = 0,
203     GrabModeAsync = 1
204 }
205 enum {
206     GrabSuccess = 0,
207     AlreadyGrabbed = 1,
208     GrabInvalidTime = 2,
209     GrabNotViewable = 3,
210     GrabFrozen = 4
211 }
212 enum {
213     AsyncPointer = 0,
214     SyncPointer = 1,
215     ReplayPointer = 2,
216     AsyncKeyboard = 3,
217     SyncKeyboard = 4,
218     ReplayKeyboard = 5,
219     AsyncBoth = 6,
220     SyncBoth = 7
221 }
222 enum {
223     RevertToNone = None,
224     RevertToPointerRoot = PointerRoot,
225     RevertToParent = 2
226 }
227 enum XErrorCode : int {
228     Success = 0,
229     BadRequest = 1,
230     BadValue = 2,
231     BadWindow = 3,
232     BadPixmap = 4,
233     BadAtom = 5,
234     BadCursor = 6,
235     BadFont = 7,
236     BadMatch = 8,
237     BadDrawable = 9,
238     BadAccess = 10,
239     BadAlloc = 11,
240     BadColor = 12,
241     BadGC = 13,
242     BadIDChoice = 14,
243     BadName = 15,
244     BadLength = 16,
245     BadImplementation = 17,
246     FirstExtensionError = 128,
247     LastExtensionError = 255
248 }
249 
250 enum {
251     InputOutput = 1,
252     InputOnly = 2
253 }
254 enum {
255     CWBackPixmap = 1 << 0,
256     CWBackPixel = 1 << 1,
257     CWBorderPixmap = 1 << 2,
258     CWBorderPixel = 1 << 3,
259     CWBitGravity = 1 << 4,
260     CWWinGravity = 1 << 5,
261     CWBackingStore = 1 << 6,
262     CWBackingPlanes = 1 << 7,
263     CWBackingPixel = 1 << 8,
264     CWOverrideRedirect = 1 << 9,
265     CWSaveUnder = 1 << 10,
266     CWEventMask = 1 << 11,
267     CWDontPropagate = 1 << 12,
268     CWColormap = 1 << 13,
269     CWCursor = 1 << 14
270 }
271 enum {
272     CWX = 1 << 0,
273     CWY = 1 << 1,
274     CWWidth = 1 << 2,
275     CWHeight = 1 << 3,
276     CWBorderWidth = 1 << 4,
277     CWSibling = 1 << 5,
278     CWStackMode = 1 << 6
279 }
280 enum {
281     ForgetGravity = 0,
282     NorthWestGravity = 1,
283     NorthGravity = 2,
284     NorthEastGravity = 3,
285     WestGravity = 4,
286     CenterGravity = 5,
287     EastGravity = 6,
288     SouthWestGravity = 7,
289     SouthGravity = 8,
290     SouthEastGravity = 9,
291     StaticGravity = 10
292 }
293 const uint UnmapGravity = 0;
294 enum {
295     NotUseful = 0,
296     WhenMapped = 1,
297     Always = 2
298 }
299 enum {
300     IsUnmapped = 0,
301     IsUnviewable = 1,
302     IsViewable = 2
303 }
304 enum {
305     SetModeInsert = 0,
306     SetModeDelete = 1
307 }
308 enum CloseDownMode : int {
309     DestroyAll = 0,
310     RetainPermanent = 1,
311     RetainTemporary = 2
312 }
313 enum {
314     Above = 0,
315     Below = 1,
316     TopIf = 2,
317     BottomIf = 3,
318     Opposite = 4
319 }
320 enum {
321     RaiseLowest = 0,
322     LowerHighest = 1
323 }
324 enum {
325     PropModeReplace = 0,
326     PropModePrepend = 1,
327     PropModeAppend = 2
328 }
329 enum {
330     ArcChord = 0,
331     ArcPieSlice = 1
332 }
333 enum {
334     GCFunction = 1 << 0,
335     GCPlaneMask = 1 << 1,
336     GCForeground = 1 << 2,
337     GCBackground = 1 << 3,
338     GCLineWidth = 1 << 4,
339     GCLineStyle = 1 << 5,
340     GCCapStyle = 1 << 6,
341     GCJoinStyle = 1 << 7,
342     GCFillStyle = 1 << 8,
343     GCFillRule = 1 << 9,
344     GCTile = 1 << 10,
345     GCStipple = 1 << 11,
346     GCTileStipXOrigin = 1 << 12,
347     GCTileStipYOrigin = 1 << 13,
348     GCFont = 1 << 14,
349     GCSubwindowMode = 1 << 15,
350     GCGraphicsExposures = 1 << 16,
351     GCClipXOrigin = 1 << 17,
352     GCClipYOrigin = 1 << 18,
353     GCClipMask = 1 << 19,
354     GCDashOffset = 1 << 20,
355     GCDashList = 1 << 21,
356     GCArcMode = 1 << 22,
357 }
358 const uint GCLastBit = 22;
359 enum {
360     FontLeftToRight = 0,
361     FontRightToLeft = 1,
362     FontChange = 255
363 }
364 enum {
365     XYBitmap = 0,
366     XYPixmap = 1,
367     ZPixmap = 2
368 }
369 enum {
370     AllocNone = 0,
371     AllocAll = 1
372 }
373 enum {
374     DoRed = 1 << 0,
375     DoGreen = 1 << 1,
376     DoBlue = 1 << 2
377 }
378 enum {
379     CursorShape = 0,
380     TileShape = 1,
381     StippleShape = 2
382 }
383 enum {
384     AutoRepeatModeOff = 0,
385     AutoRepeatModeOn = 1,
386     AutoRepeatModeDefault = 2
387 }
388 enum {
389     LedModeOff = 0,
390     LedModeOn = 1
391 }
392 enum {
393     KBKeyClickPercent = 1 << 0,
394     KBBellPercent = 1 << 1,
395     KBBellPitch = 1 << 2,
396     KBBellDuration = 1 << 3,
397     KBLed = 1 << 4,
398     KBLedMode = 1 << 5,
399     KBKey = 1 << 6,
400     KBAutoRepeatMode = 1 << 7
401 }
402 enum {
403     MappingSuccess = 0,
404     MappingBusy = 1,
405     MappingFailed = 2
406 }
407 enum {
408     MappingModifier = 0,
409     MappingKeyboard = 1,
410     MappingPointer = 2
411 }
412 enum {
413     DontPreferBlanking = 0,
414     PreferBlanking = 1,
415     DefaultBlanking = 2
416 }
417 enum {
418     DisableScreenSaver = 0,
419     DisableScreenInterval = 0
420 }
421 enum {
422     DontAllowExposures = 0,
423     AllowExposures = 1,
424     DefaultExposures = 2
425 }
426 enum {
427     ScreenSaverReset = 0,
428     ScreenSaverActive = 1
429 }
430 enum {
431     HostInsert = 0,
432     HostDelete = 1
433 }
434 enum {
435     EnableAccess = 1,
436     DisableAccess = 0
437 }
438 enum {
439     StaticGray = 0,
440     GrayScale = 1,
441     StaticColor = 2,
442     PseudoColor = 3,
443     TrueColor = 4,
444     DirectColor = 5
445 }
446 enum {
447     LSBFirst = 0,
448     MSBFirst = 1
449 }
450 struct _XkbAnyEvent {
451     int type;
452     c_ulong serial;
453     Bool send_event;
454     Display* display;
455     Time time;
456     int xkb_type;
457     uint device;
458 }
459 alias _XkbAnyEvent XkbAnyEvent;
460 struct _XkbNewKeyboardNotify {
461     int type;
462     c_ulong serial;
463     Bool send_event;
464     Display* display;
465     Time time;
466     int xkb_type;
467     int device;
468     int old_device;
469     int min_key_code;
470     int max_key_code;
471     int old_min_key_code;
472     int old_max_key_code;
473     uint changed;
474     char req_major;
475     char req_minor;
476 }
477 alias _XkbNewKeyboardNotify XkbNewKeyboardNotifyEvent;
478 struct _XkbMapNotifyEvent {
479     int type;
480     c_ulong serial;
481     Bool send_event;
482     Display* display;
483     Time time;
484     int xkb_type;
485     int device;
486     uint changed;
487     uint flags;
488     int first_type;
489     int num_types;
490     KeyCode min_key_code;
491     KeyCode max_key_code;
492     KeyCode first_key_sym;
493     KeyCode first_key_act;
494     KeyCode first_key_behavior;
495     KeyCode first_key_explicit;
496     KeyCode first_modmap_key;
497     KeyCode first_vmodmap_key;
498     int num_key_syms;
499     int num_key_acts;
500     int num_key_behaviors;
501     int num_key_explicit;
502     int num_modmap_keys;
503     int num_vmodmap_keys;
504     uint vmods;
505 }
506 alias _XkbMapNotifyEvent XkbMapNotifyEvent;
507 struct _XkbStateNotifyEvent {
508     int type;
509     c_ulong serial;
510     Bool send_event;
511     Display* display;
512     Time time;
513     int xkb_type;
514     int device;
515     uint changed;
516     int group;
517     int base_group;
518     int latched_group;
519     int locked_group;
520     uint mods;
521     uint base_mods;
522     uint latched_mods;
523     uint locked_mods;
524     int compat_state;
525     ubyte grab_mods;
526     ubyte compat_grab_mods;
527     ubyte lookup_mods;
528     ubyte compat_lookup_mods;
529     int ptr_buttons;
530     KeyCode keycode;
531     char event_type;
532     char req_major;
533     char req_minor;
534 }
535 alias _XkbStateNotifyEvent XkbStateNotifyEvent;
536 struct _XkbControlsNotify {
537     int type;
538     c_ulong serial;
539     Bool send_event;
540     Display* display;
541     Time time;
542     int xkb_type;
543     int device;
544     uint changed_ctrls;
545     uint enabled_ctrls;
546     uint enabled_ctrl_changes;
547     int num_groups;
548     KeyCode keycode;
549     char event_type;
550     char req_major;
551     char req_minor;
552 }
553 alias _XkbControlsNotify XkbControlsNotifyEvent;
554 struct _XkbIndicatorNotify {
555     int type;
556     c_ulong serial;
557     Bool send_event;
558     Display* display;
559     Time time;
560     int xkb_type;
561     int device;
562     uint changed;
563     uint state;
564 }
565 alias _XkbIndicatorNotify XkbIndicatorNotifyEvent;
566 struct _XkbNamesNotify {
567     int type;
568     c_ulong serial;
569     Bool send_event;
570     Display* display;
571     Time time;
572     int xkb_type;
573     int device;
574     uint changed;
575     int first_type;
576     int num_types;
577     int first_lvl;
578     int num_lvls;
579     int num_aliases;
580     int num_radio_groups;
581     uint changed_vmods;
582     uint changed_groups;
583     uint changed_indicators;
584     int first_key;
585     int num_keys;
586 }
587 alias _XkbNamesNotify XkbNamesNotifyEvent;
588 struct _XkbCompatMapNotify {
589     int type;
590     c_ulong serial;
591     Bool send_event;
592     Display* display;
593     Time time;
594     int xkb_type;
595     int device;
596     uint changed_groups;
597     int first_si;
598     int num_si;
599     int num_total_si;
600 }
601 alias _XkbCompatMapNotify XkbCompatMapNotifyEvent;
602 struct _XkbBellNotify {
603     int type;
604     c_ulong serial;
605     Bool send_event;
606     Display* display;
607     Time time;
608     int xkb_type;
609     int device;
610     int percent;
611     int pitch;
612     int duration;
613     int bell_class;
614     int bell_id;
615     Atom name;
616     Window window;
617     Bool event_only;
618 }
619 alias _XkbBellNotify XkbBellNotifyEvent;
620 struct _XkbActionMessage {
621     int type;
622     c_ulong serial;
623     Bool send_event;
624     Display* display;
625     Time time;
626     int xkb_type;
627     int device;
628     KeyCode keycode;
629     Bool press;
630     Bool key_event_follows;
631     int group;
632     uint mods;
633     char[XkbActionMessageLength + 1] message;
634 }
635 alias _XkbActionMessage XkbActionMessageEvent;
636 struct _XkbAccessXNotify {
637     int type;
638     c_ulong serial;
639     Bool send_event;
640     Display* display;
641     Time time;
642     int xkb_type;
643     int device;
644     int detail;
645     int keycode;
646     int sk_delay;
647     int debounce_delay;
648 }
649 alias _XkbAccessXNotify XkbAccessXNotifyEvent;
650 struct _XkbExtensionDeviceNotify {
651     int type;
652     c_ulong serial;
653     Bool send_event;
654     Display* display;
655     Time time;
656     int xkb_type;
657     int device;
658     uint reason;
659     uint supported;
660     uint unsupported;
661     int first_btn;
662     int num_btns;
663     uint leds_defined;
664     uint led_state;
665     int led_class;
666     int led_id;
667 }
668 alias _XkbExtensionDeviceNotify XkbExtensionDeviceNotifyEvent;
669 union _XkbEvent {
670     int type;
671     XkbAnyEvent any;
672     XkbNewKeyboardNotifyEvent new_kbd;
673     XkbMapNotifyEvent map;
674     XkbStateNotifyEvent state;
675     XkbControlsNotifyEvent ctrls;
676     XkbIndicatorNotifyEvent indicators;
677     XkbNamesNotifyEvent names;
678     XkbCompatMapNotifyEvent compat;
679     XkbBellNotifyEvent bell;
680     XkbActionMessageEvent message;
681     XkbAccessXNotifyEvent accessx;
682     XkbExtensionDeviceNotifyEvent device;
683     XEvent core;
684 }
685 alias _XkbEvent XkbEvent;
686 enum XkbLC_AllComposeControls = 0xc0000000;
687 enum XkbLC_AllControls = 0xc000001f;
688 Bool XkbIgnoreExtension(Bool);
689 Display* XkbOpenDisplay(char*, int*, int*, int*, int*, int*);
690 Bool XkbQueryExtension(Display*, int*, int*, int*, int*, int*);
691 Bool XkbUseExtension(Display*, int*, int*);
692 Bool XkbLibraryVersion(int*, int*);
693 uint XkbSetXlibControls(Display*, uint, uint);
694 uint XkbGetXlibControls(Display*);
695 uint XkbXlibControlsImplemented();
696 alias Atom function(Display*, const(char)*, Bool) XkbInternAtomFunc;
697 alias char* function(Display*, Atom) XkbGetAtomNameFunc;
698 void XkbSetAtomFuncs(XkbInternAtomFunc, XkbGetAtomNameFunc);
699 KeySym XkbKeycodeToKeysym(Display*, KeyCode, int, int);
700 uint XkbKeysymToModifiers(Display*, KeySym);
701 Bool XkbLookupKeySym(Display*, KeyCode, uint, uint*, KeySym*);
702 Bool XkbDeviceBellEvent(Display*, Window, int, int, int, int, Atom);
703 Bool XkbBell(Display*, Window, int, Atom);
704 Bool XkbForceBell(Display*, int);
705 Bool XkbBellEvent(Display*, Window, int, Atom);
706 Bool XkbSelectEvents(Display*, uint, uint, uint);
707 Bool XkbSelectEventDetails(Display*, uint, uint, c_ulong, c_ulong);
708 void XkbNoteMapChanges(XkbMapChangesPtr, XkbMapNotifyEvent*, uint);
709 void XkbNoteNameChanges(XkbNameChangesPtr, XkbNamesNotifyEvent*, uint);
710 Bool XkbSetServerInternalMods(Display*, uint, uint, uint, uint, uint);
711 Bool XkbSetIgnoreLockMods(Display*, uint, uint, uint, uint, uint);
712 Bool XkbVirtualModsToReal(XkbDescPtr, uint, uint*);
713 Bool XkbComputeEffectiveMap(XkbDescPtr, XkbKeyTypePtr, ubyte*);
714 Status XkbInitCanonicalKeyTypes(XkbDescPtr, uint, int);
715 XkbDescPtr XkbAllocKeyboard();
716 void XkbFreeKeyboard(XkbDescPtr, uint, Bool);
717 Status XkbAllocClientMap(XkbDescPtr, uint, uint);
718 Status XkbAllocServerMap(XkbDescPtr, uint, uint);
719 void XkbFreeClientMap(XkbDescPtr, uint, Bool);
720 void XkbFreeServerMap(XkbDescPtr, uint, Bool);
721 XkbKeyTypePtr XkbAddKeyType(XkbDescPtr, Atom, int, Bool, int);
722 Status XkbAllocIndicatorMaps(XkbDescPtr);
723 void XkbFreeIndicatorMaps(XkbDescPtr);
724 XkbDescPtr XkbGetMap(Display*, uint, uint);
725 Status XkbGetUpdatedMap(Display*, uint, XkbDescPtr);
726 Status XkbAllocCompatMap(XkbDescPtr, uint, uint);
727 void XkbFreeCompatMap(XkbDescPtr, uint, Bool);
728 Status XkbGetCompatMap(Display*, uint, XkbDescPtr);
729 Bool XkbSetCompatMap(Display*, uint, XkbDescPtr, Bool);
730 XkbSymInterpretPtr XkbAddSymInterpret(XkbDescPtr, XkbSymInterpretPtr, Bool, XkbChangesPtr);
731 Status XkbAllocNames(XkbDescPtr, uint, int, int);
732 Status XkbGetNames(Display*, uint, XkbDescPtr);
733 Bool XkbSetNames(Display*, uint, uint, uint, XkbDescPtr);
734 Bool XkbChangeNames(Display*, XkbDescPtr, XkbNameChangesPtr);
735 void XkbFreeNames(XkbDescPtr, uint, Bool);
736 Status XkbGetState(Display*, uint, XkbStatePtr);
737 Bool XkbSetMap(Display*, uint, XkbDescPtr);
738 Bool XkbChangeMap(Display*, XkbDescPtr, XkbMapChangesPtr);
739 Bool XkbSetDetectableAutoRepeat(Display*, Bool, Bool*);
740 Bool XkbGetDetectableAutoRepeat(Display*, Bool*);
741 Bool XkbSetDebuggingFlags(Display*, uint, uint, char*, uint, uint, uint*, uint*);
742 Bool XkbApplyVirtualModChanges(XkbDescPtr, uint, XkbChangesPtr);
743 Bool XkbUpdateActionVirtualMods(XkbDescPtr, XkbAction*, uint);
744 void XkbUpdateKeyTypeVirtualMods(XkbDescPtr, XkbKeyTypePtr, uint, XkbChangesPtr);
745 enum XA_PRIMARY = 1;
746 enum XA_SECONDARY = 2;
747 enum XA_ARC = 3;
748 enum XA_ATOM = 4;
749 enum XA_BITMAP = 5;
750 enum XA_CARDINAL = 6;
751 enum XA_COLORMAP = 7;
752 enum XA_CURSOR = 8;
753 enum XA_CUT_BUFFER0 = 9;
754 enum XA_CUT_BUFFER1 = 10;
755 enum XA_CUT_BUFFER2 = 11;
756 enum XA_CUT_BUFFER3 = 12;
757 enum XA_RGB_GREEN_MAP = 29;
758 enum XA_RGB_RED_MAP = 30;
759 enum XA_STRING = 31;
760 enum XA_VISUALID = 32;
761 enum XA_WINDOW = 33;
762 enum XA_WM_COMMAND = 34;
763 enum XA_WM_HINTS = 35;
764 enum XA_WM_CLIENT_MACHINE = 36;
765 alias int XcursorBool;
766 alias uint XcursorUInt;
767 alias XcursorUInt XcursorDim;
768 alias XcursorUInt XcursorPixel;
769 enum XcursorTrue = 1;
770 enum XcursorFalse = 0;
771 enum XCURSOR_MAGIC = 0x72756358;
772 enum XCURSOR_FILE_TOC_LEN = (3 * 4);
773 struct _XcursorFileToc {
774     XcursorUInt type;
775     XcursorUInt subtype;
776     XcursorUInt position;
777 }
778 alias _XcursorFileToc XcursorFileToc;
779 struct _XcursorFileHeader {
780     XcursorUInt magic;
781     XcursorUInt header;
782     XcursorUInt version_;
783     XcursorUInt ntoc;
784     XcursorFileToc* tocs;
785 }
786 alias _XcursorFileHeader XcursorFileHeader;
787 enum XCURSOR_CHUNK_HEADER_LEN = (4 * 4);
788 struct _XcursorChunkHeader {
789     XcursorUInt header;
790     XcursorUInt type;
791     XcursorUInt subtype;
792     XcursorUInt version_;
793 }
794 alias _XcursorChunkHeader XcursorChunkHeader;
795 enum XCURSOR_COMMENT_TYPE = 0xfffe0001;
796 enum XCURSOR_COMMENT_VERSION = 1;
797 enum XCURSOR_COMMENT_HEADER_LEN = (XCURSOR_CHUNK_HEADER_LEN + (1 * 4));
798 enum XCURSOR_COMMENT_COPYRIGHT = 1;
799 enum XCURSOR_COMMENT_LICENSE = 2;
800 enum XCURSOR_COMMENT_OTHER = 3;
801 enum XCURSOR_COMMENT_MAX_LEN = 0x100000;
802 struct _XcursorComment {
803     XcursorUInt version_;
804     XcursorUInt comment_type;
805     char* comment;
806 }
807 alias _XcursorComment XcursorComment;
808 enum XCURSOR_IMAGE_TYPE = 0xfffd0002;
809 enum XCURSOR_IMAGE_VERSION = 1;
810 enum XCURSOR_IMAGE_HEADER_LEN = (XCURSOR_CHUNK_HEADER_LEN + (5 * 4));
811 enum XCURSOR_IMAGE_MAX_SIZE = 0x7fff
812  ;
813 struct _XcursorImage {
814     XcursorUInt version_;
815     XcursorDim size;
816     XcursorDim width;
817     XcursorDim height;
818     XcursorDim xhot;
819     XcursorDim yhot;
820     XcursorUInt delay;
821     XcursorPixel* pixels;
822 }
823 alias _XcursorImage XcursorImage;
824 struct _XcursorImages {
825     int nimage;
826     XcursorImage** images;
827     char* name;
828 }
829 enum int XlibSpecificationRelease = 6;
830 enum int X_HAVE_UTF8_STRING = 1;
831 alias char* XPointer;
832 alias int Status;
833 alias int Bool;
834 enum {
835     False,
836     True
837 }
838 alias int QueueMode;
839 enum {
840     QueuedAlready,
841     QueuedAfterReading,
842     QueuedAfterFlush
843 }
844 int ConnectionNumber(Display* dpy) {
845     return dpy.fd;
846 }
847 Window RootWindow(Display* dpy, int scr) {
848     return ScreenOfDisplay(dpy, scr).root;
849 }
850 int DefaultScreen(Display* dpy) {
851     return dpy.default_screen;
852 }
853 Window DefaultRootWindow(Display* dpy) {
854     return ScreenOfDisplay(dpy, DefaultScreen(dpy)).root;
855 }
856 Visual* DefaultVisual(Display* dpy, int scr) {
857     return ScreenOfDisplay(dpy, scr).root_visual;
858 }
859 GC DefaultGC(Display* dpy, int scr) {
860     return ScreenOfDisplay(dpy, scr).default_gc;
861 }
862 c_ulong BlackPixel(Display* dpy, int scr) {
863     return cast(c_ulong) ScreenOfDisplay(dpy, scr).black_pixel;
864 }
865 c_ulong WhitePixel(Display* dpy, int scr) {
866     return cast(c_ulong) ScreenOfDisplay(dpy, scr).white_pixel;
867 }
868 c_ulong AllPlanes() {
869     return 0xFFFFFFFF;
870 }
871 int QLength(Display* dpy) {
872     return dpy.qlen;
873 }
874 int DisplayWidth(Display* dpy, int scr) {
875     return ScreenOfDisplay(dpy, scr).width;
876 }
877 int DisplayHeight(Display* dpy, int scr) {
878     return ScreenOfDisplay(dpy, scr).height;
879 }
880 int DisplayWidthMM(Display* dpy, int scr) {
881     return ScreenOfDisplay(dpy, scr).mwidth;
882 }
883 int DisplayHeightMM(Display* dpy, int scr) {
884     return ScreenOfDisplay(dpy, scr).mheight;
885 }
886 int DisplayPlanes(Display* dpy, int scr) {
887     return ScreenOfDisplay(dpy, scr).root_depth;
888 }
889 int DisplayCells(Display* dpy, int scr) {
890     return DefaultVisual(dpy, scr).map_entries;
891 }
892 int ScreenCount(Display* dpy) {
893     return dpy.nscreens;
894 }
895 int ProtocolVersion(Display* dpy) {
896     return dpy.proto_major_version;
897 }
898 int ProtocolRevision(Display* dpy) {
899     return dpy.proto_minor_version;
900 }
901 int VendorRelease(Display* dpy) {
902     return dpy.release;
903 }
904 char* DisplayString(Display* dpy) {
905     return dpy.display_name;
906 }
907 int DefaultDepth(Display* dpy, int scr) {
908     return ScreenOfDisplay(dpy, scr).root_depth;
909 }
910 Colormap DefaultColormap(Display* dpy, int scr) {
911     return ScreenOfDisplay(dpy, scr).cmap;
912 }
913 int BitmapUnit(Display* dpy) {
914     return dpy.bitmap_unit;
915 }
916 int BitmapBitOrder(Display* dpy) {
917     return dpy.bitmap_bit_order;
918 }
919 int BitmapPad(Display* dpy) {
920     return dpy.bitmap_pad;
921 }
922 uint NextRequest(Display* dpy) {
923     return cast(uint) dpy.request + 1;
924 }
925 uint LastKnownRequestProcessed(Display* dpy) {
926     return cast(uint) dpy.last_request_read;
927 }
928 Screen* ScreenOfDisplay(Display* dpy, int scr) {
929     return &dpy.screens[scr];
930 }
931 Screen* DefaultScreenOfDisplay(Display* dpy) {
932     return ScreenOfDisplay(dpy, DefaultScreen(dpy));
933 }
934 Display* DisplayOfScreen(Screen* s) {
935     return s.display;
936 }
937 int DoesBackingStore(Screen* s) {
938     return s.backing_store;
939 }
940 c_long EventMaskOfScreen(Screen* s) {
941     return s.root_input_mask;
942 }
943 struct XExtData {
944     int number;
945     XExtData* next;
946     extern(C) nothrow int function(XExtData* extension) free_private;
947     XPointer private_data;
948 }
949 struct XExtCodes {
950     int extension;
951     int major_opcode;
952     int first_event;
953     int first_error;
954 }
955 struct XPixmapFormatValues {
956     int depth;
957     int bits_per_pixel;
958     int scanline_pad;
959 }
960 struct XGCValues {
961     int function_;
962     c_ulong plane_mask;
963     c_ulong foreground;
964     c_ulong background;
965     int line_width;
966     int line_style;
967     int cap_style;
968     int join_style;
969     int fill_style;
970     int fill_rule;
971     int arc_mode;
972     Pixmap tile;
973     Pixmap stipple;
974     int ts_x_origin;
975     int ts_y_origin;
976     Font font;
977     int subwindow_mode;
978     Bool graphics_exposures;
979     int clip_x_origin;
980     int clip_y_origin;
981     Pixmap clip_mask;
982     int dash_offset;
983     char dashes;
984 }
985 alias _XGC* GC;
986 struct Visual {
987     XExtData* ext_data;
988     VisualID visualid;
989     int c_class;
990     c_ulong red_mask, green_mask, blue_mask;
991     int bits_per_rgb;
992     int map_entries;
993 }
994 struct Depth {
995     int depth;
996     int nvisuals;
997     Visual* visuals;
998 }
999 alias Display XDisplay;
1000 struct Screen {
1001     XExtData* ext_data;
1002     XDisplay* display;
1003     Window root;
1004     int width, height;
1005     int mwidth, mheight;
1006     int ndepths;
1007     Depth* depths;
1008     int root_depth;
1009     Visual* root_visual;
1010     GC default_gc;
1011     Colormap cmap;
1012     c_ulong white_pixel;
1013     c_ulong black_pixel;
1014     int max_maps, min_maps;
1015     int backing_store;
1016     Bool save_unders;
1017     c_long root_input_mask;
1018 }
1019 struct ScreenFormat {
1020     XExtData* ext_data;
1021     int depth;
1022     int bits_per_pixel;
1023     int scanline_pad;
1024 }
1025 struct XSetWindowAttributes {
1026     Pixmap background_pixmap;
1027     c_ulong background_pixel;
1028     Pixmap border_pixmap;
1029     c_ulong border_pixel;
1030     int bit_gravity;
1031     int win_gravity;
1032     int backing_store;
1033     c_ulong backing_planes;
1034     c_ulong backing_pixel;
1035     Bool save_under;
1036     c_long event_mask;
1037     c_long do_not_propagate_mask;
1038     Bool override_redirect;
1039     Colormap colormap;
1040     Cursor cursor;
1041 }
1042 struct XWindowAttributes {
1043     int x, y;
1044     int width, height;
1045     int border_width;
1046     int depth;
1047     Visual* visual;
1048     Window root;
1049     int c_class;
1050     int bit_gravity;
1051     int win_gravity;
1052     int backing_store;
1053     c_ulong backing_planes;
1054     c_ulong backing_pixel;
1055     Bool save_under;
1056     Colormap colormap;
1057     Bool map_installed;
1058     int map_state;
1059     c_long all_event_masks;
1060     c_long your_event_mask;
1061     c_long do_not_propagate_mask;
1062     Bool override_redirect;
1063     Screen* screen;
1064 }
1065 struct XHostAddress {
1066     int family;
1067     int length;
1068     char* address;
1069 }
1070 struct XServerInterpretedAddress {
1071     int typelength;
1072     int valuelength;
1073     char* type;
1074     char* value;
1075 }
1076 struct XImage {
1077     int width, height;
1078     int xoffset;
1079     int format;
1080     char* data;
1081     int char_order;
1082     int bitmap_unit;
1083     int bitmap_bit_order;
1084     int bitmap_pad;
1085     int depth;
1086     int chars_per_line;
1087     int bits_per_pixel;
1088     c_ulong red_mask;
1089     c_ulong green_mask;
1090     c_ulong blue_mask;
1091     XPointer obdata;
1092     struct F {
1093     extern(C) nothrow:
1094     @nogc:
1095         XImage* function(XDisplay*, Visual*, uint, int, int, char*, uint, uint, int, int) create_image;
1096         int function(XImage*) destroy_image;
1097         c_ulong function(XImage*, int, int) get_pixel;
1098         int function(XImage*, int, int, c_ulong) put_pixel;
1099         XImage function(XImage*, int, int, uint, uint) sub_image;
1100         int function(XImage*, c_long) add_pixel;
1101     }
1102     F f;
1103 }
1104 struct XWindowChanges {
1105     int x, y;
1106     int width, height;
1107     int border_width;
1108     Window sibling;
1109     int stack_mode;
1110 }
1111 struct XColor {
1112     c_ulong pixel;
1113     ushort red, green, blue;
1114     char flags;
1115     char pad;
1116 }
1117 struct XSegment {
1118     short x1, y1, x2, y2;
1119 }
1120 struct XPoint {
1121     short x, y;
1122 }
1123 struct XRectangle {
1124     short x, y;
1125     ushort width, height;
1126 }
1127 struct XArc {
1128     short x, y;
1129     ushort width, height;
1130     short angle1, angle2;
1131 }
1132 struct XKeyboardControl {
1133     int key_click_percent;
1134     int bell_percent;
1135     int bell_pitch;
1136     int bell_duration;
1137     int led;
1138     int led_mode;
1139     int key;
1140     int auto_repeat_mode;
1141 }
1142 struct XKeyboardState {
1143     int key_click_percent;
1144     int bell_percent;
1145     uint bell_pitch, bell_duration;
1146     c_ulong led_mask;
1147     int global_auto_repeat;
1148     char[32] auto_repeats;
1149 }
1150 struct XTimeCoord {
1151     Time time;
1152     short x, y;
1153 }
1154 struct XModifierKeymap {
1155     int max_keypermod;
1156     KeyCode* modifiermap;
1157 }
1158 struct _XPrivate;
1159 struct _XrmHashBucketRec;
1160 alias _XDisplay Display;
1161 alias _XDisplay* _XPrivDisplay;
1162 struct XKeyEvent {
1163     int type;
1164     c_ulong serial;
1165     Bool send_event;
1166     Display* display;
1167     Window window;
1168     Window root;
1169     Window subwindow;
1170     Time time;
1171     int x, y;
1172     int x_root, y_root;
1173     uint state;
1174     uint keycode;
1175     Bool same_screen;
1176 }
1177 alias XKeyEvent XKeyPressedEvent;
1178 alias XKeyEvent XKeyReleasedEvent;
1179 struct XButtonEvent {
1180     int type;
1181     c_ulong serial;
1182     Bool send_event;
1183     Display* display;
1184     Window window;
1185     Window root;
1186     Window subwindow;
1187     Time time;
1188     int x, y;
1189     int x_root, y_root;
1190     uint state;
1191     uint button;
1192     Bool same_screen;
1193 }
1194 alias XButtonEvent XButtonPressedEvent;
1195 alias XButtonEvent XButtonReleasedEvent;
1196 struct XMotionEvent {
1197     int type;
1198     c_ulong serial;
1199     Bool send_event;
1200     Display* display;
1201     Window window;
1202     Window root;
1203     Window subwindow;
1204     Time time;
1205     int x, y;
1206     int x_root, y_root;
1207     uint state;
1208     char is_hint;
1209     Bool same_screen;
1210 }
1211 alias XMotionEvent XPointerMovedEvent;
1212 struct XCrossingEvent {
1213     int type;
1214     c_ulong serial;
1215     Bool send_event;
1216     Display* display;
1217     Window window;
1218     Window root;
1219     Window subwindow;
1220     Time time;
1221     int x, y;
1222     int x_root, y_root;
1223     int mode;
1224     int detail;
1225     Bool same_screen;
1226     Bool focus;
1227     uint state;
1228 }
1229 alias XCrossingEvent XEnterWindowEvent;
1230 alias XCrossingEvent XLeaveWindowEvent;
1231 struct XFocusChangeEvent {
1232     int type;
1233     c_ulong serial;
1234     Bool send_event;
1235     Display* display;
1236     Window window;
1237     int mode;
1238     int detail;
1239 }
1240 alias XFocusChangeEvent XFocusInEvent;
1241 alias XFocusChangeEvent XFocusOutEvent;
1242 struct XKeymapEvent {
1243     int type;
1244     c_ulong serial;
1245     Bool send_event;
1246     Display* display;
1247     Window window;
1248     char[32] key_vector;
1249 }
1250 struct XExposeEvent {
1251     int type;
1252     c_ulong serial;
1253     Bool send_event;
1254     Display* display;
1255     Window window;
1256     int x, y;
1257     int width, height;
1258     int count;
1259 }
1260 struct XGraphicsExposeEvent {
1261     int type;
1262     c_ulong serial;
1263     Bool send_event;
1264     Display* display;
1265     Drawable drawable;
1266     int x, y;
1267     int width, height;
1268     int count;
1269     int major_code;
1270     int minor_code;
1271 }
1272 struct XNoExposeEvent {
1273     int type;
1274     c_ulong serial;
1275     Bool send_event;
1276     Display* display;
1277     Drawable drawable;
1278     int major_code;
1279     int minor_code;
1280 }
1281 struct XVisibilityEvent {
1282     int type;
1283     c_ulong serial;
1284     Bool send_event;
1285     Display* display;
1286     Window window;
1287     int state;
1288 }
1289 struct XCreateWindowEvent {
1290     int type;
1291     c_ulong serial;
1292     Bool send_event;
1293     Display* display;
1294     Window parent;
1295     Window window;
1296     int x, y;
1297     int width, height;
1298     int border_width;
1299     Bool override_redirect;
1300 }
1301 struct XDestroyWindowEvent {
1302     int type;
1303     c_ulong serial;
1304     Bool send_event;
1305     Display* display;
1306     Window event;
1307     Window window;
1308 }
1309 struct XUnmapEvent {
1310     int type;
1311     c_ulong serial;
1312     Bool send_event;
1313     Display* display;
1314     Window event;
1315     Window window;
1316     Bool from_configure;
1317 }
1318 struct XMapEvent {
1319     int type;
1320     c_ulong serial;
1321     Bool send_event;
1322     Display* display;
1323     Window event;
1324     Window window;
1325     Bool override_redirect;
1326 }
1327 struct XMapRequestEvent {
1328     int type;
1329     c_ulong serial;
1330     Bool send_event;
1331     Display* display;
1332     Window parent;
1333     Window window;
1334 }
1335 struct XReparentEvent {
1336     int type;
1337     c_ulong serial;
1338     Bool send_event;
1339     Display* display;
1340     Window event;
1341     Window window;
1342     Window parent;
1343     int x, y;
1344     Bool override_redirect;
1345 }
1346 struct XConfigureEvent {
1347     int type;
1348     c_ulong serial;
1349     Bool send_event;
1350     Display* display;
1351     Window event;
1352     Window window;
1353     int x, y;
1354     int width, height;
1355     int border_width;
1356     Window above;
1357     Bool override_redirect;
1358 }
1359 struct XGravityEvent {
1360     int type;
1361     c_ulong serial;
1362     Bool send_event;
1363     Display* display;
1364     Window event;
1365     Window window;
1366     int x, y;
1367 }
1368 struct XResizeRequestEvent {
1369     int type;
1370     c_ulong serial;
1371     Bool send_event;
1372     Display* display;
1373     Window window;
1374     int width, height;
1375 }
1376 struct XConfigureRequestEvent {
1377     int type;
1378     c_ulong serial;
1379     Bool send_event;
1380     Display* display;
1381     Window parent;
1382     Window window;
1383     int x, y;
1384     int width, height;
1385     int border_width;
1386     Window above;
1387     int detail;
1388     c_ulong value_mask;
1389 }
1390 struct XCirculateEvent {
1391     int type;
1392     c_ulong serial;
1393     Bool send_event;
1394     Display* display;
1395     Window event;
1396     Window window;
1397     int place;
1398 }
1399 struct XCirculateRequestEvent {
1400     int type;
1401     c_ulong serial;
1402     Bool send_event;
1403     Display* display;
1404     Window parent;
1405     Window window;
1406     int place;
1407 }
1408 struct XPropertyEvent {
1409     int type;
1410     c_ulong serial;
1411     Bool send_event;
1412     Display* display;
1413     Window window;
1414     Atom atom;
1415     Time time;
1416     int state;
1417 }
1418 struct XSelectionClearEvent {
1419     int type;
1420     c_ulong serial;
1421     Bool send_event;
1422     Display* display;
1423     Window window;
1424     Atom selection;
1425     Time time;
1426 }
1427 struct XSelectionRequestEvent {
1428     int type;
1429     c_ulong serial;
1430     Bool send_event;
1431     Display* display;
1432     Window owner;
1433     Window requestor;
1434     Atom selection;
1435     Atom target;
1436     Atom property;
1437     Time time;
1438 }
1439 struct XSelectionEvent {
1440     int type;
1441     c_ulong serial;
1442     Bool send_event;
1443     Display* display;
1444     Window requestor;
1445     Atom selection;
1446     Atom target;
1447     Atom property;
1448     Time time;
1449 }
1450 struct XColormapEvent {
1451     int type;
1452     c_ulong serial;
1453     Bool send_event;
1454     Display* display;
1455     Window window;
1456     Colormap colormap;
1457     Bool c_new;
1458     int state;
1459 }
1460 struct XClientMessageEvent {
1461     int type;
1462     c_ulong serial;
1463     Bool send_event;
1464     Display* display;
1465     Window window;
1466     Atom message_type;
1467     int format;
1468     union _data {
1469         char[20] b;
1470         short[10] s;
1471         c_long[5] l;
1472     }
1473     _data data;
1474 }
1475 struct XMappingEvent {
1476     int type;
1477     c_ulong serial;
1478     Bool send_event;
1479     Display* display;
1480     Window window;
1481     int request;
1482     int first_keycode;
1483     int count;
1484 }
1485 struct XErrorEvent {
1486     int type;
1487     Display* display;
1488     XID resourceid;
1489     c_ulong serial;
1490     ubyte error_code;
1491     ubyte request_code;
1492     ubyte minor_code;
1493 }
1494 struct XAnyEvent {
1495     int type;
1496     c_ulong serial;
1497     Bool send_event;
1498     Display* display;
1499     Window window;
1500 }
1501 struct XGenericEvent {
1502     int type;
1503     c_ulong serial;
1504     Bool send_event;
1505     Display* display;
1506     int extension;
1507     int evtype;
1508 }
1509 struct XGenericEventCookie {
1510     int type;
1511     c_ulong serial;
1512     Bool send_event;
1513     Display* display;
1514     int extension;
1515     int evtype;
1516     uint cookie;
1517     void* data;
1518 }
1519 union XEvent {
1520     int type;
1521     XAnyEvent xany;
1522     XKeyEvent xkey;
1523     XButtonEvent xbutton;
1524     XMotionEvent xmotion;
1525     XCrossingEvent xcrossing;
1526     XFocusChangeEvent xfocus;
1527     XExposeEvent xexpose;
1528     XGraphicsExposeEvent xgraphicsexpose;
1529     XNoExposeEvent xnoexpose;
1530     XVisibilityEvent xvisibility;
1531     XCreateWindowEvent xcreatewindow;
1532     XDestroyWindowEvent xdestroywindow;
1533     XUnmapEvent xunmap;
1534     XMapEvent xmap;
1535     XMapRequestEvent xmaprequest;
1536     XReparentEvent xreparent;
1537     XConfigureEvent xconfigure;
1538     XGravityEvent xgravity;
1539     XResizeRequestEvent xresizerequest;
1540     XConfigureRequestEvent xconfigurerequest;
1541     XCirculateEvent xcirculate;
1542     XCirculateRequestEvent xcirculaterequest;
1543     XPropertyEvent xproperty;
1544     XSelectionClearEvent xselectionclear;
1545     XSelectionRequestEvent xselectionrequest;
1546     XSelectionEvent xselection;
1547     XColormapEvent xcolormap;
1548     XClientMessageEvent xclient;
1549     XMappingEvent xmapping;
1550     XErrorEvent xerror;
1551     XKeymapEvent xkeymap;
1552     XGenericEvent xgeneric;
1553     XGenericEventCookie xcookie;
1554     c_long[24] pad;
1555 }
1556 int XAllocID(Display* dpy) {
1557     return cast(int) dpy.resource_alloc(dpy);
1558 }
1559 struct XCharStruct {
1560     short lbearing;
1561     short rbearing;
1562     short width;
1563     short ascent;
1564     short descent;
1565     ushort attributes;
1566 }
1567 struct XFontProp {
1568     Atom name;
1569     c_ulong card32;
1570 }
1571 struct XFontStruct {
1572     XExtData* ext_data;
1573     Font fid;
1574     uint direction;
1575     uint min_char_or_char2;
1576     uint max_char_or_char2;
1577     uint min_char1;
1578     uint max_char1;
1579     Bool all_chars_exist;
1580     uint default_char;
1581     int n_properties;
1582     XFontProp* properties;
1583     XCharStruct min_bounds;
1584     XCharStruct max_bounds;
1585     XCharStruct* per_char;
1586     int ascent;
1587     int descent;
1588 }
1589 struct XTextItem {
1590     char* chars;
1591     int nchars;
1592     int delta;
1593     Font font;
1594 }
1595 struct XChar2b {
1596     ubyte char1;
1597     ubyte char2;
1598 }
1599 struct XTextItem16 {
1600     XChar2b* chars;
1601     int nchars;
1602     int delta;
1603     Font font;
1604 }
1605 union XEDataObject {
1606     Display* display;
1607     GC gc;
1608     Visual* visual;
1609     Screen* screen;
1610     ScreenFormat* pixmap_format;
1611     XFontStruct* font;
1612 }
1613 struct XFontSetExtents {
1614     XRectangle max_ink_extent;
1615     XRectangle max_logical_extent;
1616 }
1617 struct _XOM {}
1618 struct _XOC {}
1619 alias _XOM* XOM;
1620 alias _XOC* XOC;
1621 alias _XOC* XFontSet;
1622 struct XmbTextItem {
1623     char* chars;
1624     int nchars;
1625     int delta;
1626     XFontSet font_set;
1627 }
1628 struct XwcTextItem {
1629     wchar* chars;
1630     int nchars;
1631     int delta;
1632     XFontSet font_set;
1633 }
1634 const char* XNRequiredCharSet = "requiredCharSet";
1635 const char* XNQueryOrientation = "queryOrientation";
1636 const char* XNBaseFontName = "baseFontName";
1637 const char* XNOMAutomatic = "omAutomatic";
1638 const char* XNMissingCharSet = "missingCharSet";
1639 const char* XNDefaultString = "defaultString";
1640 const char* XNOrientation = "orientation";
1641 const char* XNDirectionalDependentDrawing = "directionalDependentDrawing";
1642 const char* XNContextualDrawing = "contextualDrawing";
1643 const char* XNFontInfo = "fontInfo";
1644 struct XOMCharSetList {
1645     int charset_count;
1646     char** charset_list;
1647 }
1648 alias int XOrientation;
1649 enum {
1650     XOMOrientation_LTR_TTB,
1651     XOMOrientation_RTL_TTB,
1652     XOMOrientation_TTB_LTR,
1653     XOMOrientation_TTB_RTL,
1654     XOMOrientation_Context
1655 }
1656 struct XOMOrientation {
1657     int num_orientation;
1658     XOrientation* orientation;
1659 }
1660 struct XOMFontInfo {
1661     int num_font;
1662     XFontStruct** font_struct_list;
1663     char** font_name_list;
1664 }
1665 struct _XIM {}
1666 struct _XIC {}
1667 alias _XIM* XIM;
1668 alias _XIC* XIC;
1669 alias void function(XIM, XPointer, XPointer) XIMProc;
1670 alias Bool function(XIC, XPointer, XPointer) XICProc;
1671 alias void function(Display*, XPointer, XPointer) XIDProc;
1672 struct XIMStyles {
1673     ushort count_styles;
1674     XIMStyle* supported_styles;
1675 }
1676 alias c_ulong XIMStyle;
1677 enum {
1678     XIMPreeditArea = 0x0001L,
1679     XIMPreeditCallbacks = 0x0002L,
1680     XIMPreeditPosition = 0x0004L,
1681     XIMPreeditNothing = 0x0008L,
1682     XIMPreeditNone = 0x0010L,
1683     XIMStatusArea = 0x0100L,
1684     XIMStatusCallbacks = 0x0200L,
1685     XIMStatusNothing = 0x0400L,
1686     XIMStatusNone = 0x0800L
1687 }
1688 const char* XNVaNestedList = "XNVaNestedList";
1689 const char* XNQueryInputStyle = "queryInputStyle";
1690 const char* XNClientWindow = "clientWindow";
1691 const char* XNInputStyle = "inputStyle";
1692 const char* XNFocusWindow = "focusWindow";
1693 const char* XNResourceName = "resourceName";
1694 const char* XNResourceClass = "resourceClass";
1695 const char* XNGeometryCallback = "geometryCallback";
1696 const char* XNDestroyCallback = "destroyCallback";
1697 const char* XNFilterEvents = "filterEvents";
1698 const char* XNPreeditStartCallback = "preeditStartCallback";
1699 const char* XNPreeditDoneCallback = "preeditDoneCallback";
1700 const char* XNStringConversion = "stringConversion";
1701 const char* XNResetState = "resetState";
1702 const char* XNHotKey = "hotKey";
1703 const char* XNHotKeyState = "hotKeyState";
1704 const char* XNPreeditState = "preeditState";
1705 const char* XNSeparatorofNestedList = "separatorofNestedList";
1706 enum int XBufferOverflow = -1;
1707 enum int XLookupNone = 1;
1708 enum int XLookupChars = 2;
1709 enum int XLookupKeySym = 3;
1710 enum int XLookupBoth = 4;
1711 alias XVaNestedList = void*;
1712 XImage* XGetImage(Display*, Drawable, int, int, uint, uint, c_ulong, int);
1713 XImage* XGetSubImage(Display*, Drawable, int, int, uint, uint, c_ulong, int, XImage*, int, int);
1714 Display* XOpenDisplay(char*);
1715 void XrmInitialize();
1716 int function(Display*) XSetAfterFunction(Display*, int function(Display*));
1717 Atom XInternAtom(Display*, const char*, Bool);
1718 Status XInternAtoms(Display*, char**, int, Bool, Atom*);
1719 Colormap XCopyColormapAndFree(Display*, Colormap);
1720 Colormap XCreateColormap(Display*, Window, Visual*, int);
1721 Cursor XCreatePixmapCursor(Display*, Pixmap, Pixmap, XColor*, XColor*, uint, uint);
1722 Cursor XCreateGlyphCursor(Display*, Font, Font, uint, uint, XColor*, XColor*);
1723 Cursor XCreateFontCursor(Display*, uint);
1724 Window XGetSelectionOwner(Display*, Atom);
1725 Window XCreateWindow(Display*, Window, int, int, uint, uint, uint, int, uint, Visual*, c_ulong, XSetWindowAttributes*);
1726 Colormap* XListInstalledColormaps(Display*, Window, int*);
1727 char** XListFonts(Display*, char*, int, int*);
1728 XHostAddress* XListHosts(Display*, int*, Bool*);
1729 KeySym XKeycodeToKeysym(Display*, KeyCode, int);
1730 KeySym XLookupKeysym(XKeyEvent*, int);
1731 KeySym* XGetKeyboardMapping(Display*, KeyCode, int, int*);
1732 KeySym XStringToKeysym(char*);
1733 c_long XMaxRequestSize(Display*);
1734 c_long XExtendedMaxRequestSize(Display*);
1735 char* XResourceManagerString(Display*);
1736 char* XScreenResourceString(Screen*);
1737 c_ulong XDisplayMotionBufferSize(Display*);
1738 VisualID XVisualIDFromVisual(Visual*);
1739 Status XInitThreads();
1740 int XScreenNumberOfScreen(Screen*);
1741 alias int function(Display*, XErrorEvent*) XErrorHandler;
1742 XErrorHandler XSetErrorHandler(XErrorHandler);
1743 alias int function(Display*) XIOErrorHandler;
1744 Status XGetWMProtocols(Display*, Window, Atom**, int*);
1745 Status XSetWMProtocols(Display*, Window, Atom*, int);
1746 Status XIconifyWindow(Display*, Window, int);
1747 Status XWithdrawWindow(Display*, Window, int);
1748 int XChangeKeyboardControl(Display*, c_ulong, XKeyboardControl*);
1749 int XChangeKeyboardMapping(Display*, int, int, KeySym*, int);
1750 int XChangePointerControl(Display*, Bool, Bool, int, int, int);
1751 int XChangeProperty(Display*, Window, Atom, Atom, int, int, ubyte*, int);
1752 int XChangeSaveSet(Display*, Window, int);
1753 int XChangeWindowAttributes(Display*, Window, uint, XSetWindowAttributes*);
1754 Bool XCheckIfEvent(Display*, XEvent*, Bool function(Display*, XEvent*, XPointer), XPointer);
1755 Bool XCheckMaskEvent(Display*, c_long, XEvent*);
1756 Bool XCheckTypedEvent(Display*, int, XEvent*);
1757 Bool XCheckTypedWindowEvent(Display*, Window, int, XEvent*);
1758 Bool XCheckWindowEvent(Display*, Window, c_long, XEvent*);
1759 int XCirculateSubwindows(Display*, Window, int);
1760 int XCloseDisplay(Display*);
1761 int XConfigureWindow(Display*, Window, c_ulong, XWindowChanges*);
1762 int XConnectionNumber(Display*);
1763 int XConvertSelection(Display*, Atom, Atom, Atom, Window, Time);
1764 int XDefaultDepthOfScreen(Screen*);
1765 int XDefaultScreen(Display*);
1766 int XDefineCursor(Display*, Window, Cursor);
1767 int XDeleteProperty(Display*, Window, Atom);
1768 int XDestroyWindow(Display*, Window);
1769 int XDestroySubwindows(Display*, Window);
1770 int XDoesBackingStore(Screen*);
1771 Bool XDoesSaveUnders(Screen*);
1772 int XEventsQueued(Display*, int);
1773 Status XFetchName(Display*, Window, char**);
1774 int XFillArc(Display*, Drawable, GC, int, int, uint, uint, int, int);
1775 int XFillArcs(Display*, Drawable, GC, XArc*, int);
1776 int XFillPolygon(Display*, Drawable, GC, XPoint*, int, int, int);
1777 int XFillRectangle(Display*, Drawable, GC, int, int, uint, uint);
1778 int XFillRectangles(Display*, Drawable, GC, XRectangle*, int);
1779 int XFlush(Display*);
1780 int XForceScreenSaver(Display*, int);
1781 int XFree(void*);
1782 int XFreeColormap(Display*, Colormap);
1783 int XFreeColors(Display*, Colormap, c_ulong*, int, c_ulong);
1784 int XFreeCursor(Display*, Cursor);
1785 int XFreeExtensionList(char**);
1786 int XFreeFont(Display*, XFontStruct*);
1787 int XFreeFontInfo(char**, XFontStruct*, int);
1788 int XFreePixmap(Display*, Pixmap);
1789 int XGeometry(Display*, int, char*, char*, uint, uint, uint, int, int, int*, int*, int*, int*);
1790 int XGetErrorDatabaseText(Display*, char*, char*, char*, char*, int);
1791 int XGetErrorText(Display*, int, char*, int);
1792 int XGetInputFocus(Display*, Window*, int*);
1793 int XGetKeyboardControl(Display*, XKeyboardState*);
1794 int XGetPointerControl(Display*, int*, int*, int*);
1795 int XGetPointerMapping(Display*, ubyte*, int);
1796 int XGetScreenSaver(Display*, int*, int*, int*, int*);
1797 Status XGetTransientForHint(Display*, Window, Window*);
1798 int XGetWindowProperty(Display*, Window, Atom, c_long, c_long, Bool, Atom, Atom*, int*, c_ulong*, c_ulong*, ubyte**);
1799 Status XGetWindowAttributes(Display*, Window, XWindowAttributes*);
1800 int XGrabButton(Display*, uint, uint, Window, Bool, uint, int, int, Window, Cursor);
1801 int XGrabKey(Display*, int, uint, Window, Bool, int, int);
1802 int XGrabKeyboard(Display*, Window, Bool, int, int, Time);
1803 int XGrabPointer(Display*, Window, Bool, uint, int, int, Window, Cursor, Time);
1804 Status XLookupColor(Display*, Colormap, char*, XColor*, XColor*);
1805 int XLowerWindow(Display*, Window);
1806 int XMapRaised(Display*, Window);
1807 int XMapSubwindows(Display*, Window);
1808 int XMapWindow(Display*, Window);
1809 int XMaskEvent(Display*, c_long, XEvent*);
1810 int XMaxCmapsOfScreen(Screen*);
1811 int XMinCmapsOfScreen(Screen*);
1812 int XMoveResizeWindow(Display*, Window, int, int, uint, uint);
1813 int XMoveWindow(Display*, Window, int, int);
1814 int XNextEvent(Display*, XEvent*);
1815 int XNoOp(Display*);
1816 Status XParseColor(Display*, Colormap, char*, XColor*);
1817 int XParseGeometry(char*, int*, int*, uint*, uint*);
1818 int XPeekEvent(Display*, XEvent*);
1819 int XPeekIfEvent(Display*, XEvent*, Bool function(Display*, XEvent*, XPointer), XPointer);
1820 int XPending(Display*);
1821 int XPlanesOfScreen(Screen*);
1822 int XProtocolRevision(Display*);
1823 int XProtocolVersion(Display*);
1824 int XPutBackEvent(Display*, XEvent*);
1825 int XPutImage(Display*, Drawable, GC, XImage*, int, int, int, int, uint, uint);
1826 int XQLength(Display*);
1827 Status XQueryBestCursor(Display*, Drawable, uint, uint, uint*, uint*);
1828 int XQueryColors(Display*, Colormap, XColor*, int);
1829 Bool XQueryExtension(Display*, const(char)*, int*, int*, int*);
1830 int XQueryKeymap(Display*, char[32]);
1831 Bool XQueryPointer(Display*, Window, Window*, Window*, int*, int*, int*, int*, uint*);
1832 int XQueryTextExtents(Display*, XID, char*, int, int*, int*, int*, XCharStruct*);
1833 int XQueryTextExtents16(Display*, XID, XChar2b*, int, int*, int*, int*, XCharStruct*);
1834 Status XQueryTree(Display*, Window, Window*, Window*, Window**, uint*);
1835 int XRaiseWindow(Display*, Window);
1836 int XReparentWindow(Display*, Window, Window, int, int);
1837 int XResetScreenSaver(Display*);
1838 int XResizeWindow(Display*, Window, uint, uint);
1839 int XRestackWindows(Display*, Window*, int);
1840 int XRotateBuffers(Display*, int);
1841 int XRotateWindowProperties(Display*, Window, Atom*, int, int);
1842 int XScreenCount(Display*);
1843 int XSelectInput(Display*, Window, c_long);
1844 Status XSendEvent(Display*, Window, Bool, c_long, XEvent*);
1845 int XSetAccessControl(Display*, int);
1846 int XSetArcMode(Display*, GC, int);
1847 int XSetBackground(Display*, GC, c_ulong);
1848 int XSetGraphicsExposures(Display*, GC, Bool);
1849 int XSetIconName(Display*, Window, char*);
1850 int XSetInputFocus(Display*, Window, int, Time);
1851 int XSetLineAttributes(Display*, GC, uint, int, int, int);
1852 int XSetModifierMapping(Display*, XModifierKeymap*);
1853 int XSetPlaneMask(Display*, GC, c_ulong);
1854 int XSetPointerMapping(Display*, ubyte*, int);
1855 int XSetScreenSaver(Display*, int, int, int, int);
1856 int XSetSelectionOwner(Display*, Atom, Window, Time);
1857 int XSetState(Display*, GC, c_ulong, c_ulong, int, c_ulong);
1858 int XSetStipple(Display*, GC, Pixmap);
1859 int XSetSubwindowMode(Display*, GC, int);
1860 int XStoreName(Display*, Window, char*);
1861 int XStoreNamedColor(Display*, Colormap, char*, c_ulong, int);
1862 int XSync(Display*, Bool);
1863 int XTextExtents(XFontStruct*, char*, int, int*, int*, int*, XCharStruct*);
1864 int XTextExtents16(XFontStruct*, XChar2b*, int, int*, int*, int*, XCharStruct*);
1865 int XTextWidth(XFontStruct*, char*, int);
1866 int XTextWidth16(XFontStruct*, XChar2b*, int);
1867 Bool XTranslateCoordinates(Display*, Window, Window, int, int, int*, int*, Window*);
1868 int XUndefineCursor(Display*, Window);
1869 int XUngrabButton(Display*, uint, uint, Window);
1870 int XUngrabKey(Display*, int, uint, Window);
1871 int XUngrabKeyboard(Display*, Time);
1872 int XUngrabPointer(Display*, Time);
1873 int XUngrabServer(Display*);
1874 int XUninstallColormap(Display*, Colormap);
1875 int XUnloadFont(Display*, Font);
1876 int XUnmapSubwindows(Display*, Window);
1877 int XUnmapWindow(Display*, Window);
1878 int XVendorRelease(Display*);
1879 int XWarpPointer(Display*, Window, Window, int, int, uint, uint, int, int);
1880 Bool XSupportsLocale();
1881 char* XSetLocaleModifiers(const char*);
1882 XOM XOpenOM(Display*, _XrmHashBucketRec*, char*, char*);
1883 Status XCloseOM(XOM);XIM XOpenIM(Display*, _XrmHashBucketRec*, char*, char*);
1884 Status XCloseIM(XIM);char* XGetIMValues(XIM, ...);
1885 char* XSetIMValues(XIM, ...);
1886 Display* XDisplayOfIM(XIM);
1887 char* XLocaleOfIM(XIM);
1888 XIC XCreateIC(XIM,...);
1889 void XDestroyIC(XIC);
1890 void XSetICFocus(XIC);
1891 void XUnsetICFocus(XIC);
1892 wchar* XwcResetIC(XIC);
1893 char* XmbResetIC(XIC);
1894 char* Xutf8ResetIC(XIC);
1895 char* XSetICValues(XIC, ...);
1896 char* XGetICValues(XIC, ...);
1897 XIM XIMOfIC(XIC);Bool XFilterEvent(XEvent*, Window);
1898 int XmbLookupString(XIC, XKeyPressedEvent*, char*, int, KeySym*, Status*);int XwcLookupString(XIC, XKeyPressedEvent*, wchar_t*, int, KeySym*, Status*);int Xutf8LookupString(XIC, XKeyPressedEvent*, char*, int, KeySym*, Status*);XVaNestedList XVaCreateNestedList(int, ...);
1899 Bool XRegisterIMInstantiateCallback(Display*, _XrmHashBucketRec*, char*, char*, XIDProc, XPointer);
1900 Bool XUnregisterIMInstantiateCallback(Display*, _XrmHashBucketRec*, char*, char*, XIDProc, XPointer);
1901 alias void function(Display*, XPointer, int, Bool, XPointer*) XConnectionWatchProc;
1902 void XSetAuthorization(char*, int, char*, int);
1903 int _Xmbtowc(wchar*, char*, int);
1904 int _Xwctomb(char*, wchar);
1905 Bool XGetEventData(Display*, XGenericEventCookie*);
1906 void XFreeEventData(Display*, XGenericEventCookie*);
1907 enum bool XTHREADS = true;
1908 enum bool XUSE_MTSAFE_API = true;
1909 enum XEventQueueOwner {
1910     XlibOwnsEventQueue = 0,
1911     XCBOwnsEventQueue
1912 }
1913 const uint XCONN_CHECK_FREQ = 256;
1914 struct _XGC {
1915     XExtData* ext_data;
1916     GContext gid;
1917     Bool rects;
1918     Bool dashes;
1919     c_ulong dirty;
1920     XGCValues values;
1921 }
1922 struct _XLockInfo {}
1923 struct _XDisplayAtoms {}
1924 struct _XContextDB {}
1925 struct _XIMFilter {}
1926 struct _XkbInfoRec {}
1927 struct _XtransConnInfo {}
1928 struct _X11XCBPrivate {}
1929 //~ struct _XLockPtrs{} -- define in version XTHREAD
1930 struct _XKeytrans {}
1931 struct _XDisplay {
1932     XExtData* ext_data;
1933     _XFreeFuncs* free_funcs;
1934     int fd;
1935     int conn_checker;
1936     int proto_major_version;
1937     int proto_minor_version;
1938     char* c_vendor;
1939     XID resource_base;
1940     XID resource_mask;
1941     XID resource_id;
1942     int resource_shift;
1943     extern(C) @nogc nothrow XID function(_XDisplay*) resource_alloc;
1944     int byte_order;
1945     int bitmap_unit;
1946     int bitmap_pad;
1947     int bitmap_bit_order;
1948     int nformats;
1949     ScreenFormat* pixmap_format;
1950     int vnumber;
1951     int release;
1952     _XSQEvent* head, tail;
1953     int qlen;
1954     c_ulong last_request_read;
1955     c_ulong request;
1956     char* last_req;
1957     char* buffer;
1958     char* bufptr;
1959     char* bufmax;
1960     uint max_request_size;
1961     _XrmHashBucketRec* db;
1962     extern(C) nothrow int function(_XDisplay*) synchandler;
1963     char* display_name;
1964     int default_screen;
1965     int nscreens;
1966     Screen* screens;
1967     c_ulong motion_buffer;
1968     c_ulong flags;
1969     int min_keycode;
1970     int max_keycode;
1971     KeySym* keysyms;
1972     XModifierKeymap* modifiermap;
1973     int keysyms_per_keycode;
1974     char* xdefaults;
1975     char* scratch_buffer;
1976     c_ulong scratch_length;
1977     int ext_number;
1978     _XExten* ext_procs;
1979     extern(C) nothrow Bool function(
1980             Display*, XEvent*, xEvent*)[128] event_vec;
1981     extern(C) nothrow Status function(
1982             Display*, XEvent*, xEvent*)[128] wire_vec;
1983     KeySym lock_meaning;
1984     _XLockInfo* lock;
1985     _XInternalAsync* async_handlers;
1986     c_ulong bigreq_size;
1987     _XLockPtrs* lock_fns;
1988     extern(C) @nogc nothrow void function(
1989             Display*, XID*, int) idlist_alloc;
1990     _XKeytrans* key_bindings;
1991     Font cursor_font;
1992     _XDisplayAtoms* atoms;
1993     uint mode_switch;
1994     uint num_lock;
1995     _XContextDB* context_db;
1996     extern(C) @nogc nothrow Bool function(
1997             Display*, XErrorEvent*, xError*)* error_vec;
1998     struct cms {
1999         XPointer defaultCCCs;
2000         XPointer clientCmaps;
2001         XPointer perVisualIntensityMaps;
2002     }
2003     _XIMFilter* im_filters;
2004     _XSQEvent* qfree;
2005     c_ulong next_event_serial_num;
2006     _XExten* flushes;
2007     _XConnectionInfo* im_fd_info;
2008     int im_fd_length;
2009     _XConnWatchInfo* conn_watchers;
2010     int watcher_count;
2011     XPointer filedes;
2012     extern(C) nothrow int function(
2013             Display*) savedsynchandler;
2014     XID resource_max;
2015     int xcmisc_opcode;
2016     _XkbInfoRec* xkb_info;
2017     _XtransConnInfo* trans_conn;
2018     _X11XCBPrivate* xcb;
2019     uint next_cookie;
2020     extern(C) nothrow Bool function(Display*, XGenericEventCookie*, xEvent*)[128] generic_event_vec;
2021     extern(C) nothrow Bool function(Display*, XGenericEventCookie*, XGenericEventCookie*)[128] generic_event_copy_vec;
2022     void* cookiejar;
2023 }
2024 void XAllocIDs(Display* dpy, XID* ids, int n) {
2025     dpy.idlist_alloc(dpy, ids, n);
2026 }
2027 enum bool DataRoutineIsProcedure = false;
2028 struct _XSQEvent {
2029     _XSQEvent* next;
2030     XEvent event;
2031     c_ulong qserial_num;
2032 }
2033 alias _XSQEvent _XQEvent;
2034 extern LockInfoPtr _Xglobal_lock; // warn put here for skip build error
2035 struct _XLockPtrs {}
2036 struct _LockInfoRec {}
2037 alias _LockInfoRec* LockInfoPtr;
2038 
2039 void Xfree(void* ptr) {
2040     free(ptr);
2041 }
2042 struct _XInternalAsync {
2043     _XInternalAsync* next;
2044     extern(C) nothrow Bool function(Display*, xReply*, char*, int, XPointer) handler;
2045     XPointer data;
2046 }
2047 alias _XInternalAsync _XAsyncHandler;
2048 struct _XAsyncEState {
2049     c_ulong min_sequence_number;
2050     c_ulong max_sequence_number;
2051     ubyte error_code;
2052     ubyte major_opcode;
2053     ushort minor_opcode;
2054     ubyte last_error_received;
2055     int error_count;
2056 }
2057 alias _XAsyncEState _XAsyncErrorState;
2058 void _XDeqAsyncHandler(Display* dpy, _XAsyncHandler* handler);
2059 void DeqAsyncHandler(Display* dpy, _XAsyncHandler* handler) {
2060     if (dpy.async_handlers == handler)
2061         dpy.async_handlers = handler.next;
2062     else
2063         _XDeqAsyncHandler(dpy, handler);
2064 }
2065 alias void function(Display*) FreeFuncType;
2066 alias int function(XModifierKeymap*) FreeModmapType;
2067 struct _XFreeFuncs {
2068     FreeFuncType atoms;
2069     FreeModmapType modifiermap;
2070     FreeFuncType key_bindings;
2071     FreeFuncType context_db;
2072     FreeFuncType defaultCCCs;
2073     FreeFuncType clientCmaps;
2074     FreeFuncType intensityMaps;
2075     FreeFuncType im_filters;
2076     FreeFuncType xkb;
2077 }
2078 alias _XFreeFuncs _XFreeFuncRec;
2079 alias int function(Display*, GC, XExtCodes*) CreateGCType;
2080 alias int function(Display*, GC, XExtCodes*) CopyGCType;
2081 alias int function(Display*, GC, XExtCodes*) FlushGCType;
2082 alias int function(Display*, GC, XExtCodes*) FreeGCType;
2083 alias int function(Display*, XFontStruct*, XExtCodes*) CreateFontType;
2084 alias int function(Display*, XFontStruct*, XExtCodes*) FreeFontType;
2085 alias int function(Display*, XExtCodes*) CloseDisplayType;
2086 alias int function(Display*, xError*, XExtCodes*, int*) ErrorType;
2087 alias char* function(Display*, int, XExtCodes*, char*, int) ErrorStringType;
2088 alias void function(Display*, XErrorEvent*, void*) PrintErrorType;
2089 alias void function(Display*, XExtCodes*, const char*, c_long) BeforeFlushType;
2090 struct _XExten {
2091     _XExten* next;
2092     XExtCodes codes;
2093     CreateGCType create_GC;
2094     CopyGCType copy_GC;
2095     FlushGCType flush_GC;
2096     FreeGCType free_GC;
2097     CreateFontType create_Font;
2098     FreeFontType free_Font;
2099     CloseDisplayType close_display;
2100     ErrorType error;
2101     ErrorStringType error_string;
2102     char* name;
2103     PrintErrorType error_values;
2104     BeforeFlushType before_flush;
2105     _XExten* next_flush;
2106 }
2107 alias _XExten _XExtension;
2108 alias void function(Display*, int, XPointer) _XInternalConnectionProc;
2109 Status _XRegisterInternalConnection(Display*, int, _XInternalConnectionProc, XPointer);
2110 void _XUnregisterInternalConnection(Display*, int);
2111 void _XProcessInternalConnection(Display*, _XConnectionInfo*);
2112 struct _XConnectionInfo {
2113     int fd;
2114     _XInternalConnectionProc read_callback;
2115     XPointer call_data;
2116     XPointer* watch_data;
2117     _XConnectionInfo* next;
2118 }
2119 struct _XConnWatchInfo {
2120     XConnectionWatchProc fn;
2121     XPointer client_data;
2122     _XConnWatchInfo* next;
2123 }
2124 version(X86_64) {
2125     enum bool LONG64 = true;
2126     enum bool MUSTCOPY = true;
2127 } else {
2128     enum bool LONG64 = false;
2129     enum bool MUSTCOPY = false;
2130 }
2131 size_t _SIZEOF(T)() {
2132     return T.sizeof;
2133 }
2134 alias _SIZEOF SIZEOF;
2135 version(X86_64) {
2136     alias long INT64;
2137     alias uint INT32;
2138     alias uint INT16;
2139 } else {
2140     static if (LONG64) {
2141         alias c_long INT64;
2142         alias int INT32;
2143     } else
2144         alias c_long INT32;
2145     alias short INT16;
2146 }
2147 alias byte INT8;
2148 static if (LONG64) {
2149     alias c_ulong CARD64;
2150     alias uint CARD32;
2151 } else
2152     alias c_ulong CARD32;
2153 static if (!WORD64 && !LONG64)
2154     alias ulong CARD64;
2155 alias ushort CARD16;
2156 alias byte CARD8;
2157 alias CARD32 BITS32;
2158 alias CARD16 BITS16;
2159 alias CARD8 BYTE;
2160 alias CARD8 BOOL;
2161 static if (WORD64) {
2162     template cvtINT8toInt(INT8 val) {
2163         enum int cvtINT8toInt = cast(int)(val & 0x00000080) ? (val | 0xffffffffffffff00) : val;
2164     }
2165     template cvtINT16toInt(INT16 val) {
2166         enum int cvtINT16toInt = cast(int)(val & 0x00008000) ? (val | 0xffffffffffff0000) : val;
2167     }
2168     template cvtINT32toInt(INT32 val) {
2169         enum int cvtINT32toInt = cast(int)(val & 0x80000000) ? (val | 0xffffffff00000000) : val;
2170     }
2171     template cvtINT8toShort(INT8 val) {
2172         enum short cvtINT8toShort = cast(short) cvtINT8toInt(val);
2173     }
2174     template cvtINT16toShort(INT16 val) {
2175         enum short cvtINT16toShort = cast(short) cvtINT16toInt(val);
2176     }
2177     template cvtINT32toShort(INT32 val) {
2178         enum short cvtINT32toShort = cast(short) cvtINT32toInt(val);
2179     }
2180     template cvtINT8toLong(INT8 val) {
2181         enum c_long cvtINT8toLong = cast(c_long) cvtINT8toInt(val);
2182     }
2183     template cvtINT16toLong(INT16 val) {
2184         enum c_long cvtINT16toLong = cast(c_long) cvtINT16toInt(val);
2185     }
2186     template cvtINT32toLong(INT32 val) {
2187         enum c_long cvtINT32toLong = cast(c_long) cvtINT32toInt(val);
2188     }
2189 } else {
2190     template cvtINT8toInt(INT8 val) {
2191         enum int cvtINT8toInt = cast(int) val;
2192     }
2193     template cvtINT16toInt(INT16 val) {
2194         enum int cvtINT16toInt = cast(int) val;
2195     }
2196     template cvtINT32toInt(INT32 val) {
2197         enum int cvtINT32toInt = cast(int) val;
2198     }
2199     template cvtINT8toShort(INT8 val) {
2200         enum short cvtINT8toShort = cast(short) val;
2201     }
2202     template cvtINT16toShort(INT16 val) {
2203         enum short cvtINT16toShort = cast(short) val;
2204     }
2205     template cvtINT32toShort(INT32 val) {
2206         enum short cvtINT32toShort = cast(short) val;
2207     }
2208     template cvtINT8toLong(INT8 val) {
2209         enum c_long cvtINT8toLong = cast(c_long) val;
2210     }
2211     template cvtINT16toLong(INT16 val) {
2212         enum c_long cvtINT16toLong = cast(c_long) val;
2213     }
2214     template cvtINT32toLong(INT32 val) {
2215         enum c_long cvtINT32toLong = cast(c_long) val;
2216     }
2217 }
2218 enum int xFalse = 0;
2219 alias CARD16 KeyButMask;
2220 struct xConnClientPrefix {
2221     CARD8 byteOrder;
2222     BYTE pad;
2223     CARD16 majorVersion;
2224     CARD16 minorVersion;
2225     CARD16 nbytesAuthProto6;
2226     CARD16 nbytesAuthString;
2227     CARD16 pad2;
2228 }
2229 struct xConnSetupPrefix {
2230     CARD8 success;
2231     BYTE lengthReason;
2232     CARD16 majorVersion, minorVersion;
2233     CARD16 length;
2234 }
2235 struct xWindowRoot {
2236     Window windowId;
2237     Colormap defaultColormap;
2238     CARD32 whitePixel, blackPixel;
2239     CARD32 currentInputMask;
2240     CARD16 pixWidth, pixHeight;
2241     CARD16 mmWidth, mmHeight;
2242     CARD16 minInstalledMaps, maxInstalledMaps;
2243     VisualID rootVisualID;
2244     CARD8 backingStore;
2245     BOOL saveUnders;
2246     CARD8 rootDepth;
2247     CARD8 nDepths;
2248 }
2249 struct xTimecoord {
2250     CARD32 time;
2251     INT16 x, y;
2252 }
2253 struct xHostEntry {
2254     CARD8 family;
2255     BYTE pad;
2256     CARD16 length;
2257 }
2258 struct xCharInfo {
2259     INT16 leftSideBearing, rightSideBearing, characterWidth, ascent, descent;
2260     CARD16 attributes;
2261 }
2262 alias CARD8 KEYCODE;
2263 struct xGenericReply {
2264     BYTE type;
2265     BYTE data1;
2266     CARD16 sequenceNumber;
2267     CARD32 length;
2268     CARD32 data00;
2269     CARD32 data01;
2270     CARD32 data02;
2271     CARD32 data03;
2272     CARD32 data04;
2273     CARD32 data05;
2274 }
2275 struct xGetWindowAttributesReply {
2276     BYTE type;
2277     CARD8 backingStore;
2278     CARD16 sequenceNumber;
2279     CARD32 length;
2280     VisualID visualID;
2281     CARD16 c_class;
2282     CARD8 bitGravity;
2283     CARD8 winGravity;
2284     CARD32 backingBitPlanes;
2285     CARD32 backingPixel;
2286     BOOL saveUnder;
2287     BOOL mapInstalled;
2288     CARD8 mapState;
2289     BOOL c_override;
2290     Colormap colormap;
2291     CARD32 allEventMasks;
2292     CARD32 yourEventMask;
2293     CARD16 doNotPropagateMask;
2294     CARD16 pad;
2295 }
2296 struct xGetGeometryReply {
2297     BYTE type;
2298     CARD8 depth;
2299     CARD16 sequenceNumber;
2300     CARD32 length;
2301     Window root;
2302     INT16 x, y;
2303     CARD16 width, height;
2304     CARD16 borderWidth;
2305     CARD16 pad1;
2306     CARD32 pad2;
2307     CARD32 pad3;
2308 }
2309 struct xQueryTreeReply {
2310     BYTE type;
2311     BYTE pad1;
2312     CARD16 sequenceNumber;
2313     CARD32 length;
2314     Window root, parent;
2315     CARD16 nChildren;
2316     CARD16 pad2;
2317     CARD32 pad3;
2318     CARD32 pad4;
2319     CARD32 pad5;
2320 }
2321 struct xInternAtomReply {
2322     BYTE type;
2323     BYTE pad1;
2324     CARD16 sequenceNumber;
2325     CARD32 length;
2326     Atom atom;
2327     CARD32 pad2;
2328     CARD32 pad3;
2329     CARD32 pad4;
2330     CARD32 pad5;
2331     CARD32 pad6;
2332 }
2333 struct xGetAtomNameReply {
2334     BYTE type;
2335     BYTE pad1;
2336     CARD16 sequenceNumber;
2337     CARD32 length;
2338     CARD16 nameLength;
2339     CARD16 pad2;
2340     CARD32 pad3;
2341     CARD32 pad4;
2342     CARD32 pad5;
2343     CARD32 pad6;
2344     CARD32 pad7;
2345 }
2346 struct xGetPropertyReply {
2347     BYTE type;
2348     CARD8 format;
2349     CARD16 sequenceNumber;
2350     CARD32 length;
2351     Atom propertyType;
2352     CARD32 bytesAfter;
2353     CARD32 nItems;
2354     CARD32 pad1;
2355     CARD32 pad2;
2356     CARD32 pad3;
2357 }
2358 struct xListPropertiesReply {
2359     BYTE type;
2360     BYTE pad1;
2361     CARD16 sequenceNumber;
2362     CARD32 length;
2363     CARD16 nProperties;
2364     CARD16 pad2;
2365     CARD32 pad3;
2366     CARD32 pad4;
2367     CARD32 pad5;
2368     CARD32 pad6;
2369     CARD32 pad7;
2370 }
2371 struct xGetSelectionOwnerReply {
2372     BYTE type;
2373     BYTE pad1;
2374     CARD16 sequenceNumber;
2375     CARD32 length;
2376     Window owner;
2377     CARD32 pad2;
2378     CARD32 pad3;
2379     CARD32 pad4;
2380     CARD32 pad5;
2381     CARD32 pad6;
2382 }
2383 struct xGrabPointerReply {
2384     BYTE type;
2385     BYTE status;
2386     CARD16 sequenceNumber;
2387     CARD32 length;
2388     CARD32 pad1;
2389     CARD32 pad2;
2390     CARD32 pad3;
2391     CARD32 pad4;
2392     CARD32 pad5;
2393     CARD32 pad6;
2394 }
2395 alias xGrabPointerReply xGrabKeyboardReply;
2396 struct xQueryPointerReply {
2397     BYTE type;
2398     BOOL sameScreen;
2399     CARD16 sequenceNumber;
2400     CARD32 length;
2401     Window root, child;
2402     INT16 rootX, rootY, winX, winY;
2403     CARD16 mask;
2404     CARD16 pad1;
2405     CARD32 pad;
2406 }
2407 struct xGetMotionEventsReply {
2408     BYTE type;
2409     BYTE pad1;
2410     CARD16 sequenceNumber;
2411     CARD32 length;
2412     CARD32 nEvents;
2413     CARD32 pad2;
2414     CARD32 pad3;
2415     CARD32 pad4;
2416     CARD32 pad5;
2417     CARD32 pad6;
2418 }
2419 struct xTranslateCoordsReply {
2420     BYTE type;
2421     BOOL sameScreen;
2422     CARD16 sequenceNumber;
2423     CARD32 length;
2424     Window child;
2425     INT16 dstX, dstY;
2426     CARD32 pad2;
2427     CARD32 pad3;
2428     CARD32 pad4;
2429     CARD32 pad5;
2430 }
2431 struct xGetInputFocusReply {
2432     BYTE type;
2433     CARD8 revertTo;
2434     CARD16 sequenceNumber;
2435     CARD32 length;
2436     Window focus;
2437     CARD32 pad1;
2438     CARD32 pad2;
2439     CARD32 pad3;
2440     CARD32 pad4;
2441     CARD32 pad5;
2442 }
2443 struct xQueryTextExtentsReply {
2444     BYTE type;
2445     CARD8 drawDirection;
2446     CARD16 sequenceNumber;
2447     CARD32 length;
2448     INT16 fontAscent, fontDescent;
2449     INT16 overallAscent, overallDescent;
2450     INT32 overallWidth, overallLeft, overallRight;
2451     CARD32 pad;
2452 }
2453 struct xListFontsReply {
2454     BYTE type;
2455     BYTE pad1;
2456     CARD16 sequenceNumber;
2457     CARD32 length;
2458     CARD16 nFonts;
2459     CARD16 pad2;
2460     CARD32 pad3;
2461     CARD32 pad4;
2462     CARD32 pad5;
2463     CARD32 pad6;
2464     CARD32 pad7;
2465 }
2466 version(X86_64) {
2467     struct xListFontsWithInfoReply {
2468         BYTE type;
2469         CARD8 nameLength;
2470         CARD16 sequenceNumber;
2471         CARD32 length;
2472         xCharInfo minBounds;
2473         xCharInfo maxBounds;
2474         CARD16 minCharOrByte2, maxCharOrByte2;
2475         CARD16 defaultChar;
2476         CARD16 nFontProps;
2477         CARD8 drawDirection;
2478         CARD8 minByte1, maxByte1;
2479         BOOL allCharsExist;
2480         INT16 fontAscent, fontDescent;
2481         CARD32 nReplies;
2482     }
2483 } else {
2484     struct xListFontsWithInfoReply {
2485         BYTE type;
2486         CARD8 nameLength;
2487         CARD16 sequenceNumber;
2488         CARD32 length;
2489         xCharInfo minBounds;
2490         CARD32 walign1;
2491         xCharInfo maxBounds;
2492         CARD32 align2;
2493         CARD16 minCharOrByte2, maxCharOrByte2;
2494         CARD16 defaultChar;
2495         CARD16 nFontProps;
2496         CARD8 drawDirection;
2497         CARD8 minByte1, maxByte1;
2498         BOOL allCharsExist;
2499         INT16 fontAscent, fontDescent;
2500         CARD32 nReplies;
2501     }
2502 }
2503 struct xGetFontPathReply {
2504     BYTE type;
2505     BYTE pad1;
2506     CARD16 sequenceNumber;
2507     CARD32 length;
2508     CARD16 nPaths;
2509     CARD16 pad2;
2510     CARD32 pad3;
2511     CARD32 pad4;
2512     CARD32 pad5;
2513     CARD32 pad6;
2514     CARD32 pad7;
2515 }
2516 struct xGetImageReply {
2517     BYTE type;
2518     CARD8 depth;
2519     CARD16 sequenceNumber;
2520     CARD32 length;
2521     VisualID visual;
2522     CARD32 pad3;
2523     CARD32 pad4;
2524     CARD32 pad5;
2525     CARD32 pad6;
2526     CARD32 pad7;
2527 }
2528 struct xListInstalledColormapsReply {
2529     BYTE type;
2530     BYTE pad1;
2531     CARD16 sequenceNumber;
2532     CARD32 length;
2533     CARD16 nColormaps;
2534     CARD16 pad2;
2535     CARD32 pad3;
2536     CARD32 pad4;
2537     CARD32 pad5;
2538     CARD32 pad6;
2539     CARD32 pad7;
2540 }
2541 struct xAllocColorReply {
2542     BYTE type;
2543     BYTE pad1;
2544     CARD16 sequenceNumber;
2545     CARD32 length;
2546     CARD16 red, green, blue;
2547     CARD16 pad2;
2548     CARD32 pixel;
2549     CARD32 pad3;
2550     CARD32 pad4;
2551     CARD32 pad5;
2552 }
2553 struct xAllocNamedColorReply {
2554     BYTE type;
2555     BYTE pad1;
2556     CARD16 sequenceNumber;
2557     CARD32 length;
2558     CARD32 pixel;
2559     CARD16 exactRed, exactGreen, exactBlue;
2560     CARD16 screenRed, screenGreen, screenBlue;
2561     CARD32 pad2;
2562     CARD32 pad3;
2563 }
2564 struct xAllocColorCellsReply {
2565     BYTE type;
2566     BYTE pad1;
2567     CARD16 sequenceNumber;
2568     CARD32 length;
2569     CARD16 nPixels, nMasks;
2570     CARD32 pad3;
2571     CARD32 pad4;
2572     CARD32 pad5;
2573     CARD32 pad6;
2574     CARD32 pad7;
2575 }
2576 struct xAllocColorPlanesReply {
2577     BYTE type;
2578     BYTE pad1;
2579     CARD16 sequenceNumber;
2580     CARD32 length;
2581     CARD16 nPixels;
2582     CARD16 pad2;
2583     CARD32 redMask, greenMask, blueMask;
2584     CARD32 pad3;
2585     CARD32 pad4;
2586 }
2587 struct xQueryColorsReply {
2588     BYTE type;
2589     BYTE pad1;
2590     CARD16 sequenceNumber;
2591     CARD32 length;
2592     CARD16 nColors;
2593     CARD16 pad2;
2594     CARD32 pad3;
2595     CARD32 pad4;
2596     CARD32 pad5;
2597     CARD32 pad6;
2598     CARD32 pad7;
2599 }
2600 struct xLookupColorReply {
2601     BYTE type;
2602     BYTE pad1;
2603     CARD16 sequenceNumber;
2604     CARD32 length;
2605     CARD16 exactRed, exactGreen, exactBlue;
2606     CARD16 screenRed, screenGreen, screenBlue;
2607     CARD32 pad3;
2608     CARD32 pad4;
2609     CARD32 pad5;
2610 }
2611 struct xQueryBestSizeReply {
2612     BYTE type;
2613     BYTE pad1;
2614     CARD16 sequenceNumber;
2615     CARD32 length;
2616     CARD16 width, height;
2617     CARD32 pad3;
2618     CARD32 pad4;
2619     CARD32 pad5;
2620     CARD32 pad6;
2621     CARD32 pad7;
2622 }
2623 struct xQueryExtensionReply {
2624     BYTE type;
2625     BYTE pad1;
2626     CARD16 sequenceNumber;
2627     CARD32 length;
2628     BOOL present;
2629     CARD8 major_opcode;
2630     CARD8 first_event;
2631     CARD8 first_error;
2632     CARD32 pad3;
2633     CARD32 pad4;
2634     CARD32 pad5;
2635     CARD32 pad6;
2636     CARD32 pad7;
2637 }
2638 struct xListExtensionsReply {
2639     BYTE type;
2640     CARD8 nExtensions;
2641     CARD16 sequenceNumber;
2642     CARD32 length;
2643     CARD32 pad2;
2644     CARD32 pad3;
2645     CARD32 pad4;
2646     CARD32 pad5;
2647     CARD32 pad6;
2648     CARD32 pad7;
2649 }
2650 struct xSetMappingReply {
2651     BYTE type;
2652     CARD8 success;
2653     CARD16 sequenceNumber;
2654     CARD32 length;
2655     CARD32 pad2;
2656     CARD32 pad3;
2657     CARD32 pad4;
2658     CARD32 pad5;
2659     CARD32 pad6;
2660     CARD32 pad7;
2661 }
2662 alias xSetMappingReply xSetPointerMappingReply;
2663 alias xSetMappingReply xSetModifierMappingReply;
2664 struct xGetPointerMappingReply {
2665     BYTE type;
2666     CARD8 nElts;
2667     CARD16 sequenceNumber;
2668     CARD32 length;
2669     CARD32 pad2;
2670     CARD32 pad3;
2671     CARD32 pad4;
2672     CARD32 pad5;
2673     CARD32 pad6;
2674     CARD32 pad7;
2675 }
2676 struct xGetKeyboardMappingReply {
2677     BYTE type;
2678     CARD8 keySymsPerKeyCode;
2679     CARD16 sequenceNumber;
2680     CARD32 length;
2681     CARD32 pad2;
2682     CARD32 pad3;
2683     CARD32 pad4;
2684     CARD32 pad5;
2685     CARD32 pad6;
2686     CARD32 pad7;
2687 }
2688 struct xGetModifierMappingReply {
2689     BYTE type;
2690     CARD8 numKeyPerModifier;
2691     CARD16 sequenceNumber;
2692     CARD32 length;
2693     CARD32 pad1;
2694     CARD32 pad2;
2695     CARD32 pad3;
2696     CARD32 pad4;
2697     CARD32 pad5;
2698     CARD32 pad6;
2699 }
2700 struct xGetKeyboardControlReply {
2701     BYTE type;
2702     BOOL globalAutoRepeat;
2703     CARD16 sequenceNumber;
2704     CARD32 length;
2705     CARD32 ledMask;
2706     CARD8 keyClickPercent, bellPercent;
2707     CARD16 bellPitch, bellDuration;
2708     CARD16 pad;
2709     BYTE[32] map;
2710 }
2711 struct xGetPointerControlReply {
2712     BYTE type;
2713     BYTE pad1;
2714     CARD16 sequenceNumber;
2715     CARD32 length;
2716     CARD16 accelNumerator, accelDenominator;
2717     CARD16 threshold;
2718     CARD16 pad2;
2719     CARD32 pad3;
2720     CARD32 pad4;
2721     CARD32 pad5;
2722     CARD32 pad6;
2723 }
2724 struct xGetScreenSaverReply {
2725     BYTE type;
2726     BYTE pad1;
2727     CARD16 sequenceNumber;
2728     CARD32 length;
2729     CARD16 timeout, interval;
2730     BOOL preferBlanking;
2731     BOOL allowExposures;
2732     CARD16 pad2;
2733     CARD32 pad3;
2734     CARD32 pad4;
2735     CARD32 pad5;
2736     CARD32 pad6;
2737 }
2738 struct xListHostsReply {
2739     BYTE type;
2740     BOOL enabled;
2741     CARD16 sequenceNumber;
2742     CARD32 length;
2743     CARD16 nHosts;
2744     CARD16 pad1;
2745     CARD32 pad3;
2746     CARD32 pad4;
2747     CARD32 pad5;
2748     CARD32 pad6;
2749     CARD32 pad7;
2750 }
2751 struct xError {
2752     BYTE type;
2753     BYTE errorCode;
2754     CARD16 sequenceNumber;
2755     CARD32 resourceID;
2756     CARD16 minorCode;
2757     CARD8 majorCode;
2758     BYTE pad1;
2759     CARD32 pad3;
2760     CARD32 pad4;
2761     CARD32 pad5;
2762     CARD32 pad6;
2763     CARD32 pad7;
2764 }
2765 struct _xEvent {
2766     union u {
2767         struct u {
2768             BYTE type;
2769             BYTE detail;
2770             CARD16 sequenceNumber;
2771         }
2772         struct keyButtonPointer {
2773             CARD32 pad00;
2774             Time time;
2775             Window root, event, child;
2776             INT16 rootX, rootY, eventX, eventY;
2777             KeyButMask state;
2778             BOOL sameScreen;
2779             BYTE pad1;
2780         }
2781         struct enterLeave {
2782             CARD32 pad00;
2783             Time time;
2784             Window root, event, child;
2785             INT16 rootX, rootY, eventX, eventY;
2786             KeyButMask state;
2787             BYTE mode;
2788             BYTE flags;
2789             enum int ELFlagFocus = 1 << 0;
2790             enum int ELFlagSameScreen = 1 << 1;
2791         }
2792         struct focus {
2793             CARD32 pad00;
2794             Window window;
2795             BYTE mode;
2796             BYTE pad1, pad2, pad3;
2797         }
2798         struct expose {
2799             CARD32 pad00;
2800             Window window;
2801             CARD16 x, y, width, height;
2802             CARD16 count;
2803             CARD16 pad2;
2804         }
2805         struct graphicsExposure {
2806             CARD32 pad00;
2807             Drawable drawable;
2808             CARD16 x, y, width, height;
2809             CARD16 minorEvent;
2810             CARD16 count;
2811             BYTE majorEvent;
2812             BYTE pad1, pad2, pad3;
2813         }
2814         struct noExposure {
2815             CARD32 pad00;
2816             Drawable drawable;
2817             CARD16 minorEvent;
2818             BYTE majorEvent;
2819             BYTE bpad;
2820         }
2821         struct visibility {
2822             CARD32 pad00;
2823             Window window;
2824             CARD8 state;
2825             BYTE pad1, pad2, pad3;
2826         }
2827         struct createNotify {
2828             CARD32 pad00;
2829             Window parent, window;
2830             INT16 x, y;
2831             CARD16 width, height, borderWidth;
2832             BOOL c_override;
2833             BYTE bpad;
2834         }
2835         struct destroyNotify {
2836             CARD32 pad00;
2837             Window event, window;
2838         }
2839         struct unmapNotify {
2840             CARD32 pad00;
2841             Window event, window;
2842             BOOL fromConfigure;
2843             BYTE pad1, pad2, pad3;
2844         }
2845         struct mapNotify {
2846             CARD32 pad00;
2847             Window event, window;
2848             BOOL c_override;
2849             BYTE pad1, pad2, pad3;
2850         }
2851         struct mapRequest {
2852             CARD32 pad00;
2853             Window parent, window;
2854         }
2855         struct reparent {
2856             CARD32 pad00;
2857             Window event, window, parent;
2858             INT16 x, y;
2859             BOOL c_override;
2860             BYTE pad1, pad2, pad3;
2861         }
2862         struct configureNotify {
2863             CARD32 pad00;
2864             Window event, window, aboveSibling;
2865             INT16 x, y;
2866             CARD16 width, height, borderWidth;
2867             BOOL c_override;
2868             BYTE bpad;
2869         }
2870         struct configureRequest {
2871             CARD32 pad00;
2872             Window parent, window, sibling;
2873             INT16 x, y;
2874             CARD16 width, height, borderWidth;
2875             CARD16 valueMask;
2876             CARD32 pad1;
2877         }
2878         struct gravity {
2879             CARD32 pad00;
2880             Window event, window;
2881             INT16 x, y;
2882             CARD32 pad1, pad2, pad3, pad4;
2883         }
2884         struct resizeRequest {
2885             CARD32 pad00;
2886             Window window;
2887             CARD16 width, height;
2888         }
2889         struct circulate {
2890             CARD32 pad00;
2891             Window event, window, parent;
2892             BYTE place;
2893             BYTE pad1, pad2, pad3;
2894         }
2895         struct property {
2896             CARD32 pad00;
2897             Window window;
2898             Atom atom;
2899             Time time;
2900             BYTE state;
2901             BYTE pad1;
2902             CARD16 pad2;
2903         }
2904         struct selectionClear {
2905             CARD32 pad00;
2906             Time time;
2907             Window window;
2908             Atom atom;
2909         }
2910         struct selectionRequest {
2911             CARD32 pad00;
2912             Time time;
2913             Window owner, requestor;
2914             Atom selection, target, property;
2915         }
2916         struct selectionNotify {
2917             CARD32 pad00;
2918             Time time;
2919             Window requestor;
2920             Atom selection, target, property;
2921         }
2922         struct colormap {
2923             CARD32 pad00;
2924             Window window;
2925             Colormap colormap;
2926             BOOL c_new;
2927             BYTE state;
2928             BYTE pad1, pad2;
2929         }
2930         struct mappingNotify {
2931             CARD32 pad00;
2932             CARD8 request;
2933             KeyCode firstKeyCode;
2934             CARD8 count;
2935             BYTE pad1;
2936         }
2937         struct clientMessage {
2938             CARD32 pad00;
2939             Window window;
2940             union u {
2941                 struct l {
2942                     Atom type;
2943                     INT32 longs0;
2944                     INT32 longs1;
2945                     INT32 longs2;
2946                     INT32 longs3;
2947                     INT32 longs4;
2948                 }
2949                 struct s {
2950                     Atom type;
2951                     INT16 shorts0;
2952                     INT16 shorts1;
2953                     INT16 shorts2;
2954                     INT16 shorts3;
2955                     INT16 shorts4;
2956                     INT16 shorts5;
2957                     INT16 shorts6;
2958                     INT16 shorts7;
2959                     INT16 shorts8;
2960                     INT16 shorts9;
2961                 }
2962                 struct b {
2963                     Atom type;
2964                     INT8[20] bytes;
2965                 }
2966             }
2967         }
2968     }
2969 }
2970 alias _xEvent xEvent;
2971 struct xGenericEvent {
2972     BYTE type;
2973     CARD8 extension;
2974     CARD16 sequenceNumber;
2975     CARD32 length;
2976     CARD16 evtype;
2977     CARD16 pad2;
2978     CARD32 pad3;
2979     CARD32 pad4;
2980     CARD32 pad5;
2981     CARD32 pad6;
2982     CARD32 pad7;
2983 }
2984 struct xKeymapEvent {
2985     BYTE type;
2986     BYTE[31] map;
2987 }
2988 const size_t XEventSize = xEvent.sizeof;
2989 union xReply {
2990     xGenericReply generic;
2991     xGetGeometryReply geom;
2992     xQueryTreeReply tree;
2993     xInternAtomReply atom;
2994     xGetAtomNameReply atomName;
2995     xGetPropertyReply propertyReply;
2996     xListPropertiesReply listProperties;
2997     xGetSelectionOwnerReply selection;
2998     xGrabPointerReply grabPointer;
2999     xGrabKeyboardReply grabKeyboard;
3000     xQueryPointerReply pointer;
3001     xGetMotionEventsReply motionEvents;
3002     xTranslateCoordsReply coords;
3003     xGetInputFocusReply inputFocus;
3004     xQueryTextExtentsReply textExtents;
3005     xListFontsReply fonts;
3006     xGetFontPathReply fontPath;
3007     xGetImageReply image;
3008     xListInstalledColormapsReply colormaps;
3009     xAllocColorReply allocColor;
3010     xAllocNamedColorReply allocNamedColor;
3011     xAllocColorCellsReply colorCells;
3012     xAllocColorPlanesReply colorPlanes;
3013     xQueryColorsReply colors;
3014     xLookupColorReply lookupColor;
3015     xQueryBestSizeReply bestSize;
3016     xQueryExtensionReply extension;
3017     xListExtensionsReply extensions;
3018     xSetModifierMappingReply setModifierMapping;
3019     xGetModifierMappingReply getModifierMapping;
3020     xSetPointerMappingReply setPointerMapping;
3021     xGetKeyboardMappingReply getKeyboardMapping;
3022     xGetPointerMappingReply getPointerMapping;
3023     xGetPointerControlReply pointerControl;
3024     xGetScreenSaverReply screenSaver;
3025     xListHostsReply hosts;
3026     xError error;
3027     xEvent event;
3028 }
3029 struct _xReq {
3030     CARD8 reqType;
3031     CARD8 data;
3032     CARD16 length;
3033 }
3034 alias _xReq xReq;
3035 struct xResourceReq {
3036     CARD8 reqType;
3037     BYTE pad;
3038     CARD16 length;
3039     CARD32 id;
3040 }
3041 struct Box {
3042     short x1, x2, y1, y2;
3043 }
3044 alias Box BOX;
3045 alias Box BoxRec;
3046 int MAX(int a, int b) {
3047     return (a < b) ? b : a;
3048 }
3049 int MIN(int a, int b) {
3050     return (a > b) ? b : a;
3051 }
3052 struct _XRegion {
3053     c_long size;
3054     c_long numRects;
3055     BOX* rects;
3056     BOX extents;
3057 }
3058 alias _XRegion REGION;
3059 alias int XrmQuark;
3060 alias int* XrmQuarkList;
3061 const XrmQuark NULLQUARK = 0;
3062 alias char* XrmString;
3063 const XrmString NULLSTRING = null;
3064 XrmQuark XrmStringToQuark(const char*);
3065 XrmQuark XrmPermStringToQuark(const char*);
3066 XrmString XrmQuarkToString(XrmQuark);
3067 XrmQuark XrmUniqueQuark();
3068 bool XrmStringsEqual(XrmString a1, XrmString a2) {
3069     return *a1 == *a2;
3070 }
3071 alias int XrmBinding;
3072 enum {
3073     XrmBindTightly,
3074     XrmBindLoosely
3075 }
3076 alias XrmBinding* XrmBindingList;
3077 void XrmStringToQuarkList(const char*, XrmQuarkList);
3078 void XrmStringToBindingQuarkList(const char*, XrmBindingList, XrmQuarkList);
3079 alias XrmQuark XrmName;
3080 alias XrmQuarkList XrmNameList;
3081 XrmString XrmNameToString(XrmName name) {
3082     return XrmQuarkToString(cast(XrmQuark) name);
3083 }
3084 XrmName XrmStringToName(XrmString string) {
3085     return cast(XrmName) XrmStringToQuark(string);
3086 }
3087 void XrmStringToNameList(XrmString str, XrmNameList name) {
3088     XrmStringToQuarkList(str, name);
3089 }
3090 alias XrmQuark XrmClass;
3091 alias XrmQuarkList XrmClassList;
3092 XrmString XrmClassToString(XrmClass c_class) {
3093     return XrmQuarkToString(cast(XrmQuark) c_class);
3094 }
3095 XrmClass XrmStringToClass(XrmString c_class) {
3096     return cast(XrmClass) XrmStringToQuark(c_class);
3097 }
3098 void XrmStringToClassList(XrmString str, XrmClassList c_class) {
3099     XrmStringToQuarkList(str, c_class);
3100 }
3101 alias XrmQuark XrmRepresentation;
3102 XrmRepresentation XrmStringToRepresentation(XrmString string) {
3103     return cast(XrmRepresentation) XrmStringToQuark(string);
3104 }
3105 XrmString XrmRepresentationToString(XrmRepresentation type) {
3106     return XrmQuarkToString(type);
3107 }
3108 struct XrmValue {
3109     uint size;
3110     XPointer addr;
3111 }
3112 alias XrmValue* XrmValuePtr;
3113 alias _XrmHashBucketRec* XrmHashBucket;
3114 alias XrmHashBucket* XrmHashTable;
3115 alias XrmHashTable[] XrmSearchList;
3116 alias _XrmHashBucketRec* XrmDatabase;
3117 void XrmDestroyDatabase(XrmDatabase);
3118 void XrmQPutResource(XrmDatabase*, XrmBindingList, XrmQuarkList, XrmRepresentation, XrmValue*);
3119 Bool XrmQGetResource(XrmDatabase, XrmNameList, XrmClassList, XrmRepresentation*, XrmValue*);Bool XrmGetResource(XrmDatabase, const char*, const char*, char**, XrmValue*);Bool XrmQGetSearchList(XrmDatabase, XrmNameList, XrmClassList, XrmSearchList, int);Bool XrmQGetSearchResource(XrmSearchList, XrmName, XrmClass, XrmRepresentation*, XrmValue*);XrmDatabase XrmGetStringDatabase(const char*);
3120 void XrmPutFileDatabase(XrmDatabase, const char*);
3121 void XrmMergeDatabases(XrmDatabase, XrmDatabase*);
3122 void XrmCombineDatabase(XrmDatabase, XrmDatabase*, Bool);
3123 alias int XrmOptionKind;
3124 enum {
3125     XrmoptionNoArg,
3126     XrmoptionIsArg,
3127     XrmoptionStickyArg,
3128     XrmoptionSepArg,
3129     XrmoptionResArg,
3130     XrmoptionSkipArg,
3131     XrmoptionSkipLine,
3132     XrmoptionSkipNArgs
3133 }
3134 struct XrmOptionDescRec {
3135     char* option;
3136     char* specifier;
3137     XrmOptionKind argKind;
3138     XPointer value;
3139 }
3140 alias XrmOptionDescRec* XrmOptionDescList;
3141 void XrmParseCommand(XrmDatabase*, XrmOptionDescList, int, const char*, int*, char**);
3142 enum bool WORD64 = false;
3143 enum int NoValue = 0x0000;
3144 enum int AllValues = 0x000F;
3145 enum int XNegative = 0x0010;
3146 enum int YNegative = 0x0020;
3147 struct XSizeHints {
3148     c_long flags;
3149     int x, y;
3150     int width, height;
3151     int min_width, min_height;
3152     int max_width, max_height;
3153     int width_inc, height_inc;
3154     struct aspect {
3155         int x;
3156         int y;
3157     }
3158     aspect min_aspect, max_aspect;
3159     int base_width, base_height;
3160     int win_gravity;
3161 }
3162 enum {
3163     USPosition = 1L << 0,
3164     USSize = 1L << 1,
3165     PPosition = 1L << 2,
3166     PSize = 1L << 3,
3167     PMinSize = 1L << 4,
3168     PMaxSize = 1L << 5,
3169     PResizeInc = 1L << 6,
3170     PAspect = 1L << 7,
3171     PBaseSize = 1L << 8,
3172     PWinGravity = 1L << 9
3173 }
3174 c_long PAllHints = (PPosition | PSize | PMinSize | PMaxSize | PResizeInc | PAspect);
3175 struct XWMHints {
3176     c_long flags;
3177     Bool input;
3178     int initial_state;
3179     Pixmap icon_pixmap;
3180     Window icon_window;
3181     int icon_x, icon_y;
3182     Pixmap icon_mask;
3183     XID window_group;
3184 }
3185 enum {
3186     InputHint = (1L << 0),
3187     StateHint = (1L << 1),
3188     IconPixmapHint = (1L << 2),
3189     IconWindowHint = (1L << 3),
3190     IconPositionHint = (1L << 4),
3191     IconMaskHint = (1L << 5),
3192     WindowGroupHint = (1L << 6),
3193     AllHints = (InputHint | StateHint | IconPixmapHint | IconWindowHint
3194             | IconPositionHint | IconMaskHint | WindowGroupHint),
3195     XUrgencyHint = (1L << 8)
3196 }
3197 enum {
3198     WithdrawnState = 0,
3199     NormalState = 1,
3200     IconicState = 3
3201 }
3202 enum {
3203     DontCareState = 0,
3204     ZoomState = 2,
3205     InactiveState = 4
3206 }
3207 struct XTextProperty {
3208     ubyte* value;
3209     Atom encoding;
3210     int format;
3211     c_ulong nitems;
3212 }
3213 enum int XNoMemory = -1;
3214 struct XIconSize {
3215     int min_width, min_height;
3216     int max_width, max_height;
3217     int width_inc, height_inc;
3218 }
3219 struct XClassHint {
3220     char* res_name;
3221     char* res_class;
3222 }
3223 struct XComposeStatus {
3224     XPointer compose_ptr;
3225     int chars_matched;
3226 }
3227 template IsKeypadKey(KeySym keysym) {
3228     const bool IsKeypadKey = ((keysym >= XK_KP_Space) && (keysym <= XK_KP_Equal));
3229 }
3230 template IsPrivateKeypadKey(KeySym keysym) {
3231     const bool IsPrivateKeypadKey = ((keysym >= 0x11000000) && (keysym <= 0x1100FFFF));
3232 }
3233 static if (XK_XKB_KEYS) {
3234     template IsModifierKey(KeySym keysym) {
3235         const bool IsModifierKey = (((keysym >= XK_Shift_L) && (keysym <= XK_Hyper_R))
3236                 || ((keysym >= XK_ISO_Lock) && (keysym <= XK_ISO_Last_Group_Lock))
3237                 || (keysym == XK_Mode_switch) || (keysym == XK_Num_Lock));
3238     }
3239 } else {
3240     template IsModifierKey(keysym) {
3241         const bool IsModifierKey = (((keysym >= XK_Shift_L) && (keysym <= XK_Hyper_R))
3242                 || (keysym == XK_Mode_switch) || (keysym == XK_Num_Lock));
3243     }
3244 }
3245 alias _XRegion* Region;
3246 enum {
3247     RectangleOut = 0,
3248     RectangleIn = 1,
3249     RectanglePart = 2
3250 }
3251 struct XVisualInfo {
3252     Visual* visual;
3253     VisualID visualid;
3254     int screen;
3255     int depth;
3256     int c_class;
3257     c_ulong red_mask;
3258     c_ulong green_mask;
3259     c_ulong blue_mask;
3260     int colormap_size;
3261     int bits_per_rgb;
3262 }
3263 enum {
3264     VisualNoMask = 0x0,
3265     VisualIDMask = 0x1,
3266     VisualScreenMask = 0x2,
3267     VisualDepthMask = 0x4,
3268     VisualClassMask = 0x8,
3269     VisualRedMaskMask = 0x10,
3270     VisualGreenMaskMask = 0x20,
3271     VisualBlueMaskMask = 0x40,
3272     VisualColormapSizeMask = 0x80,
3273     VisualBitsPerRGBMask = 0x100,
3274     VisualAllMask = 0x1FF
3275 }
3276 struct XStandardColormap {
3277     Colormap colormap;
3278     c_ulong red_max;
3279     c_ulong red_mult;
3280     c_ulong green_max;
3281     c_ulong green_mult;
3282     c_ulong blue_max;
3283     c_ulong blue_mult;
3284     c_ulong base_pixel;
3285     VisualID visualid;
3286     XID killid;
3287 }
3288 const XID ReleaseByFreeingColormap = 1L;
3289 enum {
3290     BitmapSuccess = 0,
3291     BitmapOpenFailed = 1,
3292     BitmapFileInvalid = 2,
3293     BitmapNoMemory = 3
3294 }
3295 enum {
3296     XCSUCCESS = 0,
3297     XCNOMEM = 1,
3298     XCNOENT = 2,
3299 }
3300 alias int XContext;
3301 extern(D) auto XUniqueContext() {
3302     return cast(XContext) XrmUniqueQuark();
3303 }
3304 XContext XStringToContext(char* statement) {
3305     return XrmStringToQuark(statement);
3306 }
3307 XClassHint* XAllocClassHint();
3308 XIconSize* XAllocIconSize();
3309 XSizeHints* XAllocSizeHints();
3310 XStandardColormap* XAllocStandardColormap();
3311 XWMHints* XAllocWMHints();
3312 int XClipBox(Region, XRectangle*);
3313 Region XCreateRegion();
3314 char* XDefaultString();
3315 int XDeleteContext(Display*, XID, XContext);
3316 int XDestroyRegion(Region);
3317 int XEmptyRegion(Region);
3318 int XEqualRegion(Region, Region);
3319 int XFindContext(Display*, XID, XContext, XPointer*);
3320 Status XGetClassHint(Display*, Window, XClassHint*);
3321 Status XGetIconSizes(Display*, Window, XIconSize**, int*);
3322 Status XGetNormalHints(Display*, Window, XSizeHints*);
3323 XVisualInfo* XGetVisualInfo(Display*, long, XVisualInfo*, int*);
3324 Status XGetWMClientMachine(Display*, Window, XTextProperty*);
3325 XWMHints* XGetWMHints(Display*, Window);
3326 Status XGetWMIconName(Display*, Window, XTextProperty*);
3327 Status XGetWMName(Display*, Window, XTextProperty*);
3328 Status XGetWMNormalHints(Display*, Window, XSizeHints*, long*);
3329 Status XGetWMSizeHints(Display*, Window, XSizeHints*, long*, Atom);
3330 Status XGetZoomHints(Display*, Window, XSizeHints*);
3331 int XIntersectRegion(Region, Region, Region);
3332 void XConvertCase(KeySym, KeySym*, KeySym*);
3333 int XLookupString(XKeyEvent*, char*, int, KeySym*, XComposeStatus*);
3334 Status XMatchVisualInfo(Display*, int, int, int, XVisualInfo*);
3335 int XSaveContext(Display*, XID, XContext, char*);
3336 int XSetClassHint(Display*, Window, XClassHint*);
3337 int XSetIconSizes(Display*, Window, XIconSize*, int);
3338 int XSetNormalHints(Display*, Window, XSizeHints*);
3339 void XSetWMClientMachine(Display*, Window, XTextProperty*);
3340 int XSetWMHints(Display*, Window, XWMHints*);
3341 void XSetWMIconName(Display*, Window, XTextProperty*);
3342 void XSetWMName(Display*, Window, XTextProperty*);
3343 void XSetWMNormalHints(Display*, Window, XSizeHints*);
3344 void XSetWMProperties(Display*, Window, XTextProperty*, XTextProperty*, char**, int, XSizeHints*, XWMHints*, XClassHint*);
3345 void XmbSetWMProperties(Display*, Window, const(char)*, const(char)*, const(char)**, int, XSizeHints*, XWMHints*, XClassHint*);
3346 void Xutf8SetWMProperties(Display*, Window, char*, char*, char**, int, XSizeHints*, XWMHints*, XClassHint*);
3347 enum XC_cross_reverse = 32;
3348 enum XC_crosshair = 34;
3349 enum XC_diamond_cross = 36;
3350 enum XC_dot = 38;
3351 enum XC_gumby = 56;
3352 enum XC_hand1 = 58;
3353 enum XC_hand2 = 60;
3354 enum XC_heart = 62;
3355 enum XC_icon = 64;
3356 enum XC_iron_cross = 66;
3357 enum XC_left_ptr = 68;
3358 enum XC_left_side = 70;
3359 enum XC_sailboat = 104;
3360 enum XC_sb_down_arrow = 106;
3361 enum XC_sb_h_double_arrow = 108;
3362 enum XC_sb_left_arrow = 110;
3363 enum XC_sb_right_arrow = 112;
3364 enum XC_sb_up_arrow = 114;
3365 enum XC_sb_v_double_arrow = 116;
3366 enum XC_shuttle = 118;
3367 enum XC_xterm = 152;
3368 enum bool XK_MISCELLANY = true;
3369 enum bool XK_XKB_KEYS = true;
3370 enum bool XK_3270 = false;
3371 enum bool XK_LATIN1 = true;
3372 enum bool XK_LATIN2 = true;
3373 enum bool XK_LATIN3 = true;
3374 enum bool XK_LATIN4 = true;
3375 enum bool XK_SINHALA = true;
3376 enum int XK_VoidSymbol = 0xffffff;
3377 static if (XK_MISCELLANY) {
3378     enum int XK_BackSpace = 0xff08;
3379     enum int XK_Tab = 0xff09;
3380     enum int XK_Linefeed = 0xff0a;
3381     enum int XK_Clear = 0xff0b;
3382     enum int XK_Return = 0xff0d;
3383     enum int XK_Pause = 0xff13;
3384     enum int XK_Scroll_Lock = 0xff14;
3385     enum int XK_Sys_Req = 0xff15;
3386     enum int XK_Escape = 0xff1b;
3387     enum int XK_Delete = 0xffff;
3388     enum int XK_Multi_key = 0xff20;
3389     enum int XK_Codeinput = 0xff37;
3390     enum int XK_SingleCandidate = 0xff3c;
3391     enum int XK_MultipleCandidate = 0xff3d;
3392     enum int XK_PreviousCandidate = 0xff3e;
3393     enum int XK_Kanji = 0xff21;
3394     enum int XK_Muhenkan = 0xff22;
3395     enum int XK_Henkan_Mode = 0xff23;
3396     enum int XK_Henkan = 0xff23;
3397     enum int XK_Romaji = 0xff24;
3398     enum int XK_Hiragana = 0xff25;
3399     enum int XK_Katakana = 0xff26;
3400     enum int XK_Hiragana_Katakana = 0xff27;
3401     enum int XK_Zenkaku = 0xff28;
3402     enum int XK_Hankaku = 0xff29;
3403     enum int XK_Zenkaku_Hankaku = 0xff2a;
3404     enum int XK_Touroku = 0xff2b;
3405     enum int XK_Massyo = 0xff2c;
3406     enum int XK_Kana_Lock = 0xff2d;
3407     enum int XK_Kana_Shift = 0xff2e;
3408     enum int XK_Eisu_Shift = 0xff2f;
3409     enum int XK_Eisu_toggle = 0xff30;
3410     enum int XK_Kanji_Bangou = 0xff37;
3411     enum int XK_Zen_Koho = 0xff3d;
3412     enum int XK_Mae_Koho = 0xff3e;
3413     enum int XK_Home = 0xff50;
3414     enum int XK_Left = 0xff51;
3415     enum int XK_Up = 0xff52;
3416     enum int XK_Right = 0xff53;
3417     enum int XK_Down = 0xff54;
3418     enum int XK_Prior = 0xff55;
3419     enum int XK_Page_Up = 0xff55;
3420     enum int XK_Next = 0xff56;
3421     enum int XK_Page_Down = 0xff56;
3422     enum int XK_End = 0xff57;
3423     enum int XK_Begin = 0xff58;
3424     enum int XK_Select = 0xff60;
3425     enum int XK_Print = 0xff61;
3426     enum int XK_Execute = 0xff62;
3427     enum int XK_Insert = 0xff63;
3428     enum int XK_Undo = 0xff65;
3429     enum int XK_Redo = 0xff66;
3430     enum int XK_Menu = 0xff67;
3431     enum int XK_Find = 0xff68;
3432     enum int XK_Cancel = 0xff69;
3433     enum int XK_Help = 0xff6a;
3434     enum int XK_break = 0xff6b;
3435     enum int XK_Mode_switch = 0xff7e;
3436     enum int XK_script_switch = 0xff7e;
3437     enum int XK_Num_Lock = 0xff7f;
3438     enum int XK_KP_Space = 0xff80;
3439     enum int XK_KP_Tab = 0xff89;
3440     enum int XK_KP_Enter = 0xff8d;
3441     enum int XK_KP_F1 = 0xff91;
3442     enum int XK_KP_F2 = 0xff92;
3443     enum int XK_KP_F3 = 0xff93;
3444     enum int XK_KP_F4 = 0xff94;
3445     enum int XK_KP_Home = 0xff95;
3446     enum int XK_KP_Left = 0xff96;
3447     enum int XK_KP_Up = 0xff97;
3448     enum int XK_KP_Right = 0xff98;
3449     enum int XK_KP_Down = 0xff99;
3450     enum int XK_KP_Prior = 0xff9a;
3451     enum int XK_KP_Page_Up = 0xff9a;
3452     enum int XK_KP_Next = 0xff9b;
3453     enum int XK_KP_Page_Down = 0xff9b;
3454     enum int XK_KP_End = 0xff9c;
3455     enum int XK_KP_Begin = 0xff9d;
3456     enum int XK_KP_Insert = 0xff9e;
3457     enum int XK_KP_Delete = 0xff9f;
3458     enum int XK_KP_Equal = 0xffbd;
3459     enum int XK_KP_Multiply = 0xffaa;
3460     enum int XK_KP_Add = 0xffab;
3461     enum int XK_KP_Separator = 0xffac;
3462     enum int XK_KP_Subtract = 0xffad;
3463     enum int XK_KP_Decimal = 0xffae;
3464     enum int XK_KP_Divide = 0xffaf;
3465     enum int XK_KP_0 = 0xffb0;
3466     enum int XK_KP_1 = 0xffb1;
3467     enum int XK_KP_2 = 0xffb2;
3468     enum int XK_KP_3 = 0xffb3;
3469     enum int XK_KP_4 = 0xffb4;
3470     enum int XK_KP_5 = 0xffb5;
3471     enum int XK_KP_6 = 0xffb6;
3472     enum int XK_KP_7 = 0xffb7;
3473     enum int XK_KP_8 = 0xffb8;
3474     enum int XK_KP_9 = 0xffb9;
3475     enum int XK_F1 = 0xffbe;
3476     enum int XK_F2 = 0xffbf;
3477     enum int XK_F3 = 0xffc0;
3478     enum int XK_F4 = 0xffc1;
3479     enum int XK_F5 = 0xffc2;
3480     enum int XK_F6 = 0xffc3;
3481     enum int XK_F7 = 0xffc4;
3482     enum int XK_F8 = 0xffc5;
3483     enum int XK_F9 = 0xffc6;
3484     enum int XK_F10 = 0xffc7;
3485     enum int XK_F11 = 0xffc8;
3486     enum int XK_L1 = 0xffc8;
3487     enum int XK_F12 = 0xffc9;
3488     enum int XK_L2 = 0xffc9;
3489     enum int XK_F13 = 0xffca;
3490     enum int XK_L3 = 0xffca;
3491     enum int XK_F14 = 0xffcb;
3492     enum int XK_L4 = 0xffcb;
3493     enum int XK_F15 = 0xffcc;
3494     enum int XK_L5 = 0xffcc;
3495     enum int XK_F16 = 0xffcd;
3496     enum int XK_L6 = 0xffcd;
3497     enum int XK_F17 = 0xffce;
3498     enum int XK_L7 = 0xffce;
3499     enum int XK_F18 = 0xffcf;
3500     enum int XK_L8 = 0xffcf;
3501     enum int XK_F19 = 0xffd0;
3502     enum int XK_L9 = 0xffd0;
3503     enum int XK_F20 = 0xffd1;
3504     enum int XK_L10 = 0xffd1;
3505     enum int XK_F21 = 0xffd2;
3506     enum int XK_R1 = 0xffd2;
3507     enum int XK_F22 = 0xffd3;
3508     enum int XK_R2 = 0xffd3;
3509     enum int XK_F23 = 0xffd4;
3510     enum int XK_R3 = 0xffd4;
3511     enum int XK_F24 = 0xffd5;
3512     enum int XK_R4 = 0xffd5;
3513     enum int XK_F25 = 0xffd6;
3514     enum int XK_R5 = 0xffd6;
3515     enum int XK_F26 = 0xffd7;
3516     enum int XK_R6 = 0xffd7;
3517     enum int XK_F27 = 0xffd8;
3518     enum int XK_R7 = 0xffd8;
3519     enum int XK_F28 = 0xffd9;
3520     enum int XK_R8 = 0xffd9;
3521     enum int XK_F29 = 0xffda;
3522     enum int XK_R9 = 0xffda;
3523     enum int XK_F30 = 0xffdb;
3524     enum int XK_R10 = 0xffdb;
3525     enum int XK_F31 = 0xffdc;
3526     enum int XK_R11 = 0xffdc;
3527     enum int XK_F32 = 0xffdd;
3528     enum int XK_R12 = 0xffdd;
3529     enum int XK_F33 = 0xffde;
3530     enum int XK_R13 = 0xffde;
3531     enum int XK_F34 = 0xffdf;
3532     enum int XK_R14 = 0xffdf;
3533     enum int XK_F35 = 0xffe0;
3534     enum int XK_R15 = 0xffe0;
3535     enum int XK_Shift_L = 0xffe1;
3536     enum int XK_Shift_R = 0xffe2;
3537     enum int XK_Control_L = 0xffe3;
3538     enum int XK_Control_R = 0xffe4;
3539     enum int XK_Caps_Lock = 0xffe5;
3540     enum int XK_Shift_Lock = 0xffe6;
3541     enum int XK_Meta_L = 0xffe7;
3542     enum int XK_Meta_R = 0xffe8;
3543     enum int XK_Alt_L = 0xffe9;
3544     enum int XK_Alt_R = 0xffea;
3545     enum int XK_Super_L = 0xffeb;
3546     enum int XK_Super_R = 0xffec;
3547     enum int XK_Hyper_L = 0xffed;
3548     enum int XK_Hyper_R = 0xffee;
3549 }
3550 static if (XK_XKB_KEYS) {
3551     enum int XK_ISO_Lock = 0xfe01;
3552     enum int XK_ISO_Level2_Latch = 0xfe02;
3553     enum int XK_ISO_Level3_Shift = 0xfe03; // used
3554     enum int XK_ISO_Level3_Latch = 0xfe04;
3555     enum int XK_ISO_Level3_Lock = 0xfe05;
3556     enum int XK_ISO_Level5_Shift = 0xfe11;
3557     enum int XK_ISO_Level5_Latch = 0xfe12;
3558     enum int XK_ISO_Level5_Lock = 0xfe13;
3559     enum int XK_ISO_Group_Shift = 0xff7e;
3560     enum int XK_ISO_Group_Latch = 0xfe06;
3561     enum int XK_ISO_Group_Lock = 0xfe07;
3562     enum int XK_ISO_Next_Group = 0xfe08;
3563     enum int XK_ISO_Next_Group_Lock = 0xfe09;
3564     enum int XK_ISO_Prev_Group = 0xfe0a;
3565     enum int XK_ISO_Prev_Group_Lock = 0xfe0b;
3566     enum int XK_ISO_First_Group = 0xfe0c;
3567     enum int XK_ISO_First_Group_Lock = 0xfe0d;
3568     enum int XK_ISO_Last_Group = 0xfe0e;
3569     enum int XK_ISO_Last_Group_Lock = 0xfe0f;
3570     enum int XK_ISO_Left_Tab = 0xfe20;
3571     enum int XK_ISO_Move_Line_Up = 0xfe21;
3572     enum int XK_ISO_Move_Line_Down = 0xfe22;
3573     enum int XK_ISO_Partial_Line_Up = 0xfe23;
3574     enum int XK_ISO_Partial_Line_Down = 0xfe24;
3575     enum int XK_ISO_Partial_Space_Left = 0xfe25;
3576     enum int XK_ISO_Partial_Space_Right = 0xfe26;
3577     enum int XK_ISO_Set_Margin_Left = 0xfe27;
3578     enum int XK_ISO_Set_Margin_Right = 0xfe28;
3579     enum int XK_ISO_Release_Margin_Left = 0xfe29;
3580     enum int XK_ISO_Release_Margin_Right = 0xfe2a;
3581     enum int XK_ISO_Release_Both_Margins = 0xfe2b;
3582     enum int XK_ISO_Fast_Cursor_Left = 0xfe2c;
3583     enum int XK_ISO_Fast_Cursor_Right = 0xfe2d;
3584     enum int XK_ISO_Fast_Cursor_Up = 0xfe2e;
3585     enum int XK_ISO_Fast_Cursor_Down = 0xfe2f;
3586     enum int XK_ISO_Continuous_Underline = 0xfe30;
3587     enum int XK_ISO_Discontinuous_Underline = 0xfe31;
3588     enum int XK_ISO_Emphasize = 0xfe32;
3589     enum int XK_ISO_Center_Object = 0xfe33;
3590     enum int XK_ISO_Enter = 0xfe34;
3591     enum int XK_dead_grave = 0xfe50;
3592     enum int XK_dead_acute = 0xfe51;
3593     enum int XK_dead_circumflex = 0xfe52;
3594     enum int XK_dead_tilde = 0xfe53;
3595     enum int XK_dead_perispomeni = 0xfe53;
3596     enum int XK_dead_macron = 0xfe54;
3597     enum int XK_dead_breve = 0xfe55;
3598     enum int XK_dead_abovedot = 0xfe56;
3599     enum int XK_dead_diaeresis = 0xfe57;
3600     enum int XK_dead_abovering = 0xfe58;
3601     enum int XK_dead_doubleacute = 0xfe59;
3602     enum int XK_dead_caron = 0xfe5a;
3603     enum int XK_dead_cedilla = 0xfe5b;
3604     enum int XK_dead_ogonek = 0xfe5c;
3605     enum int XK_dead_iota = 0xfe5d;
3606     enum int XK_dead_voiced_sound = 0xfe5e;
3607     enum int XK_dead_semivoiced_sound = 0xfe5f;
3608     enum int XK_dead_belowdot = 0xfe60;
3609     enum int XK_dead_hook = 0xfe61;
3610     enum int XK_dead_horn = 0xfe62;
3611     enum int XK_dead_stroke = 0xfe63;
3612     enum int XK_dead_abovecomma = 0xfe64;
3613     enum int XK_dead_psili = 0xfe64;
3614     enum int XK_dead_abovereversedcomma = 0xfe65;
3615     enum int XK_dead_dasia = 0xfe65;
3616     enum int XK_dead_doublegrave = 0xfe66;
3617     enum int XK_dead_belowring = 0xfe67;
3618     enum int XK_dead_belowmacron = 0xfe68;
3619     enum int XK_dead_belowcircumflex = 0xfe69;
3620     enum int XK_dead_belowtilde = 0xfe6a;
3621     enum int XK_dead_belowbreve = 0xfe6b;
3622     enum int XK_dead_belowdiaeresis = 0xfe6c;
3623     enum int XK_dead_invertedbreve = 0xfe6d;
3624     enum int XK_dead_belowcomma = 0xfe6e;
3625     enum int XK_dead_currency = 0xfe6f;
3626     enum int XK_dead_a = 0xfe80;
3627     enum int XK_dead_A = 0xfe81;
3628     enum int XK_dead_e = 0xfe82;
3629     enum int XK_dead_E = 0xfe83;
3630     enum int XK_dead_i = 0xfe84;
3631     enum int XK_dead_I = 0xfe85;
3632     enum int XK_dead_o = 0xfe86;
3633     enum int XK_dead_O = 0xfe87;
3634     enum int XK_dead_u = 0xfe88;
3635     enum int XK_dead_U = 0xfe89;
3636     enum int XK_dead_small_schwa = 0xfe8a;
3637     enum int XK_dead_capital_schwa = 0xfe8b;
3638     enum int XK_First_Virtual_Screen = 0xfed0;
3639     enum int XK_Prev_Virtual_Screen = 0xfed1;
3640     enum int XK_Next_Virtual_Screen = 0xfed2;
3641     enum int XK_Last_Virtual_Screen = 0xfed4;
3642     enum int XK_Terminate_Server = 0xfed5;
3643     enum int XK_AccessX_Enable = 0xfe70;
3644     enum int XK_AccessX_Feedback_Enable = 0xfe71;
3645     enum int XK_RepeatKeys_Enable = 0xfe72;
3646     enum int XK_SlowKeys_Enable = 0xfe73;
3647     enum int XK_BounceKeys_Enable = 0xfe74;
3648     enum int XK_StickyKeys_Enable = 0xfe75;
3649     enum int XK_MouseKeys_Enable = 0xfe76;
3650     enum int XK_MouseKeys_Accel_Enable = 0xfe77;
3651     enum int XK_Overlay1_Enable = 0xfe78;
3652     enum int XK_Overlay2_Enable = 0xfe79;
3653     enum int XK_AudibleBell_Enable = 0xfe7a;
3654     enum int XK_Pointer_Left = 0xfee0;
3655     enum int XK_Pointer_Right = 0xfee1;
3656     enum int XK_Pointer_Up = 0xfee2;
3657     enum int XK_Pointer_Down = 0xfee3;
3658     enum int XK_Pointer_UpLeft = 0xfee4;
3659     enum int XK_Pointer_UpRight = 0xfee5;
3660     enum int XK_Pointer_DownLeft = 0xfee6;
3661     enum int XK_Pointer_DownRight = 0xfee7;
3662     enum int XK_Pointer_Button_Dflt = 0xfee8;
3663     enum int XK_Pointer_Button1 = 0xfee9;
3664     enum int XK_Pointer_Button2 = 0xfeea;
3665     enum int XK_Pointer_Button3 = 0xfeeb;
3666     enum int XK_Pointer_Button4 = 0xfeec;
3667     enum int XK_Pointer_Button5 = 0xfeed;
3668     enum int XK_Pointer_DblClick_Dflt = 0xfeee;
3669     enum int XK_Pointer_DblClick1 = 0xfeef;
3670     enum int XK_Pointer_DblClick2 = 0xfef0;
3671     enum int XK_Pointer_DblClick3 = 0xfef1;
3672     enum int XK_Pointer_DblClick4 = 0xfef2;
3673     enum int XK_Pointer_DblClick5 = 0xfef3;
3674     enum int XK_Pointer_Drag_Dflt = 0xfef4;
3675     enum int XK_Pointer_Drag1 = 0xfef5;
3676     enum int XK_Pointer_Drag2 = 0xfef6;
3677     enum int XK_Pointer_Drag3 = 0xfef7;
3678     enum int XK_Pointer_Drag4 = 0xfef8;
3679     enum int XK_Pointer_Drag5 = 0xfefd;
3680     enum int XK_Pointer_EnableKeys = 0xfef9;
3681     enum int XK_Pointer_Accelerate = 0xfefa;
3682     enum int XK_Pointer_DfltBtnNext = 0xfefb;
3683     enum int XK_Pointer_DfltBtnPrev = 0xfefc;
3684 }
3685 static if (XK_LATIN1) {
3686     enum int XK_space = 0x0020;
3687     enum int XK_exclam = 0x0021;
3688     enum int XK_quotedbl = 0x0022;
3689     enum int XK_numbersign = 0x0023;
3690     enum int XK_dollar = 0x0024;
3691     enum int XK_percent = 0x0025;
3692     enum int XK_ampersand = 0x0026;
3693     enum int XK_apostrophe = 0x0027;
3694     enum int XK_quoteright = 0x0027;
3695     enum int XK_parenleft = 0x0028;
3696     enum int XK_parenright = 0x0029;
3697     enum int XK_asterisk = 0x002a;
3698     enum int XK_plus = 0x002b;
3699     enum int XK_comma = 0x002c;
3700     enum int XK_minus = 0x002d;
3701     enum int XK_period = 0x002e;
3702     enum int XK_slash = 0x002f;
3703     enum int XK_0 = 0x0030;
3704     enum int XK_1 = 0x0031;
3705     enum int XK_2 = 0x0032;
3706     enum int XK_3 = 0x0033;
3707     enum int XK_4 = 0x0034;
3708     enum int XK_5 = 0x0035;
3709     enum int XK_6 = 0x0036;
3710     enum int XK_7 = 0x0037;
3711     enum int XK_8 = 0x0038;
3712     enum int XK_9 = 0x0039;
3713     enum int XK_colon = 0x003a;
3714     enum int XK_semicolon = 0x003b;
3715     enum int XK_less = 0x003c;
3716     enum int XK_equal = 0x003d;
3717     enum int XK_greater = 0x003e;
3718     enum int XK_question = 0x003f;
3719     enum int XK_at = 0x0040;
3720     enum int XK_A = 0x0041;
3721     enum int XK_B = 0x0042;
3722     enum int XK_C = 0x0043;
3723     enum int XK_D = 0x0044;
3724     enum int XK_E = 0x0045;
3725     enum int XK_F = 0x0046;
3726     enum int XK_G = 0x0047;
3727     enum int XK_H = 0x0048;
3728     enum int XK_I = 0x0049;
3729     enum int XK_J = 0x004a;
3730     enum int XK_K = 0x004b;
3731     enum int XK_L = 0x004c;
3732     enum int XK_M = 0x004d;
3733     enum int XK_N = 0x004e;
3734     enum int XK_O = 0x004f;
3735     enum int XK_P = 0x0050;
3736     enum int XK_Q = 0x0051;
3737     enum int XK_R = 0x0052;
3738     enum int XK_S = 0x0053;
3739     enum int XK_T = 0x0054;
3740     enum int XK_U = 0x0055;
3741     enum int XK_V = 0x0056;
3742     enum int XK_W = 0x0057;
3743     enum int XK_X = 0x0058;
3744     enum int XK_Y = 0x0059;
3745     enum int XK_Z = 0x005a;
3746     enum int XK_bracketleft = 0x005b;
3747     enum int XK_backslash = 0x005c;
3748     enum int XK_bracketright = 0x005d;
3749     enum int XK_asciicircum = 0x005e;
3750     enum int XK_underscore = 0x005f;
3751     enum int XK_grave = 0x0060;
3752     enum int XK_quoteleft = 0x0060;
3753     enum int XK_a = 0x0061;
3754     enum int XK_b = 0x0062;
3755     enum int XK_c = 0x0063;
3756     enum int XK_d = 0x0064;
3757     enum int XK_e = 0x0065;
3758     enum int XK_f = 0x0066;
3759     enum int XK_g = 0x0067;
3760     enum int XK_h = 0x0068;
3761     enum int XK_i = 0x0069;
3762     enum int XK_j = 0x006a;
3763     enum int XK_k = 0x006b;
3764     enum int XK_l = 0x006c;
3765     enum int XK_m = 0x006d;
3766     enum int XK_n = 0x006e;
3767     enum int XK_o = 0x006f;
3768     enum int XK_p = 0x0070;
3769     enum int XK_q = 0x0071;
3770     enum int XK_r = 0x0072;
3771     enum int XK_s = 0x0073;
3772     enum int XK_t = 0x0074;
3773     enum int XK_u = 0x0075;
3774     enum int XK_v = 0x0076;
3775     enum int XK_w = 0x0077;
3776     enum int XK_x = 0x0078;
3777     enum int XK_y = 0x0079;
3778     enum int XK_z = 0x007a;
3779     enum int XK_braceleft = 0x007b;
3780     enum int XK_bar = 0x007c;
3781     enum int XK_braceright = 0x007d;
3782     enum int XK_asciitilde = 0x007e;
3783     enum int XK_nobreakspace = 0x00a0;
3784     enum int XK_exclamdown = 0x00a1;
3785     enum int XK_cent = 0x00a2;
3786     enum int XK_sterling = 0x00a3;
3787     enum int XK_currency = 0x00a4;
3788     enum int XK_yen = 0x00a5;
3789     enum int XK_brokenbar = 0x00a6;
3790     enum int XK_section = 0x00a7;
3791     enum int XK_diaeresis = 0x00a8;
3792     enum int XK_copyright = 0x00a9;
3793     enum int XK_ordfeminine = 0x00aa;
3794     enum int XK_guillemotleft = 0x00ab;
3795     enum int XK_notsign = 0x00ac;
3796     enum int XK_hyphen = 0x00ad;
3797     enum int XK_registered = 0x00ae;
3798     enum int XK_macron = 0x00af;
3799     enum int XK_degree = 0x00b0;
3800     enum int XK_plusminus = 0x00b1;
3801     enum int XK_twosuperior = 0x00b2;
3802     enum int XK_threesuperior = 0x00b3;
3803     enum int XK_acute = 0x00b4;
3804     enum int XK_mu = 0x00b5;
3805     enum int XK_paragraph = 0x00b6;
3806     enum int XK_periodcentered = 0x00b7;
3807     enum int XK_cedilla = 0x00b8;
3808     enum int XK_onesuperior = 0x00b9;
3809     enum int XK_masculine = 0x00ba;
3810     enum int XK_guillemotright = 0x00bb;
3811     enum int XK_onequarter = 0x00bc;
3812     enum int XK_onehalf = 0x00bd;
3813     enum int XK_threequarters = 0x00be;
3814     enum int XK_questiondown = 0x00bf;
3815     enum int XK_Agrave = 0x00c0;
3816     enum int XK_Aacute = 0x00c1;
3817     enum int XK_Acircumflex = 0x00c2;
3818     enum int XK_Atilde = 0x00c3;
3819     enum int XK_Adiaeresis = 0x00c4;
3820     enum int XK_Aring = 0x00c5;
3821     enum int XK_AE = 0x00c6;
3822     enum int XK_Ccedilla = 0x00c7;
3823     enum int XK_Egrave = 0x00c8;
3824     enum int XK_Eacute = 0x00c9;
3825     enum int XK_Ecircumflex = 0x00ca;
3826     enum int XK_Ediaeresis = 0x00cb;
3827     enum int XK_Igrave = 0x00cc;
3828     enum int XK_Iacute = 0x00cd;
3829     enum int XK_Icircumflex = 0x00ce;
3830     enum int XK_Idiaeresis = 0x00cf;
3831     enum int XK_ETH = 0x00d0;
3832     enum int XK_Eth = 0x00d0;
3833     enum int XK_Ntilde = 0x00d1;
3834     enum int XK_Ograve = 0x00d2;
3835     enum int XK_Oacute = 0x00d3;
3836     enum int XK_Ocircumflex = 0x00d4;
3837     enum int XK_Otilde = 0x00d5;
3838     enum int XK_Odiaeresis = 0x00d6;
3839     enum int XK_multiply = 0x00d7;
3840     enum int XK_Oslash = 0x00d8;
3841     enum int XK_Ooblique = 0x00d8;
3842     enum int XK_Ugrave = 0x00d9;
3843     enum int XK_Uacute = 0x00da;
3844     enum int XK_Ucircumflex = 0x00db;
3845     enum int XK_Udiaeresis = 0x00dc;
3846     enum int XK_Yacute = 0x00dd;
3847     enum int XK_THORN = 0x00de;
3848     enum int XK_Thorn = 0x00de;
3849     enum int XK_ssharp = 0x00df;
3850     enum int XK_agrave = 0x00e0;
3851     enum int XK_aacute = 0x00e1;
3852     enum int XK_acircumflex = 0x00e2;
3853     enum int XK_atilde = 0x00e3;
3854     enum int XK_adiaeresis = 0x00e4;
3855     enum int XK_aring = 0x00e5;
3856     enum int XK_ae = 0x00e6;
3857     enum int XK_ccedilla = 0x00e7;
3858     enum int XK_egrave = 0x00e8;
3859     enum int XK_eacute = 0x00e9;
3860     enum int XK_ecircumflex = 0x00ea;
3861     enum int XK_ediaeresis = 0x00eb;
3862     enum int XK_igrave = 0x00ec;
3863     enum int XK_iacute = 0x00ed;
3864     enum int XK_icircumflex = 0x00ee;
3865     enum int XK_idiaeresis = 0x00ef;
3866     enum int XK_eth = 0x00f0;
3867     enum int XK_ntilde = 0x00f1;
3868     enum int XK_ograve = 0x00f2;
3869     enum int XK_oacute = 0x00f3;
3870     enum int XK_ocircumflex = 0x00f4;
3871     enum int XK_otilde = 0x00f5;
3872     enum int XK_odiaeresis = 0x00f6;
3873     enum int XK_division = 0x00f7;
3874     enum int XK_oslash = 0x00f8;
3875     enum int XK_ooblique = 0x00f8;
3876     enum int XK_ugrave = 0x00f9;
3877     enum int XK_uacute = 0x00fa;
3878     enum int XK_ucircumflex = 0x00fb;
3879     enum int XK_udiaeresis = 0x00fc;
3880     enum int XK_yacute = 0x00fd;
3881     enum int XK_thorn = 0x00fe;
3882     enum int XK_ydiaeresis = 0x00ff;
3883 }
3884 template XIClearMask(string ptr, int event) {
3885     const ubyte XIClearMask = cast(ubyte)(ptr[(event) >> 3] &= ~(1 << ((event) & 7)));
3886 }
3887 auto XIMaskIsSet(T, U)(T ptr, U event) {
3888     return cast(ubyte)((cast(ubyte*) ptr)[(event) >> 3] & (1 << ((event) & 7)));
3889 }
3890 auto XIMaskIsSet(T)(T event) {
3891     return (((event) >> 3) + 1);
3892 }
3893 auto XIMaskLen(T)(T event) {
3894     return (((event) >> 3) + 1);
3895 }
3896 enum {
3897     XIAllDevices = 0,
3898     XIAllMasterDevices = 1
3899 }
3900 enum {
3901     XI_DeviceChanged = 1,
3902     XI_KeyPress = 2,
3903     XI_KeyRelease = 3,
3904     XI_ButtonPress = 4,
3905     XI_ButtonRelease = 5,
3906     XI_Motion = 6,
3907     XI_Enter = 7,
3908     XI_Leave = 8,
3909     XI_FocusIn = 9,
3910     XI_FocusOut = 10,
3911     XI_HierarchyChanged = 11,
3912     XI_PropertyEvent = 12,
3913     XI_RawKeyPress = 13,
3914     XI_RawKeyRelease = 14,
3915     XI_RawButtonPress = 15,
3916     XI_RawButtonRelease = 16,
3917     XI_RawMotion = 17,
3918     XI_LASTEVENT = XI_RawMotion
3919 }
3920 enum {
3921     XI_DeviceChangedMask = (1 << XI_DeviceChanged),
3922     XI_KeyPressMask = (1 << XI_KeyPress),
3923     XI_KeyReleaseMask = (1 << XI_KeyRelease),
3924     XI_ButtonPressMask = (1 << XI_ButtonPress),
3925     XI_ButtonReleaseMask = (1 << XI_ButtonRelease),
3926     XI_MotionMask = (1 << XI_Motion),
3927     XI_EnterMask = (1 << XI_Enter),
3928     XI_LeaveMask = (1 << XI_Leave),
3929     XI_FocusInMask = (1 << XI_FocusIn),
3930     XI_FocusOutMask = (1 << XI_FocusOut),
3931     XI_HierarchyChangedMask = (1 << XI_HierarchyChanged),
3932     XI_PropertyEventMask = (1 << XI_PropertyEvent),
3933     XI_RawKeyPressMask = (
3934             1 << XI_RawKeyPress),
3935     XI_RawKeyReleaseMask = (1 << XI_RawKeyRelease),
3936     XI_RawButtonPressMask = (1 << XI_RawButtonPress),
3937     XI_RawButtonReleaseMask = (
3938             1 << XI_RawButtonRelease),
3939     XI_RawMotionMask = (1 << XI_RawMotion)
3940 }
3941 enum _deviceKeyPress = 0;
3942 struct XDeviceCoreState {
3943     XID control;
3944     int length;
3945     int status;
3946     int iscore;
3947 }
3948 struct XDeviceEnableControl {
3949     XID control;
3950     int length;
3951     int enable;
3952 }
3953 alias XDeviceEnableState = XDeviceEnableControl;
3954 struct XAnyClassInfo {
3955     XID class_;
3956     int length;
3957 }
3958 alias XAnyClassPtr = XAnyClassInfo*;
3959 struct XDeviceInfo {
3960     XID id;
3961     Atom type;
3962     char* name;
3963     int num_classes;
3964     int use;
3965     XAnyClassPtr inputclassinfo;
3966 }
3967 alias XDeviceInfoPtr = XDeviceInfo*;
3968 struct XKeyInfo {
3969     XID class_;
3970     int length;
3971     ushort min_keycode;
3972     ushort max_keycode;
3973     ushort num_keys;
3974 }
3975 alias XKeyInfoPtr = XKeyInfo*;
3976 struct XButtonInfo {
3977     XID class_;
3978     int length;
3979     short num_buttons;
3980 }
3981 alias XButtonInfoPtr = XButtonInfo*;
3982 alias XAxisInfoPtr = XAxisInfo*;
3983 struct XAxisInfo {
3984     int resolution;
3985     int min_value;
3986     int max_value;
3987 }
3988 alias XValuatorInfoPtr = XValuatorInfo*;
3989 struct XValuatorInfo {
3990     XID class_;
3991     int length;
3992     ubyte num_axes;
3993     ubyte mode;
3994     ulong motion_buffer;
3995     XAxisInfoPtr axes;
3996 }
3997 struct XInputClassInfo {
3998     ubyte input_class;
3999     ubyte event_type_base;
4000 }
4001 struct XIAddMasterInfo {
4002     int type;
4003     char* name;
4004     Bool send_core;
4005     Bool enable;
4006 }
4007 struct XIRemoveMasterInfo {
4008     int type;
4009     int deviceid;
4010     int return_mode;
4011     int return_pointer;
4012     int return_keyboard;
4013 }
4014 struct XIAttachSlaveInfo {
4015     int type;
4016     int deviceid;
4017     int new_master;
4018 }
4019 struct XIDetachSlaveInfo {
4020     int type;
4021     int deviceid;
4022 }
4023 union XIAnyHierarchyChangeInfo {
4024     int type;
4025     XIAddMasterInfo add;
4026     XIRemoveMasterInfo remove;
4027     XIAttachSlaveInfo attach;
4028     XIDetachSlaveInfo detach;
4029 }
4030 struct XIModifierState {
4031     int base;
4032     int latched;
4033     int locked;
4034     int effective;
4035 }
4036 alias XIModifierState XIGroupState;
4037 struct XIButtonState {
4038     int mask_len;
4039     ubyte* mask;
4040 }
4041 struct XIValuatorState {
4042     int mask_len;
4043     ubyte mask;
4044     double* values;
4045 }
4046 struct XIEventMask {
4047     int deviceid;
4048     int mask_len;
4049     ubyte* mask;
4050 }
4051 struct XIAnyClassInfo {
4052     int type;
4053     int sourceid;
4054 }
4055 struct XIButtonClassInfo {
4056     int type;
4057     int sourceid;
4058     int num_buttons;
4059     Atom* labels;
4060     XIButtonState state;
4061 }
4062 struct XIDeviceEvent {
4063     int type;
4064     c_ulong serial;
4065     Bool send_event;
4066     Display* display;
4067     int extension;
4068     int evtype;
4069     Time time;
4070     int deviceid;
4071     int sourceid;
4072     int detail;
4073     Window root;
4074     Window event;
4075     Window child;
4076     double root_x;
4077     double root_y;
4078     double event_x;
4079     double event_y;
4080     int flags;
4081     XIButtonState buttons;
4082     XIValuatorState valuators;
4083     XIModifierState mods;
4084     XIGroupState group;
4085 }
4086 struct XIRawEvent {
4087     int type;
4088     c_ulong serial;
4089     Bool send_event;
4090     Display* display;
4091     int extension;
4092     int evtype;
4093     Time time;
4094     int deviceid;
4095     int sourceid;
4096     int detail;
4097     int flags;
4098     XIValuatorState valuators;
4099     double* raw_values;
4100 }
4101 struct XIEnterEvent {
4102     int type;
4103     c_ulong serial;
4104     Bool send_event;
4105     Display* display;
4106     int extension;
4107     int evtype;
4108     Time time;
4109     int deviceid;
4110     int sourceid;
4111     int detail;
4112     Window root;
4113     Window event;
4114     Window child;
4115     double root_x;
4116     double root_y;
4117     double event_x;
4118     double event_y;
4119     int mode;
4120     Bool focus;
4121     Bool same_screen;
4122     XIButtonState buttons;
4123     XIModifierState mods;
4124     XIGroupState group;
4125 }
4126 alias XIEnterEvent XILeaveEvent;
4127 enum X_kbSetDeviceInfo = 25;
4128 enum X_kbSetDebuggingFlags = 101;
4129 enum XkbEventCode = 0;
4130 enum XkbNumberEvents = (XkbEventCode + 1);
4131 enum XkbNewKeyboardNotify = 0;
4132 enum XkbMapNotify = 1;
4133 enum XkbStateNotify = 2;
4134 enum XkbControlsNotify = 3;
4135 enum XkbModifierLockMask = (1L << 3);
4136 enum XkbGroupStateMask = (1L << 4);
4137 enum XkbGroupBaseMask = (1L << 5);
4138 enum XkbGroupLatchMask = (1L << 6);
4139 enum XkbLookupModsMask = (1L << 11);
4140 enum XkbCompatLookupModsMask = (1L << 12);
4141 enum XkbPointerButtonMask = (1L << 13);
4142 enum XkbAllStateComponentsMask = (0x3fff);
4143 enum XkbUseCoreKbd = 0x0100;
4144 enum XkbUseCorePtr = 0x0200;
4145 enum XkbDfltXIClass = 0x0300;
4146 enum XkbDfltXIId = 0x0400;
4147 enum XkbAllVirtualModsMask = 0xffff;
4148 enum XkbNumKbdGroups = 4;
4149 enum XkbMaxKbdGroup = (XkbNumKbdGroups - 1);
4150 enum XkbMaxMouseKeysBtn = 4;
4151 enum XkbKB_Overlay1 = 0x03;
4152 enum XkbKB_Overlay2 = 0x04;
4153 enum XkbKB_RGAllowNone = 0x80;
4154 enum XkbMinLegalKeyCode = 8;
4155 enum XkbMaxLegalKeyCode = 255;
4156 enum XkbMaxKeyCount = (XkbMaxLegalKeyCode - XkbMinLegalKeyCode + 1);
4157 enum XkbPerKeyBitArraySize = ((XkbMaxLegalKeyCode + 1) / 8);
4158 enum XkbNumModifiers = 8;
4159 enum XkbNumVirtualMods = 16;
4160 enum XkbNumIndicators = 32;
4161 enum XkbAllIndicatorsMask = (0xffffffff);
4162 enum XkbRGMaxMembers = 12;
4163 enum XkbActionMessageLength = 6;
4164 enum XkbKeyNameLength = 4;
4165 enum XkbMaxRedirectCount = 8;
4166 enum XkbKTLevelNamesMask = (1 << 7);
4167 enum XkbIndicatorNamesMask = (1 << 8);
4168 enum XkbKeyNamesMask = (1 << 9);
4169 enum XkbKeyAliasesMask = (1 << 10);
4170 struct _xkbAnyEvent {
4171     BYTE type;
4172     BYTE xkbType;
4173     CARD16 sequenceNumber;
4174     Time time;
4175     CARD8 deviceID;
4176     CARD8 pad1;
4177     CARD16 pad2;
4178     CARD32 pad3;
4179     CARD32 pad4;
4180     CARD32 pad5;
4181     CARD32 pad6;
4182     CARD32 pad7;
4183 }
4184 alias _xkbAnyEvent xkbAnyEvent;
4185 enum sz_xkbAnyEvent = 32;
4186 struct _xkbNewKeyboardNotify {
4187     BYTE type;
4188     BYTE xkbType;
4189     CARD16 sequenceNumber;
4190     Time time;
4191     CARD8 deviceID;
4192     CARD8 oldDeviceID;
4193     KeyCode minKeyCode;
4194     KeyCode maxKeyCode;
4195     KeyCode oldMinKeyCode;
4196     KeyCode oldMaxKeyCode;
4197     CARD8 requestMajor;
4198     CARD8 requestMinor;
4199     CARD16 changed;
4200     CARD8 detail;
4201     CARD8 pad1;
4202     CARD32 pad2;
4203     CARD32 pad3;
4204     CARD32 pad4;
4205 }
4206 alias _xkbNewKeyboardNotify xkbNewKeyboardNotify;
4207 enum sz_xkbNewKeyboardNotify = 32;
4208 struct _xkbMapNotify {
4209     BYTE type;
4210     BYTE xkbType;
4211     CARD16 sequenceNumber;
4212     Time time;
4213     CARD8 deviceID;
4214     CARD8 ptrBtnActions;
4215     CARD16 changed;
4216     KeyCode minKeyCode;
4217     KeyCode maxKeyCode;
4218     CARD8 firstType;
4219     CARD8 nTypes;
4220     KeyCode firstKeySym;
4221     CARD8 nKeySyms;
4222     KeyCode firstKeyAct;
4223     CARD8 nKeyActs;
4224     KeyCode firstKeyBehavior;
4225     CARD8 nKeyBehaviors;
4226     KeyCode firstKeyExplicit;
4227     CARD8 nKeyExplicit;
4228     KeyCode firstModMapKey;
4229     CARD8 nModMapKeys;
4230     KeyCode firstVModMapKey;
4231     CARD8 nVModMapKeys;
4232     CARD16 virtualMods;
4233     CARD16 pad1;
4234 }
4235 alias _xkbMapNotify xkbMapNotify;
4236 enum sz_xkbMapNotify = 32;
4237 struct _xkbStateNotify {
4238     BYTE type;
4239     BYTE xkbType;
4240     CARD16 sequenceNumber;
4241     Time time;
4242     CARD8 deviceID;
4243     CARD8 mods;
4244     CARD8 baseMods;
4245     CARD8 latchedMods;
4246     CARD8 lockedMods;
4247     CARD8 group;
4248     INT16 baseGroup;
4249     INT16 latchedGroup;
4250     CARD8 lockedGroup;
4251     CARD8 compatState;
4252     CARD8 grabMods;
4253     CARD8 compatGrabMods;
4254     CARD8 lookupMods;
4255     CARD8 compatLookupMods;
4256     CARD16 ptrBtnState;
4257     CARD16 changed;
4258     KeyCode keycode;
4259     CARD8 eventType;
4260     CARD8 requestMajor;
4261     CARD8 requestMinor;
4262 }
4263 alias _xkbStateNotify xkbStateNotify;
4264 enum sz_xkbStateNotify = 32;
4265 struct _xkbControlsNotify {
4266     BYTE type;
4267     BYTE xkbType;
4268     CARD16 sequenceNumber;
4269     Time time;
4270     CARD8 deviceID;
4271     CARD8 numGroups;
4272     CARD16 pad1;
4273     CARD32 changedControls;
4274     CARD32 enabledControls;
4275     CARD32 enabledControlChanges;
4276     KeyCode keycode;
4277     CARD8 eventType;
4278     CARD8 requestMajor;
4279     CARD8 requestMinor;
4280     CARD32 pad2;
4281 }
4282 alias _xkbControlsNotify xkbControlsNotify;
4283 enum sz_xkbControlsNotify = 32;
4284 struct _xkbIndicatorNotify {
4285     BYTE type;
4286     BYTE xkbType;
4287     CARD16 sequenceNumber;
4288     Time time;
4289     CARD8 deviceID;
4290     CARD8 pad1;
4291     CARD16 pad2;
4292     CARD32 state;
4293     CARD32 changed;
4294     CARD32 pad3;
4295     CARD32 pad4;
4296     CARD32 pad5;
4297 }
4298 alias _xkbIndicatorNotify xkbIndicatorNotify;
4299 enum sz_xkbIndicatorNotify = 32;
4300 struct _xkbNamesNotify {
4301     BYTE type;
4302     BYTE xkbType;
4303     CARD16 sequenceNumber;
4304     Time time;
4305     CARD8 deviceID;
4306     CARD8 pad1;
4307     CARD16 changed;
4308     CARD8 firstType;
4309     CARD8 nTypes;
4310     CARD8 firstLevelName;
4311     CARD8 nLevelNames;
4312     CARD8 pad2;
4313     CARD8 nRadioGroups;
4314     CARD8 nAliases;
4315     CARD8 changedGroupNames;
4316     CARD16 changedVirtualMods;
4317     CARD8 firstKey;
4318     CARD8 nKeys;
4319     CARD32 changedIndicators;
4320     CARD32 pad3;
4321 }
4322 alias _xkbNamesNotify xkbNamesNotify;
4323 enum sz_xkbNamesNotify = 32;
4324 struct _xkbCompatMapNotify {
4325     BYTE type;
4326     BYTE xkbType;
4327     CARD16 sequenceNumber;
4328     Time time;
4329     CARD8 deviceID;
4330     CARD8 changedGroups;
4331     CARD16 firstSI;
4332     CARD16 nSI;
4333     CARD16 nTotalSI;
4334     CARD32 pad1;
4335     CARD32 pad2;
4336     CARD32 pad3;
4337     CARD32 pad4;
4338 }
4339 alias _xkbCompatMapNotify xkbCompatMapNotify;
4340 enum sz_xkbCompatMapNotify = 32;
4341 struct _xkbBellNotify {
4342     BYTE type;
4343     BYTE xkbType;
4344     CARD16 sequenceNumber;
4345     Time time;
4346     CARD8 deviceID;
4347     CARD8 bellClass;
4348     CARD8 bellID;
4349     CARD8 percent;
4350     CARD16 pitch;
4351     CARD16 duration;
4352     Atom name;
4353     Window window;
4354     BOOL eventOnly;
4355     CARD8 pad1;
4356     CARD16 pad2;
4357     CARD32 pad3;
4358 }
4359 alias _xkbBellNotify xkbBellNotify;
4360 enum sz_xkbBellNotify = 32;
4361 struct _xkbActionMessage {
4362     BYTE type;
4363     BYTE xkbType;
4364     CARD16 sequenceNumber;
4365     Time time;
4366     CARD8 deviceID;
4367     KeyCode keycode;
4368     BOOL press;
4369     BOOL keyEventFollows;
4370     CARD8 mods;
4371     CARD8 group;
4372     CARD8[8] message;
4373     CARD16 pad1;
4374     CARD32 pad2;
4375     CARD32 pad3;
4376 }
4377 alias _xkbActionMessage xkbActionMessage;
4378 enum sz_xkbActionMessage = 32;
4379 struct _xkbAccessXNotify {
4380     BYTE type;
4381     BYTE xkbType;
4382     CARD16 sequenceNumber;
4383     Time time;
4384     CARD8 deviceID;
4385     KeyCode keycode;
4386     CARD16 detail;
4387     CARD16 slowKeysDelay;
4388     CARD16 debounceDelay;
4389     CARD32 pad1;
4390     CARD32 pad2;
4391     CARD32 pad3;
4392     CARD32 pad4;
4393 }
4394 alias _xkbAccessXNotify xkbAccessXNotify;
4395 enum sz_xkbAccessXNotify = 32;
4396 struct _xkbExtensionDeviceNotify {
4397     BYTE type;
4398     BYTE xkbType;
4399     CARD16 sequenceNumber;
4400     Time time;
4401     CARD8 deviceID;
4402     CARD8 pad1;
4403     CARD16 reason;
4404     CARD16 ledClass;
4405     CARD16 ledID;
4406     CARD32 ledsDefined;
4407     CARD32 ledState;
4408     CARD8 firstBtn;
4409     CARD8 nBtns;
4410     CARD16 supported;
4411     CARD16 unsupported;
4412     CARD16 pad3;
4413 }
4414 alias _xkbExtensionDeviceNotify xkbExtensionDeviceNotify;
4415 enum sz_xkbExtensionDeviceNotify = 32;
4416 struct _xkbEvent {
4417     union _U {
4418         xkbAnyEvent any;
4419         xkbNewKeyboardNotify new_kbd;
4420         xkbMapNotify map;
4421         xkbStateNotify state;
4422         xkbControlsNotify ctrls;
4423         xkbIndicatorNotify indicators;
4424         xkbNamesNotify names;
4425         xkbCompatMapNotify compat;
4426         xkbBellNotify bell;
4427         xkbActionMessage message;
4428         xkbAccessXNotify accessx;
4429         xkbExtensionDeviceNotify device;
4430     }
4431     _U u;
4432 }
4433 alias _xkbEvent xkbEvent;
4434 enum sz_xkbEvent = 32;
4435 /// Translated from C to D
4436 struct _XkbStateRec {
4437     ubyte group;
4438     ubyte locked_group;
4439     ushort base_group;
4440     ushort latched_group;
4441     ubyte mods;
4442     ubyte base_mods;
4443     ubyte latched_mods;
4444     ubyte locked_mods;
4445     ubyte compat_state;
4446     ubyte grab_mods;
4447     ubyte compat_grab_mods;
4448     ubyte lookup_mods;
4449     ubyte compat_lookup_mods;
4450     ushort ptr_buttons;
4451 }
4452 alias _XkbStateRec XkbStateRec;
4453 alias _XkbStateRec* XkbStatePtr;
4454 struct _XkbMods {
4455     ubyte mask;
4456     ubyte real_mods;
4457     ushort vmods;
4458 }
4459 alias _XkbMods XkbModsRec;
4460 alias _XkbMods* XkbModsPtr;
4461 struct _XkbKTMapEntry {
4462     Bool active;
4463     ubyte level;
4464     XkbModsRec mods;
4465 }
4466 alias _XkbKTMapEntry XkbKTMapEntryRec;
4467 alias _XkbKTMapEntry* XkbKTMapEntryPtr;
4468 struct _XkbKeyType {
4469     XkbModsRec mods;
4470     ubyte num_levels;
4471     ubyte map_count;
4472     XkbKTMapEntryPtr map;
4473     XkbModsPtr preserve;
4474     Atom name;
4475     Atom* level_names;
4476 }
4477 alias _XkbKeyType XkbKeyTypeRec;
4478 alias _XkbKeyType* XkbKeyTypePtr;
4479 struct _XkbBehavior {
4480     ubyte type;
4481     ubyte data;
4482 }
4483 alias _XkbBehavior XkbBehavior;
4484 enum XkbAnyActionDataSize = 7;
4485 struct _XkbAnyAction {
4486     ubyte type;
4487     ubyte[XkbAnyActionDataSize] data;
4488 }
4489 alias _XkbAnyAction XkbAnyAction;
4490 struct _XkbModAction {
4491     ubyte type;
4492     ubyte flags;
4493     ubyte mask;
4494     ubyte real_mods;
4495     ubyte vmods1;
4496     ubyte vmods2;
4497 }
4498 alias _XkbModAction XkbModAction;
4499 struct _XkbGroupAction {
4500     ubyte type;
4501     ubyte flags;
4502     char group_XXX;
4503 }
4504 alias _XkbGroupAction XkbGroupAction;
4505 struct _XkbISOAction {
4506     ubyte type;
4507     ubyte flags;
4508     ubyte mask;
4509     ubyte real_mods;
4510     char group_XXX;
4511     ubyte affect;
4512     ubyte vmods1;
4513     ubyte vmods2;
4514 }
4515 alias _XkbISOAction XkbISOAction;
4516 struct _XkbPtrAction {
4517     ubyte type;
4518     ubyte flags;
4519     ubyte high_XXX;
4520     ubyte low_XXX;
4521     ubyte high_YYY;
4522     ubyte low_YYY;
4523 }
4524 alias _XkbPtrAction XkbPtrAction;
4525 struct _XkbPtrBtnAction {
4526     ubyte type;
4527     ubyte flags;
4528     ubyte count;
4529     ubyte button;
4530 }
4531 alias _XkbPtrBtnAction XkbPtrBtnAction;
4532 struct _XkbPtrDfltAction {
4533     ubyte type;
4534     ubyte flags;
4535     ubyte affect;
4536     char valueXXX;
4537 }
4538 alias _XkbPtrDfltAction XkbPtrDfltAction;
4539 struct _XkbSwitchScreenAction {
4540     ubyte type;
4541     ubyte flags;
4542     char screenXXX;
4543 }
4544 alias _XkbSwitchScreenAction XkbSwitchScreenAction;
4545 struct _XkbCtrlsAction {
4546     ubyte type;
4547     ubyte flags;
4548     ubyte ctrls3;
4549     ubyte ctrls2;
4550     ubyte ctrls1;
4551     ubyte ctrls0;
4552 }
4553 alias _XkbCtrlsAction XkbCtrlsAction;
4554 struct _XkbMessageAction {
4555     ubyte type;
4556     ubyte flags;
4557     ubyte[6] message;
4558 }
4559 alias _XkbMessageAction XkbMessageAction;
4560 struct _XkbRedirectKeyAction {
4561     ubyte type;
4562     ubyte new_key;
4563     ubyte mods_mask;
4564     ubyte mods;
4565     ubyte vmods_mask0;
4566     ubyte vmods_mask1;
4567     ubyte vmods0;
4568     ubyte vmods1;
4569 }
4570 alias _XkbRedirectKeyAction XkbRedirectKeyAction;
4571 struct _XkbDeviceBtnAction {
4572     ubyte type;
4573     ubyte flags;
4574     ubyte count;
4575     ubyte button;
4576     ubyte device;
4577 }
4578 alias _XkbDeviceBtnAction XkbDeviceBtnAction;
4579 struct _XkbDeviceValuatorAction {
4580     ubyte type;
4581     ubyte device;
4582     ubyte v1_what;
4583     ubyte v1_ndx;
4584     ubyte v1_value;
4585     ubyte v2_what;
4586     ubyte v2_ndx;
4587     ubyte v2_value;
4588 }
4589 alias _XkbDeviceValuatorAction XkbDeviceValuatorAction;
4590 union _XkbAction {
4591     XkbAnyAction any;
4592     XkbModAction mods;
4593     XkbGroupAction group;
4594     XkbISOAction iso;
4595     XkbPtrAction ptr;
4596     XkbPtrBtnAction btn;
4597     XkbPtrDfltAction dflt;
4598     XkbSwitchScreenAction screen;
4599     XkbCtrlsAction ctrls;
4600     XkbMessageAction msg;
4601     XkbRedirectKeyAction redirect;
4602     XkbDeviceBtnAction devbtn;
4603     XkbDeviceValuatorAction devval;
4604     ubyte type;
4605 }
4606 alias _XkbAction XkbAction;
4607 struct _XkbControls {
4608     ubyte mk_dflt_btn;
4609     ubyte num_groups;
4610     ubyte groups_wrap;
4611     XkbModsRec internal;
4612     XkbModsRec ignore_lock;
4613     uint enabled_ctrls;
4614     ushort repeat_delay;
4615     ushort repeat_interval;
4616     ushort slow_keys_delay;
4617     ushort debounce_delay;
4618     ushort mk_delay;
4619     ushort mk_interval;
4620     ushort mk_time_to_max;
4621     ushort mk_max_speed;
4622     short mk_curve;
4623     ushort ax_options;
4624     ushort ax_timeout;
4625     ushort axt_opts_mask;
4626     ushort axt_opts_values;
4627     uint axt_ctrls_mask;
4628     uint axt_ctrls_values;
4629     ubyte[XkbPerKeyBitArraySize] per_key_repeat;
4630 }
4631 alias _XkbControls XkbControlsRec;
4632 alias _XkbControls* XkbControlsPtr;
4633 struct _XkbServerMapRec {
4634     ushort num_acts;
4635     ushort size_acts;
4636     XkbAction* acts;
4637     XkbBehavior* behaviors;
4638     ushort* key_acts;
4639     ubyte* explicit;
4640     ubyte[XkbNumVirtualMods] vmods;
4641     ushort* vmodmap;
4642 }
4643 alias _XkbServerMapRec XkbServerMapRec;
4644 alias _XkbServerMapRec* XkbServerMapPtr;
4645 struct _XkbSymMapRec {
4646     ubyte[XkbNumKbdGroups] kt_index;
4647     ubyte group_info;
4648     ubyte width;
4649     ushort offset;
4650 }
4651 alias _XkbSymMapRec XkbSymMapRec;
4652 alias _XkbSymMapRec* XkbSymMapPtr;
4653 struct _XkbClientMapRec {
4654     ubyte size_types;
4655     ubyte num_types;
4656     XkbKeyTypePtr types;
4657     ushort size_syms;
4658     ushort num_syms;
4659     KeySym* syms;
4660     XkbSymMapPtr key_sym_map;
4661     ubyte* modmap;
4662 }
4663 alias _XkbClientMapRec XkbClientMapRec;
4664 alias _XkbClientMapRec* XkbClientMapPtr;
4665 struct _XkbSymInterpretRec {
4666     KeySym sym;
4667     ubyte flags;
4668     ubyte match;
4669     ubyte mods;
4670     ubyte virtual_mod;
4671     XkbAnyAction act;
4672 }
4673 alias _XkbSymInterpretRec XkbSymInterpretRec;
4674 alias _XkbSymInterpretRec* XkbSymInterpretPtr;
4675 struct _XkbCompatMapRec {
4676     XkbSymInterpretPtr sym_interpret;
4677     XkbModsRec[XkbNumKbdGroups] groups;
4678     ushort num_si;
4679     ushort size_si;
4680 }
4681 alias _XkbCompatMapRec XkbCompatMapRec;
4682 alias _XkbCompatMapRec* XkbCompatMapPtr;
4683 struct _XkbIndicatorMapRec {
4684     ubyte flags;
4685     ubyte which_groups;
4686     ubyte groups;
4687     ubyte which_mods;
4688     XkbModsRec mods;
4689     uint ctrls;
4690 }
4691 alias _XkbIndicatorMapRec XkbIndicatorMapRec;
4692 alias _XkbIndicatorMapRec* XkbIndicatorMapPtr;
4693 struct _XkbIndicatorRec {
4694     c_ulong phys_indicators;
4695     XkbIndicatorMapRec[XkbNumIndicators] maps;
4696 }
4697 alias _XkbIndicatorRec XkbIndicatorRec;
4698 alias _XkbIndicatorRec* XkbIndicatorPtr;
4699 struct _XkbKeyNameRec {
4700     char[XkbKeyNameLength] name;
4701 }
4702 alias _XkbKeyNameRec XkbKeyNameRec;
4703 alias _XkbKeyNameRec* XkbKeyNamePtr;
4704 struct _XkbKeyAliasRec {
4705     char[XkbKeyNameLength] real_;
4706     char[XkbKeyNameLength] alias_;
4707 }
4708 alias _XkbKeyAliasRec XkbKeyAliasRec;
4709 alias _XkbKeyAliasRec* XkbKeyAliasPtr;
4710 struct _XkbNamesRec {
4711     Atom keycodes;
4712     Atom geometry;
4713     Atom symbols;
4714     Atom types;
4715     Atom compat;
4716     Atom[XkbNumVirtualMods] vmods;
4717     Atom[XkbNumIndicators] indicators;
4718     Atom[XkbNumKbdGroups] groups;
4719     XkbKeyNamePtr keys;
4720     XkbKeyAliasPtr key_aliases;
4721     Atom* radio_groups;
4722     Atom phys_symbols;
4723     ubyte num_keys;
4724     ubyte num_key_aliases;
4725     ushort num_rg;
4726 }
4727 alias _XkbNamesRec XkbNamesRec;
4728 alias _XkbNamesRec* XkbNamesPtr;
4729 struct _XkbGeometry;
4730 alias _XkbGeometry* XkbGeometryPtr;
4731 struct _XkbDesc {
4732     struct _XDisplay;
4733     _XDisplay* dpy;
4734     ushort flags;
4735     ushort device_spec;
4736     KeyCode min_key_code;
4737     KeyCode max_key_code;
4738     XkbControlsPtr ctrls;
4739     XkbServerMapPtr server;
4740     XkbClientMapPtr map;
4741     XkbIndicatorPtr indicators;
4742     XkbNamesPtr names;
4743     XkbCompatMapPtr compat;
4744     XkbGeometryPtr geom;
4745 }
4746 alias _XkbDesc XkbDescRec;
4747 alias _XkbDesc* XkbDescPtr;
4748 struct _XkbMapChanges {
4749     ushort changed;
4750     KeyCode min_key_code;
4751     KeyCode max_key_code;
4752     ubyte first_type;
4753     ubyte num_types;
4754     KeyCode first_key_sym;
4755     ubyte num_key_syms;
4756     KeyCode first_key_act;
4757     ubyte num_key_acts;
4758     KeyCode first_key_behavior;
4759     ubyte num_key_behaviors;
4760     KeyCode first_key_explicit;
4761     ubyte num_key_explicit;
4762     KeyCode first_modmap_key;
4763     ubyte num_modmap_keys;
4764     KeyCode first_vmodmap_key;
4765     ubyte num_vmodmap_keys;
4766     ubyte pad;
4767     ushort vmods;
4768 }
4769 alias _XkbMapChanges XkbMapChangesRec;
4770 alias _XkbMapChanges* XkbMapChangesPtr;
4771 struct _XkbControlsChanges {
4772     uint changed_ctrls;
4773     uint enabled_ctrls_changes;
4774     Bool num_groups_changed;
4775 }
4776 alias _XkbControlsChanges XkbControlsChangesRec;
4777 alias _XkbControlsChanges* XkbControlsChangesPtr;
4778 struct _XkbIndicatorChanges {
4779     uint state_changes;
4780     uint map_changes;
4781 }
4782 alias _XkbIndicatorChanges XkbIndicatorChangesRec;
4783 alias _XkbIndicatorChanges* XkbIndicatorChangesPtr;
4784 struct _XkbNameChanges {
4785     uint changed;
4786     ubyte first_type;
4787     ubyte num_types;
4788     ubyte first_lvl;
4789     ubyte num_lvls;
4790     ubyte num_aliases;
4791     ubyte num_rg;
4792     ubyte first_key;
4793     ubyte num_keys;
4794     ushort changed_vmods;
4795     c_ulong changed_indicators;
4796     ubyte changed_groups;
4797 }
4798 alias _XkbNameChanges XkbNameChangesRec;
4799 alias _XkbNameChanges* XkbNameChangesPtr;
4800 struct _XkbCompatChanges {
4801     ubyte changed_groups;
4802     ushort first_si;
4803     ushort num_si;
4804 }
4805 alias _XkbCompatChanges XkbCompatChangesRec;
4806 alias _XkbCompatChanges* XkbCompatChangesPtr;
4807 struct _XkbChanges {
4808     ushort device_spec;
4809     ushort state_changes;
4810     XkbMapChangesRec map;
4811     XkbControlsChangesRec ctrls;
4812     XkbIndicatorChangesRec indicators;
4813     XkbNameChangesRec names;
4814     XkbCompatChangesRec compat;
4815 }
4816 alias _XkbChanges XkbChangesRec;
4817 alias _XkbChanges* XkbChangesPtr;
4818 struct XineramaScreenInfo {
4819     int screen_number;
4820     short x_org;
4821     short y_org;
4822     short width;
4823     short height;
4824 }
4825 Bool XineramaQueryExtension(Display* dpy, int* event_base, int* error_base);
4826 Status XineramaQueryVersion(Display* dpy, int* major_versionp, int* minor_versionp);
4827 Bool XineramaIsActive(Display* dpy);
4828 XineramaScreenInfo* XineramaQueryScreens(Display* dpy, int* number);
4829 alias XID RROutput;
4830 alias XID RRCrtc;
4831 alias XID RRMode;
4832 alias ulong XRRModeFlags;
4833 struct _XRRModeInfo {
4834     RRMode id;
4835     uint width;
4836     uint height;
4837     ulong dotClock;
4838     uint hSyncStart;
4839     uint hSyncEnd;
4840     uint hTotal;
4841     uint hSkew;
4842     uint vSyncStart;
4843     uint vSyncEnd;
4844     uint vTotal;
4845     char* name;
4846     uint nameLength;
4847     XRRModeFlags modeFlags;
4848 }
4849 alias _XRRModeInfo XRRModeInfo;
4850 struct _XRRScreenResources {
4851     Time timestamp;
4852     Time configTimestamp;
4853     int ncrtc;
4854     RRCrtc* crtcs;
4855     int noutput;
4856     RROutput* outputs;
4857     int nmode;
4858     XRRModeInfo* modes;
4859 }
4860 alias _XRRScreenResources XRRScreenResources;
4861 XRRScreenResources* XRRGetScreenResources(Display* dpy, Window window);
4862 void XRRFreeScreenResources(XRRScreenResources* resources);
4863 struct _XRROutputInfo {
4864     Time timestamp;
4865     RRCrtc crtc;
4866     char* name;
4867     int nameLen;
4868     ulong mm_width;
4869     ulong mm_height;
4870     Connection connection;
4871     SubpixelOrder subpixel_order;
4872     int ncrtc;
4873     RRCrtc* crtcs;
4874     int nclone;
4875     RROutput* clones;
4876     int nmode;
4877     int npreferred;
4878     RRMode* modes;
4879 }
4880 alias _XRROutputInfo XRROutputInfo;
4881 XRROutputInfo* XRRGetOutputInfo(Display* dpy, XRRScreenResources* resources, RROutput output);
4882 void XRRFreeOutputInfo(XRROutputInfo* outputInfo);
4883 Atom* XRRListOutputProperties(Display* dpy, RROutput output, int* nprop);
4884 struct _XRRCrtcInfo {
4885     Time timestamp;
4886     int x, y;
4887     uint width, height;
4888     RRMode mode;
4889     Rotation rotation;
4890     int noutput;
4891     RROutput* outputs;
4892     Rotation rotations;
4893     int npossible;
4894     RROutput* possible;
4895 }
4896 alias _XRRCrtcInfo XRRCrtcInfo;
4897 XRRCrtcInfo* XRRGetCrtcInfo(Display* dpy, XRRScreenResources* resources, RRCrtc crtc);
4898 void XRRFreeCrtcInfo(XRRCrtcInfo* crtcInfo);
4899 Status XRRSetCrtcConfig(Display* dpy, XRRScreenResources* resources, RRCrtc crtc,
4900         Time timestamp, int x, int y, RRMode mode, Rotation rotation,
4901         RROutput* outputs, int noutputs);
4902 int XRRGetCrtcGammaSize(Display* dpy, RRCrtc crtc);
4903 struct _XRRCrtcGamma {
4904     int size;
4905     ushort* red;
4906     ushort* green;
4907     ushort* blue;
4908 }
4909 alias _XRRCrtcGamma XRRCrtcGamma;
4910 RROutput XRRGetOutputPrimary(Display* dpy, Window window);
4911 struct XRenderDirectFormat {
4912     short red;
4913     short redMask;
4914     short green;
4915     short greenMask;
4916     short blue;
4917     short blueMask;
4918     short alpha;
4919     short alphaMask;
4920 }
4921 struct XRenderPictFormat {
4922     PictFormat id;
4923     int type;
4924     int depth;
4925     XRenderDirectFormat direct;
4926     Colormap colormap;
4927 }
4928 enum PictFormatID = (1 << 0);
4929 alias ushort Rotation;
4930 alias ushort SizeID;
4931 alias ushort SubpixelOrder;
4932 alias ushort Connection;
4933 alias ushort XRandrRotation;
4934 enum RRScreenChangeNotifyMask = (1L << 0);
4935 enum RRCrtcChangeNotifyMask = (1L << 1);
4936 enum RROutputChangeNotifyMask = (1L << 2);
4937 enum RROutputPropertyNotifyMask = (1L << 3);
4938 enum RRNotify = 1;
4939 enum RRNotify_CrtcChange = 0;
4940 enum RRNotify_OutputChange = 1;
4941 enum RRNotify_OutputProperty = 2;
4942 enum RR_Rotate_90 = 2;
4943 enum RR_Rotate_180 = 4;
4944 enum RR_Rotate_270 = 8;
4945 enum RR_Reflect_X = 16;
4946 enum RR_VSyncNegative = 0x00000008;
4947 enum RR_Interlace = 0x00000010;
4948 enum RR_DoubleScan = 0x00000020;
4949 enum RR_CSync = 0x00000040;
4950 enum RR_PixelMultiplex = 0x00000800;
4951 enum RR_DoubleClock = 0x00001000;
4952 enum RR_ClockDivideBy2 = 0x00002000;
4953 enum RR_Connected = 0;
4954 alias XID PictFormat;
4955 enum RENDER_NAME = "RENDER";
4956 enum RENDER_MAJOR = 0;
4957 enum RENDER_MINOR = 11;