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

« back to all changes in this revision

Viewing changes to display.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: display.h,v 1.9 1994/05/31 12:31:54 mlschroe Exp $ FAU
 
23
 */
 
24
 
 
25
#ifdef MAPKEYS
 
26
 
 
27
#define KMAP_KEYS (T_OCAPS-T_CAPS)
 
28
#define KMAP_AKEYS (T_OCAPS-T_CURSOR)
 
29
#define KMAP_EXT 50
 
30
 
 
31
#define KMAP_NOTIMEOUT 0x4000
 
32
 
 
33
struct kmap_ext
 
34
{
 
35
  char *str;
 
36
  int fl;
 
37
  struct action um;
 
38
  struct action dm;
 
39
  struct action mm;
 
40
};
 
41
 
 
42
#endif
 
43
 
 
44
struct win;                     /* forward declaration */
 
45
 
 
46
struct canvas
 
47
{
 
48
  struct canvas   *c_next;      /* next canvas on display */
 
49
  struct display  *c_display;   /* back pointer to display */
 
50
  struct viewport *c_vplist;
 
51
  struct layer    *c_layer;     /* layer on this canvas */
 
52
  struct canvas   *c_lnext;     /* next canvas that displays layer */
 
53
  struct layer     c_blank;     /* bottom layer, always blank */
 
54
  int              c_xoff;      /* canvas x offset on display */
 
55
  int              c_yoff;      /* canvas y offset on display */
 
56
  int              c_xs;
 
57
  int              c_xe;
 
58
  int              c_ys;
 
59
  int              c_ye;
 
60
  struct event     c_captev;    /* caption changed event */
 
61
};
 
62
 
 
63
struct viewport
 
64
{
 
65
  struct viewport *v_next;      /* next vp on canvas */
 
66
  struct canvas   *v_canvas;    /* back pointer to canvas */
 
67
  int              v_xoff;      /* layer x offset on display */
 
68
  int              v_yoff;      /* layer y offset on display */
 
69
  int              v_xs;        /* vp upper left */
 
70
  int              v_xe;        /* vp upper right */
 
71
  int              v_ys;        /* vp lower left */
 
72
  int              v_ye;        /* vp lower right */
 
73
};
 
74
 
 
75
struct display
 
76
{
 
77
  struct display *d_next;       /* linked list */
 
78
  struct acluser *d_user;               /* user who owns that display */
 
79
  struct canvas *d_cvlist;      /* the canvases of this display */
 
80
  struct canvas *d_forecv;      /* current input focus */
 
81
  void (*d_processinput) __P((char *, int));
 
82
  char *d_processinputdata;     /* data for processinput */
 
83
  int d_vpxmin, d_vpxmax;       /* min/max used position on display */
 
84
  struct win *d_fore;           /* pointer to fore window */
 
85
  struct win *d_other;          /* pointer to other window */
 
86
  int   d_nonblock;             /* -1 don't block if obufmax reached */
 
87
                                /* >0: block after nonblock secs */
 
88
  char  d_termname[20 + 1];     /* $TERM */
 
89
  char  *d_tentry;              /* buffer for tgetstr */
 
90
  char  d_tcinited;             /* termcap inited flag */
 
91
  int   d_width, d_height;      /* width/height of the screen */
 
92
  int   d_defwidth, d_defheight;        /* default width/height of windows */
 
93
  int   d_top, d_bot;           /* scrollregion start/end */
 
94
  int   d_x, d_y;               /* cursor position */
 
95
  struct mchar d_rend;          /* current rendition */
 
96
  int   d_col16change;          /* the 16col bits changed in attr */
 
97
  char  d_atyp;                 /* current attribute types */
 
98
#ifdef DW_CHARS
 
99
  int   d_mbcs;                 /* saved char for multibytes charset */
 
100
#endif
 
101
#ifdef ENCODINGS
 
102
  int   d_encoding;             /* what encoding type the display is */
 
103
  int   d_decodestate;          /* state of our decoder */
 
104
  int   d_realfont;             /* real font of terminal */
 
105
#endif
 
106
  int   d_insert;               /* insert mode flag */
 
107
  int   d_keypad;               /* application keypad flag */
 
108
  int   d_cursorkeys;           /* application cursorkeys flag */
 
109
  int   d_revvid;               /* reverse video */
 
110
  int   d_curvis;               /* cursor visibility */
 
111
  int   d_has_hstatus;          /* display has hardstatus line */
 
112
  int   d_hstatus;              /* hardstatus used */
 
113
  int   d_lp_missing;           /* last character on bot line missing */
 
114
  int   d_mouse;                /* mouse mode */
 
115
#ifdef RXVT_OSC
 
116
  int   d_xtermosc[4];          /* osc used */
 
117
#endif
 
118
  struct mchar d_lpchar;        /* missing char */
 
119
  struct timeval d_status_time; /* time of status display */
 
120
  int   d_status;               /* is status displayed? */
 
121
  char  d_status_bell;          /* is it only a vbell? */
 
122
  int   d_status_len;           /* length of status line */
 
123
  char *d_status_lastmsg;       /* last displayed message */
 
124
  int   d_status_buflen;        /* last message buffer len */
 
125
  int   d_status_lastx;         /* position of the cursor */
 
126
  int   d_status_lasty;         /*   before status was displayed */
 
127
  int   d_status_obuflen;       /* saved obuflen */ 
 
128
  int   d_status_obuffree;      /* saved obuffree */ 
 
129
  struct event d_statusev;      /* timeout event */
 
130
  struct event d_hstatusev;     /* hstatus changed event */
 
131
  int   d_kaablamm;             /* display kaablamm msg */
 
132
  struct action *d_ESCseen;     /* Was the last char an ESC (^a) */
 
133
  int   d_userpid;              /* pid of attacher */
 
134
  char  d_usertty[MAXPATHLEN];  /* tty we are attached to */
 
135
  int   d_userfd;               /* fd of the tty */
 
136
  struct event d_readev;        /* userfd read event */
 
137
  struct event d_writeev;       /* userfd write event */
 
138
  struct event d_blockedev;     /* blocked timeout */
 
139
  struct mode d_OldMode;        /* tty mode when screen was started */
 
140
  struct mode d_NewMode;        /* New tty mode */
 
141
  int   d_flow;                 /* tty's flow control on/off flag*/
 
142
  int   d_intrc;                /* current intr when flow is on */
 
143
  char *d_obuf;                 /* output buffer */
 
144
  int   d_obuflen;              /* len of buffer */
 
145
  int   d_obufmax;              /* len where we are blocking the pty */
 
146
  int   d_obuflenmax;           /* len - max */
 
147
  char *d_obufp;                /* pointer in buffer */
 
148
  int   d_obuffree;             /* free bytes in buffer */
 
149
#ifdef AUTO_NUKE
 
150
  int   d_auto_nuke;            /* autonuke flag */
 
151
#endif
 
152
#ifdef MAPKEYS
 
153
  int   d_nseqs;                /* number of valid mappings */
 
154
  int   d_aseqs;                /* number of allocated mappings */
 
155
  unsigned char  *d_kmaps;      /* keymaps */
 
156
  unsigned char *d_seqp;        /* pointer into keymap array */
 
157
  int   d_seql;                 /* number of parsed chars */
 
158
  unsigned char *d_seqh;        /* last hit */
 
159
  struct event d_mapev;         /* timeout event */
 
160
  int   d_dontmap;              /* do not map next */
 
161
  int   d_mapdefault;           /* do map next to default */
 
162
#endif
 
163
  union tcu d_tcs[T_N];         /* terminal capabilities */
 
164
  char *d_attrtab[NATTR];       /* attrib emulation table */
 
165
  char  d_attrtyp[NATTR];       /* attrib group table */
 
166
  int   d_hascolor;             /* do we support color */
 
167
  short d_dospeed;              /* baudrate of tty */
 
168
#ifdef FONT
 
169
  char  d_c0_tab[256];          /* conversion for C0 */
 
170
  char ***d_xtable;             /* char translation table */
 
171
#endif
 
172
  int   d_UPcost, d_DOcost, d_LEcost, d_NDcost;
 
173
  int   d_CRcost, d_IMcost, d_EIcost, d_NLcost;
 
174
  int   d_printfd;              /* fd for vt100 print sequence */
 
175
#ifdef UTMPOK
 
176
  slot_t d_loginslot;           /* offset, where utmp_logintty belongs */
 
177
  struct utmp d_utmp_logintty;  /* here the original utmp structure is stored */
 
178
  int   d_loginttymode;
 
179
# ifdef _SEQUENT_
 
180
  char  d_loginhost[100+1];
 
181
# endif /* _SEQUENT_ */
 
182
#endif
 
183
  int   d_blocked;
 
184
  int   d_blocked_fuzz;
 
185
  struct event d_idleev;        /* screen blanker */
 
186
#ifdef BLANKER_PRG
 
187
  int   d_blankerpid;
 
188
  struct event d_blankerev;
 
189
#endif
 
190
};
 
191
 
 
192
#ifdef MULTI
 
193
# define DISPLAY(x) display->x
 
194
#else
 
195
extern struct display TheDisplay;
 
196
# define DISPLAY(x) TheDisplay.x
 
197
#endif
 
198
 
 
199
#define D_user          DISPLAY(d_user)
 
200
#define D_username      (DISPLAY(d_user) ? DISPLAY(d_user)->u_name : 0)
 
201
#define D_cvlist        DISPLAY(d_cvlist)
 
202
#define D_forecv        DISPLAY(d_forecv)
 
203
#define D_processinput  DISPLAY(d_processinput)
 
204
#define D_processinputdata      DISPLAY(d_processinputdata)
 
205
#define D_vpxmin        DISPLAY(d_vpxmin)
 
206
#define D_vpxmax        DISPLAY(d_vpxmax)
 
207
#define D_fore          DISPLAY(d_fore)
 
208
#define D_other         DISPLAY(d_other)
 
209
#define D_nonblock      DISPLAY(d_nonblock)
 
210
#define D_termname      DISPLAY(d_termname)
 
211
#define D_tentry        DISPLAY(d_tentry)
 
212
#define D_tcinited      DISPLAY(d_tcinited)
 
213
#define D_width         DISPLAY(d_width)
 
214
#define D_height        DISPLAY(d_height)
 
215
#define D_defwidth      DISPLAY(d_defwidth)
 
216
#define D_defheight     DISPLAY(d_defheight)
 
217
#define D_top           DISPLAY(d_top)
 
218
#define D_bot           DISPLAY(d_bot)
 
219
#define D_x             DISPLAY(d_x)
 
220
#define D_y             DISPLAY(d_y)
 
221
#define D_rend          DISPLAY(d_rend)
 
222
#define D_col16change   DISPLAY(d_col16change)
 
223
#define D_atyp          DISPLAY(d_atyp)
 
224
#define D_mbcs          DISPLAY(d_mbcs)
 
225
#define D_encoding      DISPLAY(d_encoding)
 
226
#define D_decodestate   DISPLAY(d_decodestate)
 
227
#define D_realfont      DISPLAY(d_realfont)
 
228
#define D_insert        DISPLAY(d_insert)
 
229
#define D_keypad        DISPLAY(d_keypad)
 
230
#define D_cursorkeys    DISPLAY(d_cursorkeys)
 
231
#define D_revvid        DISPLAY(d_revvid)
 
232
#define D_curvis        DISPLAY(d_curvis)
 
233
#define D_has_hstatus   DISPLAY(d_has_hstatus)
 
234
#define D_hstatus       DISPLAY(d_hstatus)
 
235
#define D_lp_missing    DISPLAY(d_lp_missing)
 
236
#define D_mouse         DISPLAY(d_mouse)
 
237
#define D_xtermosc      DISPLAY(d_xtermosc)
 
238
#define D_lpchar        DISPLAY(d_lpchar)
 
239
#define D_status        DISPLAY(d_status)
 
240
#define D_status_time   DISPLAY(d_status_time)
 
241
#define D_status_bell   DISPLAY(d_status_bell)
 
242
#define D_status_len    DISPLAY(d_status_len)
 
243
#define D_status_lastmsg        DISPLAY(d_status_lastmsg)
 
244
#define D_status_buflen DISPLAY(d_status_buflen)
 
245
#define D_status_lastx  DISPLAY(d_status_lastx)
 
246
#define D_status_lasty  DISPLAY(d_status_lasty)
 
247
#define D_status_obuflen        DISPLAY(d_status_obuflen)
 
248
#define D_status_obuffree       DISPLAY(d_status_obuffree)
 
249
#define D_statusev      DISPLAY(d_statusev)
 
250
#define D_hstatusev     DISPLAY(d_hstatusev)
 
251
#define D_kaablamm      DISPLAY(d_kaablamm)
 
252
#define D_ESCseen       DISPLAY(d_ESCseen)
 
253
#define D_userpid       DISPLAY(d_userpid)
 
254
#define D_usertty       DISPLAY(d_usertty)
 
255
#define D_userfd        DISPLAY(d_userfd)
 
256
#define D_OldMode       DISPLAY(d_OldMode)
 
257
#define D_NewMode       DISPLAY(d_NewMode)
 
258
#define D_flow          DISPLAY(d_flow)
 
259
#define D_intr          DISPLAY(d_intr)
 
260
#define D_obuf          DISPLAY(d_obuf)
 
261
#define D_obuflen       DISPLAY(d_obuflen)
 
262
#define D_obufmax       DISPLAY(d_obufmax)
 
263
#define D_obuflenmax    DISPLAY(d_obuflenmax)
 
264
#define D_obufp         DISPLAY(d_obufp)
 
265
#define D_obuffree      DISPLAY(d_obuffree)
 
266
#define D_auto_nuke     DISPLAY(d_auto_nuke)
 
267
#define D_nseqs         DISPLAY(d_nseqs)
 
268
#define D_aseqs         DISPLAY(d_aseqs)
 
269
#define D_seqp          DISPLAY(d_seqp)
 
270
#define D_seql          DISPLAY(d_seql)
 
271
#define D_seqh          DISPLAY(d_seqh)
 
272
#define D_dontmap       DISPLAY(d_dontmap)
 
273
#define D_mapdefault    DISPLAY(d_mapdefault)
 
274
#define D_kmaps         DISPLAY(d_kmaps)
 
275
#define D_tcs           DISPLAY(d_tcs)
 
276
#define D_attrtab       DISPLAY(d_attrtab)
 
277
#define D_attrtyp       DISPLAY(d_attrtyp)
 
278
#define D_hascolor      DISPLAY(d_hascolor)
 
279
#define D_dospeed       DISPLAY(d_dospeed)
 
280
#define D_c0_tab        DISPLAY(d_c0_tab)
 
281
#define D_xtable        DISPLAY(d_xtable)
 
282
#define D_UPcost        DISPLAY(d_UPcost)
 
283
#define D_DOcost        DISPLAY(d_DOcost)
 
284
#define D_LEcost        DISPLAY(d_LEcost)
 
285
#define D_NDcost        DISPLAY(d_NDcost)
 
286
#define D_CRcost        DISPLAY(d_CRcost)
 
287
#define D_IMcost        DISPLAY(d_IMcost)
 
288
#define D_EIcost        DISPLAY(d_EIcost)
 
289
#define D_NLcost        DISPLAY(d_NLcost)
 
290
#define D_printfd       DISPLAY(d_printfd)
 
291
#define D_loginslot     DISPLAY(d_loginslot)
 
292
#define D_utmp_logintty DISPLAY(d_utmp_logintty)
 
293
#define D_loginttymode  DISPLAY(d_loginttymode)
 
294
#define D_loginhost     DISPLAY(d_loginhost)
 
295
#define D_readev        DISPLAY(d_readev)
 
296
#define D_writeev       DISPLAY(d_writeev)
 
297
#define D_blockedev     DISPLAY(d_blockedev)
 
298
#define D_mapev         DISPLAY(d_mapev)
 
299
#define D_blocked       DISPLAY(d_blocked)
 
300
#define D_blocked_fuzz  DISPLAY(d_blocked_fuzz)
 
301
#define D_idleev        DISPLAY(d_idleev)
 
302
#define D_blankerev     DISPLAY(d_blankerev)
 
303
#define D_blankerpid    DISPLAY(d_blankerpid)
 
304
 
 
305
 
 
306
#define GRAIN 4096      /* Allocation grain size for output buffer */
 
307
#define OBUF_MAX 256    /* default for obuflimit */
 
308
 
 
309
#define OUTPUT_BLOCK_SIZE 256  /* Block size of output to tty */
 
310
 
 
311
#define AddChar(c)              \
 
312
do                              \
 
313
  {                             \
 
314
    if (--D_obuffree <= 0)      \
 
315
      Resize_obuf();            \
 
316
    *D_obufp++ = (c);           \
 
317
  }                             \
 
318
while (0)
 
319
 
 
320
#define CV_CALL(cv, cmd)                        \
 
321
{                                               \
 
322
  struct display *olddisplay = display;         \
 
323
  struct layer *oldflayer = flayer;             \
 
324
  struct layer *l = cv->c_layer;                \
 
325
  struct canvas *cvlist = l->l_cvlist;          \
 
326
  struct canvas *cvlnext = cv->c_lnext;         \
 
327
  flayer = l;                                   \
 
328
  l->l_cvlist = cv;                             \
 
329
  cv->c_lnext = 0;                              \
 
330
  cmd;                                          \
 
331
  flayer = oldflayer;                           \
 
332
  l->l_cvlist = cvlist;                         \
 
333
  cv->c_lnext = cvlnext;                        \
 
334
  display = olddisplay;                         \
 
335
}
 
336
 
 
337
#define STATUS_OFF      0
 
338
#define STATUS_ON_WIN   1
 
339
#define STATUS_ON_HS    2
 
340
 
 
341
#define HSTATUS_IGNORE          0
 
342
#define HSTATUS_LASTLINE        1
 
343
#define HSTATUS_MESSAGE         2
 
344
#define HSTATUS_HS              3
 
345
#define HSTATUS_ALWAYS          (1<<2)