2 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
3 * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
4 * Copyright (c) 2008, 2009
5 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
6 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
7 * Micah Cowan (micah@cowan.name)
8 * Sadrul Habib Chowdhury (sadrul@users.sourceforge.net)
9 * Copyright (c) 1993-2002, 2003, 2005, 2006, 2007
10 * Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
11 * Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
12 * Copyright (c) 1987 Oliver Laumann
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3, or (at your option)
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program (see the file COPYING); if not, see
26 * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc.,
27 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
29 ****************************************************************
33 #ifndef SCREEN_WINDOW_H
34 #define SCREEN_WINDOW_H
36 /* keep this in sync with the initialisations in window.c */
39 int StartAt
; /* where to start the search for the slot */
40 char *aka
; /* aka string */
41 char **args
; /* argv vector */
42 char *dir
; /* directory for chdir */
43 char *term
; /* TERM to be set instead of "screen" */
49 int wlock
; /* default writelock setting */
52 int Lflag
; /* logging */
53 int slow
; /* inter character milliseconds */
69 struct event p_readev
;
70 struct event p_writeev
;
73 char p_inbuf
[IOSIZE
]; /* buffered writing to p_ptyfd */
78 #define F_PMASK 0x0003
80 #define F_PFRONT 0x0001 /* . */
81 #define F_PBACK 0x0002 /* ! */
82 #define F_PBOTH (F_PFRONT | F_PBACK) /* : */
84 #define F_UWP 0x1000 /* | */
86 /* The screen process ...)
87 * ... wants to write to pseudo */
88 #define W_WP(w) ((w)->w_pwin && ((w)->w_pwin->p_fdpat & F_PFRONT))
90 /* ... wants to write to window: user writes to window
91 * or stdout/stderr of pseudo are duplicated to window */
92 #define W_WW(w) (!((w)->w_pwin) || \
93 (((w)->w_pwin->p_fdpat & F_PMASK) == F_PBACK) || \
94 ((((w)->w_pwin->p_fdpat >> F_PSHIFT) & F_PMASK) == F_PBOTH) || \
95 ((((w)->w_pwin->p_fdpat >> (F_PSHIFT * 2)) & F_PMASK) == F_PBOTH))
97 /* ... wants to read from pseudowin */
98 #define W_RP(w) ((w)->w_pwin && ((w)->w_pwin->p_fdpat & \
99 ((F_PFRONT << (F_PSHIFT * 2)) | (F_PFRONT << F_PSHIFT)) ))
101 /* ... wants to read from window */
102 #define W_RW(w) (!((w)->w_pwin) || ((w)->w_pwin->p_fdpat & F_PFRONT))
104 /* user input is written to pseudo */
105 #define W_UWP(w) ((w)->w_pwin && ((w)->w_pwin->p_fdpat & F_UWP))
107 /* pseudo output has to be stuffed in window */
109 ((w)->w_pwin->p_fdpat & F_PMASK << F_PSHIFT) == F_PBOTH << F_PSHIFT || \
110 ((w)->w_pwin->p_fdpat & F_PMASK << F_PSHIFT * 2) == F_PBOTH << F_PSHIFT * 2 )
112 /* window output has to be stuffed in pseudo */
113 #define W_WTOP(w) (((w)->w_pwin->p_fdpat & F_PMASK) == F_PBOTH)
117 /* definitions for wlocktype */
118 #define WLOCK_OFF 0 /* all in w_userbits can write */
119 #define WLOCK_AUTO 1 /* who selects first, can write */
120 #define WLOCK_ON 2 /* user writes even if deselected */
126 char *pa_pastebuf
; /* this gets pasted in the window */
127 char *pa_pasteptr
; /* pointer in pastebuf */
128 int pa_pastelen
; /* bytes left to paste */
129 struct layer
*pa_pastelayer
; /* layer to paste into */
130 struct event pa_slowev
; /* slowpaste event */
138 struct win
*w_next
; /* next window */
139 int w_type
; /* type of window */
141 struct layer w_layer
; /* our layer */
142 struct layer
*w_savelayer
; /* the layer to keep */
143 int w_blocked
; /* block input */
145 struct pseudowin
*w_pwin
; /* ptr to pseudo */
147 struct display
*w_pdisplay
; /* display for printer relay */
148 struct display
*w_lastdisp
; /* where the last input was made */
149 int w_number
; /* window number */
150 struct event w_readev
;
151 struct event w_writeev
;
152 struct event w_silenceev
; /* silence event */
153 int w_ptyfd
; /* fd of the master pty */
154 char w_inbuf
[IOSIZE
];
156 char w_outbuf
[IOSIZE
];
158 int w_aflag
; /* (-a option) */
159 char *w_title
; /* name of the window */
160 char *w_akachange
; /* autoaka hack */
161 char w_akabuf
[MAXSTR
]; /* aka buffer */
162 int w_autoaka
; /* autoaka hack */
163 struct win
*w_group
; /* window group we belong to */
164 int w_intermediate
; /* char used while parsing ESC-seq */
165 int w_args
[MAXARGS
]; /* emulator args */
169 int w_wlock
; /* WLOCK_AUTO, WLOCK_OFF, WLOCK_ON */
170 struct acluser
*w_wlockuser
; /* NULL when unlocked or user who writes */
171 AclBits w_userbits
[ACL_BITS_PER_WIN
];
172 AclBits w_lio_notify
; /* whom to tell when lastio+seconds < time() */
173 AclBits w_mon_notify
; /* whom to tell monitor statis */
176 enum state_t w_state
; /* parser state */
177 enum string_t w_StringType
;
178 struct mline
*w_mlines
;
179 struct mchar w_rend
; /* current rendition */
181 char w_FontL
; /* character font GL */
182 char w_FontR
; /* character font GR */
184 char w_FontE
; /* character font GR locked */
186 int w_Charset
; /* charset number GL */
187 int w_CharsetR
; /* charset number GR */
188 int w_charsets
[4]; /* Font = charsets[Charset] */
201 int w_top
, w_bot
; /* scrollregion */
202 int w_wrap
; /* autowrap */
203 int w_origin
; /* origin mode */
204 int w_insert
; /* window is in insert mode */
205 int w_keypad
; /* keypad mode */
206 int w_cursorkeys
; /* appl. cursorkeys mode */
207 int w_revvid
; /* reverse video */
208 int w_curinv
; /* cursor invisible */
209 int w_curvvis
; /* cursor very visible */
210 int w_autolf
; /* automatic linefeed */
211 char *w_hstatus
; /* hardstatus line */
212 int w_gr
; /* enable GR flag */
213 int w_c1
; /* enable C1 flag */
214 int w_bce
; /* enable backcol erase */
216 int w_encoding
; /* for input and paste */
218 int w_decodestate
; /* state of our input decoder */
220 int w_mbcs
; /* saved char for multibytes charset */
222 char w_string
[MAXSTR
];
224 char *w_tabs
; /* line with tabs */
225 int w_bell
; /* bell status of this window */
226 int w_flow
; /* flow flags */
227 struct logfile
*w_log
; /* log to file */
228 int w_logsilence
; /* silence in secs */
229 int w_monitor
; /* monitor status */
230 int w_silencewait
; /* wait for silencewait secs */
231 int w_silence
; /* silence status (Lloyd Zusman) */
233 char w_norefresh
; /* dont redisplay when switching to that win */
235 char w_xtermosc
[4][MAXSTR
]; /* special xterm/rxvt escapes */
237 int w_mouse
; /* mouse mode 0,9,1000 */
239 int w_bd_x
, w_bd_y
; /* Braille cursor position */
243 int w_slowpaste
; /* do careful writes to the window */
244 int w_histheight
; /* all histbases are malloced with width * histheight */
245 int w_histidx
; /* 0 <= histidx < histheight; where we insert lines */
246 struct mline
*w_hlines
; /* history buffer */
247 struct paster w_paster
; /* paste info */
249 int w_histheight
; /* always 0 */
251 int w_pid
; /* process at the other end of ptyfd */
252 int w_deadpid
; /* saved w_pid of a process that closed the ptyfd to us */
254 char *w_cmdargs
[MAXARGS
]; /* command line argument vector */
255 char *w_dir
; /* directory for chdir */
256 char *w_term
; /* TERM to be set instead of "screen" */
258 int w_lflag
; /* login flag */
259 slot_t w_slot
; /* utmp slot */
261 struct utmp w_savut
; /* utmp entry of this window */
268 struct display
*w_zdisplay
;
270 #ifdef BUILTIN_TELNET
271 struct sockaddr_in w_telsa
;
272 char w_telbuf
[IOSIZE
];
274 char w_telmopts
[256];
275 char w_telropts
[256];
277 char w_telsubbuf
[128];
279 struct event w_telconnev
;
282 int on
; /* Is the alternate buffer currently being used? */
283 struct mline
*mlines
;
288 struct mline
*hlines
;
291 int histheight
; /* 0 */
293 struct cursor cursor
;
296 struct event w_destroyev
; /* window destroy event */
298 union wait w_exitstatus
; /* window exit status */
305 #define w_encoding w_layer.l_encoding
306 #define w_width w_layer.l_width
307 #define w_height w_layer.l_height
308 #define w_x w_layer.l_x
309 #define w_y w_layer.l_y
311 /* definitions for w_type */
313 #define W_TYPE_PLAIN 1
314 #define W_TYPE_TELNET 2
315 #define W_TYPE_GROUP 3
319 * Definitions for flow
320 * 000 -(-) flow off, auto would be off
321 * 001 +(-) flow on , auto would be off
322 * 010 -(+) flow off, auto would be on
323 * 011 +(+) flow on , auto would be on
324 * 100 - flow auto, currently off
325 * 111 + flow auto, currently on
326 * Application controls auto_flow via TIOCPKT, if available,
327 * else via application keypad mode.
329 #define FLOW_NOW (1<<0)
330 #define FLOW_AUTO (1<<1)
331 #define FLOW_AUTOFLAG (1<<2)
335 * WIN gives us a reference to line y of the *whole* image
336 * where line 0 is the oldest line in our history.
337 * y must be in whole image coordinate system, not in display.
340 #define WIN(y) ((y < fore->w_histheight) ? \
341 &fore->w_hlines[(fore->w_histidx + y) % fore->w_histheight] \
342 : &fore->w_mlines[y - fore->w_histheight])
344 #define Layer2Window(l) ((struct win *)(l)->l_bottom->l_data)
346 int WindowChangeNumber
__P((struct win
*, int));
348 #endif /* SCREEN_WINDOW_H */