ptyx.h revision 3367019c
13367019cSmrg/* $XTermId: ptyx.h,v 1.767 2013/05/27 22:21:32 tom Exp $ */ 2d522f475Smrg 3d522f475Smrg/* 43367019cSmrg * Copyright 1999-2012,2013 by Thomas E. Dickey 5d522f475Smrg * 6d522f475Smrg * All Rights Reserved 7d522f475Smrg * 8d522f475Smrg * Permission is hereby granted, free of charge, to any person obtaining a 9d522f475Smrg * copy of this software and associated documentation files (the 10d522f475Smrg * "Software"), to deal in the Software without restriction, including 11d522f475Smrg * without limitation the rights to use, copy, modify, merge, publish, 12d522f475Smrg * distribute, sublicense, and/or sell copies of the Software, and to 13d522f475Smrg * permit persons to whom the Software is furnished to do so, subject to 14d522f475Smrg * the following conditions: 15d522f475Smrg * 16d522f475Smrg * The above copyright notice and this permission notice shall be included 17d522f475Smrg * in all copies or substantial portions of the Software. 18d522f475Smrg * 19d522f475Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20d522f475Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21d522f475Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22d522f475Smrg * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 23d522f475Smrg * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24d522f475Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25d522f475Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26d522f475Smrg * 27d522f475Smrg * Except as contained in this notice, the name(s) of the above copyright 28d522f475Smrg * holders shall not be used in advertising or otherwise to promote the 29d522f475Smrg * sale, use or other dealings in this Software without prior written 30d522f475Smrg * authorization. 31d522f475Smrg * 32d522f475Smrg * 33d522f475Smrg * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. 34d522f475Smrg * 35d522f475Smrg * All Rights Reserved 36d522f475Smrg * 37d522f475Smrg * Permission to use, copy, modify, and distribute this software and its 38d522f475Smrg * documentation for any purpose and without fee is hereby granted, 39d522f475Smrg * provided that the above copyright notice appear in all copies and that 40d522f475Smrg * both that copyright notice and this permission notice appear in 41d522f475Smrg * supporting documentation, and that the name of Digital Equipment 42d522f475Smrg * Corporation not be used in advertising or publicity pertaining to 43d522f475Smrg * distribution of the software without specific, written prior permission. 44d522f475Smrg * 45d522f475Smrg * 46d522f475Smrg * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 47d522f475Smrg * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 48d522f475Smrg * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 49d522f475Smrg * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 50d522f475Smrg * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 51d522f475Smrg * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 52d522f475Smrg * SOFTWARE. 53d522f475Smrg */ 54d522f475Smrg 55d522f475Smrg#ifndef included_ptyx_h 56d522f475Smrg#define included_ptyx_h 1 57d522f475Smrg 58d522f475Smrg#ifdef HAVE_CONFIG_H 59d522f475Smrg#include <xtermcfg.h> 60d522f475Smrg#endif 61d522f475Smrg 62d522f475Smrg/* ptyx.h */ 63c219fbebSmrg/* *INDENT-OFF* */ 64d522f475Smrg/* @(#)ptyx.h X10/6.6 11/10/86 */ 65d522f475Smrg 66d522f475Smrg#include <X11/IntrinsicP.h> 67d522f475Smrg#include <X11/Shell.h> /* for XtNdieCallback, etc. */ 68d522f475Smrg#include <X11/StringDefs.h> /* for standard resource names */ 69d522f475Smrg#include <X11/Xmu/Misc.h> /* For Max() and Min(). */ 703367019cSmrg 713367019cSmrg#undef bcopy 723367019cSmrg#undef bzero 73d522f475Smrg#include <X11/Xfuncs.h> 743367019cSmrg 75d522f475Smrg#include <X11/Xosdefs.h> 76d522f475Smrg#include <X11/Xmu/Converters.h> 77d522f475Smrg#ifdef XRENDERFONT 78d522f475Smrg#include <X11/Xft/Xft.h> 79d522f475Smrg#endif 80d522f475Smrg 81712a7ff4Smrg#include <stdio.h> 82712a7ff4Smrg 83d522f475Smrg/* adapted from IntrinsicI.h */ 84d522f475Smrg#define MyStackAlloc(size, stack_cache_array) \ 85d522f475Smrg ((size) <= sizeof(stack_cache_array) \ 86d522f475Smrg ? (XtPointer)(stack_cache_array) \ 87cd3331d0Smrg : (XtPointer)malloc((size_t)(size))) 88d522f475Smrg 89d522f475Smrg#define MyStackFree(pointer, stack_cache_array) \ 90d522f475Smrg if ((pointer) != ((char *)(stack_cache_array))) free(pointer) 91d522f475Smrg 92d522f475Smrg/* adapted from vile (vi-like-emacs) */ 93cd3331d0Smrg#define TypeCallocN(type,n) (type *)calloc((size_t) (n), sizeof(type)) 94cd3331d0Smrg#define TypeCalloc(type) TypeCallocN(type, 1) 95d522f475Smrg 96cd3331d0Smrg#define TypeMallocN(type,n) (type *)malloc(sizeof(type) * (size_t) (n)) 97cd3331d0Smrg#define TypeMalloc(type) TypeMallocN(type, 1) 98d522f475Smrg 99d522f475Smrg#define TypeRealloc(type,n,p) (type *)realloc(p, (n) * sizeof(type)) 100d522f475Smrg 101c219fbebSmrg#define TypeXtReallocN(t,p,n) (t *)(void *)XtRealloc((char *)(p), (Cardinal)(sizeof(t) * (size_t) (n))) 102c219fbebSmrg 103c219fbebSmrg#define TypeXtMallocX(type,n) (type *)(void *)XtMalloc((Cardinal)(sizeof(type) + (size_t) (n))) 104c219fbebSmrg#define TypeXtMallocN(type,n) (type *)(void *)XtMalloc((Cardinal)(sizeof(type) * (size_t) (n))) 105c219fbebSmrg#define TypeXtMalloc(type) TypeXtMallocN(type, 1) 106c219fbebSmrg 107d522f475Smrg/* use these to allocate partly-structured data */ 108cd3331d0Smrg#define CastMallocN(type,n) (type *)malloc(sizeof(type) + (size_t) (n)) 109d522f475Smrg#define CastMalloc(type) CastMallocN(type,0) 110d522f475Smrg 111b7c89284Ssnj#define BumpBuffer(type, buffer, size, want) \ 112b7c89284Ssnj if (want >= size) { \ 113b7c89284Ssnj size = 1 + (want * 2); \ 114b7c89284Ssnj buffer = TypeRealloc(type, size, buffer); \ 115b7c89284Ssnj } 116b7c89284Ssnj 117b7c89284Ssnj#define BfBuf(type) screen->bf_buf_##type 118b7c89284Ssnj#define BfLen(type) screen->bf_len_##type 119b7c89284Ssnj 120b7c89284Ssnj#define TypedBuffer(type) \ 121b7c89284Ssnj type *bf_buf_##type; \ 122b7c89284Ssnj Cardinal bf_len_##type 123b7c89284Ssnj 124b7c89284Ssnj#define BumpTypedBuffer(type, want) \ 125b7c89284Ssnj BumpBuffer(type, BfBuf(type), BfLen(type), want) 126b7c89284Ssnj 127b7c89284Ssnj#define FreeTypedBuffer(type) \ 128b7c89284Ssnj if (BfBuf(type) != 0) { \ 129b7c89284Ssnj free(BfBuf(type)); \ 130b7c89284Ssnj BfBuf(type) = 0; \ 131b7c89284Ssnj } \ 132b7c89284Ssnj BfLen(type) = 0 133b7c89284Ssnj 134d522f475Smrg/* 135d522f475Smrg** System V definitions 136d522f475Smrg*/ 137d522f475Smrg 138d522f475Smrg#ifdef att 139d522f475Smrg#define ATT 140d522f475Smrg#endif 141d522f475Smrg 142d522f475Smrg#ifdef SVR4 143d522f475Smrg#undef SYSV /* predefined on Solaris 2.4 */ 144d522f475Smrg#define SYSV /* SVR4 is (approx) superset of SVR3 */ 145d522f475Smrg#define ATT 146d522f475Smrg#endif 147d522f475Smrg 148d522f475Smrg#ifdef SYSV 149d522f475Smrg#ifdef X_NOT_POSIX 150d522f475Smrg#if !defined(CRAY) && !defined(SVR4) 151d522f475Smrg#define dup2(fd1,fd2) ((fd1 == fd2) ? fd1 : \ 152d522f475Smrg (close(fd2), fcntl(fd1, F_DUPFD, fd2))) 153d522f475Smrg#endif 154d522f475Smrg#endif 155d522f475Smrg#endif /* SYSV */ 156d522f475Smrg 157d522f475Smrg/* 158d522f475Smrg * Newer versions of <X11/Xft/Xft.h> have a version number. We use certain 159d522f475Smrg * features from that. 160d522f475Smrg */ 161d522f475Smrg#if defined(XRENDERFONT) && defined(XFT_VERSION) && XFT_VERSION >= 20100 162d522f475Smrg#define HAVE_TYPE_FCCHAR32 1 /* compatible: XftChar16 */ 163d522f475Smrg#define HAVE_TYPE_XFTCHARSPEC 1 /* new type XftCharSpec */ 164d522f475Smrg#endif 165d522f475Smrg 166d522f475Smrg/* 167d522f475Smrg** Definitions to simplify ifdef's for pty's. 168d522f475Smrg*/ 169d522f475Smrg#define USE_PTY_DEVICE 1 170d522f475Smrg#define USE_PTY_SEARCH 1 171d522f475Smrg 172b7c89284Ssnj#if defined(__osf__) || (defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) 173d522f475Smrg#undef USE_PTY_DEVICE 174d522f475Smrg#undef USE_PTY_SEARCH 175d522f475Smrg#define USE_PTS_DEVICE 1 176d522f475Smrg#elif defined(VMS) 177d522f475Smrg#undef USE_PTY_DEVICE 178d522f475Smrg#undef USE_PTY_SEARCH 179d522f475Smrg#elif defined(PUCC_PTYD) 180d522f475Smrg#undef USE_PTY_SEARCH 181d522f475Smrg#elif (defined(sun) && defined(SVR4)) || defined(_ALL_SOURCE) || defined(__CYGWIN__) 182d522f475Smrg#undef USE_PTY_SEARCH 1833367019cSmrg#elif defined(__OpenBSD__) 1843367019cSmrg#undef USE_PTY_SEARCH 1853367019cSmrg#undef USE_PTY_DEVICE 186d522f475Smrg#endif 187d522f475Smrg 1883367019cSmrg#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) 1893367019cSmrg#define USE_HANDSHAKE 0 /* "recent" Linux systems do not require handshaking */ 190d522f475Smrg#endif 191d522f475Smrg 192d522f475Smrg#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) 193d522f475Smrg#define USE_USG_PTYS 194d522f475Smrg#elif (defined(ATT) && !defined(__sgi)) || defined(__MVS__) || (defined(SYSV) && defined(i386)) 195d522f475Smrg#define USE_USG_PTYS 196d522f475Smrg#endif 197d522f475Smrg 198d522f475Smrg/* 199d522f475Smrg * More systems than not require pty-handshaking. 200d522f475Smrg */ 201d522f475Smrg#ifndef USE_HANDSHAKE 202d522f475Smrg#define USE_HANDSHAKE 1 203d522f475Smrg#endif 204d522f475Smrg 205d522f475Smrg/* 206d522f475Smrg** allow for mobility of the pty master/slave directories 207d522f475Smrg*/ 208d522f475Smrg#ifndef PTYDEV 209d522f475Smrg#if defined(__hpux) 210d522f475Smrg#define PTYDEV "/dev/ptym/ptyxx" 211d522f475Smrg#elif defined(__MVS__) 212d522f475Smrg#define PTYDEV "/dev/ptypxxxx" 213d522f475Smrg#else 214d522f475Smrg#define PTYDEV "/dev/ptyxx" 215d522f475Smrg#endif 216d522f475Smrg#endif /* !PTYDEV */ 217d522f475Smrg 218d522f475Smrg#ifndef TTYDEV 219d522f475Smrg#if defined(__hpux) 220d522f475Smrg#define TTYDEV "/dev/pty/ttyxx" 221d522f475Smrg#elif defined(__MVS__) 222d522f475Smrg#define TTYDEV "/dev/ptypxxxx" 223d522f475Smrg#elif defined(USE_PTS_DEVICE) 224d522f475Smrg#define TTYDEV "/dev/pts/0" 225d522f475Smrg#else 226d522f475Smrg#define TTYDEV "/dev/ttyxx" 227d522f475Smrg#endif 228d522f475Smrg#endif /* !TTYDEV */ 229d522f475Smrg 230d522f475Smrg#ifndef PTYCHAR1 231d522f475Smrg#ifdef __hpux 232d522f475Smrg#define PTYCHAR1 "zyxwvutsrqp" 233d522f475Smrg#else /* !__hpux */ 234d522f475Smrg#define PTYCHAR1 "pqrstuvwxyzPQRSTUVWXYZ" 235d522f475Smrg#endif /* !__hpux */ 236d522f475Smrg#endif /* !PTYCHAR1 */ 237d522f475Smrg 238d522f475Smrg#ifndef PTYCHAR2 239d522f475Smrg#ifdef __hpux 240d522f475Smrg#define PTYCHAR2 "fedcba9876543210" 241d522f475Smrg#else /* !__hpux */ 242d522f475Smrg#if defined(__DragonFly__) || defined(__FreeBSD__) 243d522f475Smrg#define PTYCHAR2 "0123456789abcdefghijklmnopqrstuv" 244d522f475Smrg#else /* !__FreeBSD__ */ 245d522f475Smrg#define PTYCHAR2 "0123456789abcdef" 246d522f475Smrg#endif /* !__FreeBSD__ */ 247d522f475Smrg#endif /* !__hpux */ 248d522f475Smrg#endif /* !PTYCHAR2 */ 249d522f475Smrg 250d522f475Smrg#ifndef TTYFORMAT 251d522f475Smrg#if defined(CRAY) 252d522f475Smrg#define TTYFORMAT "/dev/ttyp%03d" 253d522f475Smrg#elif defined(__MVS__) 254d522f475Smrg#define TTYFORMAT "/dev/ttyp%04d" 255d522f475Smrg#else 256d522f475Smrg#define TTYFORMAT "/dev/ttyp%d" 257d522f475Smrg#endif 258d522f475Smrg#endif /* TTYFORMAT */ 259d522f475Smrg 260d522f475Smrg#ifndef PTYFORMAT 261d522f475Smrg#ifdef CRAY 262d522f475Smrg#define PTYFORMAT "/dev/pty/%03d" 263d522f475Smrg#elif defined(__MVS__) 264d522f475Smrg#define PTYFORMAT "/dev/ptyp%04d" 265d522f475Smrg#else 266d522f475Smrg#define PTYFORMAT "/dev/ptyp%d" 267d522f475Smrg#endif 268d522f475Smrg#endif /* PTYFORMAT */ 269d522f475Smrg 270d522f475Smrg#ifndef PTYCHARLEN 271d522f475Smrg#ifdef CRAY 272d522f475Smrg#define PTYCHARLEN 3 273d522f475Smrg#elif defined(__MVS__) 274d522f475Smrg#define PTYCHARLEN 8 /* OS/390 stores, e.g. ut_id="ttyp1234" */ 275d522f475Smrg#else 276d522f475Smrg#define PTYCHARLEN 2 277d522f475Smrg#endif 278d522f475Smrg#endif 279d522f475Smrg 280d522f475Smrg#ifndef MAXPTTYS 281d522f475Smrg#ifdef CRAY 282d522f475Smrg#define MAXPTTYS 256 283d522f475Smrg#else 284d522f475Smrg#define MAXPTTYS 2048 285d522f475Smrg#endif 286d522f475Smrg#endif 287d522f475Smrg 288d522f475Smrg/* Until the translation manager comes along, I have to do my own translation of 289d522f475Smrg * mouse events into the proper routines. */ 290d522f475Smrg 291d522f475Smrgtypedef enum { 292d522f475Smrg NORMAL = 0 293d522f475Smrg , LEFTEXTENSION 294d522f475Smrg , RIGHTEXTENSION 295d522f475Smrg} EventMode; 296d522f475Smrg 297d522f475Smrg/* 298d522f475Smrg * The origin of a screen is 0, 0. Therefore, the number of rows 299d522f475Smrg * on a screen is screen->max_row + 1, and similarly for columns. 300d522f475Smrg */ 301d522f475Smrg#define MaxCols(screen) ((screen)->max_col + 1) 302d522f475Smrg#define MaxRows(screen) ((screen)->max_row + 1) 303d522f475Smrg 304d522f475Smrgtypedef unsigned char Char; /* to support 8 bit chars */ 305d522f475Smrgtypedef Char *ScrnPtr; 306d522f475Smrgtypedef ScrnPtr *ScrnBuf; 307d522f475Smrg 308cd3331d0Smrg/* 309cd3331d0Smrg * Declare an X String, but for unsigned chars. 310cd3331d0Smrg */ 311cd3331d0Smrg#ifdef _CONST_X_STRING 312cd3331d0Smrgtypedef const Char *UString; 313cd3331d0Smrg#else 314cd3331d0Smrgtypedef Char *UString; 315cd3331d0Smrg#endif 316cd3331d0Smrg 317cd3331d0Smrg#define IsEmpty(s) ((s) == 0 || *(s) == '\0') 318cd3331d0Smrg 319d522f475Smrg#define CharOf(n) ((unsigned char)(n)) 320d522f475Smrg 321d522f475Smrgtypedef struct { 322d522f475Smrg int row; 323d522f475Smrg int col; 324d522f475Smrg} CELL; 325d522f475Smrg 326d522f475Smrg#define isSameRow(a,b) ((a)->row == (b)->row) 327d522f475Smrg#define isSameCol(a,b) ((a)->col == (b)->col) 328d522f475Smrg#define isSameCELL(a,b) (isSameRow(a,b) && isSameCol(a,b)) 329d522f475Smrg 330d522f475Smrg#define xBIT(n) (1 << (n)) 331d522f475Smrg 332d522f475Smrg/* 333d522f475Smrg * ANSI emulation, special character codes 334d522f475Smrg */ 335cd3331d0Smrg#define ANSI_EOT 0x04 336d522f475Smrg#define ANSI_BEL 0x07 337cd3331d0Smrg#define ANSI_BS 0x08 338cd3331d0Smrg#define ANSI_HT 0x09 339cd3331d0Smrg#define ANSI_LF 0x0A 340cd3331d0Smrg#define ANSI_VT 0x0B 341d522f475Smrg#define ANSI_FF 0x0C /* C0, C1 control names */ 342cd3331d0Smrg#define ANSI_CR 0x0D 343cd3331d0Smrg#define ANSI_SO 0x0E 344cd3331d0Smrg#define ANSI_SI 0x0F 345cd3331d0Smrg#define ANSI_XON 0x11 /* DC1 */ 346cd3331d0Smrg#define ANSI_XOFF 0x13 /* DC3 */ 347d522f475Smrg#define ANSI_NAK 0x15 348d522f475Smrg#define ANSI_CAN 0x18 349d522f475Smrg#define ANSI_ESC 0x1B 350d522f475Smrg#define ANSI_SPA 0x20 351d522f475Smrg#define XTERM_POUND 0x1E /* internal mapping for '#' */ 352d522f475Smrg#define ANSI_DEL 0x7F 353d522f475Smrg#define ANSI_SS2 0x8E 354d522f475Smrg#define ANSI_SS3 0x8F 355d522f475Smrg#define ANSI_DCS 0x90 356d522f475Smrg#define ANSI_SOS 0x98 357d522f475Smrg#define ANSI_CSI 0x9B 358d522f475Smrg#define ANSI_ST 0x9C 359d522f475Smrg#define ANSI_OSC 0x9D 360d522f475Smrg#define ANSI_PM 0x9E 361d522f475Smrg#define ANSI_APC 0x9F 362d522f475Smrg 363d522f475Smrg#define MIN_DECID 52 /* can emulate VT52 */ 3643367019cSmrg#define MAX_DECID 525 /* ...through VT525 */ 365d522f475Smrg 366d522f475Smrg#ifndef DFT_DECID 3673367019cSmrg#define DFT_DECID "vt420" /* default VT420 */ 368d522f475Smrg#endif 369d522f475Smrg 370d522f475Smrg#ifndef DFT_KBD_DIALECT 371d522f475Smrg#define DFT_KBD_DIALECT "B" /* default USASCII */ 372d522f475Smrg#endif 373d522f475Smrg 374d522f475Smrg/* constants used for utf8 mode */ 375d522f475Smrg#define UCS_REPL 0xfffd 376d522f475Smrg#define UCS_LIMIT 0x80000000U /* both limit and flag for non-UCS */ 377d522f475Smrg 378d522f475Smrg#define TERMCAP_SIZE 1500 /* 1023 is standard; 'screen' exceeds */ 379d522f475Smrg 380d522f475Smrg#define NMENUFONTS 9 /* font entries in fontMenu */ 381d522f475Smrg 382d522f475Smrg#define NBOX 5 /* Number of Points in box */ 383d522f475Smrg#define NPARAM 30 /* Max. parameters */ 384d522f475Smrg 385d522f475Smrgtypedef struct { 386cd3331d0Smrg String opt; 387cd3331d0Smrg String desc; 388d522f475Smrg} OptionHelp; 389d522f475Smrg 3903367019cSmrgtypedef struct { 3913367019cSmrg int count; /* number of values in params[] */ 3923367019cSmrg int has_subparams; /* true if there are any sub's */ 3933367019cSmrg int is_sub[NPARAM]; /* true for subparam */ 3943367019cSmrg int params[NPARAM]; /* parameter value */ 3953367019cSmrg} PARAMS; 3963367019cSmrg 3970d92cbfdSchristostypedef short ParmType; 3980d92cbfdSchristos 399d522f475Smrgtypedef struct { 4000d92cbfdSchristos Char a_type; /* CSI, etc., see unparseq() */ 4010d92cbfdSchristos Char a_pintro; /* private-mode char, if any */ 4023367019cSmrg const char * a_delim; /* between parameters (;) */ 4030d92cbfdSchristos Char a_inters; /* special (before final-char) */ 4040d92cbfdSchristos Char a_final; /* final-char */ 4050d92cbfdSchristos ParmType a_nparam; /* # of parameters */ 4060d92cbfdSchristos ParmType a_param[NPARAM]; /* Parameters */ 4073367019cSmrg Char a_radix[NPARAM]; /* Parameters */ 408d522f475Smrg} ANSI; 409d522f475Smrg 410d522f475Smrg#define TEK_FONT_LARGE 0 411d522f475Smrg#define TEK_FONT_2 1 412d522f475Smrg#define TEK_FONT_3 2 413d522f475Smrg#define TEK_FONT_SMALL 3 414d522f475Smrg#define TEKNUMFONTS 4 415d522f475Smrg 416d522f475Smrg/* Actually there are 5 types of lines, but four are non-solid lines */ 417d522f475Smrg#define TEKNUMLINES 4 418d522f475Smrg 419d522f475Smrgtypedef struct { 420d522f475Smrg int x; 421d522f475Smrg int y; 422d522f475Smrg int fontsize; 423d522f475Smrg unsigned linetype; 424d522f475Smrg} Tmodes; 425d522f475Smrg 426d522f475Smrgtypedef struct { 427d522f475Smrg int Twidth; 428d522f475Smrg int Theight; 429d522f475Smrg} T_fontsize; 430d522f475Smrg 431d522f475Smrgtypedef struct { 432d522f475Smrg short *bits; 433d522f475Smrg int x; 434d522f475Smrg int y; 435d522f475Smrg int width; 436d522f475Smrg int height; 437d522f475Smrg} BitmapBits; 438d522f475Smrg 439d522f475Smrg#define SAVELINES 64 /* default # lines to save */ 440d522f475Smrg#define SCROLLLINES 1 /* default # lines to scroll */ 441d522f475Smrg 442d522f475Smrg#define EXCHANGE(a,b,tmp) tmp = a; a = b; b = tmp 443d522f475Smrg 444d522f475Smrg/***====================================================================***/ 445d522f475Smrg 446d522f475Smrg#if (XtSpecificationRelease < 6) 447d522f475Smrg#ifndef NO_ACTIVE_ICON 448d522f475Smrg#define NO_ACTIVE_ICON 1 /* Note: code relies on an X11R6 function */ 449d522f475Smrg#endif 450d522f475Smrg#endif 451d522f475Smrg 452d522f475Smrg#ifndef OPT_AIX_COLORS 453d522f475Smrg#define OPT_AIX_COLORS 1 /* true if xterm is configured with AIX (16) colors */ 454d522f475Smrg#endif 455d522f475Smrg 456b7c89284Ssnj#ifndef OPT_ALLOW_XXX_OPS 457b7c89284Ssnj#define OPT_ALLOW_XXX_OPS 1 /* true if xterm adds "Allow XXX Ops" submenu */ 458b7c89284Ssnj#endif 459b7c89284Ssnj 460d522f475Smrg#ifndef OPT_BLINK_CURS 461d522f475Smrg#define OPT_BLINK_CURS 1 /* true if xterm has blinking cursor capability */ 462d522f475Smrg#endif 463d522f475Smrg 464d522f475Smrg#ifndef OPT_BLINK_TEXT 465d522f475Smrg#define OPT_BLINK_TEXT OPT_BLINK_CURS /* true if xterm has blinking text capability */ 466d522f475Smrg#endif 467d522f475Smrg 468d522f475Smrg#ifndef OPT_BOX_CHARS 469d522f475Smrg#define OPT_BOX_CHARS 1 /* true if xterm can simulate box-characters */ 470d522f475Smrg#endif 471d522f475Smrg 4723367019cSmrg#ifndef OPT_BUILTIN_XPMS 4733367019cSmrg#define OPT_BUILTIN_XPMS 0 /* true if all xpm data is compiled-in */ 4743367019cSmrg#endif 4753367019cSmrg 476d522f475Smrg#ifndef OPT_BROKEN_OSC 477d522f475Smrg#ifdef linux 478d522f475Smrg#define OPT_BROKEN_OSC 1 /* man console_codes, 1st paragraph - cf: ECMA-48 */ 479d522f475Smrg#else 480d522f475Smrg#define OPT_BROKEN_OSC 0 /* true if xterm allows Linux's broken OSC parsing */ 481d522f475Smrg#endif 482d522f475Smrg#endif 483d522f475Smrg 484d522f475Smrg#ifndef OPT_BROKEN_ST 485d522f475Smrg#define OPT_BROKEN_ST 1 /* true if xterm allows old/broken OSC parsing */ 486d522f475Smrg#endif 487d522f475Smrg 488d522f475Smrg#ifndef OPT_C1_PRINT 489d522f475Smrg#define OPT_C1_PRINT 1 /* true if xterm allows C1 controls to be printable */ 490d522f475Smrg#endif 491d522f475Smrg 492d522f475Smrg#ifndef OPT_CLIP_BOLD 493d522f475Smrg#define OPT_CLIP_BOLD 1 /* true if xterm uses clipping to avoid bold-trash */ 494d522f475Smrg#endif 495d522f475Smrg 496d522f475Smrg#ifndef OPT_COLOR_CLASS 497d522f475Smrg#define OPT_COLOR_CLASS 1 /* true if xterm uses separate color-resource classes */ 498d522f475Smrg#endif 499d522f475Smrg 500d522f475Smrg#ifndef OPT_COLOR_RES 501d522f475Smrg#define OPT_COLOR_RES 1 /* true if xterm delays color-resource evaluation */ 502d522f475Smrg#endif 503d522f475Smrg 504d522f475Smrg#ifndef OPT_DABBREV 505d522f475Smrg#define OPT_DABBREV 0 /* dynamic abbreviations */ 506d522f475Smrg#endif 507d522f475Smrg 508d522f475Smrg#ifndef OPT_DEC_CHRSET 509d522f475Smrg#define OPT_DEC_CHRSET 1 /* true if xterm is configured for DEC charset */ 510d522f475Smrg#endif 511d522f475Smrg 512d522f475Smrg#ifndef OPT_DEC_LOCATOR 513d522f475Smrg#define OPT_DEC_LOCATOR 0 /* true if xterm supports VT220-style mouse events */ 514d522f475Smrg#endif 515d522f475Smrg 516d522f475Smrg#ifndef OPT_DEC_RECTOPS 517d522f475Smrg#define OPT_DEC_RECTOPS 0 /* true if xterm is configured for VT420 rectangles */ 518d522f475Smrg#endif 519d522f475Smrg 520d522f475Smrg#ifndef OPT_DEC_SOFTFONT 521d522f475Smrg#define OPT_DEC_SOFTFONT 0 /* true if xterm is configured for VT220 softfonts */ 522d522f475Smrg#endif 523d522f475Smrg 5243367019cSmrg#ifndef OPT_DOUBLE_BUFFER 5253367019cSmrg#define OPT_DOUBLE_BUFFER 0 /* true if using double-buffering */ 5263367019cSmrg#endif 5273367019cSmrg 528d522f475Smrg#ifndef OPT_EBCDIC 529d522f475Smrg#ifdef __MVS__ 530d522f475Smrg#define OPT_EBCDIC 1 531d522f475Smrg#else 532d522f475Smrg#define OPT_EBCDIC 0 533d522f475Smrg#endif 534d522f475Smrg#endif 535d522f475Smrg 536d522f475Smrg#ifndef OPT_EXEC_XTERM 537d522f475Smrg#define OPT_EXEC_XTERM 0 /* true if xterm can fork/exec copies of itself */ 538d522f475Smrg#endif 539d522f475Smrg 540d522f475Smrg#ifndef OPT_EXTRA_PASTE 541d522f475Smrg#define OPT_EXTRA_PASTE 1 542d522f475Smrg#endif 543d522f475Smrg 544b7c89284Ssnj#ifndef OPT_FIFO_LINES 545b7c89284Ssnj#define OPT_FIFO_LINES 0 /* optimize save-lines feature using FIFO */ 546b7c89284Ssnj#endif 547b7c89284Ssnj 548d522f475Smrg#ifndef OPT_FOCUS_EVENT 549d522f475Smrg#define OPT_FOCUS_EVENT 1 /* focus in/out events */ 550d522f475Smrg#endif 551d522f475Smrg 552d522f475Smrg#ifndef OPT_HP_FUNC_KEYS 553d522f475Smrg#define OPT_HP_FUNC_KEYS 0 /* true if xterm supports HP-style function keys */ 554d522f475Smrg#endif 555d522f475Smrg 556d522f475Smrg#ifndef OPT_I18N_SUPPORT 557d522f475Smrg#if (XtSpecificationRelease >= 5) 558d522f475Smrg#define OPT_I18N_SUPPORT 1 /* true if xterm uses internationalization support */ 559d522f475Smrg#else 560d522f475Smrg#define OPT_I18N_SUPPORT 0 561d522f475Smrg#endif 562d522f475Smrg#endif 563d522f475Smrg 564d522f475Smrg#ifndef OPT_INITIAL_ERASE 565d522f475Smrg#define OPT_INITIAL_ERASE 1 /* use pty's erase character if it's not 128 */ 566d522f475Smrg#endif 567d522f475Smrg 568d522f475Smrg#ifndef OPT_INPUT_METHOD 569d522f475Smrg#if (XtSpecificationRelease >= 6) 570d522f475Smrg#define OPT_INPUT_METHOD 1 /* true if xterm uses input-method support */ 571d522f475Smrg#else 572d522f475Smrg#define OPT_INPUT_METHOD 0 573d522f475Smrg#endif 574d522f475Smrg#endif 575d522f475Smrg 576d522f475Smrg#ifndef OPT_ISO_COLORS 577d522f475Smrg#define OPT_ISO_COLORS 1 /* true if xterm is configured with ISO colors */ 578d522f475Smrg#endif 579d522f475Smrg 580d522f475Smrg#ifndef OPT_256_COLORS 581d522f475Smrg#define OPT_256_COLORS 0 /* true if xterm is configured with 256 colors */ 582d522f475Smrg#endif 583d522f475Smrg 584d522f475Smrg#ifndef OPT_88_COLORS 585d522f475Smrg#define OPT_88_COLORS 0 /* true if xterm is configured with 88 colors */ 586d522f475Smrg#endif 587d522f475Smrg 588d522f475Smrg#ifndef OPT_HIGHLIGHT_COLOR 589d522f475Smrg#define OPT_HIGHLIGHT_COLOR 1 /* true if xterm supports color highlighting */ 590d522f475Smrg#endif 591d522f475Smrg 592d522f475Smrg#ifndef OPT_LOAD_VTFONTS 593d522f475Smrg#define OPT_LOAD_VTFONTS 0 /* true if xterm has load-vt-fonts() action */ 594d522f475Smrg#endif 595d522f475Smrg 596d522f475Smrg#ifndef OPT_LUIT_PROG 597d522f475Smrg#define OPT_LUIT_PROG 0 /* true if xterm supports luit */ 598d522f475Smrg#endif 599d522f475Smrg 600d522f475Smrg#ifndef OPT_MAXIMIZE 601d522f475Smrg#define OPT_MAXIMIZE 1 /* add actions for iconify ... maximize */ 602d522f475Smrg#endif 603d522f475Smrg 604d522f475Smrg#ifndef OPT_MINI_LUIT 605d522f475Smrg#define OPT_MINI_LUIT 0 /* true if xterm supports built-in mini-luit */ 606d522f475Smrg#endif 607d522f475Smrg 608d522f475Smrg#ifndef OPT_MOD_FKEYS 609d522f475Smrg#define OPT_MOD_FKEYS 1 /* modify cursor- and function-keys in normal mode */ 610d522f475Smrg#endif 611d522f475Smrg 612d522f475Smrg#ifndef OPT_NUM_LOCK 613d522f475Smrg#define OPT_NUM_LOCK 1 /* use NumLock key only for numeric-keypad */ 614d522f475Smrg#endif 615d522f475Smrg 616d522f475Smrg#ifndef OPT_PASTE64 617d522f475Smrg#define OPT_PASTE64 0 /* program control of select/paste via base64 */ 618d522f475Smrg#endif 619d522f475Smrg 620d522f475Smrg#ifndef OPT_PC_COLORS 621d522f475Smrg#define OPT_PC_COLORS 1 /* true if xterm supports PC-style (bold) colors */ 622d522f475Smrg#endif 623d522f475Smrg 624712a7ff4Smrg#ifndef OPT_PRINT_ON_EXIT 625712a7ff4Smrg#define OPT_PRINT_ON_EXIT 1 /* true allows xterm to dump screen on X error */ 626712a7ff4Smrg#endif 627712a7ff4Smrg 628d522f475Smrg#ifndef OPT_PTY_HANDSHAKE 629d522f475Smrg#define OPT_PTY_HANDSHAKE USE_HANDSHAKE /* avoid pty races on older systems */ 630d522f475Smrg#endif 631d522f475Smrg 632d522f475Smrg#ifndef OPT_PRINT_COLORS 633d522f475Smrg#define OPT_PRINT_COLORS 1 /* true if we print color information */ 634d522f475Smrg#endif 635d522f475Smrg 636d522f475Smrg#ifndef OPT_READLINE 637d522f475Smrg#define OPT_READLINE 0 /* mouse-click/paste support for readline */ 638d522f475Smrg#endif 639d522f475Smrg 640d522f475Smrg#ifndef OPT_RENDERFONT 641d522f475Smrg#ifdef XRENDERFONT 642d522f475Smrg#define OPT_RENDERFONT 1 643d522f475Smrg#else 644d522f475Smrg#define OPT_RENDERFONT 0 645d522f475Smrg#endif 646d522f475Smrg#endif 647d522f475Smrg 648d522f475Smrg#ifndef OPT_RENDERWIDE 649d522f475Smrg#if OPT_RENDERFONT && OPT_WIDE_CHARS && defined(HAVE_TYPE_XFTCHARSPEC) 650d522f475Smrg#define OPT_RENDERWIDE 1 651d522f475Smrg#else 652d522f475Smrg#define OPT_RENDERWIDE 0 653d522f475Smrg#endif 654d522f475Smrg#endif 655d522f475Smrg 656d522f475Smrg#ifndef OPT_SAME_NAME 657d522f475Smrg#define OPT_SAME_NAME 1 /* suppress redundant updates of title, icon, etc. */ 658d522f475Smrg#endif 659d522f475Smrg 660b7c89284Ssnj#ifndef OPT_SAVE_LINES 661b7c89284Ssnj#define OPT_SAVE_LINES OPT_FIFO_LINES /* optimize save-lines feature */ 662b7c89284Ssnj#endif 663b7c89284Ssnj 664d522f475Smrg#ifndef OPT_SCO_FUNC_KEYS 665d522f475Smrg#define OPT_SCO_FUNC_KEYS 0 /* true if xterm supports SCO-style function keys */ 666d522f475Smrg#endif 667d522f475Smrg 668d522f475Smrg#ifndef OPT_SUN_FUNC_KEYS 669d522f475Smrg#define OPT_SUN_FUNC_KEYS 1 /* true if xterm supports Sun-style function keys */ 670d522f475Smrg#endif 671d522f475Smrg 672cd3331d0Smrg#ifndef OPT_SCROLL_LOCK 673cd3331d0Smrg#define OPT_SCROLL_LOCK 1 /* true if xterm interprets fontsize-shifting */ 674cd3331d0Smrg#endif 675cd3331d0Smrg 676d522f475Smrg#ifndef OPT_SELECT_REGEX 677d522f475Smrg#define OPT_SELECT_REGEX 0 /* true if xterm supports regular-expression selects */ 678d522f475Smrg#endif 679d522f475Smrg 6803367019cSmrg#ifndef OPT_SELECTION_OPS 6813367019cSmrg#define OPT_SELECTION_OPS 1 /* true if xterm supports operations on selection */ 6823367019cSmrg#endif 6833367019cSmrg 684d522f475Smrg#ifndef OPT_SESSION_MGT 685d522f475Smrg#if defined(XtNdieCallback) && defined(XtNsaveCallback) 686d522f475Smrg#define OPT_SESSION_MGT 1 687d522f475Smrg#else 688d522f475Smrg#define OPT_SESSION_MGT 0 689d522f475Smrg#endif 690d522f475Smrg#endif 691d522f475Smrg 692d522f475Smrg#ifndef OPT_SHIFT_FONTS 693781b53c7Schristos#define OPT_SHIFT_FONTS 0 /* true if xterm interprets fontsize-shifting */ 694d522f475Smrg#endif 695d522f475Smrg 696d522f475Smrg#ifndef OPT_SUNPC_KBD 697d522f475Smrg#define OPT_SUNPC_KBD 1 /* true if xterm supports Sun/PC keyboard map */ 698d522f475Smrg#endif 699d522f475Smrg 700d522f475Smrg#ifndef OPT_TCAP_FKEYS 701d522f475Smrg#define OPT_TCAP_FKEYS 0 /* true for experimental termcap function-keys */ 702d522f475Smrg#endif 703d522f475Smrg 704d522f475Smrg#ifndef OPT_TCAP_QUERY 705d522f475Smrg#define OPT_TCAP_QUERY 0 /* true for experimental termcap query */ 706d522f475Smrg#endif 707d522f475Smrg 708d522f475Smrg#ifndef OPT_TEK4014 709d522f475Smrg#define OPT_TEK4014 1 /* true if we're using tek4014 emulation */ 710d522f475Smrg#endif 711d522f475Smrg 712d522f475Smrg#ifndef OPT_TOOLBAR 713d522f475Smrg#define OPT_TOOLBAR 0 /* true if xterm supports toolbar menus */ 714d522f475Smrg#endif 715d522f475Smrg 716d522f475Smrg#ifndef OPT_TRACE 717d522f475Smrg#define OPT_TRACE 0 /* true if we're using debugging traces */ 718d522f475Smrg#endif 719d522f475Smrg 720d522f475Smrg#ifndef OPT_TRACE_FLAGS 721d522f475Smrg#define OPT_TRACE_FLAGS 0 /* additional tracing used for SCRN_BUF_FLAGS */ 722d522f475Smrg#endif 723d522f475Smrg 724d522f475Smrg#ifndef OPT_VT52_MODE 725d522f475Smrg#define OPT_VT52_MODE 1 /* true if xterm supports VT52 emulation */ 726d522f475Smrg#endif 727d522f475Smrg 728d522f475Smrg#ifndef OPT_WIDE_CHARS 729d522f475Smrg#define OPT_WIDE_CHARS 0 /* true if xterm supports 16-bit characters */ 730d522f475Smrg#endif 731d522f475Smrg 732b7c89284Ssnj#ifndef OPT_WIDER_ICHAR 733b7c89284Ssnj#define OPT_WIDER_ICHAR 1 /* true if xterm uses 32-bits for wide-chars */ 734b7c89284Ssnj#endif 735b7c89284Ssnj 736d522f475Smrg#ifndef OPT_XMC_GLITCH 737d522f475Smrg#define OPT_XMC_GLITCH 0 /* true if xterm supports xmc (magic cookie glitch) */ 738d522f475Smrg#endif 739d522f475Smrg 740d522f475Smrg#ifndef OPT_ZICONBEEP 741d522f475Smrg#define OPT_ZICONBEEP 1 /* true if xterm supports "-ziconbeep" option */ 742d522f475Smrg#endif 743d522f475Smrg 744d522f475Smrg/***====================================================================***/ 745d522f475Smrg 746d522f475Smrg#if OPT_AIX_COLORS && !OPT_ISO_COLORS 747d522f475Smrg/* You must have ANSI/ISO colors to support AIX colors */ 748d522f475Smrg#undef OPT_AIX_COLORS 749d522f475Smrg#define OPT_AIX_COLORS 0 750d522f475Smrg#endif 751d522f475Smrg 752d522f475Smrg#if OPT_COLOR_RES && !OPT_ISO_COLORS 753d522f475Smrg/* You must have ANSI/ISO colors to support ColorRes logic */ 754d522f475Smrg#undef OPT_COLOR_RES 755d522f475Smrg#define OPT_COLOR_RES 0 756d522f475Smrg#endif 757d522f475Smrg 758cd3331d0Smrg#if OPT_256_COLORS && (OPT_WIDE_CHARS || OPT_RENDERFONT || OPT_XMC_GLITCH) 759cd3331d0Smrg/* It's actually more complicated than that - but by trimming options you can 760cd3331d0Smrg * have 256 color resources though. 761cd3331d0Smrg */ 762cd3331d0Smrg#define OPT_COLOR_RES2 1 763cd3331d0Smrg#else 764d522f475Smrg#define OPT_COLOR_RES2 0 765d522f475Smrg#endif 766d522f475Smrg 767d522f475Smrg#if OPT_PASTE64 && !OPT_READLINE 768d522f475Smrg/* OPT_PASTE64 uses logic from OPT_READLINE */ 769d522f475Smrg#undef OPT_READLINE 770d522f475Smrg#define OPT_READLINE 1 771d522f475Smrg#endif 772d522f475Smrg 773d522f475Smrg#if OPT_PC_COLORS && !OPT_ISO_COLORS 774d522f475Smrg/* You must have ANSI/ISO colors to support PC colors */ 775d522f475Smrg#undef OPT_PC_COLORS 776d522f475Smrg#define OPT_PC_COLORS 0 777d522f475Smrg#endif 778d522f475Smrg 779d522f475Smrg#if OPT_PRINT_COLORS && !OPT_ISO_COLORS 780d522f475Smrg/* You must have ANSI/ISO colors to be able to print them */ 781d522f475Smrg#undef OPT_PRINT_COLORS 782d522f475Smrg#define OPT_PRINT_COLORS 0 783d522f475Smrg#endif 784d522f475Smrg 785d522f475Smrg#if OPT_256_COLORS && !OPT_ISO_COLORS 786d522f475Smrg/* You must have ANSI/ISO colors to support 256 colors */ 787d522f475Smrg#undef OPT_256_COLORS 788d522f475Smrg#define OPT_256_COLORS 0 789d522f475Smrg#endif 790d522f475Smrg 791d522f475Smrg#if OPT_88_COLORS && !OPT_ISO_COLORS 792d522f475Smrg/* You must have ANSI/ISO colors to support 88 colors */ 793d522f475Smrg#undef OPT_88_COLORS 794d522f475Smrg#define OPT_88_COLORS 0 795d522f475Smrg#endif 796d522f475Smrg 797d522f475Smrg#if OPT_88_COLORS && OPT_256_COLORS 798d522f475Smrg/* 256 colors supersedes 88 colors */ 799d522f475Smrg#undef OPT_88_COLORS 800d522f475Smrg#define OPT_88_COLORS 0 801d522f475Smrg#endif 802d522f475Smrg 803d522f475Smrg/***====================================================================***/ 804d522f475Smrg 805d522f475Smrg/* 806d522f475Smrg * Indices for menu_font_names[][] 807d522f475Smrg */ 808d522f475Smrgtypedef enum { 809d522f475Smrg fNorm = 0 /* normal font */ 810d522f475Smrg , fBold /* bold font */ 811d522f475Smrg#if OPT_WIDE_CHARS 812d522f475Smrg , fWide /* double-width font */ 813d522f475Smrg , fWBold /* double-width bold font */ 814d522f475Smrg#endif 815d522f475Smrg , fMAX 816d522f475Smrg} VTFontEnum; 817d522f475Smrg 818d522f475Smrg/* 819d522f475Smrg * Indices for cachedGCs.c (unrelated to VTFontEnum). 820d522f475Smrg */ 821d522f475Smrgtypedef enum { 822d522f475Smrg gcNorm = 0 823d522f475Smrg , gcBold 824d522f475Smrg , gcNormReverse 825d522f475Smrg , gcBoldReverse 826d522f475Smrg#if OPT_BOX_CHARS 827d522f475Smrg , gcLine 828d522f475Smrg , gcDots 829d522f475Smrg#endif 830d522f475Smrg#if OPT_DEC_CHRSET 831d522f475Smrg , gcCNorm 832d522f475Smrg , gcCBold 833d522f475Smrg#endif 834d522f475Smrg#if OPT_WIDE_CHARS 835d522f475Smrg , gcWide 836d522f475Smrg , gcWBold 837d522f475Smrg , gcWideReverse 838d522f475Smrg , gcWBoldReverse 839d522f475Smrg#endif 840d522f475Smrg , gcVTcursNormal 841d522f475Smrg , gcVTcursFilled 842d522f475Smrg , gcVTcursReverse 843d522f475Smrg , gcVTcursOutline 844d522f475Smrg#if OPT_TEK4014 845d522f475Smrg , gcTKcurs 846d522f475Smrg#endif 847d522f475Smrg , gcMAX 848d522f475Smrg} CgsEnum; 849d522f475Smrg 850d522f475Smrg#define for_each_text_gc(n) for (n = gcNorm; n < gcVTcursNormal; ++n) 851d522f475Smrg#define for_each_curs_gc(n) for (n = gcVTcursNormal; n <= gcVTcursOutline; ++n) 852d522f475Smrg#define for_each_gc(n) for (n = gcNorm; n < gcMAX; ++n) 853d522f475Smrg 854cd3331d0Smrg/* 855cd3331d0Smrg * Indices for the normal terminal colors in screen.Tcolors[]. 856cd3331d0Smrg * See also OscTextColors, which has corresponding values. 857cd3331d0Smrg */ 858d522f475Smrgtypedef enum { 859d522f475Smrg TEXT_FG = 0 /* text foreground */ 860d522f475Smrg , TEXT_BG /* text background */ 861d522f475Smrg , TEXT_CURSOR /* text cursor */ 862d522f475Smrg , MOUSE_FG /* mouse foreground */ 863d522f475Smrg , MOUSE_BG /* mouse background */ 864d522f475Smrg#if OPT_TEK4014 8653367019cSmrg , TEK_FG = 5 /* tektronix foreground */ 866d522f475Smrg , TEK_BG /* tektronix background */ 867d522f475Smrg#endif 868d522f475Smrg#if OPT_HIGHLIGHT_COLOR 8693367019cSmrg , HIGHLIGHT_BG = 7 /* highlight background */ 8703367019cSmrg#endif 8713367019cSmrg#if OPT_TEK4014 8723367019cSmrg , TEK_CURSOR = 8 /* tektronix cursor */ 8733367019cSmrg#endif 8743367019cSmrg#if OPT_HIGHLIGHT_COLOR 8753367019cSmrg , HIGHLIGHT_FG = 9 /* highlight foreground */ 876d522f475Smrg#endif 877d522f475Smrg , NCOLORS /* total number of colors */ 878d522f475Smrg} TermColors; 879d522f475Smrg 880cd3331d0Smrg/* 881cd3331d0Smrg * Constants for titleModes resource 882cd3331d0Smrg */ 883cd3331d0Smrgtypedef enum { 884cd3331d0Smrg tmSetBase16 = 1 /* set title using hex-string */ 885cd3331d0Smrg , tmGetBase16 = 2 /* get title using hex-string */ 886cd3331d0Smrg#if OPT_WIDE_CHARS 887cd3331d0Smrg , tmSetUtf8 = 4 /* like utf8Title, but controllable */ 888cd3331d0Smrg , tmGetUtf8 = 8 /* retrieve title encoded as UTF-8 */ 889cd3331d0Smrg#endif 890cd3331d0Smrg} TitleModes; 891cd3331d0Smrg 892cd3331d0Smrg#define IsTitleMode(xw,mode) (((xw)->screen.title_modes & mode) != 0) 893cd3331d0Smrg 894d522f475Smrg/* indices for mapping multiple clicks to selection types */ 895d522f475Smrgtypedef enum { 896d522f475Smrg Select_CHAR=0 897d522f475Smrg ,Select_WORD 898d522f475Smrg ,Select_LINE 899d522f475Smrg ,Select_GROUP 900d522f475Smrg ,Select_PAGE 901d522f475Smrg ,Select_ALL 902d522f475Smrg#if OPT_SELECT_REGEX 903d522f475Smrg ,Select_REGEX 904d522f475Smrg#endif 905d522f475Smrg ,NSELECTUNITS 906d522f475Smrg} SelectUnit; 907d522f475Smrg 908cd3331d0Smrgtypedef enum { 909cd3331d0Smrg ecSetColor = 1 910cd3331d0Smrg , ecGetColor 911cd3331d0Smrg , ecGetAnsiColor 912cd3331d0Smrg , ecLAST 913cd3331d0Smrg} ColorOps; 914cd3331d0Smrg 915cd3331d0Smrgtypedef enum { 916cd3331d0Smrg efSetFont = 1 917cd3331d0Smrg , efGetFont 918cd3331d0Smrg , efLAST 919cd3331d0Smrg} FontOps; 920cd3331d0Smrg 921c219fbebSmrgtypedef enum { 922c219fbebSmrg esFalse = 0 923c219fbebSmrg , esTrue 924c219fbebSmrg , esAlways 925c219fbebSmrg , esNever 926c219fbebSmrg} FullscreenOps; 927c219fbebSmrg 9283367019cSmrg#ifndef NO_ACTIVE_ICON 9293367019cSmrgtypedef enum { 9303367019cSmrg eiFalse = 0 9313367019cSmrg , eiTrue 9323367019cSmrg , eiDefault 9333367019cSmrg , eiLAST 9343367019cSmrg} AIconOps; 9353367019cSmrg#endif 9363367019cSmrg 937cd3331d0Smrgtypedef enum { 938cd3331d0Smrg etSetTcap = 1 939cd3331d0Smrg , etGetTcap 940cd3331d0Smrg , etLAST 941cd3331d0Smrg} TcapOps; 942cd3331d0Smrg 943cd3331d0Smrgtypedef enum { 9443367019cSmrg /* 1-23 are chosen to be the same as the control-sequence coding */ 945cd3331d0Smrg ewRestoreWin = 1 946cd3331d0Smrg , ewMinimizeWin = 2 947cd3331d0Smrg , ewSetWinPosition = 3 948cd3331d0Smrg , ewSetWinSizePixels = 4 949cd3331d0Smrg , ewRaiseWin = 5 950cd3331d0Smrg , ewLowerWin = 6 951cd3331d0Smrg , ewRefreshWin = 7 952cd3331d0Smrg , ewSetWinSizeChars = 8 953cd3331d0Smrg#if OPT_MAXIMIZE 954cd3331d0Smrg , ewMaximizeWin = 9 955c219fbebSmrg , ewFullscreenWin = 10 956cd3331d0Smrg#endif 957cd3331d0Smrg , ewGetWinState = 11 958cd3331d0Smrg , ewGetWinPosition = 13 959cd3331d0Smrg , ewGetWinSizePixels = 14 960cd3331d0Smrg , ewGetWinSizeChars = 18 961cd3331d0Smrg#if OPT_MAXIMIZE 962cd3331d0Smrg , ewGetScreenSizeChars = 19 963cd3331d0Smrg#endif 964cd3331d0Smrg , ewGetIconTitle = 20 965cd3331d0Smrg , ewGetWinTitle = 21 966cd3331d0Smrg , ewPushTitle = 22 967cd3331d0Smrg , ewPopTitle = 23 968cd3331d0Smrg /* these do not fit into that scheme, which is why we use an array */ 969cd3331d0Smrg , ewSetWinLines 970cd3331d0Smrg , ewSetXprop 971cd3331d0Smrg , ewGetSelection 972cd3331d0Smrg , ewSetSelection 973cd3331d0Smrg /* get the size of the array... */ 974cd3331d0Smrg , ewLAST 975cd3331d0Smrg} WindowOps; 976cd3331d0Smrg 977cd3331d0Smrg#define COLOR_DEFINED(s,w) ((s)->which & (unsigned) (1<<(w))) 978d522f475Smrg#define COLOR_VALUE(s,w) ((s)->colors[w]) 979cd3331d0Smrg#define SET_COLOR_VALUE(s,w,v) (((s)->colors[w] = (v)), UIntSet((s)->which, (1<<(w)))) 980d522f475Smrg 981d522f475Smrg#define COLOR_NAME(s,w) ((s)->names[w]) 982cd3331d0Smrg#define SET_COLOR_NAME(s,w,v) (((s)->names[w] = (v)), ((s)->which |= (unsigned) (1<<(w)))) 983d522f475Smrg 984d522f475Smrg#define UNDEFINE_COLOR(s,w) ((s)->which &= (~((w)<<1))) 985d522f475Smrg 986d522f475Smrg/***====================================================================***/ 987d522f475Smrg 988d522f475Smrg#if OPT_ISO_COLORS 989d522f475Smrg#define TERM_COLOR_FLAGS(xw) ((xw)->flags & (FG_COLOR|BG_COLOR)) 990d522f475Smrg#define COLOR_0 0 991d522f475Smrg#define COLOR_1 1 992d522f475Smrg#define COLOR_2 2 993d522f475Smrg#define COLOR_3 3 994d522f475Smrg#define COLOR_4 4 995d522f475Smrg#define COLOR_5 5 996d522f475Smrg#define COLOR_6 6 997d522f475Smrg#define COLOR_7 7 998d522f475Smrg#define COLOR_8 8 999d522f475Smrg#define COLOR_9 9 1000d522f475Smrg#define COLOR_10 10 1001d522f475Smrg#define COLOR_11 11 1002d522f475Smrg#define COLOR_12 12 1003d522f475Smrg#define COLOR_13 13 1004d522f475Smrg#define COLOR_14 14 1005d522f475Smrg#define COLOR_15 15 1006d522f475Smrg#define MIN_ANSI_COLORS 16 1007d522f475Smrg 1008d522f475Smrg#if OPT_256_COLORS 1009d522f475Smrg# define NUM_ANSI_COLORS 256 1010d522f475Smrg#elif OPT_88_COLORS 1011d522f475Smrg# define NUM_ANSI_COLORS 88 1012d522f475Smrg#else 1013d522f475Smrg# define NUM_ANSI_COLORS MIN_ANSI_COLORS 1014d522f475Smrg#endif 1015d522f475Smrg 1016d522f475Smrg#if NUM_ANSI_COLORS > MIN_ANSI_COLORS 1017d522f475Smrg# define OPT_EXT_COLORS 1 1018d522f475Smrg#else 1019d522f475Smrg# define OPT_EXT_COLORS 0 1020d522f475Smrg#endif 1021d522f475Smrg 1022d522f475Smrg#define COLOR_BD (NUM_ANSI_COLORS) /* BOLD */ 1023d522f475Smrg#define COLOR_UL (NUM_ANSI_COLORS+1) /* UNDERLINE */ 1024d522f475Smrg#define COLOR_BL (NUM_ANSI_COLORS+2) /* BLINK */ 1025d522f475Smrg#define COLOR_RV (NUM_ANSI_COLORS+3) /* REVERSE */ 1026d522f475Smrg#define MAXCOLORS (NUM_ANSI_COLORS+4) 1027d522f475Smrg#ifndef DFT_COLORMODE 1028d522f475Smrg#define DFT_COLORMODE True /* default colorMode resource */ 1029d522f475Smrg#endif 1030d522f475Smrg 1031d522f475Smrg#define ReverseOrHilite(screen,flags,hilite) \ 1032d522f475Smrg (( screen->colorRVMode && hilite ) || \ 1033d522f475Smrg ( !screen->colorRVMode && \ 1034d522f475Smrg (( (flags & INVERSE) && !hilite) || \ 1035d522f475Smrg (!(flags & INVERSE) && hilite)) )) 1036d522f475Smrg 1037d522f475Smrg/* Define a fake XK code, we need it for the fake color response in 1038d522f475Smrg * xtermcapKeycode(). */ 1039d522f475Smrg#if OPT_TCAP_QUERY && OPT_ISO_COLORS 1040d522f475Smrg# define XK_COLORS 0x0003 1041d522f475Smrg#endif 1042d522f475Smrg 1043d522f475Smrg#else /* !OPT_ISO_COLORS */ 1044d522f475Smrg 1045d522f475Smrg#define TERM_COLOR_FLAGS(xw) 0 1046d522f475Smrg 1047d522f475Smrg#define ReverseOrHilite(screen,flags,hilite) \ 1048d522f475Smrg (( (flags & INVERSE) && !hilite) || \ 1049d522f475Smrg (!(flags & INVERSE) && hilite)) 1050d522f475Smrg 1051d522f475Smrg#endif /* OPT_ISO_COLORS */ 1052d522f475Smrg 1053cd3331d0Smrg# define XK_TCAPNAME 0x0004 1054cd3331d0Smrg 1055d522f475Smrg#if OPT_AIX_COLORS 1056d522f475Smrg#define if_OPT_AIX_COLORS(screen, code) if(screen->colorMode) code 1057d522f475Smrg#else 1058d522f475Smrg#define if_OPT_AIX_COLORS(screen, code) /* nothing */ 1059d522f475Smrg#endif 1060d522f475Smrg 1061b7c89284Ssnj#if OPT_256_COLORS || OPT_88_COLORS || OPT_ISO_COLORS 1062b7c89284Ssnj# define if_OPT_ISO_COLORS(screen, code) if (screen->colorMode) code 1063d522f475Smrg#else 1064b7c89284Ssnj# define if_OPT_ISO_COLORS(screen, code) /* nothing */ 1065d522f475Smrg#endif 1066d522f475Smrg 1067d522f475Smrg#define COLOR_RES_NAME(root) "color" root 1068d522f475Smrg 1069d522f475Smrg#if OPT_COLOR_CLASS 1070d522f475Smrg#define COLOR_RES_CLASS(root) "Color" root 1071d522f475Smrg#else 1072d522f475Smrg#define COLOR_RES_CLASS(root) XtCForeground 1073d522f475Smrg#endif 1074d522f475Smrg 1075d522f475Smrg#if OPT_COLOR_RES 1076d522f475Smrg#define COLOR_RES(root,offset,value) Sres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset.resource, value) 1077d522f475Smrg#define COLOR_RES2(name,class,offset,value) Sres(name, class, offset.resource, value) 1078d522f475Smrg#else 1079d522f475Smrg#define COLOR_RES(root,offset,value) Cres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset, value) 1080d522f475Smrg#define COLOR_RES2(name,class,offset,value) Cres(name, class, offset, value) 1081d522f475Smrg#endif 1082d522f475Smrg 1083d522f475Smrg#define CLICK_RES_NAME(count) "on" count "Clicks" 1084d522f475Smrg#define CLICK_RES_CLASS(count) "On" count "Clicks" 1085d522f475Smrg#define CLICK_RES(count,offset,value) Sres(CLICK_RES_NAME(count), CLICK_RES_CLASS(count), offset, value) 1086d522f475Smrg 1087d522f475Smrg/***====================================================================***/ 1088d522f475Smrg 1089d522f475Smrg#if OPT_DEC_CHRSET 1090d522f475Smrg#define if_OPT_DEC_CHRSET(code) code 1091d522f475Smrg /* Use 2 bits for encoding the double high/wide sense of characters */ 1092d522f475Smrg#define CSET_SWL 0 1093d522f475Smrg#define CSET_DHL_TOP 1 1094d522f475Smrg#define CSET_DHL_BOT 2 1095d522f475Smrg#define CSET_DWL 3 1096d522f475Smrg#define NUM_CHRSET 8 /* normal/bold and 4 CSET_xxx values */ 1097b7c89284Ssnj 1098d522f475Smrg /* Use remaining bits for encoding the other character-sets */ 1099d522f475Smrg#define CSET_NORMAL(code) ((code) == CSET_SWL) 1100d522f475Smrg#define CSET_DOUBLE(code) (!CSET_NORMAL(code) && !CSET_EXTEND(code)) 1101cd3331d0Smrg#define CSET_EXTEND(code) ((int)(code) > CSET_DWL) 1102b7c89284Ssnj 1103b7c89284Ssnj#define DBLCS_BITS 4 1104b7c89284Ssnj#define DBLCS_MASK BITS2MASK(DBLCS_BITS) 1105b7c89284Ssnj 1106b7c89284Ssnj#define GetLineDblCS(ld) (((ld)->bufHead >> LINEFLAG_BITS) & DBLCS_MASK) 1107b7c89284Ssnj#define SetLineDblCS(ld,cs) (ld)->bufHead = (RowData) ((ld->bufHead & LINEFLAG_MASK) | (cs << LINEFLAG_BITS)) 1108b7c89284Ssnj 1109b7c89284Ssnj#define LineCharSet(screen, ld) \ 1110b7c89284Ssnj ((CSET_DOUBLE(GetLineDblCS(ld))) \ 1111b7c89284Ssnj ? GetLineDblCS(ld) \ 1112b7c89284Ssnj : (screen)->cur_chrset) 1113b7c89284Ssnj#define LineMaxCol(screen, ld) \ 1114b7c89284Ssnj (CSET_DOUBLE(GetLineDblCS(ld)) \ 1115b7c89284Ssnj ? (screen->max_col / 2) \ 1116b7c89284Ssnj : (screen->max_col)) 1117b7c89284Ssnj#define LineCursorX(screen, ld, col) \ 1118b7c89284Ssnj (CSET_DOUBLE(GetLineDblCS(ld)) \ 1119b7c89284Ssnj ? CursorX(screen, 2*(col)) \ 1120b7c89284Ssnj : CursorX(screen, (col))) 1121b7c89284Ssnj#define LineFontWidth(screen, ld) \ 1122b7c89284Ssnj (CSET_DOUBLE(GetLineDblCS(ld)) \ 1123b7c89284Ssnj ? 2*FontWidth(screen) \ 1124b7c89284Ssnj : FontWidth(screen)) 1125d522f475Smrg#else 1126b7c89284Ssnj 1127d522f475Smrg#define if_OPT_DEC_CHRSET(code) /*nothing*/ 1128b7c89284Ssnj 1129b7c89284Ssnj#define GetLineDblCS(ld) 0 1130b7c89284Ssnj 1131b7c89284Ssnj#define LineCharSet(screen, ld) 0 1132b7c89284Ssnj#define LineMaxCol(screen, ld) screen->max_col 1133b7c89284Ssnj#define LineCursorX(screen, ld, col) CursorX(screen, col) 1134b7c89284Ssnj#define LineFontWidth(screen, ld) FontWidth(screen) 1135b7c89284Ssnj 1136d522f475Smrg#endif 1137d522f475Smrg 1138d522f475Smrg#if OPT_LUIT_PROG && !OPT_WIDE_CHARS 1139d522f475Smrg#error Luit requires the wide-chars configuration 1140d522f475Smrg#endif 1141d522f475Smrg 1142d522f475Smrg/***====================================================================***/ 1143d522f475Smrg 1144d522f475Smrg#if OPT_EBCDIC 1145d522f475Smrgextern int E2A(int); 1146d522f475Smrgextern int A2E(int); 1147d522f475Smrg#else 1148d522f475Smrg#define E2A(a) (a) 1149d522f475Smrg#define A2E(a) (a) 1150d522f475Smrg#endif 1151d522f475Smrg 1152d522f475Smrg#define CONTROL(a) (A2E(E2A(a)&037)) 1153d522f475Smrg 1154d522f475Smrg/***====================================================================***/ 1155d522f475Smrg 1156d522f475Smrg#if OPT_TEK4014 1157d522f475Smrg#define TEK4014_ACTIVE(xw) ((xw)->misc.TekEmu) 1158d522f475Smrg#define TEK4014_SHOWN(xw) ((xw)->misc.Tshow) 1159d522f475Smrg#define CURRENT_EMU_VAL(tek,vt) (TEK4014_ACTIVE(term) ? tek : vt) 1160d522f475Smrg#define CURRENT_EMU() CURRENT_EMU_VAL((Widget)tekWidget, (Widget)term) 1161d522f475Smrg#else 1162d522f475Smrg#define TEK4014_ACTIVE(screen) 0 1163d522f475Smrg#define TEK4014_SHOWN(xw) 0 1164d522f475Smrg#define CURRENT_EMU_VAL(tek,vt) (vt) 1165d522f475Smrg#define CURRENT_EMU() ((Widget)term) 1166d522f475Smrg#endif 1167d522f475Smrg 1168d522f475Smrg/***====================================================================***/ 1169d522f475Smrg 1170d522f475Smrg#if OPT_TOOLBAR 1171d522f475Smrg#define SHELL_OF(widget) XtParent(XtParent(widget)) 1172d522f475Smrg#else 1173d522f475Smrg#define SHELL_OF(widget) XtParent(widget) 1174d522f475Smrg#endif 1175d522f475Smrg 1176d522f475Smrg/***====================================================================***/ 1177d522f475Smrg 1178d522f475Smrg#if OPT_VT52_MODE 1179d522f475Smrg#define if_OPT_VT52_MODE(screen, code) if(screen->vtXX_level == 0) code 1180d522f475Smrg#else 1181d522f475Smrg#define if_OPT_VT52_MODE(screen, code) /* nothing */ 1182d522f475Smrg#endif 1183d522f475Smrg 1184d522f475Smrg/***====================================================================***/ 1185d522f475Smrg 1186d522f475Smrg#if OPT_XMC_GLITCH 1187d522f475Smrg#define if_OPT_XMC_GLITCH(screen, code) if(screen->xmc_glitch) code 1188d522f475Smrg#define XMC_GLITCH 1 /* the character we'll show */ 1189d522f475Smrg#define XMC_FLAGS (INVERSE|UNDERLINE|BOLD|BLINK) 1190d522f475Smrg#else 1191d522f475Smrg#define if_OPT_XMC_GLITCH(screen, code) /* nothing */ 1192d522f475Smrg#endif 1193d522f475Smrg 1194d522f475Smrg/***====================================================================***/ 1195d522f475Smrg 11960d92cbfdSchristos#define LO_BYTE(ch) CharOf((ch) & 0xff) 11970d92cbfdSchristos#define HI_BYTE(ch) CharOf((ch) >> 8) 11980d92cbfdSchristos 1199d522f475Smrg#if OPT_WIDE_CHARS 1200d522f475Smrg#define if_OPT_WIDE_CHARS(screen, code) if(screen->wide_chars) code 1201d522f475Smrg#define if_WIDE_OR_NARROW(screen, wide, narrow) if(screen->wide_chars) wide else narrow 1202b7c89284Ssnj#if OPT_WIDER_ICHAR 1203b7c89284Ssnjtypedef unsigned IChar; /* for 8-21 bit characters */ 1204b7c89284Ssnj#else 1205b7c89284Ssnjtypedef unsigned short IChar; /* for 8-16 bit characters */ 1206b7c89284Ssnj#endif 1207d522f475Smrg#else 1208d522f475Smrg#define if_OPT_WIDE_CHARS(screen, code) /* nothing */ 1209d522f475Smrg#define if_WIDE_OR_NARROW(screen, wide, narrow) narrow 1210d522f475Smrgtypedef unsigned char IChar; /* for 8-bit characters */ 1211d522f475Smrg#endif 1212d522f475Smrg 1213d522f475Smrg/***====================================================================***/ 1214d522f475Smrg 1215d522f475Smrg#ifndef RES_OFFSET 1216d522f475Smrg#define RES_OFFSET(offset) XtOffsetOf(XtermWidgetRec, offset) 1217d522f475Smrg#endif 1218d522f475Smrg 1219d522f475Smrg#define RES_NAME(name) name 1220d522f475Smrg#define RES_CLASS(name) name 1221d522f475Smrg 1222d522f475Smrg#define Bres(name, class, offset, dftvalue) \ 1223d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRBoolean, sizeof(Boolean), \ 1224d522f475Smrg RES_OFFSET(offset), XtRImmediate, (XtPointer) dftvalue} 1225d522f475Smrg 1226d522f475Smrg#define Cres(name, class, offset, dftvalue) \ 1227d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRPixel, sizeof(Pixel), \ 1228d522f475Smrg RES_OFFSET(offset), XtRString, (XtPointer) dftvalue} 1229d522f475Smrg 1230d522f475Smrg#define Tres(name, class, offset, dftvalue) \ 1231d522f475Smrg COLOR_RES2(name, class, screen.Tcolors[offset], dftvalue) \ 1232d522f475Smrg 1233d522f475Smrg#define Fres(name, class, offset, dftvalue) \ 1234d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRFontStruct, sizeof(XFontStruct *), \ 1235d522f475Smrg RES_OFFSET(offset), XtRString, (XtPointer) dftvalue} 1236d522f475Smrg 1237d522f475Smrg#define Ires(name, class, offset, dftvalue) \ 1238d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRInt, sizeof(int), \ 1239d522f475Smrg RES_OFFSET(offset), XtRImmediate, (XtPointer) dftvalue} 1240d522f475Smrg 1241d522f475Smrg#define Dres(name, class, offset, dftvalue) \ 1242d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRFloat, sizeof(float), \ 1243d522f475Smrg RES_OFFSET(offset), XtRString, (XtPointer) dftvalue} 1244d522f475Smrg 1245d522f475Smrg#define Sres(name, class, offset, dftvalue) \ 1246d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRString, sizeof(char *), \ 1247d522f475Smrg RES_OFFSET(offset), XtRString, (XtPointer) dftvalue} 1248d522f475Smrg 1249d522f475Smrg#define Wres(name, class, offset, dftvalue) \ 1250d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRWidget, sizeof(Widget), \ 1251d522f475Smrg RES_OFFSET(offset), XtRWidget, (XtPointer) dftvalue} 1252d522f475Smrg 1253d522f475Smrg/***====================================================================***/ 1254d522f475Smrg 1255d522f475Smrg#define FRG_SIZE resource.minBufSize 1256d522f475Smrg#define BUF_SIZE resource.maxBufSize 1257d522f475Smrg 1258d522f475Smrgtypedef struct { 1259d522f475Smrg Char * next; 1260d522f475Smrg Char * last; 1261d522f475Smrg int update; /* HandleInterpret */ 1262d522f475Smrg#if OPT_WIDE_CHARS 1263d522f475Smrg IChar utf_data; /* resulting character */ 1264d522f475Smrg int utf_size; /* ...number of bytes decoded */ 1265d522f475Smrg Char *write_buf; 1266d522f475Smrg unsigned write_len; 1267d522f475Smrg#endif 1268d522f475Smrg Char buffer[1]; 1269d522f475Smrg} PtyData; 1270d522f475Smrg 1271d522f475Smrg/***====================================================================***/ 1272d522f475Smrg 1273d522f475Smrg#if OPT_ISO_COLORS 1274d522f475Smrg#if OPT_256_COLORS || OPT_88_COLORS 1275b7c89284Ssnj#define COLOR_BITS 8 1276b7c89284Ssnjtypedef unsigned short CellColor; 1277d522f475Smrg#else 1278b7c89284Ssnj#define COLOR_BITS 4 1279b7c89284Ssnjtypedef Char CellColor; 1280d522f475Smrg#endif 1281b7c89284Ssnj#else 1282b7c89284Ssnjtypedef int CellColor; 1283d522f475Smrg#endif 1284b7c89284Ssnj 1285b7c89284Ssnj#define BITS2MASK(b) ((1 << b) - 1) 1286b7c89284Ssnj 1287b7c89284Ssnj#define COLOR_MASK BITS2MASK(COLOR_BITS) 1288b7c89284Ssnj 1289b7c89284Ssnj#define GetCellColorFG(src) ((src) & COLOR_MASK) 1290b7c89284Ssnj#define GetCellColorBG(src) (((src) >> COLOR_BITS) & COLOR_MASK) 1291b7c89284Ssnj 1292b7c89284Ssnjtypedef Char RowData; /* wrap/blink, and DEC single-double chars */ 1293b7c89284Ssnj 1294b7c89284Ssnj#define LINEFLAG_BITS 4 1295b7c89284Ssnj#define LINEFLAG_MASK BITS2MASK(LINEFLAG_BITS) 1296b7c89284Ssnj 1297b7c89284Ssnj#define GetLineFlags(ld) ((ld)->bufHead & LINEFLAG_MASK) 1298b7c89284Ssnj 1299d522f475Smrg#if OPT_DEC_CHRSET 1300b7c89284Ssnj#define SetLineFlags(ld,xx) (ld)->bufHead = (RowData) ((ld->bufHead & (DBLCS_MASK << LINEFLAG_BITS)) | (xx & LINEFLAG_MASK)) 1301b7c89284Ssnj#else 1302b7c89284Ssnj#define SetLineFlags(ld,xx) (ld)->bufHead = (RowData) (xx & LINEFLAG_MASK) 1303d522f475Smrg#endif 1304b7c89284Ssnj 1305b7c89284Ssnjtypedef IChar CharData; 1306b7c89284Ssnj 1307b7c89284Ssnj/* 1308b7c89284Ssnj * This is the xterm line-data/scrollback structure. 1309b7c89284Ssnj */ 1310b7c89284Ssnjtypedef struct { 1311b7c89284Ssnj Dimension lineSize; /* number of columns in this row */ 1312b7c89284Ssnj RowData bufHead; /* flag for wrapped lines */ 1313d522f475Smrg#if OPT_WIDE_CHARS 1314b7c89284Ssnj Char combSize; /* number of items in combData[] */ 1315b7c89284Ssnj#endif 1316b7c89284Ssnj Char *attribs; /* video attributes */ 1317b7c89284Ssnj#if OPT_ISO_COLORS 1318b7c89284Ssnj CellColor *color; /* foreground+background color numbers */ 1319b7c89284Ssnj#endif 1320b7c89284Ssnj CharData *charData; /* cell's base character */ 1321b7c89284Ssnj CharData *combData[1]; /* first enum past fixed-offsets */ 1322b7c89284Ssnj} LineData; 1323b7c89284Ssnj 1324b7c89284Ssnj/* 1325b7c89284Ssnj * We use CellData in a few places, when copying a cell's data to a temporary 1326b7c89284Ssnj * variable. 1327b7c89284Ssnj */ 1328b7c89284Ssnjtypedef struct { 1329b7c89284Ssnj Char attribs; 1330b7c89284Ssnj#if OPT_WIDE_CHARS 1331b7c89284Ssnj Char combSize; /* number of items in combData[] */ 1332b7c89284Ssnj#endif 1333b7c89284Ssnj#if OPT_ISO_COLORS 1334b7c89284Ssnj CellColor color; /* color-array */ 1335d522f475Smrg#endif 1336b7c89284Ssnj CharData charData; /* cell's base character */ 1337b7c89284Ssnj CharData combData[1]; /* array of combining chars */ 1338b7c89284Ssnj} CellData; 1339b7c89284Ssnj 1340b7c89284Ssnj#define for_each_combData(off, ld) for (off = 0; off < ld->combSize; ++off) 1341b7c89284Ssnj 1342b7c89284Ssnj/* 1343b7c89284Ssnj * Accommodate older compilers by not using variable-length arrays. 1344b7c89284Ssnj */ 1345b7c89284Ssnj#define SizeOfLineData offsetof(LineData, combData) 1346b7c89284Ssnj#define SizeOfCellData offsetof(CellData, combData) 1347d522f475Smrg 1348d522f475Smrg /* 1349d522f475Smrg * A "row" is the index within the visible part of the screen, and an 1350d522f475Smrg * "inx" is the index within the whole set of scrollable lines. 1351d522f475Smrg */ 1352d522f475Smrg#define ROW2INX(screen, row) ((row) + (screen)->topline) 1353d522f475Smrg#define INX2ROW(screen, inx) ((inx) - (screen)->topline) 1354d522f475Smrg 1355d522f475Smrg#define ROW2ABS(screen, row) ((row) + (screen)->savedlines) 1356d522f475Smrg#define INX2ABS(screen, inx) ROW2ABS(screen, INX2ROW(screen, inx)) 1357d522f475Smrg 1358d522f475Smrg#define okScrnRow(screen, row) \ 1359b7c89284Ssnj ((row) <= ((screen)->max_row - (screen)->topline) \ 1360d522f475Smrg && (row) >= -((screen)->savedlines)) 1361d522f475Smrg 1362b7c89284Ssnj /* 1363b7c89284Ssnj * Cache data for "proportional" and other fonts containing a mixture 1364b7c89284Ssnj * of widths. 1365b7c89284Ssnj */ 1366b7c89284Ssnjtypedef struct { 13673367019cSmrg Bool mixed; 1368b7c89284Ssnj Dimension min_width; /* nominal cell width for 0..255 */ 1369b7c89284Ssnj Dimension max_width; /* maximum cell width */ 1370b7c89284Ssnj} FontMap; 1371d522f475Smrg 1372d522f475Smrgtypedef struct { 1373d522f475Smrg unsigned chrset; 1374d522f475Smrg unsigned flags; 1375d522f475Smrg XFontStruct * fs; 1376d522f475Smrg char * fn; 1377b7c89284Ssnj FontMap map; 1378b7c89284Ssnj Char known_missing[256]; 1379d522f475Smrg} XTermFonts; 1380d522f475Smrg 1381b7c89284Ssnj#if OPT_RENDERFONT 1382cd3331d0Smrgtypedef enum { 1383cd3331d0Smrg erFalse = 0 1384cd3331d0Smrg , erTrue 1385cd3331d0Smrg , erDefault 1386cd3331d0Smrg , erLast 1387cd3331d0Smrg} RenderFont; 1388cd3331d0Smrg 1389cd3331d0Smrg#define DefaultRenderFont(xw) \ 13903367019cSmrg if ((xw)->work.render_font == erDefault) \ 13913367019cSmrg (xw)->work.render_font = erFalse 1392cd3331d0Smrg 1393b7c89284Ssnjtypedef struct { 1394b7c89284Ssnj XftFont * font; 1395b7c89284Ssnj FontMap map; 1396b7c89284Ssnj} XTermXftFonts; 1397b7c89284Ssnj#endif 1398b7c89284Ssnj 1399d522f475Smrgtypedef struct { 1400d522f475Smrg int top; 1401d522f475Smrg int left; 1402d522f475Smrg int bottom; 1403d522f475Smrg int right; 1404d522f475Smrg} XTermRect; 1405d522f475Smrg 1406d522f475Smrg /* indices into save_modes[] */ 1407d522f475Smrgtypedef enum { 14083367019cSmrg DP_ALTERNATE_SCROLL, 14093367019cSmrg DP_ALT_SENDS_ESC, 14103367019cSmrg DP_BELL_IS_URGENT, 1411d522f475Smrg DP_CRS_VISIBLE, 1412d522f475Smrg DP_DECANM, 1413d522f475Smrg DP_DECARM, 1414d522f475Smrg DP_DECAWM, 1415d522f475Smrg DP_DECBKM, 1416d522f475Smrg DP_DECCKM, 1417d522f475Smrg DP_DECCOLM, /* IN132COLUMNS */ 14183367019cSmrg DP_DECKPAM, 14193367019cSmrg DP_DECNRCM, 1420d522f475Smrg DP_DECOM, 1421d522f475Smrg DP_DECPEX, 1422d522f475Smrg DP_DECPFF, 1423d522f475Smrg DP_DECSCLM, 1424d522f475Smrg DP_DECSCNM, 1425d522f475Smrg DP_DECTCEM, 14263367019cSmrg DP_DELETE_IS_DEL, 14273367019cSmrg DP_EIGHT_BIT_META, 14283367019cSmrg DP_KEEP_SELECTION, 14293367019cSmrg DP_KEYBOARD_TYPE, 14303367019cSmrg DP_POP_ON_BELL, 1431d522f475Smrg DP_PRN_EXTENT, 1432d522f475Smrg DP_PRN_FORMFEED, 14333367019cSmrg DP_RXVT_SCROLLBAR, 14343367019cSmrg DP_RXVT_SCROLL_TTY_KEYPRESS, 14353367019cSmrg DP_RXVT_SCROLL_TTY_OUTPUT, 14363367019cSmrg DP_SELECT_TO_CLIPBOARD, 1437d522f475Smrg DP_X_ALTSCRN, 1438d522f475Smrg DP_X_DECCOLM, 14393367019cSmrg DP_X_EXT_MOUSE, 1440d522f475Smrg DP_X_LOGGING, 14413367019cSmrg DP_X_LRMM, 1442d522f475Smrg DP_X_MARGIN, 1443d522f475Smrg DP_X_MORE, 1444d522f475Smrg DP_X_MOUSE, 14453367019cSmrg DP_X_NCSM, 1446d522f475Smrg DP_X_REVWRAP, 1447d522f475Smrg DP_X_X10MSE, 1448d522f475Smrg#if OPT_BLINK_CURS 1449d522f475Smrg DP_CRS_BLINK, 1450d522f475Smrg#endif 1451d522f475Smrg#if OPT_FOCUS_EVENT 1452d522f475Smrg DP_X_FOCUS, 1453d522f475Smrg#endif 14543367019cSmrg#if OPT_NUM_LOCK 14553367019cSmrg DP_REAL_NUMLOCK, 14563367019cSmrg DP_META_SENDS_ESC, 14573367019cSmrg#endif 14583367019cSmrg#if OPT_SHIFT_FONTS 14593367019cSmrg DP_RXVT_FONTSIZE, 14603367019cSmrg#endif 14613367019cSmrg#if OPT_TEK4014 14623367019cSmrg DP_DECTEK, 14633367019cSmrg#endif 1464d522f475Smrg#if OPT_TOOLBAR 1465d522f475Smrg DP_TOOLBAR, 1466d522f475Smrg#endif 1467d522f475Smrg DP_LAST 1468d522f475Smrg} SaveModes; 1469d522f475Smrg 14700d92cbfdSchristos#define DoSM(code,value) screen->save_modes[code] = (unsigned) (value) 14710d92cbfdSchristos#define DoRM(code,value) value = (Boolean) screen->save_modes[code] 14720d92cbfdSchristos#define DoRM0(code,value) value = screen->save_modes[code] 1473d522f475Smrg 1474d522f475Smrg /* index into vt_shell[] or tek_shell[] */ 1475d522f475Smrgtypedef enum { 1476d522f475Smrg noMenu = -1, 1477d522f475Smrg mainMenu, 1478d522f475Smrg vtMenu, 1479d522f475Smrg fontMenu, 1480b7c89284Ssnj#if OPT_TEK4014 1481d522f475Smrg tekMenu 1482b7c89284Ssnj#endif 1483d522f475Smrg} MenuIndex; 1484d522f475Smrg 1485cd3331d0Smrgtypedef enum { 1486cd3331d0Smrg bvOff = -1, 1487cd3331d0Smrg bvLow = 0, 1488cd3331d0Smrg bvHigh 1489cd3331d0Smrg} BellVolume; 1490cd3331d0Smrg 1491d522f475Smrg#define NUM_POPUP_MENUS 4 1492d522f475Smrg 1493d522f475Smrg#if OPT_COLOR_RES 1494d522f475Smrgtypedef struct { 1495d522f475Smrg String resource; 1496d522f475Smrg Pixel value; 14973367019cSmrg unsigned short red, green, blue; 1498cd3331d0Smrg int mode; /* -1=invalid, 0=unset, 1=set */ 1499d522f475Smrg} ColorRes; 1500d522f475Smrg#else 1501d522f475Smrg#define ColorRes Pixel 1502d522f475Smrg#endif 1503d522f475Smrg 1504cd3331d0Smrg/* these are set in getPrinterFlags */ 1505cd3331d0Smrgtypedef struct { 1506cd3331d0Smrg int printer_extent; /* print complete page */ 1507cd3331d0Smrg int printer_formfeed; /* print formfeed per function */ 1508cd3331d0Smrg int printer_newline; /* print newline per function */ 1509cd3331d0Smrg int print_attributes; /* 0=off, 1=normal, 2=color */ 1510712a7ff4Smrg int print_everything; /* 0=all, 1=dft, 2=alt, 3=saved */ 1511cd3331d0Smrg} PrinterFlags; 1512cd3331d0Smrg 1513712a7ff4Smrgtypedef struct { 1514712a7ff4Smrg FILE * fp; /* output file/pipe used */ 1515712a7ff4Smrg Boolean isOpen; /* output was opened/tried */ 1516712a7ff4Smrg Boolean toFile; /* true when directly to file */ 15173367019cSmrg Boolean printer_checked; /* printer_command is checked */ 1518712a7ff4Smrg String printer_command; /* pipe/shell command string */ 1519712a7ff4Smrg Boolean printer_autoclose; /* close printer when offline */ 1520712a7ff4Smrg Boolean printer_extent; /* print complete page */ 1521712a7ff4Smrg Boolean printer_formfeed; /* print formfeed per function */ 1522712a7ff4Smrg Boolean printer_newline; /* print newline per function */ 1523712a7ff4Smrg int printer_controlmode; /* 0=off, 1=auto, 2=controller */ 1524712a7ff4Smrg int print_attributes; /* 0=off, 1=normal, 2=color */ 1525712a7ff4Smrg int print_everything; /* 0=all, 1=dft, 2=alt, 3=saved */ 1526712a7ff4Smrg} PrinterState; 1527712a7ff4Smrg 1528d522f475Smrgtypedef struct { 1529d522f475Smrg unsigned which; /* must have NCOLORS bits */ 1530d522f475Smrg Pixel colors[NCOLORS]; 1531d522f475Smrg char *names[NCOLORS]; 1532d522f475Smrg} ScrnColors; 1533d522f475Smrg 1534d522f475Smrgtypedef struct { 1535d522f475Smrg Boolean saved; 1536d522f475Smrg int row; 1537d522f475Smrg int col; 1538d522f475Smrg unsigned flags; /* VTxxx saves graphics rendition */ 15390d92cbfdSchristos Char curgl; 15400d92cbfdSchristos Char curgr; 15410d92cbfdSchristos Char gsets[4]; 1542d522f475Smrg#if OPT_ISO_COLORS 1543d522f475Smrg int cur_foreground; /* current foreground color */ 1544d522f475Smrg int cur_background; /* current background color */ 1545d522f475Smrg int sgr_foreground; /* current SGR foreground color */ 1546d522f475Smrg int sgr_background; /* current SGR background color */ 1547d522f475Smrg Boolean sgr_extended; /* SGR set with extended codes? */ 1548d522f475Smrg#endif 1549d522f475Smrg} SavedCursor; 1550d522f475Smrg 1551cd3331d0Smrgtypedef struct _SaveTitle { 15523367019cSmrg struct _SaveTitle *next; 1553cd3331d0Smrg char *iconName; 1554cd3331d0Smrg char *windowName; 1555cd3331d0Smrg} SaveTitle; 1556cd3331d0Smrg 1557d522f475Smrg#define SAVED_CURSORS 2 1558d522f475Smrg 1559d522f475Smrgtypedef struct { 1560d522f475Smrg int width; /* if > 0, width of scrollbar, */ 1561d522f475Smrg /* and scrollbar is showing */ 1562d522f475Smrg Boolean rv_cached; /* see ScrollBarReverseVideo */ 1563d522f475Smrg int rv_active; /* ...current reverse-video */ 1564d522f475Smrg Pixel bg; /* ...cached background color */ 1565d522f475Smrg Pixel fg; /* ...cached foreground color */ 1566d522f475Smrg Pixel bdr; /* ...cached border color */ 1567d522f475Smrg Pixmap bdpix; /* ...cached border pixmap */ 1568d522f475Smrg} SbInfo; 1569d522f475Smrg 1570d522f475Smrg#if OPT_TOOLBAR 1571d522f475Smrgtypedef struct { 1572d522f475Smrg Widget menu_bar; /* toolbar, if initialized */ 1573d522f475Smrg Dimension menu_height; /* ...and its height */ 1574d522f475Smrg Dimension menu_border; /* ...and its border */ 1575d522f475Smrg} TbInfo; 1576d522f475Smrg#define VT100_TB_INFO(name) screen.fullVwin.tb_info.name 1577d522f475Smrg#endif 1578d522f475Smrg 1579d522f475Smrgtypedef struct { 1580d522f475Smrg Window window; /* X window id */ 1581d522f475Smrg int width; /* width of columns */ 1582d522f475Smrg int height; /* height of rows */ 1583d522f475Smrg Dimension fullwidth; /* full width of window */ 1584d522f475Smrg Dimension fullheight; /* full height of window */ 1585d522f475Smrg int f_width; /* width of fonts in pixels */ 1586d522f475Smrg int f_height; /* height of fonts in pixels */ 1587d522f475Smrg int f_ascent; /* ascent of font in pixels */ 1588d522f475Smrg int f_descent; /* descent of font in pixels */ 1589d522f475Smrg SbInfo sb_info; 15903367019cSmrg#if OPT_DOUBLE_BUFFER 15913367019cSmrg Drawable drawable; /* X drawable id */ 15923367019cSmrg#endif 1593d522f475Smrg#if OPT_TOOLBAR 1594d522f475Smrg Boolean active; /* true if toolbars are used */ 1595d522f475Smrg TbInfo tb_info; /* toolbar information */ 1596d522f475Smrg#endif 1597d522f475Smrg} VTwin; 1598d522f475Smrg 1599d522f475Smrgtypedef struct { 1600d522f475Smrg Window window; /* X window id */ 1601d522f475Smrg int width; /* width of columns */ 1602d522f475Smrg int height; /* height of rows */ 1603d522f475Smrg Dimension fullwidth; /* full width of window */ 1604d522f475Smrg Dimension fullheight; /* full height of window */ 1605d522f475Smrg double tekscale; /* scale factor Tek -> vs100 */ 1606d522f475Smrg} TKwin; 1607d522f475Smrg 1608712a7ff4Smrgtypedef struct { 1609712a7ff4Smrg String f_n; /* the normal font */ 1610712a7ff4Smrg String f_b; /* the bold font */ 1611712a7ff4Smrg#if OPT_WIDE_CHARS 1612712a7ff4Smrg String f_w; /* the normal wide font */ 1613712a7ff4Smrg String f_wb; /* the bold wide font */ 1614712a7ff4Smrg#endif 1615712a7ff4Smrg} VTFontNames; 1616712a7ff4Smrg 1617712a7ff4Smrgtypedef struct { 1618712a7ff4Smrg VTFontNames default_font; 1619712a7ff4Smrg String menu_font_names[NMENUFONTS][fMAX]; 1620712a7ff4Smrg} SubResourceRec; 1621712a7ff4Smrg 16223367019cSmrg#if OPT_INPUT_METHOD 16233367019cSmrg#define NINPUTWIDGETS 3 16243367019cSmrgtypedef struct { 16253367019cSmrg Widget w; 16263367019cSmrg XIM xim; /* input method attached to 'w' */ 16273367019cSmrg XIC xic; /* input context attached to 'xim' */ 16283367019cSmrg} TInput; 16293367019cSmrg#endif 16303367019cSmrg 16313367019cSmrgtypedef enum { 16323367019cSmrg CURSOR_BLOCK = 2 16333367019cSmrg , CURSOR_UNDERLINE = 4 16343367019cSmrg , CURSOR_BAR = 6 16353367019cSmrg} XtCursorShape; 16363367019cSmrg 16373367019cSmrg#define isCursorBlock(s) ((s)->cursor_shape == CURSOR_BLOCK) 16383367019cSmrg#define isCursorUnderline(s) ((s)->cursor_shape == CURSOR_UNDERLINE) 16393367019cSmrg#define isCursorBar(s) ((s)->cursor_shape == CURSOR_BAR) 16403367019cSmrg 16413367019cSmrgtypedef enum { 16423367019cSmrg DEFAULT_STYLE = 0 16433367019cSmrg , BLINK_BLOCK 16443367019cSmrg , STEADY_BLOCK 16453367019cSmrg , BLINK_UNDERLINE 16463367019cSmrg , STEADY_UNDERLINE 16473367019cSmrg , BLINK_BAR 16483367019cSmrg , STEADY_BAR 16493367019cSmrg} XtCursorStyle; 16503367019cSmrg 1651d522f475Smrgtypedef struct { 1652d522f475Smrg/* These parameters apply to both windows */ 1653d522f475Smrg Display *display; /* X display for screen */ 1654d522f475Smrg int respond; /* socket for responses 1655d522f475Smrg (position report, etc.) */ 1656d522f475Smrg/* These parameters apply to VT100 window */ 1657d522f475Smrg IChar unparse_bfr[256]; 1658d522f475Smrg unsigned unparse_len; 1659d522f475Smrg 1660d522f475Smrg#if OPT_TCAP_QUERY 1661d522f475Smrg int tc_query_code; 1662d522f475Smrg Bool tc_query_fkey; 1663d522f475Smrg#endif 1664d522f475Smrg pid_t pid; /* pid of process on far side */ 1665d522f475Smrg uid_t uid; /* user id of actual person */ 1666d522f475Smrg gid_t gid; /* group id of actual person */ 1667d522f475Smrg ColorRes Tcolors[NCOLORS]; /* terminal colors */ 1668d522f475Smrg#if OPT_HIGHLIGHT_COLOR 1669d522f475Smrg Boolean hilite_color; /* hilite colors override */ 1670d522f475Smrg Boolean hilite_reverse; /* hilite overrides reverse */ 1671d522f475Smrg#endif 1672d522f475Smrg#if OPT_ISO_COLORS 16733367019cSmrg XColor * cmap_data; /* color table */ 16743367019cSmrg unsigned cmap_size; 1675d522f475Smrg ColorRes Acolors[MAXCOLORS]; /* ANSI color emulation */ 1676d522f475Smrg int veryBoldColors; /* modifier for boldColors */ 1677d522f475Smrg Boolean boldColors; /* can we make bold colors? */ 1678d522f475Smrg Boolean colorMode; /* are we using color mode? */ 1679d522f475Smrg Boolean colorULMode; /* use color for underline? */ 1680d522f475Smrg Boolean italicULMode; /* italic font for underline? */ 1681d522f475Smrg Boolean colorBDMode; /* use color for bold? */ 1682d522f475Smrg Boolean colorBLMode; /* use color for blink? */ 1683d522f475Smrg Boolean colorRVMode; /* use color for reverse? */ 1684d522f475Smrg Boolean colorAttrMode; /* prefer colorUL/BD to SGR */ 1685d522f475Smrg#endif 1686d522f475Smrg#if OPT_DEC_CHRSET 1687d522f475Smrg Boolean font_doublesize;/* enable font-scaling */ 1688d522f475Smrg int cache_doublesize;/* limit of our cache */ 1689d522f475Smrg Char cur_chrset; /* character-set index & code */ 1690d522f475Smrg int fonts_used; /* count items in double_fonts */ 1691d522f475Smrg XTermFonts double_fonts[NUM_CHRSET]; 1692d522f475Smrg#endif 1693d522f475Smrg#if OPT_DEC_RECTOPS 1694d522f475Smrg int cur_decsace; /* parameter for DECSACE */ 1695d522f475Smrg#endif 1696d522f475Smrg#if OPT_WIDE_CHARS 1697d522f475Smrg Boolean wide_chars; /* true when 16-bit chars */ 1698d522f475Smrg Boolean vt100_graphics; /* true to allow vt100-graphics */ 1699d522f475Smrg Boolean utf8_inparse; /* true to enable UTF-8 parser */ 17003367019cSmrg Boolean normalized_c; /* true to precompose to Form C */ 1701712a7ff4Smrg char * utf8_mode_s; /* use UTF-8 decode/encode */ 1702712a7ff4Smrg char * utf8_fonts_s; /* use UTF-8 decode/encode */ 1703d522f475Smrg int utf8_mode; /* use UTF-8 decode/encode: 0-2 */ 1704712a7ff4Smrg int utf8_fonts; /* use UTF-8 decode/encode: 0-2 */ 1705d522f475Smrg int max_combining; /* maximum # of combining chars */ 1706d522f475Smrg Boolean utf8_latin1; /* use UTF-8 with Latin-1 bias */ 1707d522f475Smrg Boolean utf8_title; /* use UTF-8 titles */ 1708d522f475Smrg int latin9_mode; /* poor man's luit, latin9 */ 1709d522f475Smrg int unicode_font; /* font uses unicode encoding */ 1710d522f475Smrg int utf_count; /* state of utf_char */ 1711d522f475Smrg IChar utf_char; /* in-progress character */ 17123367019cSmrg Boolean char_was_written; 1713d522f475Smrg int last_written_col; 1714d522f475Smrg int last_written_row; 1715b7c89284Ssnj TypedBuffer(XChar2b); 1716b7c89284Ssnj TypedBuffer(char); 1717d522f475Smrg#endif 1718d522f475Smrg#if OPT_BROKEN_OSC 1719d522f475Smrg Boolean brokenLinuxOSC; /* true to ignore Linux palette ctls */ 1720d522f475Smrg#endif 1721d522f475Smrg#if OPT_BROKEN_ST 1722d522f475Smrg Boolean brokenStringTerm; /* true to match old OSC parse */ 1723d522f475Smrg#endif 1724d522f475Smrg#if OPT_C1_PRINT || OPT_WIDE_CHARS 1725d522f475Smrg Boolean c1_printable; /* true if we treat C1 as print */ 1726d522f475Smrg#endif 1727d522f475Smrg int border; /* inner border */ 1728d522f475Smrg int scrollBarBorder; /* scrollBar border */ 17290d92cbfdSchristos long event_mask; 17300d92cbfdSchristos unsigned send_mouse_pos; /* user wants mouse transition */ 1731d522f475Smrg /* and position information */ 17323367019cSmrg int extend_coords; /* support large terminals */ 1733d522f475Smrg Boolean send_focus_pos; /* user wants focus in/out info */ 1734d522f475Smrg Boolean quiet_grab; /* true if no cursor change on focus */ 1735d522f475Smrg#if OPT_PASTE64 1736b7c89284Ssnj Cardinal base64_paste; /* set to send paste in base64 */ 1737d522f475Smrg int base64_final; /* string-terminator for paste */ 1738d522f475Smrg /* _qWriteSelectionData expects these to be initialized to zero. 1739d522f475Smrg * base64_flush() is the last step of the conversion, it clears these 1740d522f475Smrg * variables. 1741d522f475Smrg */ 17420d92cbfdSchristos unsigned base64_accu; 17430d92cbfdSchristos unsigned base64_count; 17440d92cbfdSchristos unsigned base64_pad; 1745d522f475Smrg#endif 1746d522f475Smrg#if OPT_READLINE 1747d522f475Smrg unsigned click1_moves; 1748d522f475Smrg unsigned paste_moves; 1749d522f475Smrg unsigned dclick3_deletes; 1750d522f475Smrg unsigned paste_brackets; 1751d522f475Smrg unsigned paste_quotes; 1752d522f475Smrg unsigned paste_literal_nl; 1753d522f475Smrg#endif /* OPT_READLINE */ 1754d522f475Smrg#if OPT_DEC_LOCATOR 1755d522f475Smrg Boolean locator_reset; /* turn mouse off after 1 report? */ 1756d522f475Smrg Boolean locator_pixels; /* report in pixels? */ 1757d522f475Smrg /* if false, report in cells */ 17580d92cbfdSchristos unsigned locator_events; /* what events to report */ 1759d522f475Smrg Boolean loc_filter; /* is filter rectangle active? */ 1760d522f475Smrg int loc_filter_top; /* filter rectangle for DEC Locator */ 1761d522f475Smrg int loc_filter_left; 1762d522f475Smrg int loc_filter_bottom; 1763d522f475Smrg int loc_filter_right; 1764d522f475Smrg#endif /* OPT_DEC_LOCATOR */ 1765d522f475Smrg int mouse_button; /* current button pressed */ 1766d522f475Smrg int mouse_row; /* ...and its row */ 1767d522f475Smrg int mouse_col; /* ...and its column */ 1768d522f475Smrg int select; /* xterm selected */ 1769d522f475Smrg Boolean bellOnReset; /* bellOnReset */ 1770d522f475Smrg Boolean visualbell; /* visual bell mode */ 1771d522f475Smrg Boolean poponbell; /* pop on bell mode */ 17720d92cbfdSchristos 17733367019cSmrg Boolean allowPasteControls; /* PasteControls mode */ 1774cd3331d0Smrg Boolean allowColorOps; /* ColorOps mode */ 17750d92cbfdSchristos Boolean allowFontOps; /* FontOps mode */ 1776d522f475Smrg Boolean allowSendEvents;/* SendEvent mode */ 17770d92cbfdSchristos Boolean allowTcapOps; /* TcapOps mode */ 1778d522f475Smrg Boolean allowTitleOps; /* TitleOps mode */ 1779d522f475Smrg Boolean allowWindowOps; /* WindowOps mode */ 17800d92cbfdSchristos 1781cd3331d0Smrg Boolean allowColorOp0; /* initial ColorOps mode */ 17820d92cbfdSchristos Boolean allowFontOp0; /* initial FontOps mode */ 1783d522f475Smrg Boolean allowSendEvent0;/* initial SendEvent mode */ 17840d92cbfdSchristos Boolean allowTcapOp0; /* initial TcapOps mode */ 1785d522f475Smrg Boolean allowTitleOp0; /* initial TitleOps mode */ 1786d522f475Smrg Boolean allowWindowOp0; /* initial WindowOps mode */ 17870d92cbfdSchristos 1788cd3331d0Smrg String disallowedColorOps; 1789cd3331d0Smrg char disallow_color_ops[ecLAST]; 1790cd3331d0Smrg 1791cd3331d0Smrg String disallowedFontOps; 1792cd3331d0Smrg char disallow_font_ops[efLAST]; 1793cd3331d0Smrg 1794cd3331d0Smrg String disallowedTcapOps; 1795cd3331d0Smrg char disallow_tcap_ops[etLAST]; 1796cd3331d0Smrg 1797cd3331d0Smrg String disallowedWinOps; 1798cd3331d0Smrg char disallow_win_ops[ewLAST]; 1799cd3331d0Smrg 1800d522f475Smrg Boolean awaitInput; /* select-timeout mode */ 1801d522f475Smrg Boolean grabbedKbd; /* keyboard is grabbed */ 1802d522f475Smrg#ifdef ALLOWLOGGING 1803d522f475Smrg int logging; /* logging mode */ 1804d522f475Smrg int logfd; /* file descriptor of log */ 1805d522f475Smrg char *logfile; /* log file name */ 1806d522f475Smrg Char *logstart; /* current start of log buffer */ 1807d522f475Smrg#endif 1808d522f475Smrg int inhibit; /* flags for inhibiting changes */ 1809d522f475Smrg 1810d522f475Smrg/* VT window parameters */ 1811d522f475Smrg Boolean Vshow; /* VT window showing */ 1812d522f475Smrg VTwin fullVwin; 18133367019cSmrg int needSwap; 1814d522f475Smrg#ifndef NO_ACTIVE_ICON 1815d522f475Smrg VTwin iconVwin; 1816d522f475Smrg VTwin *whichVwin; 1817d522f475Smrg#endif /* NO_ACTIVE_ICON */ 1818d522f475Smrg 1819d522f475Smrg int pointer_mode; /* when to use hidden_cursor */ 1820d522f475Smrg Boolean hide_pointer; /* true to use "hidden_cursor" */ 1821d522f475Smrg Cursor pointer_cursor; /* pointer cursor in window */ 1822d522f475Smrg Cursor hidden_cursor; /* hidden cursor in window */ 1823d522f475Smrg 1824d522f475Smrg String answer_back; /* response to ENQ */ 1825d522f475Smrg 1826712a7ff4Smrg PrinterState printer_state; /* actual printer state */ 1827cd3331d0Smrg PrinterFlags printer_flags; /* working copy of printer flags */ 1828712a7ff4Smrg#if OPT_PRINT_ON_EXIT 1829712a7ff4Smrg Boolean write_error; 1830712a7ff4Smrg#endif 1831cd3331d0Smrg 1832d522f475Smrg Boolean fnt_prop; /* true if proportional fonts */ 1833d522f475Smrg Boolean fnt_boxes; /* true if font has box-chars */ 1834cd3331d0Smrg Boolean force_packed; /* true to override proportional */ 1835d522f475Smrg#if OPT_BOX_CHARS 18363367019cSmrg Boolean force_box_chars;/* true if we assume no boxchars */ 1837cd3331d0Smrg Boolean force_all_chars;/* true to outline missing chars */ 1838cd3331d0Smrg Boolean allow_packing; /* true to allow packed-fonts */ 1839d522f475Smrg#endif 1840d522f475Smrg Dimension fnt_wide; 1841d522f475Smrg Dimension fnt_high; 18423367019cSmrg float scale_height; /* scaling for font-height */ 1843d522f475Smrg XTermFonts fnts[fMAX]; /* normal/bold/etc for terminal */ 1844d522f475Smrg Boolean free_bold_box; /* same_font_size's austerity */ 1845712a7ff4Smrg Boolean allowBoldFonts; /* do we use bold fonts at all? */ 1846d522f475Smrg#ifndef NO_ACTIVE_ICON 1847cb4a1343Smrg XTermFonts fnt_icon; /* icon font */ 1848cb4a1343Smrg String icon_fontname; /* name of icon font */ 1849cb4a1343Smrg int icon_fontnum; /* number to use for icon font */ 1850d522f475Smrg#endif /* NO_ACTIVE_ICON */ 1851d522f475Smrg int enbolden; /* overstrike for bold font */ 1852d522f475Smrg XPoint *box; /* draw unselected cursor */ 1853d522f475Smrg 1854d522f475Smrg int cursor_state; /* ON, OFF, or BLINKED_OFF */ 1855d522f475Smrg int cursor_busy; /* do not redraw... */ 18560d92cbfdSchristos Boolean cursor_underline; /* true if cursor is in underline mode */ 18573367019cSmrg XtCursorShape cursor_shape; 1858d522f475Smrg#if OPT_BLINK_CURS 1859d522f475Smrg Boolean cursor_blink; /* cursor blink enable */ 1860d522f475Smrg Boolean cursor_blink_res; /* initial cursor blink value */ 1861d522f475Smrg Boolean cursor_blink_esc; /* cursor blink escape-state */ 1862d522f475Smrg#endif 1863d522f475Smrg#if OPT_BLINK_TEXT 1864d522f475Smrg Boolean blink_as_bold; /* text blink disable */ 1865d522f475Smrg#endif 1866d522f475Smrg#if OPT_BLINK_CURS || OPT_BLINK_TEXT 1867d522f475Smrg int blink_state; /* ON, OFF, or BLINKED_OFF */ 1868d522f475Smrg int blink_on; /* cursor on time (msecs) */ 1869d522f475Smrg int blink_off; /* cursor off time (msecs) */ 1870d522f475Smrg XtIntervalId blink_timer; /* timer-id for cursor-proc */ 1871d522f475Smrg#endif 1872d522f475Smrg#if OPT_ZICONBEEP 1873d522f475Smrg Boolean zIconBeep_flagged; /* True if icon name was changed */ 1874d522f475Smrg#endif /* OPT_ZICONBEEP */ 1875d522f475Smrg int cursor_GC; /* see ShowCursor() */ 1876d522f475Smrg int cursor_set; /* requested state */ 1877d522f475Smrg CELL cursorp; /* previous cursor row/column */ 1878d522f475Smrg int cur_col; /* current cursor column */ 1879d522f475Smrg int cur_row; /* current cursor row */ 1880d522f475Smrg int max_col; /* rightmost column */ 1881d522f475Smrg int max_row; /* bottom row */ 1882d522f475Smrg int top_marg; /* top line of scrolling region */ 1883d522f475Smrg int bot_marg; /* bottom line of " " */ 18843367019cSmrg int lft_marg; /* left column of " " */ 18853367019cSmrg int rgt_marg; /* right column of " " */ 1886d522f475Smrg Widget scrollWidget; /* pointer to scrollbar struct */ 1887d522f475Smrg /* 1888d522f475Smrg * Indices used to keep track of the top of the vt100 window and 1889d522f475Smrg * the saved lines, taking scrolling into account. 1890d522f475Smrg */ 1891d522f475Smrg int topline; /* line number of top, <= 0 */ 1892b7c89284Ssnj long saved_fifo; /* number of lines that've been saved */ 1893d522f475Smrg int savedlines; /* number of lines that've been saved */ 1894d522f475Smrg int savelines; /* number of lines off top to save */ 1895d522f475Smrg int scroll_amt; /* amount to scroll */ 1896d522f475Smrg int refresh_amt; /* amount to refresh */ 1897d522f475Smrg /* 1898b7c89284Ssnj * Working variables for getLineData(). 1899b7c89284Ssnj */ 1900b7c89284Ssnj size_t lineExtra; /* extra space for combining chars */ 1901b7c89284Ssnj /* 1902b7c89284Ssnj * Pointer to the current visible buffer. 1903d522f475Smrg */ 1904d522f475Smrg ScrnBuf visbuf; /* ptr to visible screen buf (main) */ 1905d522f475Smrg /* 1906d522f475Smrg * Data for the normal buffer, which may have saved lines to which 1907d522f475Smrg * the user can scroll. 1908d522f475Smrg */ 1909b7c89284Ssnj ScrnBuf saveBuf_index; 1910b7c89284Ssnj Char *saveBuf_data; 1911d522f475Smrg /* 1912b7c89284Ssnj * Data for visible and alternate buffer. 1913d522f475Smrg */ 1914b7c89284Ssnj ScrnBuf editBuf_index[2]; 1915b7c89284Ssnj Char *editBuf_data[2]; 1916b7c89284Ssnj int whichBuf; /* 0/1 for normal/alternate buf */ 1917b7c89284Ssnj Boolean is_running; /* true when buffers are legal */ 1918d522f475Smrg /* 1919d522f475Smrg * Workspace used for screen operations. 1920d522f475Smrg */ 1921d522f475Smrg Char **save_ptr; /* workspace for save-pointers */ 1922d522f475Smrg size_t save_len; /* ...and its length */ 1923d522f475Smrg 1924d522f475Smrg int scrolllines; /* number of lines to button scroll */ 19253367019cSmrg Boolean alternateScroll; /* scroll-actions become keys */ 1926d522f475Smrg Boolean scrollttyoutput; /* scroll to bottom on tty output */ 1927d522f475Smrg Boolean scrollkey; /* scroll to bottom on key */ 1928d522f475Smrg Boolean cursor_moved; /* scrolling makes cursor move */ 1929d522f475Smrg 19300d92cbfdSchristos Boolean do_wrap; /* true if cursor in last column 1931d522f475Smrg and character just output */ 1932d522f475Smrg 1933d522f475Smrg int incopy; /* 0 idle; 1 XCopyArea issued; 1934d522f475Smrg -1 first GraphicsExpose seen, 1935d522f475Smrg but last not seen */ 1936d522f475Smrg int copy_src_x; /* params from last XCopyArea ... */ 1937d522f475Smrg int copy_src_y; 1938d522f475Smrg unsigned int copy_width; 1939d522f475Smrg unsigned int copy_height; 1940d522f475Smrg int copy_dest_x; 1941d522f475Smrg int copy_dest_y; 1942d522f475Smrg 19433367019cSmrg Dimension embed_wide; 19443367019cSmrg Dimension embed_high; 19453367019cSmrg 1946d522f475Smrg Boolean c132; /* allow change to 132 columns */ 1947d522f475Smrg Boolean curses; /* kludge line wrap for more */ 1948d522f475Smrg Boolean hp_ll_bc; /* kludge HP-style ll for xdb */ 1949d522f475Smrg Boolean marginbell; /* true if margin bell on */ 1950d522f475Smrg int nmarginbell; /* columns from right margin */ 1951cd3331d0Smrg int bellArmed; /* cursor below bell margin */ 1952cd3331d0Smrg BellVolume marginVolume; /* margin-bell volume */ 1953cd3331d0Smrg BellVolume warningVolume; /* warning-bell volume */ 1954d522f475Smrg Boolean multiscroll; /* true if multi-scroll */ 1955d522f475Smrg int scrolls; /* outstanding scroll count, 1956d522f475Smrg used only with multiscroll */ 1957d522f475Smrg SavedCursor sc[SAVED_CURSORS]; /* data for restore cursor */ 19580d92cbfdSchristos unsigned save_modes[DP_LAST]; /* save dec/xterm private modes */ 1959d522f475Smrg 1960cd3331d0Smrg int title_modes; /* control set/get of titles */ 1961cd3331d0Smrg SaveTitle *save_title; 1962cd3331d0Smrg 1963d522f475Smrg /* Improved VT100 emulation stuff. */ 1964d522f475Smrg String keyboard_dialect; /* default keyboard dialect */ 19650d92cbfdSchristos Char gsets[4]; /* G0 through G3. */ 1966d522f475Smrg Char curgl; /* Current GL setting. */ 1967d522f475Smrg Char curgr; /* Current GR setting. */ 1968d522f475Smrg Char curss; /* Current single shift. */ 1969d522f475Smrg String term_id; /* resource for terminal_id */ 1970d522f475Smrg int terminal_id; /* 100=vt100, 220=vt220, etc. */ 1971d522f475Smrg int vtXX_level; /* 0=vt52, 1,2,3 = vt100 ... vt320 */ 19723367019cSmrg int ansi_level; /* dpANSI levels 1,2,3 */ 1973d522f475Smrg int protected_mode; /* 0=off, 1=DEC, 2=ISO */ 1974d522f475Smrg Boolean always_bold_mode; /* compare normal/bold font */ 1975d522f475Smrg Boolean always_highlight; /* whether to highlight cursor */ 1976d522f475Smrg Boolean bold_mode; /* use bold font or overstrike */ 1977d522f475Smrg Boolean delete_is_del; /* true for compatible Delete key */ 1978d522f475Smrg Boolean jumpscroll; /* whether we should jumpscroll */ 1979b7c89284Ssnj Boolean fastscroll; /* whether we should fastscroll */ 1980d522f475Smrg Boolean old_fkeys; /* true for compatible fkeys */ 1981d522f475Smrg Boolean underline; /* whether to underline text */ 1982d522f475Smrg 1983d522f475Smrg#if OPT_MAXIMIZE 1984d522f475Smrg Boolean restore_data; 1985d522f475Smrg int restore_x; 1986d522f475Smrg int restore_y; 1987d522f475Smrg unsigned restore_width; 1988d522f475Smrg unsigned restore_height; 1989d522f475Smrg#endif 1990d522f475Smrg 1991cd3331d0Smrg#if OPT_SCROLL_LOCK 1992cd3331d0Smrg Boolean allowScrollLock;/* ScrollLock mode */ 1993cd3331d0Smrg Boolean allowScrollLock0;/* initial ScrollLock mode */ 1994cd3331d0Smrg Boolean scroll_lock; /* true to keep buffer in view */ 1995cd3331d0Smrg Boolean scroll_dirty; /* scrolling makes screen dirty */ 1996cd3331d0Smrg#endif 1997cd3331d0Smrg 1998d522f475Smrg#if OPT_VT52_MODE 19990d92cbfdSchristos Char vt52_save_curgl; 20000d92cbfdSchristos Char vt52_save_curgr; 20010d92cbfdSchristos Char vt52_save_curss; 20020d92cbfdSchristos Char vt52_save_gsets[4]; 2003d522f475Smrg#endif 2004d522f475Smrg /* Testing */ 2005d522f475Smrg#if OPT_XMC_GLITCH 2006d522f475Smrg unsigned xmc_glitch; /* # of spaces to pad on SGR's */ 2007d522f475Smrg int xmc_attributes; /* attrs that make a glitch */ 2008d522f475Smrg Boolean xmc_inline; /* SGR's propagate only to eol */ 2009d522f475Smrg Boolean move_sgr_ok; /* SGR is reset on move */ 2010d522f475Smrg#endif 2011d522f475Smrg 2012d522f475Smrg /* 2013d522f475Smrg * Bell 2014d522f475Smrg */ 2015d522f475Smrg int visualBellDelay; /* msecs to delay for visibleBell */ 2016d522f475Smrg int bellSuppressTime; /* msecs after Bell before another allowed */ 2017d522f475Smrg Boolean bellInProgress; /* still ringing/flashing prev bell? */ 2018d522f475Smrg Boolean bellIsUrgent; /* set XUrgency WM hint on bell */ 20193367019cSmrg Boolean flash_line; /* show visualBell as current line */ 2020d522f475Smrg /* 2021d522f475Smrg * Select/paste state. 2022d522f475Smrg */ 2023d522f475Smrg Boolean selectToClipboard; /* primary vs clipboard */ 2024d522f475Smrg String *mappedSelect; /* mapping for "SELECT" to "PRIMARY" */ 2025d522f475Smrg 2026d522f475Smrg Boolean waitingForTrackInfo; 2027d522f475Smrg int numberOfClicks; 2028d522f475Smrg int maxClicks; 2029d522f475Smrg int multiClickTime; /* time between multiclick selects */ 2030d522f475Smrg SelectUnit selectUnit; 2031d522f475Smrg SelectUnit selectMap[NSELECTUNITS]; 2032d522f475Smrg String onClick[NSELECTUNITS + 1]; 2033d522f475Smrg 2034d522f475Smrg char *charClass; /* for overriding word selection */ 2035d522f475Smrg Boolean cutNewline; /* whether or not line cut has \n */ 2036d522f475Smrg Boolean cutToBeginningOfLine; /* line cuts to BOL? */ 2037d522f475Smrg Boolean highlight_selection; /* controls appearance of selection */ 2038cb4a1343Smrg Boolean show_wrap_marks; /* show lines which are wrapped */ 2039d522f475Smrg Boolean trim_selection; /* controls trimming of selection */ 2040d522f475Smrg Boolean i18nSelections; 2041d522f475Smrg Boolean brokenSelections; 2042d522f475Smrg Boolean keepSelection; /* do not lose selection on output */ 2043d522f475Smrg Boolean replyToEmacs; /* Send emacs escape code when done selecting or extending? */ 2044d522f475Smrg Char *selection_data; /* the current selection */ 2045d522f475Smrg int selection_size; /* size of allocated buffer */ 20460d92cbfdSchristos unsigned long selection_length; /* number of significant bytes */ 2047d522f475Smrg EventMode eventMode; 2048d522f475Smrg Time selection_time; /* latest event timestamp */ 2049d522f475Smrg Time lastButtonUpTime; 2050d522f475Smrg unsigned lastButton; 2051d522f475Smrg 2052d522f475Smrg CELL rawPos; /* raw position for selection start */ 2053d522f475Smrg CELL startRaw; /* area before selectUnit processing */ 2054d522f475Smrg CELL endRaw; /* " " */ 2055d522f475Smrg CELL startSel; /* area after selectUnit processing */ 2056d522f475Smrg CELL endSel; /* " " */ 2057d522f475Smrg CELL startH; /* start highlighted text */ 2058d522f475Smrg CELL endH; /* end highlighted text */ 2059d522f475Smrg CELL saveStartW; /* saved WORD state, for LINE */ 2060d522f475Smrg CELL startExt; /* Start, end of extension */ 2061d522f475Smrg CELL endExt; /* " " */ 2062d522f475Smrg CELL saveStartR; /* Saved values of raw selection for extend to restore to */ 2063d522f475Smrg CELL saveEndR; /* " " */ 2064d522f475Smrg int startHCoord, endHCoord; 2065d522f475Smrg int firstValidRow; /* Valid rows for selection clipping */ 2066d522f475Smrg int lastValidRow; /* " " */ 2067d522f475Smrg 20683367019cSmrg Boolean selectToBuffer; /* copy selection to buffer */ 20693367019cSmrg char * internal_select; 20703367019cSmrg 2071b7c89284Ssnj String default_string; 2072b7c89284Ssnj String eightbit_select_types; 2073b7c89284Ssnj Atom* selection_targets_8bit; 2074b7c89284Ssnj#if OPT_WIDE_CHARS 2075b7c89284Ssnj String utf8_select_types; 2076b7c89284Ssnj Atom* selection_targets_utf8; 2077b7c89284Ssnj#endif 2078d522f475Smrg Atom* selection_atoms; /* which selections we own */ 20793367019cSmrg Cardinal sel_atoms_size; /* how many atoms allocated */ 2080d522f475Smrg Cardinal selection_count; /* how many atoms in use */ 2081d522f475Smrg#if OPT_SELECT_REGEX 2082d522f475Smrg char * selectExpr[NSELECTUNITS]; 2083d522f475Smrg#endif 2084d522f475Smrg /* 2085d522f475Smrg * Input/output state. 2086d522f475Smrg */ 20873367019cSmrg Boolean input_eight_bits; /* do not send ESC when meta pressed */ 20883367019cSmrg int eight_bit_meta; /* use 8th bit when meta pressed */ 20893367019cSmrg char * eight_bit_meta_s; /* ...resource eightBitMeta */ 20903367019cSmrg Boolean output_eight_bits; /* honor all bits or strip */ 20913367019cSmrg Boolean control_eight_bits; /* send CSI as 8-bits */ 2092d522f475Smrg Boolean backarrow_key; /* backspace/delete */ 2093d522f475Smrg Boolean alt_is_not_meta; /* use both Alt- and Meta-key */ 2094d522f475Smrg Boolean alt_sends_esc; /* Alt-key sends ESC prefix */ 2095d522f475Smrg Boolean meta_sends_esc; /* Meta-key sends ESC prefix */ 2096d522f475Smrg /* 2097d522f475Smrg * Fonts 2098d522f475Smrg */ 2099d522f475Smrg Pixmap menu_item_bitmap; /* mask for checking items */ 2100d522f475Smrg String initial_font; 2101d522f475Smrg String menu_font_names[NMENUFONTS][fMAX]; 2102d522f475Smrg#define MenuFontName(n) menu_font_names[n][fNorm] 2103d522f475Smrg long menu_font_sizes[NMENUFONTS]; 2104d522f475Smrg int menu_font_number; 21053367019cSmrg#if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS 2106712a7ff4Smrg Boolean savedVTFonts; 2107712a7ff4Smrg Boolean mergedVTFonts; 2108712a7ff4Smrg SubResourceRec cacheVTFonts; 2109712a7ff4Smrg#endif 2110d522f475Smrg#if OPT_CLIP_BOLD 2111d522f475Smrg Boolean use_clipping; 2112d522f475Smrg#endif 2113d522f475Smrg void * main_cgs_cache; 2114d522f475Smrg#ifndef NO_ACTIVE_ICON 2115d522f475Smrg void * icon_cgs_cache; 2116d522f475Smrg#endif 2117d522f475Smrg#if OPT_RENDERFONT 2118b7c89284Ssnj XTermXftFonts renderFontNorm[NMENUFONTS]; 2119b7c89284Ssnj XTermXftFonts renderFontBold[NMENUFONTS]; 2120b7c89284Ssnj XTermXftFonts renderFontItal[NMENUFONTS]; 2121b7c89284Ssnj#if OPT_RENDERWIDE 2122b7c89284Ssnj XTermXftFonts renderWideNorm[NMENUFONTS]; 2123b7c89284Ssnj XTermXftFonts renderWideBold[NMENUFONTS]; 2124b7c89284Ssnj XTermXftFonts renderWideItal[NMENUFONTS]; 2125b7c89284Ssnj TypedBuffer(XftCharSpec); 2126b7c89284Ssnj#else 2127b7c89284Ssnj TypedBuffer(XftChar8); 2128b7c89284Ssnj#endif 2129d522f475Smrg XftDraw * renderDraw; 2130d522f475Smrg#endif 2131d522f475Smrg#if OPT_DABBREV 2132b7c89284Ssnj Boolean dabbrev_working; /* nonzero during dabbrev process */ 2133d522f475Smrg unsigned char dabbrev_erase_char; /* used for deleting inserted completion */ 2134d522f475Smrg#endif 2135d522f475Smrg char tcapbuf[TERMCAP_SIZE]; 2136712a7ff4Smrg char tcap_area[TERMCAP_SIZE]; 2137d522f475Smrg#if OPT_TCAP_FKEYS 2138d522f475Smrg char ** tcap_fkeys; 2139d522f475Smrg#endif 2140d522f475Smrg} TScreen; 2141d522f475Smrg 2142d522f475Smrgtypedef struct _TekPart { 2143d522f475Smrg XFontStruct * Tfont[TEKNUMFONTS]; 2144d522f475Smrg int tobaseline[TEKNUMFONTS]; /* top-baseline, each font */ 2145d522f475Smrg char * initial_font; /* large, 2, 3, small */ 2146d522f475Smrg char * gin_terminator_str; /* ginTerminator resource */ 2147d522f475Smrg#if OPT_TOOLBAR 2148d522f475Smrg TbInfo tb_info; /* toolbar information */ 2149d522f475Smrg#endif 2150d522f475Smrg} TekPart; 2151d522f475Smrg 2152d522f475Smrg/* Tektronix window parameters */ 2153d522f475Smrgtypedef struct _TekScreen { 2154d522f475Smrg GC TnormalGC; /* normal painting */ 2155d522f475Smrg GC TcursorGC; /* normal cursor painting */ 2156d522f475Smrg 2157d522f475Smrg Boolean waitrefresh; /* postpone refresh */ 2158d522f475Smrg TKwin fullTwin; 2159d522f475Smrg#ifndef NO_ACTIVE_ICON 2160d522f475Smrg TKwin iconTwin; 2161d522f475Smrg TKwin *whichTwin; 2162d522f475Smrg#endif /* NO_ACTIVE_ICON */ 2163d522f475Smrg 2164d522f475Smrg Cursor arrow; /* arrow cursor */ 2165d522f475Smrg GC linepat[TEKNUMLINES]; /* line patterns */ 2166d522f475Smrg int cur_X; /* current x */ 2167d522f475Smrg int cur_Y; /* current y */ 2168d522f475Smrg Tmodes cur; /* current tek modes */ 2169d522f475Smrg Tmodes page; /* starting tek modes on page */ 2170d522f475Smrg int margin; /* 0 -> margin 1, 1 -> margin 2 */ 2171d522f475Smrg int pen; /* current Tektronix pen 0=up, 1=dn */ 2172d522f475Smrg char *TekGIN; /* nonzero if Tektronix GIN mode*/ 2173d522f475Smrg int gin_terminator; /* Tek strap option */ 2174d522f475Smrg char tcapbuf[TERMCAP_SIZE]; 2175d522f475Smrg} TekScreen; 2176d522f475Smrg 2177d522f475Smrg#if OPT_READLINE 2178d522f475Smrg#define SCREEN_FLAG(screenp,f) (1&(screenp)->f) 2179d522f475Smrg#define SCREEN_FLAG_set(screenp,f) ((screenp)->f |= 1) 2180cd3331d0Smrg#define SCREEN_FLAG_unset(screenp,f) ((screenp)->f &= (unsigned) ~1L) 2181d522f475Smrg#define SCREEN_FLAG_save(screenp,f) \ 2182d522f475Smrg ((screenp)->f = (((screenp)->f)<<1) | SCREEN_FLAG(screenp,f)) 2183d522f475Smrg#define SCREEN_FLAG_restore(screenp,f) ((screenp)->f = (((screenp)->f)>>1)) 2184d522f475Smrg#else 2185d522f475Smrg#define SCREEN_FLAG(screenp,f) (0) 2186d522f475Smrg#endif 2187d522f475Smrg 21883367019cSmrg/* 21893367019cSmrg * After screen-updates, reset the flag that tells us we should do wrapping. 21903367019cSmrg * Likewise, reset (in wide-character mode) the flag that tells us where the 21913367019cSmrg * "previous" character was written. 21923367019cSmrg */ 21933367019cSmrg#if OPT_WIDE_CHARS 21943367019cSmrg#define ResetWrap(screen) \ 21953367019cSmrg (screen)->do_wrap = \ 21963367019cSmrg (screen)->char_was_written = False 21973367019cSmrg#else 21983367019cSmrg#define ResetWrap(screen) \ 21993367019cSmrg (screen)->do_wrap = False 22003367019cSmrg#endif 22013367019cSmrg 2202d522f475Smrg/* meaning of bits in screen.select flag */ 2203d522f475Smrg#define INWINDOW 01 /* the mouse is in one of the windows */ 2204d522f475Smrg#define FOCUS 02 /* one of the windows is the focus window */ 2205d522f475Smrg 2206d522f475Smrg#define MULTICLICKTIME 250 /* milliseconds */ 2207d522f475Smrg 2208c219fbebSmrgtypedef struct { 2209c219fbebSmrg const char *name; 2210c219fbebSmrg int code; 2211c219fbebSmrg} FlagList; 2212c219fbebSmrg 2213b7c89284Ssnjtypedef enum { 2214b7c89284Ssnj fwNever = 0, 2215b7c89284Ssnj fwResource, 2216b7c89284Ssnj fwAlways 2217b7c89284Ssnj} fontWarningTypes; 2218b7c89284Ssnj 2219d522f475Smrgtypedef enum { 2220d522f475Smrg keyboardIsLegacy, /* bogus vt220 codes for F1-F4, etc. */ 2221d522f475Smrg keyboardIsDefault, 2222d522f475Smrg keyboardIsHP, 2223d522f475Smrg keyboardIsSCO, 2224d522f475Smrg keyboardIsSun, 2225d522f475Smrg keyboardIsTermcap, 2226d522f475Smrg keyboardIsVT220 2227d522f475Smrg} xtermKeyboardType; 2228d522f475Smrg 2229d522f475Smrgtypedef enum { /* legal values for screen.pointer_mode */ 22303367019cSmrg pNever = 0 22313367019cSmrg , pNoMouse = 1 22323367019cSmrg , pAlways = 2 22333367019cSmrg , pFocused = 3 2234d522f475Smrg} pointerModeTypes; 2235d522f475Smrg 2236d522f475Smrgtypedef enum { /* legal values for screen.utf8_mode */ 2237712a7ff4Smrg uFalse = 0 2238712a7ff4Smrg , uTrue = 1 2239712a7ff4Smrg , uAlways = 2 2240712a7ff4Smrg , uDefault = 3 2241712a7ff4Smrg , uLast 2242d522f475Smrg} utf8ModeTypes; 2243d522f475Smrg 22443367019cSmrgtypedef enum { /* legal values for screen.eight_bit_meta */ 22453367019cSmrg ebFalse = 0 22463367019cSmrg , ebTrue = 1 22473367019cSmrg , ebNever = 2 22483367019cSmrg , ebLocale = 3 22493367019cSmrg , ebLast 22503367019cSmrg} ebMetaModeTypes; 22513367019cSmrg 2252d522f475Smrg#if OPT_HP_FUNC_KEYS 2253d522f475Smrg#define NAME_HP_KT " hp" 2254d522f475Smrg#else 2255d522f475Smrg#define NAME_HP_KT /*nothing*/ 2256d522f475Smrg#endif 2257d522f475Smrg 2258d522f475Smrg#if OPT_SCO_FUNC_KEYS 2259d522f475Smrg#define NAME_SCO_KT " sco" 2260d522f475Smrg#else 2261d522f475Smrg#define NAME_SCO_KT /*nothing*/ 2262d522f475Smrg#endif 2263d522f475Smrg 2264d522f475Smrg#if OPT_SUN_FUNC_KEYS 2265d522f475Smrg#define NAME_SUN_KT " sun" 2266d522f475Smrg#else 2267d522f475Smrg#define NAME_SUN_KT /*nothing*/ 2268d522f475Smrg#endif 2269d522f475Smrg 2270d522f475Smrg#if OPT_SUNPC_KBD 2271d522f475Smrg#define NAME_VT220_KT " vt220" 2272d522f475Smrg#else 2273d522f475Smrg#define NAME_VT220_KT /*nothing*/ 2274d522f475Smrg#endif 2275d522f475Smrg 2276d522f475Smrg#if OPT_TCAP_FKEYS 2277d522f475Smrg#define NAME_TCAP_KT " tcap" 2278d522f475Smrg#else 2279d522f475Smrg#define NAME_TCAP_KT /*nothing*/ 2280d522f475Smrg#endif 2281d522f475Smrg 2282d522f475Smrg#define KEYBOARD_TYPES NAME_TCAP_KT NAME_HP_KT NAME_SCO_KT NAME_SUN_KT NAME_VT220_KT 2283d522f475Smrg 2284cd3331d0Smrg#if OPT_TRACE 2285cd3331d0Smrg#define TRACE_RC(code,func) code = func 2286cd3331d0Smrg#else 2287cd3331d0Smrg#define TRACE_RC(code,func) func 2288cd3331d0Smrg#endif 2289cd3331d0Smrg 2290d522f475Smrg#if OPT_TRACE 2291d522f475Smrgextern const char * visibleKeyboardType(xtermKeyboardType); 2292d522f475Smrg#endif 2293d522f475Smrg 2294d522f475Smrgtypedef struct 2295d522f475Smrg{ 22963367019cSmrg int allow_keys; /* how to handle legacy/vt220 keyboard */ 2297d522f475Smrg int cursor_keys; /* how to handle cursor-key modifiers */ 2298d522f475Smrg int function_keys; /* how to handle function-key modifiers */ 2299d522f475Smrg int keypad_keys; /* how to handle keypad key-modifiers */ 2300d522f475Smrg int other_keys; /* how to handle other key-modifiers */ 2301d522f475Smrg int string_keys; /* how to handle string() modifiers */ 2302d522f475Smrg} TModify; 2303d522f475Smrg 2304d522f475Smrgtypedef struct 2305d522f475Smrg{ 2306d522f475Smrg xtermKeyboardType type; 2307d522f475Smrg unsigned flags; 2308d522f475Smrg char *shell_translations; 2309d522f475Smrg char *xterm_translations; 2310d522f475Smrg char *extra_translations; 2311d522f475Smrg#if OPT_INITIAL_ERASE 2312d522f475Smrg int reset_DECBKM; /* reset should set DECBKM */ 2313d522f475Smrg#endif 2314d522f475Smrg#if OPT_MOD_FKEYS 2315d522f475Smrg TModify modify_now; /* current modifier value */ 2316d522f475Smrg TModify modify_1st; /* original modifier value, for resets */ 2317d522f475Smrg int format_keys; /* format of modifyOtherKeys */ 2318d522f475Smrg#endif 2319d522f475Smrg} TKeyboard; 2320d522f475Smrg 2321b7c89284Ssnj#define GravityIsNorthWest(w) ((w)->misc.resizeGravity == NorthWestGravity) 2322b7c89284Ssnj#define GravityIsSouthWest(w) ((w)->misc.resizeGravity == SouthWestGravity) 2323b7c89284Ssnj 2324d522f475Smrgtypedef struct _Misc { 2325d522f475Smrg VTFontNames default_font; 2326d522f475Smrg char *geo_metry; 2327d522f475Smrg char *T_geometry; 2328d522f475Smrg#if OPT_WIDE_CHARS 2329d522f475Smrg Boolean cjk_width; /* true for built-in CJK wcwidth() */ 2330d522f475Smrg Boolean mk_width; /* true for simpler built-in wcwidth() */ 2331d522f475Smrg int mk_samplesize; 2332d522f475Smrg int mk_samplepass; 2333d522f475Smrg#endif 2334d522f475Smrg#if OPT_LUIT_PROG 2335d522f475Smrg Boolean callfilter; /* true to invoke luit */ 2336d522f475Smrg Boolean use_encoding; /* true to use -encoding option for luit */ 2337d522f475Smrg char *locale_str; /* "locale" resource */ 2338d522f475Smrg char *localefilter; /* path for luit */ 2339d522f475Smrg#endif 2340b7c89284Ssnj fontWarningTypes fontWarnings; 2341d522f475Smrg int limit_resize; 2342d522f475Smrg#ifdef ALLOWLOGGING 2343d522f475Smrg Boolean log_on; 2344d522f475Smrg#endif 2345d522f475Smrg Boolean login_shell; 23463367019cSmrg Boolean palette_changed; 2347d522f475Smrg Boolean re_verse; 2348d522f475Smrg Boolean re_verse0; /* initial value of "-rv" */ 2349d522f475Smrg XtGravity resizeGravity; 2350d522f475Smrg Boolean reverseWrap; 2351d522f475Smrg Boolean autoWrap; 2352d522f475Smrg Boolean logInhibit; 2353d522f475Smrg Boolean signalInhibit; 2354d522f475Smrg#if OPT_TEK4014 2355d522f475Smrg Boolean tekInhibit; 2356d522f475Smrg Boolean tekSmall; /* start tek window in small size */ 2357d522f475Smrg Boolean TekEmu; /* true if Tektronix emulation */ 2358d522f475Smrg Boolean Tshow; /* Tek window showing */ 2359d522f475Smrg#endif 2360d522f475Smrg Boolean scrollbar; 2361d522f475Smrg#ifdef SCROLLBAR_RIGHT 2362d522f475Smrg Boolean useRight; 2363d522f475Smrg#endif 2364d522f475Smrg Boolean titeInhibit; 23653367019cSmrg Boolean tiXtraScroll; /* scroll on ti/te */ 23663367019cSmrg Boolean cdXtraScroll; /* scroll on cd (clear-display) */ 2367d522f475Smrg Boolean appcursorDefault; 2368d522f475Smrg Boolean appkeypadDefault; 2369d522f475Smrg#if OPT_INPUT_METHOD 2370b7c89284Ssnj char* f_x; /* font for XIM */ 2371d522f475Smrg char* input_method; 2372d522f475Smrg char* preedit_type; 2373b7c89284Ssnj Boolean open_im; /* true if input-method is opened */ 2374d522f475Smrg Boolean cannot_im; /* true if we cannot use input-method */ 2375b7c89284Ssnj int retry_im; 23763367019cSmrg XFontSet xim_fs; /* fontset for XIM preedit */ 23773367019cSmrg int xim_fs_ascent; /* ascent of fs */ 23783367019cSmrg TInput inputs[NINPUTWIDGETS]; 2379d522f475Smrg#endif 2380d522f475Smrg Boolean dynamicColors; 2381d522f475Smrg#ifndef NO_ACTIVE_ICON 23823367019cSmrg char *active_icon_s; /* use application icon window */ 2383d522f475Smrg unsigned icon_border_width; 2384d522f475Smrg Pixel icon_border_pixel; 2385d522f475Smrg#endif /* NO_ACTIVE_ICON */ 2386d522f475Smrg#if OPT_DEC_SOFTFONT 2387d522f475Smrg Boolean font_loadable; 2388d522f475Smrg#endif 2389d522f475Smrg#if OPT_SHIFT_FONTS 2390d522f475Smrg Boolean shift_fonts; /* true if we interpret fontsize-shifting */ 2391d522f475Smrg#endif 2392d522f475Smrg#if OPT_SUNPC_KBD 2393d522f475Smrg int ctrl_fkeys; /* amount to add to XK_F1 for ctrl modifier */ 2394d522f475Smrg#endif 2395d522f475Smrg#if OPT_NUM_LOCK 2396d522f475Smrg Boolean real_NumLock; /* true if we treat NumLock key specially */ 2397d522f475Smrg Boolean alwaysUseMods; /* true if we always want f-key modifiers */ 2398d522f475Smrg#endif 2399d522f475Smrg#if OPT_RENDERFONT 2400d522f475Smrg char *face_name; 2401d522f475Smrg char *face_wide_name; 2402d522f475Smrg float face_size[NMENUFONTS]; 2403cd3331d0Smrg char *render_font_s; 2404d522f475Smrg#endif 2405d522f475Smrg} Misc; 2406d522f475Smrg 24073367019cSmrgtypedef struct _Work { 24083367019cSmrg int dummy; 24093367019cSmrg#ifndef NO_ACTIVE_ICON 24103367019cSmrg int active_icon; /* use application icon window */ 24113367019cSmrg#endif /* NO_ACTIVE_ICON */ 24123367019cSmrg#if OPT_MAXIMIZE 24133367019cSmrg#define MAX_EWMH_MODE 3 24143367019cSmrg#define MAX_EWMH_DATA (1 + OPT_TEK4014) 24153367019cSmrg struct { 24163367019cSmrg int mode; /* fullscreen, etc. */ 24173367019cSmrg Boolean checked[MAX_EWMH_MODE]; 24183367019cSmrg Boolean allowed[MAX_EWMH_MODE]; 24193367019cSmrg } ewmh[MAX_EWMH_DATA]; 24203367019cSmrg#endif 24213367019cSmrg#if OPT_NUM_LOCK 24223367019cSmrg unsigned num_lock; /* modifier for Num_Lock */ 24233367019cSmrg unsigned alt_mods; /* modifier for Alt_L or Alt_R */ 24243367019cSmrg unsigned meta_mods; /* modifier for Meta_L or Meta_R */ 24253367019cSmrg#endif 24263367019cSmrg#if OPT_RENDERFONT 24273367019cSmrg Boolean render_font; 24283367019cSmrg#endif 24293367019cSmrg} Work; 24303367019cSmrg 2431d522f475Smrgtypedef struct {int foo;} XtermClassPart, TekClassPart; 2432d522f475Smrg 2433d522f475Smrgtypedef struct _XtermClassRec { 2434d522f475Smrg CoreClassPart core_class; 2435d522f475Smrg XtermClassPart xterm_class; 2436d522f475Smrg} XtermClassRec; 2437d522f475Smrg 2438d522f475Smrgextern WidgetClass xtermWidgetClass; 2439d522f475Smrg 2440d522f475Smrg#define IsXtermWidget(w) (XtClass(w) == xtermWidgetClass) 2441d522f475Smrg 2442d522f475Smrg#if OPT_TEK4014 2443d522f475Smrgtypedef struct _TekClassRec { 2444d522f475Smrg CoreClassPart core_class; 2445d522f475Smrg TekClassPart tek_class; 2446d522f475Smrg} TekClassRec; 2447d522f475Smrg 2448d522f475Smrgextern WidgetClass tekWidgetClass; 2449d522f475Smrg 2450d522f475Smrg#define IsTekWidget(w) (XtClass(w) == tekWidgetClass) 2451d522f475Smrg 2452d522f475Smrg#endif 2453d522f475Smrg 2454d522f475Smrg/* define masks for keyboard.flags */ 2455d522f475Smrg#define MODE_KAM xBIT(0) /* keyboard action mode */ 2456d522f475Smrg#define MODE_DECKPAM xBIT(1) /* keypad application mode */ 2457d522f475Smrg#define MODE_DECCKM xBIT(2) /* cursor keys */ 2458d522f475Smrg#define MODE_SRM xBIT(3) /* send-receive mode */ 2459d522f475Smrg#define MODE_DECBKM xBIT(4) /* backarrow */ 2460d522f475Smrg 2461d522f475Smrg 2462d522f475Smrg#define N_MARGINBELL 10 2463d522f475Smrg 2464d522f475Smrg#define TAB_BITS_SHIFT 5 /* FIXME: 2**5 == 32 (should derive) */ 2465d522f475Smrg#define TAB_BITS_WIDTH (1 << TAB_BITS_SHIFT) 2466d522f475Smrg#define TAB_ARRAY_SIZE (1024 / TAB_BITS_WIDTH) 2467d522f475Smrg#define MAX_TABS (TAB_BITS_WIDTH * TAB_ARRAY_SIZE) 2468d522f475Smrg 2469d522f475Smrgtypedef unsigned Tabs [TAB_ARRAY_SIZE]; 2470d522f475Smrg 2471d522f475Smrgtypedef struct _XtermWidgetRec { 2472d522f475Smrg CorePart core; 2473d522f475Smrg XSizeHints hints; 2474d522f475Smrg Bool init_menu; 2475d522f475Smrg TKeyboard keyboard; /* terminal keyboard */ 2476d522f475Smrg TScreen screen; /* terminal screen */ 2477d522f475Smrg unsigned flags; /* mode flags */ 2478d522f475Smrg int cur_foreground; /* current foreground color */ 2479d522f475Smrg int cur_background; /* current background color */ 2480d522f475Smrg Pixel dft_foreground; /* default foreground color */ 2481d522f475Smrg Pixel dft_background; /* default background color */ 2482712a7ff4Smrg Pixel old_foreground; /* original foreground color */ 2483712a7ff4Smrg Pixel old_background; /* original background color */ 2484d522f475Smrg#if OPT_ISO_COLORS 2485d522f475Smrg int sgr_foreground; /* current SGR foreground color */ 2486d522f475Smrg int sgr_background; /* current SGR background color */ 2487d522f475Smrg Boolean sgr_extended; /* SGR set with extended codes? */ 2488d522f475Smrg#endif 2489d522f475Smrg unsigned initflags; /* initial mode flags */ 2490d522f475Smrg Tabs tabs; /* tabstops of the terminal */ 2491d522f475Smrg Misc misc; /* miscellaneous parameters */ 24923367019cSmrg Work work; /* workspace (no resources) */ 2493d522f475Smrg} XtermWidgetRec, *XtermWidget; 2494d522f475Smrg 2495d522f475Smrg#if OPT_TEK4014 2496d522f475Smrgtypedef struct _TekWidgetRec { 2497d522f475Smrg CorePart core; 2498d522f475Smrg TekPart tek; /* contains resources */ 2499d522f475Smrg TekScreen screen; /* contains working data (no resources) */ 2500d522f475Smrg Bool init_menu; 2501d522f475Smrg XSizeHints hints; 2502d522f475Smrg} TekWidgetRec, *TekWidget; 2503d522f475Smrg#endif /* OPT_TEK4014 */ 2504d522f475Smrg 2505d522f475Smrg/* 2506d522f475Smrg * terminal flags 2507d522f475Smrg * There are actually two namespaces mixed together here. 2508d522f475Smrg * One is the set of flags that can go in screen->visbuf attributes 2509d522f475Smrg * and which must fit in a char (see OFF_ATTRS). 2510d522f475Smrg * The other is the global setting stored in 2511d522f475Smrg * term->flags and screen->save_modes. This need only fit in an unsigned. 2512d522f475Smrg */ 2513d522f475Smrg 2514d522f475Smrg#define AttrBIT(n) xBIT(n) /* text-attributes */ 2515d522f475Smrg#define DrawBIT(n) xBIT(n + 8) /* drawXtermText flags */ 2516d522f475Smrg#define MiscBIT(n) xBIT(n + 16) /* miscellaneous state flags */ 2517d522f475Smrg 2518d522f475Smrg/* global flags and character flags (visible character attributes) */ 2519d522f475Smrg#define INVERSE AttrBIT(0) /* invert the characters to be output */ 2520d522f475Smrg#define UNDERLINE AttrBIT(1) /* true if underlining */ 2521d522f475Smrg#define BOLD AttrBIT(2) 2522d522f475Smrg#define BLINK AttrBIT(3) 2523d522f475Smrg/* global flags (also character attributes) */ 2524d522f475Smrg#define BG_COLOR AttrBIT(4) /* true if background set */ 2525d522f475Smrg#define FG_COLOR AttrBIT(5) /* true if foreground set */ 2526d522f475Smrg 2527d522f475Smrg/* character flags (internal attributes) */ 2528d522f475Smrg#define PROTECTED AttrBIT(6) /* a character that cannot be erased */ 2529d522f475Smrg#define CHARDRAWN AttrBIT(7) /* a character has been drawn here on 2530d522f475Smrg the screen. Used to distinguish 2531d522f475Smrg blanks from empty parts of the 2532d522f475Smrg screen when selecting */ 2533d522f475Smrg 2534d522f475Smrg/* The following attributes are used in the argument of drawXtermText() */ 2535d522f475Smrg#define NOBACKGROUND DrawBIT(0) /* Used for overstrike */ 2536d522f475Smrg#define NOTRANSLATION DrawBIT(1) /* No scan for chars missing in font */ 2537d522f475Smrg#define DOUBLEWFONT DrawBIT(2) /* The actual X-font is double-width */ 2538d522f475Smrg#define DOUBLEHFONT DrawBIT(3) /* The actual X-font is double-height */ 2539d522f475Smrg#define CHARBYCHAR DrawBIT(4) /* Draw chars one-by-one */ 2540d522f475Smrg 2541d522f475Smrg/* The following attribute is used in the argument of xtermSpecialFont etc */ 2542d522f475Smrg#define NORESOLUTION DrawBIT(5) /* find the font without resolution */ 2543d522f475Smrg 2544d522f475Smrg/* 2545d522f475Smrg * Other flags 2546d522f475Smrg */ 2547d522f475Smrg#define WRAPAROUND MiscBIT(0) /* true if auto wraparound mode */ 2548d522f475Smrg#define REVERSEWRAP MiscBIT(1) /* true if reverse wraparound mode */ 2549d522f475Smrg#define REVERSE_VIDEO MiscBIT(2) /* true if screen white on black */ 2550d522f475Smrg#define LINEFEED MiscBIT(3) /* true if in auto linefeed mode */ 2551d522f475Smrg#define ORIGIN MiscBIT(4) /* true if in origin mode */ 2552d522f475Smrg#define INSERT MiscBIT(5) /* true if in insert mode */ 2553d522f475Smrg#define SMOOTHSCROLL MiscBIT(6) /* true if in smooth scroll mode */ 2554d522f475Smrg#define IN132COLUMNS MiscBIT(7) /* true if in 132 column mode */ 2555d522f475Smrg#define INVISIBLE MiscBIT(8) /* true if writing invisible text */ 2556d522f475Smrg#define NATIONAL MiscBIT(9) /* true if writing national charset */ 25573367019cSmrg#define LEFT_RIGHT MiscBIT(10) /* true if left/right margin mode */ 25583367019cSmrg#define NOCLEAR_COLM MiscBIT(11) /* true if no clear on DECCOLM change */ 2559d522f475Smrg 2560d522f475Smrg/* 2561d522f475Smrg * Groups of attributes 2562d522f475Smrg */ 2563d522f475Smrg /* mask for video-attributes only */ 2564d522f475Smrg#define SGR_MASK (BOLD | BLINK | UNDERLINE | INVERSE) 2565d522f475Smrg 2566d522f475Smrg /* mask: user-visible attributes */ 2567d522f475Smrg#define ATTRIBUTES (SGR_MASK | BG_COLOR | FG_COLOR | INVISIBLE | PROTECTED) 2568d522f475Smrg 2569d522f475Smrg/* The toplevel-call to drawXtermText() should have text-attributes guarded: */ 2570d522f475Smrg#define DRAWX_MASK (ATTRIBUTES | CHARDRAWN) 2571d522f475Smrg 2572712a7ff4Smrg/* 2573712a7ff4Smrg * BOLDATTR is not only nonzero when we will use bold font, but uses the bits 2574712a7ff4Smrg * for BOLD/BLINK to match against the video attributes which were originally 2575712a7ff4Smrg * requested. 2576712a7ff4Smrg */ 2577712a7ff4Smrg#define USE_BOLD(screen) ((screen)->allowBoldFonts) 2578712a7ff4Smrg 2579d522f475Smrg#if OPT_BLINK_TEXT 2580712a7ff4Smrg#define BOLDATTR(screen) (unsigned) (USE_BOLD(screen) ? (BOLD | ((screen)->blink_as_bold ? BLINK : 0)) : 0) 2581d522f475Smrg#else 2582712a7ff4Smrg#define BOLDATTR(screen) (unsigned) (USE_BOLD(screen) ? (BOLD | BLINK) : 0) 2583d522f475Smrg#endif 2584d522f475Smrg 2585d522f475Smrg/* 2586d522f475Smrg * Per-line flags 2587d522f475Smrg */ 2588b7c89284Ssnj#define LINEWRAPPED AttrBIT(0) 2589b7c89284Ssnj/* used once per line to indicate that it wraps onto the next line so we can 2590b7c89284Ssnj * tell the difference between lines that have wrapped around and lines that 2591b7c89284Ssnj * have ended naturally with a CR at column max_col. 2592b7c89284Ssnj */ 2593b7c89284Ssnj#define LINEBLINKED AttrBIT(1) 2594b7c89284Ssnj/* set when the line contains blinking text. 2595b7c89284Ssnj */ 2596d522f475Smrg 2597d522f475Smrg#if OPT_ZICONBEEP || OPT_TOOLBAR 2598d522f475Smrg#define HANDLE_STRUCT_NOTIFY 1 2599d522f475Smrg#else 2600d522f475Smrg#define HANDLE_STRUCT_NOTIFY 0 2601d522f475Smrg#endif 2602d522f475Smrg 2603d522f475Smrg/* 2604d522f475Smrg * If we've set protected attributes with the DEC-style DECSCA, then we'll have 2605d522f475Smrg * to use DECSED or DECSEL to erase preserving protected text. (The normal ED, 2606d522f475Smrg * EL won't preserve protected-text). If we've used SPA, then normal ED and EL 2607d522f475Smrg * will preserve protected-text. To keep things simple, just remember the last 2608d522f475Smrg * control that was used to begin protected-text, and use that to determine how 2609d522f475Smrg * erases are performed (otherwise we'd need 2 bits per protected character). 2610d522f475Smrg */ 2611d522f475Smrg#define OFF_PROTECT 0 2612d522f475Smrg#define DEC_PROTECT 1 2613d522f475Smrg#define ISO_PROTECT 2 2614d522f475Smrg 2615d522f475Smrg#define TScreenOf(xw) (&(xw)->screen) 2616d522f475Smrg#define TekScreenOf(tw) (&(tw)->screen) 2617d522f475Smrg 2618712a7ff4Smrg#define PrinterOf(screen) (screen)->printer_state 2619712a7ff4Smrg 2620d522f475Smrg#ifdef SCROLLBAR_RIGHT 2621d522f475Smrg#define OriginX(screen) (((term->misc.useRight)?0:ScrollbarWidth(screen)) + screen->border) 2622d522f475Smrg#else 2623d522f475Smrg#define OriginX(screen) (ScrollbarWidth(screen) + screen->border) 2624d522f475Smrg#endif 2625d522f475Smrg 2626d522f475Smrg#define OriginY(screen) (screen->border) 2627d522f475Smrg 2628d522f475Smrg#define CursorMoved(screen) \ 2629d522f475Smrg ((screen)->cursor_moved || \ 2630d522f475Smrg ((screen)->cursorp.col != (screen)->cur_col || \ 2631d522f475Smrg (screen)->cursorp.row != (screen)->cur_row)) 2632d522f475Smrg 26333367019cSmrg#define CursorX2(screen,col,fw) ((col) * (int)(fw) + OriginX(screen)) 26343367019cSmrg#define CursorX(screen,col) CursorX2(screen, col, FontWidth(screen)) 26353367019cSmrg#define CursorY2(screen,row) (((row) * FontHeight(screen)) + screen->border) 26363367019cSmrg#define CursorY(screen,row) CursorY2(screen, INX2ROW(screen, row)) 2637d522f475Smrg 2638d522f475Smrg/* 2639d522f475Smrg * These definitions depend on whether xterm supports active-icon. 2640d522f475Smrg */ 2641d522f475Smrg#ifndef NO_ACTIVE_ICON 2642d522f475Smrg#define IsIconWin(screen,win) ((win) == &(screen)->iconVwin) 2643d522f475Smrg#define IsIcon(screen) (WhichVWin(screen) == &(screen)->iconVwin) 2644d522f475Smrg#define WhichVWin(screen) ((screen)->whichVwin) 2645d522f475Smrg#define WhichTWin(screen) ((screen)->whichTwin) 2646d522f475Smrg 2647d522f475Smrg#define WhichVFont(screen,name) (IsIcon(screen) ? (screen)->fnt_icon.fs \ 2648d522f475Smrg : (screen)->name) 2649d522f475Smrg#define FontAscent(screen) (IsIcon(screen) ? (screen)->fnt_icon.fs->ascent \ 2650d522f475Smrg : WhichVWin(screen)->f_ascent) 2651d522f475Smrg#define FontDescent(screen) (IsIcon(screen) ? (screen)->fnt_icon.fs->descent \ 2652d522f475Smrg : WhichVWin(screen)->f_descent) 2653d522f475Smrg#else /* NO_ACTIVE_ICON */ 2654d522f475Smrg 2655d522f475Smrg#define IsIconWin(screen,win) (False) 2656d522f475Smrg#define IsIcon(screen) (False) 2657d522f475Smrg#define WhichVWin(screen) (&((screen)->fullVwin)) 2658d522f475Smrg#define WhichTWin(screen) (&((screen)->fullTwin)) 2659d522f475Smrg 2660d522f475Smrg#define WhichVFont(screen,name) ((screen)->name) 2661d522f475Smrg#define FontAscent(screen) WhichVWin(screen)->f_ascent 2662d522f475Smrg#define FontDescent(screen) WhichVWin(screen)->f_descent 2663d522f475Smrg 2664d522f475Smrg#endif /* NO_ACTIVE_ICON */ 2665d522f475Smrg 2666d522f475Smrg#define okFont(font) ((font) != 0 && (font)->fid != 0) 2667d522f475Smrg 2668d522f475Smrg/* 2669d522f475Smrg * Macro to check if we are iconified; do not use render for that case. 2670d522f475Smrg */ 26713367019cSmrg#define UsingRenderFont(xw) (((xw)->work.render_font == True) && !IsIcon(TScreenOf(xw))) 2672d522f475Smrg 2673d522f475Smrg/* 2674d522f475Smrg * These definitions do not depend on whether xterm supports active-icon. 2675d522f475Smrg */ 2676d522f475Smrg#define VWindow(screen) WhichVWin(screen)->window 2677c219fbebSmrg#define VShellWindow(xw) XtWindow(SHELL_OF(xw)) 2678d522f475Smrg#define TWindow(screen) WhichTWin(screen)->window 2679d522f475Smrg#define TShellWindow XtWindow(SHELL_OF(tekWidget)) 2680d522f475Smrg 26813367019cSmrg#if OPT_DOUBLE_BUFFER 26823367019cSmrg#define VDrawable(screen) (((screen)->needSwap=1), WhichVWin(screen)->drawable) 26833367019cSmrg#else 26843367019cSmrg#define VDrawable(screen) VWindow(screen) 26853367019cSmrg#endif 26863367019cSmrg 2687d522f475Smrg#define Width(screen) WhichVWin(screen)->width 2688d522f475Smrg#define Height(screen) WhichVWin(screen)->height 2689d522f475Smrg#define FullWidth(screen) WhichVWin(screen)->fullwidth 2690d522f475Smrg#define FullHeight(screen) WhichVWin(screen)->fullheight 2691d522f475Smrg#define FontWidth(screen) WhichVWin(screen)->f_width 2692d522f475Smrg#define FontHeight(screen) WhichVWin(screen)->f_height 2693d522f475Smrg 2694d522f475Smrg#define NormalFont(screen) WhichVFont(screen, fnts[fNorm].fs) 2695d522f475Smrg#define BoldFont(screen) WhichVFont(screen, fnts[fBold].fs) 2696d522f475Smrg 2697d522f475Smrg#if OPT_WIDE_CHARS 2698d522f475Smrg#define NormalWFont(screen) WhichVFont(screen, fnts[fWide].fs) 2699d522f475Smrg#define BoldWFont(screen) WhichVFont(screen, fnts[fWBold].fs) 2700d522f475Smrg#endif 2701d522f475Smrg 2702d522f475Smrg#define ScrollbarWidth(screen) WhichVWin(screen)->sb_info.width 2703d522f475Smrg 2704d522f475Smrg#define NormalGC(w,sp) getCgsGC(w, WhichVWin(sp), gcNorm) 2705d522f475Smrg#define ReverseGC(w,sp) getCgsGC(w, WhichVWin(sp), gcNormReverse) 2706d522f475Smrg#define NormalBoldGC(w,sp) getCgsGC(w, WhichVWin(sp), gcBold) 2707d522f475Smrg#define ReverseBoldGC(w,sp) getCgsGC(w, WhichVWin(sp), gcBoldReverse) 2708d522f475Smrg 2709d522f475Smrg#define TWidth(screen) WhichTWin(screen)->width 2710d522f475Smrg#define THeight(screen) WhichTWin(screen)->height 2711d522f475Smrg#define TFullWidth(screen) WhichTWin(screen)->fullwidth 2712d522f475Smrg#define TFullHeight(screen) WhichTWin(screen)->fullheight 2713d522f475Smrg#define TekScale(screen) WhichTWin(screen)->tekscale 2714d522f475Smrg 2715d522f475Smrg#define BorderWidth(w) ((w)->core.border_width) 2716d522f475Smrg#define BorderPixel(w) ((w)->core.border_pixel) 2717d522f475Smrg 2718cd3331d0Smrg#define AllowXtermOps(w,name) (TScreenOf(w)->name && !TScreenOf(w)->allowSendEvents) 2719cd3331d0Smrg 2720cd3331d0Smrg#define AllowColorOps(w,name) (AllowXtermOps(w, allowColorOps) || \ 2721cd3331d0Smrg !TScreenOf(w)->disallow_color_ops[name]) 2722cd3331d0Smrg 2723cd3331d0Smrg#define AllowFontOps(w,name) (AllowXtermOps(w, allowFontOps) || \ 2724cd3331d0Smrg !TScreenOf(w)->disallow_font_ops[name]) 2725cd3331d0Smrg 2726cd3331d0Smrg#define AllowTcapOps(w,name) (AllowXtermOps(w, allowTcapOps) || \ 2727cd3331d0Smrg !TScreenOf(w)->disallow_tcap_ops[name]) 2728cd3331d0Smrg 2729b7c89284Ssnj#define AllowTitleOps(w) AllowXtermOps(w, allowTitleOps) 2730cd3331d0Smrg 27313367019cSmrg#define SpecialWindowOps(w,name) (!TScreenOf(w)->disallow_win_ops[name]) 2732cd3331d0Smrg#define AllowWindowOps(w,name) (AllowXtermOps(w, allowWindowOps) || \ 27333367019cSmrg SpecialWindowOps(w,name)) 2734b7c89284Ssnj 2735d522f475Smrg#if OPT_TOOLBAR 2736d522f475Smrg#define ToolbarHeight(w) ((resource.toolBar) \ 2737c219fbebSmrg ? ((w)->VT100_TB_INFO(menu_height) \ 2738c219fbebSmrg + (w)->VT100_TB_INFO(menu_border) * 2) \ 2739d522f475Smrg : 0) 2740d522f475Smrg#else 2741d522f475Smrg#define ToolbarHeight(w) 0 2742d522f475Smrg#endif 2743d522f475Smrg 2744d522f475Smrg#if OPT_TEK4014 2745d522f475Smrg#define TEK_LINK_BLOCK_SIZE 1024 2746d522f475Smrg 2747d522f475Smrgtypedef struct Tek_Link 2748d522f475Smrg{ 2749d522f475Smrg struct Tek_Link *next; /* pointer to next TekLink in list 2750d522f475Smrg NULL <=> this is last TekLink */ 2751d522f475Smrg unsigned short fontsize;/* character size, 0-3 */ 2752d522f475Smrg unsigned short count; /* number of chars in data */ 2753d522f475Smrg char *ptr; /* current pointer into data */ 2754d522f475Smrg char data [TEK_LINK_BLOCK_SIZE]; 2755d522f475Smrg} TekLink; 2756d522f475Smrg#endif /* OPT_TEK4014 */ 2757d522f475Smrg 2758d522f475Smrg/* flags for cursors */ 2759d522f475Smrg#define OFF 0 2760d522f475Smrg#define ON 1 2761d522f475Smrg#define BLINKED_OFF 2 2762d522f475Smrg#define CLEAR 0 2763d522f475Smrg#define TOGGLE 1 2764d522f475Smrg 2765d522f475Smrg/* flags for inhibit */ 2766d522f475Smrg#ifdef ALLOWLOGGING 2767d522f475Smrg#define I_LOG 0x01 2768d522f475Smrg#endif 2769d522f475Smrg#define I_SIGNAL 0x02 2770d522f475Smrg#define I_TEK 0x04 2771d522f475Smrg 2772d522f475Smrg/***====================================================================***/ 2773d522f475Smrg 2774d522f475Smrg#if OPT_TRACE 2775d522f475Smrg#undef NDEBUG /* turn on assert's */ 2776d522f475Smrg#else 2777d522f475Smrg#ifndef NDEBUG 2778d522f475Smrg#define NDEBUG /* not debugging, don't do assert's */ 2779d522f475Smrg#endif 2780d522f475Smrg#endif 2781d522f475Smrg 27820d92cbfdSchristos#include <trace.h> 27830d92cbfdSchristos 2784d522f475Smrg#ifndef TRACE 2785d522f475Smrg#define TRACE(p) /*nothing*/ 2786d522f475Smrg#endif 2787d522f475Smrg 2788cd3331d0Smrg#ifndef TRACE_CLOSE 2789cd3331d0Smrg#define TRACE_CLOSE() /*nothing*/ 2790cd3331d0Smrg#endif 2791cd3331d0Smrg 2792d522f475Smrg#ifndef TRACE_ARGV 2793d522f475Smrg#define TRACE_ARGV(tag,argv) /*nothing*/ 2794d522f475Smrg#endif 2795d522f475Smrg 2796d522f475Smrg#ifndef TRACE_CHILD 2797d522f475Smrg#define TRACE_CHILD /*nothing*/ 2798d522f475Smrg#endif 2799d522f475Smrg 2800cd3331d0Smrg#ifndef TRACE_FOCUS 2801cd3331d0Smrg#define TRACE_FOCUS(w,e) /*nothing*/ 2802cd3331d0Smrg#endif 2803cd3331d0Smrg 2804d522f475Smrg#ifndef TRACE_HINTS 2805d522f475Smrg#define TRACE_HINTS(hints) /*nothing*/ 2806d522f475Smrg#endif 2807d522f475Smrg 2808d522f475Smrg#ifndef TRACE_IDS 2809d522f475Smrg#define TRACE_IDS /*nothing*/ 2810d522f475Smrg#endif 2811d522f475Smrg 2812d522f475Smrg#ifndef TRACE_OPTS 2813d522f475Smrg#define TRACE_OPTS(opts,ress,lens) /*nothing*/ 2814d522f475Smrg#endif 2815d522f475Smrg 2816d522f475Smrg#ifndef TRACE_TRANS 2817d522f475Smrg#define TRACE_TRANS(name,w) /*nothing*/ 2818d522f475Smrg#endif 2819d522f475Smrg 28203367019cSmrg#ifndef TRACE_WIN_ATTRS 28213367019cSmrg#define TRACE_WIN_ATTRS(w) /*nothing*/ 28223367019cSmrg#endif 28233367019cSmrg 2824d522f475Smrg#ifndef TRACE_WM_HINTS 2825d522f475Smrg#define TRACE_WM_HINTS(w) /*nothing*/ 2826d522f475Smrg#endif 2827d522f475Smrg 2828d522f475Smrg#ifndef TRACE_XRES 2829d522f475Smrg#define TRACE_XRES() /*nothing*/ 2830d522f475Smrg#endif 2831d522f475Smrg 2832d522f475Smrg#ifndef TRACE2 2833d522f475Smrg#define TRACE2(p) /*nothing*/ 2834d522f475Smrg#endif 2835d522f475Smrg 28363367019cSmrg#if OPT_TRACE && !defined(DEBUG) 28373367019cSmrg#define DEBUG 1 28383367019cSmrg#endif 28393367019cSmrg 28403367019cSmrg#ifdef DEBUG 28413367019cSmrg#define if_DEBUG(code) if(debug) code 28423367019cSmrg#else 28433367019cSmrg#define if_DEBUG(code) /*nothing*/ 28443367019cSmrg#endif 28453367019cSmrg 28463367019cSmrg#define DEBUG_MSG(text) if_DEBUG({ IGNORE_RC(write(2, text, sizeof(text) - 1)); }) 28473367019cSmrg 2848c219fbebSmrg/* *INDENT-ON* */ 2849c219fbebSmrg 2850d522f475Smrg#endif /* included_ptyx_h */ 2851