Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/tkMacOSXPort.h @ 69:33d812a61356
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 17:55:14 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 69:33d812a61356 |
---|---|
1 /* | |
2 * tkMacOSXPort.h -- | |
3 * | |
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. | |
7 * | |
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> | |
11 * | |
12 * See the file "license.terms" for information on usage and redistribution | |
13 * of this file, and for a DISCLAIMER OF ALL WARRANTIES. | |
14 */ | |
15 | |
16 #ifndef _TKMACPORT | |
17 #define _TKMACPORT | |
18 | |
19 #include <stdio.h> | |
20 #include <pwd.h> | |
21 #include <assert.h> | |
22 #include <errno.h> | |
23 #include <fcntl.h> | |
24 #include <ctype.h> | |
25 #include <math.h> | |
26 #include <string.h> | |
27 #include <limits.h> | |
28 #include <stdlib.h> | |
29 #include <sys/types.h> | |
30 #include <sys/file.h> | |
31 #ifdef HAVE_SYS_SELECT_H | |
32 # include <sys/select.h> | |
33 #endif | |
34 #include <sys/stat.h> | |
35 #ifndef _TCL | |
36 # include <tcl.h> | |
37 #endif | |
38 #ifdef HAVE_SYS_TIME_H | |
39 # include <sys/time.h> | |
40 #endif | |
41 #include <time.h> | |
42 #ifdef HAVE_INTTYPES_H | |
43 # include <inttypes.h> | |
44 #endif | |
45 #include <unistd.h> | |
46 #if defined(__GNUC__) && !defined(__cplusplus) | |
47 # pragma GCC diagnostic ignored "-Wc++-compat" | |
48 #endif | |
49 #include <X11/Xlib.h> | |
50 #include <X11/cursorfont.h> | |
51 #include <X11/keysym.h> | |
52 #include <X11/Xatom.h> | |
53 #include <X11/Xfuncproto.h> | |
54 #include <X11/Xutil.h> | |
55 | |
56 /* | |
57 * The following macro defines the type of the mask arguments to | |
58 * select: | |
59 */ | |
60 | |
61 #ifndef NO_FD_SET | |
62 # define SELECT_MASK fd_set | |
63 #else | |
64 # ifndef _AIX | |
65 typedef long fd_mask; | |
66 # endif | |
67 # if defined(_IBMR2) | |
68 # define SELECT_MASK void | |
69 # else | |
70 # define SELECT_MASK int | |
71 # endif | |
72 #endif | |
73 | |
74 /* | |
75 * Used to tag functions that are only to be visible within the module being | |
76 * built and not outside it (where this is supported by the linker). | |
77 */ | |
78 | |
79 #ifndef MODULE_SCOPE | |
80 # ifdef __cplusplus | |
81 # define MODULE_SCOPE extern "C" | |
82 # else | |
83 # define MODULE_SCOPE extern | |
84 # endif | |
85 #endif | |
86 | |
87 /* | |
88 * The following macro defines the number of fd_masks in an fd_set: | |
89 */ | |
90 | |
91 #ifndef FD_SETSIZE | |
92 # ifdef OPEN_MAX | |
93 # define FD_SETSIZE OPEN_MAX | |
94 # else | |
95 # define FD_SETSIZE 256 | |
96 # endif | |
97 #endif | |
98 #if !defined(howmany) | |
99 # define howmany(x, y) (((x)+((y)-1))/(y)) | |
100 #endif | |
101 #ifndef NFDBITS | |
102 # define NFDBITS NBBY*sizeof(fd_mask) | |
103 #endif | |
104 #define MASK_SIZE howmany(FD_SETSIZE, NFDBITS) | |
105 | |
106 /* | |
107 * Define "NBBY" (number of bits per byte) if it's not already defined. | |
108 */ | |
109 | |
110 #ifndef NBBY | |
111 # define NBBY 8 | |
112 #endif | |
113 | |
114 /* | |
115 * The following define causes Tk to use its internal keysym hash table | |
116 */ | |
117 | |
118 #define REDO_KEYSYM_LOOKUP | |
119 | |
120 /* | |
121 * Defines for X functions that are used by Tk but are treated as | |
122 * no-op functions on the Macintosh. | |
123 */ | |
124 | |
125 #undef XFlush | |
126 #define XFlush(display) (0) | |
127 #undef XFree | |
128 #define XFree(data) (((data) != NULL) ? (ckfree(data),0) : 0) | |
129 #undef XGrabServer | |
130 #define XGrabServer(display) (0) | |
131 #undef XNoOp | |
132 #define XNoOp(display) (display->request++,0) | |
133 #undef XUngrabServer | |
134 #define XUngrabServer(display) (0) | |
135 #undef XSynchronize | |
136 #define XSynchronize(display, onoff) (display->request++,NULL) | |
137 #undef XVisualIDFromVisual | |
138 #define XVisualIDFromVisual(visual) (visual->visualid) | |
139 | |
140 /* | |
141 * The following functions are not used on the Mac, so we stub them out. | |
142 */ | |
143 | |
144 #define TkpCmapStressed(tkwin,colormap) (0) | |
145 #define TkpFreeColor(tkColPtr) | |
146 #define TkSetPixmapColormap(p,c) {} | |
147 #define TkpSync(display) | |
148 | |
149 /* | |
150 * TkMacOSXGetCapture is a legacy function used on the Mac. When fixing | |
151 * [943d5ebe51], TkpGetCapture was added to the Windows port. Both | |
152 * are actually the same feature and should bear the same name. However, | |
153 * in order to avoid potential backwards incompatibilities, renaming | |
154 * TkMacOSXGetCapture into TkpGetCapture in *PlatDecls.h shall not be | |
155 * done in a patch release, therefore use a define here. | |
156 */ | |
157 | |
158 #define TkpGetCapture TkMacOSXGetCapture | |
159 | |
160 /* | |
161 * This macro stores a representation of the window handle in a string. | |
162 */ | |
163 | |
164 #define TkpPrintWindowId(buf,w) \ | |
165 sprintf((buf), "0x%lx", (unsigned long) (w)) | |
166 | |
167 /* | |
168 * Turn off Tk double-buffering as Aqua windows are already double-buffered. | |
169 */ | |
170 | |
171 #define TK_NO_DOUBLE_BUFFERING 1 | |
172 #define TK_HAS_DYNAMIC_COLORS 1 | |
173 #define TK_DYNAMIC_COLORMAP 0x0fffffff | |
174 | |
175 /* | |
176 * Inform tkImgPhInstance.c that we implement TkpPutRGBAImage to render RGBA | |
177 * images directly into a window. | |
178 */ | |
179 | |
180 #define TK_CAN_RENDER_RGBA | |
181 | |
182 MODULE_SCOPE int TkpPutRGBAImage( | |
183 Display* display, Drawable drawable, GC gc,XImage* image, | |
184 int src_x, int src_y, int dest_x, int dest_y, | |
185 unsigned int width, unsigned int height); | |
186 | |
187 /* | |
188 * Used by xcolor.c | |
189 */ | |
190 | |
191 MODULE_SCOPE unsigned long TkMacOSXRGBPixel(unsigned long red, unsigned long green, | |
192 unsigned long blue); | |
193 #define TkpGetPixel(p) (TkMacOSXRGBPixel(p->red >> 8, p->green >> 8, p->blue >> 8)) | |
194 | |
195 /* | |
196 * Used by tkAppInit | |
197 */ | |
198 | |
199 #define USE_CUSTOM_EXIT_PROC | |
200 EXTERN int TkpWantsExitProc(void); | |
201 EXTERN TCL_NORETURN void TkpExitProc(void *); | |
202 | |
203 #endif /* _TKMACPORT */ |