ptyx.h revision 636d5e9f
1/* $XTermId: ptyx.h,v 1.1032 2021/06/07 19:29:11 tom Exp $ */ 2 3/* 4 * Copyright 1999-2020,2021 by Thomas E. Dickey 5 * 6 * All Rights Reserved 7 * 8 * Permission is hereby granted, free of charge, to any person obtaining a 9 * copy of this software and associated documentation files (the 10 * "Software"), to deal in the Software without restriction, including 11 * without limitation the rights to use, copy, modify, merge, publish, 12 * distribute, sublicense, and/or sell copies of the Software, and to 13 * permit persons to whom the Software is furnished to do so, subject to 14 * the following conditions: 15 * 16 * The above copyright notice and this permission notice shall be included 17 * in all copies or substantial portions of the Software. 18 * 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 23 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 26 * 27 * Except as contained in this notice, the name(s) of the above copyright 28 * holders shall not be used in advertising or otherwise to promote the 29 * sale, use or other dealings in this Software without prior written 30 * authorization. 31 * 32 * 33 * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. 34 * 35 * All Rights Reserved 36 * 37 * Permission to use, copy, modify, and distribute this software and its 38 * documentation for any purpose and without fee is hereby granted, 39 * provided that the above copyright notice appear in all copies and that 40 * both that copyright notice and this permission notice appear in 41 * supporting documentation, and that the name of Digital Equipment 42 * Corporation not be used in advertising or publicity pertaining to 43 * distribution of the software without specific, written prior permission. 44 * 45 * 46 * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 47 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 48 * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 49 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 50 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 51 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 52 * SOFTWARE. 53 */ 54 55#ifndef included_ptyx_h 56#define included_ptyx_h 1 57 58#ifdef HAVE_CONFIG_H 59#include <xtermcfg.h> 60#endif 61 62/* ptyx.h */ 63/* *INDENT-OFF* */ 64/* @(#)ptyx.h X10/6.6 11/10/86 */ 65 66#include <X11/IntrinsicP.h> 67#include <X11/Shell.h> /* for XtNdieCallback, etc. */ 68#include <X11/StringDefs.h> /* for standard resource names */ 69#include <X11/Xmu/Misc.h> /* For Max() and Min(). */ 70#include <X11/cursorfont.h> 71 72 73#undef bcopy 74#undef bzero 75#include <X11/Xfuncs.h> 76 77#include <X11/Xosdefs.h> 78#include <X11/Xmu/Converters.h> 79#ifdef XRENDERFONT 80#include <X11/Xft/Xft.h> 81#endif 82 83#include <stdio.h> 84 85#if defined(HAVE_STDINT_H) || !defined(HAVE_CONFIG_H) 86#include <stdint.h> 87#define DECONST(type,s) ((type *)(intptr_t)(const type *)(s)) 88#else 89#define DECONST(type,s) ((type *)(s)) 90#endif 91 92/* adapted from IntrinsicI.h */ 93#define MyStackAlloc(size, stack_cache_array) \ 94 ((size) <= sizeof(stack_cache_array) \ 95 ? (XtPointer)(stack_cache_array) \ 96 : (XtPointer)malloc((size_t)(size))) 97 98#define MyStackFree(pointer, stack_cache_array) \ 99 if ((pointer) != ((char *)(stack_cache_array))) free(pointer) 100 101/* adapted from vile (vi-like-emacs) */ 102#define TypeCallocN(type,n) (type *)calloc((size_t) (n), sizeof(type)) 103#define TypeCalloc(type) TypeCallocN(type, 1) 104 105#define TypeMallocN(type,n) (type *)malloc(sizeof(type) * (size_t) (n)) 106#define TypeMalloc(type) TypeMallocN(type, 1) 107 108#define TypeRealloc(type,n,p) (type *)realloc(p, (n) * sizeof(type)) 109 110#define TypeXtReallocN(t,p,n) (t *)(void *)XtRealloc((char *)(p), (Cardinal)(sizeof(t) * (size_t) (n))) 111 112#define TypeXtMallocX(type,n) (type *)(void *)XtMalloc((Cardinal)(sizeof(type) + (size_t) (n))) 113#define TypeXtMallocN(type,n) (type *)(void *)XtMalloc((Cardinal)(sizeof(type) * (size_t) (n))) 114#define TypeXtMalloc(type) TypeXtMallocN(type, 1) 115 116#define CastMalloc(type) (type *)malloc(sizeof(type)) 117 118#define BumpBuffer(type, buffer, size, want) \ 119 if (want >= size) { \ 120 size = 1 + (want * 2); \ 121 buffer = TypeRealloc(type, size, buffer); \ 122 } 123 124#define BfBuf(type) screen->bf_buf_##type 125#define BfLen(type) screen->bf_len_##type 126 127#define TypedBuffer(type) \ 128 type *bf_buf_##type; \ 129 Cardinal bf_len_##type 130 131#define BumpTypedBuffer(type, want) \ 132 BumpBuffer(type, BfBuf(type), BfLen(type), want) 133 134#define FreeTypedBuffer(type) \ 135 do { \ 136 FreeAndNull(BfBuf(type)); \ 137 BfLen(type) = 0; \ 138 } while (0) 139 140#define FreeAndNull(value) \ 141 do { \ 142 free((void *)(value)); \ 143 value = NULL; \ 144 } while (0) 145 146/* 147** System V definitions 148*/ 149 150#ifdef att 151#define ATT 152#endif 153 154#ifdef SVR4 155#undef SYSV /* predefined on Solaris 2.4 */ 156#define SYSV /* SVR4 is (approx) superset of SVR3 */ 157#define ATT 158#endif 159 160#ifdef SYSV 161#ifdef X_NOT_POSIX 162#if !defined(CRAY) && !defined(SVR4) 163#define dup2(fd1,fd2) ((fd1 == fd2) ? fd1 : \ 164 (close(fd2), fcntl(fd1, F_DUPFD, fd2))) 165#endif 166#endif 167#endif /* SYSV */ 168 169/* 170 * Newer versions of <X11/Xft/Xft.h> have a version number. We use certain 171 * features from that. 172 */ 173#if defined(XRENDERFONT) && defined(XFT_VERSION) && XFT_VERSION >= 20100 174#define HAVE_TYPE_FCCHAR32 1 /* compatible: XftChar16 */ 175#define HAVE_TYPE_XFTCHARSPEC 1 /* new type XftCharSpec */ 176#endif 177 178/* 179** Definitions to simplify ifdef's for pty's. 180*/ 181#define USE_PTY_DEVICE 1 182#define USE_PTY_SEARCH 1 183 184#if defined(__osf__) || (defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) 185#undef USE_PTY_DEVICE 186#undef USE_PTY_SEARCH 187#define USE_PTS_DEVICE 1 188#elif defined(VMS) 189#undef USE_PTY_DEVICE 190#undef USE_PTY_SEARCH 191#elif defined(PUCC_PTYD) 192#undef USE_PTY_SEARCH 193#elif (defined(sun) && defined(SVR4)) || defined(_ALL_SOURCE) || defined(__CYGWIN__) 194#undef USE_PTY_SEARCH 195#elif defined(__OpenBSD__) 196#undef USE_PTY_SEARCH 197#undef USE_PTY_DEVICE 198#endif 199 200#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) 201#define USE_HANDSHAKE 0 /* "recent" Linux systems do not require handshaking */ 202#endif 203 204#if (defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))) 205#define USE_USG_PTYS 206#elif (defined(ATT) && !defined(__sgi)) || defined(__MVS__) || (defined(SYSV) && defined(i386)) 207#define USE_USG_PTYS 208#endif 209 210/* 211 * More systems than not require pty-handshaking. 212 */ 213#ifndef USE_HANDSHAKE 214#define USE_HANDSHAKE 1 215#endif 216 217/* 218** allow for mobility of the pty master/slave directories 219*/ 220#ifndef PTYDEV 221#if defined(__hpux) 222#define PTYDEV "/dev/ptym/ptyxx" 223#elif defined(__MVS__) 224#define PTYDEV "/dev/ptypxxxx" 225#else 226#define PTYDEV "/dev/ptyxx" 227#endif 228#endif /* !PTYDEV */ 229 230#ifndef TTYDEV 231#if defined(__hpux) 232#define TTYDEV "/dev/pty/ttyxx" 233#elif defined(__MVS__) 234#define TTYDEV "/dev/ptypxxxx" 235#elif defined(USE_PTS_DEVICE) 236#define TTYDEV "/dev/pts/0" 237#else 238#define TTYDEV "/dev/ttyxx" 239#endif 240#endif /* !TTYDEV */ 241 242#ifndef PTYCHAR1 243#ifdef __hpux 244#define PTYCHAR1 "zyxwvutsrqp" 245#else /* !__hpux */ 246#define PTYCHAR1 "pqrstuvwxyzPQRSTUVWXYZ" 247#endif /* !__hpux */ 248#endif /* !PTYCHAR1 */ 249 250#ifndef PTYCHAR2 251#ifdef __hpux 252#define PTYCHAR2 "fedcba9876543210" 253#else /* !__hpux */ 254#if defined(__DragonFly__) || defined(__FreeBSD__) 255#define PTYCHAR2 "0123456789abcdefghijklmnopqrstuv" 256#else /* !__FreeBSD__ */ 257#define PTYCHAR2 "0123456789abcdef" 258#endif /* !__FreeBSD__ */ 259#endif /* !__hpux */ 260#endif /* !PTYCHAR2 */ 261 262#ifndef TTYFORMAT 263#if defined(CRAY) 264#define TTYFORMAT "/dev/ttyp%03d" 265#elif defined(__MVS__) 266#define TTYFORMAT "/dev/ttyp%04d" 267#else 268#define TTYFORMAT "/dev/ttyp%d" 269#endif 270#endif /* TTYFORMAT */ 271 272#ifndef PTYFORMAT 273#ifdef CRAY 274#define PTYFORMAT "/dev/pty/%03d" 275#elif defined(__MVS__) 276#define PTYFORMAT "/dev/ptyp%04d" 277#else 278#define PTYFORMAT "/dev/ptyp%d" 279#endif 280#endif /* PTYFORMAT */ 281 282#ifndef PTYCHARLEN 283#ifdef CRAY 284#define PTYCHARLEN 3 285#elif defined(__MVS__) 286#define PTYCHARLEN 8 /* OS/390 stores, e.g. ut_id="ttyp1234" */ 287#else 288#define PTYCHARLEN 2 289#endif 290#endif 291 292#ifndef MAXPTTYS 293#ifdef CRAY 294#define MAXPTTYS 256 295#else 296#define MAXPTTYS 2048 297#endif 298#endif 299 300/* Until the translation manager comes along, I have to do my own translation of 301 * mouse events into the proper routines. */ 302 303typedef enum { 304 NORMAL = 0 305 , LEFTEXTENSION 306 , RIGHTEXTENSION 307} EventMode; 308 309/* 310 * The origin of a screen is 0, 0. Therefore, the number of rows 311 * on a screen is screen->max_row + 1, and similarly for columns. 312 */ 313#define MaxCols(screen) ((screen)->max_col + 1) 314#define MaxRows(screen) ((screen)->max_row + 1) 315 316typedef unsigned char Char; /* to support 8 bit chars */ 317typedef Char *ScrnPtr; 318typedef ScrnPtr *ScrnBuf; 319 320/* 321 * Declare an X String, but for unsigned chars. 322 */ 323#ifdef _CONST_X_STRING 324typedef const Char *UString; 325#else 326typedef Char *UString; 327#endif 328 329#define IsEmpty(s) ((s) == 0 || *(s) == '\0') 330#define IsSpace(c) ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n') 331 332/* 333 * Check strtol result, using "FullS2L" when no more data is expected, and 334 * "PartS2L" when more data may follow in the string. 335 */ 336#define FullS2L(s,d) (PartS2L(s,d) && (*(d) == '\0')) 337#define PartS2L(s,d) (isdigit(CharOf(*(s))) && (d) != (s) && (d) != 0) 338 339#define CASETYPE(name) case name: result = #name; break 340 341#define CharOf(n) ((Char)(n)) 342 343typedef struct { 344 int row; 345 int col; 346} CELL; 347 348typedef struct { 349 Char *data_buffer; /* the current selection */ 350 size_t data_limit; /* size of allocated buffer */ 351 size_t data_length; /* number of significant bytes */ 352} SelectedCells; 353 354#define isSameRow(a,b) ((a)->row == (b)->row) 355#define isSameCol(a,b) ((a)->col == (b)->col) 356#define isSameCELL(a,b) (isSameRow(a,b) && isSameCol(a,b)) 357 358#define xBIT(n) (1 << (n)) 359 360/* 361 * ANSI emulation, special character codes 362 */ 363#define ANSI_EOT 0x04 364#define ANSI_BEL 0x07 365#define ANSI_BS 0x08 366#define ANSI_HT 0x09 367#define ANSI_LF 0x0A 368#define ANSI_VT 0x0B 369#define ANSI_FF 0x0C /* C0, C1 control names */ 370#define ANSI_CR 0x0D 371#define ANSI_SO 0x0E 372#define ANSI_SI 0x0F 373#define ANSI_XON 0x11 /* DC1 */ 374#define ANSI_XOFF 0x13 /* DC3 */ 375#define ANSI_NAK 0x15 376#define ANSI_CAN 0x18 377#define ANSI_ESC 0x1B 378#define ANSI_SPA 0x20 379#define XTERM_POUND 0x1E /* internal mapping for '#' */ 380#define ANSI_DEL 0x7F 381#define ANSI_SS2 0x8E 382#define ANSI_SS3 0x8F 383#define ANSI_DCS 0x90 384#define ANSI_SOS 0x98 385#define ANSI_CSI 0x9B 386#define ANSI_ST 0x9C 387#define ANSI_OSC 0x9D 388#define ANSI_PM 0x9E 389#define ANSI_APC 0x9F 390 391#define BAD_ASCII '?' 392#define NonLatin1(c) (((c) != ANSI_LF) && \ 393 ((c) != ANSI_HT) && \ 394 (((c) < ANSI_SPA) || \ 395 ((c) >= ANSI_DEL && (c) <= ANSI_APC))) 396#define OnlyLatin1(c) (NonLatin1(c) ? BAD_ASCII : (c)) 397 398#define L_CURL '{' 399#define R_CURL '}' 400 401#define MIN_DECID 52 /* can emulate VT52 */ 402#define MAX_DECID 525 /* ...through VT525 */ 403 404#ifndef DFT_DECID 405#define DFT_DECID "420" /* default VT420 */ 406#endif 407 408#ifndef DFT_KBD_DIALECT 409#define DFT_KBD_DIALECT "B" /* default USASCII */ 410#endif 411 412#define MAX_I_PARAM 65535 /* parameters */ 413#define MAX_I_DELAY 32767 /* time-delay in ReGIS */ 414#define MAX_U_COLOR 65535u /* colors */ 415#define MAX_U_COORD 32767u /* coordinates */ 416#define MAX_U_STRING 65535u /* string-length */ 417 418/* constants used for utf8 mode */ 419#define UCS_REPL 0xfffd 420#define UCS_LIMIT 0x80000000U /* both limit and flag for non-UCS */ 421 422#define TERMCAP_SIZE 1500 /* 1023 is standard; 'screen' exceeds */ 423 424#define MAX_XLFD_FONTS 1 425#define MAX_XFT_FONTS 1 426#define NMENUFONTS 10 /* font entries in fontMenu */ 427 428#define NBOX 5 /* Number of Points in box */ 429#define NPARAM 30 /* Max. parameters */ 430 431typedef struct { 432 String opt; 433 String desc; 434} OptionHelp; 435 436typedef struct { 437 int count; /* number of values in params[] */ 438 int has_subparams; /* true if there are any sub's */ 439 int is_sub[NPARAM]; /* true for subparam */ 440 int params[NPARAM]; /* parameter value */ 441} PARAMS; 442 443typedef short ParmType; 444typedef unsigned short UParm; /* unparseputn passes ParmType */ 445 446typedef struct { 447 Char a_type; /* CSI, etc., see unparseq() */ 448 Char a_pintro; /* private-mode char, if any */ 449 const char * a_delim; /* between parameters (;) */ 450 Char a_inters; /* special (before final-char) */ 451 Char a_final; /* final-char */ 452 ParmType a_nparam; /* # of parameters */ 453 ParmType a_param[NPARAM]; /* Parameters */ 454 Char a_radix[NPARAM]; /* Parameters */ 455} ANSI; 456 457#define TEK_FONT_LARGE 0 458#define TEK_FONT_2 1 459#define TEK_FONT_3 2 460#define TEK_FONT_SMALL 3 461#define TEKNUMFONTS 4 462 463/* Actually there are 5 types of lines, but four are non-solid lines */ 464#define TEKNUMLINES 4 465 466typedef struct { 467 int x; 468 int y; 469 int fontsize; 470 unsigned linetype; 471} Tmodes; 472 473typedef struct { 474 int Twidth; 475 int Theight; 476} T_fontsize; 477 478typedef struct { 479 short *bits; 480 int x; 481 int y; 482 int width; 483 int height; 484} BitmapBits; 485 486/* bit-assignments for extensions to DECRQCRA */ 487typedef enum { 488 csDEC = 0 489 ,csPOSITIVE = xBIT(0) 490 ,csATTRIBS = xBIT(1) 491 ,csNOTRIM = xBIT(2) 492 ,csDRAWN = xBIT(3) 493 ,csBYTE = xBIT(4) 494 ,cs8TH = xBIT(5) 495} CSBITS; 496 497#define EXCHANGE(a,b,tmp) tmp = a; a = b; b = tmp 498 499/***====================================================================***/ 500 501#if (XtSpecificationRelease < 6) 502#ifndef NO_ACTIVE_ICON 503#define NO_ACTIVE_ICON 1 /* Note: code relies on an X11R6 function */ 504#endif 505#endif 506 507#ifndef OPT_AIX_COLORS 508#define OPT_AIX_COLORS 1 /* true if xterm is configured with AIX (16) colors */ 509#endif 510 511#ifndef OPT_ALLOW_XXX_OPS 512#define OPT_ALLOW_XXX_OPS 1 /* true if xterm adds "Allow XXX Ops" submenu */ 513#endif 514 515#ifndef OPT_BLINK_CURS 516#define OPT_BLINK_CURS 1 /* true if xterm has blinking cursor capability */ 517#endif 518 519#ifndef OPT_BLINK_TEXT 520#define OPT_BLINK_TEXT OPT_BLINK_CURS /* true if xterm has blinking text capability */ 521#endif 522 523#ifndef OPT_BOX_CHARS 524#define OPT_BOX_CHARS 1 /* true if xterm can simulate box-characters */ 525#endif 526 527#ifndef OPT_BUILTIN_XPMS 528#define OPT_BUILTIN_XPMS 0 /* true if all xpm data is compiled-in */ 529#endif 530 531#ifndef OPT_BROKEN_OSC 532#ifdef linux 533#define OPT_BROKEN_OSC 1 /* man console_codes, 1st paragraph - cf: ECMA-48 */ 534#else 535#define OPT_BROKEN_OSC 0 /* true if xterm allows Linux's broken OSC parsing */ 536#endif 537#endif 538 539#ifndef OPT_BROKEN_ST 540#define OPT_BROKEN_ST 1 /* true if xterm allows old/broken OSC parsing */ 541#endif 542 543#ifndef OPT_C1_PRINT 544#define OPT_C1_PRINT 1 /* true if xterm allows C1 controls to be printable */ 545#endif 546 547#ifndef OPT_CLIP_BOLD 548#define OPT_CLIP_BOLD 1 /* true if xterm uses clipping to avoid bold-trash */ 549#endif 550 551#ifndef OPT_COLOR_CLASS 552#define OPT_COLOR_CLASS 1 /* true if xterm uses separate color-resource classes */ 553#endif 554 555#ifndef OPT_COLOR_RES 556#define OPT_COLOR_RES 1 /* true if xterm delays color-resource evaluation */ 557#endif 558 559#ifndef OPT_DABBREV 560#define OPT_DABBREV 0 /* dynamic abbreviations */ 561#endif 562 563#ifndef OPT_DEC_CHRSET 564#define OPT_DEC_CHRSET 1 /* true if xterm is configured for DEC charset */ 565#endif 566 567#ifndef OPT_DEC_LOCATOR 568#define OPT_DEC_LOCATOR 0 /* true if xterm supports VT220-style mouse events */ 569#endif 570 571#ifndef OPT_DEC_RECTOPS 572#define OPT_DEC_RECTOPS 1 /* true if xterm is configured for VT420 rectangles */ 573#endif 574 575#ifndef OPT_SIXEL_GRAPHICS 576#define OPT_SIXEL_GRAPHICS 0 /* true if xterm supports VT240-style sixel graphics */ 577#endif 578 579#ifndef OPT_PRINT_GRAPHICS 580#define OPT_PRINT_GRAPHICS 0 /* true if xterm supports screen dumps as sixel graphics */ 581#endif 582 583#ifndef OPT_SCREEN_DUMPS 584#define OPT_SCREEN_DUMPS 1 /* true if xterm supports screen dumps */ 585#endif 586 587#ifndef OPT_REGIS_GRAPHICS 588#define OPT_REGIS_GRAPHICS 0 /* true if xterm supports VT125/VT240/VT330 ReGIS graphics */ 589#endif 590 591#ifndef OPT_GRAPHICS 592#define OPT_GRAPHICS 0 /* true if xterm is configured for any type of graphics */ 593#endif 594 595#ifndef OPT_DEC_SOFTFONT 596#define OPT_DEC_SOFTFONT 0 /* true if xterm is configured for VT220 softfonts */ 597#endif 598 599#ifndef OPT_DOUBLE_BUFFER 600#define OPT_DOUBLE_BUFFER 0 /* true if using double-buffering */ 601#endif 602 603#ifndef OPT_EBCDIC 604#ifdef __MVS__ 605#define OPT_EBCDIC 1 606#else 607#define OPT_EBCDIC 0 608#endif 609#endif 610 611#ifndef OPT_EXEC_XTERM 612#define OPT_EXEC_XTERM 0 /* true if xterm can fork/exec copies of itself */ 613#endif 614 615#ifndef OPT_EXTRA_PASTE 616#define OPT_EXTRA_PASTE 1 617#endif 618 619#ifndef OPT_FIFO_LINES 620#define OPT_FIFO_LINES 1 /* optimize save-lines feature using FIFO */ 621#endif 622 623#ifndef OPT_FOCUS_EVENT 624#define OPT_FOCUS_EVENT 1 /* focus in/out events */ 625#endif 626 627#ifndef OPT_HP_FUNC_KEYS 628#define OPT_HP_FUNC_KEYS 0 /* true if xterm supports HP-style function keys */ 629#endif 630 631#ifndef OPT_I18N_SUPPORT 632#if (XtSpecificationRelease >= 5) 633#define OPT_I18N_SUPPORT 1 /* true if xterm uses internationalization support */ 634#else 635#define OPT_I18N_SUPPORT 0 636#endif 637#endif 638 639#ifndef OPT_INITIAL_ERASE 640#define OPT_INITIAL_ERASE 1 /* use pty's erase character if it's not 128 */ 641#endif 642 643#ifndef OPT_INPUT_METHOD 644#if (XtSpecificationRelease >= 6) 645#define OPT_INPUT_METHOD OPT_I18N_SUPPORT /* true if xterm uses input-method support */ 646#else 647#define OPT_INPUT_METHOD 0 648#endif 649#endif 650 651#ifndef OPT_ISO_COLORS 652#define OPT_ISO_COLORS 1 /* true if xterm is configured with ISO colors */ 653#endif 654 655#ifndef OPT_DIRECT_COLOR 656#define OPT_DIRECT_COLOR OPT_ISO_COLORS /* true if xterm is configured with direct-colors */ 657#endif 658 659#ifndef OPT_256_COLORS 660#define OPT_256_COLORS 1 /* true if xterm is configured with 256 colors */ 661#endif 662 663#ifndef OPT_88_COLORS 664#define OPT_88_COLORS 1 /* true if xterm is configured with 88 colors */ 665#endif 666 667#ifndef OPT_HIGHLIGHT_COLOR 668#define OPT_HIGHLIGHT_COLOR 1 /* true if xterm supports color highlighting */ 669#endif 670 671#ifndef OPT_LOAD_VTFONTS 672#define OPT_LOAD_VTFONTS 0 /* true if xterm has load-vt-fonts() action */ 673#endif 674 675#ifndef OPT_LUIT_PROG 676#define OPT_LUIT_PROG 1 /* true if xterm supports luit */ 677#endif 678 679#ifndef OPT_MAXIMIZE 680#define OPT_MAXIMIZE 1 /* add actions for iconify ... maximize */ 681#endif 682 683#ifndef OPT_MINI_LUIT 684#define OPT_MINI_LUIT 0 /* true if xterm supports built-in mini-luit */ 685#endif 686 687#ifndef OPT_MOD_FKEYS 688#define OPT_MOD_FKEYS 1 /* modify cursor- and function-keys in normal mode */ 689#endif 690 691#ifndef OPT_NUM_LOCK 692#define OPT_NUM_LOCK 1 /* use NumLock key only for numeric-keypad */ 693#endif 694 695#ifndef OPT_PASTE64 696#define OPT_PASTE64 1 /* program control of select/paste via base64 */ 697#endif 698 699#ifndef OPT_PC_COLORS 700#define OPT_PC_COLORS 1 /* true if xterm supports PC-style (bold) colors */ 701#endif 702 703#ifndef OPT_PRINT_ON_EXIT 704#define OPT_PRINT_ON_EXIT 1 /* true allows xterm to dump screen on X error */ 705#endif 706 707#ifndef OPT_PTY_HANDSHAKE 708#define OPT_PTY_HANDSHAKE USE_HANDSHAKE /* avoid pty races on older systems */ 709#endif 710 711#ifndef OPT_PRINT_COLORS 712#define OPT_PRINT_COLORS 1 /* true if we print color information */ 713#endif 714 715#ifndef OPT_READLINE 716#define OPT_READLINE 0 /* mouse-click/paste support for readline */ 717#endif 718 719#ifndef OPT_RENDERFONT 720#ifdef XRENDERFONT 721#define OPT_RENDERFONT 1 722#else 723#define OPT_RENDERFONT 0 724#endif 725#endif 726 727#ifndef OPT_RENDERWIDE 728#if OPT_RENDERFONT && OPT_WIDE_CHARS && defined(HAVE_TYPE_XFTCHARSPEC) 729#define OPT_RENDERWIDE 1 730#else 731#define OPT_RENDERWIDE 0 732#endif 733#endif 734 735#ifndef OPT_REPORT_CCLASS 736#define OPT_REPORT_CCLASS 1 /* provide "-report-charclass" option */ 737#endif 738 739#ifndef OPT_REPORT_COLORS 740#define OPT_REPORT_COLORS 1 /* provide "-report-colors" option */ 741#endif 742 743#ifndef OPT_REPORT_FONTS 744#define OPT_REPORT_FONTS 1 /* provide "-report-fonts" option */ 745#endif 746 747#ifndef OPT_REPORT_ICONS 748#define OPT_REPORT_ICONS 1 /* provide "-report-icons" option */ 749#endif 750 751#ifndef OPT_SAME_NAME 752#define OPT_SAME_NAME 1 /* suppress redundant updates of title, icon, etc. */ 753#endif 754 755#ifndef OPT_SAVE_LINES 756#define OPT_SAVE_LINES OPT_FIFO_LINES /* optimize save-lines feature */ 757#endif 758 759#ifndef OPT_SCO_FUNC_KEYS 760#define OPT_SCO_FUNC_KEYS 0 /* true if xterm supports SCO-style function keys */ 761#endif 762 763#ifndef OPT_SUN_FUNC_KEYS 764#define OPT_SUN_FUNC_KEYS 1 /* true if xterm supports Sun-style function keys */ 765#endif 766 767#ifndef OPT_SCROLL_LOCK 768#define OPT_SCROLL_LOCK 1 /* true if xterm interprets fontsize-shifting */ 769#endif 770 771#ifndef OPT_SELECT_REGEX 772#define OPT_SELECT_REGEX 1 /* true if xterm supports regular-expression selects */ 773#endif 774 775#ifndef OPT_SELECTION_OPS 776#define OPT_SELECTION_OPS 1 /* true if xterm supports operations on selection */ 777#endif 778 779#ifndef OPT_SESSION_MGT 780#if defined(XtNdieCallback) && defined(XtNsaveCallback) 781#define OPT_SESSION_MGT 1 782#else 783#define OPT_SESSION_MGT 0 784#endif 785#endif 786 787#ifndef OPT_SHIFT_FONTS 788#define OPT_SHIFT_FONTS 0 /* true if xterm interprets fontsize-shifting */ 789#endif 790 791#ifndef OPT_SUNPC_KBD 792#define OPT_SUNPC_KBD 1 /* true if xterm supports Sun/PC keyboard map */ 793#endif 794 795#ifndef OPT_TCAP_FKEYS 796#define OPT_TCAP_FKEYS 1 /* true for termcap function-keys */ 797#endif 798 799#ifndef OPT_TCAP_QUERY 800#define OPT_TCAP_QUERY 1 /* true for termcap query */ 801#endif 802 803#ifndef OPT_TEK4014 804#define OPT_TEK4014 1 /* true if we're using tek4014 emulation */ 805#endif 806 807#ifndef OPT_TOOLBAR 808#define OPT_TOOLBAR 0 /* true if xterm supports toolbar menus */ 809#endif 810 811#ifndef OPT_TRACE 812#define OPT_TRACE 0 /* true if we're using debugging traces */ 813#endif 814 815#ifndef OPT_TRACE_FLAGS 816#define OPT_TRACE_FLAGS 0 /* additional tracing used for SCRN_BUF_FLAGS */ 817#endif 818 819#ifndef OPT_TRACE_UNIQUE 820#define OPT_TRACE_UNIQUE 0 /* true if we're using multiple trace files */ 821#endif 822 823#ifndef OPT_VT52_MODE 824#define OPT_VT52_MODE 1 /* true if xterm supports VT52 emulation */ 825#endif 826 827#ifndef OPT_WIDE_ATTRS 828#define OPT_WIDE_ATTRS 1 /* true if xterm supports 16-bit attributes */ 829#endif 830 831#ifndef OPT_WIDE_CHARS 832#define OPT_WIDE_CHARS 1 /* true if xterm supports 16-bit characters */ 833#endif 834 835#ifndef OPT_WIDER_ICHAR 836#define OPT_WIDER_ICHAR 1 /* true if xterm uses 32-bits for wide-chars */ 837#endif 838 839#ifndef OPT_XMC_GLITCH 840#define OPT_XMC_GLITCH 0 /* true if xterm supports xmc (magic cookie glitch) */ 841#endif 842 843#ifndef OPT_XRES_QUERY 844#define OPT_XRES_QUERY 1 /* true for resource query */ 845#endif 846 847#ifndef OPT_XTERM_SGR 848#define OPT_XTERM_SGR 1 /* true if xterm supports private SGR controls */ 849#endif 850 851#ifndef OPT_ZICONBEEP 852#define OPT_ZICONBEEP 1 /* true if xterm supports "-ziconbeep" option */ 853#endif 854 855/***====================================================================***/ 856 857#if OPT_AIX_COLORS && !OPT_ISO_COLORS 858/* You must have ANSI/ISO colors to support AIX colors */ 859#undef OPT_AIX_COLORS 860#define OPT_AIX_COLORS 0 861#endif 862 863#if OPT_COLOR_RES && !OPT_ISO_COLORS 864/* You must have ANSI/ISO colors to support ColorRes logic */ 865#undef OPT_COLOR_RES 866#define OPT_COLOR_RES 0 867#endif 868 869#if OPT_256_COLORS && (OPT_WIDE_CHARS || OPT_RENDERFONT || OPT_XMC_GLITCH) 870/* It's actually more complicated than that - but by trimming options you can 871 * have 256 color resources though. 872 */ 873#define OPT_COLOR_RES2 1 874#else 875#define OPT_COLOR_RES2 0 876#endif 877 878#if OPT_PC_COLORS && !OPT_ISO_COLORS 879/* You must have ANSI/ISO colors to support PC colors */ 880#undef OPT_PC_COLORS 881#define OPT_PC_COLORS 0 882#endif 883 884#if OPT_PRINT_COLORS && !OPT_ISO_COLORS 885/* You must have ANSI/ISO colors to be able to print them */ 886#undef OPT_PRINT_COLORS 887#define OPT_PRINT_COLORS 0 888#endif 889 890#if OPT_256_COLORS && !OPT_ISO_COLORS 891/* You must have ANSI/ISO colors to support 256 colors */ 892#undef OPT_256_COLORS 893#define OPT_256_COLORS 0 894#endif 895 896#if OPT_88_COLORS && !OPT_ISO_COLORS 897/* You must have ANSI/ISO colors to support 88 colors */ 898#undef OPT_88_COLORS 899#define OPT_88_COLORS 0 900#endif 901 902#if OPT_88_COLORS && OPT_256_COLORS 903/* 256 colors supersedes 88 colors */ 904#undef OPT_88_COLORS 905#define OPT_88_COLORS 0 906#endif 907 908/***====================================================================***/ 909 910/* 911 * Indices for menu_font_names[][] 912 */ 913typedef enum { 914 fNorm = 0 /* normal font */ 915 , fBold /* bold font */ 916#if OPT_WIDE_ATTRS || OPT_RENDERWIDE 917 , fItal /* italic font */ 918 , fBtal /* bold-italic font */ 919#endif 920#if OPT_WIDE_CHARS 921 , fWide /* double-width font */ 922 , fWBold /* double-width bold font */ 923 , fWItal /* double-width italic font */ 924 , fWBtal /* double-width bold-italic font */ 925#endif 926 , fMAX 927} VTFontEnum; 928 929/* 930 * Indices for cachedGCs.c (unrelated to VTFontEnum). 931 */ 932typedef enum { 933 gcNorm = 0 934 , gcBold 935 , gcNormReverse 936 , gcBoldReverse 937 , gcFiller 938 , gcBorder 939#if OPT_BOX_CHARS 940 , gcLine 941 , gcDots 942#endif 943#if OPT_DEC_CHRSET 944 , gcCNorm 945 , gcCBold 946#endif 947#if OPT_WIDE_CHARS 948 , gcWide 949 , gcWBold 950 , gcWideReverse 951 , gcWBoldReverse 952#endif 953 , gcVTcursNormal 954 , gcVTcursFilled 955 , gcVTcursReverse 956 , gcVTcursOutline 957#if OPT_TEK4014 958 , gcTKcurs 959#endif 960 , gcMAX 961} CgsEnum; 962 963#define for_each_text_gc(n) for (n = gcNorm; n < gcVTcursNormal; ++n) 964#define for_each_curs_gc(n) for (n = gcVTcursNormal; n <= gcVTcursOutline; ++n) 965#define for_each_gc(n) for (n = gcNorm; n < gcMAX; ++n) 966 967/* 968 * Indices for the normal terminal colors in screen.Tcolors[]. 969 * See also OscTextColors, which has corresponding values. 970 */ 971typedef enum { 972 TEXT_FG = 0 /* text foreground */ 973 , TEXT_BG /* text background */ 974 , TEXT_CURSOR /* text cursor */ 975 , MOUSE_FG /* mouse foreground */ 976 , MOUSE_BG /* mouse background */ 977#if OPT_TEK4014 978 , TEK_FG = 5 /* tektronix foreground */ 979 , TEK_BG /* tektronix background */ 980#endif 981#if OPT_HIGHLIGHT_COLOR 982 , HIGHLIGHT_BG = 7 /* highlight background */ 983#endif 984#if OPT_TEK4014 985 , TEK_CURSOR = 8 /* tektronix cursor */ 986#endif 987#if OPT_HIGHLIGHT_COLOR 988 , HIGHLIGHT_FG = 9 /* highlight foreground */ 989#endif 990 , NCOLORS /* total number of colors */ 991} TermColors; 992 993/* 994 * Definitions for exec-formatted and insert-formatted actions. 995 */ 996typedef void (*FormatSelect) (Widget, char *, char *, CELL *, CELL *); 997 998typedef struct { 999 Boolean done; 1000 char *format; 1001 char *buffer; 1002 FormatSelect format_select; 1003#if OPT_PASTE64 1004 Cardinal base64_paste; 1005#endif 1006#if OPT_PASTE64 || OPT_READLINE 1007 unsigned paste_brackets; 1008#endif 1009} InternalSelect; 1010 1011/* 1012 * Constants for titleModes resource 1013 */ 1014typedef enum { 1015 tmSetBase16 = 1 /* set title using hex-string */ 1016 , tmGetBase16 = 2 /* get title using hex-string */ 1017#if OPT_WIDE_CHARS 1018 , tmSetUtf8 = 4 /* like utf8Title, but controllable */ 1019 , tmGetUtf8 = 8 /* retrieve title encoded as UTF-8 */ 1020#endif 1021} TitleModes; 1022 1023#define IsTitleMode(xw,mode) (((xw)->screen.title_modes & mode) != 0) 1024 1025#include <xcharmouse.h> 1026 1027/* 1028 * For readability... 1029 */ 1030#define nrc_percent 100 1031#define nrc_dquote 200 1032#define nrc_ampersand 300 1033typedef enum { 1034 nrc_ASCII = 0 1035 ,nrc_British /* vt100 */ 1036 ,nrc_British_Latin_1 /* vt3xx */ 1037 ,nrc_DEC_Cyrillic /* vt5xx */ 1038 ,nrc_DEC_Spec_Graphic /* vt100 */ 1039 ,nrc_DEC_Alt_Chars /* vt100 */ 1040 ,nrc_DEC_Alt_Graphics /* vt100 */ 1041 ,nrc_DEC_Supp /* vt2xx */ 1042 ,nrc_DEC_Supp_Graphic /* vt3xx */ 1043 ,nrc_DEC_Technical /* vt3xx */ 1044 ,nrc_Dutch /* vt2xx */ 1045 ,nrc_Finnish /* vt2xx */ 1046 ,nrc_Finnish2 /* vt2xx */ 1047 ,nrc_French /* vt2xx */ 1048 ,nrc_French2 /* vt2xx */ 1049 ,nrc_French_Canadian /* vt2xx */ 1050 ,nrc_French_Canadian2 /* vt3xx */ 1051 ,nrc_German /* vt2xx */ 1052 ,nrc_Greek /* vt5xx */ 1053 ,nrc_DEC_Greek_Supp /* vt5xx */ 1054 ,nrc_ISO_Greek_Supp /* vt5xx */ 1055 ,nrc_DEC_Hebrew_Supp /* vt5xx */ 1056 ,nrc_Hebrew /* vt5xx */ 1057 ,nrc_ISO_Hebrew_Supp /* vt5xx */ 1058 ,nrc_Italian /* vt2xx */ 1059 ,nrc_ISO_Latin_1_Supp /* vt5xx */ 1060 ,nrc_ISO_Latin_2_Supp /* vt5xx */ 1061 ,nrc_ISO_Latin_5_Supp /* vt5xx */ 1062 ,nrc_ISO_Latin_Cyrillic /* vt5xx */ 1063 ,nrc_Norwegian_Danish /* vt3xx */ 1064 ,nrc_Norwegian_Danish2 /* vt2xx */ 1065 ,nrc_Norwegian_Danish3 /* vt2xx */ 1066 ,nrc_Portugese /* vt3xx */ 1067 ,nrc_Russian /* vt5xx */ 1068 ,nrc_SCS_NRCS /* vt5xx - probably Serbo/Croatian */ 1069 ,nrc_Spanish /* vt2xx */ 1070 ,nrc_Swedish /* vt2xx */ 1071 ,nrc_Swedish2 /* vt2xx */ 1072 ,nrc_Swiss /* vt2xx */ 1073 ,nrc_DEC_Turkish_Supp /* vt5xx */ 1074 ,nrc_Turkish /* vt5xx */ 1075 ,nrc_Unknown 1076} DECNRCM_codes; 1077 1078/* 1079 * Use this enumerated type to check consistency among dpmodes(), savemodes() 1080 * restoremodes() and do_dec_rqm(). 1081 */ 1082typedef enum { 1083 srm_DECCKM = 1 1084 ,srm_DECANM = 2 1085 ,srm_DECCOLM = 3 1086 ,srm_DECSCLM = 4 1087 ,srm_DECSCNM = 5 1088 ,srm_DECOM = 6 1089 ,srm_DECAWM = 7 1090 ,srm_DECARM = 8 1091 ,srm_X10_MOUSE = SET_X10_MOUSE 1092#if OPT_TOOLBAR 1093 ,srm_RXVT_TOOLBAR = 10 1094#endif 1095#if OPT_BLINK_CURS 1096 ,srm_ATT610_BLINK = 12 1097 ,srm_CURSOR_BLINK_OPS = 13 1098 ,srm_XOR_CURSOR_BLINKS = 14 1099#endif 1100 ,srm_DECPFF = 18 1101 ,srm_DECPEX = 19 1102 ,srm_DECTCEM = 25 1103 ,srm_RXVT_SCROLLBAR = 30 1104#if OPT_SHIFT_FONTS 1105 ,srm_RXVT_FONTSIZE = 35 1106#endif 1107#if OPT_TEK4014 1108 ,srm_DECTEK = 38 1109#endif 1110 ,srm_132COLS = 40 1111 ,srm_CURSES_HACK = 41 1112 ,srm_DECNRCM = 42 1113#if OPT_PRINT_GRAPHICS 1114 ,srm_DECGEPM = 43 /* Graphics Expanded Print Mode */ 1115#endif 1116 ,srm_MARGIN_BELL = 44 /* also DECGPCM (Graphics Print Color Mode) */ 1117 ,srm_REVERSEWRAP = 45 /* also DECGPCS (Graphics Print Color Syntax) */ 1118#ifdef ALLOWLOGGING 1119 ,srm_ALLOWLOGGING = 46 /* also DECGPBM (Graphics Print Background Mode) */ 1120#elif OPT_PRINT_GRAPHICS 1121 ,srm_DECGPBM = 46 /* Graphics Print Background Mode */ 1122#endif 1123 ,srm_ALTBUF = 47 /* also DECGRPM (Graphics Rotated Print Mode) */ 1124 ,srm_DECNKM = 66 1125 ,srm_DECBKM = 67 1126 ,srm_DECLRMM = 69 1127#if OPT_SIXEL_GRAPHICS 1128 ,srm_DECSDM = 80 /* Sixel Display Mode */ 1129#endif 1130 ,srm_DECNCSM = 95 1131 ,srm_VT200_MOUSE = SET_VT200_MOUSE 1132 ,srm_VT200_HIGHLIGHT_MOUSE = SET_VT200_HIGHLIGHT_MOUSE 1133 ,srm_BTN_EVENT_MOUSE = SET_BTN_EVENT_MOUSE 1134 ,srm_ANY_EVENT_MOUSE = SET_ANY_EVENT_MOUSE 1135#if OPT_FOCUS_EVENT 1136 ,srm_FOCUS_EVENT_MOUSE = SET_FOCUS_EVENT_MOUSE 1137#endif 1138 ,srm_EXT_MODE_MOUSE = SET_EXT_MODE_MOUSE 1139 ,srm_SGR_EXT_MODE_MOUSE = SET_SGR_EXT_MODE_MOUSE 1140 ,srm_URXVT_EXT_MODE_MOUSE = SET_URXVT_EXT_MODE_MOUSE 1141 ,srm_PIXEL_POSITION_MOUSE = SET_PIXEL_POSITION_MOUSE 1142 ,srm_ALTERNATE_SCROLL = SET_ALTERNATE_SCROLL 1143 ,srm_RXVT_SCROLL_TTY_OUTPUT = 1010 1144 ,srm_RXVT_SCROLL_TTY_KEYPRESS = 1011 1145 ,srm_EIGHT_BIT_META = 1034 1146#if OPT_NUM_LOCK 1147 ,srm_REAL_NUMLOCK = 1035 1148 ,srm_META_SENDS_ESC = 1036 1149#endif 1150 ,srm_DELETE_IS_DEL = 1037 1151#if OPT_NUM_LOCK 1152 ,srm_ALT_SENDS_ESC = 1039 1153#endif 1154 ,srm_KEEP_SELECTION = 1040 1155 ,srm_SELECT_TO_CLIPBOARD = 1041 1156 ,srm_BELL_IS_URGENT = 1042 1157 ,srm_POP_ON_BELL = 1043 1158 ,srm_KEEP_CLIPBOARD = 1044 1159 ,srm_ALLOW_ALTBUF = 1046 1160 ,srm_OPT_ALTBUF = 1047 1161 ,srm_SAVE_CURSOR = 1048 1162 ,srm_OPT_ALTBUF_CURSOR = 1049 1163#if OPT_TCAP_FKEYS 1164 ,srm_TCAP_FKEYS = 1050 1165#endif 1166#if OPT_SUN_FUNC_KEYS 1167 ,srm_SUN_FKEYS = 1051 1168#endif 1169#if OPT_HP_FUNC_KEYS 1170 ,srm_HP_FKEYS = 1052 1171#endif 1172#if OPT_SCO_FUNC_KEYS 1173 ,srm_SCO_FKEYS = 1053 1174#endif 1175 ,srm_LEGACY_FKEYS = 1060 1176#if OPT_SUNPC_KBD 1177 ,srm_VT220_FKEYS = 1061 1178#endif 1179#if OPT_GRAPHICS 1180 ,srm_PRIVATE_COLOR_REGISTERS = 1070 1181#endif 1182#if OPT_PASTE64 || OPT_READLINE 1183 ,srm_PASTE_IN_BRACKET = SET_PASTE_IN_BRACKET 1184#endif 1185#if OPT_READLINE 1186 ,srm_BUTTON1_MOVE_POINT = SET_BUTTON1_MOVE_POINT 1187 ,srm_BUTTON2_MOVE_POINT = SET_BUTTON2_MOVE_POINT 1188 ,srm_DBUTTON3_DELETE = SET_DBUTTON3_DELETE 1189 ,srm_PASTE_QUOTE = SET_PASTE_QUOTE 1190 ,srm_PASTE_LITERAL_NL = SET_PASTE_LITERAL_NL 1191#endif /* OPT_READLINE */ 1192#if OPT_SIXEL_GRAPHICS 1193 ,srm_SIXEL_SCROLLS_RIGHT = 8452 1194#endif 1195} DECSET_codes; 1196 1197/* internal codes for selection atoms */ 1198typedef enum { 1199 PRIMARY_CODE = 0 1200 ,CLIPBOARD_CODE 1201 ,SECONDARY_CODE 1202 ,MAX_SELECTION_CODES 1203} SelectionCodes; 1204 1205/* indices for mapping multiple clicks to selection types */ 1206typedef enum { 1207 Select_CHAR=0 1208 ,Select_WORD 1209 ,Select_LINE 1210 ,Select_GROUP 1211 ,Select_PAGE 1212 ,Select_ALL 1213#if OPT_SELECT_REGEX 1214 ,Select_REGEX 1215#endif 1216 ,NSELECTUNITS 1217} SelectUnit; 1218 1219#if OPT_BLINK_CURS 1220typedef enum { 1221 cbFalse = 0 1222 , cbTrue 1223 , cbAlways 1224 , cbNever 1225 , cbLAST 1226} BlinkOps; 1227#endif 1228 1229typedef enum { 1230 ecSetColor = 1 1231 , ecGetColor 1232 , ecGetAnsiColor 1233 , ecLAST 1234} ColorOps; 1235 1236typedef enum { 1237 efSetFont = 1 1238 , efGetFont 1239 , efLAST 1240} FontOps; 1241 1242typedef enum { 1243 esFalse = 0 1244 , esTrue 1245 , esAlways 1246 , esNever 1247 , esLAST 1248} FullscreenOps; 1249 1250#ifndef NO_ACTIVE_ICON 1251typedef enum { 1252 eiFalse = 0 1253 , eiTrue 1254 , eiDefault 1255 , eiLAST 1256} AIconOps; 1257#endif 1258 1259typedef enum { 1260 emX10 = 1 1261 , emLocator 1262 , emVT200Click 1263 , emVT200Hilite 1264 , emAnyButton 1265 , emAnyEvent 1266 , emFocusEvent 1267 , emExtended 1268 , emSGR 1269 , emURXVT 1270 , emAlternateScroll 1271 , emLAST 1272} MouseOps; 1273 1274typedef enum { 1275#define DATA(name) ep##name 1276 DATA(NUL) = 0 1277 , DATA(SOH) = 1 1278 , DATA(STX) = 2 1279 , DATA(ETX) = 3 1280 , DATA(EOT) = 4 1281 , DATA(ENQ) = 5 1282 , DATA(ACK) = 6 1283 , DATA(BEL) = 7 1284 , DATA(BS) = 8 1285 , DATA(HT) = 9 1286 , DATA(LF) = 10 1287 , DATA(VT) = 11 1288 , DATA(FF) = 12 1289 , DATA(CR) = 13 1290 , DATA(SO) = 14 1291 , DATA(SI) = 15 1292 , DATA(DLE) = 16 1293 , DATA(DC1) = 17 1294 , DATA(DC2) = 18 1295 , DATA(DC3) = 19 1296 , DATA(DC4) = 20 1297 , DATA(NAK) = 21 1298 , DATA(SYN) = 22 1299 , DATA(ETB) = 23 1300 , DATA(CAN) = 24 1301 , DATA(EM) = 25 1302 , DATA(SUB) = 26 1303 , DATA(ESC) = 27 1304 , DATA(FS) = 28 1305 , DATA(GS) = 29 1306 , DATA(RS) = 30 1307 , DATA(US) = 31 1308 /* aliases */ 1309 , DATA(C0) 1310 , DATA(DEL) 1311#undef DATA 1312 , epLAST 1313} PasteControls; 1314 1315typedef enum { /* legal values for keyboard.shift_escape */ 1316 ssFalse = 0 1317 , ssTrue = 1 1318 , ssAlways = 2 1319 , ssNever = 3 1320 , ssLAST 1321} ShiftEscapeOps; 1322 1323/* 1324 * xterm uses these codes for the its push-SGR feature. They match where 1325 * possible the corresponding SGR coding. The foreground and background colors 1326 * do not fit into that scheme (because they are a set of ranges), so those are 1327 * chosen arbitrarily -TD 1328 */ 1329typedef enum { 1330 psBOLD = 1 1331#if OPT_WIDE_ATTRS 1332 , psATR_FAINT = 2 1333 , psATR_ITALIC = 3 1334#endif 1335 , psUNDERLINE = 4 1336 , psBLINK = 5 1337 , psINVERSE = 7 1338 , psINVISIBLE = 8 1339#if OPT_WIDE_ATTRS 1340 , psATR_STRIKEOUT = 9 1341#endif 1342 /* SGR 10-19 correspond to primary/alternate fonts, currently unused */ 1343#if OPT_ISO_COLORS 1344 , psFG_COLOR_obs = 10 1345 , psBG_COLOR_obs = 11 1346#endif 1347#if OPT_WIDE_ATTRS 1348 , psATR_DBL_UNDER = 21 1349#endif 1350 /* SGR 22-29 mostly are used to reset SGR 1-9 */ 1351#if OPT_ISO_COLORS 1352 , psFG_COLOR = 30 /* stack maps many colors to one state */ 1353 , psBG_COLOR = 31 1354#endif 1355 , MAX_PUSH_SGR 1356} PushSGR; 1357 1358typedef enum { 1359 etSetTcap = 1 1360 , etGetTcap 1361 , etLAST 1362} TcapOps; 1363 1364typedef enum { 1365 /* 1-23 are chosen to be the same as the control-sequence coding */ 1366 ewRestoreWin = 1 1367 , ewMinimizeWin = 2 1368 , ewSetWinPosition = 3 1369 , ewSetWinSizePixels = 4 1370 , ewRaiseWin = 5 1371 , ewLowerWin = 6 1372 , ewRefreshWin = 7 1373 , ewSetWinSizeChars = 8 1374#if OPT_MAXIMIZE 1375 , ewMaximizeWin = 9 1376 , ewFullscreenWin = 10 1377#endif 1378 , ewGetWinState = 11 1379 , ewGetWinPosition = 13 1380 , ewGetWinSizePixels = 14 1381#if OPT_MAXIMIZE 1382 , ewGetScreenSizePixels = 15 1383 , ewGetCharSizePixels = 16 1384#endif 1385 , ewGetWinSizeChars = 18 1386#if OPT_MAXIMIZE 1387 , ewGetScreenSizeChars = 19 1388#endif 1389 , ewGetIconTitle = 20 1390 , ewGetWinTitle = 21 1391 , ewPushTitle = 22 1392 , ewPopTitle = 23 1393 /* these do not fit into that scheme, which is why we use an array */ 1394 , ewSetWinLines 1395 , ewSetXprop 1396 , ewGetSelection 1397 , ewSetSelection 1398 , ewGetChecksum 1399 , ewSetChecksum 1400 /* get the size of the array... */ 1401 , ewLAST 1402} WindowOps; 1403 1404/***====================================================================***/ 1405 1406#define COLOR_DEFINED(s,w) ((s)->which & (unsigned) (1<<(w))) 1407#define COLOR_VALUE(s,w) ((s)->colors[w]) 1408#define SET_COLOR_VALUE(s,w,v) (((s)->colors[w] = (v)), UIntSet((s)->which, (1<<(w)))) 1409 1410#define COLOR_NAME(s,w) ((s)->names[w]) 1411#define SET_COLOR_NAME(s,w,v) (((s)->names[w] = (v)), ((s)->which |= (unsigned) (1<<(w)))) 1412 1413#define UNDEFINE_COLOR(s,w) ((s)->which &= (~((w)<<1))) 1414 1415/***====================================================================***/ 1416 1417#if OPT_ISO_COLORS 1418#if OPT_WIDE_ATTRS 1419#define COLOR_FLAGS (FG_COLOR | BG_COLOR | ATR_DIRECT_FG | ATR_DIRECT_BG) 1420#else 1421#define COLOR_FLAGS (FG_COLOR | BG_COLOR) 1422#endif 1423#define TERM_COLOR_FLAGS(xw) ((xw)->flags & COLOR_FLAGS) 1424#define COLOR_0 0 1425#define COLOR_1 1 1426#define COLOR_2 2 1427#define COLOR_3 3 1428#define COLOR_4 4 1429#define COLOR_5 5 1430#define COLOR_6 6 1431#define COLOR_7 7 1432#define COLOR_8 8 1433#define COLOR_9 9 1434#define COLOR_10 10 1435#define COLOR_11 11 1436#define COLOR_12 12 1437#define COLOR_13 13 1438#define COLOR_14 14 1439#define COLOR_15 15 1440#define MIN_ANSI_COLORS 16 1441 1442#if OPT_256_COLORS 1443# define NUM_ANSI_COLORS 256 1444#elif OPT_88_COLORS 1445# define NUM_ANSI_COLORS 88 1446#else 1447# define NUM_ANSI_COLORS MIN_ANSI_COLORS 1448#endif 1449 1450#define okIndexedColor(n) ((n) >= 0 && (n) < NUM_ANSI_COLORS) 1451 1452#if NUM_ANSI_COLORS > MIN_ANSI_COLORS 1453# define OPT_EXT_COLORS 1 1454#else 1455# define OPT_EXT_COLORS 0 1456#endif 1457 1458#define COLOR_BD (NUM_ANSI_COLORS) /* BOLD */ 1459#define COLOR_UL (NUM_ANSI_COLORS+1) /* UNDERLINE */ 1460#define COLOR_BL (NUM_ANSI_COLORS+2) /* BLINK */ 1461#define COLOR_RV (NUM_ANSI_COLORS+3) /* REVERSE */ 1462 1463#if OPT_WIDE_ATTRS 1464#define COLOR_IT (NUM_ANSI_COLORS+4) /* ITALIC */ 1465#define MAXCOLORS (NUM_ANSI_COLORS+5) 1466#else 1467#define MAXCOLORS (NUM_ANSI_COLORS+4) 1468#endif 1469 1470#ifndef DFT_COLORMODE 1471#define DFT_COLORMODE True /* default colorMode resource */ 1472#endif 1473 1474#define UseItalicFont(screen) (!(screen)->colorITMode) 1475 1476#define ReverseOrHilite(screen,flags,hilite) \ 1477 (( screen->colorRVMode && hilite ) || \ 1478 ( !screen->colorRVMode && \ 1479 (( (flags & INVERSE) && !hilite) || \ 1480 (!(flags & INVERSE) && hilite)) )) 1481 1482#else /* !OPT_ISO_COLORS */ 1483 1484#define TERM_COLOR_FLAGS(xw) 0 1485 1486#define UseItalicFont(screen) True 1487#define ReverseOrHilite(screen,flags,hilite) \ 1488 (( (flags & INVERSE) && !hilite) || \ 1489 (!(flags & INVERSE) && hilite)) 1490 1491#endif /* OPT_ISO_COLORS */ 1492 1493typedef enum { 1494 XK_TCAPNAME = 3 1495 /* Define fake XK codes, we need those for the fake color response in 1496 * xtermcapKeycode(). 1497 */ 1498#if OPT_ISO_COLORS 1499 , XK_COLORS 1500 , XK_RGB 1501#endif 1502} TcapQuery; 1503 1504#if OPT_AIX_COLORS 1505#define if_OPT_AIX_COLORS(screen, code) if(screen->colorMode) code 1506#else 1507#define if_OPT_AIX_COLORS(screen, code) /* nothing */ 1508#endif 1509 1510#if OPT_256_COLORS || OPT_88_COLORS || OPT_ISO_COLORS 1511# define if_OPT_ISO_COLORS(screen, code) if (screen->colorMode) code 1512#else 1513# define if_OPT_ISO_COLORS(screen, code) /* nothing */ 1514#endif 1515 1516#if OPT_DIRECT_COLOR 1517# define if_OPT_DIRECT_COLOR(screen, code) if (screen->direct_color) code 1518# define if_OPT_DIRECT_COLOR2(screen, test, code) if (screen->direct_color && (test)) code 1519#else 1520# define if_OPT_DIRECT_COLOR(screen, code) /* nothing */ 1521# define if_OPT_DIRECT_COLOR2(screen, test, code) /* nothing */ 1522#endif 1523 1524#define if_OPT_DIRECT_COLOR2_else(cond, test, stmt) \ 1525 if_OPT_DIRECT_COLOR2(cond, test, stmt else) 1526 1527#define COLOR_RES_NAME(root) "color" root 1528 1529#if OPT_COLOR_CLASS 1530#define COLOR_RES_CLASS(root) "Color" root 1531#else 1532#define COLOR_RES_CLASS(root) XtCForeground 1533#endif 1534 1535#if OPT_COLOR_RES 1536#define COLOR_RES(root,offset,value) Sres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset.resource, value) 1537#define COLOR_RES2(name,class,offset,value) Sres(name, class, offset.resource, value) 1538#else 1539#define COLOR_RES(root,offset,value) Cres(COLOR_RES_NAME(root), COLOR_RES_CLASS(root), offset, value) 1540#define COLOR_RES2(name,class,offset,value) Cres(name, class, offset, value) 1541#endif 1542 1543#define CLICK_RES_NAME(count) "on" count "Clicks" 1544#define CLICK_RES_CLASS(count) "On" count "Clicks" 1545#define CLICK_RES(count,offset,value) Sres(CLICK_RES_NAME(count), CLICK_RES_CLASS(count), offset, value) 1546 1547/***====================================================================***/ 1548 1549#if OPT_DEC_CHRSET 1550#define if_OPT_DEC_CHRSET(code) code 1551 /* Use 2 bits for encoding the double high/wide sense of characters */ 1552#define CSET_SWL 0 1553#define CSET_DHL_TOP 1 1554#define CSET_DHL_BOT 2 1555#define CSET_DWL 3 1556#define NUM_CHRSET 8 /* normal/bold and 4 CSET_xxx values */ 1557 1558 /* Use remaining bits for encoding the other character-sets */ 1559#define CSET_NORMAL(code) ((code) == CSET_SWL) 1560#define CSET_DOUBLE(code) (!CSET_NORMAL(code) && !CSET_EXTEND(code)) 1561#define CSET_EXTEND(code) ((int)(code) > CSET_DWL) 1562 1563#define DBLCS_BITS 4 1564#define DBLCS_MASK BITS2MASK(DBLCS_BITS) 1565 1566#define GetLineDblCS(ld) (((ld)->bufHead >> LINEFLAG_BITS) & DBLCS_MASK) 1567#define SetLineDblCS(ld,cs) (ld)->bufHead = (RowData) ((ld->bufHead & LINEFLAG_MASK) | (cs << LINEFLAG_BITS)) 1568 1569#define LineCharSet(screen, ld) \ 1570 (unsigned) ((CSET_DOUBLE(GetLineDblCS(ld))) \ 1571 ? GetLineDblCS(ld) \ 1572 : (screen)->cur_chrset) 1573#define LineMaxCol(screen, ld) \ 1574 (CSET_DOUBLE(GetLineDblCS(ld)) \ 1575 ? (screen->max_col / 2) \ 1576 : (screen->max_col)) 1577#define LineCursorX(screen, ld, col) \ 1578 (CSET_DOUBLE(GetLineDblCS(ld)) \ 1579 ? CursorX(screen, 2*(col)) \ 1580 : CursorX(screen, (col))) 1581#define LineFontWidth(screen, ld) \ 1582 (CSET_DOUBLE(GetLineDblCS(ld)) \ 1583 ? 2*FontWidth(screen) \ 1584 : FontWidth(screen)) 1585#else 1586 1587#define if_OPT_DEC_CHRSET(code) /*nothing*/ 1588#define CSET_SWL 0 1589#define GetLineDblCS(ld) 0U 1590#define LineCharSet(screen, ld) 0U 1591#define LineMaxCol(screen, ld) screen->max_col 1592#define LineCursorX(screen, ld, col) CursorX(screen, col) 1593#define LineFontWidth(screen, ld) FontWidth(screen) 1594 1595#endif 1596 1597#if OPT_LUIT_PROG && !OPT_WIDE_CHARS 1598/* Luit requires the wide-chars configuration */ 1599#undef OPT_LUIT_PROG 1600#define OPT_LUIT_PROG 0 1601#endif 1602 1603/***====================================================================***/ 1604 1605#if OPT_EBCDIC 1606extern int E2A(int); 1607extern int A2E(int); 1608#else 1609#define E2A(a) (a) 1610#define A2E(a) (a) 1611#endif 1612 1613#define CONTROL(a) (A2E(E2A(a)&037)) 1614 1615/***====================================================================***/ 1616 1617#if OPT_TEK4014 1618#define TEK4014_ACTIVE(xw) ((xw)->misc.TekEmu) 1619#define TEK4014_SHOWN(xw) ((xw)->misc.Tshow) 1620#define CURRENT_EMU_VAL(tek,vt) (TEK4014_ACTIVE(term) ? tek : vt) 1621#define CURRENT_EMU() CURRENT_EMU_VAL((Widget)tekWidget, (Widget)term) 1622#else 1623#define TEK4014_ACTIVE(screen) 0 1624#define TEK4014_SHOWN(xw) 0 1625#define CURRENT_EMU_VAL(tek,vt) (vt) 1626#define CURRENT_EMU() ((Widget)term) 1627#endif 1628 1629/***====================================================================***/ 1630 1631#if OPT_TOOLBAR 1632#define SHELL_OF(widget) XtParent(XtParent(widget)) 1633#else 1634#define SHELL_OF(widget) XtParent(widget) 1635#endif 1636 1637/***====================================================================***/ 1638 1639#if OPT_VT52_MODE 1640#define if_OPT_VT52_MODE(screen, code) if(screen->vtXX_level == 0) code 1641#else 1642#define if_OPT_VT52_MODE(screen, code) /* nothing */ 1643#endif 1644 1645/***====================================================================***/ 1646 1647#if OPT_XMC_GLITCH 1648#define if_OPT_XMC_GLITCH(screen, code) if(screen->xmc_glitch) code 1649#define XMC_GLITCH 1 /* the character we'll show */ 1650#define XMC_FLAGS (INVERSE|UNDERLINE|BOLD|BLINK) 1651#else 1652#define if_OPT_XMC_GLITCH(screen, code) /* nothing */ 1653#endif 1654 1655/***====================================================================***/ 1656 1657typedef unsigned IFlags; /* at least 32 bits */ 1658 1659#if OPT_WIDE_ATTRS 1660typedef unsigned short IAttr; /* at least 16 bits */ 1661#else 1662typedef unsigned char IAttr; /* at least 8 bits */ 1663#endif 1664 1665/***====================================================================***/ 1666 1667#define LO_BYTE(ch) CharOf((ch) & 0xff) 1668#define HI_BYTE(ch) CharOf((ch) >> 8) 1669 1670#if OPT_WIDE_CHARS 1671#define if_OPT_WIDE_CHARS(screen, code) if(screen->wide_chars) code 1672#define if_WIDE_OR_NARROW(screen, wide, narrow) if(screen->wide_chars) wide else narrow 1673#define NARROW_ICHAR 0xffff 1674#if OPT_WIDER_ICHAR 1675#define WIDEST_ICHAR 0x1fffff 1676typedef unsigned IChar; /* for 8-21 bit characters */ 1677#else 1678#define WIDEST_ICHAR NARROW_ICHAR 1679typedef unsigned short IChar; /* for 8-16 bit characters */ 1680#endif 1681#else 1682#define if_OPT_WIDE_CHARS(screen, code) /* nothing */ 1683#define if_WIDE_OR_NARROW(screen, wide, narrow) narrow 1684typedef unsigned char IChar; /* for 8-bit characters */ 1685#endif 1686 1687/***====================================================================***/ 1688 1689#ifndef RES_OFFSET 1690#define RES_OFFSET(offset) XtOffsetOf(XtermWidgetRec, offset) 1691#endif 1692 1693#define RES_NAME(name) name 1694#define RES_CLASS(name) name 1695 1696#define Bres(name, class, offset, dftvalue) \ 1697 {RES_NAME(name), RES_CLASS(class), XtRBoolean, sizeof(Boolean), \ 1698 RES_OFFSET(offset), XtRImmediate, (XtPointer) dftvalue} 1699 1700#define Cres(name, class, offset, dftvalue) \ 1701 {RES_NAME(name), RES_CLASS(class), XtRPixel, sizeof(Pixel), \ 1702 RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)} 1703 1704#define Tres(name, class, offset, dftvalue) \ 1705 COLOR_RES2(name, class, screen.Tcolors[offset], dftvalue) \ 1706 1707#define Fres(name, class, offset, dftvalue) \ 1708 {RES_NAME(name), RES_CLASS(class), XtRFontStruct, sizeof(XFontStruct *), \ 1709 RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)} 1710 1711#define Ires(name, class, offset, dftvalue) \ 1712 {RES_NAME(name), RES_CLASS(class), XtRInt, sizeof(int), \ 1713 RES_OFFSET(offset), XtRImmediate, (XtPointer) dftvalue} 1714 1715#define Dres(name, class, offset, dftvalue) \ 1716 {RES_NAME(name), RES_CLASS(class), XtRFloat, sizeof(float), \ 1717 RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)} 1718 1719#define Sres(name, class, offset, dftvalue) \ 1720 {RES_NAME(name), RES_CLASS(class), XtRString, sizeof(char *), \ 1721 RES_OFFSET(offset), XtRString, DECONST(char,dftvalue)} 1722 1723#define Wres(name, class, offset, dftvalue) \ 1724 {RES_NAME(name), RES_CLASS(class), XtRWidget, sizeof(Widget), \ 1725 RES_OFFSET(offset), XtRWidget, (XtPointer) dftvalue} 1726 1727/***====================================================================***/ 1728 1729#define FRG_SIZE resource.minBufSize 1730#define BUF_SIZE resource.maxBufSize 1731 1732typedef struct { 1733 Char *next; 1734 Char *last; 1735 int update; /* HandleInterpret */ 1736#if OPT_WIDE_CHARS 1737 IChar utf_data; /* resulting character */ 1738 int utf_size; /* ...number of bytes decoded */ 1739 Char *write_buf; 1740 unsigned write_len; 1741#endif 1742 Char buffer[1]; 1743} PtyData; 1744 1745/***====================================================================***/ 1746 1747/* 1748 * Pixel (and its components) are declared as unsigned long, but even for RGB 1749 * we need no more than 32-bits. 1750 */ 1751typedef uint32_t MyPixel; 1752typedef int32_t MyColor; 1753 1754#if OPT_ISO_COLORS 1755#if OPT_DIRECT_COLOR 1756typedef struct { 1757 MyColor fg; 1758 MyColor bg; 1759} CellColor; 1760 1761#define isSameCColor(p,q) (!memcmp(&(p), &(q), sizeof(CellColor))) 1762 1763#elif OPT_256_COLORS || OPT_88_COLORS 1764 1765#define COLOR_BITS 8 1766typedef unsigned short CellColor; 1767 1768#else 1769 1770#define COLOR_BITS 4 1771typedef Char CellColor; 1772 1773#endif 1774#else 1775typedef unsigned CellColor; 1776#endif 1777 1778#define NO_COLOR ((unsigned)-1) 1779 1780#ifndef isSameCColor 1781#define isSameCColor(p,q) ((p) == (q)) 1782#endif 1783 1784#define BITS2MASK(b) ((1 << b) - 1) 1785 1786#define COLOR_MASK BITS2MASK(COLOR_BITS) 1787 1788#if OPT_DIRECT_COLOR 1789#define clrDirectFG(flags) UIntClr(flags, ATR_DIRECT_FG) 1790#define clrDirectBG(flags) UIntClr(flags, ATR_DIRECT_BG) 1791#define GetCellColorFG(data) ((data).fg) 1792#define GetCellColorBG(data) ((data).bg) 1793#define hasDirectFG(flags) ((flags) & ATR_DIRECT_FG) 1794#define hasDirectBG(flags) ((flags) & ATR_DIRECT_BG) 1795#define setDirectFG(flags,test) if (test) UIntSet(flags, ATR_DIRECT_FG); else UIntClr(flags, ATR_DIRECT_FG) 1796#define setDirectBG(flags,test) if (test) UIntSet(flags, ATR_DIRECT_BG); else UIntClr(flags, ATR_DIRECT_BG) 1797#elif OPT_ISO_COLORS 1798#define clrDirectFG(flags) /* nothing */ 1799#define clrDirectBG(flags) /* nothing */ 1800#define GetCellColorFG(data) ((data) & COLOR_MASK) 1801#define GetCellColorBG(data) (((data) >> COLOR_BITS) & COLOR_MASK) 1802#define hasDirectFG(flags) 0 1803#define hasDirectBG(flags) 0 1804#define setDirectFG(flags,test) (void)(test) 1805#define setDirectBG(flags,test) (void)(test) 1806#else 1807#define GetCellColorFG(data) 7 1808#define GetCellColorBG(data) 0 1809#endif 1810extern CellColor blank_cell_color; 1811 1812typedef Char RowData; /* wrap/blink, and DEC single-double chars */ 1813 1814#define LINEFLAG_BITS 4 1815#define LINEFLAG_MASK BITS2MASK(LINEFLAG_BITS) 1816 1817#define GetLineFlags(ld) ((ld)->bufHead & LINEFLAG_MASK) 1818 1819#if OPT_DEC_CHRSET 1820#define SetLineFlags(ld,xx) (ld)->bufHead = (RowData) ((ld->bufHead & (DBLCS_MASK << LINEFLAG_BITS)) | (xx & LINEFLAG_MASK)) 1821#else 1822#define SetLineFlags(ld,xx) (ld)->bufHead = (RowData) (xx & LINEFLAG_MASK) 1823#endif 1824 1825typedef IChar CharData; 1826 1827/* 1828 * This is the xterm line-data/scrollback structure. 1829 */ 1830typedef struct { 1831 Dimension lineSize; /* number of columns in this row */ 1832 RowData bufHead; /* flag for wrapped lines */ 1833#if OPT_WIDE_CHARS 1834 Char combSize; /* number of items in combData[] */ 1835#endif 1836 IAttr *attribs; /* video attributes */ 1837#if OPT_ISO_COLORS 1838 CellColor *color; /* foreground+background color numbers */ 1839#endif 1840 CharData *charData; /* cell's base character */ 1841 CharData *combData[1]; /* first enum past fixed-offsets */ 1842} LineData; 1843 1844typedef const LineData CLineData; 1845 1846/* 1847 * We use CellData in a few places, when copying a cell's data to a temporary 1848 * variable. 1849 */ 1850typedef struct { 1851 IAttr attribs; 1852#if OPT_WIDE_CHARS 1853 Char combSize; /* number of items in combData[] */ 1854#endif 1855#if OPT_ISO_COLORS 1856 CellColor color; /* color-array */ 1857#endif 1858 CharData charData; /* cell's base character */ 1859 CharData combData[1]; /* array of combining chars */ 1860} CellData; 1861 1862#define for_each_combData(off, ld) for (off = 0; off < ld->combSize; ++off) 1863 1864#define Clear1Cell(ld, x) \ 1865 do { \ 1866 ld->charData[x] = ' '; \ 1867 do { \ 1868 if_OPT_WIDE_CHARS(screen, { \ 1869 size_t z; \ 1870 for_each_combData(z, ld) { \ 1871 ld->combData[z][x] = '\0'; \ 1872 } \ 1873 }) } while (0); \ 1874 } while (0) 1875 1876#define Clear2Cell(dst, src, x) \ 1877 do { \ 1878 dst->charData[x] = ' '; \ 1879 dst->attribs[x] = src->attribs[x]; \ 1880 do { \ 1881 if_OPT_ISO_COLORS(screen, { \ 1882 dst->color[x] = src->color[x]; \ 1883 }) } while (0); \ 1884 do { \ 1885 if_OPT_WIDE_CHARS(screen, { \ 1886 size_t z; \ 1887 for_each_combData(z, dst) { \ 1888 dst->combData[z][x] = '\0'; \ 1889 } \ 1890 }) } while (0); \ 1891 } while (0) 1892 1893/* 1894 * Accommodate older compilers by not using variable-length arrays. 1895 */ 1896#define SizeOfLineData offsetof(LineData, combData) 1897#define SizeOfCellData offsetof(CellData, combData) 1898 1899 /* 1900 * A "row" is the index within the visible part of the screen, and an 1901 * "inx" is the index within the whole set of scrollable lines. 1902 */ 1903#define ROW2INX(screen, row) ((row) + (screen)->topline) 1904#define INX2ROW(screen, inx) ((inx) - (screen)->topline) 1905 1906/* these are unused but could be useful for debugging */ 1907#if 0 1908#define ROW2ABS(screen, row) ((row) + (screen)->savedlines) 1909#define INX2ABS(screen, inx) ROW2ABS(screen, INX2ROW(screen, inx)) 1910#endif 1911 1912#define okScrnRow(screen, row) \ 1913 ((row) <= ((screen)->max_row - (screen)->topline) \ 1914 && (row) >= -((screen)->savedlines)) 1915 1916 /* 1917 * Cache data for "proportional" and other fonts containing a mixture 1918 * of widths. 1919 */ 1920typedef struct { 1921 Bool mixed; 1922 Dimension min_width; /* nominal cell width for 0..255 */ 1923 Dimension max_width; /* maximum cell width */ 1924} FontMap; 1925 1926#define KNOWN_MISSING 256 1927 1928typedef enum { 1929 fwNever = 0, 1930 fwResource, 1931 fwAlways 1932} fontWarningTypes; 1933 1934typedef struct { 1935 unsigned chrset; 1936 unsigned flags; 1937 fontWarningTypes warn; 1938 XFontStruct * fs; 1939 char * fn; 1940 FontMap map; 1941 Char known_missing[KNOWN_MISSING]; 1942} XTermFonts; 1943 1944#if OPT_RENDERFONT 1945typedef enum { 1946 erFalse = 0 1947 , erTrue 1948 , erDefault 1949 , erDefaultOff 1950 , erLast 1951} RenderFont; 1952 1953#define DefaultRenderFont(xw) \ 1954 if ((xw)->work.render_font == erDefault) \ 1955 (xw)->work.render_font = erFalse 1956 1957typedef enum { 1958 xcEmpty = 0 /* slot is unused */ 1959 , xcBogus /* ignore this pattern */ 1960 , xcOpened /* slot has open font descriptor */ 1961 , xcUnused /* opened, but unused so far */ 1962} XftCache; 1963 1964typedef struct { 1965 XftFont * font; 1966 XftCache usage; 1967} XTermXftCache; 1968 1969typedef struct { 1970 XftFont * font; /* main font */ 1971 XftPattern * pattern; /* pattern for main font */ 1972 XftFontSet * fontset; /* ordered list of fallback patterns */ 1973 XTermXftCache * cache; 1974 unsigned limit; /* allocated size of cache[] */ 1975 unsigned opened; /* number of slots with xcOpened */ 1976 FontMap map; 1977} XTermXftFonts; 1978 1979typedef struct _ListXftFonts { 1980 struct _ListXftFonts *next; 1981 XftFont * font; 1982} ListXftFonts; 1983#endif 1984 1985typedef struct { 1986 int top; 1987 int left; 1988 int bottom; 1989 int right; 1990} XTermRect; 1991 1992/***====================================================================***/ 1993 1994 /* indices into save_modes[] */ 1995typedef enum { 1996 DP_ALLOW_ALTBUF, 1997 DP_ALTERNATE_SCROLL, 1998 DP_ALT_SENDS_ESC, 1999 DP_BELL_IS_URGENT, 2000 DP_CRS_VISIBLE, 2001 DP_DECANM, 2002 DP_DECARM, 2003 DP_DECAWM, 2004 DP_DECBKM, 2005 DP_DECCKM, 2006 DP_DECCOLM, /* IN132COLUMNS */ 2007 DP_DECKPAM, 2008 DP_DECNRCM, 2009 DP_DECOM, 2010 DP_DECPEX, 2011 DP_DECPFF, 2012 DP_DECSCLM, 2013 DP_DECSCNM, 2014 DP_DECTCEM, 2015 DP_DELETE_IS_DEL, 2016 DP_EIGHT_BIT_META, 2017 DP_KEEP_CLIPBOARD, 2018 DP_KEEP_SELECTION, 2019 DP_KEYBOARD_TYPE, 2020 DP_POP_ON_BELL, 2021 DP_PRN_EXTENT, 2022 DP_PRN_FORMFEED, 2023 DP_RXVT_SCROLLBAR, 2024 DP_RXVT_SCROLL_TTY_KEYPRESS, 2025 DP_RXVT_SCROLL_TTY_OUTPUT, 2026 DP_SELECT_TO_CLIPBOARD, 2027 DP_X_ALTBUF, 2028 DP_X_DECCOLM, 2029 DP_X_EXT_MOUSE, 2030 DP_X_LOGGING, 2031 DP_X_LRMM, 2032 DP_X_MARGIN, 2033 DP_X_MORE, 2034 DP_X_MOUSE, 2035 DP_X_NCSM, 2036 DP_X_REVWRAP, 2037 DP_X_X10MSE, 2038#if OPT_BLINK_CURS 2039 DP_CRS_BLINK, 2040#endif 2041#if OPT_FOCUS_EVENT 2042 DP_X_FOCUS, 2043#endif 2044#if OPT_NUM_LOCK 2045 DP_REAL_NUMLOCK, 2046 DP_META_SENDS_ESC, 2047#endif 2048#if OPT_SHIFT_FONTS 2049 DP_RXVT_FONTSIZE, 2050#endif 2051#if OPT_SIXEL_GRAPHICS 2052 DP_DECSDM, 2053#endif 2054#if OPT_TEK4014 2055 DP_DECTEK, 2056#endif 2057#if OPT_TOOLBAR 2058 DP_TOOLBAR, 2059#endif 2060#if OPT_GRAPHICS 2061 DP_X_PRIVATE_COLOR_REGISTERS, 2062#endif 2063#if OPT_SIXEL_GRAPHICS 2064 DP_SIXEL_SCROLLS_RIGHT, 2065#endif 2066#if OPT_PRINT_GRAPHICS 2067 DP_DECGEPM, /* Graphics Expanded Print Mode */ 2068 DP_DECGPCM, /* Graphics Print Color Mode */ 2069 DP_DECGPCS, /* Graphics Print Color Syntax */ 2070 DP_DECGPBM, /* Graphics Print Background Mode */ 2071 DP_DECGRPM, /* Graphics Rotated Print Mode */ 2072#endif 2073 DP_LAST 2074} SaveModes; 2075 2076#define DoSM(code,value) screen->save_modes[code] = (unsigned) (value) 2077#define DoRM(code,value) value = (Boolean) screen->save_modes[code] 2078#define DoRM0(code,value) value = screen->save_modes[code] 2079 2080 /* index into vt_shell[] or tek_shell[] */ 2081typedef enum { 2082 noMenu = -1 2083 ,mainMenu 2084 ,vtMenu 2085 ,fontMenu 2086#if OPT_TEK4014 2087 ,tekMenu 2088#endif 2089} MenuIndex; 2090 2091typedef enum { 2092 bvOff = -1, 2093 bvLow = 0, 2094 bvHigh 2095} BellVolume; 2096 2097#define NUM_POPUP_MENUS 4 2098 2099#if OPT_COLOR_RES 2100typedef struct { 2101 String resource; 2102 Pixel value; 2103 unsigned short red, green, blue; 2104 int mode; /* -1=invalid, 0=unset, 1=set */ 2105} ColorRes; 2106#else 2107#define ColorRes Pixel 2108#endif 2109 2110/* these are set in getPrinterFlags */ 2111typedef struct { 2112 int printer_extent; /* print complete page */ 2113 int printer_formfeed; /* print formfeed per function */ 2114 int printer_newline; /* print newline per function */ 2115 int print_attributes; /* 0=off, 1=normal, 2=color */ 2116 int print_everything; /* 0=all, 1=dft, 2=alt, 3=saved */ 2117} PrinterFlags; 2118 2119typedef struct { 2120 FILE * fp; /* output file/pipe used */ 2121 Boolean isOpen; /* output was opened/tried */ 2122 Boolean toFile; /* true when directly to file */ 2123 Boolean printer_checked; /* printer_command is checked */ 2124 String printer_command; /* pipe/shell command string */ 2125 Boolean printer_autoclose; /* close printer when offline */ 2126 Boolean printer_extent; /* print complete page */ 2127 Boolean printer_formfeed; /* print formfeed per function */ 2128 Boolean printer_newline; /* print newline per function */ 2129 int printer_controlmode; /* 0=off, 1=auto, 2=controller */ 2130 int print_attributes; /* 0=off, 1=normal, 2=color */ 2131 int print_everything; /* 0=all, 1=dft, 2=alt, 3=saved */ 2132} PrinterState; 2133 2134typedef struct { 2135 unsigned which; /* must have NCOLORS bits */ 2136 Pixel colors[NCOLORS]; 2137 char *names[NCOLORS]; 2138} ScrnColors; 2139 2140#define NUM_GSETS 4 2141 2142typedef struct { 2143 Boolean saved; 2144 int row; 2145 int col; 2146 IFlags flags; /* VTxxx saves graphics rendition */ 2147 Char curgl; 2148 Char curgr; 2149 DECNRCM_codes gsets[NUM_GSETS]; 2150 Boolean wrap_flag; 2151#if OPT_ISO_COLORS 2152 int cur_foreground; /* current foreground color */ 2153 int cur_background; /* current background color */ 2154 int sgr_foreground; /* current SGR foreground color */ 2155 int sgr_background; /* current SGR background color */ 2156 Boolean sgr_38_xcolors; /* true if ISO 8613 extension */ 2157#endif 2158} SavedCursor; 2159 2160typedef struct _SaveTitle { 2161 struct _SaveTitle *next; 2162 char *iconName; 2163 char *windowName; 2164} SaveTitle; 2165 2166#define SAVED_CURSORS 2 2167 2168typedef struct { 2169 int width; /* if > 0, width of scrollbar, */ 2170 /* and scrollbar is showing */ 2171 Boolean rv_cached; /* see ScrollBarReverseVideo */ 2172 int rv_active; /* ...current reverse-video */ 2173 Pixel bg; /* ...cached background color */ 2174 Pixel fg; /* ...cached foreground color */ 2175 Pixel bdr; /* ...cached border color */ 2176 Pixmap bdpix; /* ...cached border pixmap */ 2177} SbInfo; 2178 2179#if OPT_TOOLBAR 2180typedef struct { 2181 Widget menu_bar; /* toolbar, if initialized */ 2182 Dimension menu_height; /* ...and its height */ 2183 Dimension menu_border; /* ...and its border */ 2184} TbInfo; 2185#define VT100_TB_INFO(name) screen.fullVwin.tb_info.name 2186#endif 2187 2188typedef struct { 2189 Window window; /* X window id */ 2190 int width; /* width of columns in pixels */ 2191 int height; /* height of rows in pixels */ 2192 Dimension fullwidth; /* full width of window */ 2193 Dimension fullheight; /* full height of window */ 2194 int f_width; /* width of fonts in pixels */ 2195 int f_height; /* height of fonts in pixels */ 2196 int f_ascent; /* ascent of font in pixels */ 2197 int f_descent; /* descent of font in pixels */ 2198 SbInfo sb_info; 2199 GC filler_gc; /* filler's fg/bg */ 2200 GC border_gc; /* inner border's fg/bg */ 2201 GC marker_gc[2]; /* wrap-marks */ 2202#if USE_DOUBLE_BUFFER 2203 Drawable drawable; /* X drawable id */ 2204#endif 2205#if OPT_TOOLBAR 2206 Boolean active; /* true if toolbars are used */ 2207 TbInfo tb_info; /* toolbar information */ 2208#endif 2209} VTwin; 2210 2211typedef struct { 2212 Window window; /* X window id */ 2213 int width; /* width of columns */ 2214 int height; /* height of rows */ 2215 Dimension fullwidth; /* full width of window */ 2216 Dimension fullheight; /* full height of window */ 2217 double tekscale; /* scale factor Tek -> vs100 */ 2218} TKwin; 2219 2220typedef struct { 2221 char *f_n; /* the normal font */ 2222 char *f_b; /* the bold font */ 2223#if OPT_WIDE_CHARS 2224 char *f_w; /* the normal wide font */ 2225 char *f_wb; /* the bold wide font */ 2226#endif 2227} VTFontNames; 2228 2229typedef struct { 2230 char **list_n; /* the normal font */ 2231 char **list_b; /* the bold font */ 2232#if OPT_WIDE_ATTRS || OPT_RENDERWIDE 2233 char **list_i; /* italic font (Xft only) */ 2234 char **list_bi; /* bold-italic font (Xft only) */ 2235#endif 2236#if OPT_WIDE_CHARS 2237 char **list_w; /* the normal wide font */ 2238 char **list_wb; /* the bold wide font */ 2239 char **list_wi; /* wide italic font (Xft only) */ 2240 char **list_wbi; /* wide bold-italic font (Xft only) */ 2241#endif 2242} VTFontList; 2243 2244typedef struct { 2245 VTFontList x11; 2246#if OPT_RENDERFONT 2247 VTFontList xft; 2248#endif 2249} XtermFontNames; 2250 2251typedef struct { 2252 VTFontNames default_font; 2253 String menu_font_names[NMENUFONTS][fMAX]; 2254 XtermFontNames fonts; 2255} SubResourceRec; 2256 2257#if OPT_INPUT_METHOD 2258#define NINPUTWIDGETS 3 2259typedef struct { 2260 Widget w; 2261 XIM xim; /* input method attached to 'w' */ 2262 XIC xic; /* input context attached to 'xim' */ 2263} TInput; 2264#endif 2265 2266typedef enum { 2267 CURSOR_BLOCK = 2 2268 , CURSOR_UNDERLINE = 4 2269 , CURSOR_BAR = 6 2270} XtCursorShape; 2271 2272#define isCursorBlock(s) ((s)->cursor_shape == CURSOR_BLOCK) 2273#define isCursorUnderline(s) ((s)->cursor_shape == CURSOR_UNDERLINE) 2274#define isCursorBar(s) ((s)->cursor_shape == CURSOR_BAR) 2275 2276typedef enum { 2277 DEFAULT_STYLE = 0 2278 , BLINK_BLOCK 2279 , STEADY_BLOCK 2280 , BLINK_UNDERLINE 2281 , STEADY_UNDERLINE 2282 , BLINK_BAR 2283 , STEADY_BAR 2284} XtCursorStyle; 2285 2286#if OPT_GRAPHICS 2287#define GraphicsTermId(screen) (\ 2288 (screen)->graphics_termid \ 2289 ? (screen)->graphics_termid \ 2290 : (screen)->terminal_id) 2291#else 2292#define GraphicsTermId(screen) (screen)->terminal_id 2293#endif 2294 2295#if OPT_REGIS_GRAPHICS 2296#define optRegisGraphics(screen) \ 2297 (GraphicsTermId(screen) == 125 || \ 2298 GraphicsTermId(screen) == 240 || \ 2299 GraphicsTermId(screen) == 241 || \ 2300 GraphicsTermId(screen) == 330 || \ 2301 GraphicsTermId(screen) == 340) 2302#else 2303#define optRegisGraphics(screen) False 2304#endif 2305 2306#if OPT_SIXEL_GRAPHICS 2307#define optSixelGraphics(screen) \ 2308 (GraphicsTermId(screen) == 240 || \ 2309 GraphicsTermId(screen) == 241 || \ 2310 GraphicsTermId(screen) == 330 || \ 2311 GraphicsTermId(screen) == 340 || \ 2312 GraphicsTermId(screen) == 382) 2313#else 2314#define optSixelGraphics(screen) False 2315#endif 2316 2317#if OPT_PRINT_GRAPHICS 2318#define if_PRINT_GRAPHICS2(statement) if (optRegisGraphics(screen)) { statement; } else 2319#else 2320#define if_PRINT_GRAPHICS2(statement) /* nothing */ 2321#endif 2322 2323typedef struct { 2324/* These parameters apply to both windows */ 2325 Display *display; /* X display for screen */ 2326 int respond; /* socket for responses 2327 (position report, etc.) */ 2328 int nextEventDelay; /* msecs to delay for x-events */ 2329/* These parameters apply to VT100 window */ 2330 IChar *unparse_bfr; 2331 unsigned unparse_len; 2332 unsigned unparse_max; /* limitResponse resource */ 2333 2334#if OPT_TCAP_QUERY 2335 int tc_query_code; 2336 Bool tc_query_fkey; 2337#endif 2338 pid_t pid; /* pid of process on far side */ 2339 uid_t uid; /* user id of actual person */ 2340 gid_t gid; /* group id of actual person */ 2341 ColorRes Tcolors[NCOLORS]; /* terminal colors */ 2342#if OPT_HIGHLIGHT_COLOR 2343 Boolean hilite_color; /* hilite colors override */ 2344 Boolean hilite_reverse; /* hilite overrides reverse */ 2345#endif 2346#if OPT_ISO_COLORS 2347 XColor * cmap_data; /* color table */ 2348 unsigned cmap_size; 2349 ColorRes Acolors[MAXCOLORS]; /* ANSI color emulation */ 2350 int veryBoldColors; /* modifier for boldColors */ 2351 Boolean boldColors; /* can we make bold colors? */ 2352 Boolean colorMode; /* are we using color mode? */ 2353 Boolean colorULMode; /* use color for underline? */ 2354 Boolean italicULMode; /* italic font for underline? */ 2355 Boolean colorBDMode; /* use color for bold? */ 2356 Boolean colorBLMode; /* use color for blink? */ 2357 Boolean colorRVMode; /* use color for reverse? */ 2358 Boolean colorAttrMode; /* prefer colorUL/BD to SGR */ 2359#if OPT_WIDE_ATTRS 2360 Boolean colorITMode; /* use color for italics? */ 2361#endif 2362#if OPT_DIRECT_COLOR 2363 Boolean direct_color; /* direct-color enabled? */ 2364#endif 2365#endif /* OPT_ISO_COLORS */ 2366#if OPT_DEC_CHRSET 2367 Boolean font_doublesize;/* enable font-scaling */ 2368 int cache_doublesize;/* limit of our cache */ 2369 Char cur_chrset; /* character-set index & code */ 2370 int fonts_used; /* count items in double_fonts */ 2371 XTermFonts double_fonts[NUM_CHRSET]; 2372#if OPT_RENDERFONT 2373 XftFont * double_xft_fonts[NUM_CHRSET]; 2374#endif 2375#endif /* OPT_DEC_CHRSET */ 2376#if OPT_DEC_RECTOPS 2377 int cur_decsace; /* parameter for DECSACE */ 2378 int checksum_ext; /* extensions for DECRQCRA */ 2379 int checksum_ext0; /* initial checksumExtension */ 2380#endif 2381#if OPT_WIDE_CHARS 2382 Boolean wide_chars; /* true when 16-bit chars */ 2383 Boolean vt100_graphics; /* true to allow vt100-graphics */ 2384 Boolean utf8_inparse; /* true to enable UTF-8 parser */ 2385 Boolean normalized_c; /* true to precompose to Form C */ 2386 char * utf8_mode_s; /* use UTF-8 decode/encode */ 2387 char * utf8_fonts_s; /* use UTF-8 decode/encode */ 2388 char * utf8_title_s; /* use UTF-8 titles */ 2389 int utf8_nrc_mode; /* saved UTF-8 mode for DECNRCM */ 2390 Boolean utf8_always; /* special case for wideChars */ 2391 int utf8_mode; /* use UTF-8 decode/encode: 0-2 */ 2392 int utf8_fonts; /* use UTF-8 fonts: 0-2 */ 2393 int utf8_title; /* use UTF-8 EWHM props: 0-2 */ 2394 int max_combining; /* maximum # of combining chars */ 2395 Boolean utf8_latin1; /* use UTF-8 with Latin-1 bias */ 2396 Boolean utf8_weblike; /* use UTF-8 with browser bias */ 2397 int latin9_mode; /* poor man's luit, latin9 */ 2398 int unicode_font; /* font uses unicode encoding */ 2399 int utf_count; /* state of utf_char */ 2400 IChar utf_char; /* in-progress character */ 2401 Boolean char_was_written; 2402 int last_written_col; 2403 int last_written_row; 2404 TypedBuffer(XChar2b); 2405 TypedBuffer(char); 2406#endif 2407#if OPT_BROKEN_OSC 2408 Boolean brokenLinuxOSC; /* true to ignore Linux palette ctls */ 2409#endif 2410#if OPT_BROKEN_ST 2411 Boolean brokenStringTerm; /* true to match old OSC parse */ 2412#endif 2413#if OPT_C1_PRINT || OPT_WIDE_CHARS 2414 Boolean c1_printable; /* true if we treat C1 as print */ 2415#endif 2416 int border; /* inner border */ 2417 int scrollBarBorder; /* scrollBar border */ 2418 long event_mask; 2419 unsigned send_mouse_pos; /* user wants mouse transition */ 2420 /* and position information */ 2421 int extend_coords; /* support large terminals */ 2422#if OPT_FOCUS_EVENT 2423 Boolean send_focus_pos; /* user wants focus in/out info */ 2424#endif 2425 Boolean quiet_grab; /* true if no cursor change on focus */ 2426#if OPT_PASTE64 2427 Cardinal base64_paste; /* set to send paste in base64 */ 2428 int base64_final; /* string-terminator for paste */ 2429 /* _qWriteSelectionData expects these to be initialized to zero. 2430 * base64_flush() is the last step of the conversion, it clears these 2431 * variables. 2432 */ 2433 unsigned base64_accu; 2434 unsigned base64_count; 2435 unsigned base64_pad; 2436#endif 2437#if OPT_PASTE64 || OPT_READLINE 2438 unsigned paste_brackets; 2439 /* not part of bracketed-paste, these are here to simplify ifdefs */ 2440 unsigned dclick3_deletes; 2441 unsigned paste_literal_nl; 2442#endif 2443#if OPT_READLINE 2444 unsigned click1_moves; 2445 unsigned paste_moves; 2446 unsigned paste_quotes; 2447#endif /* OPT_READLINE */ 2448#if OPT_DEC_LOCATOR 2449 Boolean locator_reset; /* turn mouse off after 1 report? */ 2450 Boolean locator_pixels; /* report in pixels? */ 2451 /* if false, report in cells */ 2452 unsigned locator_events; /* what events to report */ 2453 Boolean loc_filter; /* is filter rectangle active? */ 2454 int loc_filter_top; /* filter rectangle for DEC Locator */ 2455 int loc_filter_left; 2456 int loc_filter_bottom; 2457 int loc_filter_right; 2458#endif /* OPT_DEC_LOCATOR */ 2459 int mouse_button; /* current button pressed */ 2460 int mouse_row; /* ...and its row */ 2461 int mouse_col; /* ...and its column */ 2462 int select; /* xterm selected */ 2463 Boolean bellOnReset; /* bellOnReset */ 2464 Boolean visualbell; /* visual bell mode */ 2465 Boolean poponbell; /* pop on bell mode */ 2466 2467 Boolean eraseSavedLines; /* eraseSavedLines option */ 2468 Boolean eraseSavedLines0; /* initial eraseSavedLines */ 2469 Boolean tabCancelsWrap; /* tabCancelsWrap option */ 2470 2471 Boolean allowPasteControls; /* PasteControls mode */ 2472 Boolean allowColorOps; /* ColorOps mode */ 2473 Boolean allowFontOps; /* FontOps mode */ 2474 Boolean allowMouseOps; /* MouseOps mode */ 2475 Boolean allowSendEvents;/* SendEvent mode */ 2476 Boolean allowTcapOps; /* TcapOps mode */ 2477 Boolean allowTitleOps; /* TitleOps mode */ 2478 Boolean allowWindowOps; /* WindowOps mode */ 2479 2480 Boolean allowPasteControl0; /* PasteControls mode */ 2481 Boolean allowColorOp0; /* initial ColorOps mode */ 2482 Boolean allowFontOp0; /* initial FontOps mode */ 2483 Boolean allowMouseOp0; /* initial MouseOps mode */ 2484 Boolean allowSendEvent0;/* initial SendEvent mode */ 2485 Boolean allowTcapOp0; /* initial TcapOps mode */ 2486 Boolean allowTitleOp0; /* initial TitleOps mode */ 2487 Boolean allowWindowOp0; /* initial WindowOps mode */ 2488 2489 String disallowedColorOps; 2490 char disallow_color_ops[ecLAST]; 2491 2492 String disallowedFontOps; 2493 char disallow_font_ops[efLAST]; 2494 2495 String disallowedMouseOps; 2496 char disallow_mouse_ops[emLAST]; 2497 2498 String disallowedPasteControls; 2499 char disallow_paste_controls[epLAST]; 2500 2501 String disallowedTcapOps; 2502 char disallow_tcap_ops[etLAST]; 2503 2504 String disallowedWinOps; 2505 char disallow_win_ops[ewLAST]; 2506 2507 Boolean awaitInput; /* select-timeout mode */ 2508 Boolean grabbedKbd; /* keyboard is grabbed */ 2509#ifdef ALLOWLOGGING 2510 int logging; /* logging mode */ 2511 int logfd; /* file descriptor of log */ 2512 char *logfile; /* log file name */ 2513 Char *logstart; /* current start of log buffer */ 2514#endif 2515 int inhibit; /* flags for inhibiting changes */ 2516 2517/* VT window parameters */ 2518 Boolean Vshow; /* VT window showing */ 2519 VTwin fullVwin; 2520 int needSwap; 2521#ifndef NO_ACTIVE_ICON 2522 VTwin iconVwin; 2523 VTwin *whichVwin; 2524#endif /* NO_ACTIVE_ICON */ 2525 2526 int pointer_mode; /* when to use hidden_cursor */ 2527 int pointer_mode0; /* ...initial value */ 2528 Boolean hide_pointer; /* true to use "hidden_cursor" */ 2529 String pointer_shape; /* name of shape in cursor font */ 2530 Cursor pointer_cursor; /* current pointer cursor */ 2531 Cursor hidden_cursor; /* hidden cursor in window */ 2532 2533 String answer_back; /* response to ENQ */ 2534 2535 PrinterState printer_state; /* actual printer state */ 2536 PrinterFlags printer_flags; /* working copy of printer flags */ 2537#if OPT_PRINT_ON_EXIT 2538 Boolean write_error; 2539#endif 2540 2541 Boolean fnt_prop; /* true if proportional fonts */ 2542 unsigned fnt_boxes; /* 0=no boxes, 1=old, 2=unicode */ 2543 Boolean force_packed; /* true to override proportional */ 2544#if OPT_BOX_CHARS 2545 Boolean force_box_chars;/* true if we assume no boxchars */ 2546 Boolean broken_box_chars;/* true if broken boxchars */ 2547 Boolean force_all_chars;/* true to outline missing chars */ 2548 Boolean assume_all_chars;/* true to allow missing chars */ 2549 Boolean allow_packing; /* true to allow packed-fonts */ 2550#endif 2551 Dimension fnt_wide; 2552 Dimension fnt_high; 2553 float scale_height; /* scaling for font-height */ 2554 XTermFonts fnts[fMAX]; /* normal/bold/etc for terminal */ 2555 Boolean free_bold_box; /* same_font_size's austerity */ 2556 Boolean allowBoldFonts; /* do we use bold fonts at all? */ 2557#if OPT_WIDE_ATTRS 2558 XTermFonts ifnts[fMAX]; /* normal/bold/etc italic fonts */ 2559 Boolean ifnts_ok; /* true if ifnts[] is cached */ 2560#endif 2561#ifndef NO_ACTIVE_ICON 2562 XTermFonts fnt_icon; /* icon font */ 2563 String icon_fontname; /* name of icon font */ 2564 int icon_fontnum; /* number to use for icon font */ 2565#endif /* NO_ACTIVE_ICON */ 2566 int enbolden; /* overstrike for bold font */ 2567 XPoint *box; /* draw unselected cursor */ 2568 2569 int cursor_state; /* ON, OFF, or BLINKED_OFF */ 2570 int cursor_busy; /* do not redraw... */ 2571 Boolean cursor_underline; /* true if cursor is in underline mode */ 2572 XtCursorShape cursor_shape; 2573#if OPT_BLINK_CURS 2574 BlinkOps cursor_blink; /* cursor blink enable */ 2575 BlinkOps cursor_blink_i; /* save cursor blink enable */ 2576 char * cursor_blink_s; /* ...resource cursorBlink */ 2577 int cursor_blink_esc; /* cursor blink escape-state */ 2578 Boolean cursor_blink_xor; /* how to merge menu/escapes */ 2579#endif 2580#if OPT_BLINK_TEXT 2581 Boolean blink_as_bold; /* text blink disable */ 2582#endif 2583#if OPT_BLINK_CURS || OPT_BLINK_TEXT 2584 int blink_state; /* ON, OFF, or BLINKED_OFF */ 2585 int blink_on; /* cursor on time (msecs) */ 2586 int blink_off; /* cursor off time (msecs) */ 2587 XtIntervalId blink_timer; /* timer-id for cursor-proc */ 2588#endif 2589#if OPT_ZICONBEEP 2590 Boolean zIconBeep_flagged; /* True if icon name was changed */ 2591#endif /* OPT_ZICONBEEP */ 2592 int cursor_GC; /* see ShowCursor() */ 2593 int cursor_set; /* requested state */ 2594 CELL cursorp; /* previous cursor row/column */ 2595 int cur_col; /* current cursor column */ 2596 int cur_row; /* current cursor row */ 2597 int max_col; /* rightmost column */ 2598 int max_row; /* bottom row */ 2599 int top_marg; /* top line of scrolling region */ 2600 int bot_marg; /* bottom line of " " */ 2601 int lft_marg; /* left column of " " */ 2602 int rgt_marg; /* right column of " " */ 2603 Widget scrollWidget; /* pointer to scrollbar struct */ 2604#if USE_DOUBLE_BUFFER 2605 int buffered_sb; /* nonzero when pending update */ 2606 struct timeval buffered_at; /* reference time, for FPS */ 2607#define DbeMsecs(xw) (1000L / (long) resource.buffered_fps) 2608#endif 2609 /* 2610 * Indices used to keep track of the top of the vt100 window and 2611 * the saved lines, taking scrolling into account. 2612 */ 2613 int topline; /* line number of top, <= 0 */ 2614 long saved_fifo; /* number of lines that've ever been saved */ 2615 int savedlines; /* number of lines that've been saved */ 2616 int savelines; /* number of lines off top to save */ 2617 int scroll_amt; /* amount to scroll */ 2618 int refresh_amt; /* amount to refresh */ 2619 /* 2620 * Working variables for getLineData(). 2621 */ 2622 size_t lineExtra; /* extra space for combining chars */ 2623 size_t cellExtra; /* extra space for combining chars */ 2624 /* 2625 * Pointer to the current visible buffer. 2626 */ 2627 ScrnBuf visbuf; /* ptr to visible screen buf (main) */ 2628 /* 2629 * Data for the normal buffer, which may have saved lines to which 2630 * the user can scroll. 2631 */ 2632 ScrnBuf saveBuf_index; 2633 Char *saveBuf_data; 2634 /* 2635 * Data for visible and alternate buffer. 2636 */ 2637 ScrnBuf editBuf_index[2]; 2638 Char *editBuf_data[2]; 2639 int whichBuf; /* 0/1 for normal/alternate buf */ 2640 Boolean is_running; /* true when buffers are legal */ 2641 /* 2642 * Workspace used for screen operations. 2643 */ 2644 Char **save_ptr; /* workspace for save-pointers */ 2645 size_t save_len; /* ...and its length */ 2646 2647 int scrolllines; /* number of lines to button scroll */ 2648 Boolean alternateScroll; /* scroll-actions become keys */ 2649 Boolean scrollttyoutput; /* scroll to bottom on tty output */ 2650 Boolean scrollkey; /* scroll to bottom on key */ 2651 Boolean cursor_moved; /* scrolling makes cursor move */ 2652 2653 Boolean do_wrap; /* true if cursor in last column 2654 and character just output */ 2655 2656 int incopy; /* 0 idle; 1 XCopyArea issued; 2657 -1 first GraphicsExpose seen, 2658 but last not seen */ 2659 int copy_src_x; /* params from last XCopyArea ... */ 2660 int copy_src_y; 2661 unsigned int copy_width; 2662 unsigned int copy_height; 2663 int copy_dest_x; 2664 int copy_dest_y; 2665 2666 Dimension embed_wide; 2667 Dimension embed_high; 2668 2669 Boolean c132; /* allow change to 132 columns */ 2670 Boolean curses; /* kludge line wrap for more */ 2671 Boolean hp_ll_bc; /* kludge HP-style ll for xdb */ 2672 Boolean marginbell; /* true if margin bell on */ 2673 int nmarginbell; /* columns from right margin */ 2674 int bellArmed; /* cursor below bell margin */ 2675 BellVolume marginVolume; /* margin-bell volume */ 2676 BellVolume warningVolume; /* warning-bell volume */ 2677 Boolean multiscroll; /* true if multi-scroll */ 2678 int scrolls; /* outstanding scroll count, 2679 used only with multiscroll */ 2680 SavedCursor sc[SAVED_CURSORS]; /* data for restore cursor */ 2681 IFlags save_modes[DP_LAST]; /* save dec/xterm private modes */ 2682 2683 int title_modes; /* control set/get of titles */ 2684 int title_modes0; /* ...initial value */ 2685 SaveTitle *save_title; 2686 2687 /* Improved VT100 emulation stuff. */ 2688 String keyboard_dialect; /* default keyboard dialect */ 2689 DECNRCM_codes gsets[NUM_GSETS]; /* G0 through G3. */ 2690 Char curgl; /* Current GL setting. */ 2691 Char curgr; /* Current GR setting. */ 2692 Char curss; /* Current single shift. */ 2693 String term_id; /* resource for terminal_id */ 2694 int terminal_id; /* 100=vt100, 220=vt220, etc. */ 2695 int vtXX_level; /* 0=vt52, 1,2,3 = vt100 ... vt320 */ 2696 int ansi_level; /* dpANSI levels 1,2,3 */ 2697 int protected_mode; /* 0=off, 1=DEC, 2=ISO */ 2698 Boolean always_bold_mode; /* compare normal/bold font */ 2699 Boolean always_highlight; /* whether to highlight cursor */ 2700 Boolean bold_mode; /* use bold font or overstrike */ 2701 Boolean delete_is_del; /* true for compatible Delete key */ 2702 Boolean jumpscroll; /* whether we should jumpscroll */ 2703 Boolean fastscroll; /* whether we should fastscroll */ 2704 Boolean old_fkeys; /* true for compatible fkeys */ 2705 Boolean old_fkeys0; /* ...initial value */ 2706 Boolean underline; /* whether to underline text */ 2707 2708#if OPT_MAXIMIZE 2709 Boolean restore_data; 2710 int restore_x; 2711 int restore_y; 2712 unsigned restore_width; 2713 unsigned restore_height; 2714#endif 2715 2716#if OPT_REGIS_GRAPHICS 2717 String graphics_regis_default_font; /* font for "builtin" */ 2718 2719 String graphics_regis_screensize; /* given a size in pixels */ 2720 Dimension graphics_regis_def_wide; /* ...corresponding width */ 2721 Dimension graphics_regis_def_high; /* ...and height */ 2722#endif 2723 2724#if OPT_GRAPHICS 2725 String graph_termid; /* resource for graphics_termid */ 2726 int graphics_termid; /* based on terminal_id */ 2727 String graphics_max_size; /* given a size in pixels */ 2728 Dimension graphics_max_wide; /* ...corresponding width */ 2729 Dimension graphics_max_high; /* ...and height */ 2730#endif 2731 2732#if OPT_SCROLL_LOCK 2733 Boolean allowScrollLock;/* ScrollLock mode */ 2734 Boolean allowScrollLock0;/* initial ScrollLock mode */ 2735 Boolean autoScrollLock; /* Auto ScrollLock mode */ 2736 Boolean scroll_lock; /* true to keep buffer in view */ 2737 Boolean scroll_dirty; /* scrolling makes screen dirty */ 2738#endif 2739 2740#if OPT_SIXEL_GRAPHICS 2741 Boolean sixel_scrolling; /* sixel scrolling */ 2742 Boolean sixel_scrolls_right; /* sixel scrolling moves cursor to right */ 2743#endif 2744 2745#if OPT_GRAPHICS 2746 int numcolorregisters; /* number of supported color registers */ 2747 Boolean privatecolorregisters; /* private color registers for each graphic */ 2748#endif 2749 2750 /* Graphics Printing */ 2751#if OPT_PRINT_GRAPHICS 2752 Boolean graphics_print_to_host; 2753 Boolean graphics_expanded_print_mode; 2754 Boolean graphics_print_color_mode; 2755 Boolean graphics_print_color_syntax; 2756 Boolean graphics_print_background_mode; 2757 Boolean graphics_rotated_print_mode; 2758#endif 2759 2760#if OPT_VT52_MODE 2761 IFlags vt52_save_flags; 2762 Char vt52_save_curgl; 2763 Char vt52_save_curgr; 2764 Char vt52_save_curss; 2765 DECNRCM_codes vt52_save_gsets[NUM_GSETS]; 2766#endif 2767 /* Testing */ 2768#if OPT_XMC_GLITCH 2769 unsigned xmc_glitch; /* # of spaces to pad on SGR's */ 2770 IAttr xmc_attributes; /* attrs that make a glitch */ 2771 Boolean xmc_inline; /* SGR's propagate only to eol */ 2772 Boolean move_sgr_ok; /* SGR is reset on move */ 2773#endif 2774 2775 /* 2776 * Bell 2777 */ 2778 int visualBellDelay; /* msecs to delay for visibleBell */ 2779 int bellSuppressTime; /* msecs after Bell before another allowed */ 2780 Boolean bellInProgress; /* still ringing/flashing prev bell? */ 2781 Boolean bellIsUrgent; /* set XUrgency WM hint on bell */ 2782 Boolean flash_line; /* show visualBell as current line */ 2783 /* 2784 * Select/paste state. 2785 */ 2786 Boolean selectToClipboard; /* primary vs clipboard */ 2787 String *mappedSelect; /* mapping for "SELECT" to "PRIMARY" */ 2788 2789 Boolean waitingForTrackInfo; 2790 int numberOfClicks; 2791 int maxClicks; 2792 int multiClickTime; /* time between multiclick selects */ 2793 SelectUnit selectUnit; 2794 SelectUnit selectMap[NSELECTUNITS]; 2795 String onClick[NSELECTUNITS + 1]; 2796 2797 char *charClass; /* for overriding word selection */ 2798 Boolean cutNewline; /* whether or not line cut has \n */ 2799 Boolean cutToBeginningOfLine; /* line cuts to BOL? */ 2800 Boolean highlight_selection; /* controls appearance of selection */ 2801 Boolean show_wrap_marks; /* show lines which are wrapped */ 2802 Boolean trim_selection; /* controls trimming of selection */ 2803 Boolean i18nSelections; 2804 Boolean brokenSelections; 2805 Boolean keepClipboard; /* retain data sent to clipboard */ 2806 Boolean keepSelection; /* do not lose selection on output */ 2807 Boolean replyToEmacs; /* Send emacs escape code when done selecting or extending? */ 2808 2809 SelectedCells clipboard_data; /* what we sent to the clipboard */ 2810 2811 EventMode eventMode; 2812 Time selection_time; /* latest event timestamp */ 2813 Time lastButtonUpTime; 2814 unsigned lastButton; 2815 2816#define MAX_CUT_BUFFER 8 /* CUT_BUFFER0 to CUT_BUFFER7 */ 2817#define MAX_SELECTIONS (MAX_SELECTION_CODES + MAX_CUT_BUFFER) 2818 SelectedCells selected_cells[MAX_SELECTIONS]; 2819 2820 CELL rawPos; /* raw position for selection start */ 2821 CELL startRaw; /* area before selectUnit processing */ 2822 CELL endRaw; /* " " */ 2823 CELL startSel; /* area after selectUnit processing */ 2824 CELL endSel; /* " " */ 2825 CELL startH; /* start highlighted text */ 2826 CELL endH; /* end highlighted text */ 2827 CELL saveStartW; /* saved WORD state, for LINE */ 2828 CELL startExt; /* Start, end of extension */ 2829 CELL endExt; /* " " */ 2830 CELL saveStartR; /* Saved values of raw selection for extend to restore to */ 2831 CELL saveEndR; /* " " */ 2832 int startHCoord, endHCoord; 2833 int firstValidRow; /* Valid rows for selection clipping */ 2834 int lastValidRow; /* " " */ 2835 2836 Boolean selectToBuffer; /* copy selection to buffer */ 2837 InternalSelect internal_select; 2838 2839 String default_string; 2840 String eightbit_select_types; 2841 Atom* selection_targets_8bit; 2842#if OPT_WIDE_CHARS 2843 String utf8_select_types; 2844 Atom* selection_targets_utf8; 2845#endif 2846 Atom* selection_atoms; /* which selections we own */ 2847 Cardinal sel_atoms_size; /* how many atoms allocated */ 2848 Cardinal selection_count; /* how many atoms in use */ 2849#if OPT_SELECT_REGEX 2850 char * selectExpr[NSELECTUNITS]; 2851#endif 2852 /* 2853 * Input/output state. 2854 */ 2855 Boolean input_eight_bits; /* do not send ESC when meta pressed */ 2856 int eight_bit_meta; /* use 8th bit when meta pressed */ 2857 char * eight_bit_meta_s; /* ...resource eightBitMeta */ 2858 Boolean output_eight_bits; /* honor all bits or strip */ 2859 Boolean control_eight_bits; /* send CSI as 8-bits */ 2860 Boolean backarrow_key; /* backspace/delete */ 2861 Boolean alt_is_not_meta; /* use both Alt- and Meta-key */ 2862 Boolean alt_sends_esc; /* Alt-key sends ESC prefix */ 2863 Boolean meta_sends_esc; /* Meta-key sends ESC prefix */ 2864 /* 2865 * Fonts 2866 */ 2867 Pixmap menu_item_bitmap; /* mask for checking items */ 2868 String initial_font; 2869 char * menu_font_names[NMENUFONTS][fMAX]; 2870#define MenuFontName(n) menu_font_names[n][fNorm] 2871#define EscapeFontName() MenuFontName(fontMenu_fontescape) 2872#define SelectFontName() MenuFontName(fontMenu_fontsel) 2873 long menu_font_sizes[NMENUFONTS]; 2874 int menu_font_number; 2875#if OPT_LOAD_VTFONTS || OPT_WIDE_CHARS 2876 Boolean savedVTFonts; 2877 Boolean mergedVTFonts; 2878 SubResourceRec cacheVTFonts; 2879#endif 2880#if OPT_CLIP_BOLD 2881 Boolean use_border_clipping; 2882 Boolean use_clipping; 2883#endif 2884 void * main_cgs_cache; 2885#ifndef NO_ACTIVE_ICON 2886 void * icon_cgs_cache; 2887#endif 2888#if OPT_RENDERFONT 2889 Boolean force_xft_height; 2890 ListXftFonts *list_xft_fonts; 2891 XTermXftFonts renderFontNorm[NMENUFONTS]; 2892 XTermXftFonts renderFontBold[NMENUFONTS]; 2893 XTermXftFonts renderFontItal[NMENUFONTS]; 2894 XTermXftFonts renderFontBtal[NMENUFONTS]; 2895#if OPT_RENDERWIDE 2896 XTermXftFonts renderWideNorm[NMENUFONTS]; 2897 XTermXftFonts renderWideBold[NMENUFONTS]; 2898 XTermXftFonts renderWideItal[NMENUFONTS]; 2899 XTermXftFonts renderWideBtal[NMENUFONTS]; 2900 TypedBuffer(XftCharSpec); 2901#else 2902 TypedBuffer(XftChar8); 2903#endif 2904 XftDraw * renderDraw; 2905#endif 2906#if OPT_DABBREV 2907 Boolean dabbrev_working; /* nonzero during dabbrev process */ 2908 unsigned char dabbrev_erase_char; /* used for deleting inserted completion */ 2909#endif 2910 char tcapbuf[TERMCAP_SIZE]; 2911 char tcap_area[TERMCAP_SIZE]; 2912#if OPT_TCAP_FKEYS 2913 char ** tcap_fkeys; 2914#endif 2915 String cursor_font_name; /* alternate cursor font */ 2916} TScreen; 2917 2918typedef XTermFonts *(*MyGetFont) (TScreen *, int); 2919 2920typedef struct _TekPart { 2921 XFontStruct * Tfont[TEKNUMFONTS]; 2922 int tobaseline[TEKNUMFONTS]; /* top-baseline, each font */ 2923 char * initial_font; /* large, 2, 3, small */ 2924 char * gin_terminator_str; /* ginTerminator resource */ 2925#if OPT_TOOLBAR 2926 TbInfo tb_info; /* toolbar information */ 2927#endif 2928} TekPart; 2929 2930/* Tektronix window parameters */ 2931typedef struct _TekScreen { 2932 GC TnormalGC; /* normal painting */ 2933 GC TcursorGC; /* normal cursor painting */ 2934 2935 Boolean waitrefresh; /* postpone refresh */ 2936 TKwin fullTwin; 2937#ifndef NO_ACTIVE_ICON 2938 TKwin iconTwin; 2939 TKwin *whichTwin; 2940#endif /* NO_ACTIVE_ICON */ 2941 2942 Cursor arrow; /* arrow cursor */ 2943 GC linepat[TEKNUMLINES]; /* line patterns */ 2944 int cur_X; /* current x */ 2945 int cur_Y; /* current y */ 2946 Tmodes cur; /* current tek modes */ 2947 Tmodes page; /* starting tek modes on page */ 2948 int margin; /* 0 -> margin 1, 1 -> margin 2 */ 2949 int pen; /* current Tektronix pen 0=up, 1=dn */ 2950 char *TekGIN; /* nonzero if Tektronix GIN mode*/ 2951 int gin_terminator; /* Tek strap option */ 2952 char tcapbuf[TERMCAP_SIZE]; 2953} TekScreen; 2954 2955#if OPT_PASTE64 || OPT_READLINE 2956#define SCREEN_FLAG(screenp,f) (1&(screenp)->f) 2957#define SCREEN_FLAG_set(screenp,f) ((screenp)->f |= 1) 2958#define SCREEN_FLAG_unset(screenp,f) ((screenp)->f &= (unsigned) ~1L) 2959#define SCREEN_FLAG_save(screenp,f) \ 2960 ((screenp)->f = (((screenp)->f)<<1) | SCREEN_FLAG(screenp,f)) 2961#define SCREEN_FLAG_restore(screenp,f) ((screenp)->f = (((screenp)->f)>>1)) 2962#else 2963#define SCREEN_FLAG(screenp,f) (0) 2964#endif 2965 2966/* 2967 * After screen-updates, reset the flag that tells us we should do wrapping. 2968 * Likewise, reset (in wide-character mode) the flag that tells us where the 2969 * "previous" character was written. 2970 */ 2971#if OPT_WIDE_CHARS 2972#define ResetWrap(screen) \ 2973 (screen)->do_wrap = \ 2974 (screen)->char_was_written = False 2975#else 2976#define ResetWrap(screen) \ 2977 (screen)->do_wrap = False 2978#endif 2979 2980/* meaning of bits in screen.select flag */ 2981#define INWINDOW 01 /* the mouse is in one of the windows */ 2982#define FOCUS 02 /* one of the windows is the focus window */ 2983 2984#define MULTICLICKTIME 250 /* milliseconds */ 2985 2986typedef struct { 2987 const char *name; 2988 int code; 2989} FlagList; 2990 2991typedef enum { 2992 keyboardIsLegacy, /* bogus vt220 codes for F1-F4, etc. */ 2993 keyboardIsDefault, 2994 keyboardIsHP, 2995 keyboardIsSCO, 2996 keyboardIsSun, 2997 keyboardIsTermcap, 2998 keyboardIsVT220 2999} xtermKeyboardType; 3000 3001typedef enum { /* legal values for screen.pointer_mode */ 3002 pNever = 0 3003 , pNoMouse = 1 3004 , pAlways = 2 3005 , pFocused = 3 3006} pointerModeTypes; 3007 3008typedef enum { /* legal values for screen.utf8_mode */ 3009 uFalse = 0 3010 , uTrue = 1 3011 , uAlways = 2 3012 , uDefault = 3 3013 , uLast 3014} utf8ModeTypes; 3015 3016typedef enum { /* legal values for screen.eight_bit_meta */ 3017 ebFalse = 0 3018 , ebTrue = 1 3019 , ebNever = 2 3020 , ebLocale = 3 3021 , ebLast 3022} ebMetaModeTypes; 3023 3024#define NAME_OLD_KT " legacy" 3025 3026#if OPT_HP_FUNC_KEYS 3027#define NAME_HP_KT " hp" 3028#else 3029#define NAME_HP_KT /*nothing*/ 3030#endif 3031 3032#if OPT_SCO_FUNC_KEYS 3033#define NAME_SCO_KT " sco" 3034#else 3035#define NAME_SCO_KT /*nothing*/ 3036#endif 3037 3038#if OPT_SUN_FUNC_KEYS 3039#define NAME_SUN_KT " sun" 3040#else 3041#define NAME_SUN_KT /*nothing*/ 3042#endif 3043 3044#if OPT_SUNPC_KBD 3045#define NAME_VT220_KT " vt220" 3046#else 3047#define NAME_VT220_KT /*nothing*/ 3048#endif 3049 3050#if OPT_TCAP_FKEYS 3051#define NAME_TCAP_KT " tcap" 3052#else 3053#define NAME_TCAP_KT /*nothing*/ 3054#endif 3055 3056#define KEYBOARD_TYPES NAME_TCAP_KT NAME_HP_KT NAME_SCO_KT NAME_SUN_KT NAME_VT220_KT 3057 3058#if OPT_TRACE 3059#define TRACE_RC(code,func) code = func 3060#else 3061#define TRACE_RC(code,func) func 3062#endif 3063 3064extern const char * visibleKeyboardType(xtermKeyboardType); 3065 3066typedef struct 3067{ 3068 int allow_keys; /* how to handle legacy/vt220 keyboard */ 3069 int cursor_keys; /* how to handle cursor-key modifiers */ 3070 int function_keys; /* how to handle function-key modifiers */ 3071 int keypad_keys; /* how to handle keypad key-modifiers */ 3072 int other_keys; /* how to handle other key-modifiers */ 3073 int string_keys; /* how to handle string() modifiers */ 3074} TModify; 3075 3076typedef struct 3077{ 3078 xtermKeyboardType type; 3079 IFlags flags; 3080 char *shell_translations; /* shell's translations, for input check */ 3081 char *xterm_translations; /* xterm's translations, for input check */ 3082 char *extra_translations; 3083 char *print_translations; /* printable translations for buttons */ 3084 unsigned shift_buttons; /* special shift-modifier for mouse-buttons */ 3085 int shift_escape; /* working value of shiftEscape */ 3086 char * shift_escape_s; /* resource for shiftEscape */ 3087#if OPT_INITIAL_ERASE 3088 int reset_DECBKM; /* reset should set DECBKM */ 3089#endif 3090#if OPT_MOD_FKEYS 3091 TModify modify_now; /* current modifier value */ 3092 TModify modify_1st; /* original modifier value, for resets */ 3093 int format_keys; /* format of modifyOtherKeys */ 3094#endif 3095} TKeyboard; 3096 3097#define GravityIsNorthWest(w) ((w)->misc.resizeGravity == NorthWestGravity) 3098#define GravityIsSouthWest(w) ((w)->misc.resizeGravity == SouthWestGravity) 3099 3100typedef struct _Misc { 3101 VTFontNames default_font; 3102 char *geo_metry; 3103 char *T_geometry; 3104#if OPT_WIDE_CHARS 3105 Boolean cjk_width; /* true for built-in CJK wcwidth() */ 3106 Boolean mk_width; /* true for simpler built-in wcwidth() */ 3107 int mk_samplesize; 3108 int mk_samplepass; 3109#endif 3110#if OPT_LUIT_PROG 3111 Boolean callfilter; /* true to invoke luit */ 3112 Boolean use_encoding; /* true to use -encoding option for luit */ 3113 char *locale_str; /* "locale" resource */ 3114 char *localefilter; /* path for luit */ 3115#endif 3116 fontWarningTypes fontWarnings; 3117 int limit_resize; 3118#ifdef ALLOWLOGGING 3119 Boolean log_on; 3120#endif 3121 Boolean color_inner_border; 3122 Boolean login_shell; 3123 Boolean re_verse; 3124 Boolean re_verse0; /* initial value of "-rv" */ 3125 Boolean resizeByPixel; 3126 XtGravity resizeGravity; 3127 Boolean reverseWrap; 3128 Boolean autoWrap; 3129 Boolean logInhibit; 3130 Boolean signalInhibit; 3131#if OPT_TEK4014 3132 Boolean tekInhibit; 3133 Boolean tekSmall; /* start tek window in small size */ 3134 Boolean TekEmu; /* true if Tektronix emulation */ 3135 Boolean Tshow; /* Tek window showing */ 3136#endif 3137 Boolean scrollbar; 3138#ifdef SCROLLBAR_RIGHT 3139 Boolean useRight; 3140#endif 3141 Boolean titeInhibit; 3142 Boolean tiXtraScroll; /* scroll on ti/te */ 3143 Boolean cdXtraScroll; /* scroll on cd (clear-display) */ 3144 Boolean appcursorDefault; 3145 Boolean appkeypadDefault; 3146#if OPT_INPUT_METHOD 3147 char* f_x; /* font for XIM */ 3148 char* input_method; 3149 char* preedit_type; 3150 Boolean open_im; /* true if input-method is opened */ 3151 int retry_im; 3152#endif 3153 Boolean dynamicColors; 3154#ifndef NO_ACTIVE_ICON 3155 char *active_icon_s; /* use application icon window */ 3156 unsigned icon_border_width; 3157 Pixel icon_border_pixel; 3158#endif /* NO_ACTIVE_ICON */ 3159#if OPT_DEC_SOFTFONT 3160 Boolean font_loadable; 3161#endif 3162#if OPT_SHIFT_FONTS 3163 Boolean shift_fonts; /* true if we interpret fontsize-shifting */ 3164#endif 3165#if OPT_SUNPC_KBD 3166 int ctrl_fkeys; /* amount to add to XK_F1 for ctrl modifier */ 3167#endif 3168#if OPT_NUM_LOCK 3169 Boolean real_NumLock; /* true if we treat NumLock key specially */ 3170 Boolean alwaysUseMods; /* true if we always want f-key modifiers */ 3171#endif 3172#if OPT_RENDERFONT 3173 VTFontNames default_xft; 3174 float face_size[NMENUFONTS]; 3175 char *render_font_s; 3176 int limit_fontsets; 3177#endif 3178} Misc; 3179 3180typedef struct _Work { 3181 int dummy; 3182#ifdef SunXK_F36 3183#define MAX_UDK 37 3184#else 3185#define MAX_UDK 35 3186#endif 3187 struct { 3188 char *str; 3189 int len; 3190 } user_keys[MAX_UDK]; 3191#define MAX_POINTER (XC_num_glyphs/2) 3192 Cursor pointer_cursors[MAX_POINTER]; /* saved cursors */ 3193#ifndef NO_ACTIVE_ICON 3194 int active_icon; /* use application icon window */ 3195 char *wm_name; 3196#endif /* NO_ACTIVE_ICON */ 3197#if OPT_INPUT_METHOD 3198 Boolean cannot_im; /* true if we cannot use input-method */ 3199 XFontSet xim_fs; /* fontset for XIM preedit */ 3200 int xim_fs_ascent; /* ascent of fs */ 3201 TInput inputs[NINPUTWIDGETS]; 3202#endif 3203 Boolean doing_resize; /* currently in RequestResize */ 3204#if OPT_MAXIMIZE 3205#define MAX_EWMH_MODE 3 3206#define MAX_EWMH_DATA (1 + OPT_TEK4014) 3207 struct { 3208 int mode; /* fullscreen, etc. */ 3209 Boolean checked[MAX_EWMH_MODE + 1]; 3210 Boolean allowed[MAX_EWMH_MODE + 1]; 3211 } ewmh[MAX_EWMH_DATA]; 3212#endif 3213#if OPT_NUM_LOCK 3214 unsigned num_lock; /* modifier for Num_Lock */ 3215 unsigned alt_mods; /* modifier for Alt_L or Alt_R */ 3216 unsigned meta_mods; /* modifier for Meta_L or Meta_R */ 3217#endif 3218 XtermFontNames fonts; 3219#if OPT_RENDERFONT 3220 Boolean render_font; 3221 unsigned max_fontsets; 3222#endif 3223#if OPT_DABBREV 3224#define MAX_DABBREV 1024 /* maximum word length as in tcsh */ 3225 char dabbrev_data[MAX_DABBREV]; 3226#endif 3227 ScrnColors *oldColors; 3228 Boolean palette_changed; 3229 Boolean broken_box_chars; 3230} Work; 3231 3232typedef struct {int foo;} XtermClassPart, TekClassPart; 3233 3234typedef struct _XtermClassRec { 3235 CoreClassPart core_class; 3236 XtermClassPart xterm_class; 3237} XtermClassRec; 3238 3239extern WidgetClass xtermWidgetClass; 3240 3241#define IsXtermWidget(w) (XtClass(w) == xtermWidgetClass) 3242 3243#if OPT_TEK4014 3244typedef struct _TekClassRec { 3245 CoreClassPart core_class; 3246 TekClassPart tek_class; 3247} TekClassRec; 3248 3249extern WidgetClass tekWidgetClass; 3250 3251#define IsTekWidget(w) (XtClass(w) == tekWidgetClass) 3252 3253#endif 3254 3255/* define masks for keyboard.flags */ 3256#define MODE_KAM xBIT(0) /* mode 2: keyboard action mode */ 3257#define MODE_DECKPAM xBIT(1) /* keypad application mode */ 3258#define MODE_DECCKM xBIT(2) /* private mode 1: cursor keys */ 3259#define MODE_SRM xBIT(3) /* mode 12: send-receive mode */ 3260#define MODE_DECBKM xBIT(4) /* private mode 67: backarrow */ 3261#define MODE_DECSDM xBIT(5) /* private mode 80: sixel scrolling mode */ 3262 3263#define N_MARGINBELL 10 3264 3265#define TAB_BITS_SHIFT 5 /* FIXME: 2**5 == 32 (should derive) */ 3266#define TAB_BITS_WIDTH (1 << TAB_BITS_SHIFT) 3267#define TAB_ARRAY_SIZE (1024 / TAB_BITS_WIDTH) 3268#define MAX_TABS (TAB_BITS_WIDTH * TAB_ARRAY_SIZE) 3269 3270#define OkTAB(c) ((c) >= 0 && (c) < MAX_TABS) 3271 3272typedef unsigned Tabs [TAB_ARRAY_SIZE]; 3273 3274#if OPT_XTERM_SGR 3275#define MAX_SAVED_SGR 10 3276typedef struct { 3277 int used; 3278 struct { 3279 IFlags mask; 3280 IFlags flags; 3281#if OPT_ISO_COLORS 3282 int sgr_foreground; 3283 int sgr_background; 3284 Boolean sgr_38_xcolors; 3285#endif 3286 } stack[MAX_SAVED_SGR]; 3287} SavedSGR; 3288 3289typedef struct { 3290 ScrnColors base; 3291 ColorRes ansi[1]; 3292} ColorSlot; 3293 3294typedef struct { 3295 int used; /* currently saved or restored */ 3296 int last; /* maximum number of saved palettes */ 3297 ColorSlot *palettes[MAX_SAVED_SGR]; 3298} SavedColors; 3299#endif /* OPT_XTERM_SGR */ 3300 3301typedef struct _XtermWidgetRec { 3302 CorePart core; 3303 XSizeHints hints; 3304 XVisualInfo *visInfo; 3305 int numVisuals; 3306 unsigned rgb_shifts[3]; 3307 unsigned rgb_widths[3]; 3308 Bool has_rgb; 3309 Bool init_menu; 3310 TKeyboard keyboard; /* terminal keyboard */ 3311 TScreen screen; /* terminal screen */ 3312 IFlags flags; /* mode flags */ 3313 int cur_foreground; /* current foreground color */ 3314 int cur_background; /* current background color */ 3315 Pixel dft_foreground; /* default foreground color */ 3316 Pixel dft_background; /* default background color */ 3317 Pixel old_foreground; /* original foreground color */ 3318 Pixel old_background; /* original background color */ 3319#if OPT_ISO_COLORS 3320 int sgr_foreground; /* current SGR foreground color */ 3321 int sgr_background; /* current SGR background color */ 3322 Boolean sgr_38_xcolors; /* true if ISO 8613 extension */ 3323#endif 3324 IFlags initflags; /* initial mode flags */ 3325 Tabs tabs; /* tabstops of the terminal */ 3326 Misc misc; /* miscellaneous parameters */ 3327 Work work; /* workspace (no resources) */ 3328#if OPT_XTERM_SGR 3329 SavedSGR saved_sgr; 3330 SavedColors saved_colors; 3331#endif 3332} XtermWidgetRec, *XtermWidget; 3333 3334#if OPT_TEK4014 3335typedef struct _TekWidgetRec { 3336 CorePart core; 3337 XtermWidget vt; /* main widget has border, etc. */ 3338 TekPart tek; /* contains resources */ 3339 TekScreen screen; /* contains working data (no resources) */ 3340 Bool init_menu; 3341 XSizeHints hints; 3342} TekWidgetRec, *TekWidget; 3343#endif /* OPT_TEK4014 */ 3344 3345/* 3346 * terminal flags 3347 * There are actually two namespaces mixed together here. 3348 * One is the set of flags that can go in screen->visbuf attributes 3349 * and which must fit in a char (see OFF_ATTRS). 3350 * The other is the global setting stored in 3351 * term->flags and screen->save_modes. This need only fit in an unsigned. 3352 */ 3353 3354#define AttrBIT(n) xBIT(n) /* text-attributes */ 3355#define MiscBIT(n) xBIT(n + 16) /* miscellaneous state flags */ 3356 3357/* global flags and character flags (visible character attributes) */ 3358#define INVERSE AttrBIT(0) /* invert the characters to be output */ 3359#define UNDERLINE AttrBIT(1) /* true if underlining */ 3360#define BOLD AttrBIT(2) 3361#define BLINK AttrBIT(3) 3362/* global flags (also character attributes) */ 3363#define BG_COLOR AttrBIT(4) /* true if background set */ 3364#define FG_COLOR AttrBIT(5) /* true if foreground set */ 3365 3366/* character flags (internal attributes) */ 3367#define PROTECTED AttrBIT(6) /* a character that cannot be erased */ 3368#define CHARDRAWN AttrBIT(7) /* a character has been drawn here on 3369 the screen. Used to distinguish 3370 blanks from empty parts of the 3371 screen when selecting */ 3372 3373#if OPT_WIDE_ATTRS 3374#define ATR_FAINT AttrBIT(8) 3375#define ATR_ITALIC AttrBIT(9) 3376#define ATR_STRIKEOUT AttrBIT(10) 3377#define ATR_DBL_UNDER AttrBIT(11) 3378#define ATR_DIRECT_FG AttrBIT(12) 3379#define ATR_DIRECT_BG AttrBIT(13) 3380#define SGR_MASK2 (ATR_FAINT | ATR_ITALIC | ATR_STRIKEOUT | ATR_DBL_UNDER | ATR_DIRECT_FG | ATR_DIRECT_BG) 3381#else 3382#define SGR_MASK2 0 3383#endif 3384 3385/* 3386 * Other flags 3387 */ 3388#define WRAPAROUND MiscBIT(0) /* true if auto wraparound mode */ 3389#define REVERSEWRAP MiscBIT(1) /* true if reverse wraparound mode */ 3390#define REVERSE_VIDEO MiscBIT(2) /* true if screen white on black */ 3391#define LINEFEED MiscBIT(3) /* true if in auto linefeed mode */ 3392#define ORIGIN MiscBIT(4) /* true if in origin mode */ 3393#define INSERT MiscBIT(5) /* true if in insert mode */ 3394#define SMOOTHSCROLL MiscBIT(6) /* true if in smooth scroll mode */ 3395#define IN132COLUMNS MiscBIT(7) /* true if in 132 column mode */ 3396#define INVISIBLE MiscBIT(8) /* true if writing invisible text */ 3397#define NATIONAL MiscBIT(9) /* true if writing national charset */ 3398#define LEFT_RIGHT MiscBIT(10) /* true if left/right margin mode */ 3399#define NOCLEAR_COLM MiscBIT(11) /* true if no clear on DECCOLM change */ 3400 3401#define DrawBIT(n) xBIT(n + 8) /* XTermDraw.draw_flags */ 3402/* The following attributes are used in the argument of drawXtermText() */ 3403#define NOBACKGROUND DrawBIT(0) /* Used for overstrike */ 3404#define NOTRANSLATION DrawBIT(1) /* No scan for chars missing in font */ 3405#define DOUBLEWFONT DrawBIT(2) /* The actual X-font is double-width */ 3406#define DOUBLEHFONT DrawBIT(3) /* The actual X-font is double-height */ 3407#define CHARBYCHAR DrawBIT(4) /* Draw chars one-by-one */ 3408 3409/* The following attribute is used in the argument of xtermSpecialFont etc */ 3410#define NORESOLUTION DrawBIT(5) /* find the font without resolution */ 3411 3412 3413/* 3414 * Groups of attributes 3415 */ 3416 /* mask for video-attributes only */ 3417#define SGR_MASK (BOLD | BLINK | UNDERLINE | INVERSE) 3418 3419 /* mask: user-visible attributes */ 3420#define ATTRIBUTES (SGR_MASK | SGR_MASK2 | BG_COLOR | FG_COLOR | INVISIBLE | PROTECTED) 3421 3422/* The toplevel-call to drawXtermText() should have text-attributes guarded: */ 3423#define DRAWX_MASK (ATTRIBUTES | CHARDRAWN) 3424 3425/* 3426 * BOLDATTR is not only nonzero when we will use bold font, but uses the bits 3427 * for BOLD/BLINK to match against the video attributes which were originally 3428 * requested. 3429 */ 3430#define USE_BOLD(screen) ((screen)->allowBoldFonts) 3431 3432#if OPT_BLINK_TEXT 3433#define BOLDATTR(screen) (unsigned) (USE_BOLD(screen) ? (BOLD | ((screen)->blink_as_bold ? BLINK : 0)) : 0) 3434#else 3435#define BOLDATTR(screen) (unsigned) (USE_BOLD(screen) ? (BOLD | BLINK) : 0) 3436#endif 3437 3438/* 3439 * Per-line flags 3440 */ 3441#define LINEWRAPPED AttrBIT(0) 3442/* used once per line to indicate that it wraps onto the next line so we can 3443 * tell the difference between lines that have wrapped around and lines that 3444 * have ended naturally with a CR at column max_col. 3445 */ 3446#define LINEBLINKED AttrBIT(1) 3447/* set when the line contains blinking text. 3448 */ 3449 3450#if OPT_ZICONBEEP || OPT_TOOLBAR || (USE_DOUBLE_BUFFER && OPT_RENDERFONT) 3451#define HANDLE_STRUCT_NOTIFY 1 3452#else 3453#define HANDLE_STRUCT_NOTIFY 0 3454#endif 3455 3456/* 3457 * If we've set protected attributes with the DEC-style DECSCA, then we'll have 3458 * to use DECSED or DECSEL to erase preserving protected text. (The normal ED, 3459 * EL won't preserve protected-text). If we've used SPA, then normal ED and EL 3460 * will preserve protected-text. To keep things simple, just remember the last 3461 * control that was used to begin protected-text, and use that to determine how 3462 * erases are performed (otherwise we'd need 2 bits per protected character). 3463 */ 3464#define OFF_PROTECT 0 3465#define DEC_PROTECT 1 3466#define ISO_PROTECT 2 3467 3468/***====================================================================***/ 3469 3470/* 3471 * Reduce parameter-count of drawXtermText by putting less-modified data here. 3472 */ 3473typedef struct { 3474 XtermWidget xw; 3475 unsigned attr_flags; 3476 unsigned draw_flags; 3477 unsigned this_chrset; 3478 unsigned real_chrset; 3479 int on_wide; 3480} XTermDraw; 3481 3482/***====================================================================***/ 3483 3484#define TScreenOf(xw) (&(xw)->screen) 3485#define TekScreenOf(tw) (&(tw)->screen) 3486 3487#define PrinterOf(screen) (screen)->printer_state 3488 3489#ifdef SCROLLBAR_RIGHT 3490#define OriginX(screen) (((term->misc.useRight)?0:ScrollbarWidth(screen)) + screen->border) 3491#else 3492#define OriginX(screen) (ScrollbarWidth(screen) + screen->border) 3493#endif 3494 3495#define OriginY(screen) (screen->border) 3496 3497#define CursorMoved(screen) \ 3498 ((screen)->cursor_moved || \ 3499 ((screen)->cursorp.col != (screen)->cur_col || \ 3500 (screen)->cursorp.row != (screen)->cur_row)) 3501 3502#define CursorX2(screen,col,fw) ((col) * (int)(fw) + OriginX(screen)) 3503#define CursorX(screen,col) CursorX2(screen, col, FontWidth(screen)) 3504#define CursorY2(screen,row) (((row) * FontHeight(screen)) + screen->border) 3505#define CursorY(screen,row) CursorY2(screen, INX2ROW(screen, row)) 3506 3507/* 3508 * These definitions depend on whether xterm supports active-icon. 3509 */ 3510#ifndef NO_ACTIVE_ICON 3511#define IsIconWin(screen,win) ((win) == &(screen)->iconVwin) 3512#define IsIcon(screen) (WhichVWin(screen) == &(screen)->iconVwin) 3513#define WhichVWin(screen) ((screen)->whichVwin) 3514#define WhichTWin(screen) ((screen)->whichTwin) 3515 3516#define WhichVFont(screen,name) (IsIcon(screen) ? getIconicFont(screen) \ 3517 : getNormalFont(screen, (int)(name)))->fs 3518#define FontAscent(screen) (IsIcon(screen) ? getIconicFont(screen)->fs->ascent \ 3519 : WhichVWin(screen)->f_ascent) 3520#define FontDescent(screen) (IsIcon(screen) ? getIconicFont(screen)->fs->descent \ 3521 : WhichVWin(screen)->f_descent) 3522#else /* NO_ACTIVE_ICON */ 3523 3524#define IsIconWin(screen,win) (False) 3525#define IsIcon(screen) (False) 3526#define WhichVWin(screen) (&((screen)->fullVwin)) 3527#define WhichTWin(screen) (&((screen)->fullTwin)) 3528 3529#define WhichVFont(screen,name) getNormalFont(screen, (int)(name))->fs 3530#define FontAscent(screen) WhichVWin(screen)->f_ascent 3531#define FontDescent(screen) WhichVWin(screen)->f_descent 3532 3533#endif /* NO_ACTIVE_ICON */ 3534 3535#define okFont(font) ((font) != 0 && (font)->fid != 0) 3536 3537/* 3538 * Macro to check if we are iconified; do not use render for that case. 3539 */ 3540#define UsingRenderFont(xw) (((xw)->work.render_font == True) && !IsIcon(TScreenOf(xw))) 3541 3542/* 3543 * These definitions do not depend on whether xterm supports active-icon. 3544 */ 3545#define VWindow(screen) WhichVWin(screen)->window 3546#define VShellWindow(xw) XtWindow(SHELL_OF(xw)) 3547#define TWindow(screen) WhichTWin(screen)->window 3548#define TShellWindow XtWindow(SHELL_OF(tekWidget)) 3549 3550#if USE_DOUBLE_BUFFER 3551extern Window VDrawable(TScreen * /* screen */); 3552#else 3553#define VDrawable(screen) VWindow(screen) 3554#endif 3555 3556#define Width(screen) WhichVWin(screen)->width 3557#define Height(screen) WhichVWin(screen)->height 3558#define FullWidth(screen) WhichVWin(screen)->fullwidth 3559#define FullHeight(screen) WhichVWin(screen)->fullheight 3560#define FontWidth(screen) WhichVWin(screen)->f_width 3561#define FontHeight(screen) WhichVWin(screen)->f_height 3562 3563#define NormalFont(screen) WhichVFont(screen, fNorm) 3564#define BoldFont(screen) WhichVFont(screen, fBold) 3565 3566#if OPT_WIDE_CHARS 3567#define NormalWFont(screen) WhichVFont(screen, fWide) 3568#define BoldWFont(screen) WhichVFont(screen, fWBold) 3569#endif 3570 3571#define ScrollbarWidth(screen) WhichVWin(screen)->sb_info.width 3572 3573/* y -> y_shift, to center text versus the cursor */ 3574#define ScaleShift(screen) \ 3575 (int) ((IsIcon(screen) || (screen->scale_height <= 1.0f)) \ 3576 ? 0.0f \ 3577 : ((float) WhichVWin(screen)->f_height \ 3578 * ((float) screen->scale_height - 1.0f) / 2.0f)) 3579 3580#define BorderGC(w,sp) WhichVWin(sp)->border_gc 3581#define FillerGC(w,sp) WhichVWin(sp)->filler_gc 3582#define NormalGC(w,sp) getCgsGC(w, WhichVWin(sp), gcNorm) 3583#define ReverseGC(w,sp) getCgsGC(w, WhichVWin(sp), gcNormReverse) 3584#define NormalBoldGC(w,sp) getCgsGC(w, WhichVWin(sp), gcBold) 3585#define ReverseBoldGC(w,sp) getCgsGC(w, WhichVWin(sp), gcBoldReverse) 3586 3587#define TWidth(screen) WhichTWin(screen)->width 3588#define THeight(screen) WhichTWin(screen)->height 3589#define TFullWidth(screen) WhichTWin(screen)->fullwidth 3590#define TFullHeight(screen) WhichTWin(screen)->fullheight 3591#define TekScale(screen) WhichTWin(screen)->tekscale 3592 3593/* use these before tek4014 is realized, good enough for default "9x15" font */ 3594#define TDefaultRows 37 3595#define TDefaultCols 75 3596 3597#define BorderWidth(w) ((w)->core.border_width) 3598#define BorderPixel(w) ((w)->core.border_pixel) 3599 3600#define AllowXtermOps(w,name) (TScreenOf(w)->name && !TScreenOf(w)->allowSendEvents) 3601 3602#define AllowColorOps(w,name) (AllowXtermOps(w, allowColorOps) || \ 3603 !TScreenOf(w)->disallow_color_ops[name]) 3604 3605#define AllowFontOps(w,name) (AllowXtermOps(w, allowFontOps) || \ 3606 !TScreenOf(w)->disallow_font_ops[name]) 3607 3608#define AllowMouseOps(w,name) (AllowXtermOps(w, allowMouseOps) || \ 3609 !TScreenOf(w)->disallow_mouse_ops[name]) 3610 3611#define AllowTcapOps(w,name) (AllowXtermOps(w, allowTcapOps) || \ 3612 !TScreenOf(w)->disallow_tcap_ops[name]) 3613 3614#define AllowTitleOps(w) AllowXtermOps(w, allowTitleOps) 3615 3616#define AllowXResOps(w) True 3617 3618#define SpecialWindowOps(w,name) (!TScreenOf(w)->disallow_win_ops[name]) 3619#define AllowWindowOps(w,name) (AllowXtermOps(w, allowWindowOps) || \ 3620 SpecialWindowOps(w,name)) 3621 3622#if OPT_TOOLBAR 3623#define ToolbarHeight(w) ((resource.toolBar) \ 3624 ? ((w)->VT100_TB_INFO(menu_height) \ 3625 + (w)->VT100_TB_INFO(menu_border) * 2) \ 3626 : 0) 3627#else 3628#define ToolbarHeight(w) 0 3629#endif 3630 3631#if OPT_TEK4014 3632#define TEK_LINK_BLOCK_SIZE 1024 3633 3634typedef struct Tek_Link 3635{ 3636 struct Tek_Link *next; /* pointer to next TekLink in list 3637 NULL <=> this is last TekLink */ 3638 unsigned short fontsize;/* character size, 0-3 */ 3639 unsigned short count; /* number of chars in data */ 3640 char *ptr; /* current pointer into data */ 3641 char data [TEK_LINK_BLOCK_SIZE]; 3642} TekLink; 3643#endif /* OPT_TEK4014 */ 3644 3645/* flags for cursors */ 3646#define OFF 0 3647#define ON 1 3648#define BLINKED_OFF 2 3649#define CLEAR 0 3650#define TOGGLE 1 3651 3652/* flags for inhibit */ 3653#ifdef ALLOWLOGGING 3654#define I_LOG 0x01 3655#endif 3656#define I_SIGNAL 0x02 3657#define I_TEK 0x04 3658 3659/* *INDENT-ON* */ 3660 3661#endif /* included_ptyx_h */ 3662