4 * This file is included by all of the Tk C files. It contains
5 * information that may be configuration-dependent, such as
6 * #includes for system include files and a few other things.
8 * Copyright (c) 1994-1996 Sun Microsystems, Inc.
9 * Copyright 2001-2009, Apple Inc.
10 * Copyright (c) 2005-2009 Daniel A. Steffen <das@users.sourceforge.net>
12 * See the file "license.terms" for information on usage and redistribution
13 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
29 #include <sys/types.h>
31 #ifdef HAVE_SYS_SELECT_H
32 # include <sys/select.h>
38 #if TIME_WITH_SYS_TIME
39 # include <sys/time.h>
43 # include <sys/time.h>
49 # include <inttypes.h>
52 #if defined(__GNUC__) && !defined(__cplusplus)
53 # pragma GCC diagnostic ignored "-Wc++-compat"
56 #include <X11/cursorfont.h>
57 #include <X11/keysym.h>
58 #include <X11/Xatom.h>
59 #include <X11/Xfuncproto.h>
60 #include <X11/Xutil.h>
63 * The following macro defines the type of the mask arguments to
68 # define SELECT_MASK fd_set
74 # define SELECT_MASK void
76 # define SELECT_MASK int
81 * Used to tag functions that are only to be visible within the module being
82 * built and not outside it (where this is supported by the linker).
87 # define MODULE_SCOPE extern "C"
89 # define MODULE_SCOPE extern
94 * The following macro defines the number of fd_masks in an fd_set:
99 # define FD_SETSIZE OPEN_MAX
101 # define FD_SETSIZE 256
104 #if !defined(howmany)
105 # define howmany(x, y) (((x)+((y)-1))/(y))
108 # define NFDBITS NBBY*sizeof(fd_mask)
110 #define MASK_SIZE howmany(FD_SETSIZE, NFDBITS)
113 * Define "NBBY" (number of bits per byte) if it's not already defined.
121 * The following define causes Tk to use its internal keysym hash table
124 #define REDO_KEYSYM_LOOKUP
127 * Defines for X functions that are used by Tk but are treated as
128 * no-op functions on the Macintosh.
132 #define XFlush(display) (0)
134 #define XFree(data) (((data) != NULL) ? (ckfree(data),0) : 0)
136 #define XGrabServer(display) (0)
138 #define XNoOp(display) (display->request++,0)
140 #define XUngrabServer(display) (0)
142 #define XSynchronize(display, onoff) (display->request++,NULL)
143 #undef XVisualIDFromVisual
144 #define XVisualIDFromVisual(visual) (visual->visualid)
147 * The following functions are not used on the Mac, so we stub them out.
150 #define TkpCmapStressed(tkwin,colormap) (0)
151 #define TkpFreeColor(tkColPtr)
152 #define TkSetPixmapColormap(p,c) {}
153 #define TkpSync(display)
156 * TkMacOSXGetCapture is a legacy function used on the Mac. When fixing
157 * [943d5ebe51], TkpGetCapture was added to the Windows port. Both
158 * are actually the same feature and should bear the same name. However,
159 * in order to avoid potential backwards incompatibilities, renaming
160 * TkMacOSXGetCapture into TkpGetCapture in *PlatDecls.h shall not be
161 * done in a patch release, therefore use a define here.
164 #define TkpGetCapture TkMacOSXGetCapture
167 * This macro stores a representation of the window handle in a string.
170 #define TkpPrintWindowId(buf,w) \
171 sprintf((buf), "0x%lx", (unsigned long) (w))
174 * Turn off Tk double-buffering as Aqua windows are already double-buffered.
177 #define TK_NO_DOUBLE_BUFFERING 1
178 #define TK_HAS_DYNAMIC_COLORS 1
179 #define TK_DYNAMIC_COLORMAP 0x0fffffff
182 * Inform tkImgPhInstance.c that we implement TkpPutRGBAImage to render RGBA
183 * images directly into a window.
186 #define TK_CAN_RENDER_RGBA
188 MODULE_SCOPE int TkpPutRGBAImage(
189 Display* display, Drawable drawable, GC gc,XImage* image,
190 int src_x, int src_y, int dest_x, int dest_y,
191 unsigned int width, unsigned int height);
197 MODULE_SCOPE unsigned long TkMacOSXRGBPixel(unsigned long red, unsigned long green,
199 #define TkpGetPixel(p) (TkMacOSXRGBPixel(p->red >> 8, p->green >> 8, p->blue >> 8))
205 MODULE_SCOPE void TkMacOSXHandleMapOrUnmap(Tk_Window tkwin, XEvent *event);
207 #define TkpHandleMapOrUnmap(tkwin, event) TkMacOSXHandleMapOrUnmap(tkwin, event)
213 #define USE_CUSTOM_EXIT_PROC
214 EXTERN int TkpWantsExitProc(void);
215 EXTERN TCL_NORETURN void TkpExitProc(void *);
217 #endif /* _TKMACPORT */