Category reorganization
[openwrt/svn-archive/archive.git] / XOrg / headers / native / src / X11 / IntrinsicI.h
1 /* $Xorg: IntrinsicI.h,v 1.4 2001/02/09 02:03:55 xorgcvs Exp $ */
2
3 /***********************************************************
4
5 Copyright 1987, 1988, 1994, 1998 The Open Group
6
7 Permission to use, copy, modify, distribute, and sell this software and its
8 documentation for any purpose is hereby granted without fee, provided that
9 the above copyright notice appear in all copies and that both that
10 copyright notice and this permission notice appear in supporting
11 documentation.
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23 Except as contained in this notice, the name of The Open Group shall not be
24 used in advertising or otherwise to promote the sale, use or other dealings
25 in this Software without prior written authorization from The Open Group.
26
27
28 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
29
30 All Rights Reserved
31
32 Permission to use, copy, modify, and distribute this software and its
33 documentation for any purpose and without fee is hereby granted,
34 provided that the above copyright notice appear in all copies and that
35 both that copyright notice and this permission notice appear in
36 supporting documentation, and that the name of Digital not be
37 used in advertising or publicity pertaining to distribution of the
38 software without specific, written prior permission.
39
40 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
41 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
42 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
43 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
44 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
45 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
46 SOFTWARE.
47
48 ******************************************************************/
49 /* $XFree86: xc/lib/Xt/IntrinsicI.h,v 3.8 2001/12/14 19:56:25 dawes Exp $ */
50
51 #ifndef _XtintrinsicI_h
52 #define _XtintrinsicI_h
53
54 #include "Xtos.h"
55 #include "IntrinsicP.h"
56 #ifdef WIN32
57 #define _WILLWINSOCK_
58 #endif
59 #include <X11/Xos.h>
60
61 #include "Object.h"
62 #include "RectObj.h"
63 #include "ObjectP.h"
64 #include "RectObjP.h"
65
66 #include "ConvertI.h"
67 #include "TranslateI.h"
68
69 #define RectObjClassFlag 0x02
70 #define WidgetClassFlag 0x04
71 #define CompositeClassFlag 0x08
72 #define ConstraintClassFlag 0x10
73 #define ShellClassFlag 0x20
74 #define WMShellClassFlag 0x40
75 #define TopLevelClassFlag 0x80
76
77 /*
78 * The following macros, though very handy, are not suitable for
79 * IntrinsicP.h as they violate the rule that arguments are to
80 * be evaluated exactly once.
81 */
82
83 #define XtDisplayOfObject(object) \
84 (XtIsWidget(object) ? (object)->core.screen->display : \
85 _XtIsHookObject(object) ? ((HookObject)(object))->hooks.screen->display : \
86 _XtWindowedAncestor(object)->core.screen->display)
87
88 #define XtScreenOfObject(object) \
89 (XtIsWidget(object) ? (object)->core.screen : \
90 _XtIsHookObject(object) ? ((HookObject)(object))->hooks.screen : \
91 _XtWindowedAncestor(object)->core.screen)
92
93 #define XtWindowOfObject(object) \
94 ((XtIsWidget(object) ? (object) : _XtWindowedAncestor(object)) \
95 ->core.window)
96
97 #define XtIsManaged(object) \
98 (XtIsRectObj(object) ? (object)->core.managed : False)
99
100 #define XtIsSensitive(object) \
101 (XtIsRectObj(object) ? ((object)->core.sensitive && \
102 (object)->core.ancestor_sensitive) : False)
103
104
105 /****************************************************************
106 *
107 * Byte utilities
108 *
109 ****************************************************************/
110
111 #define _XBCOPYFUNC _XtBcopy
112 #include <X11/Xfuncs.h>
113
114 /* If the alignment characteristics of your machine are right, these may be
115 faster */
116
117 #ifdef UNALIGNED
118
119 #define XtMemmove(dst, src, size) \
120 if ((char *)(dst) != (char *)(src)) { \
121 if (size == sizeof(int)) \
122 *((int *) (dst)) = *((int *) (src)); \
123 else if (size == sizeof(char)) \
124 *((char *) (dst)) = *((char *) (src)); \
125 else if (size == sizeof(short)) \
126 *((short *) (dst)) = *((short *) (src)); \
127 else \
128 (void) memcpy((char *) (dst), (char *) (src), (int) (size)); \
129 }
130
131 #define XtBZero(dst, size) \
132 if (size == sizeof(int)) \
133 *((int *) (dst)) = 0; \
134 else \
135 bzero((char *) (dst), (int) (size))
136
137 #define XtMemcmp(b1, b2, size) \
138 (size == sizeof(int) ? \
139 *((int *) (b1)) != *((int *) (b2)) \
140 : memcmp((char *) (b1), (char *) (b2), (int) (size)) \
141 )
142
143 #else
144
145 #define XtMemmove(dst, src, size) \
146 if ((char *)(dst) != (char *)(src)) { \
147 (void) memcpy((char *) (dst), (char *) (src), (int) (size)); \
148 }
149
150 #define XtBZero(dst, size) \
151 bzero((char *) (dst), (int) (size))
152
153 #define XtMemcmp(b1, b2, size) \
154 memcmp((char *) (b1), (char *) (b2), (int) (size))
155
156 #endif
157
158
159 /****************************************************************
160 *
161 * Stack cache allocation/free
162 *
163 ****************************************************************/
164
165 #define XtStackAlloc(size, stack_cache_array) \
166 ((size) <= sizeof(stack_cache_array) \
167 ? (XtPointer)(stack_cache_array) \
168 : XtMalloc((unsigned)(size)))
169
170 #define XtStackFree(pointer, stack_cache_array) \
171 { if ((pointer) != ((XtPointer)(stack_cache_array))) XtFree(pointer); }
172
173 /***************************************************************
174 *
175 * Filename defines
176 *
177 **************************************************************/
178
179 /* used by XtResolvePathname */
180 #ifndef XFILESEARCHPATHDEFAULT
181 #define XFILESEARCHPATHDEFAULT "/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S"
182 #endif
183
184 /* the following two were both "X Toolkit " prior to R4 */
185 #ifndef XTERROR_PREFIX
186 #define XTERROR_PREFIX ""
187 #endif
188
189 #ifndef XTWARNING_PREFIX
190 #define XTWARNING_PREFIX ""
191 #endif
192
193 #ifndef ERRORDB
194 #define ERRORDB "/usr/lib/X11/XtErrorDB"
195 #endif
196
197 extern String XtCXtToolkitError;
198
199 extern void _XtAllocError(
200 String /* alloc_type */
201 );
202
203 extern void _XtCompileResourceList(
204 XtResourceList /* resources */,
205 Cardinal /* num_resources */
206 );
207
208 extern XtGeometryResult _XtMakeGeometryRequest(
209 Widget /* widget */,
210 XtWidgetGeometry* /* request */,
211 XtWidgetGeometry* /* reply_return */,
212 Boolean* /* clear_rect_obj */
213 );
214
215 extern Boolean _XtIsHookObject(
216 Widget /* widget */
217 );
218
219 extern void _XtAddShellToHookObj(
220 Widget /* widget */
221 );
222
223 /* GCManager.c */
224 extern void _XtGClistFree(Display *dpy, XtPerDisplay pd);
225
226 /** GeoTattler stuff */
227
228 #ifdef XT_GEO_TATTLER
229
230 extern void _XtGeoTab (int);
231 extern void _XtGeoTrace (
232 Widget widget,
233 ...
234 ) _X_ATTRIBUTE_PRINTF(2,3);
235
236 #define CALLGEOTAT(f) f
237
238 #else /* XT_GEO_TATTLER */
239
240 #define CALLGEOTAT(f)
241
242 #endif /* XT_GEO_TATTLER */
243
244 #ifndef XTTRACEMEMORY
245
246 extern char* __XtMalloc (
247 unsigned /* size */
248 );
249 extern char* __XtCalloc (
250 unsigned /* num */,
251 unsigned /* size */
252 );
253
254 #else
255
256 #define __XtMalloc XtMalloc
257 #define __XtCalloc XtCalloc
258 #endif
259
260 #endif /* _XtintrinsicI_h */
261 /* DON'T ADD STUFF AFTER THIS #endif */