1 /* $XConsortium: Xutil.h,v 11.78 94/04/17 20:21:56 rws Exp $ */
2 /* $XFree86: xc/lib/X11/Xutil.h,v 3.0 1996/12/09 11:49:36 dawes Exp $ */
4 /***********************************************************
6 Copyright (c) 1987 X Consortium
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the Software is
13 furnished to do so, subject to the following conditions:
15 The above copyright notice and this permission notice shall be included in
16 all copies or substantial portions of the Software.
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 Except as contained in this notice, the name of the X Consortium shall not be
26 used in advertising or otherwise to promote the sale, use or other dealings
27 in this Software without prior written authorization from the X Consortium.
30 Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
34 Permission to use, copy, modify, and distribute this software and its
35 documentation for any purpose and without fee is hereby granted,
36 provided that the above copyright notice appear in all copies and that
37 both that copyright notice and this permission notice appear in
38 supporting documentation, and that the name of Digital not be
39 used in advertising or publicity pertaining to distribution of the
40 software without specific, written prior permission.
42 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
43 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
44 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
45 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
46 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
47 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
50 ******************************************************************/
55 /* You must include <X11/Xlib.h> before including this file */
58 * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
59 * value (x, y, width, height) was found in the parsed string.
61 #define NoValue 0x0000
64 #define WidthValue 0x0004
65 #define HeightValue 0x0008
66 #define AllValues 0x000F
67 #define XNegative 0x0010
68 #define YNegative 0x0020
71 * new version containing base_width, base_height, and win_gravity fields;
72 * used with WM_NORMAL_HINTS.
75 long flags; /* marks which fields in this structure are defined */
76 int x, y; /* obsolete for new window mgrs, but clients */
77 int width, height; /* should set so old wm's don't mess up */
78 int min_width, min_height;
79 int max_width, max_height;
80 int width_inc, height_inc;
82 int x; /* numerator */
83 int y; /* denominator */
84 } min_aspect, max_aspect;
85 int base_width, base_height; /* added by ICCCM version 1 */
86 int win_gravity; /* added by ICCCM version 1 */
90 * The next block of definitions are for window manager properties that
91 * clients and applications use for communication.
94 /* flags argument in size hints */
95 #define USPosition (1L << 0) /* user specified x, y */
96 #define USSize (1L << 1) /* user specified width, height */
98 #define PPosition (1L << 2) /* program specified position */
99 #define PSize (1L << 3) /* program specified size */
100 #define PMinSize (1L << 4) /* program specified minimum size */
101 #define PMaxSize (1L << 5) /* program specified maximum size */
102 #define PResizeInc (1L << 6) /* program specified resize increments */
103 #define PAspect (1L << 7) /* program specified min and max aspect ratios */
104 #define PBaseSize (1L << 8) /* program specified base for incrementing */
105 #define PWinGravity (1L << 9) /* program specified window gravity */
108 #define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
113 long flags; /* marks which fields in this structure are defined */
114 Bool input; /* does this application rely on the window manager to
115 get keyboard input? */
116 int initial_state; /* see below */
117 Pixmap icon_pixmap; /* pixmap to be used as icon */
118 Window icon_window; /* window to be used as icon */
119 int icon_x, icon_y; /* initial position of icon */
120 Pixmap icon_mask; /* icon mask bitmap */
121 XID window_group; /* id of related window group */
122 /* this structure may be extended in the future */
125 /* definition for flags of XWMHints */
127 #define InputHint (1L << 0)
128 #define StateHint (1L << 1)
129 #define IconPixmapHint (1L << 2)
130 #define IconWindowHint (1L << 3)
131 #define IconPositionHint (1L << 4)
132 #define IconMaskHint (1L << 5)
133 #define WindowGroupHint (1L << 6)
134 #define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
135 IconPositionHint|IconMaskHint|WindowGroupHint)
136 #define XUrgencyHint (1L << 8)
138 /* definitions for initial window state */
139 #define WithdrawnState 0 /* for windows that are not mapped */
140 #define NormalState 1 /* most applications want to start this way */
141 #define IconicState 3 /* application wants to start as an icon */
144 * Obsolete states no longer defined by ICCCM
146 #define DontCareState 0 /* don't know or care */
147 #define ZoomState 2 /* application wants to start zoomed */
148 #define InactiveState 4 /* application believes it is seldom used; */
149 /* some wm's may put it on inactive menu */
153 * new structure for manipulating TEXT properties; used with WM_NAME,
154 * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
157 unsigned char *value; /* same as Property routines */
158 Atom encoding; /* prop type */
159 int format; /* prop data format: 8, 16, or 32 */
160 unsigned long nitems; /* number of data items in value */
164 #define XLocaleNotSupported -2
165 #define XConverterNotFound -3
168 XStringStyle, /* STRING */
169 XCompoundTextStyle, /* COMPOUND_TEXT */
170 XTextStyle, /* text in owner's encoding (current locale)*/
171 XStdICCTextStyle /* STRING, else COMPOUND_TEXT */
175 int min_width, min_height;
176 int max_width, max_height;
177 int width_inc, height_inc;
186 * These macros are used to give some sugar to the image routines so that
187 * naive people are more comfortable with them.
189 #define XDestroyImage(ximage) \
190 ((*((ximage)->f.destroy_image))((ximage)))
191 #define XGetPixel(ximage, x, y) \
192 ((*((ximage)->f.get_pixel))((ximage), (x), (y)))
193 #define XPutPixel(ximage, x, y, pixel) \
194 ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
195 #define XSubImage(ximage, x, y, width, height) \
196 ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
197 #define XAddPixel(ximage, value) \
198 ((*((ximage)->f.add_pixel))((ximage), (value)))
201 * Compose sequence status structure, used in calling XLookupString.
203 typedef struct _XComposeStatus {
204 XPointer compose_ptr; /* state table pointer */
205 int chars_matched; /* match state */
209 * Keysym macros, used on Keysyms to test for classes of symbols
211 #define IsKeypadKey(keysym) \
212 (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal))
214 #define IsPrivateKeypadKey(keysym) \
215 (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
217 #define IsCursorKey(keysym) \
218 (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select))
220 #define IsPFKey(keysym) \
221 (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4))
223 #define IsFunctionKey(keysym) \
224 (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35))
226 #define IsMiscFunctionKey(keysym) \
227 (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break))
229 #define IsModifierKey(keysym) \
230 ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \
231 || ((KeySym)(keysym) == XK_Mode_switch) \
232 || ((KeySym)(keysym) == XK_Num_Lock))
234 * opaque reference to Region data type
236 typedef struct _XRegion *Region;
238 /* Return values from XRectInRegion() */
240 #define RectangleOut 0
241 #define RectangleIn 1
242 #define RectanglePart 2
246 * Information used by the visual utility routines to find desired visual
247 * type from the many visuals a display may support.
255 #if defined(__cplusplus) || defined(c_plusplus)
256 int c_class; /* C++ */
260 unsigned long red_mask;
261 unsigned long green_mask;
262 unsigned long blue_mask;
267 #define VisualNoMask 0x0
268 #define VisualIDMask 0x1
269 #define VisualScreenMask 0x2
270 #define VisualDepthMask 0x4
271 #define VisualClassMask 0x8
272 #define VisualRedMaskMask 0x10
273 #define VisualGreenMaskMask 0x20
274 #define VisualBlueMaskMask 0x40
275 #define VisualColormapSizeMask 0x80
276 #define VisualBitsPerRGBMask 0x100
277 #define VisualAllMask 0x1FF
280 * This defines a window manager property that clients may use to
281 * share standard color maps of type RGB_COLOR_MAP:
285 unsigned long red_max;
286 unsigned long red_mult;
287 unsigned long green_max;
288 unsigned long green_mult;
289 unsigned long blue_max;
290 unsigned long blue_mult;
291 unsigned long base_pixel;
292 VisualID visualid; /* added by ICCCM version 1 */
293 XID killid; /* added by ICCCM version 1 */
296 #define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */
300 * return codes for XReadBitmapFile and XWriteBitmapFile
302 #define BitmapSuccess 0
303 #define BitmapOpenFailed 1
304 #define BitmapFileInvalid 2
305 #define BitmapNoMemory 3
307 /****************************************************************
311 ****************************************************************/
314 /* Associative lookup table return codes */
316 #define XCSUCCESS 0 /* No error. */
317 #define XCNOMEM 1 /* Out of memory */
318 #define XCNOENT 2 /* No entry in table */
320 typedef int XContext;
322 #define XUniqueContext() ((XContext) XrmUniqueQuark())
323 #define XStringToContext(string) ((XContext) XrmStringToQuark(string))
327 /* The following declarations are alphabetized. */
329 extern XClassHint *XAllocClassHint (
330 #if NeedFunctionPrototypes
335 extern XIconSize *XAllocIconSize (
336 #if NeedFunctionPrototypes
341 extern XSizeHints *XAllocSizeHints (
342 #if NeedFunctionPrototypes
347 extern XStandardColormap *XAllocStandardColormap (
348 #if NeedFunctionPrototypes
353 extern XWMHints *XAllocWMHints (
354 #if NeedFunctionPrototypes
360 #if NeedFunctionPrototypes
362 XRectangle* /* rect_return */
366 extern Region XCreateRegion(
367 #if NeedFunctionPrototypes
372 extern char *XDefaultString(
373 #if NeedFunctionPrototypes
378 extern int XDeleteContext(
379 #if NeedFunctionPrototypes
380 Display* /* display */,
382 XContext /* context */
386 extern int XDestroyRegion(
387 #if NeedFunctionPrototypes
392 extern int XEmptyRegion(
393 #if NeedFunctionPrototypes
398 extern int XEqualRegion(
399 #if NeedFunctionPrototypes
405 extern int XFindContext(
406 #if NeedFunctionPrototypes
407 Display* /* display */,
409 XContext /* context */,
410 XPointer* /* data_return */
414 extern Status XGetClassHint(
415 #if NeedFunctionPrototypes
416 Display* /* display */,
418 XClassHint* /* class_hints_return */
422 extern Status XGetIconSizes(
423 #if NeedFunctionPrototypes
424 Display* /* display */,
426 XIconSize** /* size_list_return */,
427 int* /* count_return */
431 extern Status XGetNormalHints(
432 #if NeedFunctionPrototypes
433 Display* /* display */,
435 XSizeHints* /* hints_return */
439 extern Status XGetRGBColormaps(
440 #if NeedFunctionPrototypes
441 Display* /* display */,
443 XStandardColormap** /* stdcmap_return */,
444 int* /* count_return */,
449 extern Status XGetSizeHints(
450 #if NeedFunctionPrototypes
451 Display* /* display */,
453 XSizeHints* /* hints_return */,
458 extern Status XGetStandardColormap(
459 #if NeedFunctionPrototypes
460 Display* /* display */,
462 XStandardColormap* /* colormap_return */,
467 extern Status XGetTextProperty(
468 #if NeedFunctionPrototypes
469 Display* /* display */,
471 XTextProperty* /* text_prop_return */,
476 extern XVisualInfo *XGetVisualInfo(
477 #if NeedFunctionPrototypes
478 Display* /* display */,
479 long /* vinfo_mask */,
480 XVisualInfo* /* vinfo_template */,
481 int* /* nitems_return */
485 extern Status XGetWMClientMachine(
486 #if NeedFunctionPrototypes
487 Display* /* display */,
489 XTextProperty* /* text_prop_return */
493 extern XWMHints *XGetWMHints(
494 #if NeedFunctionPrototypes
495 Display* /* display */,
500 extern Status XGetWMIconName(
501 #if NeedFunctionPrototypes
502 Display* /* display */,
504 XTextProperty* /* text_prop_return */
508 extern Status XGetWMName(
509 #if NeedFunctionPrototypes
510 Display* /* display */,
512 XTextProperty* /* text_prop_return */
516 extern Status XGetWMNormalHints(
517 #if NeedFunctionPrototypes
518 Display* /* display */,
520 XSizeHints* /* hints_return */,
521 long* /* supplied_return */
525 extern Status XGetWMSizeHints(
526 #if NeedFunctionPrototypes
527 Display* /* display */,
529 XSizeHints* /* hints_return */,
530 long* /* supplied_return */,
535 extern Status XGetZoomHints(
536 #if NeedFunctionPrototypes
537 Display* /* display */,
539 XSizeHints* /* zhints_return */
543 extern int XIntersectRegion(
544 #if NeedFunctionPrototypes
547 Region /* dr_return */
551 extern void XConvertCase(
552 #if NeedFunctionPrototypes
559 extern int XLookupString(
560 #if NeedFunctionPrototypes
561 XKeyEvent* /* event_struct */,
562 char* /* buffer_return */,
563 int /* bytes_buffer */,
564 KeySym* /* keysym_return */,
565 XComposeStatus* /* status_in_out */
569 extern Status XMatchVisualInfo(
570 #if NeedFunctionPrototypes
571 Display* /* display */,
575 XVisualInfo* /* vinfo_return */
579 extern int XOffsetRegion(
580 #if NeedFunctionPrototypes
587 extern Bool XPointInRegion(
588 #if NeedFunctionPrototypes
595 extern Region XPolygonRegion(
596 #if NeedFunctionPrototypes
597 XPoint* /* points */,
603 extern int XRectInRegion(
604 #if NeedFunctionPrototypes
608 unsigned int /* width */,
609 unsigned int /* height */
613 extern int XSaveContext(
614 #if NeedFunctionPrototypes
615 Display* /* display */,
617 XContext /* context */,
618 _Xconst char* /* data */
622 extern int XSetClassHint(
623 #if NeedFunctionPrototypes
624 Display* /* display */,
626 XClassHint* /* class_hints */
630 extern int XSetIconSizes(
631 #if NeedFunctionPrototypes
632 Display* /* display */,
634 XIconSize* /* size_list */,
639 extern int XSetNormalHints(
640 #if NeedFunctionPrototypes
641 Display* /* display */,
643 XSizeHints* /* hints */
647 extern void XSetRGBColormaps(
648 #if NeedFunctionPrototypes
649 Display* /* display */,
651 XStandardColormap* /* stdcmaps */,
657 extern int XSetSizeHints(
658 #if NeedFunctionPrototypes
659 Display* /* display */,
661 XSizeHints* /* hints */,
666 extern int XSetStandardProperties(
667 #if NeedFunctionPrototypes
668 Display* /* display */,
670 _Xconst char* /* window_name */,
671 _Xconst char* /* icon_name */,
672 Pixmap /* icon_pixmap */,
675 XSizeHints* /* hints */
679 extern void XSetTextProperty(
680 #if NeedFunctionPrototypes
681 Display* /* display */,
683 XTextProperty* /* text_prop */,
688 extern void XSetWMClientMachine(
689 #if NeedFunctionPrototypes
690 Display* /* display */,
692 XTextProperty* /* text_prop */
696 extern int XSetWMHints(
697 #if NeedFunctionPrototypes
698 Display* /* display */,
700 XWMHints* /* wm_hints */
704 extern void XSetWMIconName(
705 #if NeedFunctionPrototypes
706 Display* /* display */,
708 XTextProperty* /* text_prop */
712 extern void XSetWMName(
713 #if NeedFunctionPrototypes
714 Display* /* display */,
716 XTextProperty* /* text_prop */
720 extern void XSetWMNormalHints(
721 #if NeedFunctionPrototypes
722 Display* /* display */,
724 XSizeHints* /* hints */
728 extern void XSetWMProperties(
729 #if NeedFunctionPrototypes
730 Display* /* display */,
732 XTextProperty* /* window_name */,
733 XTextProperty* /* icon_name */,
736 XSizeHints* /* normal_hints */,
737 XWMHints* /* wm_hints */,
738 XClassHint* /* class_hints */
742 extern void XmbSetWMProperties(
743 #if NeedFunctionPrototypes
744 Display* /* display */,
746 _Xconst char* /* window_name */,
747 _Xconst char* /* icon_name */,
750 XSizeHints* /* normal_hints */,
751 XWMHints* /* wm_hints */,
752 XClassHint* /* class_hints */
756 extern void XSetWMSizeHints(
757 #if NeedFunctionPrototypes
758 Display* /* display */,
760 XSizeHints* /* hints */,
765 extern int XSetRegion(
766 #if NeedFunctionPrototypes
767 Display* /* display */,
773 extern void XSetStandardColormap(
774 #if NeedFunctionPrototypes
775 Display* /* display */,
777 XStandardColormap* /* colormap */,
782 extern int XSetZoomHints(
783 #if NeedFunctionPrototypes
784 Display* /* display */,
786 XSizeHints* /* zhints */
790 extern int XShrinkRegion(
791 #if NeedFunctionPrototypes
798 extern Status XStringListToTextProperty(
799 #if NeedFunctionPrototypes
802 XTextProperty* /* text_prop_return */
806 extern int XSubtractRegion(
807 #if NeedFunctionPrototypes
810 Region /* dr_return */
814 extern int XmbTextListToTextProperty(
815 #if NeedFunctionPrototypes
816 Display* /* display */,
819 XICCEncodingStyle /* style */,
820 XTextProperty* /* text_prop_return */
824 extern int XwcTextListToTextProperty(
825 #if NeedFunctionPrototypes
826 Display* /* display */,
827 wchar_t** /* list */,
829 XICCEncodingStyle /* style */,
830 XTextProperty* /* text_prop_return */
834 extern void XwcFreeStringList(
835 #if NeedFunctionPrototypes
840 extern Status XTextPropertyToStringList(
841 #if NeedFunctionPrototypes
842 XTextProperty* /* text_prop */,
843 char*** /* list_return */,
844 int* /* count_return */
848 extern int XmbTextPropertyToTextList(
849 #if NeedFunctionPrototypes
850 Display* /* display */,
851 XTextProperty* /* text_prop */,
852 char*** /* list_return */,
853 int* /* count_return */
857 extern int XwcTextPropertyToTextList(
858 #if NeedFunctionPrototypes
859 Display* /* display */,
860 XTextProperty* /* text_prop */,
861 wchar_t*** /* list_return */,
862 int* /* count_return */
866 extern int XUnionRectWithRegion(
867 #if NeedFunctionPrototypes
868 XRectangle* /* rectangle */,
869 Region /* src_region */,
870 Region /* dest_region_return */
874 extern int XUnionRegion(
875 #if NeedFunctionPrototypes
878 Region /* dr_return */
882 extern int XWMGeometry(
883 #if NeedFunctionPrototypes
884 Display* /* display */,
885 int /* screen_number */,
886 _Xconst char* /* user_geometry */,
887 _Xconst char* /* default_geometry */,
888 unsigned int /* border_width */,
889 XSizeHints* /* hints */,
892 int* /* width_return */,
893 int* /* height_return */,
894 int* /* gravity_return */
898 extern int XXorRegion(
899 #if NeedFunctionPrototypes
902 Region /* dr_return */
908 #endif /* _XUTIL_H_ */