|
|
1.1 root 1: /* $Header: Xutil.h,v 11.39 87/09/12 02:32:45 rws Exp $ */
2:
3: /***********************************************************
4: Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
5: and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
6:
7: All Rights Reserved
8:
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.
16:
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.
24:
25: ******************************************************************/
26:
27: #ifndef _XUTIL_H_
28: #define _XUTIL_H_
29:
30: /*
31: * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding
32: * value (x, y, width, height) was found in the parsed string.
33: */
34: #define NoValue 0x0000
35: #define XValue 0x0001
36: #define YValue 0x0002
37: #define WidthValue 0x0004
38: #define HeightValue 0x0008
39: #define AllValues 0x000F
40: #define XNegative 0x0010
41: #define YNegative 0x0020
42:
43: typedef struct {
44: long flags; /* marks which fields in this structure are defined */
45: int x, y;
46: int width, height;
47: int min_width, min_height;
48: int max_width, max_height;
49: int width_inc, height_inc;
50: struct {
51: int x; /* numerator */
52: int y; /* denominator */
53: } min_aspect, max_aspect;
54: } XSizeHints;
55:
56: /*
57: * The next block of definitions are for window manager properties that
58: * clients and applications use for communication.
59: */
60:
61: /* flags argument in size hints */
62: #define USPosition (1L << 0) /* user specified x, y */
63: #define USSize (1L << 1) /* user specified width, height */
64:
65: #define PPosition (1L << 2) /* program specified position */
66: #define PSize (1L << 3) /* program specified size */
67: #define PMinSize (1L << 4) /* program specified minimum size */
68: #define PMaxSize (1L << 5) /* program specified maximum size */
69: #define PResizeInc (1L << 6) /* program specified resize increments */
70: #define PAspect (1L << 7) /* program specified min and max aspect ratios */
71: #define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect)
72:
73: typedef struct {
74: long flags; /* marks which fields in this structure are defined */
75: Bool input; /* does this application rely on the window manager to
76: get keyboard input? */
77: int initial_state; /* see below */
78: Pixmap icon_pixmap; /* pixmap to be used as icon */
79: Window icon_window; /* window to be used as icon */
80: int icon_x, icon_y; /* initial position of icon */
81: Pixmap icon_mask; /* icon mask bitmap */
82: XID window_group; /* id of related window group */
83: /* this structure may be extended in the future */
84: } XWMHints;
85:
86: /* definition for flags of XWMHints */
87:
88: #define InputHint (1L << 0)
89: #define StateHint (1L << 1)
90: #define IconPixmapHint (1L << 2)
91: #define IconWindowHint (1L << 3)
92: #define IconPositionHint (1L << 4)
93: #define IconMaskHint (1L << 5)
94: #define WindowGroupHint (1L << 6)
95: #define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \
96: IconPositionHint|IconMaskHint|WindowGroupHint)
97:
98: /* definitions for initial window state */
99:
100: #define DontCareState 0 /* don't know or care */
101: #define NormalState 1 /* most applications want to start this way */
102: #define ZoomState 2 /* application wants to start zoomed */
103: #define IconicState 3 /* application wants to start as an icon */
104: #define InactiveState 4 /* application believes it is seldom used; some
105: wm's may put it on inactive menu */
106:
107:
108: typedef struct {
109: int min_width, min_height;
110: int max_width, max_height;
111: int width_inc, height_inc;
112: } XIconSize;
113:
114: typedef struct {
115: char *res_name;
116: char *res_class;
117: } XClassHint;
118:
119: /*
120: * These macros are used to give some sugar to the image routines so that
121: * naive people are more comfortable with them.
122: */
123: #define XDestroyImage(ximage) \
124: ((*((ximage)->f.destroy_image))((ximage)))
125: #define XGetPixel(ximage, x, y) \
126: ((*((ximage)->f.get_pixel))((ximage), (x), (y)))
127: #define XPutPixel(ximage, x, y, pixel) \
128: ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)))
129: #define XSubImage(ximage, x, y, width, height) \
130: ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height)))
131: #define XAddPixel(ximage, value) \
132: ((*((ximage)->f.add_pixel))((ximage), (value)))
133:
134: /*
135: * Compose sequence status structure, used in calling XLookupString.
136: */
137: typedef struct _XComposeStatus {
138: char *compose_ptr; /* state table pointer */
139: int chars_matched; /* match state */
140: } XComposeStatus;
141:
142: /*
143: * Keysym macros, used on Keysyms to test for classes of symbols
144: */
145: #define IsKeypadKey(keysym) \
146: (((unsigned)(keysym) >= XK_KP_Space) && ((unsigned)(keysym) <= XK_KP_Equal))
147:
148: #define IsCursorKey(keysym) \
149: (((unsigned)(keysym) >= XK_Home) && ((unsigned)(keysym) < XK_Select))
150:
151: #define IsPFKey(keysym) \
152: (((unsigned)(keysym) >= XK_KP_F1) && ((unsigned)(keysym) <= XK_KP_F4))
153:
154: #define IsFunctionKey(keysym) \
155: (((unsigned)(keysym) >= XK_F1) && ((unsigned)(keysym) <= XK_F35))
156:
157: #define IsMiscFunctionKey(keysym) \
158: (((unsigned)(keysym) >= XK_Select) && ((unsigned)(keysym) < XK_KP_Space))
159:
160: #define IsModifierKey(keysym) \
161: (((unsigned)(keysym) >= XK_Shift_L) && ((unsigned)(keysym) <= XK_Hyper_R))
162:
163: /*
164: * opaque reference to Region data type
165: */
166: typedef struct _XRegion *Region;
167:
168: /* Return values from XRectInRegion() */
169:
170: #define RectangleOut 0
171: #define RectangleIn 1
172: #define RectanglePart 2
173:
174:
175: /*
176: * Information used by the visual utility routines to find desired visual
177: * type from the many visuals a display may support.
178: */
179:
180: typedef struct {
181: Visual *visual;
182: VisualID visualid;
183: int screen;
184: int depth;
185: int class;
186: unsigned long red_mask;
187: unsigned long green_mask;
188: unsigned long blue_mask;
189: int colormap_size;
190: int bits_per_rgb;
191: } XVisualInfo;
192:
193: #define VisualNoMask 0x0
194: #define VisualIDMask 0x1
195: #define VisualScreenMask 0x2
196: #define VisualDepthMask 0x4
197: #define VisualClassMask 0x8
198: #define VisualRedMaskMask 0x10
199: #define VisualGreenMaskMask 0x20
200: #define VisualBlueMaskMask 0x40
201: #define VisualColormapSizeMask 0x80
202: #define VisualBitsPerRGBMask 0x100
203: #define VisualAllMask 0x1FF
204:
205: /*
206: * This defines a window manager property that clients may use to
207: * share standard color maps:
208: */
209:
210: typedef struct {
211: Colormap colormap;
212: unsigned long red_max;
213: unsigned long red_mult;
214: unsigned long green_max;
215: unsigned long green_mult;
216: unsigned long blue_max;
217: unsigned long blue_mult;
218: unsigned long base_pixel;
219: } XStandardColormap;
220:
221: /*
222: * return codes for XReadBitmapFile and XWriteBitmapFile
223: */
224: #define BitmapSuccess 0
225: #define BitmapOpenFailed 1
226: #define BitmapFileInvalid 2
227: #define BitmapNoMemory 3
228: /*
229: * Declare the routines that don't return int.
230: */
231:
232: /****************************************************************
233: *
234: * Context Management
235: *
236: ****************************************************************/
237:
238:
239: /* Associative lookup table return codes */
240:
241: #define XCSUCCESS 0 /* No error. */
242: #define XCNOMEM 1 /* Out of memory */
243: #define XCNOENT 2 /* No entry in table */
244:
245: typedef int XContext;
246:
247: #define XUniqueContext() ((XContext) XrmUniqueQuark())
248: #define XAtomToContext(atom) ((XContext) XrmAtomToQuark(atom))
249:
250: extern int XSaveContext(); /* window, context, data */
251: /* Window window; */
252: /* XContext context; */
253: /* caddr_t data; */
254:
255: extern int XFindContext(); /* display, window, context, data */
256: /* Display *display; */
257: /* Window window; */
258: /* XContext context; */
259: /* caddr_t *data; /* RETURN */
260:
261: extern int XDeleteContext(); /* window, context */
262: /* Window window; */
263: /* XContext context; */
264:
265:
266: XWMHints *XGetWMHints();
267: Region XCreateRegion(), XPolygonRegion();
268: XImage *XCreateImage();
269:
270: XVisualInfo *XGetVisualInfo();
271: #endif _XUTIL_H_
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.