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