xterm: Changes to 'upstream-unstable'
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
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
69 files changed, 8897 insertions(+), 4714 deletions(-)
New commits:
commit fc9f89a55e3f9e29cf4c9e024b6870cfaa9586a1
Author: Sven Joachim <svenjoac@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�Minier
@@ -126,6 +129,7 @@ Matthias Baake
Matthias Scheler
Matthieu Herrb
Matthieu Lagouge
+Mattias Engdeg�
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�e
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
- screen->whichTwin = &(screen->fullTwin);
+ tekscr->whichTwin = &(tekscr->fullTwin);
#endif /* NO_ACTIVE_ICON */
- for (n = 0; n < TEKNUMFONTS; ++n) {
- wnew->tek.Tfont[n] = request->tek.Tfont[n];
- }
-
init_Sres(tek.initial_font);
init_Sres(tek.gin_terminator_str);
#if OPT_TOOLBAR
init_Ires(tek.tb_info.menu_height);
wnew->tek.tb_info.menu_bar = request->tek.tb_info.menu_bar;
#endif
-}
-
-static void
-TekRealize(Widget gw,
- XtValueMask * valuemaskp,
- XSetWindowAttributes * values)
-{
- XtermWidget xw = term;
- TScreen *screen = TScreenOf(xw);
- TekWidget tw = (TekWidget) gw;
- TekScreen *tekscr = TekScreenOf(tw);
- int i;
- TekLink *tek;
- double d;
- int border = 2 * screen->border;
- int pr;
- XGCValues gcv;
- int winX, winY;
- unsigned width, height;
- char Tdefault[32];
- unsigned long TEKgcFontMask;
-
- TRACE(("TekRealize\n"));
- memset(tekscr, 0, sizeof(*tekscr));
-
-#ifndef NO_ACTIVE_ICON
- tekscr->whichTwin = &tekscr->fullTwin;
-#endif /* NO_ACTIVE_ICON */
- BorderPixel(tw) = BorderPixel(xw);
+ BorderPixel(wnew) = BorderPixel(xw);
tekscr->arrow = make_colored_cursor(XC_left_ptr,
- T_COLOR(screen, MOUSE_FG),
- T_COLOR(screen, MOUSE_BG));
+ T_COLOR(vtscr, MOUSE_FG),
+ T_COLOR(vtscr, MOUSE_BG));
for (i = 0; i < TEKNUMFONTS; i++) {
- if (!tw->tek.Tfont[i]) {
- tw->tek.Tfont[i] = XQueryFont(XtDisplay(tw), DefaultGCID);
+ if (!wnew->tek.Tfont[i]) {
+ wnew->tek.Tfont[i] = XQueryFont(XtDisplay(wnew), DefaultGCID(wnew));
+ }
+ if (wnew->tek.Tfont[i]) {
+ TRACE(("Tfont[%d] %dx%d\n",
+ i,
+ wnew->tek.Tfont[i]->max_bounds.width,
+ wnew->tek.Tfont[i]->ascent +
+ wnew->tek.Tfont[i]->descent));
+ wnew->tek.tobaseline[i] = wnew->tek.Tfont[i]->ascent;
+ } else {
+ TRACE(("Tfont[%d] disabled\n", i));
+ SetItemSensitivity(tekMenuEntries[i].widget, False);
}
- TRACE(("Tfont[%d] %dx%d\n",
- i,
- tw->tek.Tfont[i]->ascent +
- tw->tek.Tfont[i]->descent,
- tw->tek.Tfont[i]->max_bounds.width));
- tw->tek.tobaseline[i] = tw->tek.Tfont[i]->ascent;
}
- if (!TekPtyData())
- return;
-
if (xw->misc.T_geometry == NULL) {
- int defwidth, defheight;
+ int def_width, def_height;
if (xw->misc.tekSmall) {
- defwidth = TEKMINWIDTH;
- defheight = TEKMINHEIGHT;
+ def_width = TEKMINWIDTH;
+ def_height = TEKMINHEIGHT;
} else {
- defwidth = TEKDEFWIDTH;
- defheight = TEKDEFHEIGHT;
+ def_width = TEKDEFWIDTH;
+ def_height = TEKDEFHEIGHT;
}
- sprintf(Tdefault, "=%dx%d", defwidth + border, defheight + border);
+ sprintf(Tdefault, "=%dx%d", def_width + border, def_height + border);
xw->misc.T_geometry = Tdefault;
}
@@ -1470,6 +1510,8 @@ TekRealize(Widget gw,
winY = 1;
width = (unsigned) (TEKDEFWIDTH + border);
height = (unsigned) (TEKDEFHEIGHT + border);
+ min_width = (unsigned) (TEKMINWIDTH + border);
+ min_height = (unsigned) (TEKMINHEIGHT + border);
TRACE(("parsing T_geometry %s\n", NonNull(xw->misc.T_geometry)));
pr = XParseGeometry(xw->misc.T_geometry,
@@ -1477,49 +1519,113 @@ TekRealize(Widget gw,
&winY,
&width,
&height);
+
+ /* window-manager hints will do this anyway... */
+ if (height < min_height) {
+ TRACE(("... override height from %d to %d\n", height, min_height));
+ height = min_height;
+ }
+ if (width < min_width) {
+ TRACE(("... override width from %d to %d\n", width, min_width));
+ width = min_width;
+ }
+
TRACE(("... position %d,%d size %dx%d\n", winY, winX, height, width));
- if ((pr & XValue) && (pr & XNegative))
- winX += DisplayWidth(XtDisplay(tw), DefaultScreen(XtDisplay(tw)))
+ if ((pr & XValue) && (pr & XNegative)) {
+ winX += DisplayWidth(XtDisplay(wnew), DefaultScreen(XtDisplay(wnew)))
- (int) width - (BorderWidth(SHELL_OF(xw)) * 2);
- if ((pr & YValue) && (pr & YNegative))
- winY += DisplayHeight(XtDisplay(tw), DefaultScreen(XtDisplay(tw)))
+ }
+ if ((pr & YValue) && (pr & YNegative)) {
+ winY += DisplayHeight(XtDisplay(wnew), DefaultScreen(XtDisplay(wnew)))
- (int) height - (BorderWidth(SHELL_OF(xw)) * 2);
+ }
/* set up size hints */
- tw->hints.min_width = TEKMINWIDTH + border;
- tw->hints.min_height = TEKMINHEIGHT + border;
- tw->hints.width_inc = 1;
- tw->hints.height_inc = 1;
- tw->hints.flags = PMinSize | PResizeInc;
- tw->hints.x = winX;
- tw->hints.y = winY;
+
+ /* *INDENT-EQLS* */
+ wnew->hints.min_width = (int) min_width;
+ wnew->hints.min_height = (int) min_height;
+ wnew->hints.width_inc = 1;
+ wnew->hints.height_inc = 1;
+ wnew->hints.flags = PMinSize | PResizeInc;
+ wnew->hints.x = winX;
+ wnew->hints.y = winY;
+
if ((XValue & pr) || (YValue & pr)) {
- tw->hints.flags |= USSize | USPosition;
- tw->hints.flags |= PWinGravity;
+ wnew->hints.flags |= USSize | USPosition;
+ wnew->hints.flags |= PWinGravity;
switch (pr & (XNegative | YNegative)) {
case 0:
- tw->hints.win_gravity = NorthWestGravity;
+ wnew->hints.win_gravity = NorthWestGravity;
break;
case XNegative:
- tw->hints.win_gravity = NorthEastGravity;
+ wnew->hints.win_gravity = NorthEastGravity;
break;
case YNegative:
- tw->hints.win_gravity = SouthWestGravity;
+ wnew->hints.win_gravity = SouthWestGravity;
break;
default:
- tw->hints.win_gravity = SouthEastGravity;
+ wnew->hints.win_gravity = SouthEastGravity;
break;
}
} else {
/* set a default size, but do *not* set position */
- tw->hints.flags |= PSize;
+ wnew->hints.flags |= PSize;
}
- tw->hints.width = (int) width;
- tw->hints.height = (int) height;
+ wnew->hints.width = (int) width;
+ wnew->hints.height = (int) height;
if ((WidthValue & pr) || (HeightValue & pr))
- tw->hints.flags |= USSize;
+ wnew->hints.flags |= USSize;
else
- tw->hints.flags |= PSize;
+ wnew->hints.flags |= PSize;
+
+ tekscr->cur.fontsize = TEK_FONT_LARGE;
+ if (wnew->tek.initial_font) {
+ int result = TekGetFontSize(wnew->tek.initial_font);
+ if (result >= 0)
+ tekscr->cur.fontsize = result;
+ }
+ TRACE(("Tek cur.fontsize=%d\n", tekscr->cur.fontsize));
+
+#define TestGIN(s) XmuCompareISOLatin1(wnew->tek.gin_terminator_str, s)
+
+ if (TestGIN(GIN_TERM_NONE_STR) == 0)
Reply to: