1 module derelict.x11.Xlib;
2 
3 version(linux):
4 
5 import core.stdc.config;
6 import core.stdc.stdarg;
7 import derelict.x11.X;
8 
9 extern (C) nothrow @nogc:
10 
11 const int XlibSpecificationRelease  = 6;
12 const int X_HAVE_UTF8_STRING        = 1;
13 
14 alias char* XPointer;
15 alias int Status;
16 
17 alias int Bool;
18 enum {
19     False,
20     True
21 }
22 
23 alias int QueueMode;
24 enum {
25     QueuedAlready,
26     QueuedAfterReading,
27     QueuedAfterFlush
28 }
29 
30 int         ConnectionNumber            ( Display* dpy           )   { return dpy.fd;                                            }
31 Window      RootWindow                  ( Display* dpy,int scr   )   { return ScreenOfDisplay( dpy,scr ).root;                   }
32 int         DefaultScreen               ( Display* dpy           )   { return dpy.default_screen;                                }
33 Window      DefaultRootWindow           ( Display* dpy           )   { return ScreenOfDisplay( dpy,DefaultScreen( dpy ) ).root;  }
34 Visual*     DefaultVisual               ( Display* dpy,int scr   )   { return ScreenOfDisplay( dpy,scr ).root_visual;            }
35 GC          DefaultGC                   ( Display* dpy,int scr   )   { return ScreenOfDisplay( dpy,scr ).default_gc;             }
36 c_ulong     BlackPixel                  ( Display* dpy,int scr   )   { return cast(c_ulong)ScreenOfDisplay( dpy,scr ).black_pixel;  }
37 c_ulong     WhitePixel                  ( Display* dpy,int scr   )   { return cast(c_ulong)ScreenOfDisplay( dpy,scr ).white_pixel;  }
38 c_ulong     AllPlanes                   (                        )   { return 0xFFFFFFFF;                                        }
39 int         QLength                     ( Display* dpy           )   { return dpy.qlen;                                          }
40 int         DisplayWidth                ( Display* dpy,int scr   )   { return ScreenOfDisplay( dpy,scr ).width;                  }
41 int         DisplayHeight               ( Display* dpy,int scr   )   { return ScreenOfDisplay( dpy,scr ).height;                 }
42 int         DisplayWidthMM              ( Display* dpy,int scr   )   { return ScreenOfDisplay( dpy,scr ).mwidth;                 }
43 int         DisplayHeightMM             ( Display* dpy,int scr   )   { return ScreenOfDisplay( dpy,scr ).mheight;                }
44 int         DisplayPlanes               ( Display* dpy,int scr   )   { return ScreenOfDisplay( dpy,scr ).root_depth;             }
45 int         DisplayCells                ( Display* dpy,int scr   )   { return DefaultVisual( dpy,scr ).map_entries;              }
46 int         ScreenCount                 ( Display* dpy           )   { return dpy.nscreens;                                      }
47 char*       ServerVendor                ( Display* dpy           )   { return dpy.vendor;                                        }
48 int         ProtocolVersion             ( Display* dpy           )   { return dpy.proto_major_version;                           }
49 int         ProtocolRevision            ( Display* dpy           )   { return dpy.proto_minor_version;                           }
50 int         VendorRelease               ( Display* dpy           )   { return dpy.release;                                       }
51 char*       DisplayString               ( Display* dpy           )   { return dpy.display_name;                                  }
52 int         DefaultDepth                ( Display* dpy,int scr   )   { return ScreenOfDisplay( dpy,scr ).root_depth;             }
53 Colormap    DefaultColormap             ( Display* dpy,int scr   )   { return ScreenOfDisplay( dpy,scr ).cmap;                   }
54 int         BitmapUnit                  ( Display* dpy           )   { return dpy.bitmap_unit;                                   }
55 int         BitmapBitOrder              ( Display* dpy           )   { return dpy.bitmap_bit_order;                              }
56 int         BitmapPad                   ( Display* dpy           )   { return dpy.bitmap_pad;                                    }
57 int         ImagecharOrder              ( Display* dpy           )   { return dpy.char_order;                                    }
58 uint        NextRequest                 ( Display* dpy           )   { return cast(uint)dpy.request + 1;                         }
59 uint        LastKnownRequestProcessed   ( Display* dpy           )   { return cast(uint)dpy.last_request_read;                   }
60 
61 /* macros for screen oriented applications ( toolkit ) */
62 Screen*     ScreenOfDisplay             ( Display* dpy,int scr   )   { return &dpy.screens[scr];                                 }
63 Screen*     DefaultScreenOfDisplay      ( Display* dpy           )   { return ScreenOfDisplay( dpy,DefaultScreen( dpy ) );       }
64 Display*    DisplayOfScreen             ( Screen* s              )   { return s.display;                                         }
65 Window      RootWindowOfScreen          ( Screen* s              )   { return s.root;                                            }
66 c_ulong     BlackPixelOfScreen          ( Screen* s              )   { return cast(c_ulong)s.black_pixel;                        }
67 c_ulong     WhitePixelOfScreen          ( Screen* s              )   { return cast(c_ulong)s.white_pixel;                        }
68 Colormap    DefaultColormapOfScreen     ( Screen* s              )   { return s.cmap;                                            }
69 int         DefaultDepthOfScreen        ( Screen* s              )   { return s.root_depth;                                      }
70 GC          DefaultGCOfScreen           ( Screen* s              )   { return s.default_gc;                                      }
71 Visual*     DefaultVisualOfScreen       ( Screen* s              )   { return s.root_visual;                                     }
72 int         WidthOfScreen               ( Screen* s              )   { return s.width;                                           }
73 int         HeightOfScreen              ( Screen* s              )   { return s.height;                                          }
74 int         WidthMMOfScreen             ( Screen* s              )   { return s.mwidth;                                          }
75 int         HeightMMOfScreen            ( Screen* s              )   { return s.mheight;                                         }
76 int         PlanesOfScreen              ( Screen* s              )   { return s.root_depth;                                      }
77 int         CellsOfScreen               ( Screen* s              )   { return DefaultVisualOfScreen( s ).map_entries;            }
78 int         MinCmapsOfScreen            ( Screen* s              )   { return s.min_maps;                                        }
79 int         MaxCmapsOfScreen            ( Screen* s              )   { return s.max_maps;                                        }
80 Bool        DoesSaveUnders              ( Screen* s              )   { return s.save_unders;                                     }
81 int         DoesBackingStore            ( Screen* s              )   { return s.backing_store;                                   }
82 c_long      EventMaskOfScreen           ( Screen* s              )   { return s.root_input_mask;                                 }
83 
84 /*
85  * Extensions need a way to hang private data on some structures.
86  */
87 struct XExtData{
88     int number;                                         /* number returned by XRegisterExtension                        */
89     XExtData* next;                                     /* next item on list of data for structure                      */
90     extern (C) nothrow @nogc int function( XExtData* extension ) free_private;   /* called to free private storage                               */
91     XPointer private_data;                              /* data private to this extension.                              */
92 }
93 
94 /*
95  * This file contains structures used by the extension mechanism.
96  */
97 struct XExtCodes{                                       /* public to extension, cannot be changed                       */
98     int extension;                                      /* extension number                                             */
99     int major_opcode;                                   /* major op-code assigned by server                             */
100     int first_event;                                    /* first event number for the extension                         */
101     int first_error;                                    /* first error number for the extension                         */
102 
103 }
104 
105 /*
106  * Data structure for retrieving info about pixmap formats.
107  */
108 struct XPixmapFormatValues{
109     int depth;
110     int bits_per_pixel;
111     int scanline_pad;
112 }
113 
114 /*
115  * Data structure for setting graphics context.
116  */
117 
118 struct XGCValues{
119     int function_;                                      /* logical operation                                            */
120     c_ulong  plane_mask;                                /* plane mask                                                   */
121     c_ulong  foreground;                                /* foreground pixel                                             */
122     c_ulong  background;                                /* background pixel                                             */
123     int line_width;                                     /* line width                                                   */
124     int line_style;                                     /* LineSolid; LineOnOffDash; LineDoubleDash                     */
125     int cap_style;                                      /* CapNotLast; CapButt; CapRound; CapProjecting                 */
126     int join_style;                                     /* JoinMiter; JoinRound; JoinBevel                              */
127     int fill_style;                                     /* FillSolid; FillTiled; FillStippled; FillOpaeueStippled       */
128     int fill_rule;                                      /* EvenOddRule; WindingRule                                     */
129     int arc_mode;                                       /* ArcChord; ArcPieSlice                                        */
130     Pixmap tile;                                        /* tile pixmap for tiling operations                            */
131     Pixmap stipple;                                     /* stipple 1 plane pixmap for stipping                          */
132     int ts_x_origin;                                    /* offset for tile or stipple operations                        */
133     int ts_y_origin;
134     Font font;                                          /* default text font for text operations                        */
135     int subwindow_mode;                                 /* ClipByChildren; IncludeInferiors                             */
136     Bool graphics_exposures;                            /* boolean; should exposures be generated                       */
137     int clip_x_origin;                                  /* origin for clipping                                          */
138     int clip_y_origin;
139     Pixmap clip_mask;                                   /* bitmap clipping; other calls for rects                       */
140     int dash_offset;                                    /* patterned/dashed line information                            */
141     char dashes;
142 }
143 version (XLIB_ILLEGAL_ACCESS){
144     struct _XGC {
145         XExtData* ext_data;                             /* hook for extension to hang data                              */
146         GContext gid;                                   /* protocol ID for graphics context                             */
147                                                         /* there is more to this structure, but it is private to Xlib   */
148     }
149 }
150 else{
151     struct _XGC;
152 }
153 
154 alias _XGC* GC;
155 
156 /*
157  * Visual structure; contains information about colormapping possible.
158  */
159 struct Visual{
160     XExtData* ext_data;                                 /* hook for extension to hang data                              */
161     VisualID visualid;                                  /* visual id of this visual                                     */
162     int c_class;                                        /* class of screen (monochrome, etc.)                           */
163     c_ulong  red_mask, green_mask, blue_mask;            /* mask values                                                  */
164     int bits_per_rgb;                                   /* log base 2 of distinct color values                          */
165     int map_entries;                                    /* color map entries                                            */
166 }
167 
168 /*
169  * Depth structure; contains information for each possible depth.
170  */
171 struct Depth {
172     int depth;                                          /* this depth (Z) of the depth                                  */
173     int nvisuals;                                       /* number of Visual types at this depth                         */
174     Visual* visuals;                                    /* list of visuals possible at this depth                       */
175 }
176 
177 alias Display XDisplay;
178 
179 struct Screen {
180     XExtData* ext_data;                                 /* hook for extension to hang data                              */
181     XDisplay* display;                                  /* back pointer to display structure                            */
182     Window root;                                        /* Root window id.                                              */
183     int width, height;                                  /* width and height of screen                                   */
184     int mwidth, mheight;                                /* width and height of  in millimeters                          */
185     int ndepths;                                        /* number of depths possible                                    */
186     Depth* depths;                                      /* list of allowable depths on the screen                       */
187     int root_depth;                                     /* bits per pixel                                               */
188     Visual* root_visual;                                /* root visual                                                  */
189     GC default_gc;                                      /* GC for the root root visual                                  */
190     Colormap cmap;                                      /* default color map                                            */
191     c_ulong  white_pixel;
192     c_ulong  black_pixel;                               /* White and Black pixel values                                 */
193     int max_maps, min_maps;                             /* max and min color maps                                       */
194     int backing_store;                                  /* Never, WhenMapped, Always                                    */
195     Bool save_unders;
196     c_long root_input_mask;                               /* initial root input mask                                      */
197 }
198 
199 /*
200  * Format structure; describes ZFormat data the screen will understand.
201  */
202 struct ScreenFormat{
203     XExtData* ext_data;                                 /* hook for extension to hang data                              */
204     int depth;                                          /* depth of this image format                                   */
205     int bits_per_pixel;                                 /* bits/pixel at this depth                                     */
206     int scanline_pad;                                   /* scanline must padded to this multiple                        */
207 }
208 /*
209  * Data structure for setting window attributes.
210  */
211 struct XSetWindowAttributes{
212     Pixmap background_pixmap;                           /* background or None or ParentRelative                         */
213     c_ulong  background_pixel;                          /* background pixel                                             */
214     Pixmap border_pixmap;                               /* border of the window                                         */
215     c_ulong  border_pixel;                              /* border pixel value                                           */
216     int bit_gravity;                                    /* one of bit gravity values                                    */
217     int win_gravity;                                    /* one of the window gravity values                             */
218     int backing_store;                                  /* NotUseful, WhenMapped, Always                                */
219     c_ulong  backing_planes;                            /* planes to be preseved if possible                            */
220     c_ulong  backing_pixel;                             /* value to use in restoring planes                             */
221     Bool save_under;                                    /* should bits under be saved? (popups)                         */
222     c_long event_mask;                                    /* set of events that should be saved                           */
223     c_long do_not_propagate_mask;                         /* set of events that should not propagate                      */
224     Bool override_redirect;                             /* boolean value for override-redirect                          */
225     Colormap colormap;                                  /* color map to be associated with window                       */
226     Cursor cursor;                                      /* cursor to be displayed (or None)                             */
227 }
228 
229 struct XWindowAttributes{
230     int x, y;                                           /* location of window                                           */
231     int width, height;                                  /* width and height of window                                   */
232     int border_width;                                   /* border width of window                                       */
233     int depth;                                          /* depth of window                                              */
234     Visual* visual;                                     /* the associated visual structure                              */
235     Window root;                                        /* root of screen containing window                             */
236     int c_class;                                        /* InputOutput, InputOnly                                       */
237     int bit_gravity;                                    /* one of bit gravity values                                    */
238     int win_gravity;                                    /* one of the window gravity values                             */
239     int backing_store;                                  /* NotUseful, WhenMapped, Always                                */
240     c_ulong  backing_planes;                            /* planes to be preserved if possible                           */
241     c_ulong  backing_pixel;                             /* value to be used when restoring planes                       */
242     Bool save_under;                                    /* boolean, should bits under be saved?                         */
243     Colormap colormap;                                  /* color map to be associated with window                       */
244     Bool map_installed;                                 /* boolean, is color map currently installed                    */
245     int map_state;                                      /* IsUnmapped, IsUnviewable, IsViewable                         */
246     c_long all_event_masks;                               /* set of events all people have interest in                    */
247     c_long your_event_mask;                               /* my event mask                                                */
248     c_long do_not_propagate_mask;                         /* set of events that should not propagate                      */
249     Bool override_redirect;                             /* boolean value for override-redirect                          */
250     Screen* screen;                                     /* back pointer to correct screen                               */
251 }
252 
253 /*
254  * Data structure for host setting; getting routines.
255  *
256  */
257 struct XHostAddress{
258     int family;                                         /* for example FamilyInternet                                   */
259     int length;                                         /* length of address, in chars                                  */
260     char* address;                                      /* pointer to where to find the chars                           */
261 }
262 
263 /*
264  * Data structure for ServerFamilyInterpreted addresses in host routines
265  */
266 struct XServerInterpretedAddress{
267     int typelength;                                     /* length of type string, in chars                              */
268     int valuelength;                                    /* length of value string, in chars                             */
269     char* type;                                         /* pointer to where to find the type string                     */
270     char* value;                                        /* pointer to where to find the address                         */
271 }
272 
273 struct XImage{
274     int width, height;                                  /* size of image                                                */
275     int xoffset;                                        /* number of pixels offset in X direction                       */
276     int format;                                         /* XYBitmap, XYPixmap, ZPixmap                                  */
277     char* data;                                         /* pointer to image data                                        */
278     int char_order;                                     /* data char order, LSBFirst, MSBFirst                          */
279     int bitmap_unit;                                    /* quant. of scanline 8, 16, 32                                 */
280     int bitmap_bit_order;                               /* LSBFirst, MSBFirst                                           */
281     int bitmap_pad;                                     /* 8, 16, 32 either XY or ZPixmap                               */
282     int depth;                                          /* depth of image                                               */
283     int chars_per_line;                                 /* accelarator to next line                                     */
284     int bits_per_pixel;                                 /* bits per pixel (ZPixmap)                                     */
285     c_ulong  red_mask;                                  /* bits in z arrangment                                         */
286     c_ulong  green_mask;
287     c_ulong  blue_mask;
288     XPointer obdata;                                    /* hook for the object routines to hang on                      */
289     struct F {                                          /* image manipulation routines                                  */
290         extern (C) nothrow @nogc:
291 		XImage* function(
292                             XDisplay*   /* display          */,
293                             Visual*     /* visual           */,
294                             uint        /* depth            */,
295                             int         /* format           */,
296                             int         /* offset           */,
297                             char*       /* data             */,
298                             uint        /* width            */,
299                             uint        /* height           */,
300                             int         /* bitmap_pad       */,
301                             int         /* chars_per_line   */
302                         )                                   create_image;
303         int     function(XImage*)                           destroy_image;
304         c_ulong function(XImage*, int, int)                 get_pixel;
305         int     function(XImage*, int, int, c_ulong )       put_pixel;
306         XImage  function(XImage*, int, int, uint, uint)     sub_image;
307         int     function(XImage*, c_long)                   add_pixel;
308     }
309     F f;
310 }
311 
312 /*
313  * Data structure for XReconfigureWindow
314  */
315 struct XWindowChanges{
316     int x, y;
317     int width, height;
318     int border_width;
319     Window sibling;
320     int stack_mode;
321 }
322 
323 
324 /*
325  * Data structure used by color operations
326  */
327 struct XColor{
328     c_ulong  pixel;
329     ushort red, green, blue;
330     char flags;                                         /* do_red, do_green, do_blue                                    */
331     char pad;
332 }
333 
334 /*
335  * Data structures for graphics operations.  On most machines, these are
336  * congruent with the wire protocol structures, so reformatting the data
337  * can be avoided on these architectures.
338  */
339 struct XSegment{
340     short x1, y1, x2, y2;
341 }
342 
343 struct XPoint{
344     short x, y;
345 }
346 
347 struct XRectangle{
348     short x, y;
349     ushort width, height;
350 }
351 
352 struct XArc{
353     short x, y;
354     ushort width, height;
355     short angle1, angle2;
356 }
357 
358 
359 /* Data structure for XChangeKeyboardControl */
360 
361 struct XKeyboardControl{
362         int key_click_percent;
363         int bell_percent;
364         int bell_pitch;
365         int bell_duration;
366         int led;
367         int led_mode;
368         int key;
369         int auto_repeat_mode;                           /* On, Off, Default                                             */
370 }
371 /* Data structure for XGetKeyboardControl */
372 
373 struct XKeyboardState{
374     int key_click_percent;
375     int bell_percent;
376     uint bell_pitch, bell_duration;
377     c_ulong led_mask;
378     int global_auto_repeat;
379     char[32] auto_repeats;
380 }
381 
382 /* Data structure for XGetMotionEvents.  */
383 
384 struct XTimeCoord{
385     Time time;
386     short x, y;
387 }
388 
389 /* Data structure for X{Set,Get}ModifierMapping */
390 
391 struct XModifierKeymap{
392     int max_keypermod;                                  /* The server's max # of keys per modifier                      */
393     KeyCode* modifiermap;                               /* An 8 by max_keypermod array of modifiers                     */
394 }
395 
396 
397 /*
398  * Display datatype maintaining display specific data.
399  * The contents of this structure are implementation dependent.
400  * A Display should be treated as opaque by application code.
401  */
402 
403 struct _XPrivate;                                        /* Forward declare before use for C++                          */
404 struct _XrmHashBucketRec;
405 
406 struct _XDisplay{
407     XExtData* ext_data;                                 /* hook for extension to hang data                              */
408     _XPrivate* private1;
409     int fd;                                             /* Network socket.                                              */
410     int private2;
411     int proto_major_version;                            /* major version of server's X protocol */
412     int proto_minor_version;                            /* minor version of servers X protocol */
413     char* vendor;                                       /* vendor of the server hardware */
414     XID private3;
415     XID private4;
416     XID private5;
417     int private6;
418     extern (C) nothrow @nogc XID function(_XDisplay*) resource_alloc;             /* allocator function */
419     int char_order;                                     /* screen char order, LSBFirst, MSBFirst */
420     int bitmap_unit;                                    /* padding and data requirements */
421     int bitmap_pad;                                     /* padding requirements on bitmaps */
422     int bitmap_bit_order;                               /* LeastSignificant or MostSignificant */
423     int nformats;                                       /* number of pixmap formats in list */
424     ScreenFormat* pixmap_format;                        /* pixmap format list */
425     int private8;
426     int release;                                        /* release of the server */
427     _XPrivate* private9, private10;
428     int qlen;                                           /* Length of input event queue */
429     c_ulong  last_request_read;                         /* seq number of last event read */
430     c_ulong  request;                                   /* sequence number of last request. */
431     XPointer private11;
432     XPointer private12;
433     XPointer private13;
434     XPointer private14;
435     uint max_request_size;                          /* maximum number 32 bit words in request*/
436     _XrmHashBucketRec* db;
437     extern (C) nothrow @nogc int function( _XDisplay* )private15;
438     char* display_name;                             /* "host:display" string used on this connect*/
439     int default_screen;                             /* default screen for operations */
440     int nscreens;                                   /* number of screens on this server*/
441     Screen* screens;                                /* pointer to list of screens */
442     c_ulong motion_buffer;                          /* size of motion buffer */
443     c_ulong private16;
444     int min_keycode;                                /* minimum defined keycode */
445     int max_keycode;                                /* maximum defined keycode */
446     XPointer private17;
447     XPointer private18;
448     int private19;
449     char* xdefaults;                                /* contents of defaults from server */
450     /* there is more to this structure, but it is private to Xlib */
451 }
452 alias _XDisplay Display;
453 alias _XDisplay* _XPrivDisplay;
454 
455 struct XKeyEvent{
456     int type;                                           /* of event                                                     */
457     c_ulong  serial;                                    /* # of last request processed by server                        */
458     Bool send_event;                                    /* true if this came from a SendEvent request                   */
459     Display* display;                                   /* Display the event was read from                              */
460     Window window;                                      /* "event" window it is reported relative to                    */
461     Window root;                                        /* root window that the event occurred on                       */
462     Window subwindow;                                   /* child window                                                 */
463     Time time;                                          /* milliseconds                                                 */
464     int x, y;                                           /* pointer x, y coordinates in event window                     */
465     int x_root, y_root;                                 /* coordinates relative to root                                 */
466     uint state;                                         /* key or button mask                                           */
467     uint keycode;                                       /* detail                                                       */
468     Bool same_screen;                                   /* same screen flag                                             */
469 }
470 
471 alias XKeyEvent XKeyPressedEvent;
472 alias XKeyEvent XKeyReleasedEvent;
473 
474 struct XButtonEvent{
475     int type;                                           /* of event                                                     */
476     c_ulong  serial;                                    /* # of last request processed by server                        */
477     Bool send_event;                                    /* true if this came from a SendEvent request                   */
478     Display* display;                                   /* Display the event was read from                              */
479     Window window;                                      /* "event" window it is reported relative to                    */
480     Window root;                                        /* root window that the event occurred on                       */
481     Window subwindow;                                   /* child window                                                 */
482     Time time;                                          /* milliseconds                                                 */
483     int x, y;                                           /* pointer x, y coordinates in event window                     */
484     int x_root, y_root;                                 /* coordinates relative to root                                 */
485     uint state;                                         /* key or button mask                                           */
486     uint button;                                        /* detail                                                       */
487     Bool same_screen;                                   /* same screen flag                                             */
488 }
489 alias XButtonEvent XButtonPressedEvent;
490 alias XButtonEvent XButtonReleasedEvent;
491 
492 struct XMotionEvent{
493     int type;                                           /* of event                                                     */
494     c_ulong serial;                                       /* # of last request processed by server                        */
495     Bool send_event;                                    /* true if this came from a SendEvent request                   */
496     Display* display;                                   /* Display the event was read from                              */
497     Window window;                                      /* "event" window reported relative to                          */
498     Window root;                                        /* root window that the event occurred on                       */
499     Window subwindow;                                   /* child window                                                 */
500     Time time;                                          /* milliseconds                                                 */
501     int x, y;                                           /* pointer x, y coordinates in event window                     */
502     int x_root, y_root;                                 /* coordinates relative to root                                 */
503     uint state;                                         /* key or button mask                                           */
504     char is_hint;                                       /* detail                                                       */
505     Bool same_screen;                                   /* same screen flag                                             */
506 }
507 alias XMotionEvent XPointerMovedEvent;
508 
509 struct XCrossingEvent{
510     int type;                                           /* of event                                                     */
511     c_ulong serial;                                       /* # of last request processed by server                        */
512     Bool send_event;                                    /* true if this came from a SendEvent request                   */
513     Display* display;                                   /* Display the event was read from                              */
514     Window window;                                      /* "event" window reported relative to                          */
515     Window root;                                        /* root window that the event occurred on                       */
516     Window subwindow;                                   /* child window                                                 */
517     Time time;                                          /* milliseconds                                                 */
518     int x, y;                                           /* pointer x, y coordinates in event window                     */
519     int x_root, y_root;                                 /* coordinates relative to root                                 */
520     int mode;                                           /* NotifyNormal, NotifyGrab, NotifyUngrab                       */
521     int detail;
522     /*
523      * NotifyAncestor, NotifyVirtual, NotifyInferior,
524      * NotifyNonlinear,NotifyNonlinearVirtual
525      */
526     Bool same_screen;                                   /* same screen flag                                             */
527     Bool focus;                                         /* boolean focus                                                */
528     uint state;                                         /* key or button mask                                           */
529 }
530 alias XCrossingEvent XEnterWindowEvent;
531 alias XCrossingEvent XLeaveWindowEvent;
532 
533 struct XFocusChangeEvent{
534     int type;                                           /* FocusIn or FocusOut                                          */
535     c_ulong serial;                                     /* # of last request processed by server                        */
536     Bool send_event;                                    /* true if this came from a SendEvent request                   */
537     Display* display;                                   /* Display the event was read from                              */
538     Window window;                                      /* window of event                                              */
539     int mode;                                           /* NotifyNormal, NotifyWhileGrabbed,*/
540                                                         /* NotifyGrab, NotifyUngrab */
541     int detail;
542     /*
543      * NotifyAncestor, NotifyVirtual, NotifyInferior,
544      * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer,
545      * NotifyPointerRoot, NotifyDetailNone
546      */
547 }
548 alias  XFocusChangeEvent XFocusInEvent;
549 alias  XFocusChangeEvent XFocusOutEvent;
550 
551                                                         /* generated on EnterWindow and FocusIn  when KeyMapState selected */
552 struct XKeymapEvent{
553     int type;
554     c_ulong serial;                                     /* # of last request processed by server                        */
555     Bool send_event;                                    /* true if this came from a SendEvent request                   */
556     Display* display;                                   /* Display the event was read from                              */
557     Window window;
558     char[32] key_vector;
559 }
560 
561 struct XExposeEvent{
562     int type;
563     c_ulong serial;                                     /* # of last request processed by server                        */
564     Bool send_event;                                    /* true if this came from a SendEvent request                   */
565     Display* display;                                   /* Display the event was read from                              */
566     Window window;
567     int x, y;
568     int width, height;
569     int count;                                          /* if non-zero, at least this many more                         */
570 }
571 
572 struct XGraphicsExposeEvent{
573     int type;
574     c_ulong serial;                                     /* # of last request processed by server                        */
575     Bool send_event;                                    /* true if this came from a SendEvent request                   */
576     Display* display;                                   /* Display the event was read from                              */
577     Drawable drawable;
578     int x, y;
579     int width, height;
580     int count;                                          /* if non-zero, at least this many more                         */
581     int major_code;                                     /* core is CopyArea or CopyPlane                                */
582     int minor_code;                                     /* not defined in the core                                      */
583 }
584 
585 struct XNoExposeEvent{
586     int type;
587     c_ulong serial;                                       /* # of last request processed by server                        */
588     Bool send_event;                                    /* true if this came from a SendEvent request                   */
589     Display* display;                                   /* Display the event was read from                              */
590     Drawable drawable;
591     int major_code;                                     /* core is CopyArea or CopyPlane                                */
592     int minor_code;                                     /* not defined in the core                                      */
593 }
594 
595 struct XVisibilityEvent{
596     int type;
597     c_ulong serial;                                       /* # of last request processed by server                        */
598     Bool send_event;                                    /* true if this came from a SendEvent request                   */
599     Display* display;                                   /* Display the event was read from                              */
600     Window window;
601     int state;                                          /* Visibility state                                             */
602 }
603 
604 struct XCreateWindowEvent{
605     int type;
606     c_ulong serial;                                       /* # of last request processed by server                        */
607     Bool send_event;                                    /* true if this came from a SendEvent request                   */
608     Display* display;                                   /* Display the event was read from                              */
609     Window parent;                                      /* parent of the window                                         */
610     Window window;                                      /* window id of window created                                  */
611     int x, y;                                           /* window location                                              */
612     int width, height;                                  /* size of window                                               */
613     int border_width;                                   /* border width                                                 */
614     Bool override_redirect;                             /* creation should be overridden                                */
615 }
616 
617 struct XDestroyWindowEvent{
618     int type;
619     c_ulong serial;                                       /* # of last request processed by server                        */
620     Bool send_event;                                    /* true if this came from a SendEvent request                   */
621     Display* display;                                   /* Display the event was read from                              */
622     Window event;
623     Window window;
624 }
625 
626 struct XUnmapEvent{
627     int type;
628     c_ulong serial;                                       /* # of last request processed by server                        */
629     Bool send_event;                                    /* true if this came from a SendEvent request                   */
630     Display* display;                                   /* Display the event was read from                              */
631     Window event;
632     Window window;
633     Bool from_configure;
634 }
635 
636 struct XMapEvent{
637     int type;
638     c_ulong serial;                                       /* # of last request processed by server                        */
639     Bool send_event;                                    /* true if this came from a SendEvent request                   */
640     Display* display;                                   /* Display the event was read from                              */
641     Window event;
642     Window window;
643     Bool override_redirect;                             /* boolean, is override set...                                  */
644 }
645 
646 struct XMapRequestEvent{
647     int type;
648     c_ulong serial;                                       /* # of last request processed by server                        */
649     Bool send_event;                                    /* true if this came from a SendEvent request                   */
650     Display* display;                                   /* Display the event was read from                              */
651     Window parent;
652     Window window;
653 }
654 
655 struct XReparentEvent{
656     int type;
657     c_ulong serial;                                       /* # of last request processed by server                        */
658     Bool send_event;                                    /* true if this came from a SendEvent request                   */
659     Display* display;                                   /* Display the event was read from                              */
660     Window event;
661     Window window;
662     Window parent;
663     int x, y;
664     Bool override_redirect;
665 }
666 
667 struct XConfigureEvent{
668     int type;
669     c_ulong serial;                                       /* # of last request processed by server                        */
670     Bool send_event;                                    /* true if this came from a SendEvent request                   */
671     Display* display;                                   /* Display the event was read from                              */
672     Window event;
673     Window window;
674     int x, y;
675     int width, height;
676     int border_width;
677     Window above;
678     Bool override_redirect;
679 }
680 
681 struct XGravityEvent{
682     int type;
683     c_ulong serial;                                       /* # of last request processed by server                        */
684     Bool send_event;                                    /* true if this came from a SendEvent request                   */
685     Display* display;                                   /* Display the event was read from                              */
686     Window event;
687     Window window;
688     int x, y;
689 }
690 
691 struct XResizeRequestEvent{
692     int type;
693     c_ulong serial;                                       /* # of last request processed by server                        */
694     Bool send_event;                                    /* true if this came from a SendEvent request                   */
695     Display* display;                                   /* Display the event was read from                              */
696     Window window;
697     int width, height;
698 }
699 
700 struct XConfigureRequestEvent{
701     int type;
702     c_ulong serial;                                       /* # of last request processed by server                        */
703     Bool send_event;                                    /* true if this came from a SendEvent request                   */
704     Display* display;                                   /* Display the event was read from                              */
705     Window parent;
706     Window window;
707     int x, y;
708     int width, height;
709     int border_width;
710     Window above;
711     int detail;                                         /* Above, Below, TopIf, BottomIf, Opposite                      */
712     c_ulong value_mask;
713 }
714 
715 struct XCirculateEvent{
716     int type;
717     c_ulong serial;                                       /* # of last request processed by server                        */
718     Bool send_event;                                    /* true if this came from a SendEvent request                   */
719     Display* display;                                   /* Display the event was read from                              */
720     Window event;
721     Window window;
722     int place;                                          /* PlaceOnTop, PlaceOnBottom                                    */
723 }
724 
725 struct XCirculateRequestEvent{
726     int type;
727     c_ulong serial;                                       /* # of last request processed by server                        */
728     Bool send_event;                                    /* true if this came from a SendEvent request                   */
729     Display* display;                                   /* Display the event was read from                              */
730     Window parent;
731     Window window;
732     int place;                                          /* PlaceOnTop, PlaceOnBottom                                    */
733 }
734 
735 struct XPropertyEvent{
736     int type;
737     c_ulong serial;                                       /* # of last request processed by server                        */
738     Bool send_event;                                    /* true if this came from a SendEvent request                   */
739     Display* display;                                   /* Display the event was read from                              */
740     Window window;
741     Atom atom;
742     Time time;
743     int state;                                          /* NewValue, Deleted                                            */
744 }
745 
746 struct XSelectionClearEvent{
747     int type;
748     c_ulong serial;                                       /* # of last request processed by server                        */
749     Bool send_event;                                    /* true if this came from a SendEvent request                   */
750     Display* display;                                   /* Display the event was read from                              */
751     Window window;
752     Atom selection;
753     Time time;
754 }
755 
756 struct XSelectionRequestEvent{
757     int type;
758     c_ulong serial;                                       /* # of last request processed by server                        */
759     Bool send_event;                                    /* true if this came from a SendEvent request                   */
760     Display* display;                                   /* Display the event was read from                              */
761     Window owner;
762     Window requestor;
763     Atom selection;
764     Atom target;
765     Atom property;
766     Time time;
767 }
768 
769 struct XSelectionEvent{
770     int type;
771     c_ulong serial;                                       /* # of last request processed by server                        */
772     Bool send_event;                                    /* true if this came from a SendEvent request                   */
773     Display* display;                                   /* Display the event was read from                              */
774     Window requestor;
775     Atom selection;
776     Atom target;
777     Atom property;                                      /* ATOM or None                                                 */
778     Time time;
779 }
780 
781 struct XColormapEvent{
782     int type;
783     c_ulong serial;                                       /* # of last request processed by server                        */
784     Bool send_event;                                    /* true if this came from a SendEvent request                   */
785     Display* display;                                   /* Display the event was read from                              */
786     Window window;
787     Colormap colormap;                                  /* COLORMAP or None                                             */
788     Bool c_new;                                         /* C++                                                          */
789     int state;                                          /* ColormapInstalled, ColormapUninstalled                       */
790 }
791 
792 struct XClientMessageEvent{
793     int type;
794     c_ulong serial;                                       /* # of last request processed by server                        */
795     Bool send_event;                                    /* true if this came from a SendEvent request                   */
796     Display* display;                                   /* Display the event was read from                              */
797     Window window;
798     Atom message_type;
799     int format;
800     union _data  {
801                     char[20] b;
802                     short[10] s;
803                     c_long[5] l;
804                 }
805 	_data data;
806 }
807 
808 struct XMappingEvent{
809     int type;
810     c_ulong serial;                                       /* # of last request processed by server                        */
811     Bool send_event;                                    /* true if this came from a SendEvent request                   */
812     Display* display;                                   /* Display the event was read from                              */
813     Window window;                                      /* unused                                                       */
814     int request;                                        /* one of MappingModifier, MappingKeyboard, MappingPointer      */
815     int first_keycode;                                  /* first keycode                                                */
816     int count;                                          /* defines range of change w. first_keycode                     */
817 }
818 
819 struct XErrorEvent{
820     int type;
821     Display* display;                                   /* Display the event was read from                              */
822     XID resourceid;                                     /* resource id                                                  */
823     c_ulong  serial;                                    /* serial number of failed request                              */
824     ubyte error_code;                                   /* error code of failed request                                 */
825     ubyte request_code;                                 /* Major op-code of failed request                              */
826     ubyte minor_code;                                   /* Minor op-code of failed request                              */
827 }
828 
829 struct XAnyEvent{
830     int type;
831     c_ulong serial;                                      /* # of last request processed by server                        */
832     Bool send_event;                                    /* true if this came from a SendEvent request                   */
833     Display* display;                                   /* Display the event was read from                              */
834     Window window;                                      /* window on which event was requested in event mask            */
835 }
836 
837 
838 /***************************************************************
839  *
840  * GenericEvent.  This event is the standard event for all newer extensions.
841  */
842 
843 struct XGenericEvent {
844     int            type;                                /* of event. Always GenericEvent                                */
845     c_ulong        serial;                              /* # of last request processed                                  */
846     Bool           send_event;                          /* true if from SendEvent request                               */
847     Display*       display;                             /* Display the event was read from                              */
848     int            extension;                           /* major opcode of extension that caused the event              */
849     int            evtype;                              /* actual event type.                                           */
850 }
851 
852 struct XGenericEventCookie{
853     int            type;                                /* of event. Always GenericEvent                                */
854     c_ulong        serial;                              /* # of last request processed                                  */
855     Bool           send_event;                          /* true if from SendEvent request                               */
856     Display*       display;                             /* Display the event was read from                              */
857     int            extension;                           /* major opcode of extension that caused the event              */
858     int            evtype;                              /* actual event type.                                           */
859     uint           cookie;
860     void*          data;
861 }
862 
863 /*
864  * this union is defined so Xlib can always use the same sized
865  * event structure internally, to avoid memory fragmentation.
866  */
867  union XEvent {
868     int type;                                           /* must not be changed; first element                           */
869     XAnyEvent xany;
870     XKeyEvent xkey;
871     XButtonEvent xbutton;
872     XMotionEvent xmotion;
873     XCrossingEvent xcrossing;
874     XFocusChangeEvent xfocus;
875     XExposeEvent xexpose;
876     XGraphicsExposeEvent xgraphicsexpose;
877     XNoExposeEvent xnoexpose;
878     XVisibilityEvent xvisibility;
879     XCreateWindowEvent xcreatewindow;
880     XDestroyWindowEvent xdestroywindow;
881     XUnmapEvent xunmap;
882     XMapEvent xmap;
883     XMapRequestEvent xmaprequest;
884     XReparentEvent xreparent;
885     XConfigureEvent xconfigure;
886     XGravityEvent xgravity;
887     XResizeRequestEvent xresizerequest;
888     XConfigureRequestEvent xconfigurerequest;
889     XCirculateEvent xcirculate;
890     XCirculateRequestEvent xcirculaterequest;
891     XPropertyEvent xproperty;
892     XSelectionClearEvent xselectionclear;
893     XSelectionRequestEvent xselectionrequest;
894     XSelectionEvent xselection;
895     XColormapEvent xcolormap;
896     XClientMessageEvent xclient;
897     XMappingEvent xmapping;
898     XErrorEvent xerror;
899     XKeymapEvent xkeymap;
900     XGenericEvent xgeneric;
901     XGenericEventCookie xcookie;
902     c_long[24] pad;
903 };
904 
905 int XAllocID(Display* dpy) {return cast(int) dpy.resource_alloc(dpy);}
906 
907 /*
908  * per character font metric information.
909  */
910 struct XCharStruct{
911     short    lbearing;                                  /* origin to left edge of raster                                */
912     short    rbearing;                                  /* origin to right edge of raster                               */
913     short    width;                                     /* advance to next char's origin                                */
914     short    ascent;                                    /* baseline to top edge of raster                               */
915     short    descent;                                   /* baseline to bottom edge of raster                            */
916     ushort   attributes;                                /* per char flags (not predefined)                              */
917 }
918 
919 /*
920  * To allow arbitrary information with fonts, there are additional properties
921  * returned.
922  */
923 struct XFontProp{
924     Atom name;
925     c_ulong card32;
926 }
927 
928 struct XFontStruct{
929     XExtData*       ext_data;                           /* hook for extension to hang data                              */
930     Font            fid;                                /* Font id for this font                                        */
931     uint            direction;                          /* hint about direction the font is painted                     */
932     uint            min_char_or_char2;                  /* first character                                              */
933     uint            max_char_or_char2;                  /* last character                                               */
934     uint            min_char1;                          /* first row that exists                                        */
935     uint            max_char1;                          /* last row that exists                                         */
936     Bool            all_chars_exist;                    /* flag if all characters have non-zero size                    */
937     uint            default_char;                       /* char to print for undefined character                        */
938     int             n_properties;                       /* how many properties there are                                */
939     XFontProp*      properties;                         /* pointer to array of additional properties                    */
940     XCharStruct     min_bounds;                         /* minimum bounds over all existing char                        */
941     XCharStruct     max_bounds;                         /* maximum bounds over all existing char                        */
942     XCharStruct*    per_char;                           /* first_char to last_char information                          */
943     int             ascent;                             /* log. extent above baseline for spacing                       */
944     int             descent;                            /* log. descent below baseline for spacing                      */
945 }
946 
947 /*
948  * PolyText routines take these as arguments.
949  */
950 struct XTextItem{
951     char* chars;                                        /* pointer to string                                            */
952     int nchars;                                         /* number of characters                                         */
953     int delta;                                          /* delta between strings                                        */
954     Font font;                                          /* font to print it in, None don't change                       */
955 }
956 
957 struct XChar2b{                                               /* normal 16 bit characters are two chars                       */
958     ubyte char1;
959     ubyte char2;
960 }
961 
962 struct XTextItem16{
963     XChar2b* chars;                                     /* two char characters                                          */
964     int nchars;                                         /* number of characters                                         */
965     int delta;                                          /* delta between strings                                        */
966     Font font;                                          /* font to print it in, None don't change                       */
967 }
968 
969 
970 union XEDataObject{
971     Display* display;
972     GC gc;
973     Visual* visual;
974     Screen* screen;
975     ScreenFormat* pixmap_format;
976     XFontStruct* font;
977 }
978 
979 struct XFontSetExtents{
980     XRectangle      max_ink_extent;
981     XRectangle      max_logical_extent;
982 }
983 
984 /* unused:
985  void (*XOMProc)();
986  */
987 
988 struct _XOM{}
989 struct _XOC{}
990 alias _XOM*   XOM;
991 alias _XOC*   XOC;
992 alias _XOC*   XFontSet;
993 
994 struct XmbTextItem{
995     char*           chars;
996     int             nchars;
997     int             delta;
998     XFontSet        font_set;
999 }
1000 
1001 struct XwcTextItem{
1002     wchar*          chars;
1003     int             nchars;
1004     int             delta;
1005     XFontSet        font_set;
1006 }
1007 
1008 const char* XNRequiredCharSet                = "requiredCharSet";
1009 const char* XNQueryOrientation               = "queryOrientation";
1010 const char* XNBaseFontName                   = "baseFontName";
1011 const char* XNOMAutomatic                    = "omAutomatic";
1012 const char* XNMissingCharSet                 = "missingCharSet";
1013 const char* XNDefaultString                  = "defaultString";
1014 const char* XNOrientation                    = "orientation";
1015 const char* XNDirectionalDependentDrawing    = "directionalDependentDrawing";
1016 const char* XNContextualDrawing              = "contextualDrawing";
1017 const char* XNFontInfo                       = "fontInfo";
1018 
1019 struct XOMCharSetList{
1020     int charset_count;
1021     char** charset_list;
1022 }
1023 
1024 alias int XOrientation;
1025 enum {
1026     XOMOrientation_LTR_TTB,
1027     XOMOrientation_RTL_TTB,
1028     XOMOrientation_TTB_LTR,
1029     XOMOrientation_TTB_RTL,
1030     XOMOrientation_Context
1031 }
1032 
1033 struct XOMOrientation{
1034     int num_orientation;
1035     XOrientation* orientation;                          /* Input Text description                                       */
1036 }
1037 
1038 struct XOMFontInfo{
1039     int num_font;
1040     XFontStruct **font_struct_list;
1041     char** font_name_list;
1042 }
1043 
1044 struct _XIM{}
1045 struct _XIC{}
1046 alias _XIM *XIM;
1047 alias _XIC *XIC;
1048 
1049 alias void function(
1050     XIM,
1051     XPointer,
1052     XPointer
1053 ) XIMProc;
1054 
1055 alias Bool function(
1056     XIC,
1057     XPointer,
1058     XPointer
1059 ) XICProc;
1060 
1061 alias void function(
1062     Display*,
1063     XPointer,
1064     XPointer
1065 ) XIDProc;
1066 
1067 struct XIMStyles{
1068     ushort count_styles;
1069     XIMStyle* supported_styles;
1070 }
1071 
1072 alias c_ulong XIMStyle;
1073 enum {
1074     XIMPreeditArea      = 0x0001L,
1075     XIMPreeditCallbacks = 0x0002L,
1076     XIMPreeditPosition  = 0x0004L,
1077     XIMPreeditNothing   = 0x0008L,
1078     XIMPreeditNone      = 0x0010L,
1079     XIMStatusArea       = 0x0100L,
1080     XIMStatusCallbacks  = 0x0200L,
1081     XIMStatusNothing    = 0x0400L,
1082     XIMStatusNone       = 0x0800L
1083 }
1084 
1085 const char* XNVaNestedList                 = "XNVaNestedList";
1086 const char* XNQueryInputStyle              = "queryInputStyle";
1087 const char* XNClientWindow                 = "clientWindow";
1088 const char* XNInputStyle                   = "inputStyle";
1089 const char* XNFocusWindow                  = "focusWindow";
1090 const char* XNResourceName                 = "resourceName";
1091 const char* XNResourceClass                = "resourceClass";
1092 const char* XNGeometryCallback             = "geometryCallback";
1093 const char* XNDestroyCallback              = "destroyCallback";
1094 const char* XNFilterEvents                 = "filterEvents";
1095 const char* XNPreeditStartCallback         = "preeditStartCallback";
1096 const char* XNPreeditDoneCallback          = "preeditDoneCallback";
1097 const char* XNPreeditDrawCallback          = "preeditDrawCallback";
1098 const char* XNPreeditCaretCallback         = "preeditCaretCallback";
1099 const char* XNPreeditStateNotifyCallback   = "preeditStateNotifyCallback";
1100 const char* XNPreeditAttributes            = "preeditAttributes";
1101 const char* XNStatusStartCallback          = "statusStartCallback";
1102 const char* XNStatusDoneCallback           = "statusDoneCallback";
1103 const char* XNStatusDrawCallback           = "statusDrawCallback";
1104 const char* XNStatusAttributes             = "statusAttributes";
1105 const char* XNArea                         = "area";
1106 const char* XNAreaNeeded                   = "areaNeeded";
1107 const char* XNSpotLocation                 = "spotLocation";
1108 const char* XNColormap                     = "colorMap";
1109 const char* XNStdColormap                  = "stdColorMap";
1110 const char* XNForeground                   = "foreground";
1111 const char* XNBackground                   = "background";
1112 const char* XNBackgroundPixmap             = "backgroundPixmap";
1113 const char* XNFontSet                      = "fontSet";
1114 const char* XNLineSpace                    = "lineSpace";
1115 const char* XNCursor                       = "cursor";
1116 
1117 const char* XNQueryIMValuesList            = "queryIMValuesList";
1118 const char* XNQueryICValuesList            = "queryICValuesList";
1119 const char* XNVisiblePosition              = "visiblePosition";
1120 const char* XNR6PreeditCallback            = "r6PreeditCallback";
1121 const char* XNStringConversionCallback     = "stringConversionCallback";
1122 const char* XNStringConversion             = "stringConversion";
1123 const char* XNResetState                   = "resetState";
1124 const char* XNHotKey                       = "hotKey";
1125 const char* XNHotKeyState                  = "hotKeyState";
1126 const char* XNPreeditState                 = "preeditState";
1127 const char* XNSeparatorofNestedList        = "separatorofNestedList";
1128 
1129 const int XBufferOverflow                   = -1;
1130 const int XLookupNone                       = 1;
1131 const int XLookupChars                      = 2;
1132 const int XLookupKeySym                     = 3;
1133 const int XLookupBoth                       = 4;
1134 
1135 alias XVaNestedList = void*;
1136 
1137 struct XIMCallback{
1138     XPointer client_data;
1139     XIMProc callback;
1140 }
1141 
1142 struct XICCallback{
1143     XPointer client_data;
1144     XICProc callback;
1145 }
1146 
1147 alias int XIMFeedback;
1148 enum {
1149     XIMReverse              = 1L,
1150     XIMUnderline            = (1L<<1),
1151     XIMHighlight            = (1L<<2),
1152     XIMPrimary              = (1L<<5),
1153     XIMSecondary            = (1L<<6),
1154     XIMTertiary             = (1L<<7),
1155     XIMVisibleToForward     = (1L<<8),
1156     XIMVisibleToBackword    = (1L<<9),
1157     XIMVisibleToCenter      = (1L<<10)
1158 }
1159 
1160 struct XIMText {
1161     ushort length;
1162     XIMFeedback* feedback;
1163     Bool encoding_is_wchar;
1164     union c_string{
1165         char* multi_char;
1166         wchar*   wide_char;
1167     }
1168 }
1169 
1170 
1171 alias c_ulong XIMPreeditState;
1172 enum {
1173     XIMPreeditUnKnown   = 0L,
1174     XIMPreeditEnable    = 1L,
1175     XIMPreeditDisable   = (1L<<1)
1176 }
1177 
1178 struct XIMPreeditStateNotifyCallbackStruct {
1179     XIMPreeditState state;
1180 }
1181 
1182 alias c_ulong XIMResetState;
1183 enum {
1184     XIMInitialState = 1L,
1185     XIMPreserveState= 1L<<1
1186 }
1187 
1188 alias c_ulong XIMStringConversionFeedback;
1189 enum {
1190     XIMStringConversionLeftEdge     = 0x00000001,
1191     XIMStringConversionRightEdge    = 0x00000002,
1192     XIMStringConversionTopEdge      = 0x00000004,
1193     XIMStringConversionBottomEdge   = 0x00000008,
1194     XIMStringConversionConcealed    = 0x00000010,
1195     XIMStringConversionWrapped      = 0x00000020
1196 }
1197 
1198 struct XIMStringConversionText{
1199     ushort length;
1200     XIMStringConversionFeedback* feedback;
1201     Bool encoding_is_wchar;
1202     union c_string{
1203         char* mbs;
1204         wchar*   wcs;
1205     };
1206 }
1207 
1208 alias ushort XIMStringConversionPosition;
1209 
1210 alias ushort XIMStringConversionType;
1211 enum {
1212     XIMStringConversionBuffer   = 0x0001,
1213     XIMStringConversionLine     = 0x0002,
1214     XIMStringConversionWord     = 0x0003,
1215     XIMStringConversionChar     = 0x0004
1216 }
1217 
1218 alias ushort XIMStringConversionOperation;
1219 enum {
1220     XIMStringConversionSubstitution     = 0x0001,
1221     XIMStringConversionRetrieval        = 0x0002
1222 }
1223 
1224 alias int XIMCaretDirection;
1225 enum {
1226     XIMForwardChar, XIMBackwardChar,
1227     XIMForwardWord, XIMBackwardWord,
1228     XIMCaretUp,     XIMCaretDown,
1229     XIMNextLine,    XIMPreviousLine,
1230     XIMLineStart,   XIMLineEnd,
1231     XIMAbsolutePosition,
1232     XIMDontChange
1233 }
1234 
1235 struct XIMStringConversionCallbackStruct{
1236     XIMStringConversionPosition position;
1237     XIMCaretDirection direction;
1238     XIMStringConversionOperation operation;
1239     ushort factor;
1240     XIMStringConversionText* text;
1241 }
1242 
1243 struct XIMPreeditDrawCallbackStruct{
1244     int caret;                                          /* Cursor offset within pre-edit string                         */
1245     int chg_first;                                      /* Starting change position                                     */
1246     int chg_length;                                     /* Length of the change in character count                      */
1247     XIMText* text;
1248 }
1249 
1250 alias int XIMCaretStyle;
1251 enum {
1252     XIMIsInvisible,                                     /* Disable caret feedback                                       */
1253     XIMIsPrimary,                                       /* UI defined caret feedback                                    */
1254     XIMIsSecondary                                      /* UI defined caret feedback                                    */
1255 }
1256 
1257 struct XIMPreeditCaretCallbackStruct{
1258     int position;                                       /* Caret offset within pre-edit string                          */
1259     XIMCaretDirection direction;                        /* Caret moves direction                                        */
1260     XIMCaretStyle style;                                /* Feedback of the caret                                        */
1261 }
1262 
1263 alias int XIMStatusDataType;
1264 enum {
1265     XIMTextType,
1266     XIMBitmapType
1267 }
1268 
1269 struct XIMStatusDrawCallbackStruct {
1270     XIMStatusDataType type;
1271     union data{
1272         XIMText*    text;
1273         Pixmap      bitmap;
1274     };
1275 }
1276 
1277 struct XIMHotKeyTrigger {
1278     KeySym      keysym;
1279     int         modifier;
1280     int         modifier_mask;
1281 }
1282 
1283 struct XIMHotKeyTriggers {
1284     int                 num_hot_key;
1285     XIMHotKeyTrigger*   key;
1286 }
1287 
1288 alias c_ulong XIMHotKeyState;
1289 enum {
1290     XIMHotKeyStateON    = 0x0001L,
1291     XIMHotKeyStateOFF   = 0x0002L
1292 }
1293 
1294 struct XIMValuesList{
1295     ushort count_values;
1296     char** supported_values;
1297 }
1298 
1299 version( Windows ){
1300 	extern int	*_Xdebug_p;
1301 } else {
1302 	extern int _Xdebug;
1303 }
1304 
1305 extern XFontStruct* XLoadQueryFont(
1306     Display*                                            /* display                                                      */,
1307     char*                                               /* name                                                         */
1308 );
1309 
1310 extern XFontStruct* XQueryFont(
1311     Display*                                            /* display                                                      */,
1312     XID                                                 /* font_ID                                                      */
1313 );
1314 
1315 
1316 extern XTimeCoord* XGetMotionEvents(
1317     Display*                                            /* display                                                      */,
1318     Window                                              /* w                                                            */,
1319     Time                                                /* start                                                        */,
1320     Time                                                /* stop                                                         */,
1321     int*                                                /* nevents_return                                               */
1322 );
1323 
1324 extern XModifierKeymap* XDeleteModifiermapEntry(
1325     XModifierKeymap*                                    /* modmap                                                       */,
1326     KeyCode                                             /* keycode_entry                                                */,
1327     int                                                 /* modifier                                                     */
1328 );
1329 
1330 extern XModifierKeymap* XGetModifierMapping(
1331     Display*                                            /* display                                                      */
1332 );
1333 
1334 extern XModifierKeymap* XInsertModifiermapEntry(
1335     XModifierKeymap*                                    /* modmap                                                       */,
1336     KeyCode                                             /* keycode_entry                                                */,
1337     int                                                 /* modifier                                                     */
1338 );
1339 
1340 extern XModifierKeymap* XNewModifiermap(
1341     int                                                 /* max_keys_per_mod                                             */
1342 );
1343 
1344 extern XImage* XCreateImage(
1345     Display*                                            /* display                                                      */,
1346     Visual*                                             /* visual                                                       */,
1347     uint                                                /* depth                                                        */,
1348     int                                                 /* format                                                       */,
1349     int                                                 /* offset                                                       */,
1350     char*                                               /* data                                                         */,
1351     uint                                                /* width                                                        */,
1352     uint                                                /* height                                                       */,
1353     int                                                 /* bitmap_pad                                                   */,
1354     int                                                 /* chars_per_line                                               */
1355 );
1356 extern Status XInitImage(
1357     XImage*                                             /* image                                                        */
1358 );
1359 extern XImage* XGetImage(
1360     Display*                                            /* display                                                      */,
1361     Drawable                                            /* d                                                            */,
1362     int                                                 /* x                                                            */,
1363     int                                                 /* y                                                            */,
1364     uint                                                /* width                                                        */,
1365     uint                                                /* height                                                       */,
1366     c_ulong                                             /* plane_mask                                                   */,
1367     int                                                 /* format                                                       */
1368 );
1369 extern XImage* XGetSubImage(
1370     Display*                                            /* display                                                      */,
1371     Drawable                                            /* d                                                            */,
1372     int                                                 /* x                                                            */,
1373     int                                                 /* y                                                            */,
1374     uint                                                /* width                                                        */,
1375     uint                                                /* height                                                       */,
1376     c_ulong                                             /* plane_mask                                                   */,
1377     int                                                 /* format                                                       */,
1378     XImage*                                             /* dest_image                                                   */,
1379     int                                                 /* dest_x                                                       */,
1380     int                                                 /* dest_y                                                       */
1381 );
1382 
1383 /*
1384  * X function declarations.
1385  */
1386 extern Display* XOpenDisplay(
1387     char*                                               /* display_name                                                 */
1388 );
1389 
1390 extern void XrmInitialize( );
1391 
1392 extern char* XFetchchars(
1393     Display*                                            /* display                                                      */,
1394     int*                                                /* nchars_return                                                */
1395 );
1396 extern char* XFetchBuffer(
1397     Display*                                            /* display                                                      */,
1398     int*                                                /* nchars_return                                                */,
1399     int                                                 /* buffer                                                       */
1400 );
1401 extern char* XGetAtomName(
1402     Display*                                            /* display                                                      */,
1403     Atom                                                /* atom                                                         */
1404 );
1405 extern Status XGetAtomNames(
1406     Display*                                            /* dpy                                                          */,
1407     Atom*                                               /* atoms                                                        */,
1408     int                                                 /* count                                                        */,
1409     char**                                              /* names_return                                                 */
1410 );
1411 extern char* XGetDefault(
1412     Display*                                            /* display                                                      */,
1413     char*                                               /* program                                                      */,
1414     char*                                               /* option                                                       */
1415 );
1416 extern char* XDisplayName(
1417     char*                                               /* string                                                       */
1418 );
1419 extern char* XKeysymToString(
1420     KeySym                                              /* keysym                                                       */
1421 );
1422 
1423 extern int function(
1424     Display*                                            /* display                                                      */
1425 )XSynchronize(
1426     Display*                                            /* display                                                      */,
1427     Bool                                                /* onoff                                                        */
1428 );
1429 extern int function(
1430     Display*                                            /* display                                                      */
1431 )XSetAfterFunction(
1432     Display*                                            /* display                                                      */,
1433     int function(
1434          Display*                                       /* display                                                      */
1435     )                                                   /* procedure                                                    */
1436 );
1437 extern Atom XInternAtom(
1438     Display*                                            /* display                                                      */,
1439     const char*                                         /* atom_name                                                    */,
1440     Bool                                                /* only_if_exists                                               */
1441 );
1442 extern Status XInternAtoms(
1443     Display*                                            /* dpy                                                          */,
1444     char**                                              /* names                                                        */,
1445     int                                                 /* count                                                        */,
1446     Bool                                                /* onlyIfExists                                                 */,
1447     Atom*                                               /* atoms_return                                                 */
1448 );
1449 extern Colormap XCopyColormapAndFree(
1450     Display*                                            /* display                                                      */,
1451     Colormap                                            /* colormap                                                     */
1452 );
1453 extern Colormap XCreateColormap(
1454     Display*                                            /* display                                                      */,
1455     Window                                              /* w                                                            */,
1456     Visual*                                             /* visual                                                       */,
1457     int                                                 /* alloc                                                        */
1458 );
1459 extern Cursor XCreatePixmapCursor(
1460     Display*                                            /* display                                                      */,
1461     Pixmap                                              /* source                                                       */,
1462     Pixmap                                              /* mask                                                         */,
1463     XColor*                                             /* foreground_color                                             */,
1464     XColor*                                             /* background_color                                             */,
1465     uint                                                /* x                                                            */,
1466     uint                                                /* y                                                            */
1467 );
1468 extern Cursor XCreateGlyphCursor(
1469     Display*                                            /* display                                                      */,
1470     Font                                                /* source_font                                                  */,
1471     Font                                                /* mask_font                                                    */,
1472     uint                                                /* source_char*                                                 */,
1473     uint                                                /* mask_char*                                                   */,
1474     XColor*                                             /* foreground_color                                             */,
1475     XColor*                                             /* background_color                                             */
1476 );
1477 extern Cursor XCreateFontCursor(
1478     Display*                                            /* display                                                      */,
1479     uint                                                /* shape                                                        */
1480 );
1481 extern Font XLoadFont(
1482     Display*                                            /* display                                                      */,
1483     char*                                               /* name                                                         */
1484 );
1485 extern GC XCreateGC(
1486     Display*                                            /* display                                                      */,
1487     Drawable                                            /* d                                                            */,
1488     c_ulong                                             /* valuemask                                                    */,
1489     XGCValues*                                          /* values                                                       */
1490 );
1491 extern GContext XGContextFromGC(
1492     GC                                                  /* gc                                                           */
1493 );
1494 extern void XFlushGC(
1495     Display*                                            /* display                                                      */,
1496     GC                                                  /* gc                                                           */
1497 );
1498 extern Pixmap XCreatePixmap(
1499     Display*                                            /* display                                                      */,
1500     Drawable                                            /* d                                                            */,
1501     uint                                                /* width                                                        */,
1502     uint                                                /* height                                                       */,
1503     uint                                                /* depth                                                        */
1504 );
1505 extern Pixmap XCreateBitmapFromData(
1506     Display*                                            /* display                                                      */,
1507     Drawable                                            /* d                                                            */,
1508     char*                                               /* data                                                         */,
1509     uint                                                /* width                                                        */,
1510     uint                                                /* height                                                       */
1511 );
1512 extern Pixmap XCreatePixmapFromBitmapData(
1513     Display*                                            /* display                                                      */,
1514     Drawable                                            /* d                                                            */,
1515     char*                                               /* data                                                         */,
1516     uint                                                /* width                                                        */,
1517     uint                                                /* height                                                       */,
1518     c_ulong                                             /* fg                                                           */,
1519     c_ulong                                             /* bg                                                           */,
1520     uint                                                /* depth                                                        */
1521 );
1522 extern Window XCreateSimpleWindow(
1523     Display*                                            /* display                                                      */,
1524     Window                                              /* parent                                                       */,
1525     int                                                 /* x                                                            */,
1526     int                                                 /* y                                                            */,
1527     uint                                                /* width                                                        */,
1528     uint                                                /* height                                                       */,
1529     uint                                                /* border_width                                                 */,
1530     c_ulong                                             /* border                                                       */,
1531     c_ulong                                             /* background                                                   */
1532 );
1533 extern Window XGetSelectionOwner(
1534     Display*                                            /* display                                                      */,
1535     Atom                                                /* selection                                                    */
1536 );
1537 extern Window XCreateWindow(
1538     Display*                                            /* display                                                      */,
1539     Window                                              /* parent                                                       */,
1540     int                                                 /* x                                                            */,
1541     int                                                 /* y                                                            */,
1542     uint                                                /* width                                                        */,
1543     uint                                                /* height                                                       */,
1544     uint                                                /* border_width                                                 */,
1545     int                                                 /* depth                                                        */,
1546     uint                                                /* class                                                        */,
1547     Visual*                                             /* visual                                                       */,
1548     c_ulong                                             /* valuemask                                                    */,
1549     XSetWindowAttributes*                               /* attributes                                                   */
1550 );
1551 
1552 extern Colormap* XListInstalledColormaps(
1553     Display*                                            /* display                                                      */,
1554     Window                                              /* w                                                            */,
1555     int*                                                /* num_return                                                   */
1556 );
1557 extern char** XListFonts(
1558     Display*                                            /* display                                                      */,
1559     char*                                               /* pattern                                                      */,
1560     int                                                 /* maxnames                                                     */,
1561     int*                                                /* actual_count_return                                          */
1562 );
1563 extern char* XListFontsWithInfo(
1564     Display*                                            /* display                                                      */,
1565     char*                                               /* pattern                                                      */,
1566     int                                                 /* maxnames                                                     */,
1567     int*                                                /* count_return                                                 */,
1568     XFontStruct**                                       /* info_return                                                  */
1569 );
1570 extern char** XGetFontPath(
1571     Display*                                            /* display                                                      */,
1572     int*                                                /* npaths_return                                                */
1573 );
1574 extern char** XListExtensions(
1575     Display*                                            /* display                                                      */,
1576     int*                                                /* nextensions_return                                           */
1577 );
1578 extern Atom* XListProperties(
1579     Display*                                            /* display                                                      */,
1580     Window                                              /* w                                                            */,
1581     int*                                                /* num_prop_return                                              */
1582 );
1583 extern XHostAddress* XListHosts(
1584     Display*                                            /* display                                                      */,
1585     int*                                                /* nhosts_return                                                */,
1586     Bool*                                               /* state_return                                                 */
1587 );
1588 extern KeySym XKeycodeToKeysym(
1589     Display*                                            /* display                                                      */,
1590     KeyCode                                             /* keycode                                                      */,
1591     int                                                 /* index                                                        */
1592 );
1593 extern KeySym XLookupKeysym(
1594     XKeyEvent*                                          /* key_event                                                    */,
1595     int                                                 /* index                                                        */
1596 );
1597 extern KeySym* XGetKeyboardMapping(
1598     Display*                                            /* display                                                      */,
1599     KeyCode                                             /* first_keycode                                                */,
1600     int                                                 /* keycode_count                                                */,
1601     int*                                                /* keysyms_per_keycode_return                                   */
1602 );
1603 extern KeySym XStringToKeysym(
1604     char*                                               /* string                                                       */
1605 );
1606 extern c_long XMaxRequestSize(
1607     Display*                                            /* display                                                      */
1608 );
1609 extern c_long XExtendedMaxRequestSize(
1610     Display*                                            /* display                                                      */
1611 );
1612 extern char* XResourceManagerString(
1613     Display*                                            /* display                                                      */
1614 );
1615 extern char* XScreenResourceString(
1616     Screen*                                             /* screen                                                       */
1617 );
1618 extern c_ulong XDisplayMotionBufferSize(
1619     Display*                                            /* display                                                      */
1620 );
1621 extern VisualID XVisualIDFromVisual(
1622     Visual*                                             /* visual                                                       */
1623 );
1624 
1625                                                         /* multithread routines                                         */
1626 
1627 extern Status XInitThreads( );
1628 
1629 extern void XLockDisplay(
1630     Display*                                            /* display                                                      */
1631 );
1632 
1633 extern void XUnlockDisplay(
1634     Display*                                            /* display                                                      */
1635 );
1636 
1637                                                         /* routines for dealing with extensions                         */
1638 
1639 extern XExtCodes* XInitExtension(
1640     Display*                                            /* display                                                      */,
1641     char*                                               /* name                                                         */
1642 );
1643 
1644 extern XExtCodes* XAddExtension(
1645     Display*                                            /* display                                                      */
1646 );
1647 extern XExtData* XFindOnExtensionList(
1648     XExtData**                                          /* structure                                                    */,
1649     int                                                 /* number                                                       */
1650 );
1651 extern XExtData **XEHeadOfExtensionList(
1652     XEDataObject                                        /* object                                                       */
1653 );
1654 
1655                                                         /* these are routines for which there are also macros           */
1656 extern Window XRootWindow(
1657     Display*                                            /* display                                                      */,
1658     int                                                 /* screen_number                                                */
1659 );
1660 extern Window XDefaultRootWindow(
1661     Display*                                            /* display                                                      */
1662 );
1663 extern Window XRootWindowOfScreen(
1664     Screen*                                             /* screen                                                       */
1665 );
1666 extern Visual* XDefaultVisual(
1667     Display*                                            /* display                                                      */,
1668     int                                                 /* screen_number                                                */
1669 );
1670 extern Visual* XDefaultVisualOfScreen(
1671     Screen*                                             /* screen                                                       */
1672 );
1673 extern GC XDefaultGC(
1674     Display*                                            /* display                                                      */,
1675     int                                                 /* screen_number                                                */
1676 );
1677 extern GC XDefaultGCOfScreen(
1678     Screen*                                             /* screen                                                       */
1679 );
1680 extern c_ulong XBlackPixel(
1681     Display*                                            /* display                                                      */,
1682     int                                                 /* screen_number                                                */
1683 );
1684 extern c_ulong XWhitePixel(
1685     Display*                                            /* display                                                      */,
1686     int                                                 /* screen_number                                                */
1687 );
1688 extern c_ulong XAllPlanes( );
1689 extern c_ulong XBlackPixelOfScreen(
1690     Screen*                                             /* screen                                                       */
1691 );
1692 extern c_ulong XWhitePixelOfScreen(
1693     Screen*                                             /* screen                                                       */
1694 );
1695 extern uint XNextRequest(
1696     Display*                                            /* display                                                      */
1697 );
1698 extern uint XLastKnownRequestProcessed(
1699     Display*                                            /* display                                                      */
1700 );
1701 extern char* XServerVendor(
1702     Display*                                            /* display                                                      */
1703 );
1704 extern char* XDisplayString(
1705     Display*                                            /* display                                                      */
1706 );
1707 extern Colormap XDefaultColormap(
1708     Display*                                            /* display                                                      */,
1709     int                                                 /* screen_number                                                */
1710 );
1711 extern Colormap XDefaultColormapOfScreen(
1712     Screen*                                             /* screen                                                       */
1713 );
1714 extern Display* XDisplayOfScreen(
1715     Screen*                                             /* screen                                                       */
1716 );
1717 extern Screen* XScreenOfDisplay(
1718     Display*                                            /* display                                                      */,
1719     int                                                 /* screen_number                                                */
1720 );
1721 extern Screen* XDefaultScreenOfDisplay(
1722     Display*                                            /* display                                                      */
1723 );
1724 extern c_long XEventMaskOfScreen(
1725     Screen*                                             /* screen                                                       */
1726 );
1727 
1728 extern int XScreenNumberOfScreen(
1729     Screen*                                             /* screen                                                       */
1730 );
1731 
1732 alias int function (                                          /* WARNING, this type not in Xlib spec                          */
1733     Display*                                            /* display                                                      */,
1734     XErrorEvent*                                        /* error_event                                                  */
1735 ) XErrorHandler;
1736 
1737 extern XErrorHandler XSetErrorHandler (
1738     XErrorHandler                                       /* handler                                                      */
1739 );
1740 
1741 
1742 alias int function (                                          /* WARNING, this type not in Xlib spec                          */
1743     Display*                                            /* display                                                      */
1744 )XIOErrorHandler;
1745 
1746 extern XIOErrorHandler XSetIOErrorHandler (
1747     XIOErrorHandler                                     /* handler                                                      */
1748 );
1749 
1750 
1751 extern XPixmapFormatValues* XListPixmapFormats(
1752     Display*                                            /* display                                                      */,
1753     int*                                                /* count_return                                                 */
1754 );
1755 extern int* XListDepths(
1756     Display*                                            /* display                                                      */,
1757     int                                                 /* screen_number                                                */,
1758     int*                                                /* count_return                                                 */
1759 );
1760 
1761                                                         /* ICCCM routines for things that don't require special include files; */
1762                                                         /* other declarations are given in Xutil.h                             */
1763 extern Status XReconfigureWMWindow(
1764     Display*                                            /* display                                                      */,
1765     Window                                              /* w                                                            */,
1766     int                                                 /* screen_number                                                */,
1767     uint                                                /* mask                                                         */,
1768     XWindowChanges*                                     /* changes                                                      */
1769 );
1770 
1771 extern Status XGetWMProtocols(
1772     Display*                                            /* display                                                      */,
1773     Window                                              /* w                                                            */,
1774     Atom**                                              /* protocols_return                                             */,
1775     int*                                                /* count_return                                                 */
1776 );
1777 extern Status XSetWMProtocols(
1778     Display*                                            /* display                                                      */,
1779     Window                                              /* w                                                            */,
1780     Atom*                                               /* protocols                                                    */,
1781     int                                                 /* count                                                        */
1782 );
1783 extern Status XIconifyWindow(
1784     Display*                                            /* display                                                      */,
1785     Window                                              /* w                                                            */,
1786     int                                                 /* screen_number                                                */
1787 );
1788 extern Status XWithdrawWindow(
1789     Display*                                            /* display                                                      */,
1790     Window                                              /* w                                                            */,
1791     int                                                 /* screen_number                                                */
1792 );
1793 extern Status XGetCommand(
1794     Display*                                            /* display                                                      */,
1795     Window                                              /* w                                                            */,
1796     char***                                             /* argv_return                                                  */,
1797     int*                                                /* argc_return                                                  */
1798 );
1799 extern Status XGetWMColormapWindows(
1800     Display*                                            /* display                                                      */,
1801     Window                                              /* w                                                            */,
1802     Window**                                            /* windows_return                                               */,
1803     int*                                                /* count_return                                                 */
1804 );
1805 extern Status XSetWMColormapWindows(
1806     Display*                                            /* display                                                      */,
1807     Window                                              /* w                                                            */,
1808     Window*                                             /* colormap_windows                                             */,
1809     int                                                 /* count                                                        */
1810 );
1811 extern void XFreeStringList(
1812     char**                                              /* list                                                         */
1813 );
1814 extern int XSetTransientForHint(
1815     Display*                                            /* display                                                      */,
1816     Window                                              /* w                                                            */,
1817     Window                                              /* prop_window                                                  */
1818 );
1819 
1820                                                         /* The following are given in alphabetical order                */
1821 
1822 extern int XActivateScreenSaver(
1823     Display*                                            /* display                                                      */
1824 );
1825 
1826 extern int XAddHost(
1827     Display*                                            /* display                                                      */,
1828     XHostAddress*                                       /* host                                                         */
1829 );
1830 
1831 extern int XAddHosts(
1832     Display*                                            /* display                                                      */,
1833     XHostAddress*                                       /* hosts                                                        */,
1834     int                                                 /* num_hosts                                                    */
1835 );
1836 
1837 extern int XAddToExtensionList(
1838     XExtData**                                          /* structure                                                    */,
1839     XExtData*                                           /* ext_data                                                     */
1840 );
1841 
1842 extern int XAddToSaveSet(
1843     Display*                                            /* display                                                      */,
1844     Window                                              /* w                                                            */
1845 );
1846 
1847 extern Status XAllocColor(
1848     Display*                                            /* display                                                      */,
1849     Colormap                                            /* colormap                                                     */,
1850     XColor*                                             /* screen_in_out                                                */
1851 );
1852 
1853 extern Status XAllocColorCells(
1854     Display*                                            /* display                                                      */,
1855     Colormap                                            /* colormap                                                     */,
1856     Bool                                                /* contig                                                       */,
1857     c_ulong*                                            /* plane_masks_return                                           */,
1858     uint                                                /* nplanes                                                      */,
1859     c_ulong*                                            /* pixels_return                                                */,
1860     uint                                                /* npixels                                                      */
1861 );
1862 
1863 extern Status XAllocColorPlanes(
1864     Display*                                            /* display                                                      */,
1865     Colormap                                            /* colormap                                                     */,
1866     Bool                                                /* contig                                                       */,
1867     c_ulong*                                            /* pixels_return                                                */,
1868     int                                                 /* ncolors                                                      */,
1869     int                                                 /* nreds                                                        */,
1870     int                                                 /* ngreens                                                      */,
1871     int                                                 /* nblues                                                       */,
1872     c_ulong*                                            /* rmask_return                                                 */,
1873     c_ulong*                                            /* gmask_return                                                 */,
1874     c_ulong*                                            /* bmask_return                                                 */
1875 );
1876 
1877 extern Status XAllocNamedColor(
1878     Display*                                            /* display                                                      */,
1879     Colormap                                            /* colormap                                                     */,
1880     char*                                               /* color_name                                                   */,
1881     XColor*                                             /* screen_def_return                                            */,
1882     XColor*                                             /* exact_def_return                                             */
1883 );
1884 
1885 extern int XAllowEvents(
1886     Display*                                            /* display                                                      */,
1887     int                                                 /* event_mode                                                   */,
1888     Time                                                /* time                                                         */
1889 );
1890 
1891 extern int XAutoRepeatOff(
1892     Display*                                            /* display                                                      */
1893 );
1894 
1895 extern int XAutoRepeatOn(
1896     Display*                                            /* display                                                      */
1897 );
1898 
1899 extern int XBell(
1900     Display*                                            /* display                                                      */,
1901     int                                                 /* percent                                                      */
1902 );
1903 
1904 extern int XBitmapBitOrder(
1905     Display*                                            /* display                                                      */
1906 );
1907 
1908 extern int XBitmapPad(
1909     Display*                                            /* display                                                      */
1910 );
1911 
1912 extern int XBitmapUnit(
1913     Display*                                            /* display                                                      */
1914 );
1915 
1916 extern int XCellsOfScreen(
1917     Screen*                                             /* screen                                                       */
1918 );
1919 
1920 extern int XChangeActivePointerGrab(
1921     Display*                                            /* display                                                      */,
1922     uint                                                /* event_mask                                                   */,
1923     Cursor                                              /* cursor                                                       */,
1924     Time                                                /* time                                                         */
1925 );
1926 
1927 extern int XChangeGC(
1928     Display*                                            /* display                                                      */,
1929     GC                                                  /* gc                                                           */,
1930     c_ulong                                             /* valuemask                                                    */,
1931     XGCValues*                                          /* values                                                       */
1932 );
1933 
1934 extern int XChangeKeyboardControl(
1935     Display*                                            /* display                                                      */,
1936     c_ulong                                             /* value_mask                                                   */,
1937     XKeyboardControl*                                   /* values                                                       */
1938 );
1939 
1940 extern int XChangeKeyboardMapping(
1941     Display*                                            /* display                                                      */,
1942     int                                                 /* first_keycode                                                */,
1943     int                                                 /* keysyms_per_keycode                                          */,
1944     KeySym*                                             /* keysyms                                                      */,
1945     int                                                 /* num_codes                                                    */
1946 );
1947 
1948 extern int XChangePointerControl(
1949     Display*                                            /* display                                                      */,
1950     Bool                                                /* do_accel                                                     */,
1951     Bool                                                /* do_threshold                                                 */,
1952     int                                                 /* accel_numerator                                              */,
1953     int                                                 /* accel_denominator                                            */,
1954     int                                                 /* threshold                                                    */
1955 );
1956 
1957 extern int XChangeProperty(
1958     Display*                                            /* display                                                      */,
1959     Window                                              /* w                                                            */,
1960     Atom                                                /* property                                                     */,
1961     Atom                                                /* type                                                         */,
1962     int                                                 /* format                                                       */,
1963     int                                                 /* mode                                                         */,
1964     ubyte*                                              /* data                                                         */,
1965     int                                                 /* nelements                                                    */
1966 );
1967 
1968 extern int XChangeSaveSet(
1969     Display*                                            /* display                                                      */,
1970     Window                                              /* w                                                            */,
1971     int                                                 /* change_mode                                                  */
1972 );
1973 
1974 extern int XChangeWindowAttributes(
1975     Display*                                            /* display                                                      */,
1976     Window                                              /* w                                                            */,
1977     uint                                                /* valuemask                                                    */,
1978     XSetWindowAttributes*                               /* attributes                                                   */
1979 );
1980 
1981 extern Bool XCheckIfEvent(
1982     Display*                                            /* display                                                      */,
1983     XEvent*                                             /* event_return                                                 */,
1984     Bool function(
1985         Display*                                        /* display                                                      */,
1986         XEvent*                                         /* event                                                        */,
1987         XPointer                                        /* arg                                                          */
1988     )                                                   /* predicate                                                    */,
1989     XPointer                                            /* arg                                                          */
1990 );
1991 
1992 extern Bool XCheckMaskEvent(
1993     Display*                                            /* display                                                      */,
1994     c_long                                              /* event_mask                                                   */,
1995     XEvent*                                             /* event_return                                                 */
1996 );
1997 
1998 extern Bool XCheckTypedEvent(
1999     Display*                                            /* display                                                      */,
2000     int                                                 /* event_type                                                   */,
2001     XEvent*                                             /* event_return                                                 */
2002 );
2003 
2004 extern Bool XCheckTypedWindowEvent(
2005     Display*                                            /* display                                                      */,
2006     Window                                              /* w                                                            */,
2007     int                                                 /* event_type                                                   */,
2008     XEvent*                                             /* event_return                                                 */
2009 );
2010 
2011 extern Bool XCheckWindowEvent(
2012     Display*                                            /* display                                                      */,
2013     Window                                              /* w                                                            */,
2014     c_long                                              /* event_mask                                                   */,
2015     XEvent*                                             /* event_return                                                 */
2016 );
2017 
2018 extern int XCirculateSubwindows(
2019     Display*                                            /* display                                                      */,
2020     Window                                              /* w                                                            */,
2021     int                                                 /* direction                                                    */
2022 );
2023 
2024 extern int XCirculateSubwindowsDown(
2025     Display*                                            /* display                                                      */,
2026     Window                                              /* w                                                            */
2027 );
2028 
2029 extern int XCirculateSubwindowsUp(
2030     Display*                                            /* display                                                      */,
2031     Window                                              /* w                                                            */
2032 );
2033 
2034 extern int XClearArea(
2035     Display*                                            /* display                                                      */,
2036     Window                                              /* w                                                            */,
2037     int                                                 /* x                                                            */,
2038     int                                                 /* y                                                            */,
2039     uint                                                /* width                                                        */,
2040     uint                                                /* height                                                       */,
2041     Bool                                                /* exposures                                                    */
2042 );
2043 
2044 extern int XClearWindow(
2045     Display*                                            /* display                                                      */,
2046     Window                                              /* w                                                            */
2047 );
2048 
2049 extern int XCloseDisplay(
2050     Display*                                            /* display                                                      */
2051 );
2052 
2053 extern int XConfigureWindow(
2054     Display*                                            /* display                                                      */,
2055     Window                                              /* w                                                            */,
2056     c_ulong                                             /* value_mask                                                   */,
2057     XWindowChanges*                                     /* values                                                       */
2058 );
2059 
2060 extern int XConnectionNumber(
2061     Display*                                            /* display                                                      */
2062 );
2063 
2064 extern int XConvertSelection(
2065     Display*                                            /* display                                                      */,
2066     Atom                                                /* selection                                                    */,
2067     Atom                                                /* target                                                       */,
2068     Atom                                                /* property                                                     */,
2069     Window                                              /* requestor                                                    */,
2070     Time                                                /* time                                                         */
2071 );
2072 
2073 extern int XCopyArea(
2074     Display*                                            /* display                                                      */,
2075     Drawable                                            /* src                                                          */,
2076     Drawable                                            /* dest                                                         */,
2077     GC                                                  /* gc                                                           */,
2078     int                                                 /* src_x                                                        */,
2079     int                                                 /* src_y                                                        */,
2080     uint                                                /* width                                                        */,
2081     uint                                                /* height                                                       */,
2082     int                                                 /* dest_x                                                       */,
2083     int                                                 /* dest_y                                                       */
2084 );
2085 
2086 extern int XCopyGC(
2087     Display*                                            /* display                                                      */,
2088     GC                                                  /* src                                                          */,
2089     uint                                                /* valuemask                                                    */,
2090     GC                                                  /* dest                                                         */
2091 );
2092 
2093 extern int XCopyPlane(
2094     Display*                                            /* display                                                      */,
2095     Drawable                                            /* src                                                          */,
2096     Drawable                                            /* dest                                                         */,
2097     GC                                                  /* gc                                                           */,
2098     int                                                 /* src_x                                                        */,
2099     int                                                 /* src_y                                                        */,
2100     uint                                                /* width                                                        */,
2101     uint                                                /* height                                                       */,
2102     int                                                 /* dest_x                                                       */,
2103     int                                                 /* dest_y                                                       */,
2104     c_ulong                                             /* plane                                                        */
2105 );
2106 
2107 extern int XDefaultDepth(
2108     Display*                                            /* display                                                      */,
2109     int                                                 /* screen_number                                                */
2110 );
2111 
2112 extern int XDefaultDepthOfScreen(
2113     Screen*                                             /* screen                                                       */
2114 );
2115 
2116 extern int XDefaultScreen(
2117     Display*                                            /* display                                                      */
2118 );
2119 
2120 extern int XDefineCursor(
2121     Display*                                            /* display                                                      */,
2122     Window                                              /* w                                                            */,
2123     Cursor                                              /* cursor                                                       */
2124 );
2125 
2126 extern int XDeleteProperty(
2127     Display*                                            /* display                                                      */,
2128     Window                                              /* w                                                            */,
2129     Atom                                                /* property                                                     */
2130 );
2131 
2132 extern int XDestroyWindow(
2133     Display*                                            /* display                                                      */,
2134     Window                                              /* w                                                            */
2135 );
2136 
2137 extern int XDestroySubwindows(
2138     Display*                                            /* display                                                      */,
2139     Window                                              /* w                                                            */
2140 );
2141 
2142 extern int XDoesBackingStore(
2143     Screen*                                             /* screen                                                       */
2144 );
2145 
2146 extern Bool XDoesSaveUnders(
2147     Screen*                                             /* screen                                                       */
2148 );
2149 
2150 extern int XDisableAccessControl(
2151     Display*                                            /* display                                                      */
2152 );
2153 
2154 
2155 extern int XDisplayCells(
2156     Display*                                            /* display                                                      */,
2157     int                                                 /* screen_number                                                */
2158 );
2159 
2160 extern int XDisplayHeight(
2161     Display*                                            /* display                                                      */,
2162     int                                                 /* screen_number                                                */
2163 );
2164 
2165 extern int XDisplayHeightMM(
2166     Display*                                            /* display                                                      */,
2167     int                                                 /* screen_number                                                */
2168 );
2169 
2170 extern int XDisplayKeycodes(
2171     Display*                                            /* display                                                      */,
2172     int*                                                /* min_keycodes_return                                          */,
2173     int*                                                /* max_keycodes_return                                          */
2174 );
2175 
2176 extern int XDisplayPlanes(
2177     Display*                                            /* display                                                      */,
2178     int                                                 /* screen_number                                                */
2179 );
2180 
2181 extern int XDisplayWidth(
2182     Display*                                            /* display                                                      */,
2183     int                                                 /* screen_number                                                */
2184 );
2185 
2186 extern int XDisplayWidthMM(
2187     Display*                                            /* display                                                      */,
2188     int                                                 /* screen_number                                                */
2189 );
2190 
2191 extern int XDrawArc(
2192     Display*                                            /* display                                                      */,
2193     Drawable                                            /* d                                                            */,
2194     GC                                                  /* gc                                                           */,
2195     int                                                 /* x                                                            */,
2196     int                                                 /* y                                                            */,
2197     uint                                                /* width                                                        */,
2198     uint                                                /* height                                                       */,
2199     int                                                 /* angle1                                                       */,
2200     int                                                 /* angle2                                                       */
2201 );
2202 
2203 extern int XDrawArcs(
2204     Display*                                            /* display                                                      */,
2205     Drawable                                            /* d                                                            */,
2206     GC                                                  /* gc                                                           */,
2207     XArc*                                               /* arcs                                                         */,
2208     int                                                 /* narcs                                                        */
2209 );
2210 
2211 extern int XDrawImageString(
2212     Display*                                            /* display                                                      */,
2213     Drawable                                            /* d                                                            */,
2214     GC                                                  /* gc                                                           */,
2215     int                                                 /* x                                                            */,
2216     int                                                 /* y                                                            */,
2217     char*                                               /* string                                                       */,
2218     int                                                 /* length                                                       */
2219 );
2220 
2221 extern int XDrawImageString16(
2222     Display*                                            /* display                                                      */,
2223     Drawable                                            /* d                                                            */,
2224     GC                                                  /* gc                                                           */,
2225     int                                                 /* x                                                            */,
2226     int                                                 /* y                                                            */,
2227     XChar2b*                                            /* string                                                       */,
2228     int                                                 /* length                                                       */
2229 );
2230 
2231 extern int XDrawLine(
2232     Display*                                            /* display                                                      */,
2233     Drawable                                            /* d                                                            */,
2234     GC                                                  /* gc                                                           */,
2235     int                                                 /* x1                                                           */,
2236     int                                                 /* y1                                                           */,
2237     int                                                 /* x2                                                           */,
2238     int                                                 /* y2                                                           */
2239 );
2240 
2241 extern int XDrawLines(
2242     Display*                                            /* display                                                      */,
2243     Drawable                                            /* d                                                            */,
2244     GC                                                  /* gc                                                           */,
2245     XPoint*                                             /* points                                                       */,
2246     int                                                 /* npoints                                                      */,
2247     int                                                 /* mode                                                         */
2248 );
2249 
2250 extern int XDrawPoint(
2251     Display*                                            /* display                                                      */,
2252     Drawable                                            /* d                                                            */,
2253     GC                                                  /* gc                                                           */,
2254     int                                                 /* x                                                            */,
2255     int                                                 /* y                                                            */
2256 );
2257 
2258 extern int XDrawPoints(
2259     Display*                                            /* display                                                      */,
2260     Drawable                                            /* d                                                            */,
2261     GC                                                  /* gc                                                           */,
2262     XPoint*                                             /* points                                                       */,
2263     int                                                 /* npoints                                                      */,
2264     int                                                 /* mode                                                         */
2265 );
2266 
2267 extern int XDrawRectangle(
2268     Display*                                            /* display                                                      */,
2269     Drawable                                            /* d                                                            */,
2270     GC                                                  /* gc                                                           */,
2271     int                                                 /* x                                                            */,
2272     int                                                 /* y                                                            */,
2273     uint                                                /* width                                                        */,
2274     uint                                                /* height                                                       */
2275 );
2276 
2277 extern int XDrawRectangles(
2278     Display*                                            /* display                                                      */,
2279     Drawable                                            /* d                                                            */,
2280     GC                                                  /* gc                                                           */,
2281     XRectangle*                                         /* rectangles                                                   */,
2282     int                                                 /* nrectangles                                                  */
2283 );
2284 
2285 extern int XDrawSegments(
2286     Display*                                            /* display                                                      */,
2287     Drawable                                            /* d                                                            */,
2288     GC                                                  /* gc                                                           */,
2289     XSegment*                                           /* segments                                                     */,
2290     int                                                 /* nsegments                                                    */
2291 );
2292 
2293 extern int XDrawString(
2294     Display*                                            /* display                                                      */,
2295     Drawable                                            /* d                                                            */,
2296     GC                                                  /* gc                                                           */,
2297     int                                                 /* x                                                            */,
2298     int                                                 /* y                                                            */,
2299     char*                                               /* string                                                       */,
2300     int                                                 /* length                                                       */
2301 );
2302 
2303 extern int XDrawString16(
2304     Display*                                            /* display                                                      */,
2305     Drawable                                            /* d                                                            */,
2306     GC                                                  /* gc                                                           */,
2307     int                                                 /* x                                                            */,
2308     int                                                 /* y                                                            */,
2309     XChar2b*                                            /* string                                                       */,
2310     int                                                 /* length                                                       */
2311 );
2312 
2313 extern int XDrawText(
2314     Display*                                            /* display                                                      */,
2315     Drawable                                            /* d                                                            */,
2316     GC                                                  /* gc                                                           */,
2317     int                                                 /* x                                                            */,
2318     int                                                 /* y                                                            */,
2319     XTextItem*                                          /* items                                                        */,
2320     int                                                 /* nitems                                                       */
2321 );
2322 
2323 extern int XDrawText16(
2324     Display*                                            /* display                                                      */,
2325     Drawable                                            /* d                                                            */,
2326     GC                                                  /* gc                                                           */,
2327     int                                                 /* x                                                            */,
2328     int                                                 /* y                                                            */,
2329     XTextItem16*                                        /* items                                                        */,
2330     int                                                 /* nitems                                                       */
2331 );
2332 
2333 extern int XEnableAccessControl(
2334     Display*                                            /* display                                                      */
2335 );
2336 
2337 extern int XEventsQueued(
2338     Display*                                            /* display                                                      */,
2339     int                                                 /* mode                                                         */
2340 );
2341 
2342 extern Status XFetchName(
2343     Display*                                            /* display                                                      */,
2344     Window                                              /* w                                                            */,
2345     char**                                              /* window_name_return                                           */
2346 );
2347 
2348 extern int XFillArc(
2349     Display*                                            /* display                                                      */,
2350     Drawable                                            /* d                                                            */,
2351     GC                                                  /* gc                                                           */,
2352     int                                                 /* x                                                            */,
2353     int                                                 /* y                                                            */,
2354     uint                                                /* width                                                        */,
2355     uint                                                /* height                                                       */,
2356     int                                                 /* angle1                                                       */,
2357     int                                                 /* angle2                                                       */
2358 );
2359 
2360 extern int XFillArcs(
2361     Display*                                            /* display                                                      */,
2362     Drawable                                            /* d                                                            */,
2363     GC                                                  /* gc                                                           */,
2364     XArc*                                               /* arcs                                                         */,
2365     int                                                 /* narcs                                                        */
2366 );
2367 
2368 extern int XFillPolygon(
2369     Display*                                            /* display                                                      */,
2370     Drawable                                            /* d                                                            */,
2371     GC                                                  /* gc                                                           */,
2372     XPoint*                                             /* points                                                       */,
2373     int                                                 /* npoints                                                      */,
2374     int                                                 /* shape                                                        */,
2375     int                                                 /* mode                                                         */
2376 );
2377 
2378 extern int XFillRectangle(
2379     Display*                                            /* display                                                      */,
2380     Drawable                                            /* d                                                            */,
2381     GC                                                  /* gc                                                           */,
2382     int                                                 /* x                                                            */,
2383     int                                                 /* y                                                            */,
2384     uint                                                /* width                                                        */,
2385     uint                                                /* height                                                       */
2386 );
2387 
2388 extern int XFillRectangles(
2389     Display*                                            /* display                                                      */,
2390     Drawable                                            /* d                                                            */,
2391     GC                                                  /* gc                                                           */,
2392     XRectangle*                                         /* rectangles                                                   */,
2393     int                                                 /* nrectangles                                                  */
2394 );
2395 
2396 extern int XFlush(
2397     Display*                                            /* display                                                      */
2398 );
2399 
2400 extern int XForceScreenSaver(
2401     Display*                                            /* display                                                      */,
2402     int                                                 /* mode                                                         */
2403 );
2404 
2405 extern int XFree(
2406     void*                                               /* data                                                         */
2407 );
2408 
2409 extern int XFreeColormap(
2410     Display*                                            /* display                                                      */,
2411     Colormap                                            /* colormap                                                     */
2412 );
2413 
2414 extern int XFreeColors(
2415     Display*                                            /* display                                                      */,
2416     Colormap                                            /* colormap                                                     */,
2417     c_ulong*                                            /* pixels                                                       */,
2418     int                                                 /* npixels                                                      */,
2419     c_ulong                                             /* planes                                                       */
2420 );
2421 
2422 extern int XFreeCursor(
2423     Display*                                            /* display                                                      */,
2424     Cursor                                              /* cursor                                                       */
2425 );
2426 
2427 extern int XFreeExtensionList(
2428     char**                                              /* list                                                         */
2429 );
2430 
2431 extern int XFreeFont(
2432     Display*                                            /* display                                                      */,
2433     XFontStruct*                                        /* font_struct                                                  */
2434 );
2435 
2436 extern int XFreeFontInfo(
2437     char**                                              /* names                                                        */,
2438     XFontStruct*                                        /* free_info                                                    */,
2439     int                                                 /* actual_count                                                 */
2440 );
2441 
2442 extern int XFreeFontNames(
2443     char**                                              /* list                                                         */
2444 );
2445 
2446 extern int XFreeFontPath(
2447     char**                                              /* list                                                         */
2448 );
2449 
2450 extern int XFreeGC(
2451     Display*                                            /* display                                                      */,
2452     GC                                                  /* gc                                                           */
2453 );
2454 
2455 extern int XFreeModifiermap(
2456     XModifierKeymap*                                    /* modmap                                                       */
2457 );
2458 
2459 extern int XFreePixmap(
2460     Display*                                            /* display                                                      */,
2461     Pixmap                                              /* pixmap                                                       */
2462 );
2463 
2464 extern int XGeometry(
2465     Display*                                            /* display                                                      */,
2466     int                                                 /* screen                                                       */,
2467     char*                                               /* position                                                     */,
2468     char*                                               /* default_position                                             */,
2469     uint                                                /* bwidth                                                       */,
2470     uint                                                /* fwidth                                                       */,
2471     uint                                                /* fheight                                                      */,
2472     int                                                 /* xadder                                                       */,
2473     int                                                 /* yadder                                                       */,
2474     int*                                                /* x_return                                                     */,
2475     int*                                                /* y_return                                                     */,
2476     int*                                                /* width_return                                                 */,
2477     int*                                                /* height_return                                                */
2478 );
2479 
2480 extern int XGetErrorDatabaseText(
2481     Display*                                            /* display                                                      */,
2482     char*                                               /* name                                                         */,
2483     char*                                               /* message                                                      */,
2484     char*                                               /* default_string                                               */,
2485     char*                                               /* buffer_return                                                */,
2486     int                                                 /* length                                                       */
2487 );
2488 
2489 extern int XGetErrorText(
2490     Display*                                            /* display                                                      */,
2491     int                                                 /* code                                                         */,
2492     char*                                               /* buffer_return                                                */,
2493     int                                                 /* length                                                       */
2494 );
2495 
2496 extern Bool XGetFontProperty(
2497     XFontStruct*                                        /* font_struct                                                  */,
2498     Atom                                                /* atom                                                         */,
2499     c_ulong*                                            /* value_return                                                 */
2500 );
2501 
2502 extern Status XGetGCValues(
2503     Display*                                            /* display                                                      */,
2504     GC                                                  /* gc                                                           */,
2505     c_ulong                                             /* valuemask                                                    */,
2506     XGCValues*                                          /* values_return                                                */
2507 );
2508 
2509 extern Status XGetGeometry(
2510     Display*                                            /* display                                                      */,
2511     Drawable                                            /* d                                                            */,
2512     Window*                                             /* root_return                                                  */,
2513     int*                                                /* x_return                                                     */,
2514     int*                                                /* y_return                                                     */,
2515     uint*                                               /* width_return                                                 */,
2516     uint*                                               /* height_return                                                */,
2517     uint*                                               /* border_width_return                                          */,
2518     uint*                                               /* depth_return                                                 */
2519 );
2520 
2521 extern Status XGetIconName(
2522     Display*                                            /* display                                                      */,
2523     Window                                              /* w                                                            */,
2524     char**                                              /* icon_name_return                                             */
2525 );
2526 
2527 extern int XGetInputFocus(
2528     Display*                                            /* display                                                      */,
2529     Window*                                             /* focus_return                                                 */,
2530     int*                                                /* revert_to_return                                             */
2531 );
2532 
2533 extern int XGetKeyboardControl(
2534     Display*                                            /* display                                                      */,
2535     XKeyboardState*                                     /* values_return                                                */
2536 );
2537 
2538 extern int XGetPointerControl(
2539     Display*                                            /* display                                                      */,
2540     int*                                                /* accel_numerator_return                                       */,
2541     int*                                                /* accel_denominator_return                                     */,
2542     int*                                                /* threshold_return                                             */
2543 );
2544 
2545 extern int XGetPointerMapping(
2546     Display*                                            /* display                                                      */,
2547     ubyte*                                          /* map_return                                                   */,
2548     int                                                 /* nmap                                                         */
2549 );
2550 
2551 extern int XGetScreenSaver(
2552     Display*                                            /* display                                                      */,
2553     int*                                                /* timeout_return                                               */,
2554     int*                                                /* interval_return                                              */,
2555     int*                                                /* prefer_blanking_return                                       */,
2556     int*                                                /* allow_exposures_return                                       */
2557 );
2558 
2559 extern Status XGetTransientForHint(
2560     Display*                                            /* display                                                      */,
2561     Window                                              /* w                                                            */,
2562     Window*                                             /* prop_window_return                                           */
2563 );
2564 
2565 extern int XGetWindowProperty(
2566     Display*                                            /* display                                                      */,
2567     Window                                              /* w                                                            */,
2568     Atom                                                /* property                                                     */,
2569     c_long                                              /* c_long_offset                                                  */,
2570     c_long                                              /* c_long_length                                                  */,
2571     Bool                                                /* delete                                                       */,
2572     Atom                                                /* req_type                                                     */,
2573     Atom*                                               /* actual_type_return                                           */,
2574     int*                                                /* actual_format_return                                         */,
2575     c_ulong*                                            /* nitems_return                                                */,
2576     c_ulong*                                            /* chars_after_return                                           */,
2577     ubyte**                                             /* prop_return                                                  */
2578 );
2579 
2580 extern Status XGetWindowAttributes(
2581     Display*                                            /* display                                                      */,
2582     Window                                              /* w                                                            */,
2583     XWindowAttributes*                                  /* window_attributes_return                                     */
2584 );
2585 
2586 extern int XGrabButton(
2587     Display*                                            /* display                                                      */,
2588     uint                                                /* button                                                       */,
2589     uint                                                /* modifiers                                                    */,
2590     Window                                              /* grab_window                                                  */,
2591     Bool                                                /* owner_events                                                 */,
2592     uint                                                /* event_mask                                                   */,
2593     int                                                 /* pointer_mode                                                 */,
2594     int                                                 /* keyboard_mode                                                */,
2595     Window                                              /* confine_to                                                   */,
2596     Cursor                                              /* cursor                                                       */
2597 );
2598 
2599 extern int XGrabKey(
2600     Display*                                            /* display                                                      */,
2601     int                                                 /* keycode                                                      */,
2602     uint                                                /* modifiers                                                    */,
2603     Window                                              /* grab_window                                                  */,
2604     Bool                                                /* owner_events                                                 */,
2605     int                                                 /* pointer_mode                                                 */,
2606     int                                                 /* keyboard_mode                                                */
2607 );
2608 
2609 extern int XGrabKeyboard(
2610     Display*                                            /* display                                                      */,
2611     Window                                              /* grab_window                                                  */,
2612     Bool                                                /* owner_events                                                 */,
2613     int                                                 /* pointer_mode                                                 */,
2614     int                                                 /* keyboard_mode                                                */,
2615     Time                                                /* time                                                         */
2616 );
2617 
2618 extern int XGrabPointer(
2619     Display*                                            /* display                                                      */,
2620     Window                                              /* grab_window                                                  */,
2621     Bool                                                /* owner_events                                                 */,
2622     uint                                                /* event_mask                                                   */,
2623     int                                                 /* pointer_mode                                                 */,
2624     int                                                 /* keyboard_mode                                                */,
2625     Window                                              /* confine_to                                                   */,
2626     Cursor                                              /* cursor                                                       */,
2627     Time                                                /* time                                                         */
2628 );
2629 
2630 extern int XGrabServer(
2631     Display*                                            /* display                                                      */
2632 );
2633 
2634 extern int XHeightMMOfScreen(
2635     Screen*                                             /* screen                                                       */
2636 );
2637 
2638 extern int XHeightOfScreen(
2639     Screen*                                             /* screen                                                       */
2640 );
2641 
2642 extern int XIfEvent(
2643     Display*                                            /* display                                                      */,
2644     XEvent*                                             /* event_return                                                 */,
2645     Bool function(
2646         Display*                                        /* display                                                      */,
2647         XEvent*                                         /* event                                                        */,
2648         XPointer                                        /* arg                                                          */
2649     )                                                   /* predicate                                                    */,
2650     XPointer                                            /* arg                                                          */
2651 );
2652 
2653 extern int XImagecharOrder(
2654     Display*                                            /* display                                                      */
2655 );
2656 
2657 extern int XInstallColormap(
2658     Display*                                            /* display                                                      */,
2659     Colormap                                            /* colormap                                                     */
2660 );
2661 
2662 extern KeyCode XKeysymToKeycode(
2663     Display*                                            /* display                                                      */,
2664     KeySym                                              /* keysym                                                       */
2665 );
2666 
2667 extern int XKillClient(
2668     Display*                                            /* display                                                      */,
2669     XID                                                 /* resource                                                     */
2670 );
2671 
2672 extern Status XLookupColor(
2673     Display*                                            /* display                                                      */,
2674     Colormap                                            /* colormap                                                     */,
2675     char*                                               /* color_name                                                   */,
2676     XColor*                                             /* exact_def_return                                             */,
2677     XColor*                                             /* screen_def_return                                            */
2678 );
2679 
2680 extern int XLowerWindow(
2681     Display*                                            /* display                                                      */,
2682     Window                                              /* w                                                            */
2683 );
2684 
2685 extern int XMapRaised(
2686     Display*                                            /* display                                                      */,
2687     Window                                              /* w                                                            */
2688 );
2689 
2690 extern int XMapSubwindows(
2691     Display*                                            /* display                                                      */,
2692     Window                                              /* w                                                            */
2693 );
2694 
2695 extern int XMapWindow(
2696     Display*                                            /* display                                                      */,
2697     Window                                              /* w                                                            */
2698 );
2699 
2700 extern int XMaskEvent(
2701     Display*                                            /* display                                                      */,
2702     c_long                                              /* event_mask                                                   */,
2703     XEvent*                                             /* event_return                                                 */
2704 );
2705 
2706 extern int XMaxCmapsOfScreen(
2707     Screen*                                             /* screen                                                       */
2708 );
2709 
2710 extern int XMinCmapsOfScreen(
2711     Screen*                                             /* screen                                                       */
2712 );
2713 
2714 extern int XMoveResizeWindow(
2715     Display*                                            /* display                                                      */,
2716     Window                                              /* w                                                            */,
2717     int                                                 /* x                                                            */,
2718     int                                                 /* y                                                            */,
2719     uint                                                /* width                                                        */,
2720     uint                                                /* height                                                       */
2721 );
2722 
2723 extern int XMoveWindow(
2724     Display*                                            /* display                                                      */,
2725     Window                                              /* w                                                            */,
2726     int                                                 /* x                                                            */,
2727     int                                                 /* y                                                            */
2728 );
2729 
2730 extern int XNextEvent(
2731     Display*                                            /* display                                                      */,
2732     XEvent*                                             /* event_return                                                 */
2733 );
2734 
2735 extern int XNoOp(
2736     Display*                                            /* display                                                      */
2737 );
2738 
2739 extern Status XParseColor(
2740     Display*                                            /* display                                                      */,
2741     Colormap                                            /* colormap                                                     */,
2742     char*                                               /* spec                                                         */,
2743     XColor*                                             /* exact_def_return                                             */
2744 );
2745 
2746 extern int XParseGeometry(
2747     char*                                               /* parsestring                                                  */,
2748     int*                                                /* x_return                                                     */,
2749     int*                                                /* y_return                                                     */,
2750     uint*                                               /* width_return                                                 */,
2751     uint*                                               /* height_return                                                */
2752 );
2753 
2754 extern int XPeekEvent(
2755     Display*                                            /* display                                                      */,
2756     XEvent*                                             /* event_return                                                 */
2757 );
2758 
2759 extern int XPeekIfEvent(
2760     Display*                                            /* display                                                      */,
2761     XEvent*                                             /* event_return                                                 */,
2762     Bool function(
2763         Display*                                        /* display                                                      */,
2764         XEvent*                                         /* event                                                        */,
2765         XPointer                                        /* arg                                                          */
2766     )                                                   /* predicate                                                    */,
2767     XPointer                                            /* arg                                                          */
2768 );
2769 
2770 extern int XPending(
2771     Display*                                            /* display                                                      */
2772 );
2773 
2774 extern int XPlanesOfScreen(
2775     Screen*                                             /* screen                                                       */
2776 );
2777 
2778 extern int XProtocolRevision(
2779     Display*                                            /* display                                                      */
2780 );
2781 
2782 extern int XProtocolVersion(
2783     Display*                                            /* display                                                      */
2784 );
2785 
2786 
2787 extern int XPutBackEvent(
2788     Display*                                            /* display                                                      */,
2789     XEvent*                                             /* event                                                        */
2790 );
2791 
2792 extern int XPutImage(
2793     Display*                                            /* display                                                      */,
2794     Drawable                                            /* d                                                            */,
2795     GC                                                  /* gc                                                           */,
2796     XImage*                                             /* image                                                        */,
2797     int                                                 /* src_x                                                        */,
2798     int                                                 /* src_y                                                        */,
2799     int                                                 /* dest_x                                                       */,
2800     int                                                 /* dest_y                                                       */,
2801     uint                                                /* width                                                        */,
2802     uint                                                /* height                                                       */
2803 );
2804 
2805 extern int XQLength(
2806     Display*                                            /* display                                                      */
2807 );
2808 
2809 extern Status XQueryBestCursor(
2810     Display*                                            /* display                                                      */,
2811     Drawable                                            /* d                                                            */,
2812     uint                                                /* width                                                        */,
2813     uint                                                /* height                                                       */,
2814     uint*                                               /* width_return                                                 */,
2815     uint*                                               /* height_return                                                */
2816 );
2817 
2818 extern Status XQueryBestSize(
2819     Display*                                            /* display                                                      */,
2820     int                                                 /* class                                                        */,
2821     Drawable                                            /* which_screen                                                 */,
2822     uint                                                /* width                                                        */,
2823     uint                                                /* height                                                       */,
2824     uint*                                               /* width_return                                                 */,
2825     uint*                                               /* height_return                                                */
2826 );
2827 
2828 extern Status XQueryBestStipple(
2829     Display*                                            /* display                                                      */,
2830     Drawable                                            /* which_screen                                                 */,
2831     uint                                                /* width                                                        */,
2832     uint                                                /* height                                                       */,
2833     uint*                                               /* width_return                                                 */,
2834     uint*                                               /* height_return                                                */
2835 );
2836 
2837 extern Status XQueryBestTile(
2838     Display*                                            /* display                                                      */,
2839     Drawable                                            /* which_screen                                                 */,
2840     uint                                                /* width                                                        */,
2841     uint                                                /* height                                                       */,
2842     uint*                                               /* width_return                                                 */,
2843     uint*                                               /* height_return                                                */
2844 );
2845 
2846 extern int XQueryColor(
2847     Display*                                            /* display                                                      */,
2848     Colormap                                            /* colormap                                                     */,
2849     XColor*                                             /* def_in_out                                                   */
2850 );
2851 
2852 extern int XQueryColors(
2853     Display*                                            /* display                                                      */,
2854     Colormap                                            /* colormap                                                     */,
2855     XColor*                                             /* defs_in_out                                                  */,
2856     int                                                 /* ncolors                                                      */
2857 );
2858 
2859 extern Bool XQueryExtension(
2860     Display*                                            /* display                                                      */,
2861     char*                                               /* name                                                         */,
2862     int*                                                /* major_opcode_return                                          */,
2863     int*                                                /* first_event_return                                           */,
2864     int*                                                /* first_error_return                                           */
2865 );
2866 
2867 extern int XQueryKeymap(
2868     Display*                                            /* display                                                      */,
2869     char [32]                                           /* keys_return                                                  */
2870 );
2871 
2872 extern Bool XQueryPointer(
2873     Display*                                            /* display                                                      */,
2874     Window                                              /* w                                                            */,
2875     Window*                                             /* root_return                                                  */,
2876     Window*                                             /* child_return                                                 */,
2877     int*                                                /* root_x_return                                                */,
2878     int*                                                /* root_y_return                                                */,
2879     int*                                                /* win_x_return                                                 */,
2880     int*                                                /* win_y_return                                                 */,
2881     uint*                                               /* mask_return                                                  */
2882 );
2883 
2884 extern int XQueryTextExtents(
2885     Display*                                            /* display                                                      */,
2886     XID                                                 /* font_ID                                                      */,
2887     char*                                               /* string                                                       */,
2888     int                                                 /* nchars                                                       */,
2889     int*                                                /* direction_return                                             */,
2890     int*                                                /* font_ascent_return                                           */,
2891     int*                                                /* font_descent_return                                          */,
2892     XCharStruct*                                        /* overall_return                                               */
2893 );
2894 
2895 extern int XQueryTextExtents16(
2896     Display*                                            /* display                                                      */,
2897     XID                                                 /* font_ID                                                      */,
2898     XChar2b*                                            /* string                                                       */,
2899     int                                                 /* nchars                                                       */,
2900     int*                                                /* direction_return                                             */,
2901     int*                                                /* font_ascent_return                                           */,
2902     int*                                                /* font_descent_return                                          */,
2903     XCharStruct*                                        /* overall_return                                               */
2904 );
2905 
2906 extern Status XQueryTree(
2907     Display*                                            /* display                                                      */,
2908     Window                                              /* w                                                            */,
2909     Window*                                             /* root_return                                                  */,
2910     Window*                                             /* parent_return                                                */,
2911     Window**                                            /* children_return                                              */,
2912     uint*                                               /* nchildren_return                                             */
2913 );
2914 
2915 extern int XRaiseWindow(
2916     Display*                                            /* display                                                      */,
2917     Window                                              /* w                                                            */
2918 );
2919 
2920 extern int XReadBitmapFile(
2921     Display*                                            /* display                                                      */,
2922     Drawable                                            /* d                                                            */,
2923     ubyte*                                              /* filename                                                     */,
2924     uint*                                               /* width_return                                                 */,
2925     uint*                                               /* height_return                                                */,
2926     Pixmap*                                             /* bitmap_return                                                */,
2927     int*                                                /* x_hot_return                                                 */,
2928     int*                                                /* y_hot_return                                                 */
2929 );
2930 
2931 extern int XReadBitmapFileData(
2932     char*                                               /* filename                                                     */,
2933     uint*                                               /* width_return                                                 */,
2934     uint*                                               /* height_return                                                */,
2935     ubyte**                                             /* data_return                                                  */,
2936     int*                                                /* x_hot_return                                                 */,
2937     int*                                                /* y_hot_return                                                 */
2938 );
2939 
2940 extern int XRebindKeysym(
2941     Display*                                            /* display                                                      */,
2942     KeySym                                              /* keysym                                                       */,
2943     KeySym*                                             /* list                                                         */,
2944     int                                                 /* mod_count                                                    */,
2945     ubyte*                                              /* string                                                       */,
2946     int                                                 /* chars_string                                                 */
2947 );
2948 
2949 extern int XRecolorCursor(
2950     Display*                                            /* display                                                      */,
2951     Cursor                                              /* cursor                                                       */,
2952     XColor*                                             /* foreground_color                                             */,
2953     XColor*                                             /* background_color                                             */
2954 );
2955 
2956 extern int XRefreshKeyboardMapping(
2957     XMappingEvent*                                      /* event_map                                                    */
2958 );
2959 
2960 extern int XRemoveFromSaveSet(
2961     Display*                                            /* display                                                      */,
2962     Window                                              /* w                                                            */
2963 );
2964 
2965 extern int XRemoveHost(
2966     Display*                                            /* display                                                      */,
2967     XHostAddress*                                       /* host                                                         */
2968 );
2969 
2970 extern int XRemoveHosts(
2971     Display*                                            /* display                                                      */,
2972     XHostAddress*                                       /* hosts                                                        */,
2973     int                                                 /* num_hosts                                                    */
2974 );
2975 
2976 extern int XReparentWindow(
2977     Display*                                            /* display                                                      */,
2978     Window                                              /* w                                                            */,
2979     Window                                              /* parent                                                       */,
2980     int                                                 /* x                                                            */,
2981     int                                                 /* y                                                            */
2982 );
2983 
2984 extern int XResetScreenSaver(
2985     Display*                                            /* display                                                      */
2986 );
2987 
2988 extern int XResizeWindow(
2989     Display*                                            /* display                                                      */,
2990     Window                                              /* w                                                            */,
2991     uint                                                /* width                                                        */,
2992     uint                                                /* height                                                       */
2993 );
2994 
2995 extern int XRestackWindows(
2996     Display*                                            /* display                                                      */,
2997     Window*                                             /* windows                                                      */,
2998     int                                                 /* nwindows                                                     */
2999 );
3000 
3001 extern int XRotateBuffers(
3002     Display*                                            /* display                                                      */,
3003     int                                                 /* rotate                                                       */
3004 );
3005 
3006 extern int XRotateWindowProperties(
3007     Display*                                            /* display                                                      */,
3008     Window                                              /* w                                                            */,
3009     Atom*                                               /* properties                                                   */,
3010     int                                                 /* num_prop                                                     */,
3011     int                                                 /* npositions                                                   */
3012 );
3013 
3014 extern int XScreenCount(
3015     Display*                                            /* display                                                      */
3016 );
3017 
3018 extern int XSelectInput(
3019     Display*                                            /* display                                                      */,
3020     Window                                              /* w                                                            */,
3021     c_long                                              /* event_mask                                                   */
3022 );
3023 
3024 extern Status XSendEvent(
3025     Display*                                            /* display                                                      */,
3026     Window                                              /* w                                                            */,
3027     Bool                                                /* propagate                                                    */,
3028     c_long                                              /* event_mask                                                   */,
3029     XEvent*                                             /* event_send                                                   */
3030 );
3031 
3032 extern int XSetAccessControl(
3033     Display*                                            /* display                                                      */,
3034     int                                                 /* mode                                                         */
3035 );
3036 
3037 extern int XSetArcMode(
3038     Display*                                            /* display                                                      */,
3039     GC                                                  /* gc                                                           */,
3040     int                                                 /* arc_mode                                                     */
3041 );
3042 
3043 extern int XSetBackground(
3044     Display*                                            /* display                                                      */,
3045     GC                                                  /* gc                                                           */,
3046     c_ulong                                             /* background                                                   */
3047 );
3048 
3049 extern int XSetClipMask(
3050     Display*                                            /* display                                                      */,
3051     GC                                                  /* gc                                                           */,
3052     Pixmap                                              /* pixmap                                                       */
3053 );
3054 
3055 extern int XSetClipOrigin(
3056     Display*                                            /* display                                                      */,
3057     GC                                                  /* gc                                                           */,
3058     int                                                 /* clip_x_origin                                                */,
3059     int                                                 /* clip_y_origin                                                */
3060 );
3061 
3062 extern int XSetClipRectangles(
3063     Display*                                            /* display                                                      */,
3064     GC                                                  /* gc                                                           */,
3065     int                                                 /* clip_x_origin                                                */,
3066     int                                                 /* clip_y_origin                                                */,
3067     XRectangle*                                         /* rectangles                                                   */,
3068     int                                                 /* n                                                            */,
3069     int                                                 /* ordering                                                     */
3070 );
3071 
3072 extern int XSetCloseDownMode(
3073     Display*                                            /* display                                                      */,
3074     int                                                 /* close_mode                                                   */
3075 );
3076 
3077 extern int XSetCommand(
3078     Display*                                            /* display                                                      */,
3079     Window                                              /* w                                                            */,
3080     char**                                              /* argv                                                         */,
3081     int                                                 /* argc                                                         */
3082 );
3083 
3084 extern int XSetDashes(
3085     Display*                                            /* display                                                      */,
3086     GC                                                  /* gc                                                           */,
3087     int                                                 /* dash_offset                                                  */,
3088     char*                                               /* dash_list                                                    */,
3089     int                                                 /* n                                                            */
3090 );
3091 
3092 extern int XSetFillRule(
3093     Display*                                            /* display                                                      */,
3094     GC                                                  /* gc                                                           */,
3095     int                                                 /* fill_rule                                                    */
3096 );
3097 
3098 extern int XSetFillStyle(
3099     Display*                                            /* display                                                      */,
3100     GC                                                  /* gc                                                           */,
3101     int                                                 /* fill_style                                                   */
3102 );
3103 
3104 extern int XSetFont(
3105     Display*                                            /* display                                                      */,
3106     GC                                                  /* gc                                                           */,
3107     Font                                                /* font                                                         */
3108 );
3109 
3110 extern int XSetFontPath(
3111     Display*                                            /* display                                                      */,
3112     char**                                              /* directories                                                  */,
3113     int                                                 /* ndirs                                                        */
3114 );
3115 
3116 extern int XSetForeground(
3117     Display*                                            /* display                                                      */,
3118     GC                                                  /* gc                                                           */,
3119     c_ulong                                             /* foreground                                                   */
3120 );
3121 
3122 extern int XSetFunction(
3123     Display*                                            /* display                                                      */,
3124     GC                                                  /* gc                                                           */,
3125     int                                                 /* function                                                     */
3126 );
3127 
3128 extern int XSetGraphicsExposures(
3129     Display*                                            /* display                                                      */,
3130     GC                                                  /* gc                                                           */,
3131     Bool                                                /* graphics_exposures                                           */
3132 );
3133 
3134 extern int XSetIconName(
3135     Display*                                            /* display                                                      */,
3136     Window                                              /* w                                                            */,
3137     char*                                               /* icon_name                                                    */
3138 );
3139 
3140 extern int XSetInputFocus(
3141     Display*                                            /* display                                                      */,
3142     Window                                              /* focus                                                        */,
3143     int                                                 /* revert_to                                                    */,
3144     Time                                                /* time                                                         */
3145 );
3146 
3147 extern int XSetLineAttributes(
3148     Display*                                            /* display                                                      */,
3149     GC                                                  /* gc                                                           */,
3150     uint                                                /* line_width                                                   */,
3151     int                                                 /* line_style                                                   */,
3152     int                                                 /* cap_style                                                    */,
3153     int                                                 /* join_style                                                   */
3154 );
3155 
3156 extern int XSetModifierMapping(
3157     Display*                                            /* display                                                      */,
3158     XModifierKeymap*                                    /* modmap                                                       */
3159 );
3160 
3161 extern int XSetPlaneMask(
3162     Display*                                            /* display                                                      */,
3163     GC                                                  /* gc                                                           */,
3164     c_ulong                                             /* plane_mask                                                   */
3165 );
3166 
3167 extern int XSetPointerMapping(
3168     Display*                                            /* display                                                      */,
3169     ubyte*                                              /* map                                                          */,
3170     int                                                 /* nmap                                                         */
3171 );
3172 
3173 extern int XSetScreenSaver(
3174     Display*                                            /* display                                                      */,
3175     int                                                 /* timeout                                                      */,
3176     int                                                 /* interval                                                     */,
3177     int                                                 /* prefer_blanking                                              */,
3178     int                                                 /* allow_exposures                                              */
3179 );
3180 
3181 extern int XSetSelectionOwner(
3182     Display*                                            /* display                                                      */,
3183     Atom                                                /* selection                                                    */,
3184     Window                                              /* owner                                                        */,
3185     Time                                                /* time                                                         */
3186 );
3187 
3188 extern int XSetState(
3189     Display*                                            /* display                                                      */,
3190     GC                                                  /* gc                                                           */,
3191     c_ulong                                             /* foreground                                                   */,
3192     c_ulong                                             /* background                                                   */,
3193     int                                                 /* function                                                     */,
3194     c_ulong                                             /* plane_mask                                                   */
3195 );
3196 
3197 extern int XSetStipple(
3198     Display*                                            /* display                                                      */,
3199     GC                                                  /* gc                                                           */,
3200     Pixmap                                              /* stipple                                                      */
3201 );
3202 
3203 extern int XSetSubwindowMode(
3204     Display*                                            /* display                                                      */,
3205     GC                                                  /* gc                                                           */,
3206     int                                                 /* subwindow_mode                                               */
3207 );
3208 
3209 extern int XSetTSOrigin(
3210     Display*                                            /* display                                                      */,
3211     GC                                                  /* gc                                                           */,
3212     int                                                 /* ts_x_origin                                                  */,
3213     int                                                 /* ts_y_origin                                                  */
3214 );
3215 
3216 extern int XSetTile(
3217     Display*                                            /* display                                                      */,
3218     GC                                                  /* gc                                                           */,
3219     Pixmap                                              /* tile                                                         */
3220 );
3221 
3222 extern int XSetWindowBackground(
3223     Display*                                            /* display                                                      */,
3224     Window                                              /* w                                                            */,
3225     c_ulong                                             /* background_pixel                                             */
3226 );
3227 
3228 extern int XSetWindowBackgroundPixmap(
3229     Display*                                            /* display                                                      */,
3230     Window                                              /* w                                                            */,
3231     Pixmap                                              /* background_pixmap                                            */
3232 );
3233 
3234 extern int XSetWindowBorder(
3235     Display*                                            /* display                                                      */,
3236     Window                                              /* w                                                            */,
3237     c_ulong                                             /* border_pixel                                                 */
3238 );
3239 
3240 extern int XSetWindowBorderPixmap(
3241     Display*                                            /* display                                                      */,
3242     Window                                              /* w                                                            */,
3243     Pixmap                                              /* border_pixmap                                                */
3244 );
3245 
3246 extern int XSetWindowBorderWidth(
3247     Display*                                            /* display                                                      */,
3248     Window                                              /* w                                                            */,
3249     uint                                                /* width                                                        */
3250 );
3251 
3252 extern int XSetWindowColormap(
3253     Display*                                            /* display                                                      */,
3254     Window                                              /* w                                                            */,
3255     Colormap                                            /* colormap                                                     */
3256 );
3257 
3258 extern int XStoreBuffer(
3259     Display*                                            /* display                                                      */,
3260     char*                                               /* chars                                                        */,
3261     int                                                 /* nchars                                                       */,
3262     int                                                 /* buffer                                                       */
3263 );
3264 
3265 extern int XStorechars(
3266     Display*                                            /* display                                                      */,
3267     char*                                               /* chars                                                        */,
3268     int                                                 /* nchars                                                       */
3269 );
3270 
3271 extern int XStoreColor(
3272     Display*                                            /* display                                                      */,
3273     Colormap                                            /* colormap                                                     */,
3274     XColor*                                             /* color                                                        */
3275 );
3276 
3277 extern int XStoreColors(
3278     Display*                                            /* display                                                      */,
3279     Colormap                                            /* colormap                                                     */,
3280     XColor*                                             /* color                                                        */,
3281     int                                                 /* ncolors                                                      */
3282 );
3283 
3284 extern int XStoreName(
3285     Display*                                            /* display                                                      */,
3286     Window                                              /* w                                                            */,
3287     char*                                               /* window_name                                                  */
3288 );
3289 
3290 extern int XStoreNamedColor(
3291     Display*                                            /* display                                                      */,
3292     Colormap                                            /* colormap                                                     */,
3293     char*                                               /* color                                                        */,
3294     c_ulong                                             /* pixel                                                        */,
3295     int                                                 /* flags                                                        */
3296 );
3297 
3298 extern int XSync(
3299     Display*                                            /* display                                                      */,
3300     Bool                                                /* discard                                                      */
3301 );
3302 
3303 extern int XTextExtents(
3304     XFontStruct*                                        /* font_struct                                                  */,
3305     char*                                               /* string                                                       */,
3306     int                                                 /* nchars                                                       */,
3307     int*                                                /* direction_return                                             */,
3308     int*                                                /* font_ascent_return                                           */,
3309     int*                                                /* font_descent_return                                          */,
3310     XCharStruct*                                        /* overall_return                                               */
3311 );
3312 
3313 extern int XTextExtents16(
3314     XFontStruct*                                        /* font_struct                                                  */,
3315     XChar2b*                                            /* string                                                       */,
3316     int                                                 /* nchars                                                       */,
3317     int*                                                /* direction_return                                             */,
3318     int*                                                /* font_ascent_return                                           */,
3319     int*                                                /* font_descent_return                                          */,
3320     XCharStruct*                                        /* overall_return                                               */
3321 );
3322 
3323 extern int XTextWidth(
3324     XFontStruct*                                        /* font_struct                                                  */,
3325     char*                                               /* string                                                       */,
3326     int                                                 /* count                                                        */
3327 );
3328 
3329 extern int XTextWidth16(
3330     XFontStruct*                                        /* font_struct                                                  */,
3331     XChar2b*                                            /* string                                                       */,
3332     int                                                 /* count                                                        */
3333 );
3334 
3335 extern Bool XTranslateCoordinates(
3336     Display*                                            /* display                                                      */,
3337     Window                                              /* src_w                                                        */,
3338     Window                                              /* dest_w                                                       */,
3339     int                                                 /* src_x                                                        */,
3340     int                                                 /* src_y                                                        */,
3341     int*                                                /* dest_x_return                                                */,
3342     int*                                                /* dest_y_return                                                */,
3343     Window*                                             /* child_return                                                 */
3344 );
3345 
3346 extern int XUndefineCursor(
3347     Display*                                            /* display                                                      */,
3348     Window                                              /* w                                                            */
3349 );
3350 
3351 extern int XUngrabButton(
3352     Display*                                            /* display                                                      */,
3353     uint                                                /* button                                                       */,
3354     uint                                                /* modifiers                                                    */,
3355     Window                                              /* grab_window                                                  */
3356 );
3357 
3358 extern int XUngrabKey(
3359     Display*                                            /* display                                                      */,
3360     int                                                 /* keycode                                                      */,
3361     uint                                                /* modifiers                                                    */,
3362     Window                                              /* grab_window                                                  */
3363 );
3364 
3365 extern int XUngrabKeyboard(
3366     Display*                                            /* display                                                      */,
3367     Time                                                /* time                                                         */
3368 );
3369 
3370 extern int XUngrabPointer(
3371     Display*                                            /* display                                                      */,
3372     Time                                                /* time                                                         */
3373 );
3374 
3375 extern int XUngrabServer(
3376     Display*                                            /* display                                                      */
3377 );
3378 
3379 extern int XUninstallColormap(
3380     Display*                                            /* display                                                      */,
3381     Colormap                                            /* colormap                                                     */
3382 );
3383 
3384 extern int XUnloadFont(
3385     Display*                                            /* display                                                      */,
3386     Font                                                /* font                                                         */
3387 );
3388 
3389 extern int XUnmapSubwindows(
3390     Display*                                            /* display                                                      */,
3391     Window                                              /* w                                                            */
3392 );
3393 
3394 extern int XUnmapWindow(
3395     Display*                                            /* display                                                      */,
3396     Window                                              /* w                                                            */
3397 );
3398 
3399 extern int XVendorRelease(
3400     Display*                                            /* display                                                      */
3401 );
3402 
3403 extern int XWarpPointer(
3404     Display*                                            /* display                                                      */,
3405     Window                                              /* src_w                                                        */,
3406     Window                                              /* dest_w                                                       */,
3407     int                                                 /* src_x                                                        */,
3408     int                                                 /* src_y                                                        */,
3409     uint                                                /* src_width                                                    */,
3410     uint                                                /* src_height                                                   */,
3411     int                                                 /* dest_x                                                       */,
3412     int                                                 /* dest_y                                                       */
3413 );
3414 
3415 extern int XWidthMMOfScreen(
3416     Screen*                                             /* screen                                                       */
3417 );
3418 
3419 extern int XWidthOfScreen(
3420     Screen*                                             /* screen                                                       */
3421 );
3422 
3423 extern int XWindowEvent(
3424     Display*                                            /* display                                                      */,
3425     Window                                              /* w                                                            */,
3426     c_long                                              /* event_mask                                                   */,
3427     XEvent*                                             /* event_return                                                 */
3428 );
3429 
3430 extern int XWriteBitmapFile(
3431     Display*                                            /* display                                                      */,
3432     char*                                               /* filename                                                     */,
3433     Pixmap                                              /* bitmap                                                       */,
3434     uint                                                /* width                                                        */,
3435     uint                                                /* height                                                       */,
3436     int                                                 /* x_hot                                                        */,
3437     int                                                 /* y_hot                                                        */
3438 );
3439 
3440 extern Bool XSupportsLocale ( );
3441 
3442 extern char* XSetLocaleModifiers(
3443     const char*                                         /* modifier_list                                                */
3444 );
3445 
3446 extern XOM XOpenOM(
3447     Display*                                            /* display                                                      */,
3448     _XrmHashBucketRec*                                  /* rdb                                                          */,
3449     char*                                               /* res_name                                                     */,
3450     char*                                               /* res_class                                                    */
3451 );
3452 
3453 extern Status XCloseOM(
3454     XOM                                                 /* om                                                           */
3455 );
3456 
3457 extern char* XSetOMValues(
3458     XOM                                                 /* om                                                           */,
3459     ...
3460 );
3461 
3462 extern char* XGetOMValues(
3463     XOM                                                 /* om                                                           */,
3464     ...
3465 );
3466 
3467 extern Display* XDisplayOfOM(
3468     XOM                                                 /* om                                                           */
3469 );
3470 
3471 extern char* XLocaleOfOM(
3472 
3473     XOM                                                 /* om                                                           */
3474 );
3475 
3476 extern XOC XCreateOC(
3477     XOM                                                 /* om                                                           */,
3478     ...
3479 );
3480 
3481 extern void XDestroyOC(
3482     XOC                                                 /* oc                                                           */
3483 );
3484 
3485 extern XOM XOMOfOC(
3486     XOC                                                 /* oc                                                           */
3487 );
3488 
3489 extern char* XSetOCValues(
3490     XOC                                                 /* oc                                                           */,
3491     ...
3492 );
3493 
3494 extern char* XGetOCValues(
3495     XOC                                                 /* oc                                                           */,
3496     ...
3497 );
3498 
3499 extern XFontSet XCreateFontSet(
3500     Display*                                            /* display                                                      */,
3501     char*                                               /* base_font_name_list                                          */,
3502     char***                                             /* missing_charset_list                                         */,
3503     int*                                                /* missing_charset_count                                        */,
3504     char**                                              /* def_string                                                   */
3505 );
3506 
3507 extern void XFreeFontSet(
3508     Display*                                            /* display                                                      */,
3509     XFontSet                                            /* font_set                                                     */
3510 );
3511 
3512 extern int XFontsOfFontSet(
3513     XFontSet                                            /* font_set                                                     */,
3514     XFontStruct***                                      /* font_struct_list                                             */,
3515     char***                                             /* font_name_list                                               */
3516 );
3517 
3518 extern char* XBaseFontNameListOfFontSet(
3519     char                                                /* font_set                                                     */
3520 );
3521 
3522 extern char* XLocaleOfFontSet(
3523     XFontSet                                            /* font_set                                                     */
3524 );
3525 
3526 extern Bool XContextDependentDrawing(
3527     XFontSet                                            /* font_set                                                     */
3528 );
3529 
3530 extern Bool XDirectionalDependentDrawing(
3531     XFontSet                                            /* font_set                                                     */
3532 );
3533 
3534 extern Bool XContextualDrawing(
3535     XFontSet                                            /* font_set                                                     */
3536 );
3537 
3538 extern XFontSetExtents* XExtentsOfFontSet(
3539     XFontSet                                            /* font_set                                                     */
3540 );
3541 
3542 extern int XmbTextEscapement(
3543     XFontSet                                            /* font_set                                                     */,
3544     char*                                               /* text                                                         */,
3545     int                                                 /* chars_text                                                   */
3546 );
3547 
3548 extern int XwcTextEscapement(
3549     XFontSet                                            /* font_set                                                     */,
3550     wchar*                                              /* text                                                         */,
3551     int                                                 /* num_wchars                                                   */
3552 );
3553 
3554 extern int Xutf8TextEscapement(
3555     XFontSet                                            /* font_set                                                     */,
3556     char*                                               /* text                                                         */,
3557     int                                                 /* chars_text                                                   */
3558 );
3559 
3560 extern int XmbTextExtents(
3561     XFontSet                                            /* font_set                                                     */,
3562     char*                                               /* text                                                         */,
3563     int                                                 /* chars_text                                                   */,
3564     XRectangle*                                         /* overall_ink_return                                           */,
3565     XRectangle*                                         /* overall_logical_return                                       */
3566 );
3567 
3568 extern int XwcTextExtents(
3569     XFontSet                                            /* font_set                                                     */,
3570     wchar*                                              /* text                                                         */,
3571     int                                                 /* num_wchars                                                   */,
3572     XRectangle*                                         /* overall_ink_return                                           */,
3573     XRectangle*                                         /* overall_logical_return                                       */
3574 );
3575 
3576 extern int Xutf8TextExtents(
3577     XFontSet                                            /* font_set                                                     */,
3578     char*                                               /* text                                                         */,
3579     int                                                 /* chars_text                                                   */,
3580     XRectangle*                                         /* overall_ink_return                                           */,
3581     XRectangle*                                         /* overall_logical_return                                       */
3582 );
3583 
3584 extern Status XmbTextPerCharExtents(
3585     XFontSet                                            /* font_set                                                     */,
3586     char*                                               /* text                                                         */,
3587     int                                                 /* chars_text                                                   */,
3588     XRectangle*                                         /* ink_extents_buffer                                           */,
3589     XRectangle*                                         /* logical_extents_buffer                                       */,
3590     int                                                 /* buffer_size                                                  */,
3591     int*                                                /* num_chars                                                    */,
3592     XRectangle*                                         /* overall_ink_return                                           */,
3593     XRectangle*                                         /* overall_logical_return                                       */
3594 );
3595 
3596 extern Status XwcTextPerCharExtents(
3597     XFontSet                                            /* font_set                                                     */,
3598     wchar*                                              /* text                                                         */,
3599     int                                                 /* num_wchars                                                   */,
3600     XRectangle*                                         /* ink_extents_buffer                                           */,
3601     XRectangle*                                         /* logical_extents_buffer                                       */,
3602     int                                                 /* buffer_size                                                  */,
3603     int*                                                /* num_chars                                                    */,
3604     XRectangle*                                         /* overall_ink_return                                           */,
3605     XRectangle*                                         /* overall_logical_return                                       */
3606 );
3607 
3608 extern Status Xutf8TextPerCharExtents(
3609     XFontSet                                            /* font_set                                                     */,
3610     char*                                               /* text                                                         */,
3611     int                                                 /* chars_text                                                   */,
3612     XRectangle*                                         /* ink_extents_buffer                                           */,
3613     XRectangle*                                         /* logical_extents_buffer                                       */,
3614     int                                                 /* buffer_size                                                  */,
3615     int*                                                /* num_chars                                                    */,
3616     XRectangle*                                         /* overall_ink_return                                           */,
3617     XRectangle*                                         /* overall_logical_return                                       */
3618 );
3619 
3620 extern void XmbDrawText(
3621     Display*                                            /* display                                                      */,
3622     Drawable                                            /* d                                                            */,
3623     GC                                                  /* gc                                                           */,
3624     int                                                 /* x                                                            */,
3625     int                                                 /* y                                                            */,
3626     XmbTextItem*                                        /* text_items                                                   */,
3627     int                                                 /* nitems                                                       */
3628 );
3629 
3630 extern void XwcDrawText(
3631     Display*                                            /* display                                                      */,
3632     Drawable                                            /* d                                                            */,
3633     GC                                                  /* gc                                                           */,
3634     int                                                 /* x                                                            */,
3635     int                                                 /* y                                                            */,
3636     XwcTextItem*                                        /* text_items                                                   */,
3637     int                                                 /* nitems                                                       */
3638 );
3639 
3640 extern void Xutf8DrawText(
3641     Display*                                            /* display                                                      */,
3642     Drawable                                            /* d                                                            */,
3643     GC                                                  /* gc                                                           */,
3644     int                                                 /* x                                                            */,
3645     int                                                 /* y                                                            */,
3646     XmbTextItem*                                        /* text_items                                                   */,
3647     int                                                 /* nitems                                                       */
3648 );
3649 
3650 extern void XmbDrawString(
3651     Display*                                            /* display                                                      */,
3652     Drawable                                            /* d                                                            */,
3653     XFontSet                                            /* font_set                                                     */,
3654     GC                                                  /* gc                                                           */,
3655     int                                                 /* x                                                            */,
3656     int                                                 /* y                                                            */,
3657     char*                                       /* text                                                         */,
3658     int                                                 /* chars_text                                                   */
3659 );
3660 
3661 extern void XwcDrawString(
3662     Display*                                            /* display                                                      */,
3663     Drawable                                            /* d                                                            */,
3664     XFontSet                                            /* font_set                                                     */,
3665     GC                                                  /* gc                                                           */,
3666     int                                                 /* x                                                            */,
3667     int                                                 /* y                                                            */,
3668     wchar*                                              /* text                                                         */,
3669     int                                                 /* num_wchars                                                   */
3670 );
3671 
3672 extern void Xutf8DrawString(
3673     Display*                                            /* display                                                      */,
3674     Drawable                                            /* d                                                            */,
3675     XFontSet                                            /* font_set                                                     */,
3676     GC                                                  /* gc                                                           */,
3677     int                                                 /* x                                                            */,
3678     int                                                 /* y                                                            */,
3679     char*                                               /* text                                                         */,
3680     int                                                 /* chars_text                                                   */
3681 );
3682 
3683 extern void XmbDrawImageString(
3684     Display*                                            /* display                                                      */,
3685     Drawable                                            /* d                                                            */,
3686     XFontSet                                            /* font_set                                                     */,
3687     GC                                                  /* gc                                                           */,
3688     int                                                 /* x                                                            */,
3689     int                                                 /* y                                                            */,
3690     char*                                               /* text                                                         */,
3691     int                                                 /* chars_text                                                   */
3692 );
3693 
3694 extern void XwcDrawImageString(
3695     Display*                                            /* display                                                      */,
3696     Drawable                                            /* d                                                            */,
3697     XFontSet                                            /* font_set                                                     */,
3698     GC                                                  /* gc                                                           */,
3699     int                                                 /* x                                                            */,
3700     int                                                 /* y                                                            */,
3701     wchar*                                              /* text                                                         */,
3702     int                                                 /* num_wchars                                                   */
3703 );
3704 
3705 extern void Xutf8DrawImageString(
3706     Display*                                            /* display                                                      */,
3707     Drawable                                            /* d                                                            */,
3708     XFontSet                                            /* font_set                                                     */,
3709     GC                                                  /* gc                                                           */,
3710     int                                                 /* x                                                            */,
3711     int                                                 /* y                                                            */,
3712     char*                                               /* text                                                         */,
3713     int                                                 /* chars_text                                                   */
3714 );
3715 
3716 extern XIM XOpenIM(
3717     Display*                                            /* dpy                                                          */,
3718     _XrmHashBucketRec*                                  /* rdb                                                          */,
3719     char*                                               /* res_name                                                     */,
3720     char*                                               /* res_class                                                    */
3721 );
3722 
3723 extern Status XCloseIM(
3724     XIM                                                 /* im                                                           */
3725 );
3726 
3727 extern char* XGetIMValues(
3728     XIM                                                 /* im                                                           */,
3729 	...
3730 );
3731 
3732 extern char* XSetIMValues(
3733     XIM                                                 /* im                                                           */,
3734 	...
3735 );
3736 
3737 extern Display* XDisplayOfIM(
3738     XIM                                                 /* im                                                           */
3739 );
3740 
3741 extern char* XLocaleOfIM(
3742     XIM                                                 /* im                                                           */
3743 );
3744 
3745 extern XIC XCreateIC(
3746     XIM,                                                 /* im                                                           */
3747 	...
3748 );
3749 
3750 extern void XDestroyIC(
3751     XIC                                                 /* ic                                                           */
3752 );
3753 
3754 extern void XSetICFocus(
3755     XIC                                                 /* ic                                                           */
3756 );
3757 
3758 extern void XUnsetICFocus(
3759     XIC                                                 /* ic                                                           */
3760 );
3761 
3762 extern wchar*   XwcResetIC(
3763     XIC                                                 /* ic                                                           */
3764 );
3765 
3766 extern char* XmbResetIC(
3767     XIC                                                 /* ic                                                           */
3768 );
3769 
3770 extern char* Xutf8ResetIC(
3771     XIC                                                 /* ic                                                           */
3772 );
3773 
3774 extern char* XSetICValues(
3775     XIC                                                 /* ic                                                           */,
3776 	...
3777 );
3778 
3779 extern char* XGetICValues(
3780     XIC                                                 /* ic                                                           */,
3781 	...
3782 );
3783 
3784 extern XIM XIMOfIC(
3785     XIC                                                 /* ic                                                           */
3786 );
3787 
3788 extern Bool XFilterEvent(
3789     XEvent*                                             /* event                                                        */,
3790     Window                                              /* window                                                       */
3791 );
3792 
3793 extern int XmbLookupString(
3794     XIC                                                 /* ic                                                           */,
3795     XKeyPressedEvent*                                   /* event                                                        */,
3796     char*                                               /* buffer_return                                                */,
3797     int                                                 /* chars_buffer                                                 */,
3798     KeySym*                                             /* keysym_return                                                */,
3799     Status*                                             /* status_return                                                */
3800 );
3801 
3802 extern int XwcLookupString(
3803     XIC                                                 /* ic                                                           */,
3804     XKeyPressedEvent*                                   /* event                                                        */,
3805     wchar*                                              /* buffer_return                                                */,
3806     int                                                 /* wchars_buffer                                                */,
3807     KeySym*                                             /* keysym_return                                                */,
3808     Status*                                             /* status_return                                                */
3809 );
3810 
3811 extern int Xutf8LookupString(
3812     XIC                                                 /* ic                                                           */,
3813     XKeyPressedEvent*                                   /* event                                                        */,
3814     char*                                               /* buffer_return                                                */,
3815     int                                                 /* chars_buffer                                                 */,
3816     KeySym*                                             /* keysym_return                                                */,
3817     Status*                                             /* status_return                                                */
3818 );
3819 
3820 extern XVaNestedList XVaCreateNestedList(
3821     int                                                 /*unused                                                        */,
3822 	... 
3823 );
3824                                                         /* internal connections for IMs                                 */
3825 
3826 extern Bool XRegisterIMInstantiateCallback(
3827     Display*                                            /* dpy                                                          */,
3828     _XrmHashBucketRec*                                  /* rdb                                                          */,
3829     char*                                               /* res_name                                                     */,
3830     char*                                               /* res_class                                                    */,
3831     XIDProc                                             /* callback                                                     */,
3832     XPointer                                            /* client_data                                                  */
3833 );
3834 
3835 extern Bool XUnregisterIMInstantiateCallback(
3836     Display*                                            /* dpy                                                          */,
3837     _XrmHashBucketRec*                                  /* rdb                                                          */,
3838     char*                                               /* res_name                                                     */,
3839     char*                                               /* res_class                                                    */,
3840     XIDProc                                             /* callback                                                     */,
3841     XPointer                                            /* client_data                                                  */
3842 );
3843 
3844 alias void function(
3845     Display*                                            /* dpy                                                          */,
3846     XPointer                                            /* client_data                                                  */,
3847     int                                                 /* fd                                                           */,
3848     Bool                                                /* opening, open or close flag                                  */,
3849     XPointer*                                           /* watch_data, open sets, close uses                            */
3850 ) XConnectionWatchProc;
3851 
3852 
3853 extern Status XInternalConnectionNumbers(
3854     Display*                                            /* dpy                                                          */,
3855     int**                                               /* fd_return                                                    */,
3856     int*                                                /* count_return                                                 */
3857 );
3858 
3859 extern void XProcessInternalConnection(
3860     Display*                                            /* dpy                                                          */,
3861     int                                                 /* fd                                                           */
3862 );
3863 
3864 extern Status XAddConnectionWatch(
3865     Display*                                            /* dpy                                                          */,
3866     XConnectionWatchProc                                /* callback                                                     */,
3867     XPointer                                            /* client_data                                                  */
3868 );
3869 
3870 extern void XRemoveConnectionWatch(
3871     Display*                                            /* dpy                                                          */,
3872     XConnectionWatchProc                                /* callback                                                     */,
3873     XPointer                                            /* client_data                                                  */
3874 );
3875 
3876 extern void XSetAuthorization(
3877     char*                                               /* name                                                         */,
3878     int                                                 /* namelen                                                      */,
3879     char*                                               /* data                                                         */,
3880     int                                                 /* datalen                                                      */
3881 );
3882 
3883 extern int _Xmbtowc(
3884     wchar*                                              /* wstr                                                         */,
3885     char*                                               /* str                                                          */,
3886     int                                                 /* len                                                          */
3887 );
3888 
3889 extern int _Xwctomb(
3890     char*                                               /* str                                                          */,
3891     wchar                                               /* wc                                                           */
3892 );
3893 
3894 extern Bool XGetEventData(
3895     Display*                                            /* dpy                                                          */,
3896     XGenericEventCookie*                                /* cookie                                                       */
3897 );
3898 
3899 extern void XFreeEventData(
3900     Display*                                            /* dpy                                                          */,
3901     XGenericEventCookie*                                /* cookie                                                       */
3902 );