1 /*
2  * Copyright (C) 1997-2009, Michael Jennings
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to
6  * deal in the Software without restriction, including without limitation the
7  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8  * sell copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies of the Software, its documentation and marketing & publicity
13  * materials, and acknowledgment shall be given in the documentation, materials
14  * and software packages that this Software was used.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  */
23 
24 #ifndef _FEATURE_H_
25 # define _FEATURE_H_
26 
27 /********************* Miscellaneous OS fixings *********************/
28 
29 # if defined(hpux) && !defined(_HPUX_SOURCE)
30 #  define _HPUX_SOURCE
31 # endif
32 
33 /*
34 # if defined(_HPUX_SOURCE) && !defined(SVR4)
35 #  define SVR4
36 # endif
37  */
38 
39 # if defined(SVR4) || defined(__SVR4)
40 #  ifndef __svr4__
41 #   define __svr4__
42 #  endif
43 # endif
44 
45 # if defined(sun) && !defined(__sun__)
46 #  define __sun__
47 # endif
48 # if !defined(sun) && defined(__sun__)
49 #  define sun
50 # endif
51 
52 # if defined (sun)
53 #  undef HAVE_SYS_IOCTL_H
54 # endif
55 
56 # ifdef __GNUC__
57 #  ifndef _GNU_SOURCE
58 #   define _GNU_SOURCE
59 #  endif
60 # else
61 #  define _XOPEN_SOURCE 600
62 #  define _XOPEN_SOURCE_EXTENDED 1
63 # endif
64 
65 /********************* Debugging stuff *********************/
66 /* As Keith Bunge would say, don't crap with the debugging stuff below
67  * unless you develop this mess. :^)   -- mej
68  */
69 
70 # ifndef DEBUG
71 #   define DEBUG 0
72 # endif
73 
74 /********************* Random development stuff ***************************/
75 #ifdef ENABLE_PROFILE
76 # define PROFILE_SCREEN
77 # define PROFILE_X_EVENTS
78 # define COUNT_X_EVENTS
79 #endif
80 
81 #define OPTIMIZE_HACKS
82 #define USE_EFFECTS
83 
84 /* For Pablo I/O Trace Library */
85 #ifdef IOTRACE
86 # include <IOTrace.h>
87 # include <PabloTrace.h>
88 # define PABLO_START_TRACING()  do {setTraceProcessorNumber(0); setTraceFileName("Eterm-pablo-trace.sddf"); initIOTrace(); \
89                                     enableLifetimeSummaries(); enableTimeWindowSummaries(0.1); enableFileRegionSummaries(8192); \
90                                    } while (0)
91 # define PABLO_STOP_TRACING()   do {endIOTrace(); endTracing();} while (0)
92 #else
93 # define PABLO_START_TRACING()  ((void) 0)
94 # define PABLO_STOP_TRACING()   ((void) 0)
95 #endif
96 
97 # include <stdio.h>
98 # include <stdlib.h>
99 
100 # include <libast.h>
101 # include "eterm_debug.h"
102 
103 /********************* Color, screen, and image stuff *********************/
104 
105 /* Support for background pixmap cycling */
106 #define BACKGROUND_CYCLING_SUPPORT
107 
108 /* The environment variable in which Eterm looks for a search path for
109    config files and pixmaps */
110 #define PATH_ENV	"ETERMPATH"
111 
112 /* Disable the secondary screen ("\E[?47h" / "\E[?47l") */
113 /* #define NO_SECONDARY_SCREEN */
114 
115 /* The number of screenfuls between refreshes.  Anything higher than 1
116  * will cause gaps in the scrollback buffer. */
117 # define REFRESH_PERIOD  1
118 
119 /* This will force clearing of characters before writing new ones on top of
120  * them. This is experimental - added in order to try and fix pixel dropping
121  * problems some people have had. */
122 /*# define FORCE_CLEAR_CHARS*/
123 
124 /* The command through which to pipe print-screen requests */
125 #define PRINTPIPE	"lp"
126 
127 /* If the screen can handle 24-bit graphics, force them */
128 /* #define PREFER_24BIT */
129 
130 /* Offer some support for the Offix DND (Drag 'n' Drop) protocol (untested) */
131 /* #define OFFIX_DND */
132 
133 /* Allows the -w and --border-width options for specifying the width of the
134  * border (in pixels) between the actual X client window and the program-useable
135  * terminal window.                                                 -- mej
136  */
137 # define BORDER_WIDTH_OPTION
138 
139 /********************* Key and key-bindings options *********************/
140 
141 /* Pick the hotkey for changing the font size */
142 # define HOTKEY_CTRL
143 /* #define HOTKEY_META */
144 
145 /* Use Home = "\E[1~" and End = "\E[4~" instead of Home = "\E[7~" and End = "\E[8~" */
146 /* #define LINUX_KEYS */
147 
148 /* Allow the "keysym" attribute in config files for remapping keysyms */
149 #define KEYSYM_ATTRIBUTE
150 
151 /* Allow unshifted Next and Prior keys to scroll, in addition to their shifted
152  * counterparts */
153 /* #define UNSHIFTED_SCROLLKEYS */
154 
155 /********************* Mouse, scrollbar, and menu bar options *********************/
156 
157 /* Disable sending escape sequences from the scrollbar when mouse reporting
158  * is enabled */
159 /* #define NO_SCROLLBAR_REPORT */
160 
161 /* Set the default number of lines in the scrollback buffer */
162 /* #define SAVELINES 256 */
163 
164 /* Set the default separator characters for double-click word selection */
165 #define CUTCHARS "\"&'()*,;<=>?@[\\]^`{|} \t"
166 
167 /* Make it an option */
168 #define CUTCHAR_OPTION
169 
170 /* To activate double-click reporting for button 1 */
171 /* #define MOUSE_REPORT_DOUBLECLICK */
172 
173 /* The delay in milliseconds between multiple clicks */
174 /* #define MULTICLICK_TIME 500 */
175 
176 /* Support for the old xterm-style scrollbar */
177 #define XTERM_SCROLLBAR
178 
179 /* Support for the traditional motif-style scrollbar */
180 #define MOTIF_SCROLLBAR
181 
182 /* Support for a NeXT-style scrollbar */
183 #define NEXT_SCROLLBAR
184 
185 /* Default scrollbar type */
186 #define SCROLLBAR_DEFAULT_TYPE SCROLLBAR_MOTIF
187 
188 /* The default width (in pixels) of the scrollbar. */
189 #define SB_WIDTH 10
190 
191 /* Continuous scrolling by pressing the scrollbar arrow buttons */
192 #define SCROLLBAR_BUTTON_CONTINUAL_SCROLLING
193 
194 /* Delay periods for continuous scrolling */
195 /* #define SCROLLBAR_INITIAL_DELAY 40 */
196 /* #define SCROLLBAR_CONTINUOUS_DELAY 2 */
197 
198 /* How many lines of context to keep on screen when paging up/down */
199 #define CONTEXT_LINES 1
200 
201 /********************* Multi-lingual support options *********************/
202 
203 /* Allow option/attribute for Meta to set the 8th bit */
204 #define META8_OPTION
205 
206 /* Attempt to deactivate UTF-8 and similar locales. */
207 /* #define NO_UTF8_LOCALE */
208 
209 /********************* Miscellaneous options *********************/
210 
211 /* To have "\E[7n" reply with the display name.  This is a potential security risk,
212  * so its use is discouraged and unsupported. */
213 /* #define ENABLE_DISPLAY_ANSWER */
214 
215 /* To control what the Eterm detection sequence, ESC-Z, replies with */
216 /* #define ESCZ_ANSWER	"\033[?1;2C" */
217 
218 /* Defining NO_ENQ_ANS disables the response to the ENQ (Ctrl-E) character.  I
219  * don't believe xterm answers this one, so neither will we by default.  xterm
220  * does, however, answer the ANSI/ECMA-48 DA sequence \e[c (the u9 capability).
221  * We won't.  It seems to cause trouble on some systems.
222  */
223 #define NO_ENQ_ANS
224 #define NO_VT100_ANS
225 
226 /* Allow changing of the foreground and background colors with "\E]39;color^G" */
227 #define XTERM_COLOR_CHANGE
228 
229 /* Disable automatic de-iconify on bell altogether */
230 /* #define NO_MAPALERT */
231 
232 /* Make it an option */
233 #define MAPALERT_OPTION
234 
235 /********************* Anti-cl00bie protection (sigh) *********************/
236 /* EDITING THIS FILE BELOW THIS LINE IS UNSUPPORTED!  YOU HAVE BEEN WARNED! */
237 
238 #ifdef MULTI_CHARSET
239 # undef GREEK_SUPPORT
240 # undef XTERM_FONT_CHANGE
241 # undef DEFINE_XTERM_COLOR
242 #endif	/* MULTI_CHARSET */
243 #define FONT0_IDX 2
244 
245 #ifndef PIXMAP_SUPPORT
246 # undef PIXMAP_OFFSET
247 # undef IMLIB_TRANS
248 # undef BACKGROUND_CYCLING_SUPPORT
249 # undef WATCH_PIXMAP_OPTION
250 #endif
251 
252 #ifndef PIXMAP_OFFSET
253 # undef WATCH_DESKTOP_OPTION
254 #endif
255 
256 #ifndef HAVE_MEMMOVE
257 inline void *memmove(void *, const void *, size_t);
258 #endif
259 
260 #define APL_NAME	"Eterm"
261 
262 /* COLORTERM, TERM environment variables */
263 #define TERMENV       "kterm"
264 #define COLORTERMENV  "kterm"
265 
266 #ifdef NO_MOUSE_REPORT
267 # ifndef NO_MOUSE_REPORT_SCROLLBAR
268 #  define NO_MOUSE_REPORT_SCROLLBAR
269 # endif
270 #endif
271 
272 #ifndef DEFAULT_BORDER_WIDTH
273 # define DEFAULT_BORDER_WIDTH 5
274 #endif
275 
276 #ifndef SB_WIDTH
277 # define SB_WIDTH 10
278 #endif
279 
280 #ifndef SAVELINES
281 # define SAVELINES 256
282 #endif
283 
284 #ifdef NO_SECONDARY_SCREEN
285 # define NSCREENS       0
286 #else
287 # define NSCREENS       1
288 #endif
289 
290 #ifndef DEFAULT_REFRESH
291 # define DEFAULT_REFRESH FAST_REFRESH
292 #endif
293 
294 #ifndef CUTCHARS
295 # define CUTCHARS "\"&'()*,;<=>?@[\\]^`{|}~"
296 #endif
297 
298 #if defined (__sun__) || defined (__svr4__)
299 # define NO_DELETE_KEY		/* These systems seem to be anal this way*/
300 #endif
301 
302 #if !defined(HAVE_X11_EXTENSIONS_XRES_H)
303 # undef HAVE_XRES_EXT
304 #endif
305 
306 #ifndef PATH_ENV
307 # define PATH_ENV "ETERMPATH"
308 #endif
309 
310 #if defined(_POSIX_VERSION) && defined(_POSIX_SAVED_IDS)
311 #  ifdef HAVE_SAVED_UIDS
312 #    undef HAVE_SAVED_UIDS
313 #  endif
314 #  define HAVE_SAVED_UIDS 1
315 #endif
316 
317 /* utmp doesn't work on CygWin32 */
318 #ifdef __CYGWIN32__
319 # undef UTMP_SUPPORT
320 #endif
321 
322 #endif	/* _FEATURE_H_ */
323