1
/* Copyright (c) 1993-2002
2
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
3
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
4
* Copyright (c) 1987 Oliver Laumann
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program (see the file COPYING); if not, write to the
18
* Free Software Foundation, Inc.,
19
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
21
****************************************************************
22
* $Id: window.h,v 1.11 1994/05/31 12:33:27 mlschroe Exp $ FAU
26
/* keep this in sync with the initialisations in window.c */
29
int StartAt; /* where to start the search for the slot */
30
char *aka; /* aka string */
31
char **args; /* argv vector */
32
char *dir; /* directory for chdir */
33
char *term; /* TERM to be set instead of "screen" */
39
int wlock; /* default writelock setting */
42
int Lflag; /* logging */
43
int slow; /* inter character milliseconds */
59
struct event p_readev;
60
struct event p_writeev;
63
char p_inbuf[IOSIZE]; /* buffered writing to p_ptyfd */
68
#define F_PMASK 0x0003
70
#define F_PFRONT 0x0001 /* . */
71
#define F_PBACK 0x0002 /* ! */
72
#define F_PBOTH (F_PFRONT | F_PBACK) /* : */
74
#define F_UWP 0x1000 /* | */
76
/* The screen process ...)
77
* ... wants to write to pseudo */
78
#define W_WP(w) ((w)->w_pwin && ((w)->w_pwin->p_fdpat & F_PFRONT))
80
/* ... wants to write to window: user writes to window
81
* or stdout/stderr of pseudo are duplicated to window */
82
#define W_WW(w) (!((w)->w_pwin) || \
83
(((w)->w_pwin->p_fdpat & F_PMASK) == F_PBACK) || \
84
((((w)->w_pwin->p_fdpat >> F_PSHIFT) & F_PMASK) == F_PBOTH) || \
85
((((w)->w_pwin->p_fdpat >> (F_PSHIFT * 2)) & F_PMASK) == F_PBOTH))
87
/* ... wants to read from pseudowin */
88
#define W_RP(w) ((w)->w_pwin && ((w)->w_pwin->p_fdpat & \
89
((F_PFRONT << (F_PSHIFT * 2)) | (F_PFRONT << F_PSHIFT)) ))
91
/* ... wants to read from window */
92
#define W_RW(w) (!((w)->w_pwin) || ((w)->w_pwin->p_fdpat & F_PFRONT))
94
/* user input is written to pseudo */
95
#define W_UWP(w) ((w)->w_pwin && ((w)->w_pwin->p_fdpat & F_UWP))
97
/* pseudo output has to be stuffed in window */
99
((w)->w_pwin->p_fdpat & F_PMASK << F_PSHIFT) == F_PBOTH << F_PSHIFT || \
100
((w)->w_pwin->p_fdpat & F_PMASK << F_PSHIFT * 2) == F_PBOTH << F_PSHIFT * 2 )
102
/* window output has to be stuffed in pseudo */
103
#define W_WTOP(w) (((w)->w_pwin->p_fdpat & F_PMASK) == F_PBOTH)
107
/* definitions for wlocktype */
108
#define WLOCK_OFF 0 /* all in w_userbits can write */
109
#define WLOCK_AUTO 1 /* who selects first, can write */
110
#define WLOCK_ON 2 /* user writes even if deselected */
116
char *pa_pastebuf; /* this gets pasted in the window */
117
char *pa_pasteptr; /* pointer in pastebuf */
118
int pa_pastelen; /* bytes left to paste */
119
struct layer *pa_pastelayer; /* layer to paste into */
120
struct event pa_slowev; /* slowpaste event */
128
struct win *w_next; /* next window */
129
int w_type; /* type of window */
131
struct layer w_layer; /* our layer */
132
struct layer *w_savelayer; /* the layer to keep */
133
int w_blocked; /* block input */
135
struct pseudowin *w_pwin; /* ptr to pseudo */
137
struct display *w_pdisplay; /* display for printer relay */
138
struct display *w_lastdisp; /* where the last input was made */
139
int w_number; /* window number */
140
struct event w_readev;
141
struct event w_writeev;
142
struct event w_silenceev; /* silence event */
143
int w_ptyfd; /* fd of the master pty */
144
char w_inbuf[IOSIZE];
146
char w_outbuf[IOSIZE];
148
int w_aflag; /* (-a option) */
149
char *w_title; /* name of the window */
150
char *w_akachange; /* autoaka hack */
151
char w_akabuf[MAXSTR]; /* aka buffer */
152
int w_autoaka; /* autoaka hack */
153
int w_intermediate; /* char used while parsing ESC-seq */
154
int w_args[MAXARGS]; /* emulator args */
158
int w_wlock; /* WLOCK_AUTO, WLOCK_OFF, WLOCK_ON */
159
struct acluser *w_wlockuser; /* NULL when unlocked or user who writes */
160
AclBits w_userbits[ACL_BITS_PER_WIN];
161
AclBits w_lio_notify; /* whom to tell when lastio+seconds < time() */
162
AclBits w_mon_notify; /* whom to tell monitor statis */
165
enum state_t w_state; /* parser state */
166
enum string_t w_StringType;
167
struct mline *w_mlines;
168
struct mchar w_rend; /* current rendition */
170
char w_FontL; /* character font GL */
171
char w_FontR; /* character font GR */
173
char w_FontE; /* character font GR locked */
175
int w_Charset; /* charset number GL */
176
int w_CharsetR; /* charset number GR */
177
int w_charsets[4]; /* Font = charsets[Charset] */
181
int w_Saved_x, w_Saved_y;
182
struct mchar w_SavedRend;
186
int w_SavedCharsets[4];
188
int w_top, w_bot; /* scrollregion */
189
int w_wrap; /* autowrap */
190
int w_origin; /* origin mode */
191
int w_insert; /* window is in insert mode */
192
int w_keypad; /* keypad mode */
193
int w_cursorkeys; /* appl. cursorkeys mode */
194
int w_revvid; /* reverse video */
195
int w_curinv; /* cursor invisible */
196
int w_curvvis; /* cursor very visible */
197
int w_autolf; /* automatic linefeed */
198
char *w_hstatus; /* hardstatus line */
199
int w_gr; /* enable GR flag */
200
int w_c1; /* enable C1 flag */
201
int w_bce; /* enable backcol erase */
203
int w_encoding; /* for input and paste */
205
int w_decodestate; /* state of our input decoder */
207
int w_mbcs; /* saved char for multibytes charset */
209
char w_string[MAXSTR];
211
char *w_tabs; /* line with tabs */
212
int w_bell; /* bell status of this window */
213
int w_flow; /* flow flags */
214
struct logfile *w_log; /* log to file */
215
int w_logsilence; /* silence in secs */
216
int w_monitor; /* monitor status */
217
int w_silencewait; /* wait for silencewait secs */
218
int w_silence; /* silence status (Lloyd Zusman) */
220
char w_norefresh; /* dont redisplay when switching to that win */
222
char w_xtermosc[4][MAXSTR]; /* special xterm/rxvt escapes */
224
int w_mouse; /* mouse mode 0,9,1000 */
226
int w_bd_x, w_bd_y; /* Braille cursor position */
230
int w_slowpaste; /* do careful writes to the window */
231
int w_histheight; /* all histbases are malloced with width * histheight */
232
int w_histidx; /* 0 <= histidx < histheight; where we insert lines */
233
struct mline *w_hlines; /* history buffer */
234
struct paster w_paster; /* paste info */
236
int w_histheight; /* always 0 */
238
int w_pid; /* process at the other end of ptyfd */
240
char *w_cmdargs[MAXARGS]; /* command line argument vector */
241
char *w_dir; /* directory for chdir */
242
char *w_term; /* TERM to be set instead of "screen" */
244
int w_lflag; /* login flag */
245
slot_t w_slot; /* utmp slot */
247
struct utmp w_savut; /* utmp entry of this window */
254
struct display *w_zdisplay;
256
#ifdef BUILTIN_TELNET
257
struct sockaddr_in w_telsa;
258
char w_telbuf[IOSIZE];
260
char w_telmopts[256];
261
char w_telropts[256];
263
char w_telsubbuf[128];
265
struct event w_telconnev;
267
struct mline *w_alt_mlines;
270
int w_alt_histheight;
271
int w_alt_x, w_alt_y;
273
struct mline *w_alt_hlines;
279
#define w_encoding w_layer.l_encoding
280
#define w_width w_layer.l_width
281
#define w_height w_layer.l_height
282
#define w_x w_layer.l_x
283
#define w_y w_layer.l_y
285
/* definitions for w_type */
287
#define W_TYPE_PLAIN 1
288
#define W_TYPE_TELNET 2
292
* Definitions for flow
293
* 000 -(-) flow off, auto would be off
294
* 001 +(-) flow on , auto would be off
295
* 010 -(+) flow off, auto would be on
296
* 011 +(+) flow on , auto would be on
297
* 100 - flow auto, currently off
298
* 111 + flow auto, currently on
299
* Application controls auto_flow via TIOCPKT, if available,
300
* else via application keypad mode.
302
#define FLOW_NOW (1<<0)
303
#define FLOW_AUTO (1<<1)
304
#define FLOW_AUTOFLAG (1<<2)
308
* WIN gives us a reference to line y of the *whole* image
309
* where line 0 is the oldest line in our history.
310
* y must be in whole image coordinate system, not in display.
313
#define WIN(y) ((y < fore->w_histheight) ? \
314
&fore->w_hlines[(fore->w_histidx + y) % fore->w_histheight] \
315
: &fore->w_mlines[y - fore->w_histheight])
317
#define Layer2Window(l) ((struct win *)(l)->l_bottom->l_data)