INSTALL | 13 MANIFEST | 2 Makefile.in | 6 NEWS | 147 - THANKS | 9 Tekproc.c | 514 ++- XTerm.ad | 3 aclocal.m4 | 87 button.c | 359 +- cachedGCs.c | 12 charclass.c | 101 charclass.h | 6 charproc.c | 949 +++--- config.guess | 133 config.sub | 47 configure | 5139 ++++++++++++++++++++--------------- configure.in | 20 ctlseqs.ms | 111 ctlseqs.txt | 96 cursor.c | 9 data.h | 9 debian/changelog | 15 debian/control | 2 debian/patches/900_debian_xterm.diff | 6 debian/patches/902_windowops.diff | 2 debian/patches/904_fontops.diff | 8 debian/rules | 1 doublechr.c | 23 fontutils.c | 1424 +++++++-- fontutils.h | 46 graphics_regis.c | 222 + html.c | 6 input.c | 6 main.c | 129 main.h | 12 menu.c | 52 menu.h | 5 minstall.in | 5 misc.c | 84 package/debian/changelog | 6 package/debian/control | 2 package/debian/copyright | 2 package/debian/rules | 7 package/debian/xterm-dev.docs | 1 package/debian/xterm-dev.menu | 4 package/freebsd/Makefile | 2 package/xterm.spec | 4 print.c | 52 ptyx.h | 147 - resize.c | 19 screen.c | 36 terminfo | 512 +++ trace.c | 26 trace.h | 6 util.c | 143 version.c | 4 version.h | 8 vttests/256colors.pl | 25 vttests/256colors2.pl | 197 - vttests/88colors.pl | 24 vttests/88colors2.pl | 200 - vttests/closest-rgb.pl | 230 + vttests/dynamic.pl | 132 vttests/query-color.pl | 94 vttests/query-status.pl | 169 + vttests/resize.pl | 154 - vttests/tcapquery.pl | 472 +-- xstrings.c | 47 xstrings.h | 5 xterm.h | 81 xterm.log.html | 259 + xterm.man | 681 +++- xterm_io.h | 51 xtermcfg.hin | 5 xutf8.c | 18 75 files changed, 8922 insertions(+), 4723 deletions(-)
New commits: commit badfc56d6f4ef43f1e6e05119ed17d2b24a2e6ea Author: Sven Joachim <svenj...@gmx.de> Date: Fri Jun 9 19:51:04 2017 +0200 Close bug #844325 diff --git a/debian/changelog b/debian/changelog index 32c93cd..8339eed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,10 @@ xterm (328-1) UNRELEASED; urgency=medium * New upstream release. + - Add special case for displaying soft-hyphen if it happens to fall + at the right margin, and omitting similar case such as the BIDI + markers, where a zero-width character is neither a control character + nor a combining character (Closes: #844325). * Refresh Debian patches. * Bump autoconf-dickey build dependency to (>= 2.52+20170501), as per configure.in. commit 3791765bcdb0537c912dc7c6579bf261609b6b63 Author: Sven Joachim <svenj...@gmx.de> Date: Fri Jun 9 19:43:15 2017 +0200 Configure "--with-desktop-category=System,TerminalEmulator," This is actually the default now, but depending on what other applications are installed on the build system "Utility" might still be added. So add the configure option for deterministic results. diff --git a/debian/changelog b/debian/changelog index 8477e89..32c93cd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ xterm (328-1) UNRELEASED; urgency=medium * Refresh Debian patches. * Bump autoconf-dickey build dependency to (>= 2.52+20170501), as per configure.in. + * Configure "--with-desktop-category=System,TerminalEmulator," + (Closes: #780176). -- Sven Joachim <svenj...@gmx.de> Fri, 09 Jun 2017 16:42:01 +0200 diff --git a/debian/rules b/debian/rules index a35d111..521becf 100755 --- a/debian/rules +++ b/debian/rules @@ -48,6 +48,7 @@ override_dh_auto_configure: --enable-backarrow-is-erase \ --enable-sixel-graphics \ --with-utempter \ + --with-desktop-category=System,TerminalEmulator, \ DESKTOP_FLAGS="$(DESKTOP_FLAGS)" \ CFLAGS="$(CFLAGS)" \ CPPFLAGS="$(CPPFLAGS)" \ commit 3cc51694108eddbb6872b2f676d0651d741279ae Author: Sven Joachim <svenj...@gmx.de> Date: Fri Jun 9 19:24:58 2017 +0200 Bump autoconf-dickey build dependency to (>= 2.52+20170501) Needed, since configure.in has AC_PREREQ(2.52.20170501) now. diff --git a/debian/changelog b/debian/changelog index 86bfffe..8477e89 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ xterm (328-1) UNRELEASED; urgency=medium * New upstream release. * Refresh Debian patches. + * Bump autoconf-dickey build dependency to (>= 2.52+20170501), as per + configure.in. -- Sven Joachim <svenj...@gmx.de> Fri, 09 Jun 2017 16:42:01 +0200 diff --git a/debian/control b/debian/control index 430f6a6..7512e67 100644 --- a/debian/control +++ b/debian/control @@ -17,7 +17,7 @@ Build-Depends: libxinerama-dev, debhelper (>= 10), autotools-dev, - autoconf-dickey, + autoconf-dickey (>= 2.52+20170501), lynx | lynx-cur, xorg-docs-core, desktop-file-utils, commit fd4f4da47d0a30823b8044c9a8c5a5bdb1c33501 Author: Sven Joachim <svenj...@gmx.de> Date: Fri Jun 9 17:33:54 2017 +0200 Refresh Debian patches The patch 904_fontops.diff failed to apply. diff --git a/debian/changelog b/debian/changelog index 25ea65e..86bfffe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ xterm (328-1) UNRELEASED; urgency=medium * New upstream release. + * Refresh Debian patches. -- Sven Joachim <svenj...@gmx.de> Fri, 09 Jun 2017 16:42:01 +0200 diff --git a/debian/patches/900_debian_xterm.diff b/debian/patches/900_debian_xterm.diff index 5023b46..93ebedb 100644 --- a/debian/patches/900_debian_xterm.diff +++ b/debian/patches/900_debian_xterm.diff @@ -40,7 +40,7 @@ This patch by Branden Robinson. + :kb=^?: --- a/terminfo +++ b/terminfo -@@ -137,6 +137,8 @@ xterm-new|modern xterm terminal emulator +@@ -138,6 +138,8 @@ xterm-new|modern xterm terminal emulator use=xterm+pcfkeys, use=xterm+tmux, use=xterm-basic, @@ -49,7 +49,7 @@ This patch by Branden Robinson. # # Encode modifiers using parameters (see "Xterm Control Sequences" ctlseqs.ms). # Note that this is unrelated to PCTERM. -@@ -1972,12 +1974,12 @@ xterm-r5|xterm R5 version, +@@ -2364,12 +2366,12 @@ xterm-r5|xterm R5 version, # This is the only entry which you should have to customize, since "xterm" # is widely used for a variety of incompatible terminal emulations including # color_xterm and rxvt. @@ -66,7 +66,7 @@ This patch by Branden Robinson. # kbs=^?, --- a/XTerm.ad +++ b/XTerm.ad -@@ -163,6 +163,9 @@ +@@ -164,6 +164,9 @@ *tek4014*font3: 6x13 *tek4014*fontSmall: 6x10 diff --git a/debian/patches/902_windowops.diff b/debian/patches/902_windowops.diff index d69d536..1c27957 100644 --- a/debian/patches/902_windowops.diff +++ b/debian/patches/902_windowops.diff @@ -4,7 +4,7 @@ --- a/xterm.man +++ b/xterm.man -@@ -2743,8 +2743,9 @@ This is a comma-separated list of names, +@@ -2842,8 +2842,9 @@ This is a comma-separated list of names, from \fIdtterm\fP the operation number). The default value is .NS diff --git a/debian/patches/904_fontops.diff b/debian/patches/904_fontops.diff index 1d50466..6528026 100644 --- a/debian/patches/904_fontops.diff +++ b/debian/patches/904_fontops.diff @@ -4,12 +4,12 @@ --- a/xterm.man +++ b/xterm.man -@@ -1997,7 +1997,7 @@ The default is \*(``true\*(''. +@@ -2041,7 +2041,7 @@ The default is \*(``true\*(''. .TP .B "allowFontOps\fP (class\fB AllowFontOps\fP)" Specifies whether control sequences that set/query the font should be allowed. -The default is \*(``true\*(''. +The default is \*(``false\*(''. - .TP 8 - .B "allowPasteControls\fP (class\fB AllowPasteControls\fP)" - If true, allow control characters such as BEL and CAN to be pasted. + .TP + .B "allowMouseOps\fP (class\fB AllowMouseOps\fP)" + Specifies whether control sequences that enable \fI\*n\fP to send commit e2d0a232d984d1cea678fa24bfa87068ca55fce2 Author: Sven Joachim <svenj...@gmx.de> Date: Fri Jun 9 16:42:09 2017 +0200 New upstream release diff --git a/debian/changelog b/debian/changelog index 236f53e..25ea65e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +xterm (328-1) UNRELEASED; urgency=medium + + * New upstream release. + + -- Sven Joachim <svenj...@gmx.de> Fri, 09 Jun 2017 16:42:01 +0200 + xterm (327-2) unstable; urgency=medium * Bump debhelper compatibility level to 10. commit fc9f89a55e3f9e29cf4c9e024b6870cfaa9586a1 Author: Sven Joachim <svenj...@gmx.de> Date: Fri Jun 9 16:35:53 2017 +0200 Imported Upstream version 328 diff --git a/INSTALL b/INSTALL index 4d961da..188bac3 100644 --- a/INSTALL +++ b/INSTALL @@ -1,6 +1,6 @@ --- $XTermId: INSTALL,v 1.160 2016/09/09 22:56:18 tom Exp $ +-- $XTermId: INSTALL,v 1.163 2017/05/30 08:32:35 tom Exp $ ------------------------------------------------------------------------------- --- Copyright 1997-2015,2016 by Thomas E. Dickey +-- Copyright 1997-2016,2017 by Thomas E. Dickey -- -- All Rights Reserved -- @@ -432,6 +432,13 @@ The options (in alphabetic order): further work because colors used for clearing the screen do not match the expected behavior (see vttest for instance). + --enable-env-terminfo setenv $TERMINFO if --with-own-terminfo gives value + + Use the custom terminfo directory specified in "--with-own-terminfo" + as the $TERMINFO variable for the shells spawned by xterm. Setting + this variable makes most curses (and termcap) applications look in + that directory for terminal descriptions. + --enable-exec-xterm enable "spawn-new-terminal" action If your platform supports the process filesystem "cwd" link, @@ -614,7 +621,7 @@ The options (in alphabetic order): at existing ".desktop" files for xterm and common terminal emulators, to use those. If none are found, the script uses this default: - System;TerminalEmulator;Utility; + System;TerminalEmulator; --with-freetype-config configure script to use for FreeType diff --git a/MANIFEST b/MANIFEST index bd690d0..b5bdd85 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,4 +1,4 @@ -MANIFEST for xterm-327, version xterm-327 +MANIFEST for xterm-328, version xterm-328 -------------------------------------------------------------------------------- MANIFEST this file 256colres.h resource-definitions for 256-color mode diff --git a/Makefile.in b/Makefile.in index 5fcbfab..5b4f67f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,8 @@ -## $XTermId: Makefile.in,v 1.238 2016/10/06 00:28:15 tom Exp $ +## $XTermId: Makefile.in,v 1.239 2017/01/14 00:15:11 tom Exp $ # ----------------------------------------------------------------------------- # this file is part of xterm # -# Copyright 1997-2015,2016 by Thomas E. Dickey +# Copyright 1997-2016,2017 by Thomas E. Dickey # # All Rights Reserved # @@ -119,7 +119,7 @@ EXTRAOBJ = @EXTRAOBJS@ OBJS2 = resize$o version$o xstrings$o SRCS = $(SRCS1) $(SRCS2) OBJS = $(OBJS1) $(OBJS2) - HDRS = VTparse.h data.h error.h main.h menu.h \ + HDRS = VTparse.h data.h error.h fontutils.h main.h menu.h \ ptyx.h version.h xstrings.h xterm.h xtermcap.h $(EXTRAHDR) PROGRAMS = xterm$x resize$x diff --git a/NEWS b/NEWS index 0fa030a..1e93ea7 100644 --- a/NEWS +++ b/NEWS @@ -1,22 +1,135 @@ The NEWS file was generated from xterm.log.html, which serves as the changelog for xterm. -------------------------------------------------------------------------------- - Patch #327 - 2016/10/07 + Patch #328 - 2017/06/01 - * add a check in the function which handles end-of-line wrapping to - ensure that C1 controls are allocated one column when - allowC1Printable is set (Debian #738794). - * use consistent error-checking after strtol calls, fixes a case - where a query with OSC 6 did not ensure there was a valid color - number (report by Alex Smith). - * add -baudrate option, for testing ncurses. - * always generate the CASE_xxx symbols in VTparse.h and Tekparse.h, - as part of a change to improve debug-logging. This makes the build - always depend upon awk. - * modify allowC1Printable to disallow codes 160-254 as being - equivalent to codes 32-126 when parsing escape sequences (Debian - #839220). - * amend fix from patch #326 for TrueType fonts to exclude the hidden - character used for double-width cells (report by Grady Martin). - * fix a typo in ctlseqs.ms + * revise parser for charClass resource, making these improvements: + + accept octal and hexadecimal values + + allow embedded whitespace + + allow the class after colon to be optional, e.g., to clear + class settings for a range of characters. + * add command-line option -report-charclass. + * fix most lintian warnings about test-package + * add eraseSavedLines resource. + * document DECSED 3 in ctlseqs.ms (report by Ben Longmans). + * improve integration between configure-events and updates for + reported screensize, in particular when switching between vt100 and + tek4014 modes. + * modify selection-highlighting of reverse-video text to keep that + distinct, e.g., by reversing the selection foreground and + background colors as one would expect. This fixes a "useless" case + in the description of highlightColorMode. + * improve fix for Debian #759734, addressing a case where non-colored + cursor would be invisible against reverse-video (see patch #311). + * updates for ReGIS (Ross Combs): + + the "H" option of the "T" command should multiply by 10, not + 20. + + display unknown glyphs as a solid block. + + given a succession of text-direction options, use the last. + + fix the direction of ReGIS slanted text so that negative + values produce oblique output . + + fix the ReGIS text direction option to only rotate characters + when no following size option is used. + * update terminfo to better match corresponding entries in ncurses, + e.g., u8 pattern to match the VT220, VT420, etc., primary + responses, as well as adding smxx and rmxx. + * fixes from Jörg Sommer: + + corrected a trace-message regarding maximum graphics-size; it + used the similar ReGIS maximum size which might not be + configured. + + in do_select_regex, clear selection if there is no match. If + the regex does not match anything around the cursor, the + selection returned must be empty, otherwise the whole line is + treated as a match. This way the command defined by + exec-selectable will not be executed if there is no match. + + modify limit in do_select_regex to include the character at + the cursor in the match, making it easier to type something + and then hit the key to trigger exec-selectable. + + If exec-selectable or insert-selection is triggered by a mouse + button click, the position of the mouse pointer should be + used. This makes it easier to address any position on the + window and it makes it possible to use the mouse, e.g., for + applications such as mutt where you cannot move the cursor. + * modify DECRC to save/restore xterm's last-column flag used to + control wrapping behavior rather than manipulating DECAWM + (report/analysis by Mattias Engdegård). + * add configure option --enable-terminfo-env to use the value set by + --with-own-terminfo for the $TERMINFO environment variable. That + variable was set automatically for HPUX, but would be useful in + other systems, e.g., for Solaris (request by Jeff Wieland). + * fix a race condition when setting up a signal handler to timeout if + opening /dev/tty hangs (patch by Tobias Stoeckmann). + * review/cleanup resources which were not in the manual page (report + by Maxwell Anselm): + + add manual page description as needed. + + drop resource name for menuBar, as unnecessary. + + modify fallback numeric value for regisScreenSize resource to + match that for maxGraphicSize. + * updated configure macros CF_ADD_CFLAGS, CF_CC_ENV_FLAGS, + CF_GNU_SOURCE, CF_MATH_LIB, and CF_XOPEN_SOURCE from other + program-changes. + * update config.guess, config.sub + * change “maximum screensize” assumed by resize to 9999x9999, to + accommodate people using the Unreadable font. + * drop Utility from default value of --with-desktop-category (Debian + #780176). + * widen the configure script pattern used for finding related + ".desktop" files, including “Terminal” + * several minor improvements to font utility functions: + + provide for later modification to implement font-sets by + parsing the font resources as comma-separated lists. + + parse -fn and -fa similarly, using “x:” and “xft:” prefixes + for font name/family strings to distinguish between XLFD and + Xft font specifications. + + use loops to iterate over font classes + + use getters/setters for font data to allow for on-demand + lookups. + + make the debugging trace for missing glyph less verbose since + that interferes with the -report-fonts option. + + refactor xtermLoadFont to make it clearer how some fonts are + derived from others, e.g., bold, wide. + + make the triggering and suppressing of font-warnings more + consistent by storing the last state in the widget. + + reduce font-warnings by checking for repeated warnings. + * add vttests/query-status.pl + * add vttests/closest-rgb + * add special case for displaying soft-hyphen if it happens to fall + at the right margin, and omitting similar case such as the BIDI + markers, where a zero-width character is neither a control + character nor a combining character (Debian #844325). + * modify logic for OSC 52, manipulate selection data, to update the + selection-time to include the latest X events. This fixes some + cases where the selection was invalid, e.g., after an event due to + focus-follows-mouse (report/testcase by Stephane Chauveau). + * revise macro CastMallocN as new macro TextAlloc to make explicit + use of sizeof(char) (prompted by patch by Cade Foster). + * add “Mouse Ops” menu entry and related resources to allow runtime + disabling/enabling of the mouse protocol escape sequences + (discussion with Bob Proulx). + * improve discussion of mouse actions versus protocol in the manual + (discussion with Bob Proulx). + * improve discussion of environment variables in the manual, pointing + out where some features (such as termcap and the System5 COLUMNS + and LINES variables) are used rarely, mainly to support legacy + applications. + * add examples of translations resource for select/paste, and for + font-size changes to the manual. + * minor reordering of some entries in ctlseqs.ms for consistency + (report by Arran Ubels). + * add -s option to 256colors2.pl and 88colors2.pl, to demonstrate + modifying the “system” colors 0–15. + * omit XFT_SPACING property from call to XftPatternBuild, to work + around a bug in fontconfig for handling Google Go fonts, whose + names sort in an order not expected by fontconfig, causing the + request for a monospaced font to return italics, e.g., + +$ fc-match 'Go Mono:spacing=monospace' +Go-Mono-Italic.ttf: "Go Mono" "Italic" +(report by Giacomo Boffi on Stackoverflow). + + + * modify minstall.in to improve a workaround added to the manual page + in patch #182 to avoid having the C preprocessor used in the imake + configuration strip out the comments in the character classes + section (reports by Ted Unangst, Anthony J Bentley). diff --git a/THANKS b/THANKS index f2af2bf..25bf331 100644 --- a/THANKS +++ b/THANKS @@ -1,4 +1,4 @@ --- $XTermId: THANKS,v 1.15 2015/08/28 08:17:31 tom Exp $ +-- $XTermId: THANKS,v 1.16 2017/05/27 16:55:42 tom Exp $ -- vile:txtmode fk=8bit There's no AUTHORS file in this distribution; it would be redundant since I (Thomas E. Dickey) have done more than 80% of the work on xterm since 1996. @@ -28,6 +28,7 @@ Andrey Panov Andries E Brouwer Anton Kovalenko Balazs Kezes +Ben Wiley Sittler Ben Yoshino Bernhard R Link Bernhard Rosenkraenzer @@ -45,6 +46,7 @@ Christian Biere Christian Weisgerber Chuck Blake D Roland Walker +Dan Church Daniel Colascione Daniel Drake Daniel Jacobowitz @@ -110,6 +112,7 @@ Kevin Buhr Kevin Ryde Kevin Schoedel Kiyokazu Suto +Larry Hynes Larry Riedel Lee Olsen Lo�c Minier @@ -126,6 +129,7 @@ Matthias Baake Matthias Scheler Matthieu Herrb Matthieu Lagouge +Mattias Engdeg�rd Max Mikhanosha Michael Riepe Michael Rohleder @@ -133,6 +137,7 @@ Michael Schroeder Mike Castle Mike Fabian Mike Hopkirk +Milan Mehner Min Sik Kim Miroslav Lichvar Nam SungHyun @@ -189,7 +194,7 @@ Tomohiro Kubota Tor Lillqvist Torrey Lyons Victor Stinner -Vincent Lefevre +Vincent Lef�vre Werner Fink Werner Lemberg Will Day diff --git a/Tekproc.c b/Tekproc.c index a640643..ce03237 100644 --- a/Tekproc.c +++ b/Tekproc.c @@ -1,7 +1,7 @@ -/* $XTermId: Tekproc.c,v 1.199 2016/05/16 09:14:46 tom Exp $ */ +/* $XTermId: Tekproc.c,v 1.228 2017/05/29 23:19:34 tom Exp $ */ /* - * Copyright 2001-2014,2016 by Thomas E. Dickey + * Copyright 2001-2016,2017 by Thomas E. Dickey * * All Rights Reserved * @@ -111,25 +111,33 @@ #include <menu.h> #include <xstrings.h> -#define DefaultGCID XGContextFromGC(DefaultGC(XtDisplay(tw), DefaultScreen(XtDisplay(tw)))) +#define DefaultGCID(tw) \ + XGContextFromGC(DefaultGC(XtDisplay(tw), \ + DefaultScreen(XtDisplay(tw)))) /* Tek defines */ -#define DOTDASHEDLINE 2 +#define MY_CLASS "Tek4014" +#define MY_NAME "tek4014" + +#define SOLIDLINE 0 #define DOTTEDLINE 1 -#define EAST 01 -#define LINEMASK 07 +#define DOTDASHEDLINE 2 +#define SHORTDASHEDLINE 3 #define LONGDASHEDLINE 4 + +#define EAST 001 +#define WEST 002 +#define NORTH 004 +#define SOUTH 010 + +#define LINEMASK 07 #define MARGIN1 0 #define MARGIN2 1 #define MAX_PTS 150 #define MAX_VTX 300 -#define NORTH 04 #define PENDOWN 1 #define PENUP 0 -#define SHORTDASHEDLINE 3 -#define SOLIDLINE 0 -#define SOUTH 010 #define TEKBOTTOMPAD 23 #define TEKDEFHEIGHT 565 #define TEKDEFWIDTH 750 @@ -140,7 +148,14 @@ #define TEKMINWIDTH 600 #define TEKTOPPAD 34 #define TEKWIDTH 4096 -#define WEST 02 + +#define FULL_HEIGHT (TEKHEIGHT + TEKTOPPAD + TEKBOTTOMPAD) + +#define BottomY(y) (TEKHEIGHT + TEKTOPPAD - (y)) +#define BorderOf(tw) (TScreenOf((tw)->vt)->border) +#define ScaleOf(tw) TekScale(TekScreenOf(tw)) +#define ScaledX(tw,x) (((x) * ScaleOf(tw)) + BorderOf(tw)) +#define ScaledY(tw,y) ((BottomY(y) * ScaleOf(tw)) + BorderOf(tw)) #define TekMove(tw,x,y) tekscr->cur_X = x; tekscr->cur_Y = y #define input() Tinput(tw) @@ -276,7 +291,7 @@ static void TCursorForward(TekWidget /* tw */ ); static void TCursorUp(TekWidget /* tw */ ); static void TekBackground(TekWidget /* tw */ , TScreen * /* screen */ ); -static void TekConfigure(Widget /* w */ ); +static void TekResize(Widget /* w */ ); static void TekDraw(TekWidget /* tw */ , int /* x */ , int /* y */ ); @@ -299,7 +314,7 @@ static WidgetClassRec tekClassRec = { /* core_class fields */ (WidgetClass) & widgetClassRec, /* superclass */ - "Tek4014", /* class_name */ + MY_CLASS, /* class_name */ sizeof(TekWidgetRec), /* widget_size */ NULL, /* class_initialize */ NULL, /* class_part_initialize */ @@ -317,7 +332,7 @@ static WidgetClassRec tekClassRec = True, /* compress_enterleave */ False, /* visible_interest */ NULL, /* destroy */ - TekConfigure, /* resize */ + TekResize, /* resize */ TekExpose, /* expose */ NULL, /* set_values */ NULL, /* set_values_hook */ @@ -336,6 +351,11 @@ WidgetClass tekWidgetClass = (WidgetClass) & tekClassRec; static Bool Tfailed = False; +/* + * TekInit/TekRun are called after the VT100 widget has been initialized, but + * may be before VT100 is realized, depending upon whether Tek4014 is the + * first window to be shown. + */ int TekInit(void) { @@ -370,7 +390,7 @@ TekInit(void) /* this causes the Realize method to be called */ tekWidget = (TekWidget) - XtVaCreateManagedWidget("tek4014", + XtVaCreateManagedWidget(MY_NAME, tekWidgetClass, form_top, #if OPT_TOOLBAR XtNmenuBar, menu_top, @@ -393,28 +413,26 @@ TekInit(void) /* * If we haven't allocated the PtyData struct, do so. */ -int +static int TekPtyData(void) { - if (Tpushb == 0) { + if (Tpushb == 0 && !Tfailed) { if ((Tpushb = TypeMallocN(Char, 10)) == NULL || (Tline = TypeMallocN(XSegment, MAX_VTX)) == NULL) { xtermWarning("Not enough core for Tek mode\n"); if (Tpushb) free(Tpushb); Tfailed = True; - return 0; } } - return 1; + return (Tfailed ? 0 : 1); } static void Tekparse(TekWidget tw) { - XtermWidget xw = term; - TScreen *screen = TScreenOf(xw); TekScreen *tekscr = TekScreenOf(tw); + TScreen *screen = TScreenOf(tw->vt); int x, y; IChar ch; int nextstate; @@ -456,7 +474,7 @@ Tekparse(TekWidget tw) TRACE(("case: special return to vt102 mode\n")); Tparsestate = curstate; TekRecord->ptr[-1] = ANSI_NAK; /* remove from recording */ - FlushLog(xw); + FlushLog(tw->vt); return; case CASE_SPT_STATE: @@ -485,7 +503,7 @@ Tekparse(TekWidget tw) if (tekscr->TekGIN) TekGINoff(tw); if (!tekRefreshList) - Bell(xw, XkbBI_TerminalBell, 0); + Bell(tw->vt, XkbBI_TerminalBell, 0); Tparsestate = curstate; /* clear bypass condition */ break; @@ -707,10 +725,8 @@ Tekparse(TekWidget tw) case CASE_PRINT: TRACE(("case: printable character\n")); ch = c; - x = (int) (tekscr->cur_X * TekScale(tekscr)) - + screen->border; - y = (int) ((TEKHEIGHT + TEKTOPPAD - tekscr->cur_Y) * TekScale(tekscr)) - + screen->border; + x = (int) ScaledX(tw, tekscr->cur_X); + y = (int) ScaledY(tw, tekscr->cur_Y); #if OPT_WIDE_CHARS if (screen->wide_chars @@ -763,7 +779,7 @@ Tekparse(TekWidget tw) buf2[len] = 0; if (!nested++) { if (c2 == ANSI_BEL) - do_osc(xw, buf2, len, ANSI_BEL); + do_osc(tw->vt, buf2, len, ANSI_BEL); } --nested; } @@ -780,9 +796,8 @@ static PtySelect Tselect_mask; static IChar Tinput(TekWidget tw) { - XtermWidget xw = term; TekScreen *tekscr = TekScreenOf(tw); - TScreen *screen = TScreenOf(xw); + TScreen *screen = TScreenOf(tw->vt); TekLink *tek; if (Tpushback > Tpushb) @@ -820,7 +835,7 @@ Tinput(TekWidget tw) &Tselect_mask, NULL, NULL, &crocktimeout); #endif - if (readPtyData(xw, &Tselect_mask, VTbuffer)) { + if (readPtyData(tw->vt, &Tselect_mask, VTbuffer)) { break; } if (Ttoggled && curstate == Talptable) { @@ -897,28 +912,74 @@ TekClear(TekWidget tw) XClearWindow(XtDisplay(tw), TWindow(tekscr)); } -/* this should become the Tek Widget's Resize proc */ +void +TekSetWinSize(TekWidget tw) +{ + if (TEK4014_ACTIVE(tw->vt)) { + TekScreen *tekscr = TekScreenOf(tw); + const struct Tek_Char *t = &TekChar[tekscr->cur.fontsize]; + int rows = THeight(tekscr) / (int) (ScaleOf(tw) * t->vsize); + int cols = TWidth(tekscr) / (int) (ScaleOf(tw) * t->hsize); + + update_winsize(TScreenOf(tw->vt)->respond, + rows, cols, + TFullHeight(tekscr), + TFullWidth(tekscr)); + } +} + +static void +compute_sizes(TekWidget tw) +{ + TekScreen *tekscr = TekScreenOf(tw); + int border = 2 * BorderOf(tw); + double d; +#if OPT_TRACE + const struct Tek_Char *t = &TekChar[tekscr->cur.fontsize]; + const XFontStruct *fs = tw->tek.Tfont[tekscr->cur.fontsize]; +#endif + + /* *INDENT-EQLS* */ + TWidth(tekscr) = tw->core.width - border; + THeight(tekscr) = tw->core.height - border; + ScaleOf(tw) = (double) TWidth(tekscr) / TEKWIDTH; + + if ((d = (double) THeight(tekscr) / FULL_HEIGHT) < ScaleOf(tw)) + ScaleOf(tw) = d; + + TFullWidth(tekscr) = tw->core.width; + TFullHeight(tekscr) = tw->core.height; + + TRACE(("%s size %dx%d full %dx%d scale %.2f\n", MY_NAME, + THeight(tekscr), TWidth(tekscr), + TFullHeight(tekscr), TFullWidth(tekscr), + ScaleOf(tw))); + + /* The tek4014 fonts always look odd since their spacing is overridden to + * get the "same" size as a real Tektronix terminal. TrueType fonts for + * these small sizes would be no better... + */ + TRACE(("unscaled font %dx%d\n", t->vsize, t->hsize)); + TRACE(("scaled font %.1fx%.1f\n", d * t->vsize, d * t->hsize)); + TRACE(("actual font %dx%d\n", + fs->max_bounds.ascent + fs->max_bounds.descent, + fs->max_bounds.width)); + + TekSetWinSize(tw); +} + static void -TekConfigure(Widget w) +TekResize(Widget w) { TekWidget tw = getTekWidget(w); if (tw != 0) { - XtermWidget xw = term; - TekScreen *tekscr = TekScreenOf(tw); - TScreen *screen = TScreenOf(xw); - int border = 2 * screen->border; - double d; - TRACE(("TekConfigure\n")); + TRACE(("TekResize {{\n")); TekClear(tw); - TWidth(tekscr) = w->core.width - border; - THeight(tekscr) = w->core.height - border; - TekScale(tekscr) = (double) TWidth(tekscr) / TEKWIDTH; - if ((d = (double) THeight(tekscr) / (TEKHEIGHT + TEKTOPPAD + TEKBOTTOMPAD)) - < TekScale(tekscr)) - TekScale(tekscr) = d; - TFullWidth(tekscr) = w->core.width; - TFullHeight(tekscr) = w->core.height; + + compute_sizes(tw); + + TRACE(("}} TekResize\n")); } } @@ -966,8 +1027,7 @@ void TekRefresh(TekWidget tw) { if (tw != 0) { - XtermWidget xw = term; - TScreen *screen = TScreenOf(xw); + TScreen *screen = TScreenOf(tw->vt); TekScreen *tekscr = TekScreenOf(tw); static Cursor wait_cursor = None; @@ -1159,9 +1219,6 @@ TCursorDown(TekWidget tw) static void AddToDraw(TekWidget tw, int x1, int y1, int x2, int y2) { - XtermWidget xw = term; - TScreen *screen = TScreenOf(xw); - TekScreen *tekscr = TekScreenOf(tw); XSegment *lp; TRACE(("AddToDraw (%d,%d) (%d,%d)\n", x1, y1, x2, y2)); @@ -1169,12 +1226,10 @@ AddToDraw(TekWidget tw, int x1, int y1, int x2, int y2) TekFlush(tw); } lp = line_pt++; - lp->x1 = (short) (x1 * TekScale(tekscr) + screen->border); - lp->y1 = (short) ((TEKHEIGHT + TEKTOPPAD - y1) * TekScale(tekscr) + - screen->border); - lp->x2 = (short) (x2 * TekScale(tekscr) + screen->border); - lp->y2 = (short) ((TEKHEIGHT + TEKTOPPAD - y2) * TekScale(tekscr) + - screen->border); + lp->x1 = (short) ScaledX(tw, x1); + lp->y1 = (short) ScaledY(tw, y1); + lp->x2 = (short) ScaledX(tw, x2); + lp->y2 = (short) ScaledY(tw, y2); nplot++; TRACE(("...AddToDraw %d points\n", nplot)); } @@ -1231,8 +1286,6 @@ TekGINoff(TekWidget tw) void TekEnqMouse(TekWidget tw, int c) /* character pressed */ { - XtermWidget xw = term; - TScreen *screen = TScreenOf(xw); TekScreen *tekscr = TekScreenOf(tw); int mousex, mousey, rootx, rooty; unsigned int mask; /* XQueryPointer */ @@ -1245,12 +1298,11 @@ TekEnqMouse(TekWidget tw, int c) /* character pressed */ &rootx, &rooty, &mousex, &mousey, &mask); - if ((mousex = (int) ((mousex - screen->border) / TekScale(tekscr))) < 0) + if ((mousex = (int) ((mousex - BorderOf(tw)) / ScaleOf(tw))) < 0) mousex = 0; else if (mousex >= TEKWIDTH) mousex = TEKWIDTH - 1; - if ((mousey = (int) (TEKHEIGHT + TEKTOPPAD - (mousey - screen->border) / - TekScale(tekscr))) < 0) + if ((mousey = (int) BottomY((mousey - BorderOf(tw)) / ScaleOf(tw))) < 0) mousey = 0; else if (mousey >= TEKHEIGHT) mousey = TEKHEIGHT - 1; @@ -1263,8 +1315,7 @@ TekEnq(TekWidget tw, int x, int y) { - XtermWidget xw = term; - TScreen *screen = TScreenOf(xw); + TScreen *screen = TScreenOf(tw->vt); TekScreen *tekscr = TekScreenOf(tw); Char cplot[7]; int len = 5; @@ -1357,24 +1408,43 @@ static _Xconst char *dashes[TEKNUMLINES] = }; /* - * The following is called to create the tekWidget + * The following functions are called to initialize and realize the tekWidget */ - static void TekInitialize(Widget wrequest, Widget new_arg, ArgList args GCC_UNUSED, Cardinal *num_args GCC_UNUSED) { + XtermWidget xw = term; + TScreen *vtscr = TScreenOf(xw); + TekWidget request = (TekWidget) wrequest; TekWidget wnew = (TekWidget) new_arg; + Widget tekparent = SHELL_OF(wnew); -#ifndef NO_ACTIVE_ICON - TekScreen *screen = TekScreenOf((TekWidget) wnew); -#endif - int n; + TekScreen *tekscr = TekScreenOf((TekWidget) wnew); - TRACE(("TekInitialize\n")); + int i; + int border; + int pr; + int winX, winY; + unsigned min_width, min_height; + unsigned width, height; + char Tdefault[32]; + + (void) args; + (void) num_args; + + TRACE(("TekInitialize {{\n")); + memset(tekscr, 0, sizeof(*tekscr)); + + /* + * Eliminate 'term' as global from other functions. + */ + wnew->vt = xw; + border = 2 * BorderOf(wnew); + TRACE(("... border*2: %d\n", border)); /* look for focus related events on the shell, because we need * to care about the shell's border being part of our focus. @@ -1389,80 +1459,50 @@ TekInitialize(Widget wrequest, HandleBellPropertyChange, (Opaque) 0); #ifndef NO_ACTIVE_ICON