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