|
|
1.1 root 1: /*
2: * $Source: /u1/X11/clients/xterm/RCS/ptyx.h,v $
3: * $Header: ptyx.h,v 1.11 87/09/11 08:17:30 toddb Exp $
4: */
5:
6: #include <X11/copyright.h>
7:
8: /*
9: * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
10: *
11: * All Rights Reserved
12: *
13: * Permission to use, copy, modify, and distribute this software and its
14: * documentation for any purpose and without fee is hereby granted,
15: * provided that the above copyright notice appear in all copies and that
16: * both that copyright notice and this permission notice appear in
17: * supporting documentation, and that the name of Digital Equipment
18: * Corporation not be used in advertising or publicity pertaining to
19: * distribution of the software without specific, written prior permission.
20: *
21: *
22: * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
23: * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
24: * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
25: * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
26: * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
27: * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
28: * SOFTWARE.
29: */
30:
31: /* ptyx.h */
32: /* @(#)ptyx.h X10/6.6 11/10/86 */
33:
34: #include <X11/Xlib.h>
35:
36: /* Extra Xlib definitions */
37: #define AllButtonsUp(detail, ignore) (\
38: ((ignore) == Button1) ? \
39: (((detail)&(Button2Mask|Button3Mask)) == 0) \
40: : \
41: (((ignore) == Button2) ? \
42: (((detail)&(Button1Mask|Button3Mask)) == 0) \
43: : \
44: (((detail)&(Button1Mask|Button2Mask)) == 0)) \
45: )
46:
47:
48: #define Max(i, j) ((i) > (j) ? (i) : (j))
49:
50: #define MAX_COLS 200
51: #define MAX_ROWS 128
52:
53: /* Until the translation manager comes along, I have to do my own translation of
54: * mouse events into the proper routines. */
55:
56: typedef enum {NORMAL, LEFTEXTENSION, RIGHTEXTENSION} EventMode;
57:
58: /*
59: * The origin of a screen is 0, 0. Therefore, the number of rows
60: * on a screen is screen->max_row + 1, and similarly for columns.
61: */
62:
63: typedef char **ScrnBuf;
64:
65: /*
66: * ANSI emulation.
67: */
68: #define INQ 0x05
69: #define FF 0x0C /* C0, C1 control names */
70: #define LS1 0x0E
71: #define LS0 0x0F
72: #define CAN 0x18
73: #define SUB 0x1A
74: #define ESC 0x1B
75: #define US 0x1F
76: #define DEL 0x7F
77: #define HTS ('H'+0x40')
78: #define SS2 0x8E
79: #define SS3 0x8F
80: #define DCS 0x90
81: #define OLDID 0x9A /* ESC Z */
82: #define CSI 0x9B
83: #define ST 0x9C
84: #define OSC 0x9D
85: #define PM 0x9E
86: #define APC 0x9F
87: #define RDEL 0xFF
88:
89: #define NBOX 5 /* Number of Points in box */
90: #define NPARAM 10 /* Max. parameters */
91:
92: #define MINHILITE 32
93:
94: typedef struct {
95: unsigned char a_type;
96: unsigned char a_pintro;
97: unsigned char a_final;
98: unsigned char a_inters;
99: char a_nparam; /* # of parameters */
100: char a_dflt[NPARAM]; /* Default value flags */
101: short a_param[NPARAM]; /* Parameters */
102: char a_nastyf; /* Error flag */
103: } ANSI;
104:
105: typedef struct {
106: int row;
107: int col;
108: unsigned flags; /* Vt100 saves graphics rendition. Ugh! */
109: char curgl;
110: char curgr;
111: char gsets[4];
112: } SavedCursor;
113:
114: #define TEKNUMFONTS 4
115: /* Actually there are 5 types of lines, but four are non-solid lines */
116: #define TEKNUMLINES 4
117:
118: typedef struct {
119: int x;
120: int y;
121: int fontsize;
122: int linetype;
123: } Tmodes;
124:
125: typedef struct {
126: int Twidth;
127: int Theight;
128: } T_fontsize;
129:
130: typedef struct {
131: short *bits;
132: int x;
133: int y;
134: int width;
135: int height;
136: } BitmapBits;
137:
138: #define SAVELINES 64 /* default # lines to save */
139: #define SCROLLBARWIDTH 15 /* scroll bar width */
140:
141: typedef struct {
142: /* These parameters apply to both windows */
143: Display *display; /* X display for screen */
144: int respond; /* socket for responses
145: (position report, etc.) */
146: long pid; /* pid of process on far side */
147: int uid; /* user id of actual person */
148: int gid; /* group id of actual person */
149: int color; /* colors used */
150: GC normalGC; /* normal painting */
151: GC reverseGC; /* reverse painting */
152: GC normalboldGC; /* normal painting, bold font */
153: GC reverseboldGC; /* reverse painting, bold font */
154: GC cursorGC; /* normal cursor painting */
155: GC reversecursorGC;/* reverse cursor painting */
156: unsigned long foreground; /* foreground color */
157: unsigned long background; /* Background color */
158: unsigned long cursorcolor; /* Cursor color */
159: unsigned long mousecolor; /* Mouse color */
160: int border; /* inner border */
161: int borderwidth; /* outer border */
162: unsigned long bordercolor; /* border Pixel color */
163: Pixmap graybordertile; /* tile pixmap for border when
164: window is unselected */
165: Cursor arrow; /* arrow cursor */
166: unsigned short send_mouse_pos; /* user wants mouse transition */
167: /* and position information */
168: int select; /* xterm selected */
169: int visualbell; /* visual bell mode */
170: int logging; /* logging mode */
171: int logfd; /* file descriptor of log */
172: char *logfile; /* log file name */
173: char *logstart; /* current start of log buffer */
174: int inhibit; /* flags for inhibiting changes */
175:
176: /* VT window parameters */
177: struct {
178: Window window; /* X window id */
179: int width; /* width of columns */
180: int height; /* height of rows */
181: int fullwidth; /* full width of window */
182: int fullheight; /* full height of window */
183: int f_width; /* width of fonts in pixels */
184: int f_height; /* height of fonts in pixels */
185: } fullVwin;
186: Cursor curs; /* cursor resource from X */
187: /* Terminal fonts must be of the same size and of fixed width */
188: XFontStruct *fnt_norm; /* normal font of terminal */
189: XFontStruct *fnt_bold; /* bold font of terminal */
190: int enbolden; /* overstrike for bold font */
191: XPoint *box; /* draw unselected cursor */
192:
193: int cursor_state; /* ON or OFF */
194: int cursor_set; /* requested state */
195: int cursor_col; /* previous cursor column */
196: int cursor_row; /* previous cursor row */
197: int cur_col; /* current cursor column */
198: int cur_row; /* current cursor row */
199: int max_col; /* rightmost column */
200: int max_row; /* bottom row */
201: int top_marg; /* top line of scrolling region */
202: int bot_marg; /* bottom line of " " */
203: Window scrollWindow; /* pointer to scrollbar struct */
204: int scrollbar; /* if > 0, width of scrollbar, and
205: scrollbar is showing */
206: int topline; /* line number of top, <= 0 */
207: int savedlines; /* number of lines that've been saved */
208: int savelines; /* number of lines off top to save */
209: int scrollinput; /* scroll to bottom on input */
210: int scrollkey; /* scroll to bottom on key */
211:
212: ScrnBuf buf; /* screen buffer (main) */
213: ScrnBuf allbuf; /* screen buffer (may include
214: lines scrolled off top */
215: ScrnBuf altbuf; /* alternate screen buffer */
216: int alternate; /* true if using alternate buf */
217: unsigned short do_wrap; /* true if cursor in last column
218: and character just output */
219: int incopy; /* 0 if no RasterCopy exposure
220: event processed since last
221: RasterCopy */
222: int c132; /* allow change to 132 columns */
223: int curses; /* cludge-ups for more and vi */
224: int marginbell; /* true if margin bell on */
225: int nmarginbell; /* columns from right margin */
226: int bellarmed; /* cursor below bell margin */
227: unsigned int multiscroll; /* true if multi-scroll */
228: int scrolls; /* outstanding scroll count */
229: SavedCursor sc; /* data for restore cursor */
230: char *iconname; /* name in icon */
231: int iconnamelen; /* length of icon name */
232: char *titlename; /* name in title */
233: int titlenamelen; /* length of title name */
234: int save_modes[19]; /* save dec private modes */
235:
236: /* Improved VT100 emulation stuff. */
237: char gsets[4]; /* G0 through G3. */
238: char curgl; /* Current GL setting. */
239: char curgr; /* Current GR setting. */
240: char curss; /* Current single shift. */
241: int scroll_amt; /* amount to scroll */
242: int refresh_amt; /* amount to refresh */
243: int jumpscroll; /* whether we should jumpscroll */
244:
245: /* Tektronix window parameters */
246: GC TnormalGC; /* normal painting */
247: GC TcursorGC; /* normal cursor painting */
248: unsigned long Tforeground; /* foreground color */
249: unsigned long Tbackground; /* Background color */
250: unsigned long Tcursorcolor; /* Cursor color */
251: Pixmap Tbgndtile; /* background tile pixmap */
252: int Tcolor; /* colors used */
253: int planeused; /* is xorplane being used */
254: int cellsused; /* are color cells being used */
255: XColor colorcells[3]; /* color cells for Tek */
256: int Tshow; /* Tek window showing */
257: int waitrefresh; /* postpone refresh */
258: struct {
259: Window window; /* X window id */
260: int width; /* width of columns */
261: int height; /* height of rows */
262: int fullwidth; /* full width of window */
263: int fullheight; /* full height of window */
264: double tekscale; /* scale factor Tek -> vs100 */
265: } fullTwin;
266: XPoint **Tbox; /* draw unselected cursor */
267: int xorplane; /* z plane for inverts */
268: GC linepat[TEKNUMLINES]; /* line patterns */
269: XFontStruct *Tfont[TEKNUMFONTS]; /* Tek fonts */
270: int tobaseline[TEKNUMFONTS]; /* top to baseline for
271: each font */
272: int TekEmu; /* true if Tektronix emulation */
273: int cur_X; /* current x */
274: int cur_Y; /* current y */
275: Tmodes cur; /* current tek modes */
276: Tmodes page; /* starting tek modes on page */
277: int margin; /* 0 -> margin 1, 1 -> margin 2 */
278: int pen; /* current Tektronix pen 0=up, 1=dn */
279: char *TekGIN; /* nonzero if Tektronix GIN mode*/
280: char *Ticonname; /* name in icon */
281: int Ticonnamelen; /* length of icon name */
282: char *Ttitlename; /* name of title */
283: int Ttitlenamelen; /* length of title name */
284: } TScreen;
285:
286: /* meaning of bits in screen.select flag */
287: #define INWINDOW 01 /* the mouse is in one of the windows */
288: #define FOCUS 02 /* one of the windows is the focus window */
289:
290: typedef struct
291: {
292: unsigned flags;
293: } TKeyboard;
294:
295: /* define masks for flags */
296: #define CAPS_LOCK 0x01
297: #define KYPD_APL 0x02
298: #define CURSOR_APL 0x04
299:
300:
301: #define N_MARGINBELL 10
302: #define MAX_TABS 320
303: #define TAB_ARRAY_SIZE 10 /* number of ints to provide MAX_TABS bits */
304:
305: typedef unsigned Tabs [TAB_ARRAY_SIZE];
306:
307:
308: #define BUF_SIZE 4096
309:
310: typedef struct
311: {
312: TKeyboard keyboard; /* terminal keyboard */
313: TScreen screen; /* terminal screeen */
314: unsigned flags; /* mode flags */
315: unsigned initflags; /* initial mode flags */
316: Tabs tabs; /* tabstops of the terminal */
317: } Terminal;
318:
319:
320: /* masks for terminal flags */
321:
322: #define INVERSE 0x01 /* invert the characters to be output */
323: #define UNDERLINE 0x02 /* true if underlining */
324: #define BOLD 0x04
325: #define WRAPAROUND 0x08
326: #define REVERSE_VIDEO 0x10 /* true if screen white on black */
327: #define ORIGIN 0x20 /* true if in origin mode */
328: #define INSERT 0x40 /* true if in insert mode */
329: #define SMOOTHSCROLL 0x80 /* true if in smooth scroll mode */
330: #define AUTOREPEAT 0x100 /* true if in autorepeat mode */
331: #define IN132COLUMNS 0x200 /* true if in 132 column mode */
332: #define LINEFEED 0x400
333: #define REVERSEWRAP 0x800 /* true if reverse wraparound mode */
334:
335: #define ATTRIBUTES 0x07 /* attributes mask */
336: #define CHAR 0177
337:
338: #define VWindow(screen) (screen->fullVwin.window)
339: #define TextWindow(screen) (screen->fullVwin.window)
340: #define TWindow(screen) (screen->fullTwin.window)
341: #define Width(screen) (screen->fullVwin.width)
342: #define Height(screen) (screen->fullVwin.height)
343: #define FullWidth(screen) (screen->fullVwin.fullwidth)
344: #define FullHeight(screen) (screen->fullVwin.fullheight)
345: #define FontWidth(screen) (screen->fullVwin.f_width)
346: #define FontHeight(screen) (screen->fullVwin.f_height)
347: #define TWidth(screen) (screen->fullTwin.width)
348: #define THeight(screen) (screen->fullTwin.height)
349: #define TFullWidth(screen) (screen->fullTwin.fullwidth)
350: #define TFullHeight(screen) (screen->fullTwin.fullheight)
351: #define TekScale(screen) (screen->fullTwin.tekscale)
352:
353: #define CursorX(screen,col) ((col) * FontWidth(screen) + screen->border \
354: + screen->scrollbar)
355: #define CursorY(screen,row) ((((row) - screen->topline) * FontHeight(screen)) \
356: + screen->border)
357:
358: #define TWINDOWEVENTS (KeyPressMask | ExposureMask | ButtonPressMask |\
359: ButtonReleaseMask | StructureNotifyMask |\
360: EnterWindowMask | LeaveWindowMask | FocusChangeMask)
361:
362: #define WINDOWEVENTS (TWINDOWEVENTS | PointerMotionMask)
363:
364:
365: #define TEK_LINK_BLOCK_SIZE 1024
366:
367: typedef struct Tek_Link
368: {
369: struct Tek_Link *next; /* pointer to next TekLink in list
370: NULL <=> this is last TekLink */
371: short count;
372: char *ptr;
373: char data [TEK_LINK_BLOCK_SIZE];
374: } TekLink;
375:
376: /* flags for cursors */
377: #define OFF 0
378: #define ON 1
379: #define CLEAR 0
380: #define TOGGLE 1
381:
382: /* flags for color */
383: #define C_FOREGROUND 0x01
384: #define C_BACKGROUND 0x02
385: #define C_FBMASK 0x03
386: #define C_CURSOR 0x04
387: #define C_MOUSE 0x08
388: #define C_BORDER 0x10
389:
390: /* flags for inhibit */
391: #define I_LOG 0x01
392: #define I_SIGNAL 0x02
393: #define I_TEK 0x04
394:
395: extern Cursor make_tcross();
396: extern Cursor make_xterm();
397: extern Cursor make_wait();
398: extern Cursor make_arrow();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.