ptyx.h revision 980988ae
1980988aeSmrg/* $XTermId: ptyx.h,v 1.1124 2024/05/21 23:30:59 tom Exp $ */ 2d522f475Smrg 3d522f475Smrg/* 4980988aeSmrg * Copyright 1999-2023,2024 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(). */ 708f44fb3bSmrg#include <X11/cursorfont.h> 718f44fb3bSmrg 723367019cSmrg 733367019cSmrg#undef bcopy 743367019cSmrg#undef bzero 75d522f475Smrg#include <X11/Xfuncs.h> 763367019cSmrg 77d522f475Smrg#include <X11/Xosdefs.h> 78d522f475Smrg#include <X11/Xmu/Converters.h> 79d522f475Smrg#ifdef XRENDERFONT 80d522f475Smrg#include <X11/Xft/Xft.h> 81d522f475Smrg#endif 82d522f475Smrg 83712a7ff4Smrg#include <stdio.h> 84d1603babSmrg#include <limits.h> 85712a7ff4Smrg 86d4fba8b9Smrg#if defined(HAVE_STDINT_H) || !defined(HAVE_CONFIG_H) 87fa3f02f3Smrg#include <stdint.h> 88fa3f02f3Smrg#define DECONST(type,s) ((type *)(intptr_t)(const type *)(s)) 89fa3f02f3Smrg#else 90fa3f02f3Smrg#define DECONST(type,s) ((type *)(s)) 91fa3f02f3Smrg#endif 92fa3f02f3Smrg 93d522f475Smrg/* adapted from IntrinsicI.h */ 94d522f475Smrg#define MyStackAlloc(size, stack_cache_array) \ 95d522f475Smrg ((size) <= sizeof(stack_cache_array) \ 96d1603babSmrg ? (stack_cache_array) \ 97d1603babSmrg : (char*)malloc((size_t)(size))) 98d522f475Smrg 99d522f475Smrg#define MyStackFree(pointer, stack_cache_array) \ 100d522f475Smrg if ((pointer) != ((char *)(stack_cache_array))) free(pointer) 101d522f475Smrg 102d522f475Smrg/* adapted from vile (vi-like-emacs) */ 103cd3331d0Smrg#define TypeCallocN(type,n) (type *)calloc((size_t) (n), sizeof(type)) 104cd3331d0Smrg#define TypeCalloc(type) TypeCallocN(type, 1) 105d522f475Smrg 106cd3331d0Smrg#define TypeMallocN(type,n) (type *)malloc(sizeof(type) * (size_t) (n)) 107cd3331d0Smrg#define TypeMalloc(type) TypeMallocN(type, 1) 108d522f475Smrg 109d522f475Smrg#define TypeRealloc(type,n,p) (type *)realloc(p, (n) * sizeof(type)) 110d522f475Smrg 111c219fbebSmrg#define TypeXtReallocN(t,p,n) (t *)(void *)XtRealloc((char *)(p), (Cardinal)(sizeof(t) * (size_t) (n))) 112c219fbebSmrg 113c219fbebSmrg#define TypeXtMallocX(type,n) (type *)(void *)XtMalloc((Cardinal)(sizeof(type) + (size_t) (n))) 114c219fbebSmrg#define TypeXtMallocN(type,n) (type *)(void *)XtMalloc((Cardinal)(sizeof(type) * (size_t) (n))) 115c219fbebSmrg#define TypeXtMalloc(type) TypeXtMallocN(type, 1) 116c219fbebSmrg 117dfb07bc7Smrg#define CastMalloc(type) (type *)malloc(sizeof(type)) 118d522f475Smrg 119b7c89284Ssnj#define BumpBuffer(type, buffer, size, want) \ 120b7c89284Ssnj if (want >= size) { \ 121b7c89284Ssnj size = 1 + (want * 2); \ 122b7c89284Ssnj buffer = TypeRealloc(type, size, buffer); \ 123b7c89284Ssnj } 124b7c89284Ssnj 125b7c89284Ssnj#define BfBuf(type) screen->bf_buf_##type 126b7c89284Ssnj#define BfLen(type) screen->bf_len_##type 127b7c89284Ssnj 128b7c89284Ssnj#define TypedBuffer(type) \ 129b7c89284Ssnj type *bf_buf_##type; \ 130b7c89284Ssnj Cardinal bf_len_##type 131b7c89284Ssnj 132b7c89284Ssnj#define BumpTypedBuffer(type, want) \ 133b7c89284Ssnj BumpBuffer(type, BfBuf(type), BfLen(type), want) 134b7c89284Ssnj 135b7c89284Ssnj#define FreeTypedBuffer(type) \ 136d4fba8b9Smrg do { \ 137d4fba8b9Smrg FreeAndNull(BfBuf(type)); \ 138d4fba8b9Smrg BfLen(type) = 0; \ 139d4fba8b9Smrg } while (0) 140d4fba8b9Smrg 141d4fba8b9Smrg#define FreeAndNull(value) \ 142d4fba8b9Smrg do { \ 143d4fba8b9Smrg free((void *)(value)); \ 144d4fba8b9Smrg value = NULL; \ 145d4fba8b9Smrg } while (0) 146b7c89284Ssnj 147d522f475Smrg/* 148d522f475Smrg** System V definitions 149d522f475Smrg*/ 150d522f475Smrg 151d522f475Smrg#ifdef att 152d522f475Smrg#define ATT 153d522f475Smrg#endif 154d522f475Smrg 155d522f475Smrg#ifdef SVR4 156d522f475Smrg#undef SYSV /* predefined on Solaris 2.4 */ 157d522f475Smrg#define SYSV /* SVR4 is (approx) superset of SVR3 */ 158d522f475Smrg#define ATT 159d522f475Smrg#endif 160d522f475Smrg 161d522f475Smrg#ifdef SYSV 162d522f475Smrg#ifdef X_NOT_POSIX 163d522f475Smrg#if !defined(CRAY) && !defined(SVR4) 164d522f475Smrg#define dup2(fd1,fd2) ((fd1 == fd2) ? fd1 : \ 165d522f475Smrg (close(fd2), fcntl(fd1, F_DUPFD, fd2))) 166d522f475Smrg#endif 167d522f475Smrg#endif 168d522f475Smrg#endif /* SYSV */ 169d522f475Smrg 170d522f475Smrg/* 171d522f475Smrg * Newer versions of <X11/Xft/Xft.h> have a version number. We use certain 172d522f475Smrg * features from that. 173d522f475Smrg */ 174d522f475Smrg#if defined(XRENDERFONT) && defined(XFT_VERSION) && XFT_VERSION >= 20100 175d522f475Smrg#define HAVE_TYPE_FCCHAR32 1 /* compatible: XftChar16 */ 176d522f475Smrg#define HAVE_TYPE_XFTCHARSPEC 1 /* new type XftCharSpec */ 177d522f475Smrg#endif 178d522f475Smrg 179d522f475Smrg/* 180d522f475Smrg** Definitions to simplify ifdef's for pty's. 181d522f475Smrg*/ 182d522f475Smrg#define USE_PTY_DEVICE 1 183d522f475Smrg#define USE_PTY_SEARCH 1 184d522f475Smrg 185b7c89284Ssnj#if defined(__osf__) || (defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) 186d522f475Smrg#undef USE_PTY_DEVICE 187d522f475Smrg#undef USE_PTY_SEARCH 188d522f475Smrg#define USE_PTS_DEVICE 1 189d522f475Smrg#elif defined(VMS) 190d522f475Smrg#undef USE_PTY_DEVICE 191d522f475Smrg#undef USE_PTY_SEARCH 192d522f475Smrg#elif defined(PUCC_PTYD) 193d522f475Smrg#undef USE_PTY_SEARCH 194d522f475Smrg#elif (defined(sun) && defined(SVR4)) || defined(_ALL_SOURCE) || defined(__CYGWIN__) 195d522f475Smrg#undef USE_PTY_SEARCH 1963367019cSmrg#elif defined(__OpenBSD__) 1973367019cSmrg#undef USE_PTY_SEARCH 1983367019cSmrg#undef USE_PTY_DEVICE 199d522f475Smrg#endif 200d522f475Smrg 2013367019cSmrg#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) 2023367019cSmrg#define USE_HANDSHAKE 0 /* "recent" Linux systems do not require handshaking */ 203d522f475Smrg#endif 204d522f475Smrg 205d522f475Smrg#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) 206d522f475Smrg#define USE_USG_PTYS 207d522f475Smrg#elif (defined(ATT) && !defined(__sgi)) || defined(__MVS__) || (defined(SYSV) && defined(i386)) 208d522f475Smrg#define USE_USG_PTYS 209d522f475Smrg#endif 210d522f475Smrg 211d522f475Smrg/* 212d522f475Smrg * More systems than not require pty-handshaking. 213d522f475Smrg */ 214d522f475Smrg#ifndef USE_HANDSHAKE 215d522f475Smrg#define USE_HANDSHAKE 1 216d522f475Smrg#endif 217d522f475Smrg 218d522f475Smrg/* 219d522f475Smrg** allow for mobility of the pty master/slave directories 220d522f475Smrg*/ 221d522f475Smrg#ifndef PTYDEV 222d522f475Smrg#if defined(__hpux) 223d522f475Smrg#define PTYDEV "/dev/ptym/ptyxx" 224d522f475Smrg#elif defined(__MVS__) 225d522f475Smrg#define PTYDEV "/dev/ptypxxxx" 226d522f475Smrg#else 227d522f475Smrg#define PTYDEV "/dev/ptyxx" 228d522f475Smrg#endif 229d522f475Smrg#endif /* !PTYDEV */ 230d522f475Smrg 231d522f475Smrg#ifndef TTYDEV 232d522f475Smrg#if defined(__hpux) 233d522f475Smrg#define TTYDEV "/dev/pty/ttyxx" 234d522f475Smrg#elif defined(__MVS__) 235d522f475Smrg#define TTYDEV "/dev/ptypxxxx" 236d522f475Smrg#elif defined(USE_PTS_DEVICE) 237d522f475Smrg#define TTYDEV "/dev/pts/0" 238d522f475Smrg#else 239d522f475Smrg#define TTYDEV "/dev/ttyxx" 240d522f475Smrg#endif 241d522f475Smrg#endif /* !TTYDEV */ 242d522f475Smrg 243d522f475Smrg#ifndef PTYCHAR1 244d522f475Smrg#ifdef __hpux 245d522f475Smrg#define PTYCHAR1 "zyxwvutsrqp" 246d522f475Smrg#else /* !__hpux */ 247d522f475Smrg#define PTYCHAR1 "pqrstuvwxyzPQRSTUVWXYZ" 248d522f475Smrg#endif /* !__hpux */ 249d522f475Smrg#endif /* !PTYCHAR1 */ 250d522f475Smrg 251d522f475Smrg#ifndef PTYCHAR2 252d522f475Smrg#ifdef __hpux 253d522f475Smrg#define PTYCHAR2 "fedcba9876543210" 254d522f475Smrg#else /* !__hpux */ 255d522f475Smrg#if defined(__DragonFly__) || defined(__FreeBSD__) 256d522f475Smrg#define PTYCHAR2 "0123456789abcdefghijklmnopqrstuv" 257d522f475Smrg#else /* !__FreeBSD__ */ 258d522f475Smrg#define PTYCHAR2 "0123456789abcdef" 259d522f475Smrg#endif /* !__FreeBSD__ */ 260d522f475Smrg#endif /* !__hpux */ 261d522f475Smrg#endif /* !PTYCHAR2 */ 262d522f475Smrg 263d522f475Smrg#ifndef TTYFORMAT 264d522f475Smrg#if defined(CRAY) 265d522f475Smrg#define TTYFORMAT "/dev/ttyp%03d" 266d522f475Smrg#elif defined(__MVS__) 267d522f475Smrg#define TTYFORMAT "/dev/ttyp%04d" 268d522f475Smrg#else 269d522f475Smrg#define TTYFORMAT "/dev/ttyp%d" 270d522f475Smrg#endif 271d522f475Smrg#endif /* TTYFORMAT */ 272d522f475Smrg 273d522f475Smrg#ifndef PTYFORMAT 274d522f475Smrg#ifdef CRAY 275d522f475Smrg#define PTYFORMAT "/dev/pty/%03d" 276d522f475Smrg#elif defined(__MVS__) 277d522f475Smrg#define PTYFORMAT "/dev/ptyp%04d" 278d522f475Smrg#else 279d522f475Smrg#define PTYFORMAT "/dev/ptyp%d" 280d522f475Smrg#endif 281d522f475Smrg#endif /* PTYFORMAT */ 282d522f475Smrg 283d522f475Smrg#ifndef PTYCHARLEN 284d522f475Smrg#ifdef CRAY 285d522f475Smrg#define PTYCHARLEN 3 286d522f475Smrg#elif defined(__MVS__) 287d522f475Smrg#define PTYCHARLEN 8 /* OS/390 stores, e.g. ut_id="ttyp1234" */ 288d522f475Smrg#else 289d522f475Smrg#define PTYCHARLEN 2 290d522f475Smrg#endif 291d522f475Smrg#endif 292d522f475Smrg 293d522f475Smrg#ifndef MAXPTTYS 294d522f475Smrg#ifdef CRAY 295d522f475Smrg#define MAXPTTYS 256 296d522f475Smrg#else 297d522f475Smrg#define MAXPTTYS 2048 298d522f475Smrg#endif 299d522f475Smrg#endif 300d522f475Smrg 301d522f475Smrg/* Until the translation manager comes along, I have to do my own translation of 302d522f475Smrg * mouse events into the proper routines. */ 303d522f475Smrg 304d522f475Smrgtypedef enum { 305d522f475Smrg NORMAL = 0 306d522f475Smrg , LEFTEXTENSION 307d522f475Smrg , RIGHTEXTENSION 308d522f475Smrg} EventMode; 309d522f475Smrg 310d522f475Smrg/* 311d522f475Smrg * The origin of a screen is 0, 0. Therefore, the number of rows 312d522f475Smrg * on a screen is screen->max_row + 1, and similarly for columns. 313d522f475Smrg */ 314d522f475Smrg#define MaxCols(screen) ((screen)->max_col + 1) 315d522f475Smrg#define MaxRows(screen) ((screen)->max_row + 1) 316d522f475Smrg 317d1603babSmrg#define MaxUChar 255 318d522f475Smrgtypedef unsigned char Char; /* to support 8 bit chars */ 319d522f475Smrgtypedef Char *ScrnPtr; 320d522f475Smrgtypedef ScrnPtr *ScrnBuf; 321d522f475Smrg 322cd3331d0Smrg/* 323cd3331d0Smrg * Declare an X String, but for unsigned chars. 324cd3331d0Smrg */ 325cd3331d0Smrg#ifdef _CONST_X_STRING 326cd3331d0Smrgtypedef const Char *UString; 327cd3331d0Smrg#else 328cd3331d0Smrgtypedef Char *UString; 329cd3331d0Smrg#endif 330cd3331d0Smrg 331cd3331d0Smrg#define IsEmpty(s) ((s) == 0 || *(s) == '\0') 3329a64e1c5Smrg#define IsSpace(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n') 333cd3331d0Smrg 334037a25ddSmrg/* 335037a25ddSmrg * Check strtol result, using "FullS2L" when no more data is expected, and 336037a25ddSmrg * "PartS2L" when more data may follow in the string. 337037a25ddSmrg */ 338037a25ddSmrg#define FullS2L(s,d) (PartS2L(s,d) && (*(d) == '\0')) 339037a25ddSmrg#define PartS2L(s,d) (isdigit(CharOf(*(s))) && (d) != (s) && (d) != 0) 340037a25ddSmrg 341037a25ddSmrg#define CASETYPE(name) case name: result = #name; break 342037a25ddSmrg 343fa3f02f3Smrg#define CharOf(n) ((Char)(n)) 344d522f475Smrg 345d522f475Smrgtypedef struct { 346d522f475Smrg int row; 347d522f475Smrg int col; 348d522f475Smrg} CELL; 349d522f475Smrg 350d4fba8b9Smrgtypedef struct { 351d4fba8b9Smrg Char *data_buffer; /* the current selection */ 352d4fba8b9Smrg size_t data_limit; /* size of allocated buffer */ 353d4fba8b9Smrg size_t data_length; /* number of significant bytes */ 354d4fba8b9Smrg} SelectedCells; 355d4fba8b9Smrg 356d522f475Smrg#define isSameRow(a,b) ((a)->row == (b)->row) 357d522f475Smrg#define isSameCol(a,b) ((a)->col == (b)->col) 358d522f475Smrg#define isSameCELL(a,b) (isSameRow(a,b) && isSameCol(a,b)) 359d522f475Smrg 360d522f475Smrg#define xBIT(n) (1 << (n)) 361d522f475Smrg 362d522f475Smrg/* 363d522f475Smrg * ANSI emulation, special character codes 364d522f475Smrg */ 365cd3331d0Smrg#define ANSI_EOT 0x04 366d522f475Smrg#define ANSI_BEL 0x07 367cd3331d0Smrg#define ANSI_BS 0x08 368cd3331d0Smrg#define ANSI_HT 0x09 369cd3331d0Smrg#define ANSI_LF 0x0A 370cd3331d0Smrg#define ANSI_VT 0x0B 371d522f475Smrg#define ANSI_FF 0x0C /* C0, C1 control names */ 372cd3331d0Smrg#define ANSI_CR 0x0D 373cd3331d0Smrg#define ANSI_SO 0x0E 374cd3331d0Smrg#define ANSI_SI 0x0F 375cd3331d0Smrg#define ANSI_XON 0x11 /* DC1 */ 376cd3331d0Smrg#define ANSI_XOFF 0x13 /* DC3 */ 377d522f475Smrg#define ANSI_NAK 0x15 378d522f475Smrg#define ANSI_CAN 0x18 379d522f475Smrg#define ANSI_ESC 0x1B 380d522f475Smrg#define ANSI_SPA 0x20 381d522f475Smrg#define XTERM_POUND 0x1E /* internal mapping for '#' */ 382d522f475Smrg#define ANSI_DEL 0x7F 383d522f475Smrg#define ANSI_SS2 0x8E 384d522f475Smrg#define ANSI_SS3 0x8F 385d522f475Smrg#define ANSI_DCS 0x90 386d522f475Smrg#define ANSI_SOS 0x98 387d522f475Smrg#define ANSI_CSI 0x9B 388d522f475Smrg#define ANSI_ST 0x9C 389d522f475Smrg#define ANSI_OSC 0x9D 390d522f475Smrg#define ANSI_PM 0x9E 391d522f475Smrg#define ANSI_APC 0x9F 392980988aeSmrg#define XTERM_PUA 0xEEEE /* internal mapping for DEC Technical */ 393d522f475Smrg 394d4fba8b9Smrg#define BAD_ASCII '?' 395d4fba8b9Smrg#define NonLatin1(c) (((c) != ANSI_LF) && \ 396d4fba8b9Smrg ((c) != ANSI_HT) && \ 397d4fba8b9Smrg (((c) < ANSI_SPA) || \ 398d4fba8b9Smrg ((c) >= ANSI_DEL && (c) <= ANSI_APC))) 399d4fba8b9Smrg#define OnlyLatin1(c) (NonLatin1(c) ? BAD_ASCII : (c)) 400d4fba8b9Smrg 401d1603babSmrg#define L_BLOK '[' 402d1603babSmrg#define R_BLOK ']' 403d1603babSmrg 40494644356Smrg#define L_CURL '{' 40594644356Smrg#define R_CURL '}' 40694644356Smrg 407d522f475Smrg#define MIN_DECID 52 /* can emulate VT52 */ 4083367019cSmrg#define MAX_DECID 525 /* ...through VT525 */ 409d522f475Smrg 410d522f475Smrg#ifndef DFT_DECID 411d4fba8b9Smrg#define DFT_DECID "420" /* default VT420 */ 412d522f475Smrg#endif 413d522f475Smrg 414d522f475Smrg#ifndef DFT_KBD_DIALECT 415d522f475Smrg#define DFT_KBD_DIALECT "B" /* default USASCII */ 416d522f475Smrg#endif 417d522f475Smrg 4188f44fb3bSmrg#define MAX_I_PARAM 65535 /* parameters */ 4198f44fb3bSmrg#define MAX_I_DELAY 32767 /* time-delay in ReGIS */ 4208f44fb3bSmrg#define MAX_U_COLOR 65535u /* colors */ 4218f44fb3bSmrg#define MAX_U_COORD 32767u /* coordinates */ 4228f44fb3bSmrg#define MAX_U_STRING 65535u /* string-length */ 4238f44fb3bSmrg 424d522f475Smrg/* constants used for utf8 mode */ 425d522f475Smrg#define UCS_REPL 0xfffd 426d522f475Smrg#define UCS_LIMIT 0x80000000U /* both limit and flag for non-UCS */ 427d522f475Smrg 428d522f475Smrg#define TERMCAP_SIZE 1500 /* 1023 is standard; 'screen' exceeds */ 429d522f475Smrg 430dfb07bc7Smrg#define MAX_XLFD_FONTS 1 431d1603babSmrg#define MAX_XFT_FONTS 2 432d4fba8b9Smrg#define NMENUFONTS 10 /* font entries in fontMenu */ 433d522f475Smrg 434d522f475Smrg#define NBOX 5 /* Number of Points in box */ 435d522f475Smrg#define NPARAM 30 /* Max. parameters */ 436d522f475Smrg 437d522f475Smrgtypedef struct { 438cd3331d0Smrg String opt; 439cd3331d0Smrg String desc; 440d522f475Smrg} OptionHelp; 441d522f475Smrg 4423367019cSmrgtypedef struct { 4433367019cSmrg int count; /* number of values in params[] */ 4443367019cSmrg int has_subparams; /* true if there are any sub's */ 4453367019cSmrg int is_sub[NPARAM]; /* true for subparam */ 4463367019cSmrg int params[NPARAM]; /* parameter value */ 4473367019cSmrg} PARAMS; 4483367019cSmrg 4490d92cbfdSchristostypedef short ParmType; 450d4fba8b9Smrgtypedef unsigned short UParm; /* unparseputn passes ParmType */ 4510d92cbfdSchristos 452d1603babSmrg#define MaxSParm 0x7fff /* limit if a signed value is needed */ 453d1603babSmrg#define MaxUParm 0xffff /* limit if unsigned value is needed */ 454d1603babSmrg 455d1603babSmrg#define SParmOf(n) ((int)(ParmType)(n)) 456d1603babSmrg#define UParmOf(n) ((unsigned)(UParm)(n)) 457d1603babSmrg 458d522f475Smrgtypedef struct { 4590d92cbfdSchristos Char a_type; /* CSI, etc., see unparseq() */ 4600d92cbfdSchristos Char a_pintro; /* private-mode char, if any */ 4613367019cSmrg const char * a_delim; /* between parameters (;) */ 4620d92cbfdSchristos Char a_inters; /* special (before final-char) */ 4630d92cbfdSchristos Char a_final; /* final-char */ 4640d92cbfdSchristos ParmType a_nparam; /* # of parameters */ 4650d92cbfdSchristos ParmType a_param[NPARAM]; /* Parameters */ 4663367019cSmrg Char a_radix[NPARAM]; /* Parameters */ 467d522f475Smrg} ANSI; 468d522f475Smrg 469d522f475Smrg#define TEK_FONT_LARGE 0 470d522f475Smrg#define TEK_FONT_2 1 471d522f475Smrg#define TEK_FONT_3 2 472d522f475Smrg#define TEK_FONT_SMALL 3 473d522f475Smrg#define TEKNUMFONTS 4 474d522f475Smrg 475d522f475Smrg/* Actually there are 5 types of lines, but four are non-solid lines */ 476d522f475Smrg#define TEKNUMLINES 4 477d522f475Smrg 478d522f475Smrgtypedef struct { 479d522f475Smrg int x; 480d522f475Smrg int y; 481d522f475Smrg int fontsize; 482d522f475Smrg unsigned linetype; 483d522f475Smrg} Tmodes; 484d522f475Smrg 485d522f475Smrgtypedef struct { 486d522f475Smrg int Twidth; 487d522f475Smrg int Theight; 488d522f475Smrg} T_fontsize; 489d522f475Smrg 490d522f475Smrgtypedef struct { 491d522f475Smrg short *bits; 492d522f475Smrg int x; 493d522f475Smrg int y; 494d522f475Smrg int width; 495d522f475Smrg int height; 496d522f475Smrg} BitmapBits; 497d522f475Smrg 498980988aeSmrg/* bit-assignments for extensions to DECRQCRA, to omit DEC features */ 499d4fba8b9Smrgtypedef enum { 500d4fba8b9Smrg csDEC = 0 501980988aeSmrg ,csPOSITIVE = xBIT(0) /* do not negate the result */ 502980988aeSmrg ,csATTRIBS = xBIT(1) /* do not report the VT100 video attributes */ 503980988aeSmrg ,csNOTRIM = xBIT(2) /* do not omit checksum for blanks */ 504980988aeSmrg ,csDRAWN = xBIT(3) /* do not skip uninitialized cells */ 505980988aeSmrg ,csBYTE = xBIT(4) /* do not mask cell value to 8 bits or ignore combining chars */ 506d4fba8b9Smrg} CSBITS; 507d522f475Smrg 508d522f475Smrg#define EXCHANGE(a,b,tmp) tmp = a; a = b; b = tmp 509d522f475Smrg 510d522f475Smrg/***====================================================================***/ 511d522f475Smrg 512d522f475Smrg#if (XtSpecificationRelease < 6) 513d522f475Smrg#ifndef NO_ACTIVE_ICON 514d522f475Smrg#define NO_ACTIVE_ICON 1 /* Note: code relies on an X11R6 function */ 515d522f475Smrg#endif 516d522f475Smrg#endif 517d522f475Smrg 518d522f475Smrg#ifndef OPT_AIX_COLORS 519d522f475Smrg#define OPT_AIX_COLORS 1 /* true if xterm is configured with AIX (16) colors */ 520d522f475Smrg#endif 521d522f475Smrg 522b7c89284Ssnj#ifndef OPT_ALLOW_XXX_OPS 523b7c89284Ssnj#define OPT_ALLOW_XXX_OPS 1 /* true if xterm adds "Allow XXX Ops" submenu */ 524b7c89284Ssnj#endif 525b7c89284Ssnj 526d522f475Smrg#ifndef OPT_BLINK_CURS 527d522f475Smrg#define OPT_BLINK_CURS 1 /* true if xterm has blinking cursor capability */ 528d522f475Smrg#endif 529d522f475Smrg 530d522f475Smrg#ifndef OPT_BLINK_TEXT 531d522f475Smrg#define OPT_BLINK_TEXT OPT_BLINK_CURS /* true if xterm has blinking text capability */ 532d522f475Smrg#endif 533d522f475Smrg 534d522f475Smrg#ifndef OPT_BOX_CHARS 535d522f475Smrg#define OPT_BOX_CHARS 1 /* true if xterm can simulate box-characters */ 536d522f475Smrg#endif 537d522f475Smrg 5383367019cSmrg#ifndef OPT_BUILTIN_XPMS 5393367019cSmrg#define OPT_BUILTIN_XPMS 0 /* true if all xpm data is compiled-in */ 5403367019cSmrg#endif 5413367019cSmrg 542d522f475Smrg#ifndef OPT_BROKEN_OSC 543d522f475Smrg#ifdef linux 544d522f475Smrg#define OPT_BROKEN_OSC 1 /* man console_codes, 1st paragraph - cf: ECMA-48 */ 545d522f475Smrg#else 546d522f475Smrg#define OPT_BROKEN_OSC 0 /* true if xterm allows Linux's broken OSC parsing */ 547d522f475Smrg#endif 548d522f475Smrg#endif 549d522f475Smrg 550d522f475Smrg#ifndef OPT_BROKEN_ST 551d522f475Smrg#define OPT_BROKEN_ST 1 /* true if xterm allows old/broken OSC parsing */ 552d522f475Smrg#endif 553d522f475Smrg 554d522f475Smrg#ifndef OPT_C1_PRINT 555d522f475Smrg#define OPT_C1_PRINT 1 /* true if xterm allows C1 controls to be printable */ 556d522f475Smrg#endif 557d522f475Smrg 558d522f475Smrg#ifndef OPT_CLIP_BOLD 559d522f475Smrg#define OPT_CLIP_BOLD 1 /* true if xterm uses clipping to avoid bold-trash */ 560d522f475Smrg#endif 561d522f475Smrg 562d522f475Smrg#ifndef OPT_COLOR_CLASS 563d522f475Smrg#define OPT_COLOR_CLASS 1 /* true if xterm uses separate color-resource classes */ 564d522f475Smrg#endif 565d522f475Smrg 566d522f475Smrg#ifndef OPT_DABBREV 567d522f475Smrg#define OPT_DABBREV 0 /* dynamic abbreviations */ 568d522f475Smrg#endif 569d522f475Smrg 570d522f475Smrg#ifndef OPT_DEC_CHRSET 571d522f475Smrg#define OPT_DEC_CHRSET 1 /* true if xterm is configured for DEC charset */ 572d522f475Smrg#endif 573d522f475Smrg 574d522f475Smrg#ifndef OPT_DEC_LOCATOR 575d522f475Smrg#define OPT_DEC_LOCATOR 0 /* true if xterm supports VT220-style mouse events */ 576d522f475Smrg#endif 577d522f475Smrg 578d522f475Smrg#ifndef OPT_DEC_RECTOPS 579d4fba8b9Smrg#define OPT_DEC_RECTOPS 1 /* true if xterm is configured for VT420 rectangles */ 580d522f475Smrg#endif 581d522f475Smrg 582d1603babSmrg#ifndef OPT_SGR2_HASH 583d1603babSmrg#define OPT_SGR2_HASH 1 /* true if xterm hashes color-lookups for faint color */ 584d1603babSmrg#endif 585d1603babSmrg 586fa3f02f3Smrg#ifndef OPT_SIXEL_GRAPHICS 5879a64e1c5Smrg#define OPT_SIXEL_GRAPHICS 0 /* true if xterm supports VT240-style sixel graphics */ 5889a64e1c5Smrg#endif 5899a64e1c5Smrg 590d4fba8b9Smrg#ifndef OPT_PRINT_GRAPHICS 591d4fba8b9Smrg#define OPT_PRINT_GRAPHICS 0 /* true if xterm supports screen dumps as sixel graphics */ 592d4fba8b9Smrg#endif 593d4fba8b9Smrg 594037a25ddSmrg#ifndef OPT_SCREEN_DUMPS 595d4fba8b9Smrg#define OPT_SCREEN_DUMPS 1 /* true if xterm supports screen dumps */ 596037a25ddSmrg#endif 597037a25ddSmrg 5989a64e1c5Smrg#ifndef OPT_REGIS_GRAPHICS 5999a64e1c5Smrg#define OPT_REGIS_GRAPHICS 0 /* true if xterm supports VT125/VT240/VT330 ReGIS graphics */ 6009a64e1c5Smrg#endif 6019a64e1c5Smrg 6029a64e1c5Smrg#ifndef OPT_GRAPHICS 6039a64e1c5Smrg#define OPT_GRAPHICS 0 /* true if xterm is configured for any type of graphics */ 604fa3f02f3Smrg#endif 605fa3f02f3Smrg 606d522f475Smrg#ifndef OPT_DEC_SOFTFONT 607d522f475Smrg#define OPT_DEC_SOFTFONT 0 /* true if xterm is configured for VT220 softfonts */ 608d522f475Smrg#endif 609d522f475Smrg 6103367019cSmrg#ifndef OPT_DOUBLE_BUFFER 6113367019cSmrg#define OPT_DOUBLE_BUFFER 0 /* true if using double-buffering */ 6123367019cSmrg#endif 6133367019cSmrg 614d522f475Smrg#ifndef OPT_EBCDIC 615d522f475Smrg#ifdef __MVS__ 616d522f475Smrg#define OPT_EBCDIC 1 617d522f475Smrg#else 618d522f475Smrg#define OPT_EBCDIC 0 619d522f475Smrg#endif 620d522f475Smrg#endif 621d522f475Smrg 622d1603babSmrg#ifndef OPT_EXEC_SELECTION 623d1603babSmrg#define OPT_EXEC_SELECTION 1 /* true if xterm can exec to process selection */ 624d1603babSmrg#endif 625d1603babSmrg 626d522f475Smrg#ifndef OPT_EXEC_XTERM 627d522f475Smrg#define OPT_EXEC_XTERM 0 /* true if xterm can fork/exec copies of itself */ 628d522f475Smrg#endif 629d522f475Smrg 630d522f475Smrg#ifndef OPT_EXTRA_PASTE 631d522f475Smrg#define OPT_EXTRA_PASTE 1 632d522f475Smrg#endif 633d522f475Smrg 634d522f475Smrg#ifndef OPT_FOCUS_EVENT 635d522f475Smrg#define OPT_FOCUS_EVENT 1 /* focus in/out events */ 636d522f475Smrg#endif 637d522f475Smrg 638d522f475Smrg#ifndef OPT_HP_FUNC_KEYS 639d522f475Smrg#define OPT_HP_FUNC_KEYS 0 /* true if xterm supports HP-style function keys */ 640d522f475Smrg#endif 641d522f475Smrg 642d522f475Smrg#ifndef OPT_I18N_SUPPORT 643d522f475Smrg#if (XtSpecificationRelease >= 5) 644d522f475Smrg#define OPT_I18N_SUPPORT 1 /* true if xterm uses internationalization support */ 645d522f475Smrg#else 646d522f475Smrg#define OPT_I18N_SUPPORT 0 647d522f475Smrg#endif 648d522f475Smrg#endif 649d522f475Smrg 650d522f475Smrg#ifndef OPT_INITIAL_ERASE 651d522f475Smrg#define OPT_INITIAL_ERASE 1 /* use pty's erase character if it's not 128 */ 652d522f475Smrg#endif 653d522f475Smrg 654d522f475Smrg#ifndef OPT_INPUT_METHOD 655d522f475Smrg#if (XtSpecificationRelease >= 6) 656d4fba8b9Smrg#define OPT_INPUT_METHOD OPT_I18N_SUPPORT /* true if xterm uses input-method support */ 657d522f475Smrg#else 658d522f475Smrg#define OPT_INPUT_METHOD 0 659d522f475Smrg#endif 660d522f475Smrg#endif 661d522f475Smrg 662d522f475Smrg#ifndef OPT_ISO_COLORS 663d522f475Smrg#define OPT_ISO_COLORS 1 /* true if xterm is configured with ISO colors */ 664d522f475Smrg#endif 665d522f475Smrg 666d4fba8b9Smrg#ifndef OPT_DIRECT_COLOR 667d4fba8b9Smrg#define OPT_DIRECT_COLOR OPT_ISO_COLORS /* true if xterm is configured with direct-colors */ 668d4fba8b9Smrg#endif 669d4fba8b9Smrg 670d522f475Smrg#ifndef OPT_256_COLORS 671d4fba8b9Smrg#define OPT_256_COLORS 1 /* true if xterm is configured with 256 colors */ 672d522f475Smrg#endif 673d522f475Smrg 674d522f475Smrg#ifndef OPT_88_COLORS 675d4fba8b9Smrg#define OPT_88_COLORS 1 /* true if xterm is configured with 88 colors */ 676d522f475Smrg#endif 677d522f475Smrg 678d522f475Smrg#ifndef OPT_HIGHLIGHT_COLOR 679d522f475Smrg#define OPT_HIGHLIGHT_COLOR 1 /* true if xterm supports color highlighting */ 680d522f475Smrg#endif 681d522f475Smrg 682d522f475Smrg#ifndef OPT_LOAD_VTFONTS 683d522f475Smrg#define OPT_LOAD_VTFONTS 0 /* true if xterm has load-vt-fonts() action */ 684d522f475Smrg#endif 685d522f475Smrg 686d522f475Smrg#ifndef OPT_LUIT_PROG 687d4fba8b9Smrg#define OPT_LUIT_PROG 1 /* true if xterm supports luit */ 688d522f475Smrg#endif 689d522f475Smrg 690d522f475Smrg#ifndef OPT_MAXIMIZE 691d522f475Smrg#define OPT_MAXIMIZE 1 /* add actions for iconify ... maximize */ 692d522f475Smrg#endif 693d522f475Smrg 694d522f475Smrg#ifndef OPT_MINI_LUIT 695d522f475Smrg#define OPT_MINI_LUIT 0 /* true if xterm supports built-in mini-luit */ 696d522f475Smrg#endif 697d522f475Smrg 698d522f475Smrg#ifndef OPT_MOD_FKEYS 699d522f475Smrg#define OPT_MOD_FKEYS 1 /* modify cursor- and function-keys in normal mode */ 700d522f475Smrg#endif 701d522f475Smrg 702d522f475Smrg#ifndef OPT_NUM_LOCK 703d522f475Smrg#define OPT_NUM_LOCK 1 /* use NumLock key only for numeric-keypad */ 704d522f475Smrg#endif 705d522f475Smrg 706d522f475Smrg#ifndef OPT_PASTE64 707d4fba8b9Smrg#define OPT_PASTE64 1 /* program control of select/paste via base64 */ 708d522f475Smrg#endif 709d522f475Smrg 710d522f475Smrg#ifndef OPT_PC_COLORS 711d522f475Smrg#define OPT_PC_COLORS 1 /* true if xterm supports PC-style (bold) colors */ 712d522f475Smrg#endif 713d522f475Smrg 714712a7ff4Smrg#ifndef OPT_PRINT_ON_EXIT 715712a7ff4Smrg#define OPT_PRINT_ON_EXIT 1 /* true allows xterm to dump screen on X error */ 716712a7ff4Smrg#endif 717712a7ff4Smrg 718d522f475Smrg#ifndef OPT_PTY_HANDSHAKE 719d522f475Smrg#define OPT_PTY_HANDSHAKE USE_HANDSHAKE /* avoid pty races on older systems */ 720d522f475Smrg#endif 721d522f475Smrg 722d522f475Smrg#ifndef OPT_PRINT_COLORS 723d522f475Smrg#define OPT_PRINT_COLORS 1 /* true if we print color information */ 724d522f475Smrg#endif 725d522f475Smrg 726d522f475Smrg#ifndef OPT_READLINE 727d522f475Smrg#define OPT_READLINE 0 /* mouse-click/paste support for readline */ 728d522f475Smrg#endif 729d522f475Smrg 730d522f475Smrg#ifndef OPT_RENDERFONT 731d522f475Smrg#ifdef XRENDERFONT 732d522f475Smrg#define OPT_RENDERFONT 1 733d522f475Smrg#else 734d522f475Smrg#define OPT_RENDERFONT 0 735d522f475Smrg#endif 736d522f475Smrg#endif 737d522f475Smrg 738d522f475Smrg#ifndef OPT_RENDERWIDE 739d522f475Smrg#if OPT_RENDERFONT && OPT_WIDE_CHARS && defined(HAVE_TYPE_XFTCHARSPEC) 740d522f475Smrg#define OPT_RENDERWIDE 1 741d522f475Smrg#else 742d522f475Smrg#define OPT_RENDERWIDE 0 743d522f475Smrg#endif 744d522f475Smrg#endif 745d522f475Smrg 746dfb07bc7Smrg#ifndef OPT_REPORT_CCLASS 747dfb07bc7Smrg#define OPT_REPORT_CCLASS 1 /* provide "-report-charclass" option */ 748dfb07bc7Smrg#endif 749dfb07bc7Smrg 750fa3f02f3Smrg#ifndef OPT_REPORT_COLORS 751fa3f02f3Smrg#define OPT_REPORT_COLORS 1 /* provide "-report-colors" option */ 752fa3f02f3Smrg#endif 753fa3f02f3Smrg 754fa3f02f3Smrg#ifndef OPT_REPORT_FONTS 755fa3f02f3Smrg#define OPT_REPORT_FONTS 1 /* provide "-report-fonts" option */ 756fa3f02f3Smrg#endif 757fa3f02f3Smrg 758d4fba8b9Smrg#ifndef OPT_REPORT_ICONS 759d4fba8b9Smrg#define OPT_REPORT_ICONS 1 /* provide "-report-icons" option */ 760d4fba8b9Smrg#endif 761d4fba8b9Smrg 762d522f475Smrg#ifndef OPT_SAME_NAME 763d522f475Smrg#define OPT_SAME_NAME 1 /* suppress redundant updates of title, icon, etc. */ 764d522f475Smrg#endif 765d522f475Smrg 766d522f475Smrg#ifndef OPT_SCO_FUNC_KEYS 767d522f475Smrg#define OPT_SCO_FUNC_KEYS 0 /* true if xterm supports SCO-style function keys */ 768d522f475Smrg#endif 769d522f475Smrg 770d522f475Smrg#ifndef OPT_SUN_FUNC_KEYS 771d522f475Smrg#define OPT_SUN_FUNC_KEYS 1 /* true if xterm supports Sun-style function keys */ 772d522f475Smrg#endif 773d522f475Smrg 774cd3331d0Smrg#ifndef OPT_SCROLL_LOCK 775cd3331d0Smrg#define OPT_SCROLL_LOCK 1 /* true if xterm interprets fontsize-shifting */ 776cd3331d0Smrg#endif 777cd3331d0Smrg 778d522f475Smrg#ifndef OPT_SELECT_REGEX 779d4fba8b9Smrg#define OPT_SELECT_REGEX 1 /* true if xterm supports regular-expression selects */ 780d522f475Smrg#endif 781d522f475Smrg 7823367019cSmrg#ifndef OPT_SELECTION_OPS 7833367019cSmrg#define OPT_SELECTION_OPS 1 /* true if xterm supports operations on selection */ 7843367019cSmrg#endif 7853367019cSmrg 786d522f475Smrg#ifndef OPT_SESSION_MGT 787d522f475Smrg#if defined(XtNdieCallback) && defined(XtNsaveCallback) 788d522f475Smrg#define OPT_SESSION_MGT 1 789d522f475Smrg#else 790d522f475Smrg#define OPT_SESSION_MGT 0 791d522f475Smrg#endif 792d522f475Smrg#endif 793d522f475Smrg 794d522f475Smrg#ifndef OPT_SHIFT_FONTS 795781b53c7Schristos#define OPT_SHIFT_FONTS 0 /* true if xterm interprets fontsize-shifting */ 796d522f475Smrg#endif 797d522f475Smrg 79850027b5bSmrg#ifndef OPT_STATUS_LINE 79950027b5bSmrg#define OPT_STATUS_LINE 0 /* true if xterm supports status-line controls */ 80050027b5bSmrg#endif 80150027b5bSmrg 802d522f475Smrg#ifndef OPT_SUNPC_KBD 803d522f475Smrg#define OPT_SUNPC_KBD 1 /* true if xterm supports Sun/PC keyboard map */ 804d522f475Smrg#endif 805d522f475Smrg 806d522f475Smrg#ifndef OPT_TCAP_FKEYS 807d4fba8b9Smrg#define OPT_TCAP_FKEYS 1 /* true for termcap function-keys */ 808d522f475Smrg#endif 809d522f475Smrg 810d522f475Smrg#ifndef OPT_TCAP_QUERY 811d4fba8b9Smrg#define OPT_TCAP_QUERY 1 /* true for termcap query */ 812d522f475Smrg#endif 813d522f475Smrg 814d522f475Smrg#ifndef OPT_TEK4014 815d522f475Smrg#define OPT_TEK4014 1 /* true if we're using tek4014 emulation */ 816d522f475Smrg#endif 817d522f475Smrg 818d522f475Smrg#ifndef OPT_TOOLBAR 819d522f475Smrg#define OPT_TOOLBAR 0 /* true if xterm supports toolbar menus */ 820d522f475Smrg#endif 821d522f475Smrg 822d522f475Smrg#ifndef OPT_TRACE 823d522f475Smrg#define OPT_TRACE 0 /* true if we're using debugging traces */ 824d522f475Smrg#endif 825d522f475Smrg 826d522f475Smrg#ifndef OPT_TRACE_FLAGS 827d522f475Smrg#define OPT_TRACE_FLAGS 0 /* additional tracing used for SCRN_BUF_FLAGS */ 828d522f475Smrg#endif 829d522f475Smrg 830d4fba8b9Smrg#ifndef OPT_TRACE_UNIQUE 831d4fba8b9Smrg#define OPT_TRACE_UNIQUE 0 /* true if we're using multiple trace files */ 832d4fba8b9Smrg#endif 833d4fba8b9Smrg 834d522f475Smrg#ifndef OPT_VT52_MODE 835d522f475Smrg#define OPT_VT52_MODE 1 /* true if xterm supports VT52 emulation */ 836d522f475Smrg#endif 837d522f475Smrg 8389a64e1c5Smrg#ifndef OPT_WIDE_ATTRS 8399a64e1c5Smrg#define OPT_WIDE_ATTRS 1 /* true if xterm supports 16-bit attributes */ 8409a64e1c5Smrg#endif 8419a64e1c5Smrg 842980988aeSmrg#ifndef OPT_VT525_COLORS 843980988aeSmrg#define OPT_VT525_COLORS 1 /* true if xterm is configured for VT525 colors */ 844980988aeSmrg#endif 845980988aeSmrg 846d522f475Smrg#ifndef OPT_WIDE_CHARS 847d4fba8b9Smrg#define OPT_WIDE_CHARS 1 /* true if xterm supports 16-bit characters */ 848d522f475Smrg#endif 849d522f475Smrg 850b7c89284Ssnj#ifndef OPT_WIDER_ICHAR 851b7c89284Ssnj#define OPT_WIDER_ICHAR 1 /* true if xterm uses 32-bits for wide-chars */ 852b7c89284Ssnj#endif 853b7c89284Ssnj 854d522f475Smrg#ifndef OPT_XMC_GLITCH 855d522f475Smrg#define OPT_XMC_GLITCH 0 /* true if xterm supports xmc (magic cookie glitch) */ 856d522f475Smrg#endif 857d522f475Smrg 858d4fba8b9Smrg#ifndef OPT_XRES_QUERY 859d4fba8b9Smrg#define OPT_XRES_QUERY 1 /* true for resource query */ 860d4fba8b9Smrg#endif 861d4fba8b9Smrg 862d4fba8b9Smrg#ifndef OPT_XTERM_SGR 863d4fba8b9Smrg#define OPT_XTERM_SGR 1 /* true if xterm supports private SGR controls */ 864d4fba8b9Smrg#endif 865d4fba8b9Smrg 866d522f475Smrg#ifndef OPT_ZICONBEEP 867d522f475Smrg#define OPT_ZICONBEEP 1 /* true if xterm supports "-ziconbeep" option */ 868d522f475Smrg#endif 869d522f475Smrg 870d522f475Smrg/***====================================================================***/ 871d522f475Smrg 872d522f475Smrg#if OPT_AIX_COLORS && !OPT_ISO_COLORS 873d522f475Smrg/* You must have ANSI/ISO colors to support AIX colors */ 874d522f475Smrg#undef OPT_AIX_COLORS 875d522f475Smrg#define OPT_AIX_COLORS 0 876d522f475Smrg#endif 877d522f475Smrg 878d522f475Smrg#if OPT_PC_COLORS && !OPT_ISO_COLORS 879d522f475Smrg/* You must have ANSI/ISO colors to support PC colors */ 880d522f475Smrg#undef OPT_PC_COLORS 881d522f475Smrg#define OPT_PC_COLORS 0 882d522f475Smrg#endif 883d522f475Smrg 884d522f475Smrg#if OPT_PRINT_COLORS && !OPT_ISO_COLORS 885d522f475Smrg/* You must have ANSI/ISO colors to be able to print them */ 886d522f475Smrg#undef OPT_PRINT_COLORS 887d522f475Smrg#define OPT_PRINT_COLORS 0 888d522f475Smrg#endif 889d522f475Smrg 890d522f475Smrg#if OPT_256_COLORS && !OPT_ISO_COLORS 891d522f475Smrg/* You must have ANSI/ISO colors to support 256 colors */ 892d522f475Smrg#undef OPT_256_COLORS 893d522f475Smrg#define OPT_256_COLORS 0 894d522f475Smrg#endif 895d522f475Smrg 896d522f475Smrg#if OPT_88_COLORS && !OPT_ISO_COLORS 897d522f475Smrg/* You must have ANSI/ISO colors to support 88 colors */ 898d522f475Smrg#undef OPT_88_COLORS 899d522f475Smrg#define OPT_88_COLORS 0 900d522f475Smrg#endif 901d522f475Smrg 902d522f475Smrg#if OPT_88_COLORS && OPT_256_COLORS 903d522f475Smrg/* 256 colors supersedes 88 colors */ 904d522f475Smrg#undef OPT_88_COLORS 905d522f475Smrg#define OPT_88_COLORS 0 906d522f475Smrg#endif 907d522f475Smrg 908d522f475Smrg/***====================================================================***/ 909d522f475Smrg 910d522f475Smrg/* 911d522f475Smrg * Indices for menu_font_names[][] 912d522f475Smrg */ 913d522f475Smrgtypedef enum { 914d522f475Smrg fNorm = 0 /* normal font */ 915d522f475Smrg , fBold /* bold font */ 916dfb07bc7Smrg#if OPT_WIDE_ATTRS || OPT_RENDERWIDE 917dfb07bc7Smrg , fItal /* italic font */ 918d4fba8b9Smrg , fBtal /* bold-italic font */ 919dfb07bc7Smrg#endif 920d522f475Smrg#if OPT_WIDE_CHARS 921d522f475Smrg , fWide /* double-width font */ 922d522f475Smrg , fWBold /* double-width bold font */ 923dfb07bc7Smrg , fWItal /* double-width italic font */ 924d4fba8b9Smrg , fWBtal /* double-width bold-italic font */ 925d522f475Smrg#endif 926d522f475Smrg , fMAX 927d522f475Smrg} VTFontEnum; 928d522f475Smrg 929d522f475Smrg/* 930d522f475Smrg * Indices for cachedGCs.c (unrelated to VTFontEnum). 931d522f475Smrg */ 932d522f475Smrgtypedef enum { 933d522f475Smrg gcNorm = 0 934d522f475Smrg , gcBold 935d522f475Smrg , gcNormReverse 936d522f475Smrg , gcBoldReverse 937d4fba8b9Smrg , gcFiller 938d4fba8b9Smrg , gcBorder 939980988aeSmrg#if OPT_BOX_CHARS || OPT_WIDE_CHARS 940d522f475Smrg , gcLine 941d522f475Smrg , gcDots 942d522f475Smrg#endif 943d522f475Smrg#if OPT_DEC_CHRSET 944d522f475Smrg , gcCNorm 945d522f475Smrg , gcCBold 946d522f475Smrg#endif 947d522f475Smrg#if OPT_WIDE_CHARS 948d522f475Smrg , gcWide 949d522f475Smrg , gcWBold 950d522f475Smrg , gcWideReverse 951d522f475Smrg , gcWBoldReverse 952d522f475Smrg#endif 953d522f475Smrg , gcVTcursNormal 954d522f475Smrg , gcVTcursFilled 955d522f475Smrg , gcVTcursReverse 956d522f475Smrg , gcVTcursOutline 957d522f475Smrg#if OPT_TEK4014 958d522f475Smrg , gcTKcurs 959d522f475Smrg#endif 960d522f475Smrg , gcMAX 961d522f475Smrg} CgsEnum; 962d522f475Smrg 963d522f475Smrg#define for_each_text_gc(n) for (n = gcNorm; n < gcVTcursNormal; ++n) 964d522f475Smrg#define for_each_curs_gc(n) for (n = gcVTcursNormal; n <= gcVTcursOutline; ++n) 965d522f475Smrg#define for_each_gc(n) for (n = gcNorm; n < gcMAX; ++n) 966d522f475Smrg 967cd3331d0Smrg/* 968cd3331d0Smrg * Indices for the normal terminal colors in screen.Tcolors[]. 969cd3331d0Smrg * See also OscTextColors, which has corresponding values. 970cd3331d0Smrg */ 971d522f475Smrgtypedef enum { 972d522f475Smrg TEXT_FG = 0 /* text foreground */ 973d522f475Smrg , TEXT_BG /* text background */ 974d522f475Smrg , TEXT_CURSOR /* text cursor */ 975d522f475Smrg , MOUSE_FG /* mouse foreground */ 976d522f475Smrg , MOUSE_BG /* mouse background */ 977d522f475Smrg#if OPT_TEK4014 9783367019cSmrg , TEK_FG = 5 /* tektronix foreground */ 979d522f475Smrg , TEK_BG /* tektronix background */ 980d522f475Smrg#endif 981d522f475Smrg#if OPT_HIGHLIGHT_COLOR 9823367019cSmrg , HIGHLIGHT_BG = 7 /* highlight background */ 9833367019cSmrg#endif 9843367019cSmrg#if OPT_TEK4014 9853367019cSmrg , TEK_CURSOR = 8 /* tektronix cursor */ 9863367019cSmrg#endif 9873367019cSmrg#if OPT_HIGHLIGHT_COLOR 9883367019cSmrg , HIGHLIGHT_FG = 9 /* highlight foreground */ 989d522f475Smrg#endif 990d522f475Smrg , NCOLORS /* total number of colors */ 991d522f475Smrg} TermColors; 992d522f475Smrg 99394644356Smrg/* 99494644356Smrg * Definitions for exec-formatted and insert-formatted actions. 99594644356Smrg */ 99694644356Smrgtypedef void (*FormatSelect) (Widget, char *, char *, CELL *, CELL *); 99794644356Smrg 99894644356Smrgtypedef struct { 999d4fba8b9Smrg Boolean done; 100094644356Smrg char *format; 100194644356Smrg char *buffer; 100294644356Smrg FormatSelect format_select; 100394644356Smrg#if OPT_PASTE64 100494644356Smrg Cardinal base64_paste; 100594644356Smrg#endif 1006d4fba8b9Smrg#if OPT_PASTE64 || OPT_READLINE 100794644356Smrg unsigned paste_brackets; 100894644356Smrg#endif 100994644356Smrg} InternalSelect; 101094644356Smrg 1011cd3331d0Smrg/* 1012cd3331d0Smrg * Constants for titleModes resource 1013cd3331d0Smrg */ 1014cd3331d0Smrgtypedef enum { 1015cd3331d0Smrg tmSetBase16 = 1 /* set title using hex-string */ 1016cd3331d0Smrg , tmGetBase16 = 2 /* get title using hex-string */ 1017cd3331d0Smrg#if OPT_WIDE_CHARS 1018cd3331d0Smrg , tmSetUtf8 = 4 /* like utf8Title, but controllable */ 1019cd3331d0Smrg , tmGetUtf8 = 8 /* retrieve title encoded as UTF-8 */ 1020cd3331d0Smrg#endif 1021cd3331d0Smrg} TitleModes; 1022cd3331d0Smrg 1023cd3331d0Smrg#define IsTitleMode(xw,mode) (((xw)->screen.title_modes & mode) != 0) 1024cd3331d0Smrg 1025fa3f02f3Smrg#include <xcharmouse.h> 1026fa3f02f3Smrg 1027fa3f02f3Smrg/* 1028fa3f02f3Smrg * For readability... 1029fa3f02f3Smrg */ 1030fa3f02f3Smrg#define nrc_percent 100 1031fa3f02f3Smrg#define nrc_dquote 200 1032fa3f02f3Smrg#define nrc_ampersand 300 1033fa3f02f3Smrgtypedef enum { 1034fa3f02f3Smrg nrc_ASCII = 0 1035fa3f02f3Smrg ,nrc_British /* vt100 */ 1036fa3f02f3Smrg ,nrc_British_Latin_1 /* vt3xx */ 1037d4fba8b9Smrg ,nrc_DEC_Cyrillic /* vt5xx */ 1038fa3f02f3Smrg ,nrc_DEC_Spec_Graphic /* vt100 */ 1039fa3f02f3Smrg ,nrc_DEC_Alt_Chars /* vt100 */ 1040fa3f02f3Smrg ,nrc_DEC_Alt_Graphics /* vt100 */ 1041fa3f02f3Smrg ,nrc_DEC_Supp /* vt2xx */ 1042fa3f02f3Smrg ,nrc_DEC_Supp_Graphic /* vt3xx */ 1043fa3f02f3Smrg ,nrc_DEC_Technical /* vt3xx */ 1044980988aeSmrg ,nrc_DEC_UPSS /* vt3xx */ 1045fa3f02f3Smrg ,nrc_Dutch /* vt2xx */ 1046fa3f02f3Smrg ,nrc_Finnish /* vt2xx */ 1047fa3f02f3Smrg ,nrc_Finnish2 /* vt2xx */ 1048fa3f02f3Smrg ,nrc_French /* vt2xx */ 1049fa3f02f3Smrg ,nrc_French2 /* vt2xx */ 1050fa3f02f3Smrg ,nrc_French_Canadian /* vt2xx */ 1051fa3f02f3Smrg ,nrc_French_Canadian2 /* vt3xx */ 1052fa3f02f3Smrg ,nrc_German /* vt2xx */ 1053fa3f02f3Smrg ,nrc_Greek /* vt5xx */ 1054d4fba8b9Smrg ,nrc_DEC_Greek_Supp /* vt5xx */ 1055d4fba8b9Smrg ,nrc_ISO_Greek_Supp /* vt5xx */ 1056d4fba8b9Smrg ,nrc_DEC_Hebrew_Supp /* vt5xx */ 1057fa3f02f3Smrg ,nrc_Hebrew /* vt5xx */ 1058d4fba8b9Smrg ,nrc_ISO_Hebrew_Supp /* vt5xx */ 1059fa3f02f3Smrg ,nrc_Italian /* vt2xx */ 1060980988aeSmrg ,nrc_ISO_Latin_1_Supp /* vt3xx */ 1061d4fba8b9Smrg ,nrc_ISO_Latin_2_Supp /* vt5xx */ 1062d4fba8b9Smrg ,nrc_ISO_Latin_5_Supp /* vt5xx */ 1063d4fba8b9Smrg ,nrc_ISO_Latin_Cyrillic /* vt5xx */ 1064fa3f02f3Smrg ,nrc_Norwegian_Danish /* vt3xx */ 1065fa3f02f3Smrg ,nrc_Norwegian_Danish2 /* vt2xx */ 1066fa3f02f3Smrg ,nrc_Norwegian_Danish3 /* vt2xx */ 1067fa3f02f3Smrg ,nrc_Portugese /* vt3xx */ 1068fa3f02f3Smrg ,nrc_Russian /* vt5xx */ 1069fa3f02f3Smrg ,nrc_SCS_NRCS /* vt5xx - probably Serbo/Croatian */ 1070fa3f02f3Smrg ,nrc_Spanish /* vt2xx */ 1071fa3f02f3Smrg ,nrc_Swedish /* vt2xx */ 1072fa3f02f3Smrg ,nrc_Swedish2 /* vt2xx */ 1073fa3f02f3Smrg ,nrc_Swiss /* vt2xx */ 1074d4fba8b9Smrg ,nrc_DEC_Turkish_Supp /* vt5xx */ 1075fa3f02f3Smrg ,nrc_Turkish /* vt5xx */ 1076fa3f02f3Smrg ,nrc_Unknown 1077fa3f02f3Smrg} DECNRCM_codes; 1078fa3f02f3Smrg 1079980988aeSmrg/* 1080980988aeSmrg * Default and alternate codes for user-preferred supplemental set. 1081980988aeSmrg */ 1082980988aeSmrg#define DFT_UPSS nrc_DEC_Supp_Graphic 1083980988aeSmrg#define ALT_UPSS nrc_ISO_Latin_1_Supp 1084980988aeSmrg#define PreferredUPSS(screen) ((screen)->prefer_latin1 ? ALT_UPSS : DFT_UPSS) 1085980988aeSmrg 1086fa3f02f3Smrg/* 1087fa3f02f3Smrg * Use this enumerated type to check consistency among dpmodes(), savemodes() 1088d4fba8b9Smrg * restoremodes() and do_dec_rqm(). 1089fa3f02f3Smrg */ 1090fa3f02f3Smrgtypedef enum { 1091980988aeSmrg srm_DECCKM = 1 /* Cursor Keys Mode */ 1092980988aeSmrg ,srm_DECANM = 2 /* ANSI Mode */ 1093980988aeSmrg ,srm_DECCOLM = 3 /* Column Mode */ 1094980988aeSmrg ,srm_DECSCLM = 4 /* Scrolling Mode */ 1095980988aeSmrg ,srm_DECSCNM = 5 /* Screen Mode */ 1096980988aeSmrg ,srm_DECOM = 6 /* Origin Mode */ 1097980988aeSmrg ,srm_DECAWM = 7 /* Autowrap Mode */ 1098980988aeSmrg ,srm_DECARM = 8 /* Autorepeat Mode */ 1099fa3f02f3Smrg ,srm_X10_MOUSE = SET_X10_MOUSE 1100fa3f02f3Smrg#if OPT_TOOLBAR 1101fa3f02f3Smrg ,srm_RXVT_TOOLBAR = 10 1102fa3f02f3Smrg#endif 1103fa3f02f3Smrg#if OPT_BLINK_CURS 1104fa3f02f3Smrg ,srm_ATT610_BLINK = 12 1105d4fba8b9Smrg ,srm_CURSOR_BLINK_OPS = 13 1106d4fba8b9Smrg ,srm_XOR_CURSOR_BLINKS = 14 1107fa3f02f3Smrg#endif 1108980988aeSmrg ,srm_DECPFF = 18 /* Print Form Feed Mode */ 1109980988aeSmrg ,srm_DECPEX = 19 /* Printer Extent Mode */ 1110980988aeSmrg ,srm_DECTCEM = 25 /* Text Cursor Enable Mode */ 1111fa3f02f3Smrg ,srm_RXVT_SCROLLBAR = 30 1112980988aeSmrg ,srm_DECRLM = 34 /* vt510:Cursor Right to Left Mode */ 1113fa3f02f3Smrg#if OPT_SHIFT_FONTS 1114980988aeSmrg ,srm_RXVT_FONTSIZE = 35 /* also vt520:DECHEBM */ 1115fa3f02f3Smrg#endif 1116980988aeSmrg ,srm_DECHEM = 36 /* vt510:Hebrew Encoding Mode */ 1117fa3f02f3Smrg#if OPT_TEK4014 1118fa3f02f3Smrg ,srm_DECTEK = 38 1119fa3f02f3Smrg#endif 1120fa3f02f3Smrg ,srm_132COLS = 40 1121fa3f02f3Smrg ,srm_CURSES_HACK = 41 1122980988aeSmrg ,srm_DECNRCM = 42 /* National Replacement Character Set Mode */ 1123d4fba8b9Smrg#if OPT_PRINT_GRAPHICS 1124d4fba8b9Smrg ,srm_DECGEPM = 43 /* Graphics Expanded Print Mode */ 1125d4fba8b9Smrg#endif 1126d4fba8b9Smrg ,srm_MARGIN_BELL = 44 /* also DECGPCM (Graphics Print Color Mode) */ 1127d4fba8b9Smrg ,srm_REVERSEWRAP = 45 /* also DECGPCS (Graphics Print Color Syntax) */ 1128fa3f02f3Smrg#ifdef ALLOWLOGGING 1129d4fba8b9Smrg ,srm_ALLOWLOGGING = 46 /* also DECGPBM (Graphics Print Background Mode) */ 1130d4fba8b9Smrg#elif OPT_PRINT_GRAPHICS 1131d4fba8b9Smrg ,srm_DECGPBM = 46 /* Graphics Print Background Mode */ 1132fa3f02f3Smrg#endif 1133d4fba8b9Smrg ,srm_ALTBUF = 47 /* also DECGRPM (Graphics Rotated Print Mode) */ 1134980988aeSmrg ,srm_DECNAKB = 57 /* vt510:Greek/N-A Keyboard Mapping */ 1135980988aeSmrg ,srm_DECIPEM = 58 /* vt510:IBM ProPrinter Emulation Mode */ 1136980988aeSmrg ,srm_DECHCCM = 60 /* vt420:Horizontal Cursor-Coupling Mode */ 1137980988aeSmrg ,srm_DECVCCM = 61 /* vt420:Vertical Cursor-Coupling Mode */ 1138980988aeSmrg ,srm_DECPCCM = 64 /* vt420:Page Cursor-Coupling Mode */ 1139980988aeSmrg ,srm_DECNKM = 66 /* vt420:Numeric Keypad Mode */ 1140980988aeSmrg ,srm_DECBKM = 67 /* vt420:Backarrow Key mode */ 1141980988aeSmrg ,srm_DECKBUM = 68 /* vt420:Keyboard Usage mode */ 1142980988aeSmrg ,srm_DECLRMM = 69 /* vt420:Vertical Split Screen Mode (DECVSSM) */ 1143980988aeSmrg ,srm_DECXRLM = 73 /* vt420:Transmit Rate Limiting */ 1144fa3f02f3Smrg#if OPT_SIXEL_GRAPHICS 1145fa3f02f3Smrg ,srm_DECSDM = 80 /* Sixel Display Mode */ 1146fa3f02f3Smrg#endif 1147980988aeSmrg ,srm_DECKPM = 81 /* vt420:Key Position Mode */ 1148980988aeSmrg ,srm_DECNCSM = 95 /* vt510:No Clearing Screen On Column Change */ 1149980988aeSmrg ,srm_DECRLCM = 96 /* vt510:Right-to-Left Copy */ 1150980988aeSmrg ,srm_DECCRTSM = 97 /* vt510:CRT Save Mode */ 1151980988aeSmrg ,srm_DECARSM = 98 /* vt510:Auto Resize Mode */ 1152980988aeSmrg ,srm_DECMCM = 99 /* vt510:Modem Control Mode */ 1153980988aeSmrg ,srm_DECCAAM = 100 /* vt510:Auto Answerback Mode */ 1154980988aeSmrg ,srm_DECCANSM = 101 /* vt510:Conceal Answerback Message Mode */ 1155980988aeSmrg ,srm_DECNULM = 102 /* vt510:Ignoring Null Mode */ 1156980988aeSmrg ,srm_DECHDPXM = 103 /* vt510:Half-Duplex Mode */ 1157980988aeSmrg ,srm_DECOSCNM = 106 /* vt510:Overscan Mode */ 1158980988aeSmrg ,srm_DECNUMLK = 108 /* vt510:Num Lock Mode */ 1159980988aeSmrg ,srm_DECCAPSLK = 109 /* vt510:Caps Lock Mode */ 1160980988aeSmrg ,srm_DECKLHIM = 110 /* vt510:Keyboard LEDs Host Indicator Mode */ 1161980988aeSmrg ,srm_DECFWM = 111 /* vt520:Framed Windows Mode */ 1162980988aeSmrg ,srm_DECRPL = 112 /* vt520:Review Previous Lines */ 1163980988aeSmrg ,srm_DECHWUM = 113 /* vt520:Host Wake-Up */ 1164980988aeSmrg ,srm_DECATCUM = 114 /* vt520:Alternate Text Color Underline */ 1165980988aeSmrg ,srm_DECATCBM = 115 /* vt520:Alternate Text Color Blink */ 1166980988aeSmrg ,srm_DECBBSM = 116 /* vt520:Bold and Blink Style Mode */ 1167980988aeSmrg ,srm_DECECM = 117 /* vt520:Erase Color Mode */ 1168fa3f02f3Smrg ,srm_VT200_MOUSE = SET_VT200_MOUSE 1169fa3f02f3Smrg ,srm_VT200_HIGHLIGHT_MOUSE = SET_VT200_HIGHLIGHT_MOUSE 1170fa3f02f3Smrg ,srm_BTN_EVENT_MOUSE = SET_BTN_EVENT_MOUSE 1171fa3f02f3Smrg ,srm_ANY_EVENT_MOUSE = SET_ANY_EVENT_MOUSE 1172fa3f02f3Smrg#if OPT_FOCUS_EVENT 1173fa3f02f3Smrg ,srm_FOCUS_EVENT_MOUSE = SET_FOCUS_EVENT_MOUSE 1174fa3f02f3Smrg#endif 1175fa3f02f3Smrg ,srm_EXT_MODE_MOUSE = SET_EXT_MODE_MOUSE 1176fa3f02f3Smrg ,srm_SGR_EXT_MODE_MOUSE = SET_SGR_EXT_MODE_MOUSE 1177fa3f02f3Smrg ,srm_URXVT_EXT_MODE_MOUSE = SET_URXVT_EXT_MODE_MOUSE 1178d4fba8b9Smrg ,srm_PIXEL_POSITION_MOUSE = SET_PIXEL_POSITION_MOUSE 1179fa3f02f3Smrg ,srm_ALTERNATE_SCROLL = SET_ALTERNATE_SCROLL 1180fa3f02f3Smrg ,srm_RXVT_SCROLL_TTY_OUTPUT = 1010 1181fa3f02f3Smrg ,srm_RXVT_SCROLL_TTY_KEYPRESS = 1011 1182980988aeSmrg ,srm_FAST_SCROLL = 1014 1183fa3f02f3Smrg ,srm_EIGHT_BIT_META = 1034 1184fa3f02f3Smrg#if OPT_NUM_LOCK 1185fa3f02f3Smrg ,srm_REAL_NUMLOCK = 1035 1186fa3f02f3Smrg ,srm_META_SENDS_ESC = 1036 1187fa3f02f3Smrg#endif 1188fa3f02f3Smrg ,srm_DELETE_IS_DEL = 1037 1189fa3f02f3Smrg#if OPT_NUM_LOCK 1190fa3f02f3Smrg ,srm_ALT_SENDS_ESC = 1039 1191fa3f02f3Smrg#endif 1192fa3f02f3Smrg ,srm_KEEP_SELECTION = 1040 1193fa3f02f3Smrg ,srm_SELECT_TO_CLIPBOARD = 1041 1194fa3f02f3Smrg ,srm_BELL_IS_URGENT = 1042 1195fa3f02f3Smrg ,srm_POP_ON_BELL = 1043 1196037a25ddSmrg ,srm_KEEP_CLIPBOARD = 1044 1197980988aeSmrg ,srm_REVERSEWRAP2 = 1045 /* reverse-wrap without limits */ 1198d4fba8b9Smrg ,srm_ALLOW_ALTBUF = 1046 1199d4fba8b9Smrg ,srm_OPT_ALTBUF = 1047 1200d4fba8b9Smrg ,srm_SAVE_CURSOR = 1048 1201d4fba8b9Smrg ,srm_OPT_ALTBUF_CURSOR = 1049 1202fa3f02f3Smrg#if OPT_TCAP_FKEYS 1203fa3f02f3Smrg ,srm_TCAP_FKEYS = 1050 1204fa3f02f3Smrg#endif 1205fa3f02f3Smrg#if OPT_SUN_FUNC_KEYS 1206fa3f02f3Smrg ,srm_SUN_FKEYS = 1051 1207fa3f02f3Smrg#endif 1208fa3f02f3Smrg#if OPT_HP_FUNC_KEYS 1209fa3f02f3Smrg ,srm_HP_FKEYS = 1052 1210fa3f02f3Smrg#endif 1211fa3f02f3Smrg#if OPT_SCO_FUNC_KEYS 1212fa3f02f3Smrg ,srm_SCO_FKEYS = 1053 1213fa3f02f3Smrg#endif 1214fa3f02f3Smrg ,srm_LEGACY_FKEYS = 1060 1215fa3f02f3Smrg#if OPT_SUNPC_KBD 1216fa3f02f3Smrg ,srm_VT220_FKEYS = 1061 1217fa3f02f3Smrg#endif 12189a64e1c5Smrg#if OPT_GRAPHICS 1219fa3f02f3Smrg ,srm_PRIVATE_COLOR_REGISTERS = 1070 1220fa3f02f3Smrg#endif 1221d4fba8b9Smrg#if OPT_PASTE64 || OPT_READLINE 1222d4fba8b9Smrg ,srm_PASTE_IN_BRACKET = SET_PASTE_IN_BRACKET 1223d4fba8b9Smrg#endif 1224fa3f02f3Smrg#if OPT_READLINE 1225fa3f02f3Smrg ,srm_BUTTON1_MOVE_POINT = SET_BUTTON1_MOVE_POINT 1226fa3f02f3Smrg ,srm_BUTTON2_MOVE_POINT = SET_BUTTON2_MOVE_POINT 1227fa3f02f3Smrg ,srm_DBUTTON3_DELETE = SET_DBUTTON3_DELETE 1228fa3f02f3Smrg ,srm_PASTE_QUOTE = SET_PASTE_QUOTE 1229fa3f02f3Smrg ,srm_PASTE_LITERAL_NL = SET_PASTE_LITERAL_NL 1230fa3f02f3Smrg#endif /* OPT_READLINE */ 12319a64e1c5Smrg#if OPT_SIXEL_GRAPHICS 12329a64e1c5Smrg ,srm_SIXEL_SCROLLS_RIGHT = 8452 12339a64e1c5Smrg#endif 1234fa3f02f3Smrg} DECSET_codes; 1235fa3f02f3Smrg 1236d4fba8b9Smrg/* internal codes for selection atoms */ 1237d4fba8b9Smrgtypedef enum { 1238d4fba8b9Smrg PRIMARY_CODE = 0 1239d4fba8b9Smrg ,CLIPBOARD_CODE 1240d4fba8b9Smrg ,SECONDARY_CODE 1241d4fba8b9Smrg ,MAX_SELECTION_CODES 1242d4fba8b9Smrg} SelectionCodes; 1243d4fba8b9Smrg 1244d522f475Smrg/* indices for mapping multiple clicks to selection types */ 1245d522f475Smrgtypedef enum { 1246d522f475Smrg Select_CHAR=0 1247d522f475Smrg ,Select_WORD 1248d522f475Smrg ,Select_LINE 1249d522f475Smrg ,Select_GROUP 1250d522f475Smrg ,Select_PAGE 1251d522f475Smrg ,Select_ALL 1252d522f475Smrg#if OPT_SELECT_REGEX 1253d522f475Smrg ,Select_REGEX 1254d522f475Smrg#endif 1255d522f475Smrg ,NSELECTUNITS 1256d522f475Smrg} SelectUnit; 1257d522f475Smrg 1258d4fba8b9Smrg#if OPT_BLINK_CURS 1259d4fba8b9Smrgtypedef enum { 1260d4fba8b9Smrg cbFalse = 0 1261d4fba8b9Smrg , cbTrue 1262d4fba8b9Smrg , cbAlways 1263d4fba8b9Smrg , cbNever 1264d4fba8b9Smrg , cbLAST 1265d4fba8b9Smrg} BlinkOps; 1266d4fba8b9Smrg#endif 1267d4fba8b9Smrg 1268cd3331d0Smrgtypedef enum { 1269cd3331d0Smrg ecSetColor = 1 1270cd3331d0Smrg , ecGetColor 1271cd3331d0Smrg , ecGetAnsiColor 1272cd3331d0Smrg , ecLAST 1273cd3331d0Smrg} ColorOps; 1274cd3331d0Smrg 1275cd3331d0Smrgtypedef enum { 1276cd3331d0Smrg efSetFont = 1 1277cd3331d0Smrg , efGetFont 1278cd3331d0Smrg , efLAST 1279cd3331d0Smrg} FontOps; 1280cd3331d0Smrg 1281c219fbebSmrgtypedef enum { 1282c219fbebSmrg esFalse = 0 1283c219fbebSmrg , esTrue 1284c219fbebSmrg , esAlways 1285c219fbebSmrg , esNever 1286d4fba8b9Smrg , esLAST 1287c219fbebSmrg} FullscreenOps; 1288c219fbebSmrg 12893367019cSmrg#ifndef NO_ACTIVE_ICON 12903367019cSmrgtypedef enum { 12913367019cSmrg eiFalse = 0 12923367019cSmrg , eiTrue 12933367019cSmrg , eiDefault 12943367019cSmrg , eiLAST 12953367019cSmrg} AIconOps; 12963367019cSmrg#endif 12973367019cSmrg 1298dfb07bc7Smrgtypedef enum { 1299dfb07bc7Smrg emX10 = 1 1300dfb07bc7Smrg , emLocator 1301dfb07bc7Smrg , emVT200Click 1302dfb07bc7Smrg , emVT200Hilite 1303dfb07bc7Smrg , emAnyButton 1304dfb07bc7Smrg , emAnyEvent 1305dfb07bc7Smrg , emFocusEvent 1306dfb07bc7Smrg , emExtended 1307dfb07bc7Smrg , emSGR 1308dfb07bc7Smrg , emURXVT 1309dfb07bc7Smrg , emAlternateScroll 1310dfb07bc7Smrg , emLAST 1311dfb07bc7Smrg} MouseOps; 1312dfb07bc7Smrg 1313d4fba8b9Smrgtypedef enum { 1314d4fba8b9Smrg#define DATA(name) ep##name 1315d4fba8b9Smrg DATA(NUL) = 0 1316d4fba8b9Smrg , DATA(SOH) = 1 1317d4fba8b9Smrg , DATA(STX) = 2 1318d4fba8b9Smrg , DATA(ETX) = 3 1319d4fba8b9Smrg , DATA(EOT) = 4 1320d4fba8b9Smrg , DATA(ENQ) = 5 1321d4fba8b9Smrg , DATA(ACK) = 6 1322d4fba8b9Smrg , DATA(BEL) = 7 1323d4fba8b9Smrg , DATA(BS) = 8 1324d4fba8b9Smrg , DATA(HT) = 9 1325d4fba8b9Smrg , DATA(LF) = 10 1326d4fba8b9Smrg , DATA(VT) = 11 1327d4fba8b9Smrg , DATA(FF) = 12 1328d4fba8b9Smrg , DATA(CR) = 13 1329d4fba8b9Smrg , DATA(SO) = 14 1330d4fba8b9Smrg , DATA(SI) = 15 1331d4fba8b9Smrg , DATA(DLE) = 16 1332d4fba8b9Smrg , DATA(DC1) = 17 1333d4fba8b9Smrg , DATA(DC2) = 18 1334d4fba8b9Smrg , DATA(DC3) = 19 1335d4fba8b9Smrg , DATA(DC4) = 20 1336d4fba8b9Smrg , DATA(NAK) = 21 1337d4fba8b9Smrg , DATA(SYN) = 22 1338d4fba8b9Smrg , DATA(ETB) = 23 1339d4fba8b9Smrg , DATA(CAN) = 24 1340d4fba8b9Smrg , DATA(EM) = 25 1341d4fba8b9Smrg , DATA(SUB) = 26 1342d4fba8b9Smrg , DATA(ESC) = 27 1343d4fba8b9Smrg , DATA(FS) = 28 1344d4fba8b9Smrg , DATA(GS) = 29 1345d4fba8b9Smrg , DATA(RS) = 30 1346d4fba8b9Smrg , DATA(US) = 31 1347d4fba8b9Smrg /* aliases */ 1348d4fba8b9Smrg , DATA(C0) 1349d4fba8b9Smrg , DATA(DEL) 1350980988aeSmrg , DATA(STTY) 1351d4fba8b9Smrg#undef DATA 1352d4fba8b9Smrg , epLAST 1353d4fba8b9Smrg} PasteControls; 1354d4fba8b9Smrg 1355d4fba8b9Smrgtypedef enum { /* legal values for keyboard.shift_escape */ 1356d4fba8b9Smrg ssFalse = 0 1357d4fba8b9Smrg , ssTrue = 1 1358d4fba8b9Smrg , ssAlways = 2 1359d4fba8b9Smrg , ssNever = 3 1360d4fba8b9Smrg , ssLAST 1361d4fba8b9Smrg} ShiftEscapeOps; 1362d4fba8b9Smrg 1363d4fba8b9Smrg/* 1364d4fba8b9Smrg * xterm uses these codes for the its push-SGR feature. They match where 1365d4fba8b9Smrg * possible the corresponding SGR coding. The foreground and background colors 1366d4fba8b9Smrg * do not fit into that scheme (because they are a set of ranges), so those are 1367d4fba8b9Smrg * chosen arbitrarily -TD 1368d4fba8b9Smrg */ 1369d4fba8b9Smrgtypedef enum { 1370d4fba8b9Smrg psBOLD = 1 1371d4fba8b9Smrg#if OPT_WIDE_ATTRS 1372d4fba8b9Smrg , psATR_FAINT = 2 1373d4fba8b9Smrg , psATR_ITALIC = 3 1374d4fba8b9Smrg#endif 1375d4fba8b9Smrg , psUNDERLINE = 4 1376d4fba8b9Smrg , psBLINK = 5 1377d4fba8b9Smrg , psINVERSE = 7 1378d4fba8b9Smrg , psINVISIBLE = 8 1379d4fba8b9Smrg#if OPT_WIDE_ATTRS 1380d4fba8b9Smrg , psATR_STRIKEOUT = 9 1381d4fba8b9Smrg#endif 1382d4fba8b9Smrg /* SGR 10-19 correspond to primary/alternate fonts, currently unused */ 1383d4fba8b9Smrg#if OPT_ISO_COLORS 1384d4fba8b9Smrg , psFG_COLOR_obs = 10 1385d4fba8b9Smrg , psBG_COLOR_obs = 11 1386d4fba8b9Smrg#endif 1387d4fba8b9Smrg#if OPT_WIDE_ATTRS 1388d4fba8b9Smrg , psATR_DBL_UNDER = 21 1389d4fba8b9Smrg#endif 1390d4fba8b9Smrg /* SGR 22-29 mostly are used to reset SGR 1-9 */ 1391d4fba8b9Smrg#if OPT_ISO_COLORS 1392d4fba8b9Smrg , psFG_COLOR = 30 /* stack maps many colors to one state */ 1393d4fba8b9Smrg , psBG_COLOR = 31 1394d4fba8b9Smrg#endif 1395d4fba8b9Smrg , MAX_PUSH_SGR 1396d4fba8b9Smrg} PushSGR; 1397d4fba8b9Smrg 1398cd3331d0Smrgtypedef enum { 1399cd3331d0Smrg etSetTcap = 1 1400cd3331d0Smrg , etGetTcap 1401cd3331d0Smrg , etLAST 1402cd3331d0Smrg} TcapOps; 1403cd3331d0Smrg 1404cd3331d0Smrgtypedef enum { 14053367019cSmrg /* 1-23 are chosen to be the same as the control-sequence coding */ 1406cd3331d0Smrg ewRestoreWin = 1 1407cd3331d0Smrg , ewMinimizeWin = 2 1408cd3331d0Smrg , ewSetWinPosition = 3 1409cd3331d0Smrg , ewSetWinSizePixels = 4 1410cd3331d0Smrg , ewRaiseWin = 5 1411cd3331d0Smrg , ewLowerWin = 6 1412cd3331d0Smrg , ewRefreshWin = 7 1413cd3331d0Smrg , ewSetWinSizeChars = 8 1414cd3331d0Smrg#if OPT_MAXIMIZE 1415cd3331d0Smrg , ewMaximizeWin = 9 1416c219fbebSmrg , ewFullscreenWin = 10 1417cd3331d0Smrg#endif 1418cd3331d0Smrg , ewGetWinState = 11 1419cd3331d0Smrg , ewGetWinPosition = 13 1420cd3331d0Smrg , ewGetWinSizePixels = 14 1421d4fba8b9Smrg#if OPT_MAXIMIZE 1422d4fba8b9Smrg , ewGetScreenSizePixels = 15 1423d4fba8b9Smrg , ewGetCharSizePixels = 16 1424d4fba8b9Smrg#endif 1425cd3331d0Smrg , ewGetWinSizeChars = 18 1426cd3331d0Smrg#if OPT_MAXIMIZE 1427cd3331d0Smrg , ewGetScreenSizeChars = 19 1428cd3331d0Smrg#endif 1429cd3331d0Smrg , ewGetIconTitle = 20 1430cd3331d0Smrg , ewGetWinTitle = 21 1431cd3331d0Smrg , ewPushTitle = 22 1432cd3331d0Smrg , ewPopTitle = 23 1433cd3331d0Smrg /* these do not fit into that scheme, which is why we use an array */ 1434cd3331d0Smrg , ewSetWinLines 1435cd3331d0Smrg , ewSetXprop 1436cd3331d0Smrg , ewGetSelection 1437cd3331d0Smrg , ewSetSelection 1438d4fba8b9Smrg , ewGetChecksum 1439d4fba8b9Smrg , ewSetChecksum 1440cd3331d0Smrg /* get the size of the array... */ 1441cd3331d0Smrg , ewLAST 1442cd3331d0Smrg} WindowOps; 1443cd3331d0Smrg 1444d4fba8b9Smrg/***====================================================================***/ 1445d4fba8b9Smrg 1446cd3331d0Smrg#define COLOR_DEFINED(s,w) ((s)->which & (unsigned) (1<<(w))) 1447d522f475Smrg#define COLOR_VALUE(s,w) ((s)->colors[w]) 1448cd3331d0Smrg#define SET_COLOR_VALUE(s,w,v) (((s)->colors[w] = (v)), UIntSet((s)->which, (1<<(w)))) 1449d522f475Smrg 1450d522f475Smrg#define COLOR_NAME(s,w) ((s)->names[w]) 1451cd3331d0Smrg#define SET_COLOR_NAME(s,w,v) (((s)->names[w] = (v)), ((s)->which |= (unsigned) (1<<(w)))) 1452d522f475Smrg 1453d522f475Smrg#define UNDEFINE_COLOR(s,w) ((s)->which &= (~((w)<<1))) 1454d522f475Smrg 1455d522f475Smrg/***====================================================================***/ 1456d522f475Smrg 1457d522f475Smrg#if OPT_ISO_COLORS 1458d4fba8b9Smrg#if OPT_WIDE_ATTRS 1459d4fba8b9Smrg#define COLOR_FLAGS (FG_COLOR | BG_COLOR | ATR_DIRECT_FG | ATR_DIRECT_BG) 1460d4fba8b9Smrg#else 1461d4fba8b9Smrg#define COLOR_FLAGS (FG_COLOR | BG_COLOR) 1462d4fba8b9Smrg#endif 1463d4fba8b9Smrg#define TERM_COLOR_FLAGS(xw) ((xw)->flags & COLOR_FLAGS) 1464d522f475Smrg#define COLOR_0 0 1465d522f475Smrg#define COLOR_1 1 1466d522f475Smrg#define COLOR_2 2 1467d522f475Smrg#define COLOR_3 3 1468d522f475Smrg#define COLOR_4 4 1469d522f475Smrg#define COLOR_5 5 1470d522f475Smrg#define COLOR_6 6 1471d522f475Smrg#define COLOR_7 7 1472d522f475Smrg#define COLOR_8 8 1473d522f475Smrg#define COLOR_9 9 1474d522f475Smrg#define COLOR_10 10 1475d522f475Smrg#define COLOR_11 11 1476d522f475Smrg#define COLOR_12 12 1477d522f475Smrg#define COLOR_13 13 1478d522f475Smrg#define COLOR_14 14 1479d522f475Smrg#define COLOR_15 15 1480d522f475Smrg#define MIN_ANSI_COLORS 16 1481d522f475Smrg 1482d522f475Smrg#if OPT_256_COLORS 1483d522f475Smrg# define NUM_ANSI_COLORS 256 1484d522f475Smrg#elif OPT_88_COLORS 1485d522f475Smrg# define NUM_ANSI_COLORS 88 1486d522f475Smrg#else 1487d522f475Smrg# define NUM_ANSI_COLORS MIN_ANSI_COLORS 1488d522f475Smrg#endif 1489d522f475Smrg 1490d4fba8b9Smrg#define okIndexedColor(n) ((n) >= 0 && (n) < NUM_ANSI_COLORS) 1491d4fba8b9Smrg 1492d522f475Smrg#if NUM_ANSI_COLORS > MIN_ANSI_COLORS 1493d522f475Smrg# define OPT_EXT_COLORS 1 1494d522f475Smrg#else 1495d522f475Smrg# define OPT_EXT_COLORS 0 1496d522f475Smrg#endif 1497d522f475Smrg 1498d522f475Smrg#define COLOR_BD (NUM_ANSI_COLORS) /* BOLD */ 1499d522f475Smrg#define COLOR_UL (NUM_ANSI_COLORS+1) /* UNDERLINE */ 1500d522f475Smrg#define COLOR_BL (NUM_ANSI_COLORS+2) /* BLINK */ 1501d522f475Smrg#define COLOR_RV (NUM_ANSI_COLORS+3) /* REVERSE */ 150294644356Smrg 150394644356Smrg#if OPT_WIDE_ATTRS 150494644356Smrg#define COLOR_IT (NUM_ANSI_COLORS+4) /* ITALIC */ 150594644356Smrg#define MAXCOLORS (NUM_ANSI_COLORS+5) 150694644356Smrg#else 1507d522f475Smrg#define MAXCOLORS (NUM_ANSI_COLORS+4) 150894644356Smrg#endif 150994644356Smrg 1510d522f475Smrg#ifndef DFT_COLORMODE 1511d522f475Smrg#define DFT_COLORMODE True /* default colorMode resource */ 1512d522f475Smrg#endif 1513d522f475Smrg 151494644356Smrg#define UseItalicFont(screen) (!(screen)->colorITMode) 151594644356Smrg 1516d522f475Smrg#define ReverseOrHilite(screen,flags,hilite) \ 1517d522f475Smrg (( screen->colorRVMode && hilite ) || \ 1518d522f475Smrg ( !screen->colorRVMode && \ 1519d522f475Smrg (( (flags & INVERSE) && !hilite) || \ 1520d522f475Smrg (!(flags & INVERSE) && hilite)) )) 1521d522f475Smrg 1522d522f475Smrg#else /* !OPT_ISO_COLORS */ 1523d522f475Smrg 1524d522f475Smrg#define TERM_COLOR_FLAGS(xw) 0 1525d522f475Smrg 152694644356Smrg#define UseItalicFont(screen) True 1527d522f475Smrg#define ReverseOrHilite(screen,flags,hilite) \ 1528d522f475Smrg (( (flags & INVERSE) && !hilite) || \ 1529d522f475Smrg (!(flags & INVERSE) && hilite)) 1530d522f475Smrg 1531d522f475Smrg#endif /* OPT_ISO_COLORS */ 1532d522f475Smrg 1533d4fba8b9Smrgtypedef enum { 1534d4fba8b9Smrg XK_TCAPNAME = 3 1535d4fba8b9Smrg /* Define fake XK codes, we need those for the fake color response in 1536d4fba8b9Smrg * xtermcapKeycode(). 1537d4fba8b9Smrg */ 1538d4fba8b9Smrg#if OPT_ISO_COLORS 1539d4fba8b9Smrg , XK_COLORS 1540d4fba8b9Smrg , XK_RGB 1541d4fba8b9Smrg#endif 1542d4fba8b9Smrg} TcapQuery; 1543cd3331d0Smrg 1544d522f475Smrg#if OPT_AIX_COLORS 1545d522f475Smrg#define if_OPT_AIX_COLORS(screen, code) if(screen->colorMode) code 1546d522f475Smrg#else 1547d522f475Smrg#define if_OPT_AIX_COLORS(screen, code) /* nothing */ 1548d522f475Smrg#endif 1549d522f475Smrg 1550b7c89284Ssnj#if OPT_256_COLORS || OPT_88_COLORS || OPT_ISO_COLORS 1551b7c89284Ssnj# define if_OPT_ISO_COLORS(screen, code) if (screen->colorMode) code 1552d522f475Smrg#else 1553b7c89284Ssnj# define if_OPT_ISO_COLORS(screen, code) /* nothing */ 1554d522f475Smrg#endif 1555d522f475Smrg 1556d4fba8b9Smrg#if OPT_DIRECT_COLOR 1557d4fba8b9Smrg# define if_OPT_DIRECT_COLOR(screen, code) if (screen->direct_color) code 1558d4fba8b9Smrg# define if_OPT_DIRECT_COLOR2(screen, test, code) if (screen->direct_color && (test)) code 1559d4fba8b9Smrg#else 1560d4fba8b9Smrg# define if_OPT_DIRECT_COLOR(screen, code) /* nothing */ 1561d4fba8b9Smrg# define if_OPT_DIRECT_COLOR2(screen, test, code) /* nothing */ 1562d4fba8b9Smrg#endif 1563d4fba8b9Smrg 1564d4fba8b9Smrg#define if_OPT_DIRECT_COLOR2_else(cond, test, stmt) \ 1565d4fba8b9Smrg if_OPT_DIRECT_COLOR2(cond, test, stmt else) 1566d4fba8b9Smrg 1567d522f475Smrg#define COLOR_RES_NAME(root) "color" root 1568d522f475Smrg 1569d522f475Smrg#if OPT_COLOR_CLASS 1570d522f475Smrg#define COLOR_RES_CLASS(root) "Color" root 1571d522f475Smrg#else 1572d522f475Smrg#define COLOR_RES_CLASS(root) XtCForeground 1573d522f475Smrg#endif 1574d522f475Smrg 1575d522f475Smrg#define COLOR_RES(root,offset,value) Sres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset.resource, value) 1576d522f475Smrg#define COLOR_RES2(name,class,offset,value) Sres(name, class, offset.resource, value) 1577d522f475Smrg 1578d522f475Smrg#define CLICK_RES_NAME(count) "on" count "Clicks" 1579d522f475Smrg#define CLICK_RES_CLASS(count) "On" count "Clicks" 1580d522f475Smrg#define CLICK_RES(count,offset,value) Sres(CLICK_RES_NAME(count), CLICK_RES_CLASS(count), offset, value) 1581d522f475Smrg 1582d522f475Smrg/***====================================================================***/ 1583d522f475Smrg 1584d522f475Smrg#if OPT_DEC_CHRSET 1585d522f475Smrg#define if_OPT_DEC_CHRSET(code) code 1586d522f475Smrg /* Use 2 bits for encoding the double high/wide sense of characters */ 1587d1603babSmrg#define CSET_SWL 0 /* character set: single-width line */ 1588d1603babSmrg#define CSET_DHL_TOP 1 /* character set: double-height top line */ 1589d1603babSmrg#define CSET_DHL_BOT 2 /* character set: double-height bottom line */ 1590d1603babSmrg#define CSET_DWL 3 /* character set: double-width line */ 1591d522f475Smrg#define NUM_CHRSET 8 /* normal/bold and 4 CSET_xxx values */ 1592b7c89284Ssnj 1593d522f475Smrg /* Use remaining bits for encoding the other character-sets */ 1594d522f475Smrg#define CSET_NORMAL(code) ((code) == CSET_SWL) 1595d522f475Smrg#define CSET_DOUBLE(code) (!CSET_NORMAL(code) && !CSET_EXTEND(code)) 1596cd3331d0Smrg#define CSET_EXTEND(code) ((int)(code) > CSET_DWL) 1597b7c89284Ssnj 1598b7c89284Ssnj#define DBLCS_BITS 4 1599b7c89284Ssnj#define DBLCS_MASK BITS2MASK(DBLCS_BITS) 1600b7c89284Ssnj 1601b7c89284Ssnj#define GetLineDblCS(ld) (((ld)->bufHead >> LINEFLAG_BITS) & DBLCS_MASK) 1602b7c89284Ssnj#define SetLineDblCS(ld,cs) (ld)->bufHead = (RowData) ((ld->bufHead & LINEFLAG_MASK) | (cs << LINEFLAG_BITS)) 1603b7c89284Ssnj 1604b7c89284Ssnj#define LineCharSet(screen, ld) \ 1605d4fba8b9Smrg (unsigned) ((CSET_DOUBLE(GetLineDblCS(ld))) \ 1606d4fba8b9Smrg ? GetLineDblCS(ld) \ 1607d4fba8b9Smrg : (screen)->cur_chrset) 1608b7c89284Ssnj#define LineMaxCol(screen, ld) \ 1609b7c89284Ssnj (CSET_DOUBLE(GetLineDblCS(ld)) \ 1610b7c89284Ssnj ? (screen->max_col / 2) \ 1611b7c89284Ssnj : (screen->max_col)) 1612b7c89284Ssnj#define LineCursorX(screen, ld, col) \ 1613b7c89284Ssnj (CSET_DOUBLE(GetLineDblCS(ld)) \ 1614b7c89284Ssnj ? CursorX(screen, 2*(col)) \ 1615b7c89284Ssnj : CursorX(screen, (col))) 1616b7c89284Ssnj#define LineFontWidth(screen, ld) \ 1617b7c89284Ssnj (CSET_DOUBLE(GetLineDblCS(ld)) \ 1618b7c89284Ssnj ? 2*FontWidth(screen) \ 1619b7c89284Ssnj : FontWidth(screen)) 1620d522f475Smrg#else 1621b7c89284Ssnj 1622d522f475Smrg#define if_OPT_DEC_CHRSET(code) /*nothing*/ 1623d4fba8b9Smrg#define CSET_SWL 0 1624d4fba8b9Smrg#define GetLineDblCS(ld) 0U 1625d4fba8b9Smrg#define LineCharSet(screen, ld) 0U 1626b7c89284Ssnj#define LineMaxCol(screen, ld) screen->max_col 1627b7c89284Ssnj#define LineCursorX(screen, ld, col) CursorX(screen, col) 1628b7c89284Ssnj#define LineFontWidth(screen, ld) FontWidth(screen) 1629b7c89284Ssnj 1630d522f475Smrg#endif 1631d522f475Smrg 1632d522f475Smrg#if OPT_LUIT_PROG && !OPT_WIDE_CHARS 1633d4fba8b9Smrg/* Luit requires the wide-chars configuration */ 1634d4fba8b9Smrg#undef OPT_LUIT_PROG 1635d4fba8b9Smrg#define OPT_LUIT_PROG 0 1636d522f475Smrg#endif 1637d522f475Smrg 1638d522f475Smrg/***====================================================================***/ 1639d522f475Smrg 1640980988aeSmrg#if OPT_DEC_RECTOPS 1641980988aeSmrg#define if_OPT_DEC_RECTOPS(stmt) stmt 1642980988aeSmrg#else 1643980988aeSmrg#define if_OPT_DEC_RECTOPS(stmt) /* nothing */ 1644980988aeSmrg#endif 1645980988aeSmrg 1646980988aeSmrg/***====================================================================***/ 1647980988aeSmrg 1648d522f475Smrg#if OPT_EBCDIC 1649d522f475Smrgextern int E2A(int); 1650d522f475Smrgextern int A2E(int); 1651d522f475Smrg#else 1652d522f475Smrg#define E2A(a) (a) 1653d522f475Smrg#define A2E(a) (a) 1654d522f475Smrg#endif 1655d522f475Smrg 1656d522f475Smrg#define CONTROL(a) (A2E(E2A(a)&037)) 1657d522f475Smrg 1658d1603babSmrg#define XTERM_ERASE A2E(CONTROL('H')) 1659d1603babSmrg#define XTERM_LNEXT A2E(CONTROL('V')) 1660d1603babSmrg 1661d522f475Smrg/***====================================================================***/ 1662d522f475Smrg 1663d522f475Smrg#if OPT_TEK4014 1664d522f475Smrg#define TEK4014_ACTIVE(xw) ((xw)->misc.TekEmu) 1665d522f475Smrg#define TEK4014_SHOWN(xw) ((xw)->misc.Tshow) 1666d522f475Smrg#define CURRENT_EMU_VAL(tek,vt) (TEK4014_ACTIVE(term) ? tek : vt) 1667d522f475Smrg#define CURRENT_EMU() CURRENT_EMU_VAL((Widget)tekWidget, (Widget)term) 1668d522f475Smrg#else 1669d522f475Smrg#define TEK4014_ACTIVE(screen) 0 1670d522f475Smrg#define TEK4014_SHOWN(xw) 0 1671d522f475Smrg#define CURRENT_EMU_VAL(tek,vt) (vt) 1672d522f475Smrg#define CURRENT_EMU() ((Widget)term) 1673d522f475Smrg#endif 1674d522f475Smrg 1675d522f475Smrg/***====================================================================***/ 1676d522f475Smrg 1677d522f475Smrg#if OPT_TOOLBAR 1678d522f475Smrg#define SHELL_OF(widget) XtParent(XtParent(widget)) 1679d522f475Smrg#else 1680d522f475Smrg#define SHELL_OF(widget) XtParent(widget) 1681d522f475Smrg#endif 1682d522f475Smrg 1683d522f475Smrg/***====================================================================***/ 1684d522f475Smrg 1685d522f475Smrg#if OPT_VT52_MODE 1686d522f475Smrg#define if_OPT_VT52_MODE(screen, code) if(screen->vtXX_level == 0) code 1687d522f475Smrg#else 1688d522f475Smrg#define if_OPT_VT52_MODE(screen, code) /* nothing */ 1689d522f475Smrg#endif 1690d522f475Smrg 1691d522f475Smrg/***====================================================================***/ 1692d522f475Smrg 1693d522f475Smrg#if OPT_XMC_GLITCH 1694d522f475Smrg#define if_OPT_XMC_GLITCH(screen, code) if(screen->xmc_glitch) code 1695d522f475Smrg#define XMC_GLITCH 1 /* the character we'll show */ 1696d522f475Smrg#define XMC_FLAGS (INVERSE|UNDERLINE|BOLD|BLINK) 1697d522f475Smrg#else 1698d522f475Smrg#define if_OPT_XMC_GLITCH(screen, code) /* nothing */ 1699d522f475Smrg#endif 1700d522f475Smrg 1701d522f475Smrg/***====================================================================***/ 1702d522f475Smrg 17039a64e1c5Smrgtypedef unsigned IFlags; /* at least 32 bits */ 17049a64e1c5Smrg 17059a64e1c5Smrg#if OPT_WIDE_ATTRS 17069a64e1c5Smrgtypedef unsigned short IAttr; /* at least 16 bits */ 17079a64e1c5Smrg#else 17089a64e1c5Smrgtypedef unsigned char IAttr; /* at least 8 bits */ 17099a64e1c5Smrg#endif 17109a64e1c5Smrg 17119a64e1c5Smrg/***====================================================================***/ 17129a64e1c5Smrg 17130d92cbfdSchristos#define LO_BYTE(ch) CharOf((ch) & 0xff) 17140d92cbfdSchristos#define HI_BYTE(ch) CharOf((ch) >> 8) 17150d92cbfdSchristos 1716d522f475Smrg#if OPT_WIDE_CHARS 1717d522f475Smrg#define if_OPT_WIDE_CHARS(screen, code) if(screen->wide_chars) code 1718d522f475Smrg#define if_WIDE_OR_NARROW(screen, wide, narrow) if(screen->wide_chars) wide else narrow 1719980988aeSmrg#define NARROW_ICHAR 0xffff 1720b7c89284Ssnj#if OPT_WIDER_ICHAR 1721980988aeSmrg#define is_NON_CHAR(c) (((c) >= 0xffd0 && (c) <= 0xfdef) || \ 1722980988aeSmrg (((c) & 0xffff) >= 0xfffe)) 1723980988aeSmrg#define is_UCS_SPECIAL(c) ((c) >= 0xfff0 && (c) <= 0xffff) 1724980988aeSmrg#define WIDEST_ICHAR 0x1fffff 1725980988aeSmrgtypedef unsigned IChar; /* for 8-21 bit characters */ 1726b7c89284Ssnj#else 1727980988aeSmrg#define is_NON_CHAR(c) (((c) >= 0xffd0 && (c) <= 0xfdef) || \ 1728980988aeSmrg ((c) >= 0xfffe && (c) <= 0xffff)) 1729980988aeSmrg#define is_UCS_SPECIAL(c) ((c) >= 0xfff0) 1730980988aeSmrg#define WIDEST_ICHAR NARROW_ICHAR 1731b7c89284Ssnjtypedef unsigned short IChar; /* for 8-16 bit characters */ 1732b7c89284Ssnj#endif 1733d1603babSmrg#else /* !OPT_WIDE_CHARS */ 1734d1603babSmrg#undef OPT_WIDER_ICHAR 1735d1603babSmrg#define OPT_WIDER_ICHAR 0 1736980988aeSmrg#define is_NON_CHAR(c) ((c) > 255) 1737d522f475Smrg#define if_OPT_WIDE_CHARS(screen, code) /* nothing */ 1738d522f475Smrg#define if_WIDE_OR_NARROW(screen, wide, narrow) narrow 1739d522f475Smrgtypedef unsigned char IChar; /* for 8-bit characters */ 1740d522f475Smrg#endif 1741d522f475Smrg 1742d522f475Smrg/***====================================================================***/ 1743d522f475Smrg 1744d522f475Smrg#ifndef RES_OFFSET 1745d522f475Smrg#define RES_OFFSET(offset) XtOffsetOf(XtermWidgetRec, offset) 1746d522f475Smrg#endif 1747d522f475Smrg 1748d522f475Smrg#define RES_NAME(name) name 1749d522f475Smrg#define RES_CLASS(name) name 1750d522f475Smrg 1751d522f475Smrg#define Bres(name, class, offset, dftvalue) \ 1752d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRBoolean, sizeof(Boolean), \ 1753d522f475Smrg RES_OFFSET(offset), XtRImmediate, (XtPointer) dftvalue} 1754d522f475Smrg 1755d522f475Smrg#define Cres(name, class, offset, dftvalue) \ 1756d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRPixel, sizeof(Pixel), \ 1757fa3f02f3Smrg RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)} 1758d522f475Smrg 1759d522f475Smrg#define Tres(name, class, offset, dftvalue) \ 1760d522f475Smrg COLOR_RES2(name, class, screen.Tcolors[offset], dftvalue) \ 1761d522f475Smrg 1762d522f475Smrg#define Fres(name, class, offset, dftvalue) \ 1763d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRFontStruct, sizeof(XFontStruct *), \ 1764fa3f02f3Smrg RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)} 1765d522f475Smrg 1766d522f475Smrg#define Ires(name, class, offset, dftvalue) \ 1767d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRInt, sizeof(int), \ 1768d522f475Smrg RES_OFFSET(offset), XtRImmediate, (XtPointer) dftvalue} 1769d522f475Smrg 1770d522f475Smrg#define Dres(name, class, offset, dftvalue) \ 1771d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRFloat, sizeof(float), \ 1772fa3f02f3Smrg RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)} 1773d522f475Smrg 1774d522f475Smrg#define Sres(name, class, offset, dftvalue) \ 1775d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRString, sizeof(char *), \ 1776fa3f02f3Smrg RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)} 1777d522f475Smrg 1778d522f475Smrg#define Wres(name, class, offset, dftvalue) \ 1779d522f475Smrg {RES_NAME(name), RES_CLASS(class), XtRWidget, sizeof(Widget), \ 1780d522f475Smrg RES_OFFSET(offset), XtRWidget, (XtPointer) dftvalue} 1781d522f475Smrg 1782d522f475Smrg/***====================================================================***/ 1783d522f475Smrg 1784d522f475Smrg#define FRG_SIZE resource.minBufSize 1785d522f475Smrg#define BUF_SIZE resource.maxBufSize 1786d522f475Smrg 1787d522f475Smrgtypedef struct { 178894644356Smrg Char *next; 178994644356Smrg Char *last; 179094644356Smrg int update; /* HandleInterpret */ 1791d522f475Smrg#if OPT_WIDE_CHARS 179294644356Smrg IChar utf_data; /* resulting character */ 1793d1603babSmrg size_t utf_size; /* ...number of bytes decoded */ 179494644356Smrg Char *write_buf; 1795d1603babSmrg size_t write_len; 1796d522f475Smrg#endif 179794644356Smrg Char buffer[1]; 1798d522f475Smrg} PtyData; 1799d522f475Smrg 1800d522f475Smrg/***====================================================================***/ 1801d522f475Smrg 1802d4fba8b9Smrg/* 1803d4fba8b9Smrg * Pixel (and its components) are declared as unsigned long, but even for RGB 1804d4fba8b9Smrg * we need no more than 32-bits. 1805d4fba8b9Smrg */ 1806d4fba8b9Smrgtypedef uint32_t MyPixel; 1807d4fba8b9Smrgtypedef int32_t MyColor; 1808d4fba8b9Smrg 1809d522f475Smrg#if OPT_ISO_COLORS 1810d4fba8b9Smrg#if OPT_DIRECT_COLOR 1811d4fba8b9Smrgtypedef struct { 1812d4fba8b9Smrg MyColor fg; 1813d4fba8b9Smrg MyColor bg; 1814d4fba8b9Smrg} CellColor; 1815d4fba8b9Smrg 1816d4fba8b9Smrg#define isSameCColor(p,q) (!memcmp(&(p), &(q), sizeof(CellColor))) 1817d4fba8b9Smrg 1818d4fba8b9Smrg#elif OPT_256_COLORS || OPT_88_COLORS 1819d4fba8b9Smrg 1820b7c89284Ssnj#define COLOR_BITS 8 1821b7c89284Ssnjtypedef unsigned short CellColor; 1822d4fba8b9Smrg 1823d522f475Smrg#else 1824d4fba8b9Smrg 1825b7c89284Ssnj#define COLOR_BITS 4 1826b7c89284Ssnjtypedef Char CellColor; 1827d4fba8b9Smrg 1828d522f475Smrg#endif 1829b7c89284Ssnj#else 18309a64e1c5Smrgtypedef unsigned CellColor; 1831d522f475Smrg#endif 1832b7c89284Ssnj 1833d4fba8b9Smrg#define NO_COLOR ((unsigned)-1) 1834d4fba8b9Smrg 1835d4fba8b9Smrg#ifndef isSameCColor 1836d4fba8b9Smrg#define isSameCColor(p,q) ((p) == (q)) 1837d4fba8b9Smrg#endif 1838d4fba8b9Smrg 1839d4fba8b9Smrg#define BITS2MASK(b) ((1 << b) - 1) 1840b7c89284Ssnj 1841d4fba8b9Smrg#define COLOR_MASK BITS2MASK(COLOR_BITS) 1842b7c89284Ssnj 1843d4fba8b9Smrg#if OPT_DIRECT_COLOR 1844d4fba8b9Smrg#define clrDirectFG(flags) UIntClr(flags, ATR_DIRECT_FG) 1845d4fba8b9Smrg#define clrDirectBG(flags) UIntClr(flags, ATR_DIRECT_BG) 1846d4fba8b9Smrg#define GetCellColorFG(data) ((data).fg) 1847d4fba8b9Smrg#define GetCellColorBG(data) ((data).bg) 1848d4fba8b9Smrg#define hasDirectFG(flags) ((flags) & ATR_DIRECT_FG) 1849d4fba8b9Smrg#define hasDirectBG(flags) ((flags) & ATR_DIRECT_BG) 1850d4fba8b9Smrg#define setDirectFG(flags,test) if (test) UIntSet(flags, ATR_DIRECT_FG); else UIntClr(flags, ATR_DIRECT_FG) 1851d4fba8b9Smrg#define setDirectBG(flags,test) if (test) UIntSet(flags, ATR_DIRECT_BG); else UIntClr(flags, ATR_DIRECT_BG) 1852d4fba8b9Smrg#elif OPT_ISO_COLORS 1853d4fba8b9Smrg#define clrDirectFG(flags) /* nothing */ 1854d4fba8b9Smrg#define clrDirectBG(flags) /* nothing */ 1855d4fba8b9Smrg#define GetCellColorFG(data) ((data) & COLOR_MASK) 1856d4fba8b9Smrg#define GetCellColorBG(data) (((data) >> COLOR_BITS) & COLOR_MASK) 1857d4fba8b9Smrg#define hasDirectFG(flags) 0 1858d4fba8b9Smrg#define hasDirectBG(flags) 0 1859d4fba8b9Smrg#define setDirectFG(flags,test) (void)(test) 1860d4fba8b9Smrg#define setDirectBG(flags,test) (void)(test) 1861d4fba8b9Smrg#else 1862d4fba8b9Smrg#define GetCellColorFG(data) 7 1863d4fba8b9Smrg#define GetCellColorBG(data) 0 1864d4fba8b9Smrg#endif 1865d4fba8b9Smrgextern CellColor blank_cell_color; 1866b7c89284Ssnj 1867b7c89284Ssnjtypedef Char RowData; /* wrap/blink, and DEC single-double chars */ 1868b7c89284Ssnj 1869d4fba8b9Smrg#define LINEFLAG_BITS 4 1870d4fba8b9Smrg#define LINEFLAG_MASK BITS2MASK(LINEFLAG_BITS) 1871b7c89284Ssnj 1872d4fba8b9Smrg#define GetLineFlags(ld) ((ld)->bufHead & LINEFLAG_MASK) 1873b7c89284Ssnj 1874d522f475Smrg#if OPT_DEC_CHRSET 1875d4fba8b9Smrg#define SetLineFlags(ld,xx) (ld)->bufHead = (RowData) ((ld->bufHead & (DBLCS_MASK << LINEFLAG_BITS)) | (xx & LINEFLAG_MASK)) 1876b7c89284Ssnj#else 1877d4fba8b9Smrg#define SetLineFlags(ld,xx) (ld)->bufHead = (RowData) (xx & LINEFLAG_MASK) 1878d522f475Smrg#endif 1879b7c89284Ssnj 1880b7c89284Ssnjtypedef IChar CharData; 1881b7c89284Ssnj 1882b7c89284Ssnj/* 1883b7c89284Ssnj * This is the xterm line-data/scrollback structure. 1884b7c89284Ssnj */ 1885b7c89284Ssnjtypedef struct { 1886b7c89284Ssnj Dimension lineSize; /* number of columns in this row */ 1887980988aeSmrg RowData bufHead; /* flag for wrapped lines */ 1888d522f475Smrg#if OPT_WIDE_CHARS 1889980988aeSmrg Char combSize; /* number of items in combData[] */ 1890b7c89284Ssnj#endif 1891980988aeSmrg#if OPT_DEC_RECTOPS 1892980988aeSmrg Char *charSets; /* SCS code (DECNRCM_codes) */ 1893980988aeSmrg Char *charSeen; /* pre-SCS value */ 1894980988aeSmrg#endif 1895980988aeSmrg IAttr *attribs; /* video attributes */ 1896b7c89284Ssnj#if OPT_ISO_COLORS 1897b7c89284Ssnj CellColor *color; /* foreground+background color numbers */ 1898b7c89284Ssnj#endif 1899b7c89284Ssnj CharData *charData; /* cell's base character */ 1900980988aeSmrg CharData *combData[1]; /* first field past fixed-offsets */ 1901b7c89284Ssnj} LineData; 1902b7c89284Ssnj 190394644356Smrgtypedef const LineData CLineData; 190494644356Smrg 1905b7c89284Ssnj/* 1906b7c89284Ssnj * We use CellData in a few places, when copying a cell's data to a temporary 1907b7c89284Ssnj * variable. 1908b7c89284Ssnj */ 1909b7c89284Ssnjtypedef struct { 1910980988aeSmrg IAttr attribs; /* video attributes */ 1911b7c89284Ssnj#if OPT_WIDE_CHARS 1912980988aeSmrg Char combSize; /* number of items in combData[] */ 1913980988aeSmrg#endif 1914980988aeSmrg#if OPT_DEC_RECTOPS 1915980988aeSmrg Char charSets; /* SCS code (DECNRCM_codes) */ 1916980988aeSmrg Char charSeen; /* pre-SCS value */ 1917b7c89284Ssnj#endif 1918b7c89284Ssnj#if OPT_ISO_COLORS 1919980988aeSmrg CellColor color; /* foreground+background color numbers */ 1920d522f475Smrg#endif 1921b7c89284Ssnj CharData charData; /* cell's base character */ 1922b7c89284Ssnj CharData combData[1]; /* array of combining chars */ 1923b7c89284Ssnj} CellData; 1924b7c89284Ssnj 1925b7c89284Ssnj#define for_each_combData(off, ld) for (off = 0; off < ld->combSize; ++off) 1926b7c89284Ssnj 1927d4fba8b9Smrg#define Clear1Cell(ld, x) \ 1928d4fba8b9Smrg do { \ 1929d4fba8b9Smrg ld->charData[x] = ' '; \ 1930d4fba8b9Smrg do { \ 1931d4fba8b9Smrg if_OPT_WIDE_CHARS(screen, { \ 1932d4fba8b9Smrg size_t z; \ 1933d4fba8b9Smrg for_each_combData(z, ld) { \ 1934d4fba8b9Smrg ld->combData[z][x] = '\0'; \ 1935d4fba8b9Smrg } \ 1936d4fba8b9Smrg }) } while (0); \ 1937d4fba8b9Smrg } while (0) 1938d4fba8b9Smrg 1939d4fba8b9Smrg#define Clear2Cell(dst, src, x) \ 1940d4fba8b9Smrg do { \ 1941d4fba8b9Smrg dst->charData[x] = ' '; \ 1942d4fba8b9Smrg dst->attribs[x] = src->attribs[x]; \ 1943d4fba8b9Smrg do { \ 1944d4fba8b9Smrg if_OPT_ISO_COLORS(screen, { \ 1945d4fba8b9Smrg dst->color[x] = src->color[x]; \ 1946d4fba8b9Smrg }) } while (0); \ 1947d4fba8b9Smrg do { \ 1948d4fba8b9Smrg if_OPT_WIDE_CHARS(screen, { \ 1949d4fba8b9Smrg size_t z; \ 1950d4fba8b9Smrg for_each_combData(z, dst) { \ 1951d4fba8b9Smrg dst->combData[z][x] = '\0'; \ 1952d4fba8b9Smrg } \ 1953d4fba8b9Smrg }) } while (0); \ 1954d4fba8b9Smrg } while (0) 1955d4fba8b9Smrg 1956b7c89284Ssnj/* 1957b7c89284Ssnj * Accommodate older compilers by not using variable-length arrays. 1958b7c89284Ssnj */ 1959b7c89284Ssnj#define SizeOfLineData offsetof(LineData, combData) 1960b7c89284Ssnj#define SizeOfCellData offsetof(CellData, combData) 1961d522f475Smrg 1962d522f475Smrg /* 1963d522f475Smrg * A "row" is the index within the visible part of the screen, and an 1964d522f475Smrg * "inx" is the index within the whole set of scrollable lines. 1965d522f475Smrg */ 1966d522f475Smrg#define ROW2INX(screen, row) ((row) + (screen)->topline) 1967d522f475Smrg#define INX2ROW(screen, inx) ((inx) - (screen)->topline) 1968d522f475Smrg 196994644356Smrg/* these are unused but could be useful for debugging */ 197094644356Smrg#if 0 1971d522f475Smrg#define ROW2ABS(screen, row) ((row) + (screen)->savedlines) 1972d522f475Smrg#define INX2ABS(screen, inx) ROW2ABS(screen, INX2ROW(screen, inx)) 197394644356Smrg#endif 1974d522f475Smrg 1975d522f475Smrg#define okScrnRow(screen, row) \ 1976b7c89284Ssnj ((row) <= ((screen)->max_row - (screen)->topline) \ 1977d522f475Smrg && (row) >= -((screen)->savedlines)) 1978d522f475Smrg 1979b7c89284Ssnj /* 1980b7c89284Ssnj * Cache data for "proportional" and other fonts containing a mixture 1981b7c89284Ssnj * of widths. 1982b7c89284Ssnj */ 1983b7c89284Ssnjtypedef struct { 19843367019cSmrg Bool mixed; 1985b7c89284Ssnj Dimension min_width; /* nominal cell width for 0..255 */ 1986b7c89284Ssnj Dimension max_width; /* maximum cell width */ 1987d1603babSmrg} XTermFontInfo; 1988d522f475Smrg 1989d1603babSmrg /* 1990d1603babSmrg * Map of characters to simplify/speed-up the checks for missing glyphs 1991d1603babSmrg * at runtime. 1992d1603babSmrg * 1993d1603babSmrg * FIXME: initially implement for Xft, but replace known_missing[] in 1994d1603babSmrg * X11 fonts as well. 1995d1603babSmrg */ 1996d1603babSmrgtypedef Char XTfontNum; 1997d1603babSmrgtypedef struct { 1998d1603babSmrg int depth; /* number of fonts merged for map */ 1999d1603babSmrg size_t limit; /* allocated size of per_font, etc */ 2000d1603babSmrg size_t first_char; /* merged first-character index */ 2001d1603babSmrg size_t last_char; /* merged last-character index */ 2002d1603babSmrg XTfontNum * per_font; /* index 1-n of first font with char */ 2003d1603babSmrg} XTermFontMap; 2004fa3f02f3Smrg 2005dfb07bc7Smrgtypedef enum { 2006dfb07bc7Smrg fwNever = 0, 2007dfb07bc7Smrg fwResource, 2008dfb07bc7Smrg fwAlways 2009dfb07bc7Smrg} fontWarningTypes; 2010dfb07bc7Smrg 2011d522f475Smrgtypedef struct { 2012d522f475Smrg unsigned chrset; 2013d522f475Smrg unsigned flags; 2014dfb07bc7Smrg fontWarningTypes warn; 2015d522f475Smrg XFontStruct * fs; 2016d522f475Smrg char * fn; 2017d1603babSmrg XTermFontInfo font_info; 2018d1603babSmrg Char known_missing[MaxUChar + 1]; 2019d522f475Smrg} XTermFonts; 2020d522f475Smrg 2021b7c89284Ssnj#if OPT_RENDERFONT 2022cd3331d0Smrgtypedef enum { 2023cd3331d0Smrg erFalse = 0 2024cd3331d0Smrg , erTrue 2025cd3331d0Smrg , erDefault 2026636d5e9fSmrg , erDefaultOff 2027cd3331d0Smrg , erLast 2028cd3331d0Smrg} RenderFont; 2029cd3331d0Smrg 2030cd3331d0Smrg#define DefaultRenderFont(xw) \ 20313367019cSmrg if ((xw)->work.render_font == erDefault) \ 20323367019cSmrg (xw)->work.render_font = erFalse 2033cd3331d0Smrg 2034d4fba8b9Smrgtypedef enum { 2035d4fba8b9Smrg xcEmpty = 0 /* slot is unused */ 2036d4fba8b9Smrg , xcBogus /* ignore this pattern */ 2037d4fba8b9Smrg , xcOpened /* slot has open font descriptor */ 2038d4fba8b9Smrg , xcUnused /* opened, but unused so far */ 2039d1603babSmrg} XTermXftState; 2040d4fba8b9Smrg 2041b7c89284Ssnjtypedef struct { 2042b7c89284Ssnj XftFont * font; 2043d1603babSmrg XTermXftState usage; 2044d4fba8b9Smrg} XTermXftCache; 2045d4fba8b9Smrg 2046d1603babSmrg#define MaxXftCache MaxUChar 2047d1603babSmrg 2048d4fba8b9Smrgtypedef struct { 2049d4fba8b9Smrg XftPattern * pattern; /* pattern for main font */ 2050d4fba8b9Smrg XftFontSet * fontset; /* ordered list of fallback patterns */ 2051d1603babSmrg XTermXftCache cache[MaxXftCache + 1]; /* list of open font pointers */ 2052d1603babSmrg int fs_size; /* last usable index of cache[] */ 2053d1603babSmrg Char opened; /* number in cache[] with xcOpened */ 2054d1603babSmrg XTermFontInfo font_info; /* summary of font metrics */ 2055d1603babSmrg XTermFontMap font_map; /* map of glyphs provided in fontset */ 2056b7c89284Ssnj} XTermXftFonts; 2057d4fba8b9Smrg 2058d1603babSmrg#define XftFpN(p,n) (p)->cache[(n)].font 2059d1603babSmrg#define XftIsN(p,n) (p)->cache[(n)].usage 2060d1603babSmrg 2061d1603babSmrg#define XftFp(p) XftFpN(p,0) 2062d1603babSmrg#define XftIs(p) XftIsN(p,0) 2063d1603babSmrg 2064d4fba8b9Smrgtypedef struct _ListXftFonts { 2065d4fba8b9Smrg struct _ListXftFonts *next; 2066d4fba8b9Smrg XftFont * font; 2067d4fba8b9Smrg} ListXftFonts; 2068b7c89284Ssnj#endif 2069b7c89284Ssnj 2070d522f475Smrgtypedef struct { 2071d522f475Smrg int top; 2072d522f475Smrg int left; 2073d522f475Smrg int bottom; 2074d522f475Smrg int right; 2075d522f475Smrg} XTermRect; 2076d522f475Smrg 2077d4fba8b9Smrg/***====================================================================***/ 2078d4fba8b9Smrg 2079d522f475Smrg /* indices into save_modes[] */ 2080d522f475Smrgtypedef enum { 2081d4fba8b9Smrg DP_ALLOW_ALTBUF, 20823367019cSmrg DP_ALTERNATE_SCROLL, 20833367019cSmrg DP_ALT_SENDS_ESC, 20843367019cSmrg DP_BELL_IS_URGENT, 2085d522f475Smrg DP_CRS_VISIBLE, 2086d522f475Smrg DP_DECANM, 2087d522f475Smrg DP_DECARM, 2088d522f475Smrg DP_DECAWM, 2089d522f475Smrg DP_DECBKM, 2090d522f475Smrg DP_DECCKM, 2091d522f475Smrg DP_DECCOLM, /* IN132COLUMNS */ 20923367019cSmrg DP_DECKPAM, 20933367019cSmrg DP_DECNRCM, 2094d522f475Smrg DP_DECOM, 2095d522f475Smrg DP_DECPEX, 2096d522f475Smrg DP_DECPFF, 2097d522f475Smrg DP_DECSCLM, 2098d522f475Smrg DP_DECSCNM, 2099d522f475Smrg DP_DECTCEM, 21003367019cSmrg DP_DELETE_IS_DEL, 21013367019cSmrg DP_EIGHT_BIT_META, 2102980988aeSmrg DP_FAST_SCROLL, 2103037a25ddSmrg DP_KEEP_CLIPBOARD, 21043367019cSmrg DP_KEEP_SELECTION, 21053367019cSmrg DP_KEYBOARD_TYPE, 21063367019cSmrg DP_POP_ON_BELL, 2107d522f475Smrg DP_PRN_EXTENT, 2108d522f475Smrg DP_PRN_FORMFEED, 21093367019cSmrg DP_RXVT_SCROLLBAR, 21103367019cSmrg DP_RXVT_SCROLL_TTY_KEYPRESS, 21113367019cSmrg DP_RXVT_SCROLL_TTY_OUTPUT, 21123367019cSmrg DP_SELECT_TO_CLIPBOARD, 2113d4fba8b9Smrg DP_X_ALTBUF, 2114d522f475Smrg DP_X_DECCOLM, 21153367019cSmrg DP_X_EXT_MOUSE, 2116d522f475Smrg DP_X_LOGGING, 21173367019cSmrg DP_X_LRMM, 2118d522f475Smrg DP_X_MARGIN, 2119d522f475Smrg DP_X_MORE, 2120d522f475Smrg DP_X_MOUSE, 21213367019cSmrg DP_X_NCSM, 2122d522f475Smrg DP_X_REVWRAP, 2123980988aeSmrg DP_X_REVWRAP2, 2124d522f475Smrg DP_X_X10MSE, 2125d522f475Smrg#if OPT_BLINK_CURS 2126d522f475Smrg DP_CRS_BLINK, 2127d522f475Smrg#endif 2128d522f475Smrg#if OPT_FOCUS_EVENT 2129d522f475Smrg DP_X_FOCUS, 2130d522f475Smrg#endif 21313367019cSmrg#if OPT_NUM_LOCK 21323367019cSmrg DP_REAL_NUMLOCK, 21333367019cSmrg DP_META_SENDS_ESC, 21343367019cSmrg#endif 21353367019cSmrg#if OPT_SHIFT_FONTS 21363367019cSmrg DP_RXVT_FONTSIZE, 21373367019cSmrg#endif 2138fa3f02f3Smrg#if OPT_SIXEL_GRAPHICS 2139fa3f02f3Smrg DP_DECSDM, 2140fa3f02f3Smrg#endif 21413367019cSmrg#if OPT_TEK4014 21423367019cSmrg DP_DECTEK, 21433367019cSmrg#endif 2144d522f475Smrg#if OPT_TOOLBAR 2145d522f475Smrg DP_TOOLBAR, 2146d522f475Smrg#endif 2147d4fba8b9Smrg#if OPT_GRAPHICS 2148fa3f02f3Smrg DP_X_PRIVATE_COLOR_REGISTERS, 2149d4fba8b9Smrg#endif 21509a64e1c5Smrg#if OPT_SIXEL_GRAPHICS 21519a64e1c5Smrg DP_SIXEL_SCROLLS_RIGHT, 2152d4fba8b9Smrg#endif 2153d4fba8b9Smrg#if OPT_PRINT_GRAPHICS 2154d4fba8b9Smrg DP_DECGEPM, /* Graphics Expanded Print Mode */ 2155d4fba8b9Smrg DP_DECGPCM, /* Graphics Print Color Mode */ 2156d4fba8b9Smrg DP_DECGPCS, /* Graphics Print Color Syntax */ 2157d4fba8b9Smrg DP_DECGPBM, /* Graphics Print Background Mode */ 2158d4fba8b9Smrg DP_DECGRPM, /* Graphics Rotated Print Mode */ 21599a64e1c5Smrg#endif 2160d522f475Smrg DP_LAST 2161d522f475Smrg} SaveModes; 2162d522f475Smrg 21630d92cbfdSchristos#define DoSM(code,value) screen->save_modes[code] = (unsigned) (value) 21640d92cbfdSchristos#define DoRM(code,value) value = (Boolean) screen->save_modes[code] 21650d92cbfdSchristos#define DoRM0(code,value) value = screen->save_modes[code] 2166d522f475Smrg 2167d522f475Smrg /* index into vt_shell[] or tek_shell[] */ 2168d522f475Smrgtypedef enum { 2169dfb07bc7Smrg noMenu = -1 2170dfb07bc7Smrg ,mainMenu 2171dfb07bc7Smrg ,vtMenu 2172dfb07bc7Smrg ,fontMenu 2173b7c89284Ssnj#if OPT_TEK4014 2174dfb07bc7Smrg ,tekMenu 2175b7c89284Ssnj#endif 2176d522f475Smrg} MenuIndex; 2177d522f475Smrg 2178cd3331d0Smrgtypedef enum { 2179cd3331d0Smrg bvOff = -1, 2180cd3331d0Smrg bvLow = 0, 2181cd3331d0Smrg bvHigh 2182cd3331d0Smrg} BellVolume; 2183cd3331d0Smrg 2184d522f475Smrg#define NUM_POPUP_MENUS 4 2185d522f475Smrg 2186d522f475Smrgtypedef struct { 2187d522f475Smrg String resource; 2188d522f475Smrg Pixel value; 21893367019cSmrg unsigned short red, green, blue; 2190cd3331d0Smrg int mode; /* -1=invalid, 0=unset, 1=set */ 2191d522f475Smrg} ColorRes; 2192d522f475Smrg 2193cd3331d0Smrg/* these are set in getPrinterFlags */ 2194cd3331d0Smrgtypedef struct { 2195cd3331d0Smrg int printer_extent; /* print complete page */ 2196cd3331d0Smrg int printer_formfeed; /* print formfeed per function */ 2197cd3331d0Smrg int printer_newline; /* print newline per function */ 2198cd3331d0Smrg int print_attributes; /* 0=off, 1=normal, 2=color */ 2199712a7ff4Smrg int print_everything; /* 0=all, 1=dft, 2=alt, 3=saved */ 2200cd3331d0Smrg} PrinterFlags; 2201cd3331d0Smrg 2202712a7ff4Smrgtypedef struct { 2203712a7ff4Smrg FILE * fp; /* output file/pipe used */ 2204712a7ff4Smrg Boolean isOpen; /* output was opened/tried */ 2205712a7ff4Smrg Boolean toFile; /* true when directly to file */ 22063367019cSmrg Boolean printer_checked; /* printer_command is checked */ 2207712a7ff4Smrg String printer_command; /* pipe/shell command string */ 2208712a7ff4Smrg Boolean printer_autoclose; /* close printer when offline */ 2209712a7ff4Smrg Boolean printer_extent; /* print complete page */ 2210712a7ff4Smrg Boolean printer_formfeed; /* print formfeed per function */ 2211712a7ff4Smrg Boolean printer_newline; /* print newline per function */ 2212712a7ff4Smrg int printer_controlmode; /* 0=off, 1=auto, 2=controller */ 2213712a7ff4Smrg int print_attributes; /* 0=off, 1=normal, 2=color */ 2214712a7ff4Smrg int print_everything; /* 0=all, 1=dft, 2=alt, 3=saved */ 2215712a7ff4Smrg} PrinterState; 2216712a7ff4Smrg 2217d522f475Smrgtypedef struct { 2218d522f475Smrg unsigned which; /* must have NCOLORS bits */ 2219d522f475Smrg Pixel colors[NCOLORS]; 2220d522f475Smrg char *names[NCOLORS]; 2221d522f475Smrg} ScrnColors; 2222d522f475Smrg 2223d4fba8b9Smrg#define NUM_GSETS 4 2224980988aeSmrg#define NUM_GSETS2 (NUM_GSETS + 1) /* include user-preferred */ 2225980988aeSmrg#define gsets_upss gsets[4] 2226980988aeSmrg 2227980988aeSmrg#define SAVED_CURSORS 2 2228d4fba8b9Smrg 2229d522f475Smrgtypedef struct { 2230d522f475Smrg Boolean saved; 2231d522f475Smrg int row; 2232d522f475Smrg int col; 22339a64e1c5Smrg IFlags flags; /* VTxxx saves graphics rendition */ 22340d92cbfdSchristos Char curgl; 22350d92cbfdSchristos Char curgr; 2236980988aeSmrg DECNRCM_codes gsets[NUM_GSETS2]; 2237dfb07bc7Smrg Boolean wrap_flag; 2238d522f475Smrg#if OPT_ISO_COLORS 2239d4fba8b9Smrg int cur_foreground; /* current foreground color */ 2240d4fba8b9Smrg int cur_background; /* current background color */ 2241d4fba8b9Smrg int sgr_foreground; /* current SGR foreground color */ 2242d4fba8b9Smrg int sgr_background; /* current SGR background color */ 2243d4fba8b9Smrg Boolean sgr_38_xcolors; /* true if ISO 8613 extension */ 2244d522f475Smrg#endif 2245d522f475Smrg} SavedCursor; 2246d522f475Smrg 2247cd3331d0Smrgtypedef struct _SaveTitle { 22483367019cSmrg struct _SaveTitle *next; 2249cd3331d0Smrg char *iconName; 2250cd3331d0Smrg char *windowName; 2251cd3331d0Smrg} SaveTitle; 2252cd3331d0Smrg 2253980988aeSmrg#define MAX_SAVED_TITLES 10 2254980988aeSmrg 2255980988aeSmrgtypedef struct { 2256980988aeSmrg int used; /* index to current item */ 2257980988aeSmrg SaveTitle data[MAX_SAVED_TITLES]; 2258980988aeSmrg} SavedTitles; 2259d522f475Smrg 2260d522f475Smrgtypedef struct { 2261d522f475Smrg int width; /* if > 0, width of scrollbar, */ 2262d522f475Smrg /* and scrollbar is showing */ 2263d522f475Smrg Boolean rv_cached; /* see ScrollBarReverseVideo */ 2264d522f475Smrg int rv_active; /* ...current reverse-video */ 2265d522f475Smrg Pixel bg; /* ...cached background color */ 2266d522f475Smrg Pixel fg; /* ...cached foreground color */ 2267d522f475Smrg Pixel bdr; /* ...cached border color */ 2268d522f475Smrg Pixmap bdpix; /* ...cached border pixmap */ 2269d522f475Smrg} SbInfo; 2270d522f475Smrg 2271d522f475Smrg#if OPT_TOOLBAR 2272d522f475Smrgtypedef struct { 2273d522f475Smrg Widget menu_bar; /* toolbar, if initialized */ 2274d522f475Smrg Dimension menu_height; /* ...and its height */ 2275d522f475Smrg Dimension menu_border; /* ...and its border */ 2276d522f475Smrg} TbInfo; 2277d522f475Smrg#define VT100_TB_INFO(name) screen.fullVwin.tb_info.name 2278d522f475Smrg#endif 2279d522f475Smrg 2280d522f475Smrgtypedef struct { 2281d522f475Smrg Window window; /* X window id */ 2282d4fba8b9Smrg int width; /* width of columns in pixels */ 2283d4fba8b9Smrg int height; /* height of rows in pixels */ 2284d522f475Smrg Dimension fullwidth; /* full width of window */ 2285d522f475Smrg Dimension fullheight; /* full height of window */ 2286d522f475Smrg int f_width; /* width of fonts in pixels */ 2287d522f475Smrg int f_height; /* height of fonts in pixels */ 2288d522f475Smrg int f_ascent; /* ascent of font in pixels */ 2289d522f475Smrg int f_descent; /* descent of font in pixels */ 2290d522f475Smrg SbInfo sb_info; 2291d4fba8b9Smrg GC filler_gc; /* filler's fg/bg */ 2292d4fba8b9Smrg GC border_gc; /* inner border's fg/bg */ 2293d4fba8b9Smrg GC marker_gc[2]; /* wrap-marks */ 2294d4fba8b9Smrg#if USE_DOUBLE_BUFFER 22953367019cSmrg Drawable drawable; /* X drawable id */ 22963367019cSmrg#endif 2297d522f475Smrg#if OPT_TOOLBAR 2298d522f475Smrg Boolean active; /* true if toolbars are used */ 2299d522f475Smrg TbInfo tb_info; /* toolbar information */ 2300d522f475Smrg#endif 2301d522f475Smrg} VTwin; 2302d522f475Smrg 2303d522f475Smrgtypedef struct { 2304d522f475Smrg Window window; /* X window id */ 2305d522f475Smrg int width; /* width of columns */ 2306d522f475Smrg int height; /* height of rows */ 2307d522f475Smrg Dimension fullwidth; /* full width of window */ 2308d522f475Smrg Dimension fullheight; /* full height of window */ 2309d522f475Smrg double tekscale; /* scale factor Tek -> vs100 */ 2310d522f475Smrg} TKwin; 2311d522f475Smrg 2312712a7ff4Smrgtypedef struct { 2313dfb07bc7Smrg char *f_n; /* the normal font */ 2314dfb07bc7Smrg char *f_b; /* the bold font */ 2315712a7ff4Smrg#if OPT_WIDE_CHARS 2316dfb07bc7Smrg char *f_w; /* the normal wide font */ 2317dfb07bc7Smrg char *f_wb; /* the bold wide font */ 2318712a7ff4Smrg#endif 2319712a7ff4Smrg} VTFontNames; 2320712a7ff4Smrg 2321dfb07bc7Smrgtypedef struct { 2322dfb07bc7Smrg char **list_n; /* the normal font */ 2323dfb07bc7Smrg char **list_b; /* the bold font */ 2324dfb07bc7Smrg#if OPT_WIDE_ATTRS || OPT_RENDERWIDE 2325dfb07bc7Smrg char **list_i; /* italic font (Xft only) */ 2326d4fba8b9Smrg char **list_bi; /* bold-italic font (Xft only) */ 2327dfb07bc7Smrg#endif 2328dfb07bc7Smrg#if OPT_WIDE_CHARS 2329dfb07bc7Smrg char **list_w; /* the normal wide font */ 2330dfb07bc7Smrg char **list_wb; /* the bold wide font */ 2331dfb07bc7Smrg char **list_wi; /* wide italic font (Xft only) */ 2332d4fba8b9Smrg char **list_wbi; /* wide bold-italic font (Xft only) */ 2333dfb07bc7Smrg#endif 2334dfb07bc7Smrg} VTFontList; 2335dfb07bc7Smrg 2336dfb07bc7Smrgtypedef struct { 2337dfb07bc7Smrg VTFontList x11; 2338dfb07bc7Smrg#if OPT_RENDERFONT 2339dfb07bc7Smrg VTFontList xft; 2340dfb07bc7Smrg#endif 2341dfb07bc7Smrg} XtermFontNames; 2342dfb07bc7Smrg 2343712a7ff4Smrgtypedef struct { 2344712a7ff4Smrg VTFontNames default_font; 2345712a7ff4Smrg String menu_font_names[NMENUFONTS][fMAX]; 2346dfb07bc7Smrg XtermFontNames fonts; 2347712a7ff4Smrg} SubResourceRec; 2348712a7ff4Smrg 23493367019cSmrg#if OPT_INPUT_METHOD 23503367019cSmrg#define NINPUTWIDGETS 3 23513367019cSmrgtypedef struct { 23523367019cSmrg Widget w; 23533367019cSmrg XIM xim; /* input method attached to 'w' */ 23543367019cSmrg XIC xic; /* input context attached to 'xim' */ 23553367019cSmrg} TInput; 23563367019cSmrg#endif 23573367019cSmrg 23583367019cSmrgtypedef enum { 23593367019cSmrg CURSOR_BLOCK = 2 23603367019cSmrg , CURSOR_UNDERLINE = 4 23613367019cSmrg , CURSOR_BAR = 6 23623367019cSmrg} XtCursorShape; 23633367019cSmrg 23643367019cSmrg#define isCursorBlock(s) ((s)->cursor_shape == CURSOR_BLOCK) 23653367019cSmrg#define isCursorUnderline(s) ((s)->cursor_shape == CURSOR_UNDERLINE) 23663367019cSmrg#define isCursorBar(s) ((s)->cursor_shape == CURSOR_BAR) 23673367019cSmrg 23683367019cSmrgtypedef enum { 23693367019cSmrg DEFAULT_STYLE = 0 23703367019cSmrg , BLINK_BLOCK 23713367019cSmrg , STEADY_BLOCK 23723367019cSmrg , BLINK_UNDERLINE 23733367019cSmrg , STEADY_UNDERLINE 23743367019cSmrg , BLINK_BAR 23753367019cSmrg , STEADY_BAR 23763367019cSmrg} XtCursorStyle; 23773367019cSmrg 2378d4fba8b9Smrg#if OPT_GRAPHICS 2379d4fba8b9Smrg#define GraphicsTermId(screen) (\ 2380d4fba8b9Smrg (screen)->graphics_termid \ 2381d4fba8b9Smrg ? (screen)->graphics_termid \ 2382d4fba8b9Smrg : (screen)->terminal_id) 2383d4fba8b9Smrg#else 2384d4fba8b9Smrg#define GraphicsTermId(screen) (screen)->terminal_id 2385d4fba8b9Smrg#endif 2386d4fba8b9Smrg 2387d4fba8b9Smrg#if OPT_REGIS_GRAPHICS 2388d4fba8b9Smrg#define optRegisGraphics(screen) \ 2389d4fba8b9Smrg (GraphicsTermId(screen) == 125 || \ 2390d4fba8b9Smrg GraphicsTermId(screen) == 240 || \ 2391d4fba8b9Smrg GraphicsTermId(screen) == 241 || \ 2392d4fba8b9Smrg GraphicsTermId(screen) == 330 || \ 2393d4fba8b9Smrg GraphicsTermId(screen) == 340) 2394d4fba8b9Smrg#else 2395d4fba8b9Smrg#define optRegisGraphics(screen) False 2396d4fba8b9Smrg#endif 2397d4fba8b9Smrg 2398d4fba8b9Smrg#if OPT_SIXEL_GRAPHICS 2399d4fba8b9Smrg#define optSixelGraphics(screen) \ 2400d4fba8b9Smrg (GraphicsTermId(screen) == 240 || \ 2401d4fba8b9Smrg GraphicsTermId(screen) == 241 || \ 2402d4fba8b9Smrg GraphicsTermId(screen) == 330 || \ 2403d4fba8b9Smrg GraphicsTermId(screen) == 340 || \ 2404d4fba8b9Smrg GraphicsTermId(screen) == 382) 2405d4fba8b9Smrg#else 2406d4fba8b9Smrg#define optSixelGraphics(screen) False 2407d4fba8b9Smrg#endif 2408d4fba8b9Smrg 2409d4fba8b9Smrg#if OPT_PRINT_GRAPHICS 2410d4fba8b9Smrg#define if_PRINT_GRAPHICS2(statement) if (optRegisGraphics(screen)) { statement; } else 2411d4fba8b9Smrg#else 2412d4fba8b9Smrg#define if_PRINT_GRAPHICS2(statement) /* nothing */ 2413d4fba8b9Smrg#endif 2414d4fba8b9Smrg 2415d522f475Smrgtypedef struct { 2416d522f475Smrg/* These parameters apply to both windows */ 2417d522f475Smrg Display *display; /* X display for screen */ 2418d522f475Smrg int respond; /* socket for responses 2419d522f475Smrg (position report, etc.) */ 2420d4fba8b9Smrg int nextEventDelay; /* msecs to delay for x-events */ 2421d522f475Smrg/* These parameters apply to VT100 window */ 2422d4fba8b9Smrg IChar *unparse_bfr; 2423d522f475Smrg unsigned unparse_len; 2424d4fba8b9Smrg unsigned unparse_max; /* limitResponse resource */ 2425980988aeSmrg unsigned strings_max; /* maxStringParse resource */ 2426d522f475Smrg 2427d522f475Smrg#if OPT_TCAP_QUERY 2428d522f475Smrg int tc_query_code; 2429d522f475Smrg Bool tc_query_fkey; 2430d522f475Smrg#endif 2431d522f475Smrg pid_t pid; /* pid of process on far side */ 2432d522f475Smrg uid_t uid; /* user id of actual person */ 2433d522f475Smrg gid_t gid; /* group id of actual person */ 2434d522f475Smrg ColorRes Tcolors[NCOLORS]; /* terminal colors */ 2435d522f475Smrg#if OPT_HIGHLIGHT_COLOR 2436d522f475Smrg Boolean hilite_color; /* hilite colors override */ 2437d522f475Smrg Boolean hilite_reverse; /* hilite overrides reverse */ 2438d522f475Smrg#endif 2439d522f475Smrg#if OPT_ISO_COLORS 24403367019cSmrg XColor * cmap_data; /* color table */ 24413367019cSmrg unsigned cmap_size; 2442d522f475Smrg ColorRes Acolors[MAXCOLORS]; /* ANSI color emulation */ 2443d522f475Smrg int veryBoldColors; /* modifier for boldColors */ 2444d522f475Smrg Boolean boldColors; /* can we make bold colors? */ 2445d522f475Smrg Boolean colorMode; /* are we using color mode? */ 2446d522f475Smrg Boolean colorULMode; /* use color for underline? */ 2447d522f475Smrg Boolean italicULMode; /* italic font for underline? */ 2448d522f475Smrg Boolean colorBDMode; /* use color for bold? */ 2449d522f475Smrg Boolean colorBLMode; /* use color for blink? */ 2450d522f475Smrg Boolean colorRVMode; /* use color for reverse? */ 2451d522f475Smrg Boolean colorAttrMode; /* prefer colorUL/BD to SGR */ 245294644356Smrg#if OPT_WIDE_ATTRS 245394644356Smrg Boolean colorITMode; /* use color for italics? */ 245494644356Smrg#endif 2455d4fba8b9Smrg#if OPT_DIRECT_COLOR 2456d4fba8b9Smrg Boolean direct_color; /* direct-color enabled? */ 2457d522f475Smrg#endif 2458d1603babSmrg#if OPT_WIDE_ATTRS && OPT_SGR2_HASH 2459d1603babSmrg Boolean faint_relative; /* faint is relative? */ 2460d1603babSmrg#endif 2461980988aeSmrg#if OPT_VT525_COLORS 2462980988aeSmrg int assigned_fg; /* DECAC */ 2463980988aeSmrg int assigned_bg; 2464980988aeSmrg struct { 2465980988aeSmrg int fg; /* 0..15 */ 2466980988aeSmrg int bg; /* 0..15 */ 2467980988aeSmrg } alt_colors[16]; /* DECATC if DECSTGLT is 1 or 2 */ 2468980988aeSmrg#endif 2469d4fba8b9Smrg#endif /* OPT_ISO_COLORS */ 2470d522f475Smrg#if OPT_DEC_CHRSET 2471d522f475Smrg Boolean font_doublesize;/* enable font-scaling */ 2472d522f475Smrg int cache_doublesize;/* limit of our cache */ 2473d522f475Smrg Char cur_chrset; /* character-set index & code */ 2474d522f475Smrg int fonts_used; /* count items in double_fonts */ 2475d522f475Smrg XTermFonts double_fonts[NUM_CHRSET]; 2476d4fba8b9Smrg#if OPT_RENDERFONT 2477d1603babSmrg XTermXftFonts double_xft_fonts[NUM_CHRSET]; 2478d522f475Smrg#endif 2479d4fba8b9Smrg#endif /* OPT_DEC_CHRSET */ 2480d522f475Smrg#if OPT_DEC_RECTOPS 2481d522f475Smrg int cur_decsace; /* parameter for DECSACE */ 2482d4fba8b9Smrg int checksum_ext; /* extensions for DECRQCRA */ 2483d4fba8b9Smrg int checksum_ext0; /* initial checksumExtension */ 2484d522f475Smrg#endif 2485d522f475Smrg#if OPT_WIDE_CHARS 2486d522f475Smrg Boolean wide_chars; /* true when 16-bit chars */ 2487d522f475Smrg Boolean vt100_graphics; /* true to allow vt100-graphics */ 2488d522f475Smrg Boolean utf8_inparse; /* true to enable UTF-8 parser */ 24893367019cSmrg Boolean normalized_c; /* true to precompose to Form C */ 2490712a7ff4Smrg char * utf8_mode_s; /* use UTF-8 decode/encode */ 2491712a7ff4Smrg char * utf8_fonts_s; /* use UTF-8 decode/encode */ 2492d4fba8b9Smrg char * utf8_title_s; /* use UTF-8 titles */ 2493fa3f02f3Smrg int utf8_nrc_mode; /* saved UTF-8 mode for DECNRCM */ 2494fa3f02f3Smrg Boolean utf8_always; /* special case for wideChars */ 2495d522f475Smrg int utf8_mode; /* use UTF-8 decode/encode: 0-2 */ 2496d4fba8b9Smrg int utf8_fonts; /* use UTF-8 fonts: 0-2 */ 2497d4fba8b9Smrg int utf8_title; /* use UTF-8 EWHM props: 0-2 */ 2498d522f475Smrg int max_combining; /* maximum # of combining chars */ 2499d522f475Smrg Boolean utf8_latin1; /* use UTF-8 with Latin-1 bias */ 2500d4fba8b9Smrg Boolean utf8_weblike; /* use UTF-8 with browser bias */ 2501d522f475Smrg int latin9_mode; /* poor man's luit, latin9 */ 2502d522f475Smrg int unicode_font; /* font uses unicode encoding */ 2503d522f475Smrg int utf_count; /* state of utf_char */ 2504d522f475Smrg IChar utf_char; /* in-progress character */ 25053367019cSmrg Boolean char_was_written; 2506d522f475Smrg int last_written_col; 2507d522f475Smrg int last_written_row; 2508d522f475Smrg#endif 2509d1603babSmrg TypedBuffer(IChar); 2510d1603babSmrg TypedBuffer(Char); 2511d1603babSmrg TypedBuffer(XChar2b); 2512d522f475Smrg#if OPT_BROKEN_OSC 2513d522f475Smrg Boolean brokenLinuxOSC; /* true to ignore Linux palette ctls */ 2514d522f475Smrg#endif 2515d522f475Smrg#if OPT_BROKEN_ST 2516d522f475Smrg Boolean brokenStringTerm; /* true to match old OSC parse */ 2517d522f475Smrg#endif 2518d522f475Smrg#if OPT_C1_PRINT || OPT_WIDE_CHARS 2519d522f475Smrg Boolean c1_printable; /* true if we treat C1 as print */ 2520d522f475Smrg#endif 2521d522f475Smrg int border; /* inner border */ 2522d522f475Smrg int scrollBarBorder; /* scrollBar border */ 25230d92cbfdSchristos long event_mask; 25240d92cbfdSchristos unsigned send_mouse_pos; /* user wants mouse transition */ 2525d522f475Smrg /* and position information */ 25263367019cSmrg int extend_coords; /* support large terminals */ 2527dfb07bc7Smrg#if OPT_FOCUS_EVENT 2528d522f475Smrg Boolean send_focus_pos; /* user wants focus in/out info */ 2529dfb07bc7Smrg#endif 2530d522f475Smrg Boolean quiet_grab; /* true if no cursor change on focus */ 2531d522f475Smrg#if OPT_PASTE64 2532b7c89284Ssnj Cardinal base64_paste; /* set to send paste in base64 */ 2533d522f475Smrg int base64_final; /* string-terminator for paste */ 2534d522f475Smrg /* _qWriteSelectionData expects these to be initialized to zero. 2535d522f475Smrg * base64_flush() is the last step of the conversion, it clears these 2536d522f475Smrg * variables. 2537d522f475Smrg */ 25380d92cbfdSchristos unsigned base64_accu; 25390d92cbfdSchristos unsigned base64_count; 25400d92cbfdSchristos unsigned base64_pad; 2541d522f475Smrg#endif 2542d4fba8b9Smrg#if OPT_PASTE64 || OPT_READLINE 2543d4fba8b9Smrg unsigned paste_brackets; 2544d4fba8b9Smrg /* not part of bracketed-paste, these are here to simplify ifdefs */ 2545d4fba8b9Smrg unsigned dclick3_deletes; 2546d4fba8b9Smrg unsigned paste_literal_nl; 2547d4fba8b9Smrg#endif 2548d522f475Smrg#if OPT_READLINE 2549d522f475Smrg unsigned click1_moves; 2550d522f475Smrg unsigned paste_moves; 2551d522f475Smrg unsigned paste_quotes; 2552d522f475Smrg#endif /* OPT_READLINE */ 2553d522f475Smrg#if OPT_DEC_LOCATOR 2554d522f475Smrg Boolean locator_reset; /* turn mouse off after 1 report? */ 2555d522f475Smrg Boolean locator_pixels; /* report in pixels? */ 2556d522f475Smrg /* if false, report in cells */ 25570d92cbfdSchristos unsigned locator_events; /* what events to report */ 2558d522f475Smrg Boolean loc_filter; /* is filter rectangle active? */ 2559d522f475Smrg int loc_filter_top; /* filter rectangle for DEC Locator */ 2560d522f475Smrg int loc_filter_left; 2561d522f475Smrg int loc_filter_bottom; 2562d522f475Smrg int loc_filter_right; 2563d522f475Smrg#endif /* OPT_DEC_LOCATOR */ 2564d522f475Smrg int mouse_button; /* current button pressed */ 2565d522f475Smrg int mouse_row; /* ...and its row */ 2566d522f475Smrg int mouse_col; /* ...and its column */ 2567d522f475Smrg int select; /* xterm selected */ 2568d522f475Smrg Boolean bellOnReset; /* bellOnReset */ 2569d522f475Smrg Boolean visualbell; /* visual bell mode */ 2570d522f475Smrg Boolean poponbell; /* pop on bell mode */ 25710d92cbfdSchristos 2572dfb07bc7Smrg Boolean eraseSavedLines; /* eraseSavedLines option */ 2573dfb07bc7Smrg Boolean eraseSavedLines0; /* initial eraseSavedLines */ 2574dfb07bc7Smrg Boolean tabCancelsWrap; /* tabCancelsWrap option */ 2575dfb07bc7Smrg 25763367019cSmrg Boolean allowPasteControls; /* PasteControls mode */ 2577cd3331d0Smrg Boolean allowColorOps; /* ColorOps mode */ 25780d92cbfdSchristos Boolean allowFontOps; /* FontOps mode */ 2579dfb07bc7Smrg Boolean allowMouseOps; /* MouseOps mode */ 2580d522f475Smrg Boolean allowSendEvents;/* SendEvent mode */ 25810d92cbfdSchristos Boolean allowTcapOps; /* TcapOps mode */ 2582d522f475Smrg Boolean allowTitleOps; /* TitleOps mode */ 2583d522f475Smrg Boolean allowWindowOps; /* WindowOps mode */ 25840d92cbfdSchristos 258594644356Smrg Boolean allowPasteControl0; /* PasteControls mode */ 2586cd3331d0Smrg Boolean allowColorOp0; /* initial ColorOps mode */ 25870d92cbfdSchristos Boolean allowFontOp0; /* initial FontOps mode */ 2588dfb07bc7Smrg Boolean allowMouseOp0; /* initial MouseOps mode */ 2589d522f475Smrg Boolean allowSendEvent0;/* initial SendEvent mode */ 25900d92cbfdSchristos Boolean allowTcapOp0; /* initial TcapOps mode */ 2591d522f475Smrg Boolean allowTitleOp0; /* initial TitleOps mode */ 2592d522f475Smrg Boolean allowWindowOp0; /* initial WindowOps mode */ 25930d92cbfdSchristos 2594cd3331d0Smrg String disallowedColorOps; 2595cd3331d0Smrg char disallow_color_ops[ecLAST]; 2596cd3331d0Smrg 2597cd3331d0Smrg String disallowedFontOps; 2598cd3331d0Smrg char disallow_font_ops[efLAST]; 2599cd3331d0Smrg 2600dfb07bc7Smrg String disallowedMouseOps; 2601dfb07bc7Smrg char disallow_mouse_ops[emLAST]; 2602dfb07bc7Smrg 2603d1603babSmrg String disallowedPasteOps; 2604d1603babSmrg char disallow_paste_ops[epLAST]; 2605d4fba8b9Smrg 2606cd3331d0Smrg String disallowedTcapOps; 2607cd3331d0Smrg char disallow_tcap_ops[etLAST]; 2608cd3331d0Smrg 2609cd3331d0Smrg String disallowedWinOps; 2610cd3331d0Smrg char disallow_win_ops[ewLAST]; 2611cd3331d0Smrg 2612d522f475Smrg Boolean awaitInput; /* select-timeout mode */ 2613d522f475Smrg Boolean grabbedKbd; /* keyboard is grabbed */ 2614d522f475Smrg#ifdef ALLOWLOGGING 2615d522f475Smrg int logging; /* logging mode */ 2616d522f475Smrg int logfd; /* file descriptor of log */ 2617d522f475Smrg char *logfile; /* log file name */ 2618d522f475Smrg Char *logstart; /* current start of log buffer */ 2619d522f475Smrg#endif 2620d522f475Smrg int inhibit; /* flags for inhibiting changes */ 2621d522f475Smrg 2622d522f475Smrg/* VT window parameters */ 2623d522f475Smrg Boolean Vshow; /* VT window showing */ 2624d522f475Smrg VTwin fullVwin; 26253367019cSmrg int needSwap; 2626d522f475Smrg#ifndef NO_ACTIVE_ICON 2627d522f475Smrg VTwin iconVwin; 2628d522f475Smrg VTwin *whichVwin; 2629d522f475Smrg#endif /* NO_ACTIVE_ICON */ 2630d522f475Smrg 2631d522f475Smrg int pointer_mode; /* when to use hidden_cursor */ 26329a64e1c5Smrg int pointer_mode0; /* ...initial value */ 2633d522f475Smrg Boolean hide_pointer; /* true to use "hidden_cursor" */ 2634d4fba8b9Smrg String pointer_shape; /* name of shape in cursor font */ 26358f44fb3bSmrg Cursor pointer_cursor; /* current pointer cursor */ 2636d522f475Smrg Cursor hidden_cursor; /* hidden cursor in window */ 2637d522f475Smrg 2638980988aeSmrg String answer_back; /* response to ENQ */ 2639980988aeSmrg Boolean prefer_latin1; /* preference for UPSS */ 2640d522f475Smrg 2641712a7ff4Smrg PrinterState printer_state; /* actual printer state */ 2642cd3331d0Smrg PrinterFlags printer_flags; /* working copy of printer flags */ 2643712a7ff4Smrg#if OPT_PRINT_ON_EXIT 2644712a7ff4Smrg Boolean write_error; 2645712a7ff4Smrg#endif 2646cd3331d0Smrg 2647d522f475Smrg Boolean fnt_prop; /* true if proportional fonts */ 2648d4fba8b9Smrg unsigned fnt_boxes; /* 0=no boxes, 1=old, 2=unicode */ 2649cd3331d0Smrg Boolean force_packed; /* true to override proportional */ 2650d522f475Smrg#if OPT_BOX_CHARS 26513367019cSmrg Boolean force_box_chars;/* true if we assume no boxchars */ 2652d4fba8b9Smrg Boolean broken_box_chars;/* true if broken boxchars */ 2653fa3f02f3Smrg Boolean assume_all_chars;/* true to allow missing chars */ 2654cd3331d0Smrg Boolean allow_packing; /* true to allow packed-fonts */ 2655d522f475Smrg#endif 2656980988aeSmrg#if OPT_BOX_CHARS || OPT_WIDE_CHARS 2657980988aeSmrg Boolean force_all_chars;/* true to outline missing chars */ 2658980988aeSmrg#endif 2659980988aeSmrg 2660d522f475Smrg Dimension fnt_wide; 2661d522f475Smrg Dimension fnt_high; 26623367019cSmrg float scale_height; /* scaling for font-height */ 2663d522f475Smrg XTermFonts fnts[fMAX]; /* normal/bold/etc for terminal */ 2664d522f475Smrg Boolean free_bold_box; /* same_font_size's austerity */ 2665712a7ff4Smrg Boolean allowBoldFonts; /* do we use bold fonts at all? */ 26669a64e1c5Smrg#if OPT_WIDE_ATTRS 26679a64e1c5Smrg XTermFonts ifnts[fMAX]; /* normal/bold/etc italic fonts */ 26689a64e1c5Smrg Boolean ifnts_ok; /* true if ifnts[] is cached */ 26699a64e1c5Smrg#endif 2670d522f475Smrg#ifndef NO_ACTIVE_ICON 2671cb4a1343Smrg XTermFonts fnt_icon; /* icon font */ 2672cb4a1343Smrg String icon_fontname; /* name of icon font */ 2673cb4a1343Smrg int icon_fontnum; /* number to use for icon font */ 2674d522f475Smrg#endif /* NO_ACTIVE_ICON */ 2675d522f475Smrg int enbolden; /* overstrike for bold font */ 2676d522f475Smrg XPoint *box; /* draw unselected cursor */ 2677d522f475Smrg 2678d522f475Smrg int cursor_state; /* ON, OFF, or BLINKED_OFF */ 2679d522f475Smrg int cursor_busy; /* do not redraw... */ 26800d92cbfdSchristos Boolean cursor_underline; /* true if cursor is in underline mode */ 2681d1603babSmrg Boolean cursor_bar; /* true if cursor is in bar mode */ 26823367019cSmrg XtCursorShape cursor_shape; 2683d522f475Smrg#if OPT_BLINK_CURS 2684d4fba8b9Smrg BlinkOps cursor_blink; /* cursor blink enable */ 2685d4fba8b9Smrg BlinkOps cursor_blink_i; /* save cursor blink enable */ 2686d4fba8b9Smrg char * cursor_blink_s; /* ...resource cursorBlink */ 2687d4fba8b9Smrg int cursor_blink_esc; /* cursor blink escape-state */ 2688d4fba8b9Smrg Boolean cursor_blink_xor; /* how to merge menu/escapes */ 2689d522f475Smrg#endif 2690d522f475Smrg#if OPT_BLINK_TEXT 2691d522f475Smrg Boolean blink_as_bold; /* text blink disable */ 2692d522f475Smrg#endif 2693d522f475Smrg#if OPT_BLINK_CURS || OPT_BLINK_TEXT 2694d522f475Smrg int blink_state; /* ON, OFF, or BLINKED_OFF */ 2695d522f475Smrg int blink_on; /* cursor on time (msecs) */ 2696d522f475Smrg int blink_off; /* cursor off time (msecs) */ 2697d522f475Smrg XtIntervalId blink_timer; /* timer-id for cursor-proc */ 2698d522f475Smrg#endif 2699d522f475Smrg#if OPT_ZICONBEEP 2700d522f475Smrg Boolean zIconBeep_flagged; /* True if icon name was changed */ 2701d522f475Smrg#endif /* OPT_ZICONBEEP */ 2702d522f475Smrg int cursor_GC; /* see ShowCursor() */ 2703d522f475Smrg int cursor_set; /* requested state */ 2704d522f475Smrg CELL cursorp; /* previous cursor row/column */ 2705d522f475Smrg int cur_col; /* current cursor column */ 2706d522f475Smrg int cur_row; /* current cursor row */ 2707d522f475Smrg int max_col; /* rightmost column */ 2708d522f475Smrg int max_row; /* bottom row */ 2709d522f475Smrg int top_marg; /* top line of scrolling region */ 2710d522f475Smrg int bot_marg; /* bottom line of " " */ 27113367019cSmrg int lft_marg; /* left column of " " */ 27123367019cSmrg int rgt_marg; /* right column of " " */ 2713d522f475Smrg Widget scrollWidget; /* pointer to scrollbar struct */ 2714d4fba8b9Smrg#if USE_DOUBLE_BUFFER 2715d4fba8b9Smrg int buffered_sb; /* nonzero when pending update */ 2716d4fba8b9Smrg struct timeval buffered_at; /* reference time, for FPS */ 2717d4fba8b9Smrg#define DbeMsecs(xw) (1000L / (long) resource.buffered_fps) 2718d4fba8b9Smrg#endif 2719d522f475Smrg /* 2720d522f475Smrg * Indices used to keep track of the top of the vt100 window and 2721d522f475Smrg * the saved lines, taking scrolling into account. 2722d522f475Smrg */ 2723d522f475Smrg int topline; /* line number of top, <= 0 */ 272494644356Smrg long saved_fifo; /* number of lines that've ever been saved */ 2725d522f475Smrg int savedlines; /* number of lines that've been saved */ 2726d522f475Smrg int savelines; /* number of lines off top to save */ 2727d522f475Smrg int scroll_amt; /* amount to scroll */ 2728d522f475Smrg int refresh_amt; /* amount to refresh */ 2729d522f475Smrg /* 2730b7c89284Ssnj * Working variables for getLineData(). 2731b7c89284Ssnj */ 2732b7c89284Ssnj size_t lineExtra; /* extra space for combining chars */ 2733d4fba8b9Smrg size_t cellExtra; /* extra space for combining chars */ 2734b7c89284Ssnj /* 2735b7c89284Ssnj * Pointer to the current visible buffer. 2736d522f475Smrg */ 2737d522f475Smrg ScrnBuf visbuf; /* ptr to visible screen buf (main) */ 2738d522f475Smrg /* 2739d522f475Smrg * Data for the normal buffer, which may have saved lines to which 2740d522f475Smrg * the user can scroll. 2741d522f475Smrg */ 2742b7c89284Ssnj ScrnBuf saveBuf_index; 2743b7c89284Ssnj Char *saveBuf_data; 2744d522f475Smrg /* 2745b7c89284Ssnj * Data for visible and alternate buffer. 2746d522f475Smrg */ 2747b7c89284Ssnj ScrnBuf editBuf_index[2]; 2748b7c89284Ssnj Char *editBuf_data[2]; 2749b7c89284Ssnj int whichBuf; /* 0/1 for normal/alternate buf */ 2750b7c89284Ssnj Boolean is_running; /* true when buffers are legal */ 2751d522f475Smrg /* 2752d522f475Smrg * Workspace used for screen operations. 2753d522f475Smrg */ 2754d522f475Smrg Char **save_ptr; /* workspace for save-pointers */ 2755d522f475Smrg size_t save_len; /* ...and its length */ 2756d522f475Smrg 2757d522f475Smrg int scrolllines; /* number of lines to button scroll */ 27583367019cSmrg Boolean alternateScroll; /* scroll-actions become keys */ 2759d522f475Smrg Boolean scrollttyoutput; /* scroll to bottom on tty output */ 2760d522f475Smrg Boolean scrollkey; /* scroll to bottom on key */ 2761d522f475Smrg Boolean cursor_moved; /* scrolling makes cursor move */ 2762d522f475Smrg 27630d92cbfdSchristos Boolean do_wrap; /* true if cursor in last column 2764d522f475Smrg and character just output */ 2765d522f475Smrg 2766d522f475Smrg int incopy; /* 0 idle; 1 XCopyArea issued; 2767d522f475Smrg -1 first GraphicsExpose seen, 2768d522f475Smrg but last not seen */ 2769d522f475Smrg int copy_src_x; /* params from last XCopyArea ... */ 2770d522f475Smrg int copy_src_y; 2771d522f475Smrg unsigned int copy_width; 2772d522f475Smrg unsigned int copy_height; 2773d522f475Smrg int copy_dest_x; 2774d522f475Smrg int copy_dest_y; 2775d522f475Smrg 27763367019cSmrg Dimension embed_wide; 27773367019cSmrg Dimension embed_high; 27783367019cSmrg 2779d522f475Smrg Boolean c132; /* allow change to 132 columns */ 2780d522f475Smrg Boolean curses; /* kludge line wrap for more */ 2781d522f475Smrg Boolean hp_ll_bc; /* kludge HP-style ll for xdb */ 2782d522f475Smrg Boolean marginbell; /* true if margin bell on */ 2783d522f475Smrg int nmarginbell; /* columns from right margin */ 2784cd3331d0Smrg int bellArmed; /* cursor below bell margin */ 2785cd3331d0Smrg BellVolume marginVolume; /* margin-bell volume */ 2786cd3331d0Smrg BellVolume warningVolume; /* warning-bell volume */ 2787d522f475Smrg Boolean multiscroll; /* true if multi-scroll */ 2788d522f475Smrg int scrolls; /* outstanding scroll count, 2789d522f475Smrg used only with multiscroll */ 2790d522f475Smrg SavedCursor sc[SAVED_CURSORS]; /* data for restore cursor */ 27919a64e1c5Smrg IFlags save_modes[DP_LAST]; /* save dec/xterm private modes */ 2792d522f475Smrg 2793cd3331d0Smrg int title_modes; /* control set/get of titles */ 27949a64e1c5Smrg int title_modes0; /* ...initial value */ 2795980988aeSmrg SavedTitles saved_titles; 2796cd3331d0Smrg 2797d522f475Smrg /* Improved VT100 emulation stuff. */ 2798d522f475Smrg String keyboard_dialect; /* default keyboard dialect */ 2799980988aeSmrg DECNRCM_codes gsets[NUM_GSETS2]; /* G0 through G3, plus UPSS */ 2800d522f475Smrg Char curgl; /* Current GL setting. */ 2801d522f475Smrg Char curgr; /* Current GR setting. */ 2802d522f475Smrg Char curss; /* Current single shift. */ 2803d522f475Smrg String term_id; /* resource for terminal_id */ 2804d522f475Smrg int terminal_id; /* 100=vt100, 220=vt220, etc. */ 2805980988aeSmrg int display_da1; /* 100=vt100, 220=vt220, etc. */ 2806d522f475Smrg int vtXX_level; /* 0=vt52, 1,2,3 = vt100 ... vt320 */ 28073367019cSmrg int ansi_level; /* dpANSI levels 1,2,3 */ 2808d522f475Smrg int protected_mode; /* 0=off, 1=DEC, 2=ISO */ 2809d522f475Smrg Boolean always_bold_mode; /* compare normal/bold font */ 2810d522f475Smrg Boolean always_highlight; /* whether to highlight cursor */ 2811d522f475Smrg Boolean bold_mode; /* use bold font or overstrike */ 2812d522f475Smrg Boolean delete_is_del; /* true for compatible Delete key */ 2813d522f475Smrg Boolean jumpscroll; /* whether we should jumpscroll */ 2814b7c89284Ssnj Boolean fastscroll; /* whether we should fastscroll */ 2815d522f475Smrg Boolean old_fkeys; /* true for compatible fkeys */ 28169a64e1c5Smrg Boolean old_fkeys0; /* ...initial value */ 2817d522f475Smrg Boolean underline; /* whether to underline text */ 2818d522f475Smrg 2819d522f475Smrg#if OPT_MAXIMIZE 2820d522f475Smrg Boolean restore_data; 2821d522f475Smrg int restore_x; 2822d522f475Smrg int restore_y; 2823d522f475Smrg unsigned restore_width; 2824d522f475Smrg unsigned restore_height; 2825d522f475Smrg#endif 2826d522f475Smrg 282794644356Smrg#if OPT_REGIS_GRAPHICS 282894644356Smrg String graphics_regis_default_font; /* font for "builtin" */ 282994644356Smrg 283094644356Smrg String graphics_regis_screensize; /* given a size in pixels */ 283194644356Smrg Dimension graphics_regis_def_wide; /* ...corresponding width */ 283294644356Smrg Dimension graphics_regis_def_high; /* ...and height */ 283394644356Smrg#endif 283494644356Smrg 283594644356Smrg#if OPT_GRAPHICS 2836d4fba8b9Smrg String graph_termid; /* resource for graphics_termid */ 2837d4fba8b9Smrg int graphics_termid; /* based on terminal_id */ 283894644356Smrg String graphics_max_size; /* given a size in pixels */ 283994644356Smrg Dimension graphics_max_wide; /* ...corresponding width */ 284094644356Smrg Dimension graphics_max_high; /* ...and height */ 284194644356Smrg#endif 284294644356Smrg 2843cd3331d0Smrg#if OPT_SCROLL_LOCK 2844cd3331d0Smrg Boolean allowScrollLock;/* ScrollLock mode */ 2845cd3331d0Smrg Boolean allowScrollLock0;/* initial ScrollLock mode */ 2846636d5e9fSmrg Boolean autoScrollLock; /* Auto ScrollLock mode */ 2847cd3331d0Smrg Boolean scroll_lock; /* true to keep buffer in view */ 2848cd3331d0Smrg Boolean scroll_dirty; /* scrolling makes screen dirty */ 2849cd3331d0Smrg#endif 2850cd3331d0Smrg 2851fa3f02f3Smrg#if OPT_SIXEL_GRAPHICS 2852fa3f02f3Smrg Boolean sixel_scrolling; /* sixel scrolling */ 28539a64e1c5Smrg Boolean sixel_scrolls_right; /* sixel scrolling moves cursor to right */ 2854980988aeSmrg Boolean sixel_scrolls_right0; /* initial sixelScrolling mode */ 28559a64e1c5Smrg#endif 28569a64e1c5Smrg 28579a64e1c5Smrg#if OPT_GRAPHICS 28589a64e1c5Smrg int numcolorregisters; /* number of supported color registers */ 2859fa3f02f3Smrg Boolean privatecolorregisters; /* private color registers for each graphic */ 2860980988aeSmrg Boolean privatecolorregisters0; /* initial privateColorRegisters */ 2861980988aeSmrg Boolean incremental_graphics; /* draw graphics incrementally */ 2862fa3f02f3Smrg#endif 2863fa3f02f3Smrg 2864d4fba8b9Smrg /* Graphics Printing */ 2865d4fba8b9Smrg#if OPT_PRINT_GRAPHICS 2866d4fba8b9Smrg Boolean graphics_print_to_host; 2867d4fba8b9Smrg Boolean graphics_expanded_print_mode; 2868d4fba8b9Smrg Boolean graphics_print_color_mode; 2869d4fba8b9Smrg Boolean graphics_print_color_syntax; 2870d4fba8b9Smrg Boolean graphics_print_background_mode; 2871d4fba8b9Smrg Boolean graphics_rotated_print_mode; 2872d4fba8b9Smrg#endif 2873d4fba8b9Smrg 287450027b5bSmrg#define StatusLineRows 1 /* number of rows in status-line */ 287550027b5bSmrg 287650027b5bSmrg#if OPT_STATUS_LINE 287750027b5bSmrg#define AddStatusLineRows(nrow) nrow += StatusLineRows 287850027b5bSmrg#define LastRowNumber(screen) \ 287950027b5bSmrg ( (screen)->max_row \ 288050027b5bSmrg + (IsStatusShown(screen) ? StatusLineRows : 0) ) 288150027b5bSmrg#define FirstRowNumber(screen) \ 288250027b5bSmrg ( (screen)->status_active \ 288350027b5bSmrg ? LastRowNumber(screen) \ 288450027b5bSmrg : 0 ) 288550027b5bSmrg#define IsStatusShown(screen) \ 288650027b5bSmrg ( ( (screen)->status_type == 2) || \ 288750027b5bSmrg ( (screen)->status_type == 1) ) 288850027b5bSmrg#define PlusStatusLine(screen,expr) \ 288950027b5bSmrg ( (screen)->status_shown \ 289050027b5bSmrg ? (expr) + StatusLineRows \ 289150027b5bSmrg : (expr) ) 289250027b5bSmrg#define if_STATUS_LINE(screen,stmt) \ 289350027b5bSmrg if (IsStatusShown(screen) && (screen)->status_active) stmt 289450027b5bSmrg 289550027b5bSmrg Boolean status_timeout; /* status timeout needs service */ 2896d1603babSmrg int status_active; /* DECSASD */ 289750027b5bSmrg int status_type; /* DECSSDT */ 289850027b5bSmrg int status_shown; /* last-displayed type */ 2899d1603babSmrg SavedCursor status_data[2]; /* main- and status-cursors */ 290050027b5bSmrg char * status_fmt; /* format for indicator-status */ 290150027b5bSmrg 290250027b5bSmrg#else /* !OPT_STATUS_LINE */ 290350027b5bSmrg 290450027b5bSmrg#define AddStatusLineRows(nrow) /* nothing */ 290550027b5bSmrg#define LastRowNumber(screen) (screen)->max_row 290650027b5bSmrg#define FirstRowNumber(screen) 0 2907d1603babSmrg#define IsStatusShown(screen) False 290850027b5bSmrg#define PlusStatusLine(screen,expr) (expr) 290950027b5bSmrg#define if_STATUS_LINE(screen,stmt) /* nothing */ 291050027b5bSmrg 291150027b5bSmrg#endif /* OPT_STATUS_LINE */ 291250027b5bSmrg 2913d522f475Smrg#if OPT_VT52_MODE 2914d4fba8b9Smrg IFlags vt52_save_flags; 29150d92cbfdSchristos Char vt52_save_curgl; 29160d92cbfdSchristos Char vt52_save_curgr; 29170d92cbfdSchristos Char vt52_save_curss; 2918980988aeSmrg DECNRCM_codes vt52_save_gsets[NUM_GSETS2]; 2919d522f475Smrg#endif 2920d522f475Smrg /* Testing */ 2921d522f475Smrg#if OPT_XMC_GLITCH 2922d522f475Smrg unsigned xmc_glitch; /* # of spaces to pad on SGR's */ 29239a64e1c5Smrg IAttr xmc_attributes; /* attrs that make a glitch */ 2924d522f475Smrg Boolean xmc_inline; /* SGR's propagate only to eol */ 2925d522f475Smrg Boolean move_sgr_ok; /* SGR is reset on move */ 2926d522f475Smrg#endif 2927d522f475Smrg 2928d522f475Smrg /* 2929d522f475Smrg * Bell 2930d522f475Smrg */ 2931d522f475Smrg int visualBellDelay; /* msecs to delay for visibleBell */ 2932d522f475Smrg int bellSuppressTime; /* msecs after Bell before another allowed */ 2933d522f475Smrg Boolean bellInProgress; /* still ringing/flashing prev bell? */ 2934d522f475Smrg Boolean bellIsUrgent; /* set XUrgency WM hint on bell */ 29353367019cSmrg Boolean flash_line; /* show visualBell as current line */ 2936d522f475Smrg /* 2937d522f475Smrg * Select/paste state. 2938d522f475Smrg */ 2939d522f475Smrg Boolean selectToClipboard; /* primary vs clipboard */ 2940d522f475Smrg String *mappedSelect; /* mapping for "SELECT" to "PRIMARY" */ 2941d522f475Smrg 2942d522f475Smrg Boolean waitingForTrackInfo; 2943d522f475Smrg int numberOfClicks; 2944d522f475Smrg int maxClicks; 2945d522f475Smrg int multiClickTime; /* time between multiclick selects */ 2946d522f475Smrg SelectUnit selectUnit; 2947d522f475Smrg SelectUnit selectMap[NSELECTUNITS]; 2948d522f475Smrg String onClick[NSELECTUNITS + 1]; 2949d522f475Smrg 2950d522f475Smrg char *charClass; /* for overriding word selection */ 2951d522f475Smrg Boolean cutNewline; /* whether or not line cut has \n */ 2952d522f475Smrg Boolean cutToBeginningOfLine; /* line cuts to BOL? */ 2953d522f475Smrg Boolean highlight_selection; /* controls appearance of selection */ 2954cb4a1343Smrg Boolean show_wrap_marks; /* show lines which are wrapped */ 2955d522f475Smrg Boolean trim_selection; /* controls trimming of selection */ 2956d522f475Smrg Boolean i18nSelections; 2957d522f475Smrg Boolean brokenSelections; 2958037a25ddSmrg Boolean keepClipboard; /* retain data sent to clipboard */ 2959d522f475Smrg Boolean keepSelection; /* do not lose selection on output */ 2960d522f475Smrg Boolean replyToEmacs; /* Send emacs escape code when done selecting or extending? */ 2961d4fba8b9Smrg 2962d4fba8b9Smrg SelectedCells clipboard_data; /* what we sent to the clipboard */ 2963d4fba8b9Smrg 2964d522f475Smrg EventMode eventMode; 2965d522f475Smrg Time selection_time; /* latest event timestamp */ 2966d522f475Smrg Time lastButtonUpTime; 2967d522f475Smrg unsigned lastButton; 2968d522f475Smrg 2969d4fba8b9Smrg#define MAX_CUT_BUFFER 8 /* CUT_BUFFER0 to CUT_BUFFER7 */ 2970d4fba8b9Smrg#define MAX_SELECTIONS (MAX_SELECTION_CODES + MAX_CUT_BUFFER) 2971d4fba8b9Smrg SelectedCells selected_cells[MAX_SELECTIONS]; 2972d4fba8b9Smrg 2973d522f475Smrg CELL rawPos; /* raw position for selection start */ 2974d522f475Smrg CELL startRaw; /* area before selectUnit processing */ 2975d522f475Smrg CELL endRaw; /* " " */ 2976d522f475Smrg CELL startSel; /* area after selectUnit processing */ 2977d522f475Smrg CELL endSel; /* " " */ 2978d522f475Smrg CELL startH; /* start highlighted text */ 2979d522f475Smrg CELL endH; /* end highlighted text */ 2980d522f475Smrg CELL saveStartW; /* saved WORD state, for LINE */ 2981d522f475Smrg CELL startExt; /* Start, end of extension */ 2982d522f475Smrg CELL endExt; /* " " */ 2983d522f475Smrg CELL saveStartR; /* Saved values of raw selection for extend to restore to */ 2984d522f475Smrg CELL saveEndR; /* " " */ 2985d522f475Smrg int startHCoord, endHCoord; 2986d522f475Smrg int firstValidRow; /* Valid rows for selection clipping */ 2987d522f475Smrg int lastValidRow; /* " " */ 2988d522f475Smrg 29893367019cSmrg Boolean selectToBuffer; /* copy selection to buffer */ 299094644356Smrg InternalSelect internal_select; 29913367019cSmrg 2992b7c89284Ssnj String default_string; 2993b7c89284Ssnj String eightbit_select_types; 2994b7c89284Ssnj Atom* selection_targets_8bit; 2995b7c89284Ssnj#if OPT_WIDE_CHARS 2996b7c89284Ssnj String utf8_select_types; 2997b7c89284Ssnj Atom* selection_targets_utf8; 2998b7c89284Ssnj#endif 2999d522f475Smrg Atom* selection_atoms; /* which selections we own */ 30003367019cSmrg Cardinal sel_atoms_size; /* how many atoms allocated */ 3001d522f475Smrg Cardinal selection_count; /* how many atoms in use */ 3002d522f475Smrg#if OPT_SELECT_REGEX 3003d522f475Smrg char * selectExpr[NSELECTUNITS]; 3004d522f475Smrg#endif 3005d522f475Smrg /* 3006d522f475Smrg * Input/output state. 3007d522f475Smrg */ 30083367019cSmrg Boolean input_eight_bits; /* do not send ESC when meta pressed */ 30093367019cSmrg int eight_bit_meta; /* use 8th bit when meta pressed */ 30103367019cSmrg char * eight_bit_meta_s; /* ...resource eightBitMeta */ 30113367019cSmrg Boolean output_eight_bits; /* honor all bits or strip */ 30123367019cSmrg Boolean control_eight_bits; /* send CSI as 8-bits */ 3013d522f475Smrg Boolean backarrow_key; /* backspace/delete */ 3014d522f475Smrg Boolean alt_is_not_meta; /* use both Alt- and Meta-key */ 3015d522f475Smrg Boolean alt_sends_esc; /* Alt-key sends ESC prefix */ 3016d522f475Smrg Boolean meta_sends_esc; /* Meta-key sends ESC prefix */ 3017d522f475Smrg /* 3018d522f475Smrg * Fonts 3019d522f475Smrg */ 3020d522f475Smrg Pixmap menu_item_bitmap; /* mask for checking items */ 3021d522f475Smrg String initial_font; 3022dfb07bc7Smrg char * menu_font_names[NMENUFONTS][fMAX]; 3023d522f475Smrg#define MenuFontName(n) menu_font_names[n][fNorm] 302494644356Smrg#define EscapeFontName() MenuFontName(fontMenu_fontescape) 302594644356Smrg#define SelectFontName() MenuFontName(fontMenu_fontsel) 3026d522f475Smrg long menu_font_sizes[NMENUFONTS]; 3027d522f475Smrg int menu_font_number; 30283367019cSmrg#if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS 3029712a7ff4Smrg Boolean savedVTFonts; 3030712a7ff4Smrg Boolean mergedVTFonts; 3031712a7ff4Smrg SubResourceRec cacheVTFonts; 3032712a7ff4Smrg#endif 3033d522f475Smrg#if OPT_CLIP_BOLD 3034d4fba8b9Smrg Boolean use_border_clipping; 3035d522f475Smrg Boolean use_clipping; 3036d522f475Smrg#endif 3037d522f475Smrg void * main_cgs_cache; 3038d522f475Smrg#ifndef NO_ACTIVE_ICON 3039d522f475Smrg void * icon_cgs_cache; 3040d522f475Smrg#endif 3041d522f475Smrg#if OPT_RENDERFONT 3042d1603babSmrg int xft_max_glyph_memory; 3043d1603babSmrg int xft_max_unref_fonts; 3044d1603babSmrg Boolean xft_track_mem_usage; 3045d4fba8b9Smrg Boolean force_xft_height; 3046d4fba8b9Smrg ListXftFonts *list_xft_fonts; 3047b7c89284Ssnj XTermXftFonts renderFontNorm[NMENUFONTS]; 3048b7c89284Ssnj XTermXftFonts renderFontBold[NMENUFONTS]; 3049d1603babSmrg#if OPT_WIDE_ATTRS || OPT_RENDERWIDE 3050b7c89284Ssnj XTermXftFonts renderFontItal[NMENUFONTS]; 3051d4fba8b9Smrg XTermXftFonts renderFontBtal[NMENUFONTS]; 3052d1603babSmrg#endif 3053b7c89284Ssnj#if OPT_RENDERWIDE 3054b7c89284Ssnj XTermXftFonts renderWideNorm[NMENUFONTS]; 3055b7c89284Ssnj XTermXftFonts renderWideBold[NMENUFONTS]; 3056b7c89284Ssnj XTermXftFonts renderWideItal[NMENUFONTS]; 3057d4fba8b9Smrg XTermXftFonts renderWideBtal[NMENUFONTS]; 3058b7c89284Ssnj TypedBuffer(XftCharSpec); 3059b7c89284Ssnj#else 3060b7c89284Ssnj TypedBuffer(XftChar8); 3061b7c89284Ssnj#endif 3062d522f475Smrg XftDraw * renderDraw; 3063d522f475Smrg#endif 3064d522f475Smrg#if OPT_DABBREV 3065b7c89284Ssnj Boolean dabbrev_working; /* nonzero during dabbrev process */ 3066d522f475Smrg unsigned char dabbrev_erase_char; /* used for deleting inserted completion */ 3067d522f475Smrg#endif 3068d522f475Smrg char tcapbuf[TERMCAP_SIZE]; 3069712a7ff4Smrg char tcap_area[TERMCAP_SIZE]; 3070d522f475Smrg#if OPT_TCAP_FKEYS 3071d522f475Smrg char ** tcap_fkeys; 3072d522f475Smrg#endif 3073d4fba8b9Smrg String cursor_font_name; /* alternate cursor font */ 3074d522f475Smrg} TScreen; 3075d522f475Smrg 3076d4fba8b9Smrgtypedef XTermFonts *(*MyGetFont) (TScreen *, int); 3077d4fba8b9Smrg 3078d522f475Smrgtypedef struct _TekPart { 3079d522f475Smrg XFontStruct * Tfont[TEKNUMFONTS]; 3080d522f475Smrg int tobaseline[TEKNUMFONTS]; /* top-baseline, each font */ 3081d522f475Smrg char * initial_font; /* large, 2, 3, small */ 3082d522f475Smrg char * gin_terminator_str; /* ginTerminator resource */ 3083d522f475Smrg#if OPT_TOOLBAR 3084d522f475Smrg TbInfo tb_info; /* toolbar information */ 3085d522f475Smrg#endif 3086d522f475Smrg} TekPart; 3087d522f475Smrg 3088d522f475Smrg/* Tektronix window parameters */ 3089d522f475Smrgtypedef struct _TekScreen { 3090d522f475Smrg GC TnormalGC; /* normal painting */ 3091d522f475Smrg GC TcursorGC; /* normal cursor painting */ 3092d522f475Smrg 3093d522f475Smrg Boolean waitrefresh; /* postpone refresh */ 3094d522f475Smrg TKwin fullTwin; 3095d522f475Smrg#ifndef NO_ACTIVE_ICON 3096d522f475Smrg TKwin iconTwin; 3097d522f475Smrg TKwin *whichTwin; 3098d522f475Smrg#endif /* NO_ACTIVE_ICON */ 3099d522f475Smrg 3100d522f475Smrg Cursor arrow; /* arrow cursor */ 3101d522f475Smrg GC linepat[TEKNUMLINES]; /* line patterns */ 3102d522f475Smrg int cur_X; /* current x */ 3103d522f475Smrg int cur_Y; /* current y */ 3104d522f475Smrg Tmodes cur; /* current tek modes */ 3105d522f475Smrg Tmodes page; /* starting tek modes on page */ 3106d522f475Smrg int margin; /* 0 -> margin 1, 1 -> margin 2 */ 3107d522f475Smrg int pen; /* current Tektronix pen 0=up, 1=dn */ 3108d522f475Smrg char *TekGIN; /* nonzero if Tektronix GIN mode*/ 3109d522f475Smrg int gin_terminator; /* Tek strap option */ 3110d522f475Smrg char tcapbuf[TERMCAP_SIZE]; 3111d522f475Smrg} TekScreen; 3112d522f475Smrg 3113d4fba8b9Smrg#if OPT_PASTE64 || OPT_READLINE 3114d522f475Smrg#define SCREEN_FLAG(screenp,f) (1&(screenp)->f) 3115d522f475Smrg#define SCREEN_FLAG_set(screenp,f) ((screenp)->f |= 1) 3116cd3331d0Smrg#define SCREEN_FLAG_unset(screenp,f) ((screenp)->f &= (unsigned) ~1L) 3117d522f475Smrg#define SCREEN_FLAG_save(screenp,f) \ 3118d522f475Smrg ((screenp)->f = (((screenp)->f)<<1) | SCREEN_FLAG(screenp,f)) 3119d522f475Smrg#define SCREEN_FLAG_restore(screenp,f) ((screenp)->f = (((screenp)->f)>>1)) 3120d522f475Smrg#else 3121d522f475Smrg#define SCREEN_FLAG(screenp,f) (0) 3122d522f475Smrg#endif 3123d522f475Smrg 31243367019cSmrg/* 31253367019cSmrg * After screen-updates, reset the flag that tells us we should do wrapping. 31263367019cSmrg * Likewise, reset (in wide-character mode) the flag that tells us where the 31273367019cSmrg * "previous" character was written. 31283367019cSmrg */ 31293367019cSmrg#if OPT_WIDE_CHARS 31303367019cSmrg#define ResetWrap(screen) \ 31313367019cSmrg (screen)->do_wrap = \ 31323367019cSmrg (screen)->char_was_written = False 31333367019cSmrg#else 31343367019cSmrg#define ResetWrap(screen) \ 31353367019cSmrg (screen)->do_wrap = False 31363367019cSmrg#endif 31373367019cSmrg 3138d522f475Smrg/* meaning of bits in screen.select flag */ 3139d522f475Smrg#define INWINDOW 01 /* the mouse is in one of the windows */ 3140d522f475Smrg#define FOCUS 02 /* one of the windows is the focus window */ 3141d522f475Smrg 3142d522f475Smrg#define MULTICLICKTIME 250 /* milliseconds */ 3143d522f475Smrg 3144c219fbebSmrgtypedef struct { 3145c219fbebSmrg const char *name; 3146c219fbebSmrg int code; 3147c219fbebSmrg} FlagList; 3148c219fbebSmrg 3149d522f475Smrgtypedef enum { 3150d522f475Smrg keyboardIsLegacy, /* bogus vt220 codes for F1-F4, etc. */ 3151d522f475Smrg keyboardIsDefault, 3152d522f475Smrg keyboardIsHP, 3153d522f475Smrg keyboardIsSCO, 3154d522f475Smrg keyboardIsSun, 3155d522f475Smrg keyboardIsTermcap, 3156d522f475Smrg keyboardIsVT220 3157d522f475Smrg} xtermKeyboardType; 3158d522f475Smrg 3159d522f475Smrgtypedef enum { /* legal values for screen.pointer_mode */ 31603367019cSmrg pNever = 0 31613367019cSmrg , pNoMouse = 1 31623367019cSmrg , pAlways = 2 31633367019cSmrg , pFocused = 3 3164d522f475Smrg} pointerModeTypes; 3165d522f475Smrg 3166d522f475Smrgtypedef enum { /* legal values for screen.utf8_mode */ 3167712a7ff4Smrg uFalse = 0 3168712a7ff4Smrg , uTrue = 1 3169712a7ff4Smrg , uAlways = 2 3170712a7ff4Smrg , uDefault = 3 3171712a7ff4Smrg , uLast 3172d522f475Smrg} utf8ModeTypes; 3173d522f475Smrg 31743367019cSmrgtypedef enum { /* legal values for screen.eight_bit_meta */ 31753367019cSmrg ebFalse = 0 31763367019cSmrg , ebTrue = 1 31773367019cSmrg , ebNever = 2 31783367019cSmrg , ebLocale = 3 31793367019cSmrg , ebLast 31803367019cSmrg} ebMetaModeTypes; 31813367019cSmrg 3182c48a5815Smrgtypedef enum { /* legal values for misc.cdXtraScroll */ 3183c48a5815Smrg edFalse = 0 3184c48a5815Smrg , edTrue = 1 3185c48a5815Smrg , edTrim = 2 3186c48a5815Smrg , edLast 3187c48a5815Smrg} edXtraScrollTypes; 3188c48a5815Smrg 3189037a25ddSmrg#define NAME_OLD_KT " legacy" 3190037a25ddSmrg 3191d522f475Smrg#if OPT_HP_FUNC_KEYS 3192d522f475Smrg#define NAME_HP_KT " hp" 3193d522f475Smrg#else 3194d522f475Smrg#define NAME_HP_KT /*nothing*/ 3195d522f475Smrg#endif 3196d522f475Smrg 3197d522f475Smrg#if OPT_SCO_FUNC_KEYS 3198d522f475Smrg#define NAME_SCO_KT " sco" 3199d522f475Smrg#else 3200d522f475Smrg#define NAME_SCO_KT /*nothing*/ 3201d522f475Smrg#endif 3202d522f475Smrg 3203d522f475Smrg#if OPT_SUN_FUNC_KEYS 3204d522f475Smrg#define NAME_SUN_KT " sun" 3205d522f475Smrg#else 3206d522f475Smrg#define NAME_SUN_KT /*nothing*/ 3207d522f475Smrg#endif 3208d522f475Smrg 3209d522f475Smrg#if OPT_SUNPC_KBD 3210d522f475Smrg#define NAME_VT220_KT " vt220" 3211d522f475Smrg#else 3212d522f475Smrg#define NAME_VT220_KT /*nothing*/ 3213d522f475Smrg#endif 3214d522f475Smrg 3215d522f475Smrg#if OPT_TCAP_FKEYS 3216d522f475Smrg#define NAME_TCAP_KT " tcap" 3217d522f475Smrg#else 3218d522f475Smrg#define NAME_TCAP_KT /*nothing*/ 3219d522f475Smrg#endif 3220d522f475Smrg 3221d522f475Smrg#define KEYBOARD_TYPES NAME_TCAP_KT NAME_HP_KT NAME_SCO_KT NAME_SUN_KT NAME_VT220_KT 3222d522f475Smrg 3223cd3331d0Smrg#if OPT_TRACE 3224cd3331d0Smrg#define TRACE_RC(code,func) code = func 3225cd3331d0Smrg#else 3226cd3331d0Smrg#define TRACE_RC(code,func) func 3227cd3331d0Smrg#endif 3228cd3331d0Smrg 3229d522f475Smrgextern const char * visibleKeyboardType(xtermKeyboardType); 3230d522f475Smrg 3231d522f475Smrgtypedef struct 3232d522f475Smrg{ 32333367019cSmrg int allow_keys; /* how to handle legacy/vt220 keyboard */ 3234d522f475Smrg int cursor_keys; /* how to handle cursor-key modifiers */ 3235d522f475Smrg int function_keys; /* how to handle function-key modifiers */ 3236d522f475Smrg int keypad_keys; /* how to handle keypad key-modifiers */ 3237d522f475Smrg int other_keys; /* how to handle other key-modifiers */ 3238d522f475Smrg int string_keys; /* how to handle string() modifiers */ 3239d522f475Smrg} TModify; 3240d522f475Smrg 3241d522f475Smrgtypedef struct 3242d522f475Smrg{ 3243d522f475Smrg xtermKeyboardType type; 32449a64e1c5Smrg IFlags flags; 3245d4fba8b9Smrg char *shell_translations; /* shell's translations, for input check */ 3246d4fba8b9Smrg char *xterm_translations; /* xterm's translations, for input check */ 3247d522f475Smrg char *extra_translations; 3248d4fba8b9Smrg char *print_translations; /* printable translations for buttons */ 3249d4fba8b9Smrg unsigned shift_buttons; /* special shift-modifier for mouse-buttons */ 3250d4fba8b9Smrg int shift_escape; /* working value of shiftEscape */ 3251d4fba8b9Smrg char * shift_escape_s; /* resource for shiftEscape */ 3252d522f475Smrg#if OPT_INITIAL_ERASE 3253d522f475Smrg int reset_DECBKM; /* reset should set DECBKM */ 3254d522f475Smrg#endif 3255d522f475Smrg#if OPT_MOD_FKEYS 3256d522f475Smrg TModify modify_now; /* current modifier value */ 3257d522f475Smrg TModify modify_1st; /* original modifier value, for resets */ 3258d522f475Smrg int format_keys; /* format of modifyOtherKeys */ 3259d522f475Smrg#endif 3260d522f475Smrg} TKeyboard; 3261d522f475Smrg 3262b7c89284Ssnj#define GravityIsNorthWest(w) ((w)->misc.resizeGravity == NorthWestGravity) 3263b7c89284Ssnj#define GravityIsSouthWest(w) ((w)->misc.resizeGravity == SouthWestGravity) 3264b7c89284Ssnj 3265d522f475Smrgtypedef struct _Misc { 3266d522f475Smrg VTFontNames default_font; 3267d522f475Smrg char *geo_metry; 3268d522f475Smrg char *T_geometry; 3269d522f475Smrg#if OPT_WIDE_CHARS 3270d522f475Smrg Boolean cjk_width; /* true for built-in CJK wcwidth() */ 3271d522f475Smrg Boolean mk_width; /* true for simpler built-in wcwidth() */ 3272d522f475Smrg int mk_samplesize; 3273d522f475Smrg int mk_samplepass; 3274d522f475Smrg#endif 3275d522f475Smrg#if OPT_LUIT_PROG 3276d522f475Smrg Boolean callfilter; /* true to invoke luit */ 3277d522f475Smrg Boolean use_encoding; /* true to use -encoding option for luit */ 3278d522f475Smrg char *locale_str; /* "locale" resource */ 3279d522f475Smrg char *localefilter; /* path for luit */ 3280d522f475Smrg#endif 3281b7c89284Ssnj fontWarningTypes fontWarnings; 3282d522f475Smrg int limit_resize; 3283d522f475Smrg#ifdef ALLOWLOGGING 3284d522f475Smrg Boolean log_on; 3285d522f475Smrg#endif 3286d4fba8b9Smrg Boolean color_inner_border; 3287d522f475Smrg Boolean login_shell; 3288d522f475Smrg Boolean re_verse; 3289d522f475Smrg Boolean re_verse0; /* initial value of "-rv" */ 32908f44fb3bSmrg Boolean resizeByPixel; 3291d522f475Smrg XtGravity resizeGravity; 3292d522f475Smrg Boolean reverseWrap; 3293d522f475Smrg Boolean autoWrap; 3294d522f475Smrg Boolean logInhibit; 3295d522f475Smrg Boolean signalInhibit; 3296d522f475Smrg#if OPT_TEK4014 3297d522f475Smrg Boolean tekInhibit; 3298d522f475Smrg Boolean tekSmall; /* start tek window in small size */ 3299d522f475Smrg Boolean TekEmu; /* true if Tektronix emulation */ 3300d522f475Smrg Boolean Tshow; /* Tek window showing */ 3301d522f475Smrg#endif 3302d522f475Smrg Boolean scrollbar; 3303d522f475Smrg#ifdef SCROLLBAR_RIGHT 3304d522f475Smrg Boolean useRight; 3305d522f475Smrg#endif 3306d522f475Smrg Boolean titeInhibit; 3307d522f475Smrg Boolean appcursorDefault; 3308d522f475Smrg Boolean appkeypadDefault; 3309c48a5815Smrg int cdXtraScroll; /* scroll on cd (clear-display) */ 3310c48a5815Smrg char *cdXtraScroll_s; 3311c48a5815Smrg int tiXtraScroll; /* scroll on ti/te (init/end-cup) */ 3312c48a5815Smrg char *tiXtraScroll_s; 3313d522f475Smrg#if OPT_INPUT_METHOD 3314b7c89284Ssnj char* f_x; /* font for XIM */ 3315d522f475Smrg char* input_method; 3316d522f475Smrg char* preedit_type; 3317b7c89284Ssnj Boolean open_im; /* true if input-method is opened */ 3318b7c89284Ssnj int retry_im; 3319d522f475Smrg#endif 3320d522f475Smrg Boolean dynamicColors; 3321d522f475Smrg#ifndef NO_ACTIVE_ICON 33223367019cSmrg char *active_icon_s; /* use application icon window */ 3323d522f475Smrg unsigned icon_border_width; 3324d522f475Smrg Pixel icon_border_pixel; 3325d522f475Smrg#endif /* NO_ACTIVE_ICON */ 3326d522f475Smrg#if OPT_DEC_SOFTFONT 3327d522f475Smrg Boolean font_loadable; 3328d522f475Smrg#endif 3329d522f475Smrg#if OPT_SHIFT_FONTS 3330d522f475Smrg Boolean shift_fonts; /* true if we interpret fontsize-shifting */ 3331d522f475Smrg#endif 3332d522f475Smrg#if OPT_SUNPC_KBD 3333d522f475Smrg int ctrl_fkeys; /* amount to add to XK_F1 for ctrl modifier */ 3334d522f475Smrg#endif 3335d522f475Smrg#if OPT_NUM_LOCK 3336d522f475Smrg Boolean real_NumLock; /* true if we treat NumLock key specially */ 3337d522f475Smrg Boolean alwaysUseMods; /* true if we always want f-key modifiers */ 3338d522f475Smrg#endif 3339d522f475Smrg#if OPT_RENDERFONT 3340dfb07bc7Smrg VTFontNames default_xft; 3341d522f475Smrg float face_size[NMENUFONTS]; 3342cd3331d0Smrg char *render_font_s; 3343d4fba8b9Smrg int limit_fontsets; 3344d1603babSmrg int limit_fontheight; 3345d1603babSmrg int limit_fontwidth; 3346d522f475Smrg#endif 3347d522f475Smrg} Misc; 3348d522f475Smrg 33493367019cSmrgtypedef struct _Work { 33503367019cSmrg int dummy; 33519a64e1c5Smrg#ifdef SunXK_F36 33529a64e1c5Smrg#define MAX_UDK 37 33539a64e1c5Smrg#else 33549a64e1c5Smrg#define MAX_UDK 35 33559a64e1c5Smrg#endif 33569a64e1c5Smrg struct { 33579a64e1c5Smrg char *str; 33589a64e1c5Smrg int len; 33599a64e1c5Smrg } user_keys[MAX_UDK]; 33608f44fb3bSmrg#define MAX_POINTER (XC_num_glyphs/2) 33618f44fb3bSmrg Cursor pointer_cursors[MAX_POINTER]; /* saved cursors */ 33623367019cSmrg#ifndef NO_ACTIVE_ICON 33633367019cSmrg int active_icon; /* use application icon window */ 3364d4fba8b9Smrg char *wm_name; 33653367019cSmrg#endif /* NO_ACTIVE_ICON */ 3366dfb07bc7Smrg#if OPT_INPUT_METHOD 3367dfb07bc7Smrg Boolean cannot_im; /* true if we cannot use input-method */ 3368dfb07bc7Smrg XFontSet xim_fs; /* fontset for XIM preedit */ 3369dfb07bc7Smrg int xim_fs_ascent; /* ascent of fs */ 3370dfb07bc7Smrg TInput inputs[NINPUTWIDGETS]; 3371dfb07bc7Smrg#endif 3372d4fba8b9Smrg Boolean doing_resize; /* currently in RequestResize */ 33733367019cSmrg#if OPT_MAXIMIZE 33743367019cSmrg#define MAX_EWMH_MODE 3 33753367019cSmrg#define MAX_EWMH_DATA (1 + OPT_TEK4014) 33763367019cSmrg struct { 33773367019cSmrg int mode; /* fullscreen, etc. */ 3378d4fba8b9Smrg Boolean checked[MAX_EWMH_MODE + 1]; 3379d4fba8b9Smrg Boolean allowed[MAX_EWMH_MODE + 1]; 33803367019cSmrg } ewmh[MAX_EWMH_DATA]; 33813367019cSmrg#endif 33823367019cSmrg#if OPT_NUM_LOCK 33833367019cSmrg unsigned num_lock; /* modifier for Num_Lock */ 33843367019cSmrg unsigned alt_mods; /* modifier for Alt_L or Alt_R */ 33853367019cSmrg unsigned meta_mods; /* modifier for Meta_L or Meta_R */ 33863367019cSmrg#endif 3387dfb07bc7Smrg XtermFontNames fonts; 3388c48a5815Smrg Boolean force_wideFont; /* true to single-step wideFont */ 33893367019cSmrg#if OPT_RENDERFONT 33903367019cSmrg Boolean render_font; 3391d1603babSmrg FcPattern *xft_defaults; 3392d4fba8b9Smrg unsigned max_fontsets; 33933367019cSmrg#endif 33949a64e1c5Smrg#if OPT_DABBREV 33959a64e1c5Smrg#define MAX_DABBREV 1024 /* maximum word length as in tcsh */ 33969a64e1c5Smrg char dabbrev_data[MAX_DABBREV]; 33979a64e1c5Smrg#endif 33989a64e1c5Smrg ScrnColors *oldColors; 3399dfb07bc7Smrg Boolean palette_changed; 3400d4fba8b9Smrg Boolean broken_box_chars; 3401980988aeSmrg /* data write dotext/WriteText */ 3402980988aeSmrg IChar *write_text; /* points to print_area */ 3403980988aeSmrg#if OPT_DEC_RECTOPS 3404980988aeSmrg Char *write_sums; /* if non-null, points to buffer_sums */ 3405980988aeSmrg Char *buffer_sums; /* data for ->charSeen[] */ 3406980988aeSmrg Char *buffer_sets; /* data for ->charSets[] */ 3407980988aeSmrg size_t sizeof_sums; /* allocated size of buffer_sums */ 3408980988aeSmrg#endif 34093367019cSmrg} Work; 34103367019cSmrg 3411d522f475Smrgtypedef struct {int foo;} XtermClassPart, TekClassPart; 3412d522f475Smrg 3413d522f475Smrgtypedef struct _XtermClassRec { 3414d522f475Smrg CoreClassPart core_class; 3415d522f475Smrg XtermClassPart xterm_class; 3416d522f475Smrg} XtermClassRec; 3417d522f475Smrg 3418d522f475Smrgextern WidgetClass xtermWidgetClass; 3419d522f475Smrg 3420d522f475Smrg#define IsXtermWidget(w) (XtClass(w) == xtermWidgetClass) 3421d522f475Smrg 3422d522f475Smrg#if OPT_TEK4014 3423d522f475Smrgtypedef struct _TekClassRec { 3424d522f475Smrg CoreClassPart core_class; 3425d522f475Smrg TekClassPart tek_class; 3426d522f475Smrg} TekClassRec; 3427d522f475Smrg 3428d522f475Smrgextern WidgetClass tekWidgetClass; 3429d522f475Smrg 3430d522f475Smrg#define IsTekWidget(w) (XtClass(w) == tekWidgetClass) 3431d522f475Smrg 3432d522f475Smrg#endif 3433d522f475Smrg 3434d522f475Smrg/* define masks for keyboard.flags */ 3435fa3f02f3Smrg#define MODE_KAM xBIT(0) /* mode 2: keyboard action mode */ 3436d522f475Smrg#define MODE_DECKPAM xBIT(1) /* keypad application mode */ 3437fa3f02f3Smrg#define MODE_DECCKM xBIT(2) /* private mode 1: cursor keys */ 3438fa3f02f3Smrg#define MODE_SRM xBIT(3) /* mode 12: send-receive mode */ 3439fa3f02f3Smrg#define MODE_DECBKM xBIT(4) /* private mode 67: backarrow */ 3440d1603babSmrg#define MODE_DECSDM xBIT(5) /* private mode 80: sixel DISPLAY mode -- note, when SDM is off, the terminal is in sixel SCROLLING mode */ 3441d522f475Smrg 3442d522f475Smrg#define N_MARGINBELL 10 3443d522f475Smrg 3444d522f475Smrg#define TAB_BITS_SHIFT 5 /* FIXME: 2**5 == 32 (should derive) */ 3445d522f475Smrg#define TAB_BITS_WIDTH (1 << TAB_BITS_SHIFT) 3446d522f475Smrg#define TAB_ARRAY_SIZE (1024 / TAB_BITS_WIDTH) 3447d522f475Smrg#define MAX_TABS (TAB_BITS_WIDTH * TAB_ARRAY_SIZE) 3448d522f475Smrg 3449980988aeSmrg#define OkTAB(c) ((c) > 0 && (c) < MAX_TABS) 3450d4fba8b9Smrg 3451d522f475Smrgtypedef unsigned Tabs [TAB_ARRAY_SIZE]; 3452d522f475Smrg 3453d4fba8b9Smrg#if OPT_XTERM_SGR 3454d4fba8b9Smrg#define MAX_SAVED_SGR 10 3455d4fba8b9Smrgtypedef struct { 3456d4fba8b9Smrg int used; 3457d4fba8b9Smrg struct { 3458d4fba8b9Smrg IFlags mask; 3459d4fba8b9Smrg IFlags flags; 3460d4fba8b9Smrg#if OPT_ISO_COLORS 3461d4fba8b9Smrg int sgr_foreground; 3462d4fba8b9Smrg int sgr_background; 3463d4fba8b9Smrg Boolean sgr_38_xcolors; 3464d4fba8b9Smrg#endif 3465d4fba8b9Smrg } stack[MAX_SAVED_SGR]; 3466d4fba8b9Smrg} SavedSGR; 3467d4fba8b9Smrg 3468d4fba8b9Smrgtypedef struct { 3469d4fba8b9Smrg ScrnColors base; 3470d4fba8b9Smrg ColorRes ansi[1]; 3471d4fba8b9Smrg} ColorSlot; 3472d4fba8b9Smrg 3473d4fba8b9Smrgtypedef struct { 3474d4fba8b9Smrg int used; /* currently saved or restored */ 3475d4fba8b9Smrg int last; /* maximum number of saved palettes */ 3476d4fba8b9Smrg ColorSlot *palettes[MAX_SAVED_SGR]; 3477d4fba8b9Smrg} SavedColors; 3478d4fba8b9Smrg#endif /* OPT_XTERM_SGR */ 3479d4fba8b9Smrg 3480d522f475Smrgtypedef struct _XtermWidgetRec { 3481d522f475Smrg CorePart core; 3482d522f475Smrg XSizeHints hints; 3483fa3f02f3Smrg XVisualInfo *visInfo; 3484fa3f02f3Smrg int numVisuals; 3485d4fba8b9Smrg unsigned rgb_shifts[3]; 3486d4fba8b9Smrg unsigned rgb_widths[3]; 3487d4fba8b9Smrg Bool has_rgb; 3488d522f475Smrg Bool init_menu; 3489d522f475Smrg TKeyboard keyboard; /* terminal keyboard */ 3490d522f475Smrg TScreen screen; /* terminal screen */ 34919a64e1c5Smrg IFlags flags; /* mode flags */ 3492d522f475Smrg int cur_foreground; /* current foreground color */ 3493d522f475Smrg int cur_background; /* current background color */ 3494d522f475Smrg Pixel dft_foreground; /* default foreground color */ 3495d522f475Smrg Pixel dft_background; /* default background color */ 3496712a7ff4Smrg Pixel old_foreground; /* original foreground color */ 3497712a7ff4Smrg Pixel old_background; /* original background color */ 3498d522f475Smrg#if OPT_ISO_COLORS 3499d522f475Smrg int sgr_foreground; /* current SGR foreground color */ 3500d522f475Smrg int sgr_background; /* current SGR background color */ 3501d4fba8b9Smrg Boolean sgr_38_xcolors; /* true if ISO 8613 extension */ 3502d522f475Smrg#endif 35039a64e1c5Smrg IFlags initflags; /* initial mode flags */ 3504d522f475Smrg Tabs tabs; /* tabstops of the terminal */ 3505d522f475Smrg Misc misc; /* miscellaneous parameters */ 35063367019cSmrg Work work; /* workspace (no resources) */ 3507d4fba8b9Smrg#if OPT_XTERM_SGR 3508d4fba8b9Smrg SavedSGR saved_sgr; 3509d4fba8b9Smrg SavedColors saved_colors; 3510d4fba8b9Smrg#endif 3511d522f475Smrg} XtermWidgetRec, *XtermWidget; 3512d522f475Smrg 3513d522f475Smrg#if OPT_TEK4014 3514d522f475Smrgtypedef struct _TekWidgetRec { 3515d522f475Smrg CorePart core; 3516dfb07bc7Smrg XtermWidget vt; /* main widget has border, etc. */ 3517d522f475Smrg TekPart tek; /* contains resources */ 3518d522f475Smrg TekScreen screen; /* contains working data (no resources) */ 3519d522f475Smrg Bool init_menu; 3520d522f475Smrg XSizeHints hints; 3521d522f475Smrg} TekWidgetRec, *TekWidget; 3522d522f475Smrg#endif /* OPT_TEK4014 */ 3523d522f475Smrg 3524d522f475Smrg/* 3525d522f475Smrg * terminal flags 352650027b5bSmrg * There are actually two namespaces mixed together here: 352750027b5bSmrg * a) One is the set of flags that can go in screen->visbuf attributes and 352850027b5bSmrg * which must fit in an IAttr (either a char or short, depending on whether 352950027b5bSmrg * wide-attributes are used). 353050027b5bSmrg * b) The other is the global setting stored in term->flags and 353150027b5bSmrg * screen->save_modes, which fits in an unsigned (IFlags). 3532d522f475Smrg */ 3533d522f475Smrg 3534d522f475Smrg#define AttrBIT(n) xBIT(n) /* text-attributes */ 3535d522f475Smrg#define MiscBIT(n) xBIT(n + 16) /* miscellaneous state flags */ 3536d522f475Smrg 3537d522f475Smrg/* global flags and character flags (visible character attributes) */ 3538d522f475Smrg#define INVERSE AttrBIT(0) /* invert the characters to be output */ 3539d522f475Smrg#define UNDERLINE AttrBIT(1) /* true if underlining */ 3540d522f475Smrg#define BOLD AttrBIT(2) 3541d522f475Smrg#define BLINK AttrBIT(3) 3542d522f475Smrg/* global flags (also character attributes) */ 3543d522f475Smrg#define BG_COLOR AttrBIT(4) /* true if background set */ 3544d522f475Smrg#define FG_COLOR AttrBIT(5) /* true if foreground set */ 3545d522f475Smrg 3546d522f475Smrg/* character flags (internal attributes) */ 3547d522f475Smrg#define PROTECTED AttrBIT(6) /* a character that cannot be erased */ 3548d522f475Smrg#define CHARDRAWN AttrBIT(7) /* a character has been drawn here on 3549d522f475Smrg the screen. Used to distinguish 3550d522f475Smrg blanks from empty parts of the 3551d522f475Smrg screen when selecting */ 3552980988aeSmrg/* 3553980988aeSmrg * This does not fit in a byte with the other (more important) attributes, but 3554980988aeSmrg * if wide-attributes are configured, it is possible to maintain it there. 3555980988aeSmrg */ 3556980988aeSmrg#define INVISIBLE AttrBIT(8) /* true if writing invisible text */ 3557d522f475Smrg 35589a64e1c5Smrg#if OPT_WIDE_ATTRS 3559980988aeSmrg#define ATR_FAINT AttrBIT(9) 3560980988aeSmrg#define ATR_ITALIC AttrBIT(10) 3561980988aeSmrg#define ATR_STRIKEOUT AttrBIT(11) 3562980988aeSmrg#define ATR_DBL_UNDER AttrBIT(12) 3563980988aeSmrg#define ATR_DIRECT_FG AttrBIT(13) 3564980988aeSmrg#define ATR_DIRECT_BG AttrBIT(14) 3565d4fba8b9Smrg#define SGR_MASK2 (ATR_FAINT | ATR_ITALIC | ATR_STRIKEOUT | ATR_DBL_UNDER | ATR_DIRECT_FG | ATR_DIRECT_BG) 3566980988aeSmrg#define AttrEND 15 35679a64e1c5Smrg#else 35689a64e1c5Smrg#define SGR_MASK2 0 3569980988aeSmrg#define AttrEND 9 35709a64e1c5Smrg#endif 3571d522f475Smrg 3572d522f475Smrg/* 3573d522f475Smrg * Other flags 3574d522f475Smrg */ 3575980988aeSmrg#define REVERSE_VIDEO MiscBIT(0) /* true if screen white on black */ 3576980988aeSmrg#define WRAPAROUND MiscBIT(1) /* true if auto wraparound mode */ 3577980988aeSmrg#define REVERSEWRAP MiscBIT(2) /* true if reverse wraparound mode */ 3578980988aeSmrg#define REVERSEWRAP2 MiscBIT(3) /* true if extended reverse wraparound */ 3579980988aeSmrg#define LINEFEED MiscBIT(4) /* true if in auto linefeed mode */ 3580980988aeSmrg#define ORIGIN MiscBIT(5) /* true if in origin mode */ 3581980988aeSmrg#define INSERT MiscBIT(6) /* true if in insert mode */ 3582980988aeSmrg#define SMOOTHSCROLL MiscBIT(7) /* true if in smooth scroll mode */ 3583980988aeSmrg#define IN132COLUMNS MiscBIT(8) /* true if in 132 column mode */ 3584d522f475Smrg#define NATIONAL MiscBIT(9) /* true if writing national charset */ 35853367019cSmrg#define LEFT_RIGHT MiscBIT(10) /* true if left/right margin mode */ 35863367019cSmrg#define NOCLEAR_COLM MiscBIT(11) /* true if no clear on DECCOLM change */ 3587d522f475Smrg 3588980988aeSmrg/* 3589980988aeSmrg * Drawing-bits start after the video/color attributes, and are independent 3590980988aeSmrg * of the miscellaneous flags. 3591980988aeSmrg */ 3592980988aeSmrg#define DrawBIT(n) xBIT(n + AttrEND) /* XTermDraw.draw_flags */ 35939a64e1c5Smrg/* The following attributes are used in the argument of drawXtermText() */ 35949a64e1c5Smrg#define NOBACKGROUND DrawBIT(0) /* Used for overstrike */ 35959a64e1c5Smrg#define NOTRANSLATION DrawBIT(1) /* No scan for chars missing in font */ 35969a64e1c5Smrg#define DOUBLEWFONT DrawBIT(2) /* The actual X-font is double-width */ 35979a64e1c5Smrg#define DOUBLEHFONT DrawBIT(3) /* The actual X-font is double-height */ 3598d1603babSmrg#define DOUBLEFIRST DrawBIT(4) /* Draw chars one-by-one */ 3599d1603babSmrg#define CHARBYCHAR DrawBIT(5) /* Draw chars one-by-one */ 36009a64e1c5Smrg 36019a64e1c5Smrg/* The following attribute is used in the argument of xtermSpecialFont etc */ 3602d1603babSmrg#define NORESOLUTION DrawBIT(6) /* find the font without resolution */ 36039a64e1c5Smrg 3604d522f475Smrg/* 3605d522f475Smrg * Groups of attributes 3606d522f475Smrg */ 3607d522f475Smrg /* mask for video-attributes only */ 3608d522f475Smrg#define SGR_MASK (BOLD | BLINK | UNDERLINE | INVERSE) 3609d522f475Smrg 3610d522f475Smrg /* mask: user-visible attributes */ 36119a64e1c5Smrg#define ATTRIBUTES (SGR_MASK | SGR_MASK2 | BG_COLOR | FG_COLOR | INVISIBLE | PROTECTED) 3612d522f475Smrg 3613d522f475Smrg/* The toplevel-call to drawXtermText() should have text-attributes guarded: */ 3614d522f475Smrg#define DRAWX_MASK (ATTRIBUTES | CHARDRAWN) 3615d522f475Smrg 3616712a7ff4Smrg/* 3617712a7ff4Smrg * BOLDATTR is not only nonzero when we will use bold font, but uses the bits 3618712a7ff4Smrg * for BOLD/BLINK to match against the video attributes which were originally 3619712a7ff4Smrg * requested. 3620712a7ff4Smrg */ 3621712a7ff4Smrg#define USE_BOLD(screen) ((screen)->allowBoldFonts) 3622712a7ff4Smrg 3623d522f475Smrg#if OPT_BLINK_TEXT 3624712a7ff4Smrg#define BOLDATTR(screen) (unsigned) (USE_BOLD(screen) ? (BOLD | ((screen)->blink_as_bold ? BLINK : 0)) : 0) 3625d522f475Smrg#else 3626712a7ff4Smrg#define BOLDATTR(screen) (unsigned) (USE_BOLD(screen) ? (BOLD | BLINK) : 0) 3627d522f475Smrg#endif 3628d522f475Smrg 3629c48a5815Smrg/* 3630d1603babSmrg * Sixel scrolling is on when Sixel Display Mode is off, and vice versa. 3631d1603babSmrg * (Note: DEC erroneously conflates the two in the VT330/340 manual). 3632c48a5815Smrg */ 3633c48a5815Smrg#define SixelScrolling(xw) (!((xw)->keyboard.flags & MODE_DECSDM)) 3634c48a5815Smrg 3635d522f475Smrg/* 3636d522f475Smrg * Per-line flags 3637d522f475Smrg */ 3638b7c89284Ssnj#define LINEWRAPPED AttrBIT(0) 3639b7c89284Ssnj/* used once per line to indicate that it wraps onto the next line so we can 3640b7c89284Ssnj * tell the difference between lines that have wrapped around and lines that 3641b7c89284Ssnj * have ended naturally with a CR at column max_col. 3642b7c89284Ssnj */ 3643b7c89284Ssnj#define LINEBLINKED AttrBIT(1) 3644b7c89284Ssnj/* set when the line contains blinking text. 3645b7c89284Ssnj */ 3646d522f475Smrg 3647d4fba8b9Smrg#if OPT_ZICONBEEP || OPT_TOOLBAR || (USE_DOUBLE_BUFFER && OPT_RENDERFONT) 3648d522f475Smrg#define HANDLE_STRUCT_NOTIFY 1 3649d522f475Smrg#else 3650d522f475Smrg#define HANDLE_STRUCT_NOTIFY 0 3651d522f475Smrg#endif 3652d522f475Smrg 3653d522f475Smrg/* 3654d522f475Smrg * If we've set protected attributes with the DEC-style DECSCA, then we'll have 3655d522f475Smrg * to use DECSED or DECSEL to erase preserving protected text. (The normal ED, 3656d522f475Smrg * EL won't preserve protected-text). If we've used SPA, then normal ED and EL 3657d522f475Smrg * will preserve protected-text. To keep things simple, just remember the last 3658d522f475Smrg * control that was used to begin protected-text, and use that to determine how 3659d522f475Smrg * erases are performed (otherwise we'd need 2 bits per protected character). 3660d522f475Smrg */ 3661d522f475Smrg#define OFF_PROTECT 0 3662d522f475Smrg#define DEC_PROTECT 1 3663d522f475Smrg#define ISO_PROTECT 2 3664d522f475Smrg 3665d4fba8b9Smrg/***====================================================================***/ 3666d4fba8b9Smrg 3667d4fba8b9Smrg/* 3668d4fba8b9Smrg * Reduce parameter-count of drawXtermText by putting less-modified data here. 3669d4fba8b9Smrg */ 3670d4fba8b9Smrgtypedef struct { 3671d4fba8b9Smrg XtermWidget xw; 3672d4fba8b9Smrg unsigned attr_flags; 3673d4fba8b9Smrg unsigned draw_flags; 3674d4fba8b9Smrg unsigned this_chrset; 3675d4fba8b9Smrg unsigned real_chrset; 3676d4fba8b9Smrg int on_wide; 3677d4fba8b9Smrg} XTermDraw; 3678d4fba8b9Smrg 3679d4fba8b9Smrg/***====================================================================***/ 3680d4fba8b9Smrg 3681d522f475Smrg#define TScreenOf(xw) (&(xw)->screen) 3682d522f475Smrg#define TekScreenOf(tw) (&(tw)->screen) 3683d522f475Smrg 3684712a7ff4Smrg#define PrinterOf(screen) (screen)->printer_state 3685712a7ff4Smrg 3686d522f475Smrg#ifdef SCROLLBAR_RIGHT 3687d522f475Smrg#define OriginX(screen) (((term->misc.useRight)?0:ScrollbarWidth(screen)) + screen->border) 3688d522f475Smrg#else 3689d522f475Smrg#define OriginX(screen) (ScrollbarWidth(screen) + screen->border) 3690d522f475Smrg#endif 3691d522f475Smrg 3692d522f475Smrg#define OriginY(screen) (screen->border) 3693d522f475Smrg 3694d522f475Smrg#define CursorMoved(screen) \ 3695d522f475Smrg ((screen)->cursor_moved || \ 3696d522f475Smrg ((screen)->cursorp.col != (screen)->cur_col || \ 3697d522f475Smrg (screen)->cursorp.row != (screen)->cur_row)) 3698d522f475Smrg 36993367019cSmrg#define CursorX2(screen,col,fw) ((col) * (int)(fw) + OriginX(screen)) 37003367019cSmrg#define CursorX(screen,col) CursorX2(screen, col, FontWidth(screen)) 37013367019cSmrg#define CursorY2(screen,row) (((row) * FontHeight(screen)) + screen->border) 37023367019cSmrg#define CursorY(screen,row) CursorY2(screen, INX2ROW(screen, row)) 3703d522f475Smrg 3704d522f475Smrg/* 3705d522f475Smrg * These definitions depend on whether xterm supports active-icon. 3706d522f475Smrg */ 3707d522f475Smrg#ifndef NO_ACTIVE_ICON 3708d522f475Smrg#define IsIconWin(screen,win) ((win) == &(screen)->iconVwin) 3709d522f475Smrg#define IsIcon(screen) (WhichVWin(screen) == &(screen)->iconVwin) 3710d522f475Smrg#define WhichVWin(screen) ((screen)->whichVwin) 3711d522f475Smrg#define WhichTWin(screen) ((screen)->whichTwin) 3712d522f475Smrg 3713dfb07bc7Smrg#define WhichVFont(screen,name) (IsIcon(screen) ? getIconicFont(screen) \ 3714d4fba8b9Smrg : getNormalFont(screen, (int)(name)))->fs 3715dfb07bc7Smrg#define FontAscent(screen) (IsIcon(screen) ? getIconicFont(screen)->fs->ascent \ 3716d522f475Smrg : WhichVWin(screen)->f_ascent) 3717dfb07bc7Smrg#define FontDescent(screen) (IsIcon(screen) ? getIconicFont(screen)->fs->descent \ 3718d522f475Smrg : WhichVWin(screen)->f_descent) 3719d522f475Smrg#else /* NO_ACTIVE_ICON */ 3720d522f475Smrg 3721d522f475Smrg#define IsIconWin(screen,win) (False) 3722d522f475Smrg#define IsIcon(screen) (False) 3723d522f475Smrg#define WhichVWin(screen) (&((screen)->fullVwin)) 3724d522f475Smrg#define WhichTWin(screen) (&((screen)->fullTwin)) 3725d522f475Smrg 3726d4fba8b9Smrg#define WhichVFont(screen,name) getNormalFont(screen, (int)(name))->fs 3727d522f475Smrg#define FontAscent(screen) WhichVWin(screen)->f_ascent 3728d522f475Smrg#define FontDescent(screen) WhichVWin(screen)->f_descent 3729d522f475Smrg 3730d522f475Smrg#endif /* NO_ACTIVE_ICON */ 3731d522f475Smrg 3732d522f475Smrg#define okFont(font) ((font) != 0 && (font)->fid != 0) 3733d522f475Smrg 3734d522f475Smrg/* 3735d522f475Smrg * Macro to check if we are iconified; do not use render for that case. 3736d522f475Smrg */ 37373367019cSmrg#define UsingRenderFont(xw) (((xw)->work.render_font == True) && !IsIcon(TScreenOf(xw))) 3738d522f475Smrg 3739d522f475Smrg/* 3740d522f475Smrg * These definitions do not depend on whether xterm supports active-icon. 3741d522f475Smrg */ 3742d522f475Smrg#define VWindow(screen) WhichVWin(screen)->window 3743c219fbebSmrg#define VShellWindow(xw) XtWindow(SHELL_OF(xw)) 3744d522f475Smrg#define TWindow(screen) WhichTWin(screen)->window 3745d522f475Smrg#define TShellWindow XtWindow(SHELL_OF(tekWidget)) 3746d522f475Smrg 3747d4fba8b9Smrg#if USE_DOUBLE_BUFFER 3748d4fba8b9Smrgextern Window VDrawable(TScreen * /* screen */); 37493367019cSmrg#else 37503367019cSmrg#define VDrawable(screen) VWindow(screen) 37513367019cSmrg#endif 37523367019cSmrg 3753d522f475Smrg#define Width(screen) WhichVWin(screen)->width 3754d522f475Smrg#define Height(screen) WhichVWin(screen)->height 3755d522f475Smrg#define FullWidth(screen) WhichVWin(screen)->fullwidth 3756d522f475Smrg#define FullHeight(screen) WhichVWin(screen)->fullheight 3757d522f475Smrg#define FontWidth(screen) WhichVWin(screen)->f_width 3758d522f475Smrg#define FontHeight(screen) WhichVWin(screen)->f_height 3759d522f475Smrg 3760dfb07bc7Smrg#define NormalFont(screen) WhichVFont(screen, fNorm) 3761dfb07bc7Smrg#define BoldFont(screen) WhichVFont(screen, fBold) 3762d522f475Smrg 3763d522f475Smrg#if OPT_WIDE_CHARS 3764dfb07bc7Smrg#define NormalWFont(screen) WhichVFont(screen, fWide) 3765dfb07bc7Smrg#define BoldWFont(screen) WhichVFont(screen, fWBold) 3766d522f475Smrg#endif 3767d522f475Smrg 3768d522f475Smrg#define ScrollbarWidth(screen) WhichVWin(screen)->sb_info.width 3769d522f475Smrg 3770d4fba8b9Smrg/* y -> y_shift, to center text versus the cursor */ 3771d4fba8b9Smrg#define ScaleShift(screen) \ 3772d4fba8b9Smrg (int) ((IsIcon(screen) || (screen->scale_height <= 1.0f)) \ 3773d4fba8b9Smrg ? 0.0f \ 3774d4fba8b9Smrg : ((float) WhichVWin(screen)->f_height \ 3775d4fba8b9Smrg * ((float) screen->scale_height - 1.0f) / 2.0f)) 3776d4fba8b9Smrg 3777d4fba8b9Smrg#define BorderGC(w,sp) WhichVWin(sp)->border_gc 3778d4fba8b9Smrg#define FillerGC(w,sp) WhichVWin(sp)->filler_gc 3779d522f475Smrg#define NormalGC(w,sp) getCgsGC(w, WhichVWin(sp), gcNorm) 3780d522f475Smrg#define ReverseGC(w,sp) getCgsGC(w, WhichVWin(sp), gcNormReverse) 3781d522f475Smrg#define NormalBoldGC(w,sp) getCgsGC(w, WhichVWin(sp), gcBold) 3782d522f475Smrg#define ReverseBoldGC(w,sp) getCgsGC(w, WhichVWin(sp), gcBoldReverse) 3783d522f475Smrg 3784d522f475Smrg#define TWidth(screen) WhichTWin(screen)->width 3785d522f475Smrg#define THeight(screen) WhichTWin(screen)->height 3786d522f475Smrg#define TFullWidth(screen) WhichTWin(screen)->fullwidth 3787d522f475Smrg#define TFullHeight(screen) WhichTWin(screen)->fullheight 3788d522f475Smrg#define TekScale(screen) WhichTWin(screen)->tekscale 3789d522f475Smrg 3790dfb07bc7Smrg/* use these before tek4014 is realized, good enough for default "9x15" font */ 3791dfb07bc7Smrg#define TDefaultRows 37 3792dfb07bc7Smrg#define TDefaultCols 75 3793dfb07bc7Smrg 3794d522f475Smrg#define BorderWidth(w) ((w)->core.border_width) 3795d522f475Smrg#define BorderPixel(w) ((w)->core.border_pixel) 3796d522f475Smrg 3797cd3331d0Smrg#define AllowXtermOps(w,name) (TScreenOf(w)->name && !TScreenOf(w)->allowSendEvents) 3798cd3331d0Smrg 3799cd3331d0Smrg#define AllowColorOps(w,name) (AllowXtermOps(w, allowColorOps) || \ 3800cd3331d0Smrg !TScreenOf(w)->disallow_color_ops[name]) 3801cd3331d0Smrg 3802cd3331d0Smrg#define AllowFontOps(w,name) (AllowXtermOps(w, allowFontOps) || \ 3803cd3331d0Smrg !TScreenOf(w)->disallow_font_ops[name]) 3804cd3331d0Smrg 3805dfb07bc7Smrg#define AllowMouseOps(w,name) (AllowXtermOps(w, allowMouseOps) || \ 3806dfb07bc7Smrg !TScreenOf(w)->disallow_mouse_ops[name]) 3807dfb07bc7Smrg 3808cd3331d0Smrg#define AllowTcapOps(w,name) (AllowXtermOps(w, allowTcapOps) || \ 3809cd3331d0Smrg !TScreenOf(w)->disallow_tcap_ops[name]) 3810cd3331d0Smrg 3811b7c89284Ssnj#define AllowTitleOps(w) AllowXtermOps(w, allowTitleOps) 3812cd3331d0Smrg 3813d4fba8b9Smrg#define AllowXResOps(w) True 3814d4fba8b9Smrg 38153367019cSmrg#define SpecialWindowOps(w,name) (!TScreenOf(w)->disallow_win_ops[name]) 3816cd3331d0Smrg#define AllowWindowOps(w,name) (AllowXtermOps(w, allowWindowOps) || \ 38173367019cSmrg SpecialWindowOps(w,name)) 3818b7c89284Ssnj 3819d522f475Smrg#if OPT_TOOLBAR 3820d522f475Smrg#define ToolbarHeight(w) ((resource.toolBar) \ 3821c219fbebSmrg ? ((w)->VT100_TB_INFO(menu_height) \ 3822c219fbebSmrg + (w)->VT100_TB_INFO(menu_border) * 2) \ 3823d522f475Smrg : 0) 3824d522f475Smrg#else 3825d522f475Smrg#define ToolbarHeight(w) 0 3826d522f475Smrg#endif 3827d522f475Smrg 3828d522f475Smrg#if OPT_TEK4014 3829d522f475Smrg#define TEK_LINK_BLOCK_SIZE 1024 3830d522f475Smrg 3831d522f475Smrgtypedef struct Tek_Link 3832d522f475Smrg{ 3833d522f475Smrg struct Tek_Link *next; /* pointer to next TekLink in list 3834d522f475Smrg NULL <=> this is last TekLink */ 3835d522f475Smrg unsigned short fontsize;/* character size, 0-3 */ 3836d522f475Smrg unsigned short count; /* number of chars in data */ 3837d522f475Smrg char *ptr; /* current pointer into data */ 3838d522f475Smrg char data [TEK_LINK_BLOCK_SIZE]; 3839d522f475Smrg} TekLink; 3840d522f475Smrg#endif /* OPT_TEK4014 */ 3841d522f475Smrg 3842d522f475Smrg/* flags for cursors */ 3843d522f475Smrg#define OFF 0 3844d522f475Smrg#define ON 1 3845d522f475Smrg#define BLINKED_OFF 2 3846d522f475Smrg#define CLEAR 0 3847d522f475Smrg#define TOGGLE 1 3848d522f475Smrg 3849d522f475Smrg/* flags for inhibit */ 3850d522f475Smrg#ifdef ALLOWLOGGING 3851d522f475Smrg#define I_LOG 0x01 3852d522f475Smrg#endif 3853d522f475Smrg#define I_SIGNAL 0x02 3854d522f475Smrg#define I_TEK 0x04 3855d522f475Smrg 3856c219fbebSmrg/* *INDENT-ON* */ 3857c219fbebSmrg 3858d522f475Smrg#endif /* included_ptyx_h */ 3859