Bring back --with-sys-screenrc configure flag.
[screen-lua.git] / src / display.h
blobe8b3b804e65cdbfc561d018f9cb076fd7eb81bd7
1 /* Copyright (c) 2008, 2009
2 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
3 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
4 * Micah Cowan (micah@cowan.name)
5 * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
6 * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
7 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
8 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
9 * Copyright (c) 1987 Oliver Laumann
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3, or (at your option)
14 * any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program (see the file COPYING); if not, see
23 * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 ****************************************************************
27 * $Id$ GNU
30 #ifndef SCREEN_DISPLAY_H
31 #define SCREEN_DISPLAY_H
33 #include "layout.h"
34 #include "canvas.h"
35 #include "viewport.h"
37 #ifdef MAPKEYS
39 #define KMAP_KEYS (T_OCAPS-T_CAPS)
40 #define KMAP_AKEYS (T_OCAPS-T_CURSOR)
42 #define KMAP_NOTIMEOUT 0x4000
44 struct kmap_ext
46 char *str;
47 int fl;
48 struct action um;
49 struct action dm;
50 struct action mm;
53 #else
55 #define KMAP_KEYS 0
57 #endif
59 struct win; /* forward declaration */
61 struct display
63 struct display *d_next; /* linked list */
64 struct acluser *d_user; /* user who owns that display */
65 struct canvas d_canvas; /* our canvas slice */
66 struct canvas *d_cvlist; /* the canvases of this display */
67 struct canvas *d_forecv; /* current input focus */
68 struct layout *d_layout; /* layout we're using */
69 void (*d_processinput) __P((char *, int));
70 char *d_processinputdata; /* data for processinput */
71 int d_vpxmin, d_vpxmax; /* min/max used position on display */
72 struct win *d_fore; /* pointer to fore window */
73 struct win *d_other; /* pointer to other window */
74 int d_nonblock; /* -1 don't block if obufmax reached */
75 /* >0: block after nonblock secs */
76 char d_termname[20 + 1]; /* $TERM */
77 char *d_tentry; /* buffer for tgetstr */
78 char d_tcinited; /* termcap inited flag */
79 int d_width, d_height; /* width/height of the screen */
80 int d_defwidth, d_defheight; /* default width/height of windows */
81 int d_top, d_bot; /* scrollregion start/end */
82 int d_x, d_y; /* cursor position */
83 struct mchar d_rend; /* current rendition */
84 int d_col16change; /* the 16col bits changed in attr */
85 char d_atyp; /* current attribute types */
86 #ifdef DW_CHARS
87 int d_mbcs; /* saved char for multibytes charset */
88 #endif
89 #ifdef ENCODINGS
90 int d_encoding; /* what encoding type the display is */
91 int d_decodestate; /* state of our decoder */
92 int d_realfont; /* real font of terminal */
93 #endif
94 int d_insert; /* insert mode flag */
95 int d_keypad; /* application keypad flag */
96 int d_cursorkeys; /* application cursorkeys flag */
97 int d_revvid; /* reverse video */
98 int d_curvis; /* cursor visibility */
99 int d_has_hstatus; /* display has hardstatus line */
100 int d_hstatus; /* hardstatus used */
101 int d_lp_missing; /* last character on bot line missing */
102 int d_mouse; /* mouse mode */
103 int d_mousetrack; /* set when user wants to use mouse even when the window
104 does not */
105 #ifdef RXVT_OSC
106 int d_xtermosc[4]; /* osc used */
107 #endif
108 struct mchar d_lpchar; /* missing char */
109 struct timeval d_status_time; /* time of status display */
110 int d_status; /* is status displayed? */
111 char d_status_bell; /* is it only a vbell? */
112 int d_status_len; /* length of status line */
113 char *d_status_lastmsg; /* last displayed message */
114 int d_status_buflen; /* last message buffer len */
115 int d_status_lastx; /* position of the cursor */
116 int d_status_lasty; /* before status was displayed */
117 int d_status_obuflen; /* saved obuflen */
118 int d_status_obuffree; /* saved obuffree */
119 int d_status_obufpos; /* end of status position in obuf */
120 struct event d_statusev; /* timeout event */
121 struct event d_hstatusev; /* hstatus changed event */
122 int d_kaablamm; /* display kaablamm msg */
123 struct action *d_ESCseen; /* Was the last char an ESC (^a) */
124 int d_userpid; /* pid of attacher */
125 char d_usertty[MAXPATHLEN]; /* tty we are attached to */
126 int d_userfd; /* fd of the tty */
127 struct event d_readev; /* userfd read event */
128 struct event d_writeev; /* userfd write event */
129 struct event d_blockedev; /* blocked timeout */
130 struct mode d_OldMode; /* tty mode when screen was started */
131 struct mode d_NewMode; /* New tty mode */
132 int d_flow; /* tty's flow control on/off flag*/
133 int d_intrc; /* current intr when flow is on */
134 char *d_obuf; /* output buffer */
135 int d_obuflen; /* len of buffer */
136 int d_obufmax; /* len where we are blocking the pty */
137 int d_obuflenmax; /* len - max */
138 char *d_obufp; /* pointer in buffer */
139 int d_obuffree; /* free bytes in buffer */
140 #ifdef AUTO_NUKE
141 int d_auto_nuke; /* autonuke flag */
142 #endif
143 #ifdef MAPKEYS
144 int d_nseqs; /* number of valid mappings */
145 int d_aseqs; /* number of allocated mappings */
146 unsigned char *d_kmaps; /* keymaps */
147 unsigned char *d_seqp; /* pointer into keymap array */
148 int d_seql; /* number of parsed chars */
149 unsigned char *d_seqh; /* last hit */
150 struct event d_mapev; /* timeout event */
151 int d_dontmap; /* do not map next */
152 int d_mapdefault; /* do map next to default */
153 #endif
154 union tcu d_tcs[T_N]; /* terminal capabilities */
155 char *d_attrtab[NATTR]; /* attrib emulation table */
156 char d_attrtyp[NATTR]; /* attrib group table */
157 int d_hascolor; /* do we support color */
158 short d_dospeed; /* baudrate of tty */
159 #ifdef FONT
160 char d_c0_tab[256]; /* conversion for C0 */
161 char ***d_xtable; /* char translation table */
162 #endif
163 int d_UPcost, d_DOcost, d_LEcost, d_NDcost;
164 int d_CRcost, d_IMcost, d_EIcost, d_NLcost;
165 int d_printfd; /* fd for vt100 print sequence */
166 #ifdef UTMPOK
167 slot_t d_loginslot; /* offset, where utmp_logintty belongs */
168 struct utmp d_utmp_logintty; /* here the original utmp structure is stored */
169 int d_loginttymode;
170 # ifdef _SEQUENT_
171 char d_loginhost[100+1];
172 # endif /* _SEQUENT_ */
173 #endif
174 int d_blocked;
175 int d_blocked_fuzz;
176 struct event d_idleev; /* screen blanker */
177 #ifdef BLANKER_PRG
178 int d_blankerpid;
179 struct event d_blankerev;
180 #endif
183 #ifdef MULTI
184 # define DISPLAY(x) display->x
185 #else
186 extern struct display TheDisplay;
187 # define DISPLAY(x) TheDisplay.x
188 #endif
190 #define D_user DISPLAY(d_user)
191 #define D_username (DISPLAY(d_user) ? DISPLAY(d_user)->u_name : 0)
192 #define D_canvas DISPLAY(d_canvas)
193 #define D_cvlist DISPLAY(d_cvlist)
194 #define D_layout DISPLAY(d_layout)
195 #define D_forecv DISPLAY(d_forecv)
196 #define D_processinput DISPLAY(d_processinput)
197 #define D_processinputdata DISPLAY(d_processinputdata)
198 #define D_vpxmin DISPLAY(d_vpxmin)
199 #define D_vpxmax DISPLAY(d_vpxmax)
200 #define D_fore DISPLAY(d_fore)
201 #define D_other DISPLAY(d_other)
202 #define D_nonblock DISPLAY(d_nonblock)
203 #define D_termname DISPLAY(d_termname)
204 #define D_tentry DISPLAY(d_tentry)
205 #define D_tcinited DISPLAY(d_tcinited)
206 #define D_width DISPLAY(d_width)
207 #define D_height DISPLAY(d_height)
208 #define D_defwidth DISPLAY(d_defwidth)
209 #define D_defheight DISPLAY(d_defheight)
210 #define D_top DISPLAY(d_top)
211 #define D_bot DISPLAY(d_bot)
212 #define D_x DISPLAY(d_x)
213 #define D_y DISPLAY(d_y)
214 #define D_rend DISPLAY(d_rend)
215 #define D_col16change DISPLAY(d_col16change)
216 #define D_atyp DISPLAY(d_atyp)
217 #define D_mbcs DISPLAY(d_mbcs)
218 #define D_encoding DISPLAY(d_encoding)
219 #define D_decodestate DISPLAY(d_decodestate)
220 #define D_realfont DISPLAY(d_realfont)
221 #define D_insert DISPLAY(d_insert)
222 #define D_keypad DISPLAY(d_keypad)
223 #define D_cursorkeys DISPLAY(d_cursorkeys)
224 #define D_revvid DISPLAY(d_revvid)
225 #define D_curvis DISPLAY(d_curvis)
226 #define D_has_hstatus DISPLAY(d_has_hstatus)
227 #define D_hstatus DISPLAY(d_hstatus)
228 #define D_lp_missing DISPLAY(d_lp_missing)
229 #define D_mouse DISPLAY(d_mouse)
230 #define D_mousetrack DISPLAY(d_mousetrack)
231 #define D_xtermosc DISPLAY(d_xtermosc)
232 #define D_lpchar DISPLAY(d_lpchar)
233 #define D_status DISPLAY(d_status)
234 #define D_status_time DISPLAY(d_status_time)
235 #define D_status_bell DISPLAY(d_status_bell)
236 #define D_status_len DISPLAY(d_status_len)
237 #define D_status_lastmsg DISPLAY(d_status_lastmsg)
238 #define D_status_buflen DISPLAY(d_status_buflen)
239 #define D_status_lastx DISPLAY(d_status_lastx)
240 #define D_status_lasty DISPLAY(d_status_lasty)
241 #define D_status_obuflen DISPLAY(d_status_obuflen)
242 #define D_status_obuffree DISPLAY(d_status_obuffree)
243 #define D_status_obufpos DISPLAY(d_status_obufpos)
244 #define D_statusev DISPLAY(d_statusev)
245 #define D_hstatusev DISPLAY(d_hstatusev)
246 #define D_kaablamm DISPLAY(d_kaablamm)
247 #define D_ESCseen DISPLAY(d_ESCseen)
248 #define D_userpid DISPLAY(d_userpid)
249 #define D_usertty DISPLAY(d_usertty)
250 #define D_userfd DISPLAY(d_userfd)
251 #define D_OldMode DISPLAY(d_OldMode)
252 #define D_NewMode DISPLAY(d_NewMode)
253 #define D_flow DISPLAY(d_flow)
254 #define D_intr DISPLAY(d_intr)
255 #define D_obuf DISPLAY(d_obuf)
256 #define D_obuflen DISPLAY(d_obuflen)
257 #define D_obufmax DISPLAY(d_obufmax)
258 #define D_obuflenmax DISPLAY(d_obuflenmax)
259 #define D_obufp DISPLAY(d_obufp)
260 #define D_obuffree DISPLAY(d_obuffree)
261 #define D_auto_nuke DISPLAY(d_auto_nuke)
262 #define D_nseqs DISPLAY(d_nseqs)
263 #define D_aseqs DISPLAY(d_aseqs)
264 #define D_seqp DISPLAY(d_seqp)
265 #define D_seql DISPLAY(d_seql)
266 #define D_seqh DISPLAY(d_seqh)
267 #define D_dontmap DISPLAY(d_dontmap)
268 #define D_mapdefault DISPLAY(d_mapdefault)
269 #define D_kmaps DISPLAY(d_kmaps)
270 #define D_tcs DISPLAY(d_tcs)
271 #define D_attrtab DISPLAY(d_attrtab)
272 #define D_attrtyp DISPLAY(d_attrtyp)
273 #define D_hascolor DISPLAY(d_hascolor)
274 #define D_dospeed DISPLAY(d_dospeed)
275 #define D_c0_tab DISPLAY(d_c0_tab)
276 #define D_xtable DISPLAY(d_xtable)
277 #define D_UPcost DISPLAY(d_UPcost)
278 #define D_DOcost DISPLAY(d_DOcost)
279 #define D_LEcost DISPLAY(d_LEcost)
280 #define D_NDcost DISPLAY(d_NDcost)
281 #define D_CRcost DISPLAY(d_CRcost)
282 #define D_IMcost DISPLAY(d_IMcost)
283 #define D_EIcost DISPLAY(d_EIcost)
284 #define D_NLcost DISPLAY(d_NLcost)
285 #define D_printfd DISPLAY(d_printfd)
286 #define D_loginslot DISPLAY(d_loginslot)
287 #define D_utmp_logintty DISPLAY(d_utmp_logintty)
288 #define D_loginttymode DISPLAY(d_loginttymode)
289 #define D_loginhost DISPLAY(d_loginhost)
290 #define D_readev DISPLAY(d_readev)
291 #define D_writeev DISPLAY(d_writeev)
292 #define D_blockedev DISPLAY(d_blockedev)
293 #define D_mapev DISPLAY(d_mapev)
294 #define D_blocked DISPLAY(d_blocked)
295 #define D_blocked_fuzz DISPLAY(d_blocked_fuzz)
296 #define D_idleev DISPLAY(d_idleev)
297 #define D_blankerev DISPLAY(d_blankerev)
298 #define D_blankerpid DISPLAY(d_blankerpid)
301 #define GRAIN 4096 /* Allocation grain size for output buffer */
302 #define OBUF_MAX 256 /* default for obuflimit */
304 #define OUTPUT_BLOCK_SIZE 256 /* Block size of output to tty */
306 #define AddChar(c) \
307 do \
309 if (--D_obuffree <= 0) \
310 Resize_obuf(); \
311 *D_obufp++ = (c); \
313 while (0)
315 #define STATUS_OFF 0
316 #define STATUS_ON_WIN 1
317 #define STATUS_ON_HS 2
319 #define HSTATUS_IGNORE 0
320 #define HSTATUS_LASTLINE 1
321 #define HSTATUS_MESSAGE 2
322 #define HSTATUS_HS 3
323 #define HSTATUS_ALWAYS (1<<2)
325 #endif /* SCREEN_DISPLAY_H */