~dannf/ubuntu/saucy/screen/lp1213278-from-debian

« back to all changes in this revision

Viewing changes to window.h

  • Committer: Bazaar Package Importer
  • Author(s): Nathaniel McCallum
  • Date: 2004-09-03 15:15:33 UTC
  • Revision ID: james.westby@ubuntu.com-20040903151533-px02yqlrchs4fv2t
Tags: upstream-4.0.2
ImportĀ upstreamĀ versionĀ 4.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
5
 *
 
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)
 
9
 * any later version.
 
10
 *
 
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.
 
15
 *
 
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
 
20
 *
 
21
 ****************************************************************
 
22
 * $Id: window.h,v 1.11 1994/05/31 12:33:27 mlschroe Exp $ FAU
 
23
 */
 
24
 
 
25
 
 
26
/* keep this in sync with the initialisations in window.c */
 
27
struct NewWindow
 
28
{
 
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" */
 
34
  int   aflag;
 
35
  int   flowflag;
 
36
  int   lflag;
 
37
  int   histheight;
 
38
  int   monitor;
 
39
  int   wlock;          /* default writelock setting */
 
40
  int   silence;
 
41
  int   wrap;
 
42
  int   Lflag;          /* logging */
 
43
  int   slow;           /* inter character milliseconds */
 
44
  int   gr;
 
45
  int   c1;
 
46
  int   bce;
 
47
  int   encoding;
 
48
  char  *hstatus;
 
49
  char  *charset;
 
50
};
 
51
 
 
52
#ifdef PSEUDOS
 
53
 
 
54
struct pseudowin
 
55
{
 
56
  int   p_fdpat;
 
57
  int   p_pid;
 
58
  int   p_ptyfd;
 
59
  struct event p_readev;
 
60
  struct event p_writeev;
 
61
  char  p_cmd[MAXSTR];
 
62
  char  p_tty[MAXSTR];
 
63
  char  p_inbuf[IOSIZE];        /* buffered writing to p_ptyfd */
 
64
  int   p_inlen;
 
65
};
 
66
 
 
67
/* bits for fdpat: */
 
68
#define F_PMASK         0x0003
 
69
#define F_PSHIFT        2
 
70
#define F_PFRONT        0x0001                  /* . */
 
71
#define F_PBACK         0x0002                  /* ! */
 
72
#define F_PBOTH         (F_PFRONT | F_PBACK)    /* : */
 
73
 
 
74
#define F_UWP           0x1000                  /* | */
 
75
 
 
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))
 
79
 
 
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))
 
86
 
 
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)) ))
 
90
 
 
91
/* ... wants to read from window */
 
92
#define W_RW(w) (!((w)->w_pwin) || ((w)->w_pwin->p_fdpat & F_PFRONT))
 
93
 
 
94
/* user input is written to pseudo */
 
95
#define W_UWP(w) ((w)->w_pwin && ((w)->w_pwin->p_fdpat & F_UWP))
 
96
 
 
97
/* pseudo output has to be stuffed in window */
 
98
#define W_PTOW(w) (\
 
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 )
 
101
 
 
102
/* window output has to be stuffed in pseudo */
 
103
#define W_WTOP(w) (((w)->w_pwin->p_fdpat & F_PMASK) == F_PBOTH)
 
104
 
 
105
#endif /* PSEUDOS */
 
106
 
 
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 */
 
111
 
 
112
 
 
113
#ifdef COPY_PASTE
 
114
struct paster
 
115
{
 
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 */
 
121
};
 
122
#else
 
123
struct paster;
 
124
#endif
 
125
 
 
126
struct win 
 
127
{
 
128
  struct win *w_next;           /* next window */
 
129
  int    w_type;                /* type of window */
 
130
  void  *w_data;
 
131
  struct layer w_layer;         /* our layer */
 
132
  struct layer *w_savelayer;    /* the layer to keep */
 
133
  int    w_blocked;             /* block input */
 
134
#ifdef PSEUDOS
 
135
  struct pseudowin *w_pwin;     /* ptr to pseudo */
 
136
#endif
 
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];
 
145
  int    w_inlen;
 
146
  char   w_outbuf[IOSIZE];
 
147
  int    w_outlen;
 
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 */
 
155
  int    w_NumArgs;
 
156
 
 
157
#ifdef MULTIUSER
 
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 */
 
163
#endif
 
164
 
 
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 */
 
169
#ifdef FONT
 
170
  char   w_FontL;               /* character font GL */
 
171
  char   w_FontR;               /* character font GR */
 
172
# ifdef ENCODINGS
 
173
  char   w_FontE;               /* character font GR locked */
 
174
# endif
 
175
  int    w_Charset;             /* charset number GL */
 
176
  int    w_CharsetR;            /* charset number GR */
 
177
  int    w_charsets[4];         /* Font = charsets[Charset] */
 
178
#endif
 
179
  int    w_ss;          
 
180
  int    w_saved;
 
181
  int    w_Saved_x, w_Saved_y;
 
182
  struct mchar w_SavedRend;
 
183
#ifdef FONT
 
184
  int    w_SavedCharset;
 
185
  int    w_SavedCharsetR;
 
186
  int    w_SavedCharsets[4];
 
187
#endif
 
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 */
 
202
#if 0
 
203
  int    w_encoding;            /* for input and paste */
 
204
#endif
 
205
  int    w_decodestate;         /* state of our input decoder */
 
206
#ifdef DW_CHARS
 
207
  int    w_mbcs;                /* saved char for multibytes charset */
 
208
#endif
 
209
  char   w_string[MAXSTR];
 
210
  char  *w_stringp;
 
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) */
 
219
  char   w_vbwait;            
 
220
  char   w_norefresh;           /* dont redisplay when switching to that win */
 
221
#ifdef RXVT_OSC
 
222
  char   w_xtermosc[4][MAXSTR]; /* special xterm/rxvt escapes */
 
223
#endif
 
224
  int    w_mouse;               /* mouse mode 0,9,1000 */
 
225
#ifdef HAVE_BRAILLE
 
226
  int    w_bd_x, w_bd_y;        /* Braille cursor position */
 
227
#endif
 
228
 
 
229
#ifdef COPY_PASTE
 
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 */
 
235
#else
 
236
  int    w_histheight;          /* always 0 */
 
237
#endif
 
238
  int    w_pid;                 /* process at the other end of ptyfd */ 
 
239
 
 
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" */
 
243
 
 
244
  int    w_lflag;               /* login flag */
 
245
  slot_t w_slot;                /* utmp slot */
 
246
#if defined (UTMPOK)
 
247
  struct utmp w_savut;          /* utmp entry of this window */
 
248
#endif
 
249
 
 
250
  char   w_tty[MAXSTR];
 
251
 
 
252
  int    w_zauto;
 
253
#ifdef ZMODEM
 
254
  struct display *w_zdisplay;
 
255
#endif
 
256
#ifdef BUILTIN_TELNET
 
257
  struct sockaddr_in w_telsa;
 
258
  char   w_telbuf[IOSIZE];
 
259
  int    w_telbufl;
 
260
  char   w_telmopts[256];
 
261
  char   w_telropts[256];
 
262
  int    w_telstate;
 
263
  char   w_telsubbuf[128];
 
264
  int    w_telsubidx;
 
265
  struct event w_telconnev;
 
266
#endif
 
267
  struct mline *w_alt_mlines;
 
268
  int    w_alt_width;
 
269
  int    w_alt_height;
 
270
  int    w_alt_histheight;
 
271
  int    w_alt_x, w_alt_y;
 
272
#ifdef COPY_PASTE
 
273
  struct mline *w_alt_hlines;
 
274
  int    w_alt_histidx;
 
275
#endif
 
276
};
 
277
 
 
278
 
 
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
 
284
 
 
285
/* definitions for w_type */
 
286
#define W_TYPE_PTY              0
 
287
#define W_TYPE_PLAIN            1
 
288
#define W_TYPE_TELNET           2
 
289
 
 
290
 
 
291
/*
 
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.
 
301
 */
 
302
#define FLOW_NOW        (1<<0)
 
303
#define FLOW_AUTO       (1<<1)
 
304
#define FLOW_AUTOFLAG   (1<<2)
 
305
 
 
306
 
 
307
/*
 
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.
 
311
 */
 
312
 
 
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])
 
316
 
 
317
#define Layer2Window(l) ((struct win *)(l)->l_bottom->l_data)