2
/***********************************************************
4
Copyright 1987, 1998 The Open Group
6
Permission to use, copy, modify, distribute, and sell this software and its
7
documentation for any purpose is hereby granted without fee, provided that
8
the above copyright notice appear in all copies and that both that
9
copyright notice and this permission notice appear in supporting
12
The above copyright notice and this permission notice shall be included in
13
all copies or substantial portions of the Software.
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
Except as contained in this notice, the name of The Open Group shall not be
23
used in advertising or otherwise to promote the sale, use or other dealings
24
in this Software without prior written authorization from The Open Group.
27
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
31
Permission to use, copy, modify, and distribute this software and its
32
documentation for any purpose and without fee is hereby granted,
33
provided that the above copyright notice appear in all copies and that
34
both that copyright notice and this permission notice appear in
35
supporting documentation, and that the name of Digital not be
36
used in advertising or publicity pertaining to distribution of the
37
software without specific, written prior permission.
39
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
40
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
41
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
42
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
43
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
44
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
47
******************************************************************/
52
/* You must include <X11/Xlib.h> before including this file */
54
#include <X11/keysym.h>
57
* Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
58
* value (x, y, width, height) was found in the parsed string.
60
#define NoValue 0x0000
63
#define WidthValue 0x0004
64
#define HeightValue 0x0008
65
#define AllValues 0x000F
66
#define XNegative 0x0010
67
#define YNegative 0x0020
70
* new version containing base_width, base_height, and win_gravity fields;
71
* used with WM_NORMAL_HINTS.
74
long flags; /* marks which fields in this structure are defined */
75
int x, y; /* obsolete for new window mgrs, but clients */
76
int width, height; /* should set so old wm's don't mess up */
77
int min_width, min_height;
78
int max_width, max_height;
79
int width_inc, height_inc;
81
int x; /* numerator */
82
int y; /* denominator */
83
} min_aspect, max_aspect;
84
int base_width, base_height; /* added by ICCCM version 1 */
85
int win_gravity; /* added by ICCCM version 1 */
89
* The next block of definitions are for window manager properties that
90
* clients and applications use for communication.
93
/* flags argument in size hints */
94
#define USPosition (1L << 0) /* user specified x, y */
95
#define USSize (1L << 1) /* user specified width, height */
97
#define PPosition (1L << 2) /* program specified position */
98
#define PSize (1L << 3) /* program specified size */
99
#define PMinSize (1L << 4) /* program specified minimum size */
100
#define PMaxSize (1L << 5) /* program specified maximum size */
101
#define PResizeInc (1L << 6) /* program specified resize increments */
102
#define PAspect (1L << 7) /* program specified min and max aspect ratios */
103
#define PBaseSize (1L << 8) /* program specified base for incrementing */
104
#define PWinGravity (1L << 9) /* program specified window gravity */
107
#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
112
long flags; /* marks which fields in this structure are defined */
113
Bool input; /* does this application rely on the window manager to
114
get keyboard input? */
115
int initial_state; /* see below */
116
Pixmap icon_pixmap; /* pixmap to be used as icon */
117
Window icon_window; /* window to be used as icon */
118
int icon_x, icon_y; /* initial position of icon */
119
Pixmap icon_mask; /* icon mask bitmap */
120
XID window_group; /* id of related window group */
121
/* this structure may be extended in the future */
124
/* definition for flags of XWMHints */
126
#define InputHint (1L << 0)
127
#define StateHint (1L << 1)
128
#define IconPixmapHint (1L << 2)
129
#define IconWindowHint (1L << 3)
130
#define IconPositionHint (1L << 4)
131
#define IconMaskHint (1L << 5)
132
#define WindowGroupHint (1L << 6)
133
#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
134
IconPositionHint|IconMaskHint|WindowGroupHint)
135
#define XUrgencyHint (1L << 8)
137
/* definitions for initial window state */
138
#define WithdrawnState 0 /* for windows that are not mapped */
139
#define NormalState 1 /* most applications want to start this way */
140
#define IconicState 3 /* application wants to start as an icon */
143
* Obsolete states no longer defined by ICCCM
145
#define DontCareState 0 /* don't know or care */
146
#define ZoomState 2 /* application wants to start zoomed */
147
#define InactiveState 4 /* application believes it is seldom used; */
148
/* some wm's may put it on inactive menu */
152
* new structure for manipulating TEXT properties; used with WM_NAME,
153
* WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
156
unsigned char *value; /* same as Property routines */
157
Atom encoding; /* prop type */
158
int format; /* prop data format: 8, 16, or 32 */
159
unsigned long nitems; /* number of data items in value */
163
#define XLocaleNotSupported -2
164
#define XConverterNotFound -3
167
XStringStyle, /* STRING */
168
XCompoundTextStyle, /* COMPOUND_TEXT */
169
XTextStyle, /* text in owner's encoding (current locale)*/
170
XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */
171
/* The following is an XFree86 extension, introduced in November 2000 */
172
XUTF8StringStyle /* UTF8_STRING */
176
int min_width, min_height;
177
int max_width, max_height;
178
int width_inc, height_inc;
186
#ifdef XUTIL_DEFINE_FUNCTIONS
187
extern int XDestroyImage(
189
extern unsigned long XGetPixel(
192
extern int XPutPixel(
195
unsigned long pixel);
196
extern XImage *XSubImage(
199
unsigned int width, unsigned int height);
200
extern int XAddPixel(
205
* These macros are used to give some sugar to the image routines so that
206
* naive people are more comfortable with them.
208
#define XDestroyImage(ximage) \
209
((*((ximage)->f.destroy_image))((ximage)))
210
#define XGetPixel(ximage, x, y) \
211
((*((ximage)->f.get_pixel))((ximage), (x), (y)))
212
#define XPutPixel(ximage, x, y, pixel) \
213
((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
214
#define XSubImage(ximage, x, y, width, height) \
215
((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
216
#define XAddPixel(ximage, value) \
217
((*((ximage)->f.add_pixel))((ximage), (value)))
221
* Compose sequence status structure, used in calling XLookupString.
223
typedef struct _XComposeStatus {
224
XPointer compose_ptr; /* state table pointer */
225
int chars_matched; /* match state */
229
* Keysym macros, used on Keysyms to test for classes of symbols
231
#define IsKeypadKey(keysym) \
232
(((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal))
234
#define IsPrivateKeypadKey(keysym) \
235
(((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
237
#define IsCursorKey(keysym) \
238
(((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select))
240
#define IsPFKey(keysym) \
241
(((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4))
243
#define IsFunctionKey(keysym) \
244
(((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35))
246
#define IsMiscFunctionKey(keysym) \
247
(((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break))
250
#define IsModifierKey(keysym) \
251
((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
252
|| (((KeySym)(keysym) >= XK_ISO_Lock) && \
253
((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \
254
|| ((KeySym)(keysym) == XK_Mode_switch) \
255
|| ((KeySym)(keysym) == XK_Num_Lock))
257
#define IsModifierKey(keysym) \
258
((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
259
|| ((KeySym)(keysym) == XK_Mode_switch) \
260
|| ((KeySym)(keysym) == XK_Num_Lock))
263
* opaque reference to Region data type
265
typedef struct _XRegion *Region;
267
/* Return values from XRectInRegion() */
269
#define RectangleOut 0
270
#define RectangleIn 1
271
#define RectanglePart 2
275
* Information used by the visual utility routines to find desired visual
276
* type from the many visuals a display may support.
284
#if defined(__cplusplus) || defined(c_plusplus)
285
int c_class; /* C++ */
289
unsigned long red_mask;
290
unsigned long green_mask;
291
unsigned long blue_mask;
296
#define VisualNoMask 0x0
297
#define VisualIDMask 0x1
298
#define VisualScreenMask 0x2
299
#define VisualDepthMask 0x4
300
#define VisualClassMask 0x8
301
#define VisualRedMaskMask 0x10
302
#define VisualGreenMaskMask 0x20
303
#define VisualBlueMaskMask 0x40
304
#define VisualColormapSizeMask 0x80
305
#define VisualBitsPerRGBMask 0x100
306
#define VisualAllMask 0x1FF
309
* This defines a window manager property that clients may use to
310
* share standard color maps of type RGB_COLOR_MAP:
314
unsigned long red_max;
315
unsigned long red_mult;
316
unsigned long green_max;
317
unsigned long green_mult;
318
unsigned long blue_max;
319
unsigned long blue_mult;
320
unsigned long base_pixel;
321
VisualID visualid; /* added by ICCCM version 1 */
322
XID killid; /* added by ICCCM version 1 */
325
#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */
329
* return codes for XReadBitmapFile and XWriteBitmapFile
331
#define BitmapSuccess 0
332
#define BitmapOpenFailed 1
333
#define BitmapFileInvalid 2
334
#define BitmapNoMemory 3
336
/****************************************************************
340
****************************************************************/
343
/* Associative lookup table return codes */
345
#define XCSUCCESS 0 /* No error. */
346
#define XCNOMEM 1 /* Out of memory */
347
#define XCNOENT 2 /* No entry in table */
349
typedef int XContext;
351
#define XUniqueContext() ((XContext) XrmUniqueQuark())
352
#define XStringToContext(string) ((XContext) XrmStringToQuark(string))
356
/* The following declarations are alphabetized. */
358
extern XClassHint *XAllocClassHint (
362
extern XIconSize *XAllocIconSize (
366
extern XSizeHints *XAllocSizeHints (
370
extern XStandardColormap *XAllocStandardColormap (
374
extern XWMHints *XAllocWMHints (
380
XRectangle* /* rect_return */
383
extern Region XCreateRegion(
387
extern const char *XDefaultString (void);
389
extern int XDeleteContext(
390
Display* /* display */,
392
XContext /* context */
395
extern int XDestroyRegion(
399
extern int XEmptyRegion(
403
extern int XEqualRegion(
408
extern int XFindContext(
409
Display* /* display */,
411
XContext /* context */,
412
XPointer* /* data_return */
415
extern Status XGetClassHint(
416
Display* /* display */,
418
XClassHint* /* class_hints_return */
421
extern Status XGetIconSizes(
422
Display* /* display */,
424
XIconSize** /* size_list_return */,
425
int* /* count_return */
428
extern Status XGetNormalHints(
429
Display* /* display */,
431
XSizeHints* /* hints_return */
434
extern Status XGetRGBColormaps(
435
Display* /* display */,
437
XStandardColormap** /* stdcmap_return */,
438
int* /* count_return */,
442
extern Status XGetSizeHints(
443
Display* /* display */,
445
XSizeHints* /* hints_return */,
449
extern Status XGetStandardColormap(
450
Display* /* display */,
452
XStandardColormap* /* colormap_return */,
456
extern Status XGetTextProperty(
457
Display* /* display */,
459
XTextProperty* /* text_prop_return */,
463
extern XVisualInfo *XGetVisualInfo(
464
Display* /* display */,
465
long /* vinfo_mask */,
466
XVisualInfo* /* vinfo_template */,
467
int* /* nitems_return */
470
extern Status XGetWMClientMachine(
471
Display* /* display */,
473
XTextProperty* /* text_prop_return */
476
extern XWMHints *XGetWMHints(
477
Display* /* display */,
481
extern Status XGetWMIconName(
482
Display* /* display */,
484
XTextProperty* /* text_prop_return */
487
extern Status XGetWMName(
488
Display* /* display */,
490
XTextProperty* /* text_prop_return */
493
extern Status XGetWMNormalHints(
494
Display* /* display */,
496
XSizeHints* /* hints_return */,
497
long* /* supplied_return */
500
extern Status XGetWMSizeHints(
501
Display* /* display */,
503
XSizeHints* /* hints_return */,
504
long* /* supplied_return */,
508
extern Status XGetZoomHints(
509
Display* /* display */,
511
XSizeHints* /* zhints_return */
514
extern int XIntersectRegion(
517
Region /* dr_return */
520
extern void XConvertCase(
526
extern int XLookupString(
527
XKeyEvent* /* event_struct */,
528
char* /* buffer_return */,
529
int /* bytes_buffer */,
530
KeySym* /* keysym_return */,
531
XComposeStatus* /* status_in_out */
534
extern Status XMatchVisualInfo(
535
Display* /* display */,
539
XVisualInfo* /* vinfo_return */
542
extern int XOffsetRegion(
548
extern Bool XPointInRegion(
554
extern Region XPolygonRegion(
555
XPoint* /* points */,
560
extern int XRectInRegion(
564
unsigned int /* width */,
565
unsigned int /* height */
568
extern int XSaveContext(
569
Display* /* display */,
571
XContext /* context */,
572
_Xconst char* /* data */
575
extern int XSetClassHint(
576
Display* /* display */,
578
XClassHint* /* class_hints */
581
extern int XSetIconSizes(
582
Display* /* display */,
584
XIconSize* /* size_list */,
588
extern int XSetNormalHints(
589
Display* /* display */,
591
XSizeHints* /* hints */
594
extern void XSetRGBColormaps(
595
Display* /* display */,
597
XStandardColormap* /* stdcmaps */,
602
extern int XSetSizeHints(
603
Display* /* display */,
605
XSizeHints* /* hints */,
609
extern int XSetStandardProperties(
610
Display* /* display */,
612
_Xconst char* /* window_name */,
613
_Xconst char* /* icon_name */,
614
Pixmap /* icon_pixmap */,
617
XSizeHints* /* hints */
620
extern void XSetTextProperty(
621
Display* /* display */,
623
XTextProperty* /* text_prop */,
627
extern void XSetWMClientMachine(
628
Display* /* display */,
630
XTextProperty* /* text_prop */
633
extern int XSetWMHints(
634
Display* /* display */,
636
XWMHints* /* wm_hints */
639
extern void XSetWMIconName(
640
Display* /* display */,
642
XTextProperty* /* text_prop */
645
extern void XSetWMName(
646
Display* /* display */,
648
XTextProperty* /* text_prop */
651
extern void XSetWMNormalHints(
652
Display* /* display */,
654
XSizeHints* /* hints */
657
extern void XSetWMProperties(
658
Display* /* display */,
660
XTextProperty* /* window_name */,
661
XTextProperty* /* icon_name */,
664
XSizeHints* /* normal_hints */,
665
XWMHints* /* wm_hints */,
666
XClassHint* /* class_hints */
669
extern void XmbSetWMProperties(
670
Display* /* display */,
672
_Xconst char* /* window_name */,
673
_Xconst char* /* icon_name */,
676
XSizeHints* /* normal_hints */,
677
XWMHints* /* wm_hints */,
678
XClassHint* /* class_hints */
681
extern void Xutf8SetWMProperties(
682
Display* /* display */,
684
_Xconst char* /* window_name */,
685
_Xconst char* /* icon_name */,
688
XSizeHints* /* normal_hints */,
689
XWMHints* /* wm_hints */,
690
XClassHint* /* class_hints */
693
extern void XSetWMSizeHints(
694
Display* /* display */,
696
XSizeHints* /* hints */,
700
extern int XSetRegion(
701
Display* /* display */,
706
extern void XSetStandardColormap(
707
Display* /* display */,
709
XStandardColormap* /* colormap */,
713
extern int XSetZoomHints(
714
Display* /* display */,
716
XSizeHints* /* zhints */
719
extern int XShrinkRegion(
725
extern Status XStringListToTextProperty(
728
XTextProperty* /* text_prop_return */
731
extern int XSubtractRegion(
734
Region /* dr_return */
737
extern int XmbTextListToTextProperty(
741
XICCEncodingStyle style,
742
XTextProperty* text_prop_return
745
extern int XwcTextListToTextProperty(
749
XICCEncodingStyle style,
750
XTextProperty* text_prop_return
753
extern int Xutf8TextListToTextProperty(
757
XICCEncodingStyle style,
758
XTextProperty* text_prop_return
761
extern void XwcFreeStringList(
765
extern Status XTextPropertyToStringList(
766
XTextProperty* /* text_prop */,
767
char*** /* list_return */,
768
int* /* count_return */
771
extern int XmbTextPropertyToTextList(
773
const XTextProperty* text_prop,
778
extern int XwcTextPropertyToTextList(
780
const XTextProperty* text_prop,
781
wchar_t*** list_return,
785
extern int Xutf8TextPropertyToTextList(
787
const XTextProperty* text_prop,
792
extern int XUnionRectWithRegion(
793
XRectangle* /* rectangle */,
794
Region /* src_region */,
795
Region /* dest_region_return */
798
extern int XUnionRegion(
801
Region /* dr_return */
804
extern int XWMGeometry(
805
Display* /* display */,
806
int /* screen_number */,
807
_Xconst char* /* user_geometry */,
808
_Xconst char* /* default_geometry */,
809
unsigned int /* border_width */,
810
XSizeHints* /* hints */,
813
int* /* width_return */,
814
int* /* height_return */,
815
int* /* gravity_return */
818
extern int XXorRegion(
821
Region /* dr_return */
826
#endif /* _X11_XUTIL_H_ */