source: trunk/kitgen/8.x/blt/win/X11/Xutil.h@ 175

Last change on this file since 175 was 175, checked in by demin, 12 years ago

initial commit

File size: 19.7 KB
Line 
1/* $XConsortium: Xutil.h,v 11.73 91/07/30 16:21:37 rws Exp $ */
2
3/***********************************************************
4Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
5and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
6
7 All Rights Reserved
8
9Permission to use, copy, modify, and distribute this software and its
10documentation for any purpose and without fee is hereby granted,
11provided that the above copyright notice appear in all copies and that
12both that copyright notice and this permission notice appear in
13supporting documentation, and that the names of Digital or MIT not be
14used in advertising or publicity pertaining to distribution of the
15software without specific, written prior permission.
16
17DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
18ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
19DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
20ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
22ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
23SOFTWARE.
24
25******************************************************************/
26
27#ifndef _XUTIL_H_
28#define _XUTIL_H_
29
30/* You must include <X11/Xlib.h> before including this file */
31
32#ifdef MAC_TCL
33# define Region XRegion
34#endif
35
36/*
37 * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
38 * value (x, y, width, height) was found in the parsed string.
39 */
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
48
49/*
50 * new version containing base_width, base_height, and win_gravity fields;
51 * used with WM_NORMAL_HINTS.
52 */
53typedef 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;
67
68/*
69 * The next block of definitions are for window manager properties that
70 * clients and applications use for communication.
71 */
72
73/* flags argument in size hints */
74#define USPosition (1L << 0) /* user specified x, y */
75#define USSize (1L << 1) /* user specified width, height */
76
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 */
85
86/* obsolete */
87#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
88
89
90
91typedef 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;
103
104/* definition for flags of XWMHints */
105
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| \
114IconPositionHint|IconMaskHint|WindowGroupHint)
115
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 */
120
121/*
122 * Obsolete states no longer defined by ICCCM
123 */
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 */
128
129
130/*
131 * new structure for manipulating TEXT properties; used with WM_NAME,
132 * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND.
133 */
134typedef 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;
140
141#define XNoMemory -1
142#define XLocaleNotSupported -2
143#define XConverterNotFound -3
144
145typedef 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;
151
152typedef struct {
153 int min_width, min_height;
154 int max_width, max_height;
155 int width_inc, height_inc;
156} XIconSize;
157
158typedef struct {
159 char *res_name;
160 char *res_class;
161} XClassHint;
162
163/*
164 * These macros are used to give some sugar to the image routines so that
165 * naive people are more comfortable with them.
166 */
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)))
177
178/*
179 * Compose sequence status structure, used in calling XLookupString.
180 */
181typedef struct _XComposeStatus {
182 XPointer compose_ptr; /* state table pointer */
183 int chars_matched; /* match state */
184} XComposeStatus;
185
186/*
187 * Keysym macros, used on Keysyms to test for classes of symbols
188 */
189#define IsKeypadKey(keysym) \
190 (((unsigned)(keysym) >= XK_KP_Space) && ((unsigned)(keysym) <= XK_KP_Equal))
191
192#define IsCursorKey(keysym) \
193 (((unsigned)(keysym) >= XK_Home) && ((unsigned)(keysym) < XK_Select))
194
195#define IsPFKey(keysym) \
196 (((unsigned)(keysym) >= XK_KP_F1) && ((unsigned)(keysym) <= XK_KP_F4))
197
198#define IsFunctionKey(keysym) \
199 (((unsigned)(keysym) >= XK_F1) && ((unsigned)(keysym) <= XK_F35))
200
201#define IsMiscFunctionKey(keysym) \
202 (((unsigned)(keysym) >= XK_Select) && ((unsigned)(keysym) <= XK_Break))
203
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))
208/*
209 * opaque reference to Region data type
210 */
211typedef struct _XRegion *Region;
212
213/* Return values from XRectInRegion() */
214
215#define RectangleOut 0
216#define RectangleIn 1
217#define RectanglePart 2
218
219
220/*
221 * Information used by the visual utility routines to find desired visual
222 * type from the many visuals a display may support.
223 */
224
225typedef 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;
241
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
253
254/*
255 * This defines a window manager property that clients may use to
256 * share standard color maps of type RGB_COLOR_MAP:
257 */
258typedef 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;
270
271#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */
272
273
274/*
275 * return codes for XReadBitmapFile and XWriteBitmapFile
276 */
277#define BitmapSuccess 0
278#define BitmapOpenFailed 1
279#define BitmapFileInvalid 2
280#define BitmapNoMemory 3
281
282/****************************************************************
283 *
284 * Context Management
285 *
286 ****************************************************************/
287
288
289/* Associative lookup table return codes */
290
291#define XCSUCCESS 0 /* No error. */
292#define XCNOMEM 1 /* Out of memory */
293#define XCNOENT 2 /* No entry in table */
294
295typedef int XContext;
296
297#define XUniqueContext() ((XContext) XrmUniqueQuark())
298#define XStringToContext(string) ((XContext) XrmStringToQuark(string))
299
300_XFUNCPROTOBEGIN
301
302/* The following declarations are alphabetized. */
303
304extern XClassHint *XAllocClassHint (
305#if NeedFunctionPrototypes
306 void
307#endif
308);
309
310extern XIconSize *XAllocIconSize (
311#if NeedFunctionPrototypes
312 void
313#endif
314);
315
316extern XSizeHints *XAllocSizeHints (
317#if NeedFunctionPrototypes
318 void
319#endif
320);
321
322extern XStandardColormap *XAllocStandardColormap (
323#if NeedFunctionPrototypes
324 void
325#endif
326);
327
328extern XWMHints *XAllocWMHints (
329#if NeedFunctionPrototypes
330 void
331#endif
332);
333
334extern void XClipBox(
335#if NeedFunctionPrototypes
336 Region /* r */,
337 XRectangle* /* rect_return */
338#endif
339);
340
341extern Region XCreateRegion(
342#if NeedFunctionPrototypes
343 void
344#endif
345);
346
347extern char *XDefaultString(
348#if NeedFunctionPrototypes
349 void
350#endif
351);
352
353extern int XDeleteContext(
354#if NeedFunctionPrototypes
355 Display* /* display */,
356 XID /* rid */,
357 XContext /* context */
358#endif
359);
360
361extern void XDestroyRegion(
362#if NeedFunctionPrototypes
363 Region /* r */
364#endif
365);
366
367extern void XEmptyRegion(
368#if NeedFunctionPrototypes
369 Region /* r */
370#endif
371);
372
373extern void XEqualRegion(
374#if NeedFunctionPrototypes
375 Region /* r1 */,
376 Region /* r2 */
377#endif
378);
379
380extern int XFindContext(
381#if NeedFunctionPrototypes
382 Display* /* display */,
383 XID /* rid */,
384 XContext /* context */,
385 XPointer* /* data_return */
386#endif
387);
388
389extern Status XGetClassHint(
390#if NeedFunctionPrototypes
391 Display* /* display */,
392 Window /* w */,
393 XClassHint* /* class_hints_return */
394#endif
395);
396
397extern Status XGetIconSizes(
398#if NeedFunctionPrototypes
399 Display* /* display */,
400 Window /* w */,
401 XIconSize** /* size_list_return */,
402 int* /* count_return */
403#endif
404);
405
406extern Status XGetNormalHints(
407#if NeedFunctionPrototypes
408 Display* /* display */,
409 Window /* w */,
410 XSizeHints* /* hints_return */
411#endif
412);
413
414extern Status XGetRGBColormaps(
415#if NeedFunctionPrototypes
416 Display* /* display */,
417 Window /* w */,
418 XStandardColormap** /* stdcmap_return */,
419 int* /* count_return */,
420 Atom /* property */
421#endif
422);
423
424extern Status XGetSizeHints(
425#if NeedFunctionPrototypes
426 Display* /* display */,
427 Window /* w */,
428 XSizeHints* /* hints_return */,
429 Atom /* property */
430#endif
431);
432
433extern Status XGetStandardColormap(
434#if NeedFunctionPrototypes
435 Display* /* display */,
436 Window /* w */,
437 XStandardColormap* /* colormap_return */,
438 Atom /* property */
439#endif
440);
441
442extern Status XGetTextProperty(
443#if NeedFunctionPrototypes
444 Display* /* display */,
445 Window /* window */,
446 XTextProperty* /* text_prop_return */,
447 Atom /* property */
448#endif
449);
450
451
452extern Status XGetWMClientMachine(
453#if NeedFunctionPrototypes
454 Display* /* display */,
455 Window /* w */,
456 XTextProperty* /* text_prop_return */
457#endif
458);
459
460extern XWMHints *XGetWMHints(
461#if NeedFunctionPrototypes
462 Display* /* display */,
463 Window /* w */
464#endif
465);
466
467extern Status XGetWMIconName(
468#if NeedFunctionPrototypes
469 Display* /* display */,
470 Window /* w */,
471 XTextProperty* /* text_prop_return */
472#endif
473);
474
475extern Status XGetWMName(
476#if NeedFunctionPrototypes
477 Display* /* display */,
478 Window /* w */,
479 XTextProperty* /* text_prop_return */
480#endif
481);
482
483extern Status XGetWMNormalHints(
484#if NeedFunctionPrototypes
485 Display* /* display */,
486 Window /* w */,
487 XSizeHints* /* hints_return */,
488 long* /* supplied_return */
489#endif
490);
491
492extern Status XGetWMSizeHints(
493#if NeedFunctionPrototypes
494 Display* /* display */,
495 Window /* w */,
496 XSizeHints* /* hints_return */,
497 long* /* supplied_return */,
498 Atom /* property */
499#endif
500);
501
502extern Status XGetZoomHints(
503#if NeedFunctionPrototypes
504 Display* /* display */,
505 Window /* w */,
506 XSizeHints* /* zhints_return */
507#endif
508);
509
510extern void XIntersectRegion(
511#if NeedFunctionPrototypes
512 Region /* sra */,
513 Region /* srb */,
514 Region /* dr_return */
515#endif
516);
517
518extern 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
526);
527
528extern Status XMatchVisualInfo(
529#if NeedFunctionPrototypes
530 Display* /* display */,
531 int /* screen */,
532 int /* depth */,
533 int /* class */,
534 XVisualInfo* /* vinfo_return */
535#endif
536);
537
538extern void XOffsetRegion(
539#if NeedFunctionPrototypes
540 Region /* r */,
541 int /* dx */,
542 int /* dy */
543#endif
544);
545
546extern Bool XPointInRegion(
547#if NeedFunctionPrototypes
548 Region /* r */,
549 int /* x */,
550 int /* y */
551#endif
552);
553
554extern Region XPolygonRegion(
555#if NeedFunctionPrototypes
556 XPoint* /* points */,
557 int /* n */,
558 int /* fill_rule */
559#endif
560);
561
562extern int XRectInRegion(
563#if NeedFunctionPrototypes
564 Region /* r */,
565 int /* x */,
566 int /* y */,
567 unsigned int /* width */,
568 unsigned int /* height */
569#endif
570);
571
572extern int XSaveContext(
573#if NeedFunctionPrototypes
574 Display* /* display */,
575 XID /* rid */,
576 XContext /* context */,
577 _Xconst char* /* data */
578#endif
579);
580
581extern void XSetClassHint(
582#if NeedFunctionPrototypes
583 Display* /* display */,
584 Window /* w */,
585 XClassHint* /* class_hints */
586#endif
587);
588
589extern void XSetIconSizes(
590#if NeedFunctionPrototypes
591 Display* /* display */,
592 Window /* w */,
593 XIconSize* /* size_list */,
594 int /* count */
595#endif
596);
597
598extern void XSetNormalHints(
599#if NeedFunctionPrototypes
600 Display* /* display */,
601 Window /* w */,
602 XSizeHints* /* hints */
603#endif
604);
605
606extern void XSetRGBColormaps(
607#if NeedFunctionPrototypes
608 Display* /* display */,
609 Window /* w */,
610 XStandardColormap* /* stdcmaps */,
611 int /* count */,
612 Atom /* property */
613#endif
614);
615
616extern void XSetSizeHints(
617#if NeedFunctionPrototypes
618 Display* /* display */,
619 Window /* w */,
620 XSizeHints* /* hints */,
621 Atom /* property */
622#endif
623);
624
625extern 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
636);
637
638extern void XSetTextProperty(
639#if NeedFunctionPrototypes
640 Display* /* display */,
641 Window /* w */,
642 XTextProperty* /* text_prop */,
643 Atom /* property */
644#endif
645);
646
647extern void XSetWMHints(
648#if NeedFunctionPrototypes
649 Display* /* display */,
650 Window /* w */,
651 XWMHints* /* wm_hints */
652#endif
653);
654
655extern void XSetWMIconName(
656#if NeedFunctionPrototypes
657 Display* /* display */,
658 Window /* w */,
659 XTextProperty* /* text_prop */
660#endif
661);
662
663extern void XSetWMName(
664#if NeedFunctionPrototypes
665 Display* /* display */,
666 Window /* w */,
667 XTextProperty* /* text_prop */
668#endif
669);
670
671extern void XSetWMNormalHints(
672#if NeedFunctionPrototypes
673 Display* /* display */,
674 Window /* w */,
675 XSizeHints* /* hints */
676#endif
677);
678
679extern 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
691);
692
693extern 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
705);
706
707extern void XSetWMSizeHints(
708#if NeedFunctionPrototypes
709 Display* /* display */,
710 Window /* w */,
711 XSizeHints* /* hints */,
712 Atom /* property */
713#endif
714);
715
716extern void XSetRegion(
717#if NeedFunctionPrototypes
718 Display* /* display */,
719 GC /* gc */,
720 Region /* r */
721#endif
722);
723
724extern void XSetStandardColormap(
725#if NeedFunctionPrototypes
726 Display* /* display */,
727 Window /* w */,
728 XStandardColormap* /* colormap */,
729 Atom /* property */
730#endif
731);
732
733extern void XSetZoomHints(
734#if NeedFunctionPrototypes
735 Display* /* display */,
736 Window /* w */,
737 XSizeHints* /* zhints */
738#endif
739);
740
741extern void XShrinkRegion(
742#if NeedFunctionPrototypes
743 Region /* r */,
744 int /* dx */,
745 int /* dy */
746#endif
747);
748
749extern void XSubtractRegion(
750#if NeedFunctionPrototypes
751 Region /* sra */,
752 Region /* srb */,
753 Region /* dr_return */
754#endif
755);
756
757extern int XmbTextListToTextProperty(
758#if NeedFunctionPrototypes
759 Display* /* display */,
760 char** /* list */,
761 int /* count */,
762 XICCEncodingStyle /* style */,
763 XTextProperty* /* text_prop_return */
764#endif
765);
766
767extern 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
775);
776
777extern void XwcFreeStringList(
778#if NeedFunctionPrototypes
779 wchar_t** /* list */
780#endif
781);
782
783extern Status XTextPropertyToStringList(
784#if NeedFunctionPrototypes
785 XTextProperty* /* text_prop */,
786 char*** /* list_return */,
787 int* /* count_return */
788#endif
789);
790
791extern int XmbTextPropertyToTextList(
792#if NeedFunctionPrototypes
793 Display* /* display */,
794 XTextProperty* /* text_prop */,
795 char*** /* list_return */,
796 int* /* count_return */
797#endif
798);
799
800extern int XwcTextPropertyToTextList(
801#if NeedFunctionPrototypes
802 Display* /* display */,
803 XTextProperty* /* text_prop */,
804 wchar_t*** /* list_return */,
805 int* /* count_return */
806#endif
807);
808
809extern void XUnionRectWithRegion(
810#if NeedFunctionPrototypes
811 XRectangle* /* rectangle */,
812 Region /* src_region */,
813 Region /* dest_region_return */
814#endif
815);
816
817extern void XUnionRegion(
818#if NeedFunctionPrototypes
819 Region /* sra */,
820 Region /* srb */,
821 Region /* dr_return */
822#endif
823);
824
825extern 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
839);
840
841extern void XXorRegion(
842#if NeedFunctionPrototypes
843 Region /* sra */,
844 Region /* srb */,
845 Region /* dr_return */
846#endif
847);
848
849_XFUNCPROTOEND
850
851#ifdef MAC_TCL
852# undef Region
853#endif
854
855#endif /* _XUTIL_H_ */
Note: See TracBrowser for help on using the repository browser.