Home | History | Annotate | Line # | Download | only in X11
      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  * Bit utilities
    105  *
    106  ****************************************************************/
    107 #define XtSetBits(dst,src,len)  dst = (((1U << (len)) - 1) & (unsigned)(src))
    108 #define XtSetBit(dst,src)  XtSetBits(dst,src,1)
    109 
    110 /****************************************************************
    111  *
    112  * Byte utilities
    113  *
    114  ****************************************************************/
    115 
    116 #define _XBCOPYFUNC _XtBcopy
    117 #include <X11/Xfuncs.h>
    118 
    119 #define XtMemmove(dst, src, size)	\
    120     if ((const void *)(dst) != (const void *)(src)) {		    \
    121 	(void) memcpy((void *) (dst), (const void *) (src), (size_t) (size)); \
    122     }
    123 
    124 #define XtBZero(dst, size) 	\
    125 	memset((void *) (dst), 0, (size_t) (size))
    126 
    127 #define XtMemcmp(b1, b2, size) 		\
    128 	memcmp((const void *) (b1), (const void *) (b2), (size_t) (size))
    129 
    130 
    131 /****************************************************************
    132  *
    133  * Stack cache allocation/free
    134  *
    135  ****************************************************************/
    136 
    137 #define XtStackAlloc(size, stack_cache_array)     \
    138     ((size) <= sizeof(stack_cache_array)	  \
    139     ?  (XtPointer)(stack_cache_array)		  \
    140     :  XtMalloc((Cardinal)(size)))
    141 
    142 #define XtStackFree(pointer, stack_cache_array) \
    143     { if ((pointer) != ((XtPointer)(stack_cache_array))) XtFree(pointer); }
    144 
    145 /***************************************************************
    146  *
    147  * Filename defines
    148  *
    149  **************************************************************/
    150 
    151 /* used by XtResolvePathname */
    152 #ifndef XFILESEARCHPATHDEFAULT
    153 #define XFILESEARCHPATHDEFAULT "/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S"
    154 #endif
    155 
    156 /* the following two were both "X Toolkit " prior to R4 */
    157 #ifndef XTERROR_PREFIX
    158 #define XTERROR_PREFIX ""
    159 #endif
    160 
    161 #ifndef XTWARNING_PREFIX
    162 #define XTWARNING_PREFIX ""
    163 #endif
    164 
    165 #ifndef ERRORDB
    166 #define ERRORDB "/usr/lib/X11/XtErrorDB"
    167 #endif
    168 
    169 _XFUNCPROTOBEGIN
    170 
    171 extern String XtCXtToolkitError;
    172 
    173 extern void _XtAllocError(
    174     String	/* alloc_type */
    175 ) _X_NORETURN;
    176 
    177 extern void _XtCompileResourceList(
    178     XtResourceList 	/* resources */,
    179     Cardinal 		/* num_resources */
    180 );
    181 
    182 extern XtGeometryResult _XtMakeGeometryRequest(
    183     Widget 		/* widget */,
    184     XtWidgetGeometry*	/* request */,
    185     XtWidgetGeometry*	/* reply_return */,
    186     Boolean*		/* clear_rect_obj */
    187 );
    188 
    189 extern Boolean _XtIsHookObject(
    190     Widget      /* widget */
    191 );
    192 
    193 extern void _XtAddShellToHookObj(
    194     Widget      /* widget */
    195 );
    196 
    197 /* GCManager.c */
    198 extern void _XtGClistFree(Display *dpy, XtPerDisplay pd);
    199 
    200 /** GeoTattler stuff */
    201 
    202 #ifdef XT_GEO_TATTLER
    203 
    204 extern void _XtGeoTab (int);
    205 extern void _XtGeoTrace (
    206 			    Widget widget,
    207 			    const char *,
    208 			    ...
    209 ) _X_ATTRIBUTE_PRINTF(2,3);
    210 
    211 #define CALLGEOTAT(f) f
    212 
    213 #else /* XT_GEO_TATTLER */
    214 
    215 #define CALLGEOTAT(f)
    216 
    217 #endif /* XT_GEO_TATTLER */
    218 
    219 #ifndef XTTRACEMEMORY
    220 
    221 extern char* __XtMalloc (
    222     unsigned	/* size */
    223 );
    224 extern char* __XtCalloc (
    225     unsigned	/* num */,
    226     unsigned	/* size */
    227 );
    228 
    229 #else
    230 
    231 #define __XtMalloc XtMalloc
    232 #define __XtCalloc XtCalloc
    233 #endif
    234 
    235 _XFUNCPROTOEND
    236 
    237 #endif /* _XtintrinsicI_h */
    238 /* DON'T ADD STUFF AFTER THIS #endif */
    239