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