jpayne@69: /* jpayne@69: * tkMacOSXPort.h -- jpayne@69: * jpayne@69: * This file is included by all of the Tk C files. It contains jpayne@69: * information that may be configuration-dependent, such as jpayne@69: * #includes for system include files and a few other things. jpayne@69: * jpayne@69: * Copyright (c) 1994-1996 Sun Microsystems, Inc. jpayne@69: * Copyright 2001-2009, Apple Inc. jpayne@69: * Copyright (c) 2005-2009 Daniel A. Steffen jpayne@69: * jpayne@69: * See the file "license.terms" for information on usage and redistribution jpayne@69: * of this file, and for a DISCLAIMER OF ALL WARRANTIES. jpayne@69: */ jpayne@69: jpayne@69: #ifndef _TKMACPORT jpayne@69: #define _TKMACPORT jpayne@69: jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #ifdef HAVE_SYS_SELECT_H jpayne@69: # include jpayne@69: #endif jpayne@69: #include jpayne@69: #ifndef _TCL jpayne@69: # include jpayne@69: #endif jpayne@69: #ifdef HAVE_SYS_TIME_H jpayne@69: # include jpayne@69: #endif jpayne@69: #include jpayne@69: #ifdef HAVE_INTTYPES_H jpayne@69: # include jpayne@69: #endif jpayne@69: #include jpayne@69: #if defined(__GNUC__) && !defined(__cplusplus) jpayne@69: # pragma GCC diagnostic ignored "-Wc++-compat" jpayne@69: #endif jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: #include jpayne@69: jpayne@69: /* jpayne@69: * The following macro defines the type of the mask arguments to jpayne@69: * select: jpayne@69: */ jpayne@69: jpayne@69: #ifndef NO_FD_SET jpayne@69: # define SELECT_MASK fd_set jpayne@69: #else jpayne@69: # ifndef _AIX jpayne@69: typedef long fd_mask; jpayne@69: # endif jpayne@69: # if defined(_IBMR2) jpayne@69: # define SELECT_MASK void jpayne@69: # else jpayne@69: # define SELECT_MASK int jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * Used to tag functions that are only to be visible within the module being jpayne@69: * built and not outside it (where this is supported by the linker). jpayne@69: */ jpayne@69: jpayne@69: #ifndef MODULE_SCOPE jpayne@69: # ifdef __cplusplus jpayne@69: # define MODULE_SCOPE extern "C" jpayne@69: # else jpayne@69: # define MODULE_SCOPE extern jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * The following macro defines the number of fd_masks in an fd_set: jpayne@69: */ jpayne@69: jpayne@69: #ifndef FD_SETSIZE jpayne@69: # ifdef OPEN_MAX jpayne@69: # define FD_SETSIZE OPEN_MAX jpayne@69: # else jpayne@69: # define FD_SETSIZE 256 jpayne@69: # endif jpayne@69: #endif jpayne@69: #if !defined(howmany) jpayne@69: # define howmany(x, y) (((x)+((y)-1))/(y)) jpayne@69: #endif jpayne@69: #ifndef NFDBITS jpayne@69: # define NFDBITS NBBY*sizeof(fd_mask) jpayne@69: #endif jpayne@69: #define MASK_SIZE howmany(FD_SETSIZE, NFDBITS) jpayne@69: jpayne@69: /* jpayne@69: * Define "NBBY" (number of bits per byte) if it's not already defined. jpayne@69: */ jpayne@69: jpayne@69: #ifndef NBBY jpayne@69: # define NBBY 8 jpayne@69: #endif jpayne@69: jpayne@69: /* jpayne@69: * The following define causes Tk to use its internal keysym hash table jpayne@69: */ jpayne@69: jpayne@69: #define REDO_KEYSYM_LOOKUP jpayne@69: jpayne@69: /* jpayne@69: * Defines for X functions that are used by Tk but are treated as jpayne@69: * no-op functions on the Macintosh. jpayne@69: */ jpayne@69: jpayne@69: #undef XFlush jpayne@69: #define XFlush(display) (0) jpayne@69: #undef XFree jpayne@69: #define XFree(data) (((data) != NULL) ? (ckfree(data),0) : 0) jpayne@69: #undef XGrabServer jpayne@69: #define XGrabServer(display) (0) jpayne@69: #undef XNoOp jpayne@69: #define XNoOp(display) (display->request++,0) jpayne@69: #undef XUngrabServer jpayne@69: #define XUngrabServer(display) (0) jpayne@69: #undef XSynchronize jpayne@69: #define XSynchronize(display, onoff) (display->request++,NULL) jpayne@69: #undef XVisualIDFromVisual jpayne@69: #define XVisualIDFromVisual(visual) (visual->visualid) jpayne@69: jpayne@69: /* jpayne@69: * The following functions are not used on the Mac, so we stub them out. jpayne@69: */ jpayne@69: jpayne@69: #define TkpCmapStressed(tkwin,colormap) (0) jpayne@69: #define TkpFreeColor(tkColPtr) jpayne@69: #define TkSetPixmapColormap(p,c) {} jpayne@69: #define TkpSync(display) jpayne@69: jpayne@69: /* jpayne@69: * TkMacOSXGetCapture is a legacy function used on the Mac. When fixing jpayne@69: * [943d5ebe51], TkpGetCapture was added to the Windows port. Both jpayne@69: * are actually the same feature and should bear the same name. However, jpayne@69: * in order to avoid potential backwards incompatibilities, renaming jpayne@69: * TkMacOSXGetCapture into TkpGetCapture in *PlatDecls.h shall not be jpayne@69: * done in a patch release, therefore use a define here. jpayne@69: */ jpayne@69: jpayne@69: #define TkpGetCapture TkMacOSXGetCapture jpayne@69: jpayne@69: /* jpayne@69: * This macro stores a representation of the window handle in a string. jpayne@69: */ jpayne@69: jpayne@69: #define TkpPrintWindowId(buf,w) \ jpayne@69: sprintf((buf), "0x%lx", (unsigned long) (w)) jpayne@69: jpayne@69: /* jpayne@69: * Turn off Tk double-buffering as Aqua windows are already double-buffered. jpayne@69: */ jpayne@69: jpayne@69: #define TK_NO_DOUBLE_BUFFERING 1 jpayne@69: #define TK_HAS_DYNAMIC_COLORS 1 jpayne@69: #define TK_DYNAMIC_COLORMAP 0x0fffffff jpayne@69: jpayne@69: /* jpayne@69: * Inform tkImgPhInstance.c that we implement TkpPutRGBAImage to render RGBA jpayne@69: * images directly into a window. jpayne@69: */ jpayne@69: jpayne@69: #define TK_CAN_RENDER_RGBA jpayne@69: jpayne@69: MODULE_SCOPE int TkpPutRGBAImage( jpayne@69: Display* display, Drawable drawable, GC gc,XImage* image, jpayne@69: int src_x, int src_y, int dest_x, int dest_y, jpayne@69: unsigned int width, unsigned int height); jpayne@69: jpayne@69: /* jpayne@69: * Used by xcolor.c jpayne@69: */ jpayne@69: jpayne@69: MODULE_SCOPE unsigned long TkMacOSXRGBPixel(unsigned long red, unsigned long green, jpayne@69: unsigned long blue); jpayne@69: #define TkpGetPixel(p) (TkMacOSXRGBPixel(p->red >> 8, p->green >> 8, p->blue >> 8)) jpayne@69: jpayne@69: /* jpayne@69: * Used by tkAppInit jpayne@69: */ jpayne@69: jpayne@69: #define USE_CUSTOM_EXIT_PROC jpayne@69: EXTERN int TkpWantsExitProc(void); jpayne@69: EXTERN TCL_NORETURN void TkpExitProc(void *); jpayne@69: jpayne@69: #endif /* _TKMACPORT */