1 module derelict.x11.Xutil;
2 version(linux):
3 import core.stdc.config;
4 import derelict.x11.Xlib;
5 import derelict.x11.X;
6 import derelict.x11.Xregion;
7 import derelict.x11.keysym;
8 
9 extern (C) nothrow @nogc:
10 
11 /*
12  * Bitmask returned by XParseGeometry().  Each bit tells if the corresponding
13  * value (x, y, width, height) was found in the parsed string.
14  */
15 const int NoValue     = 0x0000;
16 const int XValue      = 0x0001;
17 const int YValue      = 0x0002;
18 const int WidthValue  = 0x0004;
19 const int HeightValue = 0x0008;
20 const int AllValues   = 0x000F;
21 const int XNegative   = 0x0010;
22 const int YNegative   = 0x0020;
23 
24 /*
25  * new version containing base_width, base_height, and win_gravity fields;
26  * used with WM_NORMAL_HINTS.
27  */
28 struct XSizeHints {
29     c_long flags;                                       /* marks which fields in this structure are defined             */
30     int x, y;                                           /* obsolete for new window mgrs, but clients                    */
31     int width, height;                                  /* should set so old wm's don't mess up                         */
32     int min_width, min_height;
33     int max_width, max_height;
34     int width_inc, height_inc;
35     struct aspect {
36         int x;                                          /* numerator                                                    */
37         int y;                                          /* denominator                                                  */
38     }
39     aspect min_aspect, max_aspect;
40     int base_width, base_height;                        /* added by ICCCM version 1                                     */
41     int win_gravity;                                    /* added by ICCCM version 1                                     */
42 }
43 
44 /*
45  * The next block of definitions are for window manager properties that
46  * clients and applications use for communication.
47  */
48 
49                                                         /* flags argument in size hints                                 */
50 enum {
51     USPosition  = 1L << 0,                              /* user specified x, y                                          */
52     USSize      = 1L << 1,                              /* user specified width, height                                 */
53 
54     PPosition   = 1L << 2,                              /* program specified position                                   */
55     PSize       = 1L << 3,                              /* program specified size                                       */
56     PMinSize    = 1L << 4,                              /* program specified minimum size                               */
57     PMaxSize    = 1L << 5,                              /* program specified maximum size                               */
58     PResizeInc  = 1L << 6,                              /* program specified resize increments                          */
59     PAspect     = 1L << 7,                              /* program specified min and max aspect ratios                  */
60     PBaseSize   = 1L << 8,                              /* program specified base for incrementing                      */
61     PWinGravity = 1L << 9                               /* program specified window gravity                             */
62 }
63 
64 /* obsolete */
65 c_long PAllHints = (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect);
66 
67 
68 
69 struct XWMHints{
70     c_long  flags;                                      /* marks which fields in this structure are defined             */
71     Bool    input;                                      /* does this application rely on the window manager to get keyboard input? */
72     int     nitial_state;                               /* see below                                                    */
73     Pixmap  icon_pixmap;                                /* pixmap to be used as icon                                    */
74     Window  icon_window;                                /* window to be used as icon                                    */
75     int     icon_x, icon_y;                             /* initial position of icon                                     */
76     Pixmap  icon_mask;                                  /* icon mask bitmap                                             */
77     XID     window_group;                               /* id of related window group                                   */
78                                                         /* this structure may be extended in the future                 */
79 }
80 
81                                                         /* definition for flags of XWMHints                             */
82 enum {
83     InputHint           = (1L << 0),
84     StateHint           = (1L << 1),
85     IconPixmapHint      = (1L << 2),
86     IconWindowHint      = (1L << 3),
87     IconPositionHint    = (1L << 4),
88     IconMaskHint        = (1L << 5),
89     WindowGroupHint     = (1L << 6),
90     AllHints            = (InputHint|StateHint|IconPixmapHint|IconWindowHint|IconPositionHint|IconMaskHint|WindowGroupHint),
91     XUrgencyHint        = (1L << 8)
92 }
93 
94                                                         /* definitions for initial window state                         */
95 enum {
96     WithdrawnState  = 0,                                /* for windows that are not mapped                              */
97     NormalState     = 1,                                /* most applications want to start this way                     */
98     IconicState     = 3                                 /* application wants to start as an icon                        */
99 }
100 
101 /*
102  * Obsolete states no longer defined by ICCCM
103  */
104 enum {
105     DontCareState   = 0,                                /* don't know or care                                           */
106     ZoomState       = 2,                                /* application wants to start zoomed                            */
107     InactiveState   = 4                                 /* application believes it is seldom used;                      */
108 }
109                                                         /* some wm's may put it on inactive menu                        */
110 
111 
112 /*
113  * new structure for manipulating TEXT properties; used with WM_NAME,
114  * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
115  */
116 struct XTextProperty{
117     ubyte*  value;                                      /* same as Property routines                                    */
118     Atom    encoding;                                   /* prop type                                                    */
119     int     format;                                     /* prop data format: 8, 16, or 32                               */
120     c_ulong nitems;                                     /* number of data items in value                                */
121 }
122 
123 const int XNoMemory             = -1;
124 const int XLocaleNotSupported   = -2;
125 const int XConverterNotFound    = -3;
126 
127 alias int XICCEncodingStyle;
128 enum {
129     XStringStyle,                                       /* STRING                                                       */
130     XCompoundTextStyle,                                 /* COMPOUND_TEXT                                                */
131     XTextStyle,                                         /* text in owner's encoding (current locale)                    */
132     XStdICCTextStyle,                                   /* STRING, else COMPOUND_TEXT                                   */
133                                                         /* The following is an XFree86 extension, introduced in November 2000 */
134     XUTF8StringStyle                                    /* UTF8_STRING                                                  */
135 }
136 
137 struct XIconSize{
138     int min_width, min_height;
139     int max_width, max_height;
140     int width_inc, height_inc;
141 }
142 
143 struct XClassHint{
144     char* res_name;
145     char* res_class;
146 } ;
147 
148 version( XUTIL_DEFINE_FUNCTIONS ){
149     extern int      XDestroyImage( XImage* ximage );
150     extern c_ulong  XGetPixel( XImage *ximage, int x, int y );
151     extern int      XPutPixel( XImage* ximage, int x, int y, c_ulong pixel );
152     extern XImage*  XSubImage( XImage *ximage, int x, int y, uint width, uint height );
153     extern int      XAddPixel( XImage *ximage, c_long value);
154 }
155 else{
156     /*
157      * These macros are used to give some sugar to the image routines so that
158      * naive people are more comfortable with them.
159      */
160     /**
161      * XDestroyImage
162      * The XDestroyImage() function deallocates the memory associated with the XImage structure.
163      * Note that when the image is created using XCreateImage(), XGetImage(), or XSubImage(), the destroy procedure that this macro calls frees both the image structure and the data pointed to by the image structure.
164      * Params:
165      *  ximage   = Specifies the image.
166      * See_Also:
167      *  XAddPixel(), XCreateImage(), XGetPixel(), XPutPixel(), XSubImage(), http://tronche.com/gui/x/xlib/utilities/manipulating-images.html
168      */
169     int XDestroyImage( XImage* ximage ){
170         return ximage.f.destroy_image(ximage);
171     }
172     /**
173      * XGetPixel
174      * The XGetPixel() function returns the specified pixel from the named image. The pixel value is returned in normalized format (that is, the least-significant byte of the long is the least-significant byte of the pixel). The image must contain the x and y coordinates.
175      * Params:
176      *  ximage  = Specifies the image.
177      *  x       = Specify the x coordinate.
178      *  y       = Specify the y coordinate.
179      * See_Also:
180      *  XAddPixel(), XCreateImage(), XGetPixel(), XPutPixel(), XSubImage(), http://tronche.com/gui/x/xlib/utilities/manipulating-images.html
181      */
182     c_ulong XGetPixel( XImage* ximage, int x, int y ){
183         return ximage.f.get_pixel(ximage, x, y);
184     }
185     /**
186      * XPutPixel
187      * The XPutPixel() function overwrites the pixel in the named image with the specified pixel value. The input pixel value must be in normalized format (that is, the least-significant byte of the long is the least-significant byte of the pixel). The image must contain the x and y coordinates.
188      * Params:
189      *  ximage  = Specifies the image.
190      *  x       = Specify the x coordinate.
191      *  y       = Specify the y coordinate.
192      *  pixel   = Specifies the new pixel value.
193      * See_Also:
194      *  XAddPixel(), XCreateImage(), XGetPixel(), XPutPixel(), XSubImage(), http://tronche.com/gui/x/xlib/utilities/manipulating-images.html
195      */
196     int XPutPixel( XImage* ximage, int x, int y, c_ulong pixel ){
197         return ximage.f.put_pixel(ximage, x, y, pixel);
198     }
199     /**
200      * XSubImage
201      * The XSubImage() function creates a new image that is a subsection of an existing one. It allocates the memory necessary for the new XImage structure and returns a pointer to the new image. The data is copied from the source image, and the image must contain the rectangle defined by x, y, subimage_width, and subimage_height.
202      * Params:
203      *  ximage          = Specifies the image.
204      *  x               = Specify the x coordinate.
205      *  y               = Specify the y coordinate.
206      *  subimage_width  = Specifies the width of the new subimage, in pixels.
207      *  subimage_height = Specifies the height of the new subimage, in pixels.
208      * See_Also:
209      *  XAddPixel(), XCreateImage(), XGetPixel(), XPutPixel(), XSubImage(), http://tronche.com/gui/x/xlib/utilities/manipulating-images.html
210      */
211     XImage XSubImage( XImage* ximage, int x, int y, uint width, uint height ){
212         return ximage.f.sub_image(ximage, x, y, width, height);
213     }
214     /**
215      * XAddPixel
216      * The XAddPixel() function adds a constant value to every pixel in an image. It is useful when you have a base pixel value from allocating color resources and need to manipulate the image to that form.
217      * Params:
218      *  ximage          = Specifies the image.
219      *  value           = Specifies the constant value that is to be added.
220      * See_Also:
221      *  XAddPixel(), XCreateImage(), XGetPixel(), XPutPixel(), XSubImage(), http://tronche.com/gui/x/xlib/utilities/manipulating-images.html
222      */
223     int XAddPixel( XImage* ximage, c_long value ){
224         return ximage.f.add_pixel(ximage, value);
225     }
226 }
227 
228 /*
229  * Compose sequence status structure, used in calling XLookupString.
230  */
231 struct XComposeStatus {
232     XPointer compose_ptr;                               /* state table pointer                                          */
233     int chars_matched;                                  /* match state                                                  */
234 }
235 
236 /*
237  * Keysym macros, used on Keysyms to test for classes of symbols
238  */
239 template IsKeypadKey(KeySym keysym){
240   const bool IsKeypadKey = (( keysym >= XK_KP_Space )       && ( keysym <= XK_KP_Equal));
241 }
242 
243 template IsPrivateKeypadKey(KeySym keysym){
244   const bool IsPrivateKeypadKey = (( keysym >= 0x11000000 ) && ( keysym <= 0x1100FFFF));
245 }
246 
247 template IsCursorKey(KeySym keysym){
248   const bool IsCursorKey = (( keysym >= XK_Home )           && ( keysym <  XK_Select));
249 }
250 
251 template IsPFKey(KeySym keysym){
252   const bool IsPFKey = (( keysym >= XK_KP_F1 )              && ( keysym <= XK_KP_F4));
253 }
254 
255 template IsFunctionKey(KeySym keysym){
256   const bool IsFunctionKey = (( keysym >= XK_F1 )           && (keysym <= XK_F35));
257 }
258 
259 template IsMiscFunctionKey(KeySym keysym){
260   const bool IsMiscFunctionKey = (( keysym >= XK_Select )   && ( keysym <= XK_Break));
261 }
262 
263 static if( XK_XKB_KEYS ){
264     template IsModifierKey(KeySym keysym){
265         const bool IsModifierKey = (  ( (keysym >= XK_Shift_L) && (keysym <= XK_Hyper_R) )
266                                        || ( (keysym >= XK_ISO_Lock) && (keysym <= XK_ISO_Last_Group_Lock) )
267                                        || ( keysym == XK_Mode_switch)
268                                        || ( keysym == XK_Num_Lock)
269                                    );
270     }
271 }
272 else{
273     template IsModifierKey(keysym){
274         const bool IsModifierKey = (((keysym >= XK_Shift_L) && (keysym <= XK_Hyper_R))
275                                        || (keysym == XK_Mode_switch)
276                                        || (keysym == XK_Num_Lock)
277                                    );
278     }
279 }
280 /*
281  * opaque reference to Region data type
282  */
283 alias _XRegion* Region;
284 
285 /* Return values from XRectInRegion() */
286 enum {
287     RectangleOut    = 0,
288     RectangleIn     = 1,
289     RectanglePart   = 2
290 }
291 
292 
293 /*
294  * Information used by the visual utility routines to find desired visual
295  * type from the many visuals a display may support.
296  */
297 
298 struct XVisualInfo{
299     Visual*   visual;
300     VisualID  visualid;
301     int       screen;
302     int       depth;
303     int       c_class;                                  /* C++                                                          */;
304     c_ulong   red_mask;
305     c_ulong   green_mask;
306     c_ulong   blue_mask;
307     int       colormap_size;
308     int       bits_per_rgb;
309 }
310 
311 enum {
312     VisualNoMask            = 0x0,
313     VisualIDMask            = 0x1,
314     VisualScreenMask        = 0x2,
315     VisualDepthMask         = 0x4,
316     VisualClassMask         = 0x8,
317     VisualRedMaskMask       = 0x10,
318     VisualGreenMaskMask     = 0x20,
319     VisualBlueMaskMask      = 0x40,
320     VisualColormapSizeMask  = 0x80,
321     VisualBitsPerRGBMask    = 0x100,
322     VisualAllMask           = 0x1FF
323 }
324 
325 /*
326  * This defines a window manager property that clients may use to
327  * share standard color maps of type RGB_COLOR_MAP:
328  */
329 struct XStandardColormap{
330     Colormap colormap;
331     c_ulong     red_max;
332     c_ulong     red_mult;
333     c_ulong     green_max;
334     c_ulong     green_mult;
335     c_ulong     blue_max;
336     c_ulong     blue_mult;
337     c_ulong     base_pixel;
338     VisualID    visualid;                               /* added by ICCCM version 1                                     */
339     XID         killid;                                 /* added by ICCCM version 1                                     */
340 }
341 
342 const XID ReleaseByFreeingColormap = 1L;                /* for killid field above                                       */
343 
344 
345 /*
346  * return codes for XReadBitmapFile and XWriteBitmapFile
347  */
348 enum {
349     BitmapSuccess       = 0,
350     BitmapOpenFailed    = 1,
351     BitmapFileInvalid   = 2,
352     BitmapNoMemory      = 3
353 }
354 
355 /*****************************************************************
356  *
357  * Context Management
358  *
359  ****************************************************************/
360 
361 
362                                                         /* Associative lookup table return codes                        */
363 enum {
364     XCSUCCESS = 0,                                      /* No error.                                                    */
365     XCNOMEM   = 1,                                      /* Out of memory                                                */
366     XCNOENT   = 2,                                      /* No entry in table                                            */
367 }
368 
369 alias int XContext;
370 
371 template XUniqueContext(){
372     const XContext XUniqueContext = XrmUniqueQuark();
373 }
374 
375                                                         /* The following declarations are alphabetized.                 */
376 
377 extern XClassHint* XAllocClassHint ( );
378 
379 extern XIconSize* XAllocIconSize ( );
380 
381 extern XSizeHints* XAllocSizeHints ( );
382 
383 extern XStandardColormap* XAllocStandardColormap ( );
384 
385 extern XWMHints* XAllocWMHints ( );
386 
387 extern int XClipBox(
388     Region                                              /* r                                                            */,
389     XRectangle*                                         /* rect_return                                                  */
390 );
391 
392 extern Region XCreateRegion( );
393 
394 extern char* XDefaultString ( );
395 
396 extern int XDeleteContext(
397     Display*                                            /* display                                                      */,
398     XID                                                 /* rid                                                          */,
399     XContext                                            /* context                                                      */
400 );
401 
402 extern int XDestroyRegion(
403     Region                                              /* r                                                            */
404 );
405 
406 extern int XEmptyRegion(
407     Region                                              /* r                                                            */
408 );
409 
410 extern int XEqualRegion(
411     Region                                              /* r1                                                           */,
412     Region                                              /* r2                                                           */
413 );
414 
415 extern int XFindContext(
416     Display*                                            /* display                                                      */,
417     XID                                                 /* rid                                                          */,
418     XContext                                            /* context                                                      */,
419     XPointer*                                           /* data_return                                                  */
420 );
421 
422 extern Status XGetClassHint(
423     Display*                                            /* display                                                      */,
424     Window                                              /* w                                                            */,
425     XClassHint*                                         /* class_hints_return                                           */
426 );
427 
428 extern Status XGetIconSizes(
429     Display*                                            /* display                                                      */,
430     Window                                              /* w                                                            */,
431     XIconSize**                                         /* size_list_return                                             */,
432     int*                                                /* count_return                                                 */
433 );
434 
435 extern Status XGetNormalHints(
436     Display*                                            /* display                                                      */,
437     Window                                              /* w                                                            */,
438     XSizeHints*                                         /* hints_return                                                 */
439 );
440 
441 extern Status XGetRGBColormaps(
442     Display*                                            /* display                                                      */,
443     Window                                              /* w                                                            */,
444     XStandardColormap**                                 /* stdcmap_return                                               */,
445     int*                                                /* count_return                                                 */,
446     Atom                                                /* property                                                     */
447 );
448 
449 extern Status XGetSizeHints(
450     Display*                                            /* display                                                      */,
451     Window                                              /* w                                                            */,
452     XSizeHints*                                         /* hints_return                                                 */,
453     Atom                                                /* property                                                     */
454 );
455 
456 extern Status XGetStandardColormap(
457     Display*                                            /* display                                                      */,
458     Window                                              /* w                                                            */,
459     XStandardColormap*                                  /* colormap_return                                              */,
460     Atom                                                /* property                                                     */
461 );
462 
463 extern Status XGetTextProperty(
464     Display*                                            /* display                                                      */,
465     Window                                              /* window                                                       */,
466     XTextProperty*                                      /* text_prop_return                                             */,
467     Atom                                                /* property                                                     */
468 );
469 
470 extern XVisualInfo* XGetVisualInfo(
471     Display*                                            /* display                                                      */,
472     long                                                /* vinfo_mask                                                   */,
473     XVisualInfo*                                        /* vinfo_template                                               */,
474     int*                                                /* nitems_return                                                */
475 );
476 
477 extern Status XGetWMClientMachine(
478     Display*                                            /* display                                                      */,
479     Window                                              /* w                                                            */,
480     XTextProperty*                                      /* text_prop_return                                             */
481 );
482 
483 extern XWMHints *XGetWMHints(
484     Display*                                            /* display                                                      */,
485     Window                                              /* w                                                            */
486 );
487 
488 extern Status XGetWMIconName(
489     Display*                                            /* display                                                      */,
490     Window                                              /* w                                                            */,
491     XTextProperty*                                      /* text_prop_return                                             */
492 );
493 
494 extern Status XGetWMName(
495     Display*                                            /* display                                                      */,
496     Window                                              /* w                                                            */,
497     XTextProperty*                                      /* text_prop_return                                             */
498 );
499 
500 extern Status XGetWMNormalHints(
501     Display*                                            /* display                                                      */,
502     Window                                              /* w                                                            */,
503     XSizeHints*                                         /* hints_return                                                 */,
504     long*                                               /* supplied_return                                              */
505 );
506 
507 extern Status XGetWMSizeHints(
508     Display*                                            /* display                                                      */,
509     Window                                              /* w                                                            */,
510     XSizeHints*                                         /* hints_return                                                 */,
511     long*                                               /* supplied_return                                              */,
512     Atom                                                /* property                                                     */
513 );
514 
515 extern Status XGetZoomHints(
516     Display*                                            /* display                                                      */,
517     Window                                              /* w                                                            */,
518     XSizeHints*                                         /* zhints_return                                                */
519 );
520 
521 extern int XIntersectRegion(
522     Region                                              /* sra                                                          */,
523     Region                                              /* srb                                                          */,
524     Region                                              /* dr_return                                                    */
525 );
526 
527 extern void XConvertCase(
528     KeySym                                              /* sym                                                          */,
529     KeySym*                                             /* lower                                                        */,
530     KeySym*                                             /* upper                                                        */
531 );
532 
533 extern int XLookupString(
534     XKeyEvent*                                          /* event_struct                                                 */,
535     char*                                               /* buffer_return                                                */,
536     int                                                 /* bytes_buffer                                                 */,
537     KeySym*                                             /* keysym_return                                                */,
538     XComposeStatus*                                     /* status_in_out                                                */
539 );
540 
541 extern Status XMatchVisualInfo(
542     Display*                                            /* display                                                      */,
543     int                                                 /* screen                                                       */,
544     int                                                 /* depth                                                        */,
545     int                                                 /* class                                                        */,
546     XVisualInfo*                                        /* vinfo_return                                                 */
547 );
548 
549 extern int XOffsetRegion(
550     Region                                              /* r                                                            */,
551     int                                                 /* dx                                                           */,
552     int                                                 /* dy                                                           */
553 );
554 
555 extern Bool XPointInRegion(
556     Region                                              /* r                                                            */,
557     int                                                 /* x                                                            */,
558     int                                                 /* y                                                            */
559 );
560 
561 extern Region XPolygonRegion(
562     XPoint*                                 /* points                                                       */,
563     int                                                 /* n                                                            */,
564     int                                                 /* fill_rule                                                    */
565 );
566 
567 extern int XRectInRegion(
568     Region                                              /* r                                                            */,
569     int                                                 /* x                                                            */,
570     int                                                 /* y                                                            */,
571     uint                                                /* width                                                        */,
572     uint                                                /* height                                                       */
573 );
574 
575 extern int XSaveContext(
576     Display*                                            /* display                                                      */,
577     XID                                                 /* rid                                                          */,
578     XContext                                            /* context                                                      */,
579     char*                                               /* data                                                         */
580 );
581 
582 extern int XSetClassHint(
583     Display*                                            /* display                                                      */,
584     Window                                              /* w                                                            */,
585     XClassHint*                                         /* class_hints                                                  */
586 );
587 
588 extern int XSetIconSizes(
589     Display*                                            /* display                                                      */,
590     Window                                              /* w                                                            */,
591     XIconSize*                                          /* size_list                                                    */,
592     int                                                 /* count                                                        */
593 );
594 
595 extern int XSetNormalHints(
596     Display*                                            /* display                                                      */,
597     Window                                              /* w                                                            */,
598     XSizeHints*                                         /* hints                                                        */
599 );
600 
601 extern void XSetRGBColormaps(
602     Display*                                            /* display                                                      */,
603     Window                                              /* w                                                            */,
604     XStandardColormap*                                  /* stdcmaps                                                     */,
605     int                                                 /* count                                                        */,
606     Atom                                                /* property                                                     */
607 );
608 
609 extern int XSetSizeHints(
610     Display*                                            /* display                                                      */,
611     Window                                              /* w                                                            */,
612     XSizeHints*                                         /* hints                                                        */,
613     Atom                                                /* property                                                     */
614 );
615 
616 extern int XSetStandardProperties(
617     Display*                                            /* display                                                      */,
618     Window                                              /* w                                                            */,
619     char*                                               /* window_name                                                  */,
620     char*                                               /* icon_name                                                    */,
621     Pixmap                                              /* icon_pixmap                                                  */,
622     char**                                              /* argv                                                         */,
623     int                                                 /* argc                                                         */,
624     XSizeHints*                                         /* hints                                                        */
625 );
626 
627 extern void XSetTextProperty(
628     Display*                                            /* display                                                      */,
629     Window                                              /* w                                                            */,
630     XTextProperty*                                      /* text_prop                                                    */,
631     Atom                                                /* property                                                     */
632 );
633 
634 extern void XSetWMClientMachine(
635     Display*                                            /* display                                                      */,
636     Window                                              /* w                                                            */,
637     XTextProperty*                                      /* text_prop                                                    */
638 );
639 
640 extern int XSetWMHints(
641     Display*                                            /* display                                                      */,
642     Window                                              /* w                                                            */,
643     XWMHints*                                           /* wm_hints                                                     */
644 );
645 
646 extern void XSetWMIconName(
647     Display*                                            /* display                                                      */,
648     Window                                              /* w                                                            */,
649     XTextProperty*                                      /* text_prop                                                    */
650 );
651 
652 extern void XSetWMName(
653     Display*                                            /* display                                                      */,
654     Window                                              /* w                                                            */,
655     XTextProperty*                                      /* text_prop                                                    */
656 );
657 
658 extern void XSetWMNormalHints(
659     Display*                                            /* display                                                      */,
660     Window                                              /* w                                                            */,
661     XSizeHints*                                         /* hints                                                        */
662 );
663 
664 extern void XSetWMProperties(
665     Display*                                            /* display                                                      */,
666     Window                                              /* w                                                            */,
667     XTextProperty*                                      /* window_name                                                  */,
668     XTextProperty*                                      /* icon_name                                                    */,
669     char**                                              /* argv                                                         */,
670     int                                                 /* argc                                                         */,
671     XSizeHints*                                         /* normal_hints                                                 */,
672     XWMHints*                                           /* wm_hints                                                     */,
673     XClassHint*                                         /* class_hints                                                  */
674 );
675 
676 extern void XmbSetWMProperties(
677     Display*                                            /* display                                                      */,
678     Window                                              /* w                                                            */,
679     char*                                               /* window_name                                                  */,
680     char*                                               /* icon_name                                                    */,
681     char**                                              /* argv                                                         */,
682     int                                                 /* argc                                                         */,
683     XSizeHints*                                         /* normal_hints                                                 */,
684     XWMHints*                                           /* wm_hints                                                     */,
685     XClassHint*                                         /* class_hints                                                  */
686 );
687 
688 extern void Xutf8SetWMProperties(
689     Display*                                            /* display                                                      */,
690     Window                                              /* w                                                            */,
691     char*                                               /* window_name                                                  */,
692     char*                                               /* icon_name                                                    */,
693     char**                                              /* argv                                                         */,
694     int                                                 /* argc                                                         */,
695     XSizeHints*                                         /* normal_hints                                                 */,
696     XWMHints*                                           /* wm_hints                                                     */,
697     XClassHint*                                         /* class_hints                                                  */
698 );
699 
700 extern void XSetWMSizeHints(
701     Display*                                            /* display                                                      */,
702     Window                                              /* w                                                            */,
703     XSizeHints*                                         /* hints                                                        */,
704     Atom                                                /* property                                                     */
705 );
706 
707 extern int XSetRegion(
708     Display*                                            /* display                                                      */,
709     GC                                                  /* gc                                                           */,
710     Region                                              /* r                                                            */
711 );
712 
713 extern void XSetStandardColormap(
714     Display*                                            /* display                                                      */,
715     Window                                              /* w                                                            */,
716     XStandardColormap*                                  /* colormap                                                     */,
717     Atom                                                /* property                                                     */
718 );
719 
720 extern int XSetZoomHints(
721     Display*                                            /* display                                                      */,
722     Window                                              /* w                                                            */,
723     XSizeHints*                                         /* zhints                                                       */
724 );
725 
726 extern int XShrinkRegion(
727     Region                                              /* r                                                            */,
728     int                                                 /* dx                                                           */,
729     int                                                 /* dy                                                           */
730 );
731 
732 extern Status XStringListToTextProperty(
733     char**                                              /* list                                                         */,
734     int                                                 /* count                                                        */,
735     XTextProperty*                                      /* text_prop_return                                             */
736 );
737 
738 extern int XSubtractRegion(
739     Region                                              /* sra                                                          */,
740     Region                                              /* srb                                                          */,
741     Region                                              /* dr_return                                                    */
742 );
743 
744 extern int XmbTextListToTextProperty(
745     Display*        display,
746     char**      list,
747     int         count,
748     XICCEncodingStyle   style,
749     XTextProperty*  text_prop_return
750 );
751 
752 extern int XwcTextListToTextProperty(
753     Display*            display,
754     wchar**             list,
755     int                 count,
756     XICCEncodingStyle   style,
757     XTextProperty*      text_prop_return
758 );
759 
760 extern int Xutf8TextListToTextProperty(
761     Display*            display,
762     char**              list,
763     int                 count,
764     XICCEncodingStyle   style,
765     XTextProperty*      text_prop_return
766 );
767 
768 extern void XwcFreeStringList(
769     wchar**             list
770 );
771 
772 extern Status XTextPropertyToStringList(
773     XTextProperty*                                      /* text_prop                                                    */,
774     char***                                             /* list_return                                                  */,
775     int*                                                /* count_return                                                 */
776 );
777 
778 extern int XmbTextPropertyToTextList(
779     Display*                display,
780     const XTextProperty*    text_prop,
781     char***                 list_return,
782     int*                    count_return
783 );
784 
785 extern int XwcTextPropertyToTextList(
786     Display*                display,
787     const XTextProperty*    text_prop,
788     wchar***                list_return,
789     int*                    count_return
790 );
791 
792 extern int Xutf8TextPropertyToTextList(
793     Display*                display,
794     const XTextProperty*    text_prop,
795     char***                 list_return,
796     int*                    count_return
797 );
798 
799 extern int XUnionRectWithRegion(
800     XRectangle*                                         /* rectangle                                                    */,
801     Region                                              /* src_region                                                   */,
802     Region                                              /* dest_region_return                                           */
803 );
804 
805 extern int XUnionRegion(
806     Region                                              /* sra                                                          */,
807     Region                                              /* srb                                                          */,
808     Region                                              /* dr_return                                                    */
809 );
810 
811 extern int XWMGeometry(
812     Display*                                            /* display                                                      */,
813     int                                                 /* screen_number                                                */,
814     char*                                               /* user_geometry                                                */,
815     char*                                               /* default_geometry                                             */,
816     uint                                                /* border_width                                                 */,
817     XSizeHints*                                         /* hints                                                        */,
818     int*                                                /* x_return                                                     */,
819     int*                                                /* y_return                                                     */,
820     int*                                                /* width_return                                                 */,
821     int*                                                /* height_return                                                */,
822     int*                                                /* gravity_return                                               */
823 );
824 
825 extern int XXorRegion(
826     Region                                              /* sra                                                          */,
827     Region                                              /* srb                                                          */,
828     Region                                              /* dr_return                                                    */
829 );