Update tk to version 8.5.13
[msysgit.git] / mingw / include / X11 / Xutil.h
blob58124b04f009a30391eff793258f2fdd9dd8ee30
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.
7 All Rights Reserved
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
23 SOFTWARE.
25 ******************************************************************/
27 #ifndef _XUTIL_H_
28 #define _XUTIL_H_
30 /* You must include <X11/Xlib.h> before including this file */
32 #if defined(MAC_OSX_TK)
33 # define Region XRegion
34 #endif
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
41 #define XValue 0x0001
42 #define YValue 0x0002
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.
53 typedef struct {
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;
60 struct {
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 */
66 } XSizeHints;
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 */
86 /* obsolete */
87 #define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
91 typedef struct {
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 */
102 } XWMHints;
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.
134 typedef struct {
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 */
139 } XTextProperty;
141 #define XNoMemory -1
142 #define XLocaleNotSupported -2
143 #define XConverterNotFound -3
145 typedef enum {
146 XStringStyle, /* STRING */
147 XCompoundTextStyle, /* COMPOUND_TEXT */
148 XTextStyle, /* text in owner's encoding (current locale)*/
149 XStdICCTextStyle /* STRING, else COMPOUND_TEXT */
150 } XICCEncodingStyle;
152 typedef struct {
153 int min_width, min_height;
154 int max_width, max_height;
155 int width_inc, height_inc;
156 } XIconSize;
158 typedef struct {
159 char *res_name;
160 char *res_class;
161 } XClassHint;
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 */
184 } XComposeStatus;
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.
225 typedef struct {
226 Visual *visual;
227 VisualID visualid;
228 int screen;
229 int depth;
230 #if defined(__cplusplus) || defined(c_plusplus)
231 int c_class; /* C++ */
232 #else
233 int class;
234 #endif
235 unsigned long red_mask;
236 unsigned long green_mask;
237 unsigned long blue_mask;
238 int colormap_size;
239 int bits_per_rgb;
240 } XVisualInfo;
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:
258 typedef struct {
259 Colormap colormap;
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 */
269 } XStandardColormap;
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 /****************************************************************
284 * Context Management
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))
300 _XFUNCPROTOBEGIN
302 /* The following declarations are alphabetized. */
304 extern XClassHint *XAllocClassHint (
305 #if NeedFunctionPrototypes
306 void
307 #endif
310 extern XIconSize *XAllocIconSize (
311 #if NeedFunctionPrototypes
312 void
313 #endif
316 extern XSizeHints *XAllocSizeHints (
317 #if NeedFunctionPrototypes
318 void
319 #endif
322 extern XStandardColormap *XAllocStandardColormap (
323 #if NeedFunctionPrototypes
324 void
325 #endif
328 extern XWMHints *XAllocWMHints (
329 #if NeedFunctionPrototypes
330 void
331 #endif
334 extern void XClipBox(
335 #if NeedFunctionPrototypes
336 Region /* r */,
337 XRectangle* /* rect_return */
338 #endif
341 extern Region XCreateRegion(
342 #if NeedFunctionPrototypes
343 void
344 #endif
347 extern char *XDefaultString(
348 #if NeedFunctionPrototypes
349 void
350 #endif
353 extern int XDeleteContext(
354 #if NeedFunctionPrototypes
355 Display* /* display */,
356 XID /* rid */,
357 XContext /* context */
358 #endif
361 extern void XDestroyRegion(
362 #if NeedFunctionPrototypes
363 Region /* r */
364 #endif
367 extern Bool XEmptyRegion(
368 #if NeedFunctionPrototypes
369 Region /* r */
370 #endif
373 extern Bool XEqualRegion(
374 #if NeedFunctionPrototypes
375 Region /* r1 */,
376 Region /* r2 */
377 #endif
380 extern int XFindContext(
381 #if NeedFunctionPrototypes
382 Display* /* display */,
383 XID /* rid */,
384 XContext /* context */,
385 XPointer* /* data_return */
386 #endif
389 extern Status XGetClassHint(
390 #if NeedFunctionPrototypes
391 Display* /* display */,
392 Window /* w */,
393 XClassHint* /* class_hints_return */
394 #endif
397 extern Status XGetIconSizes(
398 #if NeedFunctionPrototypes
399 Display* /* display */,
400 Window /* w */,
401 XIconSize** /* size_list_return */,
402 int* /* count_return */
403 #endif
406 extern Status XGetNormalHints(
407 #if NeedFunctionPrototypes
408 Display* /* display */,
409 Window /* w */,
410 XSizeHints* /* hints_return */
411 #endif
414 extern Status XGetRGBColormaps(
415 #if NeedFunctionPrototypes
416 Display* /* display */,
417 Window /* w */,
418 XStandardColormap** /* stdcmap_return */,
419 int* /* count_return */,
420 Atom /* property */
421 #endif
424 extern Status XGetSizeHints(
425 #if NeedFunctionPrototypes
426 Display* /* display */,
427 Window /* w */,
428 XSizeHints* /* hints_return */,
429 Atom /* property */
430 #endif
433 extern Status XGetStandardColormap(
434 #if NeedFunctionPrototypes
435 Display* /* display */,
436 Window /* w */,
437 XStandardColormap* /* colormap_return */,
438 Atom /* property */
439 #endif
442 extern Status XGetTextProperty(
443 #if NeedFunctionPrototypes
444 Display* /* display */,
445 Window /* window */,
446 XTextProperty* /* text_prop_return */,
447 Atom /* property */
448 #endif
452 extern Status XGetWMClientMachine(
453 #if NeedFunctionPrototypes
454 Display* /* display */,
455 Window /* w */,
456 XTextProperty* /* text_prop_return */
457 #endif
460 extern XWMHints *XGetWMHints(
461 #if NeedFunctionPrototypes
462 Display* /* display */,
463 Window /* w */
464 #endif
467 extern Status XGetWMIconName(
468 #if NeedFunctionPrototypes
469 Display* /* display */,
470 Window /* w */,
471 XTextProperty* /* text_prop_return */
472 #endif
475 extern Status XGetWMName(
476 #if NeedFunctionPrototypes
477 Display* /* display */,
478 Window /* w */,
479 XTextProperty* /* text_prop_return */
480 #endif
483 extern Status XGetWMNormalHints(
484 #if NeedFunctionPrototypes
485 Display* /* display */,
486 Window /* w */,
487 XSizeHints* /* hints_return */,
488 long* /* supplied_return */
489 #endif
492 extern Status XGetWMSizeHints(
493 #if NeedFunctionPrototypes
494 Display* /* display */,
495 Window /* w */,
496 XSizeHints* /* hints_return */,
497 long* /* supplied_return */,
498 Atom /* property */
499 #endif
502 extern Status XGetZoomHints(
503 #if NeedFunctionPrototypes
504 Display* /* display */,
505 Window /* w */,
506 XSizeHints* /* zhints_return */
507 #endif
510 extern void XIntersectRegion(
511 #if NeedFunctionPrototypes
512 Region /* sra */,
513 Region /* srb */,
514 Region /* dr_return */
515 #endif
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 */
525 #endif
528 extern Status XMatchVisualInfo(
529 #if NeedFunctionPrototypes
530 Display* /* display */,
531 int /* screen */,
532 int /* depth */,
533 int /* class */,
534 XVisualInfo* /* vinfo_return */
535 #endif
538 extern void XOffsetRegion(
539 #if NeedFunctionPrototypes
540 Region /* r */,
541 int /* dx */,
542 int /* dy */
543 #endif
546 extern Bool XPointInRegion(
547 #if NeedFunctionPrototypes
548 Region /* r */,
549 int /* x */,
550 int /* y */
551 #endif
554 extern Region XPolygonRegion(
555 #if NeedFunctionPrototypes
556 XPoint* /* points */,
557 int /* n */,
558 int /* fill_rule */
559 #endif
562 extern int XRectInRegion(
563 #if NeedFunctionPrototypes
564 Region /* r */,
565 int /* x */,
566 int /* y */,
567 unsigned int /* width */,
568 unsigned int /* height */
569 #endif
572 extern int XSaveContext(
573 #if NeedFunctionPrototypes
574 Display* /* display */,
575 XID /* rid */,
576 XContext /* context */,
577 _Xconst char* /* data */
578 #endif
581 extern void XSetClassHint(
582 #if NeedFunctionPrototypes
583 Display* /* display */,
584 Window /* w */,
585 XClassHint* /* class_hints */
586 #endif
589 extern void XSetIconSizes(
590 #if NeedFunctionPrototypes
591 Display* /* display */,
592 Window /* w */,
593 XIconSize* /* size_list */,
594 int /* count */
595 #endif
598 extern void XSetNormalHints(
599 #if NeedFunctionPrototypes
600 Display* /* display */,
601 Window /* w */,
602 XSizeHints* /* hints */
603 #endif
606 extern void XSetRGBColormaps(
607 #if NeedFunctionPrototypes
608 Display* /* display */,
609 Window /* w */,
610 XStandardColormap* /* stdcmaps */,
611 int /* count */,
612 Atom /* property */
613 #endif
616 extern void XSetSizeHints(
617 #if NeedFunctionPrototypes
618 Display* /* display */,
619 Window /* w */,
620 XSizeHints* /* hints */,
621 Atom /* property */
622 #endif
625 extern void XSetStandardProperties(
626 #if NeedFunctionPrototypes
627 Display* /* display */,
628 Window /* w */,
629 _Xconst char* /* window_name */,
630 _Xconst char* /* icon_name */,
631 Pixmap /* icon_pixmap */,
632 char** /* argv */,
633 int /* argc */,
634 XSizeHints* /* hints */
635 #endif
638 extern void XSetTextProperty(
639 #if NeedFunctionPrototypes
640 Display* /* display */,
641 Window /* w */,
642 XTextProperty* /* text_prop */,
643 Atom /* property */
644 #endif
647 extern void XSetWMHints(
648 #if NeedFunctionPrototypes
649 Display* /* display */,
650 Window /* w */,
651 XWMHints* /* wm_hints */
652 #endif
655 extern void XSetWMIconName(
656 #if NeedFunctionPrototypes
657 Display* /* display */,
658 Window /* w */,
659 XTextProperty* /* text_prop */
660 #endif
663 extern void XSetWMName(
664 #if NeedFunctionPrototypes
665 Display* /* display */,
666 Window /* w */,
667 XTextProperty* /* text_prop */
668 #endif
671 extern void XSetWMNormalHints(
672 #if NeedFunctionPrototypes
673 Display* /* display */,
674 Window /* w */,
675 XSizeHints* /* hints */
676 #endif
679 extern void XSetWMProperties(
680 #if NeedFunctionPrototypes
681 Display* /* display */,
682 Window /* w */,
683 XTextProperty* /* window_name */,
684 XTextProperty* /* icon_name */,
685 char** /* argv */,
686 int /* argc */,
687 XSizeHints* /* normal_hints */,
688 XWMHints* /* wm_hints */,
689 XClassHint* /* class_hints */
690 #endif
693 extern void XmbSetWMProperties(
694 #if NeedFunctionPrototypes
695 Display* /* display */,
696 Window /* w */,
697 _Xconst char* /* window_name */,
698 _Xconst char* /* icon_name */,
699 char** /* argv */,
700 int /* argc */,
701 XSizeHints* /* normal_hints */,
702 XWMHints* /* wm_hints */,
703 XClassHint* /* class_hints */
704 #endif
707 extern void XSetWMSizeHints(
708 #if NeedFunctionPrototypes
709 Display* /* display */,
710 Window /* w */,
711 XSizeHints* /* hints */,
712 Atom /* property */
713 #endif
716 extern void XSetRegion(
717 #if NeedFunctionPrototypes
718 Display* /* display */,
719 GC /* gc */,
720 Region /* r */
721 #endif
724 extern void XSetStandardColormap(
725 #if NeedFunctionPrototypes
726 Display* /* display */,
727 Window /* w */,
728 XStandardColormap* /* colormap */,
729 Atom /* property */
730 #endif
733 extern void XSetZoomHints(
734 #if NeedFunctionPrototypes
735 Display* /* display */,
736 Window /* w */,
737 XSizeHints* /* zhints */
738 #endif
741 extern void XShrinkRegion(
742 #if NeedFunctionPrototypes
743 Region /* r */,
744 int /* dx */,
745 int /* dy */
746 #endif
749 extern void XSubtractRegion(
750 #if NeedFunctionPrototypes
751 Region /* sra */,
752 Region /* srb */,
753 Region /* dr_return */
754 #endif
757 extern int XmbTextListToTextProperty(
758 #if NeedFunctionPrototypes
759 Display* /* display */,
760 char** /* list */,
761 int /* count */,
762 XICCEncodingStyle /* style */,
763 XTextProperty* /* text_prop_return */
764 #endif
767 extern int XwcTextListToTextProperty(
768 #if NeedFunctionPrototypes
769 Display* /* display */,
770 wchar_t** /* list */,
771 int /* count */,
772 XICCEncodingStyle /* style */,
773 XTextProperty* /* text_prop_return */
774 #endif
777 extern void XwcFreeStringList(
778 #if NeedFunctionPrototypes
779 wchar_t** /* list */
780 #endif
783 extern Status XTextPropertyToStringList(
784 #if NeedFunctionPrototypes
785 XTextProperty* /* text_prop */,
786 char*** /* list_return */,
787 int* /* count_return */
788 #endif
791 extern int XmbTextPropertyToTextList(
792 #if NeedFunctionPrototypes
793 Display* /* display */,
794 XTextProperty* /* text_prop */,
795 char*** /* list_return */,
796 int* /* count_return */
797 #endif
800 extern int XwcTextPropertyToTextList(
801 #if NeedFunctionPrototypes
802 Display* /* display */,
803 XTextProperty* /* text_prop */,
804 wchar_t*** /* list_return */,
805 int* /* count_return */
806 #endif
809 extern void XUnionRectWithRegion(
810 #if NeedFunctionPrototypes
811 XRectangle* /* rectangle */,
812 Region /* src_region */,
813 Region /* dest_region_return */
814 #endif
817 extern void XUnionRegion(
818 #if NeedFunctionPrototypes
819 Region /* sra */,
820 Region /* srb */,
821 Region /* dr_return */
822 #endif
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 */,
833 int* /* x_return */,
834 int* /* y_return */,
835 int* /* width_return */,
836 int* /* height_return */,
837 int* /* gravity_return */
838 #endif
841 extern void XXorRegion(
842 #if NeedFunctionPrototypes
843 Region /* sra */,
844 Region /* srb */,
845 Region /* dr_return */
846 #endif
849 _XFUNCPROTOEND
851 #if defined(MAC_OSX_TK)
852 # undef Region
853 #endif
855 #endif /* _XUTIL_H_ */