2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * $XConsortium: TermPrimData.h /main/2 1996/10/30 13:00:24 cde-hp $";
28 * (c) Copyright 1993, 1994 Hewlett-Packard Company *
29 * (c) Copyright 1993, 1994 International Business Machines Corp. *
30 * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
31 * (c) Copyright 1993, 1994 Novell, Inc. *
32 * (c) Copyright 1995 Digital Equipment Corporation *
35 #ifndef _Dt_TermPrimData_h
36 #define _Dt_TermPrimData_h
38 #include "TermHeader.h"
39 #include "TermPrimBuffer.h"
40 #include "TermPrimParser.h"
41 #include "TermPrimPendingText.h"
42 #include "TermPrimRender.h"
43 #include "TermPrimSelect.h"
44 #include "TermPrimLineFont.h"
49 #define KEYBOARD_LOCKED(kbdLocked) ((kbdLocked).escape || \
50 (kbdLocked).xferPending || \
51 (kbdLocked).error || \
62 ** There are 4 reasons that the keyboard could be locked...
64 typedef struct _TermKbdLockStatus
66 Boolean escape; /* escape sequence (or auto lock) */
67 Boolean xferPending; /* a transfer is pending */
68 Boolean error; /* an error message is being displayed */
69 Boolean record; /* we're in record mode */
73 typedef struct _OnTheSpotData {
80 Boolean under_preedit;
81 } OnTheSpotDataRec, *OnTheSpotData;
83 #define PreRow(w) ((w)->term.tpd->onthespot->row)
84 #define PreColumn(w) ((w)->term.tpd->onthespot->column)
85 #define PreStart(w) ((w)->term.tpd->onthespot->start)
86 #define PreEnd(w) ((w)->term.tpd->onthespot->end)
87 #define PreLen(w) ((w)->term.tpd->onthespot->pre_len)
88 #define PreCursor(w) ((w)->term.tpd->onthespot->cursor)
89 #define PreUnder(w) ((w)->term.tpd->onthespot->under_preedit)
92 typedef struct termData {
93 /*********************************************************************
96 XtInputId ptyOutputId; /* pty master Xt output id */
97 XtInputId ptyInputId; /* pty master Xt input id */
99 /*********************************************************************
102 TermFont termFont; /* passed in base term font */
103 TermFont boldTermFont; /* passed in bold term font */
104 TermFont defaultTermFont; /* default base term font */
105 TermFont defaultBoldTermFont; /* default bold term font */
107 unsigned char renderTermFontsNum; /* number of above fonts */
108 unsigned char baseFontIndex; /* number of base font */
109 unsigned char altFontIndex; /* number of alternate font */
111 short cellWidth; /* width of base font */
112 short cellHeight; /* height of base font */
113 short ascent; /* ascent of base font */
115 /*********************************************************************
118 TermBuffer termBuffer; /* character/enhancment buffer */
119 short bufferRows; /* rows of term buffer memory */
120 short bufferRowRatio; /* scaled ratio of term buffer
121 * memory to term window
124 TermBuffer historyBuffer; /* history character buffer */
125 short historyBufferRows; /* rows of term history buffer */
127 short leftMargin; /* left margin */
128 short rightMargin; /* right margin */
132 short topRow; /* number of top row on screen */
133 short cursorColumn; /* current cursor position, col */
134 short cursorRow; /* current cursor position, row */
135 short lastUsedRow; /* number of last used buffer row.
136 * if == 0, no rows used, if == 1,
139 short lastUsedHistoryRow;
140 short offsetX; /* width of internal window
141 * border. With Motif, this is
143 * highlightThickness and
146 short offsetY; /* height of internal window
151 ** Generic mode information...
153 Boolean transmitFunctions; /* if true, transmit functions (A) */
154 Boolean autoWrapRight; /* if true, wrap at right margin (C) */
155 Boolean wrapRightAfterInsert; /* if true, wrap after insert */
157 WRAPbetweenMargins = 0,
160 } wrapState; /* margin wrap state */
163 ** Memory lock status...
169 } scrollLockMode; /* memory lock mode */
170 short scrollLockTopRow; /* bottom of top scroll lock region */
171 short scrollLockBottomRow; /* top of bottom scroll lock region */
173 /* for mapOnOutput */
174 time_t creationTime ;
175 Boolean windowMapped;
177 /* pointer blanking */
178 Boolean pointerFirst; /* for initialization */
179 Boolean pointerOn; /* Is pointer on? */
180 XtIntervalId pointerTimeoutID; /* ID of current timeout */
181 Boolean pointerFrozen; /* Is pointer outside window? */
182 Cursor noPointer; /* blank pointer pixmap */
185 FILE *logStream; /* file pointer for logging */
186 uid_t uid; /* user id of user */
187 gid_t gid; /* group id of user */
188 char *shell; /* users shell */
191 /* these will go away when the associated files are updated...
193 #define memoryLockRow scrollLockTopRow
194 #define memoryLockMode scrollLockMode
195 #define MEMORY_LOCKoff SCROLL_LOCKoff
196 #define MEMORY_LOCKon SCROLL_LOCKon
197 #define MEMORY_LOCKprotect SCROLL_LOCKprotect
200 /*********************************************************************
203 ParserContext context; /* context of the parser */
204 Boolean parserNotInStartState;
205 int mbCurMax; /* max bytes per char for locale*/
206 unsigned char mbPartialChar[MB_LEN_MAX];
207 /* partial multi-byte char */
208 int mbPartialCharLen; /* length of above */
210 /*********************************************************************
213 TermGC renderGC; /* GC for rendering text */
214 TermGC renderReverseGC; /* GC for rendering text */
215 TermGC clearGC; /* GC for clearing text */
217 /*********************************************************************
220 XtIntervalId cursorTimeoutId; /* cursor timeout id */
221 TermGC cursorGC; /* GC for blinking cursor */
226 } cursorState; /* state of cursor */
227 Boolean cursorVisible; /* true if cursor is visible */
229 /*********************************************************************
232 Boolean IMHasFocus; /* true if IM has focus */
233 /* The following are in character positions, not pixel positions...
235 short IMCursorColumn; /* current IM cursor column */
236 short IMCursorRow; /* current IM cursor row */
238 /*********************************************************************
241 /* the following data reflects the copy area in progress to be used
242 * for filling in possible holes in exposure events...
244 short scrollSrcX; /* x src coord of scrolled area */
245 short scrollSrcY; /* y src coord of scrolled area */
246 short scrollDestX; /* x dest coord of scrolled area*/
247 short scrollDestY; /* y dest coord of scrolled area*/
248 short scrollWidth; /* width of scrolled area */
249 short scrollHeight; /* height of scrolled area */
250 short scrollTopRow; /* row of scroll top */
251 short scrollBottomRow; /* row of scroll bottom */
252 Boolean *scrollRefreshRows; /* flags for rows that need to
253 * be refreshed after a scroll
256 Boolean useHistoryBuffer; /* true if separate history buf */
257 Boolean allowScrollBelowBuffer; /* true allows scrolling below
258 * the terminal buffer
261 /* the following is for data for both any current scroll-in-progress
262 * as well as any pending (queued) scroll...
264 Boolean scrollInProgress; /* true if scroll in progresss */
267 short scrollLines; /* number of lines to scroll */
268 short scrollsPending; /* number of scrolls pending */
269 Boolean scrolled; /* true when scrolled, cleared
274 short pendingScrollLines; /* number of lines in pending */
275 short pendingScrollTopRow; /* top row of pending scroll */
276 short pendingScrollBottomRow;
277 /* bottom row of pending scroll */
278 Boolean pendingScroll; /* True if scroll queued up */
282 /* the following is for stuffing input data when we have turned off
283 * input processing during a scroll...
285 PendingText pendingRead; /* pending read data */
286 Boolean readInProgress; /* True if now reading from pty */
289 ** Set up a linked list of text chunks, data stored here is waiting
292 PendingText pendingWrite; /* pending write data */
295 ** Keyboard state information...
297 TermKbdLockStatus keyboardLocked; /* if true, keyboard is locked */
298 DtTermInsertCharMode insertCharMode; /* insert char mode */
299 Boolean autoLineFeed; /* if true, in auto LF mode */
300 Boolean halfDuplex; /* if true, half duplex */
302 /*********************************************************************
305 Boolean capsLock; /* true == caps lock set */
306 KeyCode *capsLockKeyCodes; /* keyboard's modifier keymap */
307 short numCapsLockKeyCodes; /* number of caps lock modifiers*/
309 /*********************************************************************
312 unsigned int metaMask; /* mod mask used for meta */
314 /*********************************************************************
315 * STOP indicator tracking
317 Boolean outputStopped; /* true == out from pty stopped */
318 Boolean oneSecondPause; /* true == esc @ pause */
320 /*********************************************************************
321 * Warning/error dialog
323 Widget warningDialog; /* warning dialog */
324 Boolean mapWarningDialog; /* map dialog when window mapped*/
325 Boolean warningDialogMapped; /* true if dialog is mapped */
331 /*********************************************************************
334 char *utmpId; /* id of /etc/utmp entry */
335 #ifdef UTMPID_PROPERTY_NOTIFY
342 #endif /* UTMPID_PROPERTY_NOTIFY */
343 #ifdef UTMPID_PIPE_NOTIFY
344 int utmpNotifyPipe[2];
345 XtInputId utmpNotifyPipeInputId;
346 XtInputId utmpNotifyPipeExceptId;
347 #endif /* UTMPID_PIPE_NOTIFY */
352 TermSelectInfo selectInfo;
355 ** On the spot input method data
357 OnTheSpotData onthespot;
359 } DtTermPrimDataRec, *DtTermPrimData;
362 #endif /* _Dt_TermPrimData_h */