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