1 /* $XConsortium: Xutil.h,v 11.73 91/07/30 16:21:37 rws Exp $ */
3 /***********************************************************
4 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
5 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
9 Permission to use, copy, modify, and distribute this software and its
10 documentation for any purpose and without fee is hereby granted,
11 provided that the above copyright notice appear in all copies and that
12 both that copyright notice and this permission notice appear in
13 supporting documentation, and that the names of Digital or MIT not be
14 used in advertising or publicity pertaining to distribution of the
15 software without specific, written prior permission.
17 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
18 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
19 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
20 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
22 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
25 ******************************************************************/
30 /* You must include <X11/Xlib.h> before including this file */
32 #if defined(MAC_OSX_TK)
33 # define Region XRegion
37 * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
38 * value (x, y, width, height) was found in the parsed string.
40 #define NoValue 0x0000
43 #define WidthValue 0x0004
44 #define HeightValue 0x0008
45 #define AllValues 0x000F
46 #define XNegative 0x0010
47 #define YNegative 0x0020
50 * new version containing base_width, base_height, and win_gravity fields;
51 * used with WM_NORMAL_HINTS.
54 long flags
; /* marks which fields in this structure are defined */
55 int x
, y
; /* obsolete for new window mgrs, but clients */
56 int width
, height
; /* should set so old wm's don't mess up */
57 int min_width
, min_height
;
58 int max_width
, max_height
;
59 int width_inc
, height_inc
;
61 int x
; /* numerator */
62 int y
; /* denominator */
63 } min_aspect
, max_aspect
;
64 int base_width
, base_height
; /* added by ICCCM version 1 */
65 int win_gravity
; /* added by ICCCM version 1 */
69 * The next block of definitions are for window manager properties that
70 * clients and applications use for communication.
73 /* flags argument in size hints */
74 #define USPosition (1L << 0) /* user specified x, y */
75 #define USSize (1L << 1) /* user specified width, height */
77 #define PPosition (1L << 2) /* program specified position */
78 #define PSize (1L << 3) /* program specified size */
79 #define PMinSize (1L << 4) /* program specified minimum size */
80 #define PMaxSize (1L << 5) /* program specified maximum size */
81 #define PResizeInc (1L << 6) /* program specified resize increments */
82 #define PAspect (1L << 7) /* program specified min and max aspect ratios */
83 #define PBaseSize (1L << 8) /* program specified base for incrementing */
84 #define PWinGravity (1L << 9) /* program specified window gravity */
87 #define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
92 long flags
; /* marks which fields in this structure are defined */
93 Bool input
; /* does this application rely on the window manager to
94 get keyboard input? */
95 int initial_state
; /* see below */
96 Pixmap icon_pixmap
; /* pixmap to be used as icon */
97 Window icon_window
; /* window to be used as icon */
98 int icon_x
, icon_y
; /* initial position of icon */
99 Pixmap icon_mask
; /* icon mask bitmap */
100 XID window_group
; /* id of related window group */
101 /* this structure may be extended in the future */
104 /* definition for flags of XWMHints */
106 #define InputHint (1L << 0)
107 #define StateHint (1L << 1)
108 #define IconPixmapHint (1L << 2)
109 #define IconWindowHint (1L << 3)
110 #define IconPositionHint (1L << 4)
111 #define IconMaskHint (1L << 5)
112 #define WindowGroupHint (1L << 6)
113 #define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
114 IconPositionHint|IconMaskHint|WindowGroupHint)
116 /* definitions for initial window state */
117 #define WithdrawnState 0 /* for windows that are not mapped */
118 #define NormalState 1 /* most applications want to start this way */
119 #define IconicState 3 /* application wants to start as an icon */
122 * Obsolete states no longer defined by ICCCM
124 #define DontCareState 0 /* don't know or care */
125 #define ZoomState 2 /* application wants to start zoomed */
126 #define InactiveState 4 /* application believes it is seldom used; */
127 /* some wm's may put it on inactive menu */
131 * new structure for manipulating TEXT properties; used with WM_NAME,
132 * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
135 unsigned char *value
; /* same as Property routines */
136 Atom encoding
; /* prop type */
137 int format
; /* prop data format: 8, 16, or 32 */
138 unsigned long nitems
; /* number of data items in value */
142 #define XLocaleNotSupported -2
143 #define XConverterNotFound -3
146 XStringStyle
, /* STRING */
147 XCompoundTextStyle
, /* COMPOUND_TEXT */
148 XTextStyle
, /* text in owner's encoding (current locale)*/
149 XStdICCTextStyle
/* STRING, else COMPOUND_TEXT */
153 int min_width
, min_height
;
154 int max_width
, max_height
;
155 int width_inc
, height_inc
;
164 * These macros are used to give some sugar to the image routines so that
165 * naive people are more comfortable with them.
167 #define XDestroyImage(ximage) \
168 ((*((ximage)->f.destroy_image))((ximage)))
169 #define XGetPixel(ximage, x, y) \
170 ((*((ximage)->f.get_pixel))((ximage), (x), (y)))
171 #define XPutPixel(ximage, x, y, pixel) \
172 ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
173 #define XSubImage(ximage, x, y, width, height) \
174 ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
175 #define XAddPixel(ximage, value) \
176 ((*((ximage)->f.add_pixel))((ximage), (value)))
179 * Compose sequence status structure, used in calling XLookupString.
181 typedef struct _XComposeStatus
{
182 XPointer compose_ptr
; /* state table pointer */
183 int chars_matched
; /* match state */
187 * Keysym macros, used on Keysyms to test for classes of symbols
189 #define IsKeypadKey(keysym) \
190 (((unsigned)(keysym) >= XK_KP_Space) && ((unsigned)(keysym) <= XK_KP_Equal))
192 #define IsCursorKey(keysym) \
193 (((unsigned)(keysym) >= XK_Home) && ((unsigned)(keysym) < XK_Select))
195 #define IsPFKey(keysym) \
196 (((unsigned)(keysym) >= XK_KP_F1) && ((unsigned)(keysym) <= XK_KP_F4))
198 #define IsFunctionKey(keysym) \
199 (((unsigned)(keysym) >= XK_F1) && ((unsigned)(keysym) <= XK_F35))
201 #define IsMiscFunctionKey(keysym) \
202 (((unsigned)(keysym) >= XK_Select) && ((unsigned)(keysym) <= XK_Break))
204 #define IsModifierKey(keysym) \
205 ((((unsigned)(keysym) >= XK_Shift_L) && ((unsigned)(keysym) <= XK_Hyper_R)) \
206 || ((unsigned)(keysym) == XK_Mode_switch) \
207 || ((unsigned)(keysym) == XK_Num_Lock))
209 * opaque reference to Region data type
211 typedef struct _XRegion
*Region
;
213 /* Return values from XRectInRegion() */
215 #define RectangleOut 0
216 #define RectangleIn 1
217 #define RectanglePart 2
221 * Information used by the visual utility routines to find desired visual
222 * type from the many visuals a display may support.
230 #if defined(__cplusplus) || defined(c_plusplus)
231 int c_class
; /* C++ */
235 unsigned long red_mask
;
236 unsigned long green_mask
;
237 unsigned long blue_mask
;
242 #define VisualNoMask 0x0
243 #define VisualIDMask 0x1
244 #define VisualScreenMask 0x2
245 #define VisualDepthMask 0x4
246 #define VisualClassMask 0x8
247 #define VisualRedMaskMask 0x10
248 #define VisualGreenMaskMask 0x20
249 #define VisualBlueMaskMask 0x40
250 #define VisualColormapSizeMask 0x80
251 #define VisualBitsPerRGBMask 0x100
252 #define VisualAllMask 0x1FF
255 * This defines a window manager property that clients may use to
256 * share standard color maps of type RGB_COLOR_MAP:
260 unsigned long red_max
;
261 unsigned long red_mult
;
262 unsigned long green_max
;
263 unsigned long green_mult
;
264 unsigned long blue_max
;
265 unsigned long blue_mult
;
266 unsigned long base_pixel
;
267 VisualID visualid
; /* added by ICCCM version 1 */
268 XID killid
; /* added by ICCCM version 1 */
271 #define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */
275 * return codes for XReadBitmapFile and XWriteBitmapFile
277 #define BitmapSuccess 0
278 #define BitmapOpenFailed 1
279 #define BitmapFileInvalid 2
280 #define BitmapNoMemory 3
282 /****************************************************************
286 ****************************************************************/
289 /* Associative lookup table return codes */
291 #define XCSUCCESS 0 /* No error. */
292 #define XCNOMEM 1 /* Out of memory */
293 #define XCNOENT 2 /* No entry in table */
295 typedef int XContext
;
297 #define XUniqueContext() ((XContext) XrmUniqueQuark())
298 #define XStringToContext(string) ((XContext) XrmStringToQuark(string))
302 /* The following declarations are alphabetized. */
304 extern XClassHint
*XAllocClassHint (
305 #if NeedFunctionPrototypes
310 extern XIconSize
*XAllocIconSize (
311 #if NeedFunctionPrototypes
316 extern XSizeHints
*XAllocSizeHints (
317 #if NeedFunctionPrototypes
322 extern XStandardColormap
*XAllocStandardColormap (
323 #if NeedFunctionPrototypes
328 extern XWMHints
*XAllocWMHints (
329 #if NeedFunctionPrototypes
334 extern void XClipBox(
335 #if NeedFunctionPrototypes
337 XRectangle
* /* rect_return */
341 extern Region
XCreateRegion(
342 #if NeedFunctionPrototypes
347 extern char *XDefaultString(
348 #if NeedFunctionPrototypes
353 extern int XDeleteContext(
354 #if NeedFunctionPrototypes
355 Display
* /* display */,
357 XContext
/* context */
361 extern void XDestroyRegion(
362 #if NeedFunctionPrototypes
367 extern Bool
XEmptyRegion(
368 #if NeedFunctionPrototypes
373 extern Bool
XEqualRegion(
374 #if NeedFunctionPrototypes
380 extern int XFindContext(
381 #if NeedFunctionPrototypes
382 Display
* /* display */,
384 XContext
/* context */,
385 XPointer
* /* data_return */
389 extern Status
XGetClassHint(
390 #if NeedFunctionPrototypes
391 Display
* /* display */,
393 XClassHint
* /* class_hints_return */
397 extern Status
XGetIconSizes(
398 #if NeedFunctionPrototypes
399 Display
* /* display */,
401 XIconSize
** /* size_list_return */,
402 int* /* count_return */
406 extern Status
XGetNormalHints(
407 #if NeedFunctionPrototypes
408 Display
* /* display */,
410 XSizeHints
* /* hints_return */
414 extern Status
XGetRGBColormaps(
415 #if NeedFunctionPrototypes
416 Display
* /* display */,
418 XStandardColormap
** /* stdcmap_return */,
419 int* /* count_return */,
424 extern Status
XGetSizeHints(
425 #if NeedFunctionPrototypes
426 Display
* /* display */,
428 XSizeHints
* /* hints_return */,
433 extern Status
XGetStandardColormap(
434 #if NeedFunctionPrototypes
435 Display
* /* display */,
437 XStandardColormap
* /* colormap_return */,
442 extern Status
XGetTextProperty(
443 #if NeedFunctionPrototypes
444 Display
* /* display */,
446 XTextProperty
* /* text_prop_return */,
452 extern Status
XGetWMClientMachine(
453 #if NeedFunctionPrototypes
454 Display
* /* display */,
456 XTextProperty
* /* text_prop_return */
460 extern XWMHints
*XGetWMHints(
461 #if NeedFunctionPrototypes
462 Display
* /* display */,
467 extern Status
XGetWMIconName(
468 #if NeedFunctionPrototypes
469 Display
* /* display */,
471 XTextProperty
* /* text_prop_return */
475 extern Status
XGetWMName(
476 #if NeedFunctionPrototypes
477 Display
* /* display */,
479 XTextProperty
* /* text_prop_return */
483 extern Status
XGetWMNormalHints(
484 #if NeedFunctionPrototypes
485 Display
* /* display */,
487 XSizeHints
* /* hints_return */,
488 long* /* supplied_return */
492 extern Status
XGetWMSizeHints(
493 #if NeedFunctionPrototypes
494 Display
* /* display */,
496 XSizeHints
* /* hints_return */,
497 long* /* supplied_return */,
502 extern Status
XGetZoomHints(
503 #if NeedFunctionPrototypes
504 Display
* /* display */,
506 XSizeHints
* /* zhints_return */
510 extern void XIntersectRegion(
511 #if NeedFunctionPrototypes
514 Region
/* dr_return */
518 extern int XLookupString(
519 #if NeedFunctionPrototypes
520 XKeyEvent
* /* event_struct */,
521 char* /* buffer_return */,
522 int /* bytes_buffer */,
523 KeySym
* /* keysym_return */,
524 XComposeStatus
* /* status_in_out */
528 extern Status
XMatchVisualInfo(
529 #if NeedFunctionPrototypes
530 Display
* /* display */,
534 XVisualInfo
* /* vinfo_return */
538 extern void XOffsetRegion(
539 #if NeedFunctionPrototypes
546 extern Bool
XPointInRegion(
547 #if NeedFunctionPrototypes
554 extern Region
XPolygonRegion(
555 #if NeedFunctionPrototypes
556 XPoint
* /* points */,
562 extern int XRectInRegion(
563 #if NeedFunctionPrototypes
567 unsigned int /* width */,
568 unsigned int /* height */
572 extern int XSaveContext(
573 #if NeedFunctionPrototypes
574 Display
* /* display */,
576 XContext
/* context */,
577 _Xconst
char* /* data */
581 extern void XSetClassHint(
582 #if NeedFunctionPrototypes
583 Display
* /* display */,
585 XClassHint
* /* class_hints */
589 extern void XSetIconSizes(
590 #if NeedFunctionPrototypes
591 Display
* /* display */,
593 XIconSize
* /* size_list */,
598 extern void XSetNormalHints(
599 #if NeedFunctionPrototypes
600 Display
* /* display */,
602 XSizeHints
* /* hints */
606 extern void XSetRGBColormaps(
607 #if NeedFunctionPrototypes
608 Display
* /* display */,
610 XStandardColormap
* /* stdcmaps */,
616 extern void XSetSizeHints(
617 #if NeedFunctionPrototypes
618 Display
* /* display */,
620 XSizeHints
* /* hints */,
625 extern void XSetStandardProperties(
626 #if NeedFunctionPrototypes
627 Display
* /* display */,
629 _Xconst
char* /* window_name */,
630 _Xconst
char* /* icon_name */,
631 Pixmap
/* icon_pixmap */,
634 XSizeHints
* /* hints */
638 extern void XSetTextProperty(
639 #if NeedFunctionPrototypes
640 Display
* /* display */,
642 XTextProperty
* /* text_prop */,
647 extern void XSetWMHints(
648 #if NeedFunctionPrototypes
649 Display
* /* display */,
651 XWMHints
* /* wm_hints */
655 extern void XSetWMIconName(
656 #if NeedFunctionPrototypes
657 Display
* /* display */,
659 XTextProperty
* /* text_prop */
663 extern void XSetWMName(
664 #if NeedFunctionPrototypes
665 Display
* /* display */,
667 XTextProperty
* /* text_prop */
671 extern void XSetWMNormalHints(
672 #if NeedFunctionPrototypes
673 Display
* /* display */,
675 XSizeHints
* /* hints */
679 extern void XSetWMProperties(
680 #if NeedFunctionPrototypes
681 Display
* /* display */,
683 XTextProperty
* /* window_name */,
684 XTextProperty
* /* icon_name */,
687 XSizeHints
* /* normal_hints */,
688 XWMHints
* /* wm_hints */,
689 XClassHint
* /* class_hints */
693 extern void XmbSetWMProperties(
694 #if NeedFunctionPrototypes
695 Display
* /* display */,
697 _Xconst
char* /* window_name */,
698 _Xconst
char* /* icon_name */,
701 XSizeHints
* /* normal_hints */,
702 XWMHints
* /* wm_hints */,
703 XClassHint
* /* class_hints */
707 extern void XSetWMSizeHints(
708 #if NeedFunctionPrototypes
709 Display
* /* display */,
711 XSizeHints
* /* hints */,
716 extern void XSetRegion(
717 #if NeedFunctionPrototypes
718 Display
* /* display */,
724 extern void XSetStandardColormap(
725 #if NeedFunctionPrototypes
726 Display
* /* display */,
728 XStandardColormap
* /* colormap */,
733 extern void XSetZoomHints(
734 #if NeedFunctionPrototypes
735 Display
* /* display */,
737 XSizeHints
* /* zhints */
741 extern void XShrinkRegion(
742 #if NeedFunctionPrototypes
749 extern void XSubtractRegion(
750 #if NeedFunctionPrototypes
753 Region
/* dr_return */
757 extern int XmbTextListToTextProperty(
758 #if NeedFunctionPrototypes
759 Display
* /* display */,
762 XICCEncodingStyle
/* style */,
763 XTextProperty
* /* text_prop_return */
767 extern int XwcTextListToTextProperty(
768 #if NeedFunctionPrototypes
769 Display
* /* display */,
770 wchar_t** /* list */,
772 XICCEncodingStyle
/* style */,
773 XTextProperty
* /* text_prop_return */
777 extern void XwcFreeStringList(
778 #if NeedFunctionPrototypes
783 extern Status
XTextPropertyToStringList(
784 #if NeedFunctionPrototypes
785 XTextProperty
* /* text_prop */,
786 char*** /* list_return */,
787 int* /* count_return */
791 extern int XmbTextPropertyToTextList(
792 #if NeedFunctionPrototypes
793 Display
* /* display */,
794 XTextProperty
* /* text_prop */,
795 char*** /* list_return */,
796 int* /* count_return */
800 extern int XwcTextPropertyToTextList(
801 #if NeedFunctionPrototypes
802 Display
* /* display */,
803 XTextProperty
* /* text_prop */,
804 wchar_t*** /* list_return */,
805 int* /* count_return */
809 extern void XUnionRectWithRegion(
810 #if NeedFunctionPrototypes
811 XRectangle
* /* rectangle */,
812 Region
/* src_region */,
813 Region
/* dest_region_return */
817 extern void XUnionRegion(
818 #if NeedFunctionPrototypes
821 Region
/* dr_return */
825 extern int XWMGeometry(
826 #if NeedFunctionPrototypes
827 Display
* /* display */,
828 int /* screen_number */,
829 _Xconst
char* /* user_geometry */,
830 _Xconst
char* /* default_geometry */,
831 unsigned int /* border_width */,
832 XSizeHints
* /* hints */,
835 int* /* width_return */,
836 int* /* height_return */,
837 int* /* gravity_return */
841 extern void XXorRegion(
842 #if NeedFunctionPrototypes
845 Region
/* dr_return */
851 #if defined(MAC_OSX_TK)
855 #endif /* _XUTIL_H_ */