summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/xterm/INSTALL24
-rw-r--r--app/xterm/MANIFEST3
-rw-r--r--app/xterm/Tekproc.c207
-rw-r--r--app/xterm/VTPrsTbl.c4
-rw-r--r--app/xterm/VTparse.def4
-rw-r--r--app/xterm/VTparse.h4
-rw-r--r--app/xterm/XTerm.ad8
-rw-r--r--app/xterm/button.c14
-rw-r--r--app/xterm/charproc.c488
-rw-r--r--app/xterm/configure.in17
-rw-r--r--app/xterm/ctlseqs.ms10
-rw-r--r--app/xterm/ctlseqs.txt4
-rw-r--r--app/xterm/doublechr.c4
-rw-r--r--app/xterm/error.h3
-rw-r--r--app/xterm/fontutils.c31
-rw-r--r--app/xterm/fontutils.h4
-rw-r--r--app/xterm/input.c8
-rw-r--r--app/xterm/main.c161
-rw-r--r--app/xterm/main.h10
-rw-r--r--app/xterm/menu.c142
-rw-r--r--app/xterm/misc.c174
-rw-r--r--app/xterm/os2main.c24
-rw-r--r--app/xterm/plink.sh6
-rw-r--r--app/xterm/print.c8
-rw-r--r--app/xterm/ptydata.c17
-rw-r--r--app/xterm/ptyx.h34
-rw-r--r--app/xterm/resize.c21
-rw-r--r--app/xterm/screen.c83
-rw-r--r--app/xterm/scrollbar.c37
-rw-r--r--app/xterm/trace.c96
-rw-r--r--app/xterm/trace.h9
-rw-r--r--app/xterm/util.c30
-rw-r--r--app/xterm/uxterm.desktop4
-rw-r--r--app/xterm/version.h4
-rw-r--r--app/xterm/vms.c4
-rw-r--r--app/xterm/vttests/query-fonts.pl166
-rw-r--r--app/xterm/xterm.desktop4
-rw-r--r--app/xterm/xterm.h20
-rw-r--r--app/xterm/xterm.log.html97
-rw-r--r--app/xterm/xterm.man197
-rw-r--r--app/xterm/xterm_io.h10
-rw-r--r--app/xterm/xtermcap.c8
42 files changed, 1433 insertions, 770 deletions
diff --git a/app/xterm/INSTALL b/app/xterm/INSTALL
index d2afa33d2..4f1cd8c79 100644
--- a/app/xterm/INSTALL
+++ b/app/xterm/INSTALL
@@ -1,4 +1,4 @@
--- $XTermId: INSTALL,v 1.122 2010/04/14 10:56:29 tom Exp $
+-- $XTermId: INSTALL,v 1.123 2010/06/14 08:57:22 tom Exp $
-------------------------------------------------------------------------------
-- Copyright 1997-2009,2010 by Thomas E. Dickey
--
@@ -105,6 +105,19 @@ The options (in alphabetic order):
e.g., to make boxes. When xterm loads a font, it checks if those
characters are present, and draws its own if they are missing.
+ --disable-broken-st disallow broken string-terminators],
+
+ Do not compile-in code that works around a bug in some ISDN routers
+ (and possibly other applications written by the same people): they
+ send an unterminated control string in their banner text, making xterm
+ freeze.
+
+ The workaround tells xterm to stop processing the control string when
+ it receives one of the whitespace control characters such as newline.
+ That was the behavior before patch #171.
+
+ See also --enable-broken-osc
+
--disable-c1-print disallow -k8 option for printable 128-159],
Use this option to suppress support for nonstandard use of codes
@@ -344,15 +357,6 @@ The options (in alphabetic order):
appear to freeze. This workaround makes xterm ignore the strings,
and is compiled-in by default for Linux.
- --enable-broken-st allow broken string-terminators],
-
- Compile-in code that works around a bug in some ISDN routers (and
- possibly other applications written by the same people): they send an
- unterminated control string in their banner text, making xterm freeze.
- The workaround tells xterm to stop processing the control string when
- it receives one of the whitespace control characters such as newline.
- That was the behavior before patch #171.
-
--enable-dabbrev enable dynamic-abbreviation support
Compile-in support for "dabbrev-expand()" action and related key
diff --git a/app/xterm/MANIFEST b/app/xterm/MANIFEST
index 262de0b44..e956b9a32 100644
--- a/app/xterm/MANIFEST
+++ b/app/xterm/MANIFEST
@@ -1,4 +1,4 @@
-MANIFEST for xterm-258, version xterm-258
+MANIFEST for xterm-260, version xterm-260
--------------------------------------------------------------------------------
MANIFEST this file
256colres.h resource-definitions for 256-color mode
@@ -144,6 +144,7 @@ vttests/dynamic.sh script to illustrate the dynamic colors control
vttests/dynamic2.sh complete example of dynamic colors
vttests/fonts.sh script to demonstrate font-switching sequences
vttests/paste64.pl script to test base64-selection option
+vttests/query-fonts.pl script to demo/test font-querying
vttests/resize.pl translated resize.sh to perl since it is easy to test, and I needed
vttests/resize.sh script to demonstrate resizing
vttests/tcapquery.pl script to test tcap-query option
diff --git a/app/xterm/Tekproc.c b/app/xterm/Tekproc.c
index b84535ccf..ebfb03c58 100644
--- a/app/xterm/Tekproc.c
+++ b/app/xterm/Tekproc.c
@@ -1,61 +1,57 @@
-/* $XTermId: Tekproc.c,v 1.176 2010/04/18 16:22:54 tom Exp $ */
+/* $XTermId: Tekproc.c,v 1.182 2010/06/20 21:34:37 tom Exp $ */
/*
- * Warning, there be crufty dragons here.
- */
-
-/*
-
-Copyright 2001-2008,2009 by Thomas E. Dickey
-
- All Rights Reserved
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name(s) of the above copyright
-holders shall not be used in advertising or otherwise to promote the
-sale, use or other dealings in this Software without prior written
-authorization.
-
-Copyright 1988 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
+ *
+ * Copyright 2001-2009,2010 by Thomas E. Dickey
+ *
+ * All Rights Reserved
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the
+ * sale, use or other dealings in this Software without prior written
+ * authorization.
+ *
+ * Copyright 1988 The Open Group
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation.
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of The Open Group shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from The Open Group.
+ *
* Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
*
* All Rights Reserved
@@ -103,6 +99,7 @@ in this Software without prior written authorization from The Open Group.
#endif /* OPT_TOOLBAR */
+#include <assert.h>
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
@@ -413,7 +410,8 @@ TekPtyData(void)
static void
Tekparse(TekWidget tw)
{
- TScreen *screen = TScreenOf(term);
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
TekScreen *tekscr = TekScreenOf(tw);
int x, y;
IChar c = 0;
@@ -457,7 +455,7 @@ Tekparse(TekWidget tw)
TRACE(("case: special return to vt102 mode\n"));
Tparsestate = curstate;
TekRecord->ptr[-1] = ANSI_NAK; /* remove from recording */
- FlushLog(TScreenOf(term));
+ FlushLog(xw);
return;
case CASE_SPT_STATE:
@@ -486,7 +484,7 @@ Tekparse(TekWidget tw)
if (tekscr->TekGIN)
TekGINoff(tw);
if (!tekRefreshList)
- Bell(XkbBI_TerminalBell, 0);
+ Bell(xw, XkbBI_TerminalBell, 0);
Tparsestate = curstate; /* clear bypass condition */
break;
@@ -707,7 +705,6 @@ Tekparse(TekWidget tw)
case CASE_PRINT:
TRACE(("case: printable character\n"));
ch = c;
- c = (IChar) tekscr->cur.fontsize;
x = (int) (tekscr->cur_X * TekScale(tekscr))
+ screen->border;
y = (int) ((TEKHEIGHT + TEKTOPPAD - tekscr->cur_Y) * TekScale(tekscr))
@@ -764,7 +761,7 @@ Tekparse(TekWidget tw)
buf2[len] = 0;
if (!nested++) {
if (c2 == ANSI_BEL)
- do_osc(term, buf2, len, ANSI_BEL);
+ do_osc(xw, buf2, len, ANSI_BEL);
}
--nested;
}
@@ -781,8 +778,9 @@ static PtySelect Tselect_mask;
static IChar
Tinput(TekWidget tw)
{
+ XtermWidget xw = term;
TekScreen *tekscr = TekScreenOf(tw);
- TScreen *screen = TScreenOf(term);
+ TScreen *screen = TScreenOf(xw);
TekLink *tek;
if (Tpushback > Tpushb)
@@ -820,7 +818,7 @@ Tinput(TekWidget tw)
&Tselect_mask, NULL, NULL,
&crocktimeout);
#endif
- if (readPtyData(screen, &Tselect_mask, VTbuffer)) {
+ if (readPtyData(xw, &Tselect_mask, VTbuffer)) {
break;
}
if (Ttoggled && curstate == Talptable) {
@@ -871,13 +869,15 @@ Tinput(TekWidget tw)
tek = TekRecord;
if (tek->count >= TEK_LINK_BLOCK_SIZE
|| tek->fontsize != tekscr->cur.fontsize) {
- if ((TekRecord = tek->next = CastMalloc(TekLink)) == 0)
+ if ((TekRecord = tek->next = CastMalloc(TekLink)) == 0) {
Panic("Tinput: malloc error (%d)\n", errno);
- tek = tek->next;
- tek->next = (TekLink *) 0;
- tek->fontsize = (unsigned short) tekscr->cur.fontsize;
- tek->count = 0;
- tek->ptr = tek->data;
+ } else {
+ tek = tek->next;
+ tek->next = (TekLink *) 0;
+ tek->fontsize = (unsigned short) tekscr->cur.fontsize;
+ tek->count = 0;
+ tek->ptr = tek->data;
+ }
}
tek->count++;
@@ -900,8 +900,9 @@ TekConfigure(Widget w)
{
TekWidget tw = getTekWidget(w);
if (tw != 0) {
+ XtermWidget xw = term;
TekScreen *tekscr = TekScreenOf(tw);
- TScreen *screen = TScreenOf(term);
+ TScreen *screen = TScreenOf(xw);
int border = 2 * screen->border;
double d;
@@ -961,8 +962,9 @@ void
TekRefresh(TekWidget tw)
{
if (tw != 0) {
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
TekScreen *tekscr = TekScreenOf(tw);
- TScreen *screen = TScreenOf(term);
static Cursor wait_cursor = None;
if (wait_cursor == None)
@@ -1156,8 +1158,9 @@ 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);
- TScreen *screen = TScreenOf(term);
XSegment *lp;
TRACE(("AddToDraw (%d,%d) (%d,%d)\n", x1, y1, x2, y2));
@@ -1227,8 +1230,9 @@ TekGINoff(TekWidget tw)
void
TekEnqMouse(TekWidget tw, int c) /* character pressed */
{
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
TekScreen *tekscr = TekScreenOf(tw);
- TScreen *screen = TScreenOf(term);
int mousex, mousey, rootx, rooty;
unsigned int mask; /* XQueryPointer */
Window root, subw;
@@ -1258,8 +1262,9 @@ TekEnq(TekWidget tw,
int x,
int y)
{
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
TekScreen *tekscr = TekScreenOf(tw);
- TScreen *screen = TScreenOf(term);
Char cplot[7];
int len = 5;
int adj = (status != 0) ? 0 : 1;
@@ -1286,13 +1291,16 @@ TekEnq(TekWidget tw,
void
TekRun(void)
{
+ XtermWidget xw = term;
+
+ assert(xw != 0);
if (tekWidget == 0) {
TekInit();
}
if (tekWidget != 0) {
TRACE(("TekRun ...\n"));
- if (!TEK4014_SHOWN(term)) {
+ if (!TEK4014_SHOWN(xw)) {
set_tek_visibility(True);
}
update_vttekmode();
@@ -1308,10 +1316,10 @@ TekRun(void)
TCursorToggle(tekWidget, TOGGLE);
Ttoggled = True;
}
- TEK4014_ACTIVE(term) = False;
+ TEK4014_ACTIVE(xw) = False;
} else {
- TEK4014_ACTIVE(term) = False;
- if (VWindow(TScreenOf(term)) == 0) {
+ TEK4014_ACTIVE(xw) = False;
+ if (VWindow(TScreenOf(xw)) == 0) {
Exit(ERROR_TINIT);
}
}
@@ -1387,9 +1395,10 @@ TekRealize(Widget gw,
XtValueMask * valuemaskp,
XSetWindowAttributes * values)
{
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
TekWidget tw = (TekWidget) gw;
TekScreen *tekscr = TekScreenOf(tw);
- TScreen *screen = TScreenOf(term);
int i;
TekLink *tek;
double d;
@@ -1408,7 +1417,7 @@ TekRealize(Widget gw,
tekscr->whichTwin = &tekscr->fullTwin;
#endif /* NO_ACTIVE_ICON */
- BorderPixel(tw) = BorderPixel(term);
+ BorderPixel(tw) = BorderPixel(xw);
tekscr->arrow = make_colored_cursor(XC_left_ptr,
T_COLOR(screen, MOUSE_FG),
@@ -1429,10 +1438,10 @@ TekRealize(Widget gw,
if (!TekPtyData())
return;
- if (term->misc.T_geometry == NULL) {
+ if (xw->misc.T_geometry == NULL) {
int defwidth, defheight;
- if (term->misc.tekSmall) {
+ if (xw->misc.tekSmall) {
defwidth = TEKMINWIDTH;
defheight = TEKMINHEIGHT;
} else {
@@ -1440,7 +1449,7 @@ TekRealize(Widget gw,
defheight = TEKDEFHEIGHT;
}
sprintf(Tdefault, "=%dx%d", defwidth + border, defheight + border);
- term->misc.T_geometry = Tdefault;
+ xw->misc.T_geometry = Tdefault;
}
winX = 1;
@@ -1448,8 +1457,8 @@ TekRealize(Widget gw,
width = (unsigned) (TEKDEFWIDTH + border);
height = (unsigned) (TEKDEFHEIGHT + border);
- TRACE(("parsing T_geometry %s\n", NonNull(term->misc.T_geometry)));
- pr = XParseGeometry(term->misc.T_geometry,
+ TRACE(("parsing T_geometry %s\n", NonNull(xw->misc.T_geometry)));
+ pr = XParseGeometry(xw->misc.T_geometry,
&winX,
&winY,
&width,
@@ -1457,10 +1466,10 @@ TekRealize(Widget gw,
TRACE(("... position %d,%d size %dx%d\n", winY, winX, height, width));
if ((pr & XValue) && (pr & XNegative))
winX += DisplayWidth(XtDisplay(tw), DefaultScreen(XtDisplay(tw)))
- - (int) width - (BorderWidth(SHELL_OF(term)) * 2);
+ - (int) width - (BorderWidth(SHELL_OF(xw)) * 2);
if ((pr & YValue) && (pr & YNegative))
winY += DisplayHeight(XtDisplay(tw), DefaultScreen(XtDisplay(tw)))
- - (int) height - (BorderWidth(SHELL_OF(term)) * 2);
+ - (int) height - (BorderWidth(SHELL_OF(xw)) * 2);
/* set up size hints */
tw->hints.min_width = TEKMINWIDTH + border;
@@ -1657,6 +1666,7 @@ void
TekSetFontSize(TekWidget tw, Bool fromMenu, int newitem)
{
if (tw != 0) {
+ XtermWidget xw = term;
TekScreen *tekscr = TekScreenOf(tw);
int oldsize = tekscr->cur.fontsize;
int newsize = MI2FS(newitem);
@@ -1664,7 +1674,7 @@ TekSetFontSize(TekWidget tw, Bool fromMenu, int newitem)
TRACE(("TekSetFontSize(%d) size %d ->%d\n", newitem, oldsize, newsize));
if (newsize < 0 || newsize >= TEKNUMFONTS) {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
} else if (oldsize != newsize) {
if (!Ttoggled)
TCursorToggle(tw, TOGGLE);
@@ -1753,7 +1763,8 @@ ChangeTekColors(TekWidget tw, TScreen * screen, ScrnColors * pNew)
void
TekReverseVideo(TekWidget tw)
{
- TScreen *screen = TScreenOf(term);
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
TekScreen *tekscr = TekScreenOf(tw);
int i;
Pixel tmp;
@@ -1804,12 +1815,13 @@ TekBackground(TekWidget tw, TScreen * screen)
void
TCursorToggle(TekWidget tw, int toggle) /* TOGGLE or CLEAR */
{
+ XtermWidget xw = term;
TekScreen *tekscr = TekScreenOf(tw);
- TScreen *screen = TScreenOf(term);
+ TScreen *screen = TScreenOf(xw);
int c, x, y;
unsigned int cellwidth, cellheight;
- if (!TEK4014_SHOWN(term))
+ if (!TEK4014_SHOWN(xw))
return;
TRACE(("TCursorToggle %s\n", (toggle == TOGGLE) ? "toggle" : "clear"));
@@ -1866,8 +1878,9 @@ void
TekCopy(TekWidget tw)
{
if (tw != 0) {
+ XtermWidget xw = term;
TekScreen *tekscr = TekScreenOf(tw);
- TScreen *screen = TScreenOf(term);
+ TScreen *screen = TScreenOf(xw);
TekLink *Tp;
char buf[32];
@@ -1877,12 +1890,12 @@ TekCopy(TekWidget tw)
timestamp_filename(buf, "COPY");
if (access(buf, F_OK) >= 0
&& access(buf, W_OK) < 0) {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
return;
}
#ifndef VMS
if (access(".", W_OK) < 0) { /* can't write in directory */
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
return;
}
#endif
@@ -1910,7 +1923,9 @@ HandleGINInput(Widget w,
String * param_list,
Cardinal *nparamsp)
{
+ XtermWidget xw = term;
TekWidget tw = getTekWidget(w);
+
if (tw != 0) {
TekScreen *tekscr = TekScreenOf(tw);
@@ -1925,13 +1940,13 @@ HandleGINInput(Widget w,
case 'R':
break;
default:
- Bell(XkbBI_MinorError, 0); /* let them know they goofed */
+ Bell(xw, XkbBI_MinorError, 0); /* let them know they goofed */
c = 'l'; /* provide a default */
}
TekEnqMouse(tw, c | 0x80);
TekGINoff(tw);
} else {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
}
}
diff --git a/app/xterm/VTPrsTbl.c b/app/xterm/VTPrsTbl.c
index 095b3c19d..4ab970158 100644
--- a/app/xterm/VTPrsTbl.c
+++ b/app/xterm/VTPrsTbl.c
@@ -1,8 +1,8 @@
-/* $XTermId: VTPrsTbl.c,v 1.57 2010/04/10 00:19:56 tom Exp $ */
+/* $XTermId: VTPrsTbl.c,v 1.58 2010/06/15 10:58:13 tom Exp $ */
/*
*
- * Copyright 1999-2008,2009 by Thomas E. Dickey
+ * Copyright 1999-2009,2010 by Thomas E. Dickey
*
* All Rights Reserved
*
diff --git a/app/xterm/VTparse.def b/app/xterm/VTparse.def
index 8e8d629cb..a62f153cc 100644
--- a/app/xterm/VTparse.def
+++ b/app/xterm/VTparse.def
@@ -1,10 +1,10 @@
-# $XTermId: VTparse.def,v 1.38 2010/04/09 10:47:24 tom Exp $
+# $XTermId: VTparse.def,v 1.39 2010/06/15 10:58:13 tom Exp $
#
# vile:confmode rs=lf
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 1996-2008,2009 by Thomas E. Dickey
+# Copyright 1996-2009,2010 by Thomas E. Dickey
#
# All Rights Reserved
#
diff --git a/app/xterm/VTparse.h b/app/xterm/VTparse.h
index 0fd5110c1..162d13c6f 100644
--- a/app/xterm/VTparse.h
+++ b/app/xterm/VTparse.h
@@ -1,7 +1,7 @@
-/* $XTermId: VTparse.h,v 1.51 2010/04/09 22:29:17 tom Exp $ */
+/* $XTermId: VTparse.h,v 1.52 2010/06/15 10:58:13 tom Exp $ */
/*
- * Copyright 2002-2008,2009 by Thomas E. Dickey
+ * Copyright 2002-2009,2010 by Thomas E. Dickey
*
* All Rights Reserved
*
diff --git a/app/xterm/XTerm.ad b/app/xterm/XTerm.ad
index d573f0880..ffbb0e2cb 100644
--- a/app/xterm/XTerm.ad
+++ b/app/xterm/XTerm.ad
@@ -1,4 +1,4 @@
-! $XTermId: XTerm.ad,v 1.92 2010/01/04 22:16:17 tom Exp $
+! $XTermId: XTerm.ad,v 1.93 2010/06/15 10:55:59 tom Exp $
! -----------------------------------------------------------------------------
! this file is part of xterm
!
@@ -221,6 +221,12 @@
! vt100 widget:
*SimpleMenu*borderWidth: 2
+! xterm can switch at runtime between bitmap (default) and TrueType fonts.
+! The "faceSize" resource controls the size of the latter. However, it was
+! originally given with a size that makes the two types of fonts different
+! sizes. Uncomment this line to use the same size as "fixed".
+!*faceSize: 8
+
! Here is a pattern that is useful for double-clicking on a URL:
!*charClass: 33:48,35:48,37-38:48,43-47:48,58:48,61:48,63-64:48,95:48,126:48
!
diff --git a/app/xterm/button.c b/app/xterm/button.c
index 2976538c9..67b50d42e 100644
--- a/app/xterm/button.c
+++ b/app/xterm/button.c
@@ -1,4 +1,4 @@
-/* $XTermId: button.c,v 1.375 2010/04/18 17:48:58 tom Exp $ */
+/* $XTermId: button.c,v 1.377 2010/06/04 09:27:07 tom Exp $ */
/*
* Copyright 1999-2009,2010 by Thomas E. Dickey
@@ -797,7 +797,7 @@ ReadLineMovePoint(TScreen * screen, int col, int ldelta)
line[count++] = ANSI_ESC;
line[count++] = '['; /* XXX maybe sometimes O is better? */
}
- line[count++] = CharOf(col > 0 ? 'C' : 'D');
+ line[count] = CharOf(col > 0 ? 'C' : 'D');
if (col < 0)
col = -col;
while (col--)
@@ -1185,7 +1185,7 @@ xtermUtf8ToTextList(XtermWidget xw,
for (i = 0; i < *text_list_count; ++i) {
data = (Char *) (*text_list)[i];
size = strlen((*text_list)[i]) + 1;
- data = UTF8toLatin1(screen, data, size, &size);
+ (void) UTF8toLatin1(screen, data, size, &size);
new_size += size + 1;
}
new_text_list =
@@ -3395,9 +3395,11 @@ AppendStrToSelectionBuffer(TScreen * screen, Char * text, size_t len)
}
screen->selection_size = k;
}
- memcpy(screen->selection_data + screen->selection_length, text, len);
- screen->selection_length += len;
- screen->selection_data[screen->selection_length] = 0;
+ if (screen->selection_data != 0) {
+ memcpy(screen->selection_data + screen->selection_length, text, len);
+ screen->selection_length += len;
+ screen->selection_data[screen->selection_length] = 0;
+ }
}
}
diff --git a/app/xterm/charproc.c b/app/xterm/charproc.c
index b996ac412..b75a09381 100644
--- a/app/xterm/charproc.c
+++ b/app/xterm/charproc.c
@@ -1,4 +1,4 @@
-/* $XTermId: charproc.c,v 1.1055 2010/04/18 17:48:58 tom Exp $ */
+/* $XTermId: charproc.c,v 1.1071 2010/06/28 09:03:42 tom Exp $ */
/*
@@ -216,7 +216,7 @@ static void HandleStructNotify PROTO_XT_EV_HANDLER_ARGS;
#endif
#endif
-static char *_Font_Selected_ = "yes"; /* string is arbitrary */
+static String _Font_Selected_ = "yes"; /* string is arbitrary */
static char defaultTranslations[] =
"\
@@ -727,7 +727,7 @@ static XtResource xterm_resources[] =
#endif
#if OPT_SCROLL_LOCK
- Bres(XtNallowScrollLock, XtCAllowScrollLock, screen.allowScrollLock0, True),
+ Bres(XtNallowScrollLock, XtCAllowScrollLock, screen.allowScrollLock0, False),
#endif
#if OPT_XMC_GLITCH
@@ -752,7 +752,7 @@ static XtResource xterm_resources[] =
Dres(XtNfaceSize, XtCFaceSize, misc.face_size[0], DEFFACESIZE),
Sres(XtNfaceName, XtCFaceName, misc.face_name, DEFFACENAME),
Sres(XtNfaceNameDoublesize, XtCFaceNameDoublesize, misc.face_wide_name, DEFFACENAME),
- Bres(XtNrenderFont, XtCRenderFont, misc.render_font, True),
+ Sres(XtNrenderFont, XtCRenderFont, misc.render_font_s, "default"),
#endif
};
@@ -1347,6 +1347,22 @@ one_if_default(int which)
return result;
}
+#if OPT_C1_PRINT || OPT_WIDE_CHARS
+#define ParseSOS(screen) ((screen)->c1_printable == 0)
+#else
+#define ParseSOS(screen) 0
+#endif
+
+#define ResetState(sp) (sp)->parsestate = (sp)->groundtable
+
+static void
+illegal_parse(XtermWidget xw, unsigned c, struct ParseState *sp)
+{
+ ResetState(sp);
+ sp->nextstate = sp->parsestate[E2A(c)];
+ Bell(xw, XkbBI_MinorError, 0);
+}
+
static Boolean
doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
{
@@ -1487,8 +1503,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
break;
/* FALLTHRU */
case 'R':
- sp->parsestate = sp->groundtable;
- sp->nextstate = sp->parsestate[E2A(c)];
+ illegal_parse(xw, c, sp);
TRACE(("Reset to ground state (brokenLinuxOSC)\n"));
break;
}
@@ -1507,18 +1522,18 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
&& sp->parsestate == sos_table
&& c < 32) {
switch (c) {
- case 5: /* FALLTHRU */
- case 8: /* FALLTHRU */
- case 9: /* FALLTHRU */
- case 10: /* FALLTHRU */
- case 11: /* FALLTHRU */
- case 12: /* FALLTHRU */
- case 13: /* FALLTHRU */
- case 14: /* FALLTHRU */
- case 15: /* FALLTHRU */
- case 24:
- sp->parsestate = sp->groundtable;
- sp->nextstate = sp->parsestate[E2A(c)];
+ case ANSI_EOT: /* FALLTHRU */
+ case ANSI_BS: /* FALLTHRU */
+ case ANSI_HT: /* FALLTHRU */
+ case ANSI_LF: /* FALLTHRU */
+ case ANSI_VT: /* FALLTHRU */
+ case ANSI_FF: /* FALLTHRU */
+ case ANSI_CR: /* FALLTHRU */
+ case ANSI_SO: /* FALLTHRU */
+ case ANSI_SI: /* FALLTHRU */
+ case ANSI_XON: /* FALLTHRU */
+ case ANSI_CAN:
+ illegal_parse(xw, c, sp);
TRACE(("Reset to ground state (brokenStringTerm)\n"));
break;
}
@@ -1645,7 +1660,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_GROUND_STATE:
TRACE(("CASE_GROUND_STATE - exit ignore mode\n"));
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_IGNORE:
@@ -1665,10 +1680,10 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if (sp->string_used)
sp->string_area[--(sp->string_used)] = '\0';
do_osc(xw, sp->string_area, sp->string_used, (int) c);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
} else {
/* bell */
- Bell(XkbBI_TerminalBell, 0);
+ Bell(xw, XkbBI_TerminalBell, 0);
}
break;
@@ -1721,7 +1736,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
count = 1;
while ((count-- > 0)
&& (TabToPrevStop(xw))) ;
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_CHT:
@@ -1730,7 +1745,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
count = 1;
while ((count-- > 0)
&& (TabToNextStop(xw))) ;
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_TAB:
@@ -1741,30 +1756,30 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_SI:
screen->curgl = 0;
if_OPT_VT52_MODE(screen, {
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
});
break;
case CASE_SO:
screen->curgl = 1;
if_OPT_VT52_MODE(screen, {
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
});
break;
case CASE_DECDHL:
xterm_DECDHL(xw, c == '3');
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECSWL:
xterm_DECSWL(xw);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECDWL:
xterm_DECDWL(xw);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_SCR_STATE:
@@ -1853,7 +1868,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if ((row = param[0]) < 1)
row = 1;
InsertChar(xw, (unsigned) row);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_CUU:
@@ -1861,7 +1876,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if ((row = param[0]) < 1)
row = 1;
CursorUp(screen, row);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_CUD:
@@ -1869,7 +1884,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if ((row = param[0]) < 1)
row = 1;
CursorDown(screen, row);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_CUF:
@@ -1877,7 +1892,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if ((col = param[0]) < 1)
col = 1;
CursorForward(screen, col);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_CUB:
@@ -1885,7 +1900,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if ((col = param[0]) < 1)
col = 1;
CursorBack(xw, col);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_CUP:
@@ -1898,7 +1913,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if (nparam < 2 || (col = param[1]) < 1)
col = 1;
CursorSet(screen, row - 1, col - 1, xw->flags);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_VPA:
@@ -1906,7 +1921,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if ((row = param[0]) < 1)
row = 1;
CursorSet(screen, row - 1, screen->cur_col, xw->flags);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_HPA:
@@ -1914,7 +1929,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if ((col = param[0]) < 1)
col = 1;
CursorSet(screen, screen->cur_row, col - 1, xw->flags);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_HP_BUGGY_LL:
@@ -1924,26 +1939,26 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
the screen, regardless of what terminfo says. */
if (screen->hp_ll_bc)
CursorSet(screen, screen->max_row, 0, xw->flags);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_ED:
TRACE(("CASE_ED - erase display\n"));
do_erase_display(xw, param[0], OFF_PROTECT);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_EL:
TRACE(("CASE_EL - erase line\n"));
do_erase_line(xw, param[0], OFF_PROTECT);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_ECH:
TRACE(("CASE_ECH - erase char\n"));
/* ECH */
ClearRight(xw, param[0] < 1 ? 1 : param[0]);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_IL:
@@ -1951,7 +1966,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if ((row = param[0]) < 1)
row = 1;
InsertLine(xw, row);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DL:
@@ -1959,7 +1974,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if ((row = param[0]) < 1)
row = 1;
DeleteLine(xw, row);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DCH:
@@ -1967,7 +1982,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if ((row = param[0]) < 1)
row = 1;
DeleteChar(xw, (unsigned) row);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_TRACK_MOUSE:
@@ -1997,7 +2012,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
RevScroll(xw, count);
do_xevents();
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECID:
@@ -2007,7 +2022,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
unparseputc(xw, '/');
unparseputc(xw, 'Z');
unparse_end(xw);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
});
param[0] = DEFAULT; /* Default ID parameter */
@@ -2065,7 +2080,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
reply.a_final = 'c';
unparseseq(xw, &reply);
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DA2:
@@ -2086,7 +2101,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
reply.a_final = 'c';
unparseseq(xw, &reply);
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECRPTUI:
@@ -2100,7 +2115,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
unparseputc1(xw, ANSI_ST);
unparse_end(xw);
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_TBC:
@@ -2109,19 +2124,19 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
TabClear(xw->tabs, screen->cur_col);
else if (row == 3)
TabZonk(xw->tabs);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_SET:
TRACE(("CASE_SET - set mode\n"));
ansi_modes(xw, bitset);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_RST:
TRACE(("CASE_RST - reset mode\n"));
ansi_modes(xw, bitclr);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_SGR:
@@ -2312,7 +2327,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
break;
}
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
/* DSR (except for the '?') is a superset of CPR */
@@ -2380,20 +2395,20 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if ((reply.a_nparam = (ParmType) count) != 0)
unparseseq(xw, &reply);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
sp->private_function = False;
break;
case CASE_MC:
TRACE(("CASE_MC - media control\n"));
xtermMediaControl(xw, param[0], False);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DEC_MC:
TRACE(("CASE_DEC_MC - DEC media control\n"));
xtermMediaControl(xw, param[0], True);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_HP_MEM_LOCK:
@@ -2407,7 +2422,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
set_tb_margins(screen, screen->cur_row, screen->bot_marg);
else
set_tb_margins(screen, 0, screen->bot_marg);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECSTBM:
@@ -2424,7 +2439,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
set_tb_margins(screen, top - 1, bot - 1);
CursorSet(screen, 0, 0, xw->flags);
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECREQTPARM:
@@ -2448,7 +2463,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
unparseseq(xw, &reply);
}
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECSET:
@@ -2457,7 +2472,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if (screen->vtXX_level != 0)
#endif
dpmodes(xw, bitset);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
#if OPT_TEK4014
if (TEK4014_ACTIVE(xw))
return False;
@@ -2468,7 +2483,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
/* DECRST */
dpmodes(xw, bitclr);
init_groundtable(screen, sp);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECALN:
@@ -2479,20 +2494,20 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
CursorSet(screen, 0, 0, xw->flags);
xtermParseRect(xw, 0, 0, &myRect);
ScrnFillRectangle(xw, &myRect, 'E', 0, False);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_GSETS:
TRACE(("CASE_GSETS(%d) = '%c'\n", sp->scstype, c));
if (screen->vtXX_level != 0)
screen->gsets[sp->scstype] = CharOf(c);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECSC:
TRACE(("CASE_DECSC - save cursor\n"));
CursorSave(xw);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECRC:
@@ -2501,21 +2516,21 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if_OPT_ISO_COLORS(screen, {
setExtendedFG(xw);
});
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECKPAM:
TRACE(("CASE_DECKPAM\n"));
xw->keyboard.flags |= MODE_DECKPAM;
update_appkeypad();
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECKPNM:
TRACE(("CASE_DECKPNM\n"));
UIntClr(xw->keyboard.flags, MODE_DECKPAM);
update_appkeypad();
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_CSI_QUOTE_STATE:
@@ -2568,7 +2583,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
SetCursorBlink(screen, blinks);
}
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
#endif
@@ -2597,7 +2612,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
} else {
xtermClearLEDs(screen);
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
#endif
@@ -2622,19 +2637,19 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_ANSI_LEVEL_1:
TRACE(("CASE_ANSI_LEVEL_1\n"));
set_ansi_conformance(screen, 1);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_ANSI_LEVEL_2:
TRACE(("CASE_ANSI_LEVEL_2\n"));
set_ansi_conformance(screen, 2);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_ANSI_LEVEL_3:
TRACE(("CASE_ANSI_LEVEL_3\n"));
set_ansi_conformance(screen, 3);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECSCL:
@@ -2659,7 +2674,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
}
}
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECSCA:
@@ -2669,24 +2684,24 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
UIntClr(xw->flags, PROTECTED);
else if (param[0] == 1)
xw->flags |= PROTECTED;
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECSED:
TRACE(("CASE_DECSED\n"));
do_erase_display(xw, param[0], DEC_PROTECT);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECSEL:
TRACE(("CASE_DECSEL\n"));
do_erase_line(xw, param[0], DEC_PROTECT);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_ST:
TRACE(("CASE_ST: End of String (%lu bytes)\n", (unsigned long) sp->string_used));
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
if (!sp->string_used)
break;
sp->string_area[--(sp->string_used)] = '\0';
@@ -2711,14 +2726,22 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_SOS:
TRACE(("CASE_SOS: Start of String\n"));
- sp->string_mode = ANSI_SOS;
- sp->parsestate = sos_table;
+ if (ParseSOS(screen)) {
+ sp->string_mode = ANSI_SOS;
+ sp->parsestate = sos_table;
+ } else {
+ illegal_parse(xw, c, sp);
+ }
break;
case CASE_PM:
TRACE(("CASE_PM: Privacy Message\n"));
- sp->string_mode = ANSI_PM;
- sp->parsestate = sos_table;
+ if (ParseSOS(screen)) {
+ sp->string_mode = ANSI_PM;
+ sp->parsestate = sos_table;
+ } else {
+ illegal_parse(xw, c, sp);
+ }
break;
case CASE_DCS:
@@ -2729,21 +2752,25 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_APC:
TRACE(("CASE_APC: Application Program Command\n"));
- sp->string_mode = ANSI_APC;
- sp->parsestate = sos_table;
+ if (ParseSOS(screen)) {
+ sp->string_mode = ANSI_APC;
+ sp->parsestate = sos_table;
+ } else {
+ illegal_parse(xw, c, sp);
+ }
break;
case CASE_SPA:
TRACE(("CASE_SPA - start protected area\n"));
screen->protected_mode = ISO_PROTECT;
xw->flags |= PROTECTED;
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_EPA:
TRACE(("CASE_EPA - end protected area\n"));
UIntClr(xw->flags, PROTECTED);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_SU:
@@ -2751,57 +2778,57 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
if ((count = param[0]) < 1)
count = 1;
xtermScroll(xw, count);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_IND:
TRACE(("CASE_IND - index\n"));
xtermIndex(xw, 1);
do_xevents();
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_CPL:
TRACE(("CASE_CPL - cursor prev line\n"));
CursorPrevLine(screen, param[0]);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_CNL:
TRACE(("CASE_CNL - cursor next line\n"));
CursorNextLine(screen, param[0]);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_NEL:
TRACE(("CASE_NEL\n"));
xtermIndex(xw, 1);
CarriageReturn(screen);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_HTS:
TRACE(("CASE_HTS - horizontal tab set\n"));
TabSet(xw->tabs, screen->cur_col);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_RI:
TRACE(("CASE_RI - reverse index\n"));
RevIndex(xw, 1);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_SS2:
TRACE(("CASE_SS2\n"));
screen->curss = 2;
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_SS3:
TRACE(("CASE_SS3\n"));
screen->curss = 3;
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_CSI_STATE:
@@ -2841,7 +2868,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
screen->loc_filter_right = LOC_FILTER_POS;
InitLocatorFilter(xw);
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECELR:
@@ -2865,7 +2892,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
}
screen->loc_filter = False;
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECSLE:
@@ -2892,7 +2919,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
break;
}
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECRQLP:
@@ -2901,7 +2928,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
/* Issue DECLRP Locator Position Report */
GetLocatorPosition(xw);
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
#endif /* OPT_DEC_LOCATOR */
@@ -2926,14 +2953,14 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
TRACE(("CASE_DECCRA - Copy rectangular area\n"));
xtermParseRect(xw, nparam, param, &myRect);
ScrnCopyRectangle(xw, &myRect, nparam - 5, param + 5);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECERA:
TRACE(("CASE_DECERA - Erase rectangular area\n"));
xtermParseRect(xw, nparam, param, &myRect);
ScrnFillRectangle(xw, &myRect, ' ', 0, True);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECFRA:
@@ -2944,34 +2971,34 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
xtermParseRect(xw, nparam - 1, param + 1, &myRect);
ScrnFillRectangle(xw, &myRect, param[0], xw->flags, True);
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECSERA:
TRACE(("CASE_DECSERA - Selective erase rectangular area\n"));
xtermParseRect(xw, nparam > 4 ? 4 : nparam, param, &myRect);
ScrnWipeRectangle(xw, &myRect);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECSACE:
TRACE(("CASE_DECSACE - Select attribute change extent\n"));
screen->cur_decsace = param[0];
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECCARA:
TRACE(("CASE_DECCARA - Change attributes in rectangular area\n"));
xtermParseRect(xw, nparam > 4 ? 4 : nparam, param, &myRect);
ScrnMarkRectangle(xw, &myRect, False, nparam - 4, param + 4);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECRARA:
TRACE(("CASE_DECRARA - Reverse attributes in rectangular area\n"));
xtermParseRect(xw, nparam > 4 ? 4 : nparam, param, &myRect);
ScrnMarkRectangle(xw, &myRect, True, nparam - 4, param + 4);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
#else
case CASE_CSI_DOLLAR_STATE:
@@ -2988,7 +3015,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_S7C1T:
TRACE(("CASE_S7C1T\n"));
show_8bit_control(False);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_S8C1T:
@@ -2998,7 +3025,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
break;
#endif
show_8bit_control(True);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_OSC:
@@ -3010,13 +3037,13 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
case CASE_RIS:
TRACE(("CASE_RIS\n"));
VTReset(xw, True, True);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECSTR:
TRACE(("CASE_DECSTR\n"));
VTReset(xw, False, False);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_REP:
@@ -3033,53 +3060,53 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
repeated, 1);
}
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_LS2:
TRACE(("CASE_LS2\n"));
screen->curgl = 2;
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_LS3:
TRACE(("CASE_LS3\n"));
screen->curgl = 3;
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_LS3R:
TRACE(("CASE_LS3R\n"));
screen->curgr = 3;
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_LS2R:
TRACE(("CASE_LS2R\n"));
screen->curgr = 2;
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_LS1R:
TRACE(("CASE_LS1R\n"));
screen->curgr = 1;
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_XTERM_SAVE:
savemodes(xw);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_XTERM_RESTORE:
restoremodes(xw);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_XTERM_WINOPS:
TRACE(("CASE_XTERM_WINOPS\n"));
window_ops(xw);
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
#if OPT_WIDE_CHARS
case CASE_ESC_PERCENT:
@@ -3107,7 +3134,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
? "UTF-8 mode set from command-line"
: "wideChars resource was not set"));
}
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
#endif
#if OPT_MOD_FKEYS
@@ -3189,7 +3216,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
break;
}
TRACE(("...warningVolume %d\n", screen->warningVolume));
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
case CASE_DECSMBV:
@@ -3213,7 +3240,7 @@ doparsing(XtermWidget xw, unsigned c, struct ParseState *sp)
break;
}
TRACE(("...marginVolume %d\n", screen->marginVolume));
- sp->parsestate = sp->groundtable;
+ ResetState(sp);
break;
}
if (sp->parsestate == sp->groundtable)
@@ -3260,7 +3287,6 @@ void
v_write(int f, Char * data, unsigned len)
{
int riten;
- unsigned c = len;
TRACE2(("v_write(%d:%s)\n", len, visibleChars(data, len)));
if (v_bufstr == NULL && len > 0) {
@@ -3336,7 +3362,6 @@ v_write(int f, Char * data, unsigned len)
fprintf(stderr, "%s: cannot allocate buffer space\n",
xterm_name);
v_buffer = v_bufstr; /* restore clobbered pointer */
- c = 0;
}
}
}
@@ -3469,7 +3494,7 @@ in_put(XtermWidget xw)
}
if (screen->eventMode == NORMAL
- && readPtyData(screen, &select_mask, VTbuffer)) {
+ && readPtyData(xw, &select_mask, VTbuffer)) {
if (screen->scrollWidget
&& screen->scrollttyoutput
&& screen->topline < 0)
@@ -3543,7 +3568,7 @@ in_put(XtermWidget xw)
for (;;) {
if (screen->eventMode == NORMAL
- && (size = readPtyData(screen, &select_mask, VTbuffer)) != 0) {
+ && (size = readPtyData(xw, &select_mask, VTbuffer)) != 0) {
if (screen->scrollWidget
&& screen->scrollttyoutput
&& screen->topline < 0)
@@ -3919,10 +3944,12 @@ HandleStructNotify(Widget w GCC_UNUSED,
break;
case ConfigureNotify:
if (event->xconfigure.window == XtWindow(toplevel)) {
+#if !OPT_TOOLBAR
int height, width;
height = event->xconfigure.height;
width = event->xconfigure.width;
+#endif
TRACE(("HandleStructNotify(ConfigureNotify) %d,%d %dx%d\n",
event->xconfigure.y, event->xconfigure.x,
event->xconfigure.height, event->xconfigure.width));
@@ -4182,7 +4209,7 @@ dpmodes(XtermWidget xw, BitFunc func)
case 38: /* DECTEK */
#if OPT_TEK4014
if (IsSM() && !(screen->inhibit & I_TEK)) {
- FlushLog(screen);
+ FlushLog(xw);
TEK4014_ACTIVE(xw) = True;
}
#endif
@@ -4216,12 +4243,12 @@ dpmodes(XtermWidget xw, BitFunc func)
* enabled and disabled via escape sequences.
*/
if (IsSM())
- StartLog(screen);
+ StartLog(xw);
else
- CloseLog(screen);
+ CloseLog(xw);
#else
- Bell(XkbBI_Info, 0);
- Bell(XkbBI_Info, 0);
+ Bell(xw, XkbBI_Info, 0);
+ Bell(xw, XkbBI_Info, 0);
#endif /* ALLOWLOGFILEONOFF */
break;
#endif
@@ -4632,9 +4659,9 @@ restoremodes(XtermWidget xw)
case 46: /* logging */
#ifdef ALLOWLOGFILEONOFF
if (screen->save_modes[DP_X_LOGGING])
- StartLog(screen);
+ StartLog(xw);
else
- CloseLog(screen);
+ CloseLog(xw);
#endif /* ALLOWLOGFILEONOFF */
/* update_logging done by StartLog and CloseLog */
break;
@@ -4986,8 +5013,10 @@ window_ops(XtermWidget xw)
reply.a_pintro = 0;
reply.a_nparam = 3;
reply.a_param[0] = 9;
- reply.a_param[1] = (ParmType) (root_height / FontHeight(screen));
- reply.a_param[2] = (ParmType) (root_width / FontWidth(screen));
+ reply.a_param[1] = (ParmType) (root_height
+ / (unsigned) FontHeight(screen));
+ reply.a_param[2] = (ParmType) (root_width
+ / (unsigned) FontWidth(screen));
reply.a_inters = 0;
reply.a_final = 't';
unparseseq(xw, &reply);
@@ -5355,7 +5384,7 @@ VTRun(XtermWidget xw)
#if OPT_TEK4014
if (Tpushb > Tpushback) {
- fillPtyData(screen, VTbuffer, (char *) Tpushback, (int) (Tpushb - Tpushback));
+ fillPtyData(xw, VTbuffer, (char *) Tpushback, (int) (Tpushb - Tpushback));
Tpushb = Tpushback;
}
#endif
@@ -5856,7 +5885,7 @@ set_flags_from_list(char *target,
Cardinal limit)
{
Cardinal n;
- int value;
+ int value = -1;
while (*source != '\0') {
char *next = ParseList(&source);
@@ -5898,6 +5927,49 @@ set_flags_from_list(char *target,
}
}
+/*
+ * Extend a (normally) boolean resource value by checking for additional values
+ * which will be mapped into true/false.
+ */
+#if OPT_RENDERFONT
+static int
+extendedBoolean(const char *value, FlagList * table, Cardinal limit)
+{
+ int result = -1;
+ long check;
+ char *next;
+ Cardinal n;
+
+ if ((x_strcasecmp(value, "true") == 0)
+ || (x_strcasecmp(value, "yes") == 0)
+ || (x_strcasecmp(value, "on") == 0)) {
+ result = True;
+ } else if ((x_strcasecmp(value, "false") == 0)
+ || (x_strcasecmp(value, "no") == 0)
+ || (x_strcasecmp(value, "off") == 0)) {
+ result = False;
+ } else if ((check = strtol(value, &next, 0)) >= 0 && *next == '\0') {
+ if (check >= (long) limit)
+ check = True;
+ result = (int) check;
+ } else {
+ for (n = 0; n < limit; ++n) {
+ if (x_strcasecmp(value, table[n].name) == 0) {
+ result = table[n].code;
+ break;
+ }
+ }
+ }
+
+ if (result < 0) {
+ fprintf(stderr, "Unrecognized keyword: %s\n", value);
+ result = False;
+ }
+
+ return result;
+}
+#endif /* OPT_RENDERFONT */
+
/* ARGSUSED */
static void
VTInitialize(Widget wrequest,
@@ -5968,6 +6040,15 @@ VTInitialize(Widget wrequest,
};
#undef DATA
+#if OPT_RENDERFONT
+#define DATA(name) { #name, er##name }
+ static FlagList tblRenderFont[] =
+ {
+ DATA(Default)
+ };
+#undef DATA
+#endif
+
XtermWidget request = (XtermWidget) wrequest;
XtermWidget wnew = (XtermWidget) new_arg;
Widget my_parent = SHELL_OF(wnew);
@@ -6460,25 +6541,26 @@ VTInitialize(Widget wrequest,
TScreenOf(wnew)->Tcolors[TEK_CURSOR] = TScreenOf(wnew)->Tcolors[TEXT_CURSOR];
#endif
-#if OPT_WIDE_CHARS
- VTInitialize_locale(request);
- init_Bres(screen.utf8_latin1);
- init_Bres(screen.utf8_title);
-
-#if OPT_LUIT_PROG
- init_Bres(misc.callfilter);
- init_Bres(misc.use_encoding);
- init_Sres(misc.locale_str);
- init_Sres(misc.localefilter);
-#endif
-
#if OPT_RENDERFONT
for (i = 0; i <= fontMenu_lastBuiltin; ++i) {
init_Dres2(misc.face_size, i);
}
init_Sres(misc.face_name);
init_Sres(misc.face_wide_name);
- init_Bres(misc.render_font);
+ init_Sres(misc.render_font_s);
+ wnew->misc.render_font =
+ (Boolean) extendedBoolean(wnew->misc.render_font_s,
+ tblRenderFont, erLast);
+ if (wnew->misc.render_font == erDefault) {
+ if (IsEmpty(wnew->misc.face_name)) {
+ wnew->misc.face_name = x_strdup(DEFFACENAME_AUTO);
+ TRACE(("will allow runtime switch to render_font using \"%s\"\n",
+ wnew->misc.face_name));
+ } else {
+ wnew->misc.render_font = erTrue;
+ TRACE(("initially using TrueType font\n"));
+ }
+ }
/* minor tweak to make debug traces consistent: */
if (wnew->misc.render_font) {
if (IsEmpty(wnew->misc.face_name)) {
@@ -6488,6 +6570,18 @@ VTInitialize(Widget wrequest,
}
#endif
+#if OPT_WIDE_CHARS
+ VTInitialize_locale(request);
+ init_Bres(screen.utf8_latin1);
+ init_Bres(screen.utf8_title);
+
+#if OPT_LUIT_PROG
+ init_Bres(misc.callfilter);
+ init_Bres(misc.use_encoding);
+ init_Sres(misc.locale_str);
+ init_Sres(misc.localefilter);
+#endif
+
init_Ires(screen.utf8_inparse);
init_Ires(screen.utf8_mode);
init_Ires(screen.max_combining);
@@ -6673,14 +6767,14 @@ releaseWindowGCs(XtermWidget xw, VTwin * win)
#define TRACE_FREE_LEAK(name) \
if (name) { \
- free(name); \
+ free((void *) name); \
name = 0; \
TRACE(("freed " #name "\n")); \
}
#define FREE_LEAK(name) \
if (name) { \
- free(name); \
+ free((void *) name); \
name = 0; \
}
@@ -7215,35 +7309,38 @@ xim_real_init(XtermWidget xw)
} else {
s = xw->misc.input_method;
i = 5 + (unsigned) strlen(s);
+
t = (char *) MyStackAlloc(i, buf);
- if (t == NULL)
+ if (t == NULL) {
SysError(ERROR_VINIT);
+ } else {
- for (ns = s; ns && *s;) {
- while (*s && isspace(CharOf(*s)))
- s++;
- if (!*s)
- break;
- if ((ns = end = strchr(s, ',')) == 0)
- end = s + strlen(s);
- while ((end != s) && isspace(CharOf(end[-1])))
- end--;
-
- if (end != s) {
- strcpy(t, "@im=");
- strncat(t, s, (size_t) (end - s));
-
- if ((p = XSetLocaleModifiers(t)) != 0 && *p
- && (screen->xim = XOpenIM(XtDisplay(xw),
- NULL,
- NULL,
- NULL)) != 0)
+ for (ns = s; ns && *s;) {
+ while (*s && isspace(CharOf(*s)))
+ s++;
+ if (!*s)
break;
+ if ((ns = end = strchr(s, ',')) == 0)
+ end = s + strlen(s);
+ while ((end != s) && isspace(CharOf(end[-1])))
+ end--;
+
+ if (end != s) {
+ strcpy(t, "@im=");
+ strncat(t, s, (size_t) (end - s));
+
+ if ((p = XSetLocaleModifiers(t)) != 0 && *p
+ && (screen->xim = XOpenIM(XtDisplay(xw),
+ NULL,
+ NULL,
+ NULL)) != 0)
+ break;
+ }
+ s = ns + 1;
}
- s = ns + 1;
+ MyStackFree(t, buf);
}
- MyStackFree(t, buf);
}
if (screen->xim == NULL
@@ -7890,9 +7987,12 @@ HideCursor(void)
TRACE(("HideCursor calling drawXtermText cur(%d,%d)\n",
screen->cursorp.row, screen->cursorp.col));
- drawXtermText(xw, flags & DRAWX_MASK, currentGC,
- x = LineCursorX(screen, ld, cursor_col),
- y = CursorY(screen, screen->cursorp.row),
+
+ x = LineCursorX(screen, ld, cursor_col);
+ y = CursorY(screen, screen->cursorp.row);
+
+ drawXtermText(xw, flags & DRAWX_MASK,
+ currentGC, x, y,
LineCharSet(screen, ld),
&base, 1, 0);
@@ -8090,7 +8190,7 @@ VTReset(XtermWidget xw, Bool full, Bool saved)
TScreen *screen = TScreenOf(xw);
if (!XtIsRealized((Widget) xw) || (CURRENT_EMU() != (Widget) xw)) {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
return;
}
@@ -8127,7 +8227,7 @@ VTReset(XtermWidget xw, Bool full, Bool saved)
if (full) { /* RIS */
if (screen->bellOnReset)
- Bell(XkbBI_TerminalBell, 0);
+ Bell(xw, XkbBI_TerminalBell, 0);
/* reset the mouse mode */
screen->send_mouse_pos = MOUSE_OFF;
@@ -8356,20 +8456,22 @@ HandleKeymapChange(Widget w,
pmapName = (char *) MyStackAlloc(len, mapName);
pmapClass = (char *) MyStackAlloc(len, mapClass);
if (pmapName == NULL
- || pmapClass == NULL)
+ || pmapClass == NULL) {
SysError(ERROR_KMMALLOC1);
+ } else {
- (void) sprintf(pmapName, "%sKeymap", params[0]);
- (void) strcpy(pmapClass, pmapName);
- if (islower(CharOf(pmapClass[0])))
- pmapClass[0] = x_toupper(pmapClass[0]);
- XtGetSubresources(w, (XtPointer) &keymap, pmapName, pmapClass,
- key_resources, (Cardinal) 1, NULL, (Cardinal) 0);
- if (keymap != NULL)
- XtOverrideTranslations(w, keymap);
-
- MyStackFree(pmapName, mapName);
- MyStackFree(pmapClass, mapClass);
+ (void) sprintf(pmapName, "%sKeymap", params[0]);
+ (void) strcpy(pmapClass, pmapName);
+ if (islower(CharOf(pmapClass[0])))
+ pmapClass[0] = x_toupper(pmapClass[0]);
+ XtGetSubresources(w, (XtPointer) &keymap, pmapName, pmapClass,
+ key_resources, (Cardinal) 1, NULL, (Cardinal) 0);
+ if (keymap != NULL)
+ XtOverrideTranslations(w, keymap);
+
+ MyStackFree(pmapName, mapName);
+ MyStackFree(pmapClass, mapClass);
+ }
}
/* ARGSUSED */
@@ -8381,7 +8483,7 @@ HandleBell(Widget w GCC_UNUSED,
{
int percent = (*param_count) ? atoi(params[0]) : 0;
- Bell(XkbBI_TerminalBell, percent);
+ Bell(term, XkbBI_TerminalBell, percent);
}
/* ARGSUSED */
@@ -8423,7 +8525,7 @@ DoSetSelectedFont(Widget w,
XtermWidget xw = getXtermWidget(w);
if ((xw == 0) || *type != XA_STRING || *format != 8) {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
} else {
Boolean failed = False;
int oldFont = TScreenOf(xw)->menu_font_number;
@@ -8473,7 +8575,7 @@ DoSetSelectedFont(Widget w,
xtermFontName(TScreenOf(xw)->MenuFontName(oldFont)),
True,
oldFont);
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
if (used != val)
free(used);
@@ -8506,7 +8608,7 @@ FindFontSelection(XtermWidget xw, const char *atom_name, Bool justprobe)
atoms = (AtomPtr *) XtRealloc((char *) atoms,
(Cardinal) sizeof(AtomPtr)
* (atomCount + 1));
- *(pAtom = &atoms[atomCount++]) = XmuMakeAtom(atom_name);
+ *(pAtom = &atoms[atomCount]) = XmuMakeAtom(atom_name);
}
target = XmuInternAtom(XtDisplay(xw), *pAtom);
diff --git a/app/xterm/configure.in b/app/xterm/configure.in
index 33ea78102..08383b08d 100644
--- a/app/xterm/configure.in
+++ b/app/xterm/configure.in
@@ -1,4 +1,4 @@
-dnl $XTermId: configure.in,v 1.262 2010/04/21 00:16:24 tom Exp $
+dnl $XTermId: configure.in,v 1.266 2010/06/15 22:30:01 tom Exp $
dnl
dnl -----------------------------------------------------------------------------
dnl this file is part of xterm
@@ -462,9 +462,9 @@ fi
AC_MSG_CHECKING(if you want to allow broken string-terminators)
CF_ARG_ENABLE(broken-st,
- [ --enable-broken-st allow broken string-terminators],
- [enable_broken_st=yes],
- [enable_broken_st=no])
+ [ --disable-broken-st disallow broken string-terminators],
+ [enable_broken_st=no],
+ [enable_broken_st=yes])
AC_MSG_RESULT($enable_broken_st)
test "$enable_broken_st" = no && AC_DEFINE(OPT_BROKEN_ST,0)
@@ -818,7 +818,7 @@ CF_ARG_ENABLE(luit,
AC_MSG_RESULT($enable_luit)
if test "$enable_luit" = yes ; then
AC_DEFINE(OPT_LUIT_PROG,1)
- CF_PATH_PROG(LUIT,luit)
+ CF_PATH_PROG(LUIT,xterm-filter,bluit luit)
fi
AC_MSG_CHECKING(if you want wide-character support)
@@ -989,5 +989,12 @@ done
CF_MAKE_TAGS
CF_DISABLE_RPATH_HACK
+# Force plink.sh to not trim pcre's libraries, which have the same symbol
+# names as the system regexp.
+if test "$with_pcre" != no
+then
+ LIBS=`echo "$LIBS" | sed -e 's/-lpcre/-kpcre/g'`
+fi
+
### output Makefile and xtermcfg.h
AC_OUTPUT(Makefile)
diff --git a/app/xterm/ctlseqs.ms b/app/xterm/ctlseqs.ms
index 58c90aab7..1517b33fa 100644
--- a/app/xterm/ctlseqs.ms
+++ b/app/xterm/ctlseqs.ms
@@ -1,6 +1,6 @@
.\"#! troff -ms $1 -*- Nroff -*-
.\" "Xterm Control Sequences" document
-.\" $XTermId: ctlseqs.ms,v 1.213 2010/04/18 14:52:50 Emanuele.Giaquinta Exp $
+.\" $XTermId: ctlseqs.ms,v 1.214 2010/06/13 16:58:12 tom Exp $
.\"
.\"
.\" Copyright 1996-2009,2010 by Thomas E. Dickey
@@ -396,6 +396,10 @@ Form Feed or New Page (NP) (Ctrl-L) same as LF
.IP \\*(Lf
Line Feed or New Line (NL) (Ctrl-J)
.
+.IP \\*(Si
+Shift In (Ctrl-O) \(-> Switch to Standard Character Set: invokes the
+G0 character set (the default).
+.
.IP \\*(So
Shift Out (Ctrl-N) \(-> Switch to Alternate Character Set: invokes the
G1 character set.
@@ -408,10 +412,6 @@ Horizontal Tab (HT) (Ctrl-I)
.
.IP \\*(Vt
Vertical Tab (Ctrl-K) same as LF
-.
-.IP \\*(Si
-Shift In (Ctrl-O) \(-> Switch to Standard Character Set: invokes the
-G0 character set (the default).
.Ed
.\"
.\"
diff --git a/app/xterm/ctlseqs.txt b/app/xterm/ctlseqs.txt
index 9da44691f..cfbc8b2ec 100644
--- a/app/xterm/ctlseqs.txt
+++ b/app/xterm/ctlseqs.txt
@@ -103,13 +103,13 @@ ENQ Return Terminal Status (Ctrl-E). Default response is an empty
string, but may be overridden by a resource answerbackString.
FF Form Feed or New Page (NP) (Ctrl-L) same as LF
LF Line Feed or New Line (NL) (Ctrl-J)
+SI Shift In (Ctrl-O) -> Switch to Standard Character Set: invokes
+ the G0 character set (the default).
SO Shift Out (Ctrl-N) -> Switch to Alternate Character Set:
invokes the G1 character set.
SP Space.
TAB Horizontal Tab (HT) (Ctrl-I)
VT Vertical Tab (Ctrl-K) same as LF
-SI Shift In (Ctrl-O) -> Switch to Standard Character Set: invokes
- the G0 character set (the default).
Controls beginning with ESC (other than those where ESC is part of a
7-bit equivalent to 8-bit C1 controls), ordered by the final charac-
diff --git a/app/xterm/doublechr.c b/app/xterm/doublechr.c
index 210a41ab8..6b1d03098 100644
--- a/app/xterm/doublechr.c
+++ b/app/xterm/doublechr.c
@@ -1,8 +1,8 @@
-/* $XTermId: doublechr.c,v 1.74 2010/04/16 08:45:59 tom Exp $ */
+/* $XTermId: doublechr.c,v 1.75 2010/06/15 10:58:13 tom Exp $ */
/************************************************************
-Copyright 1997-2008,2009 by Thomas E. Dickey
+Copyright 1997-2009,2010 by Thomas E. Dickey
All Rights Reserved
diff --git a/app/xterm/error.h b/app/xterm/error.h
index 6e95055e1..0ab85bbc8 100644
--- a/app/xterm/error.h
+++ b/app/xterm/error.h
@@ -1,4 +1,4 @@
-/* $XTermId: error.h,v 1.22 2009/08/09 17:23:31 tom Exp $ */
+/* $XTermId: error.h,v 1.23 2010/05/21 21:03:27 tom Exp $ */
/*
* Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
@@ -51,7 +51,6 @@
#define ERROR_INIT 36 /* spawn: can't initialize window */
#define ERROR_TIOCKSET 46 /* spawn: ioctl() failed on TIOCKSET */
#define ERROR_TIOCKSETC 47 /* spawn: ioctl() failed on TIOCKSETC */
-#define ERROR_SPREALLOC 48 /* spawn: realloc of ttydev failed */
#define ERROR_LUMALLOC 49 /* luit: command-line malloc failed */
/* charproc.c */
diff --git a/app/xterm/fontutils.c b/app/xterm/fontutils.c
index 33d64e45b..89e231dc6 100644
--- a/app/xterm/fontutils.c
+++ b/app/xterm/fontutils.c
@@ -1,4 +1,4 @@
-/* $XTermId: fontutils.c,v 1.340 2010/04/18 16:48:46 tom Exp $ */
+/* $XTermId: fontutils.c,v 1.344 2010/06/15 08:18:58 tom Exp $ */
/************************************************************
@@ -168,7 +168,7 @@ setupPackedFonts(XtermWidget xw)
#if OPT_RENDERFONT
#define MIXED(name) screen->name[fontnum].map.mixed
- if (xw->misc.render_font) {
+ if (xw->misc.render_font == True) {
int fontnum = screen->menu_font_number;
screen->allow_packing = (Boolean) (MIXED(renderFontNorm)
@@ -749,7 +749,7 @@ xtermOpenFont(XtermWidget xw,
if ((result->fs = XLoadQueryFont(screen->display, name)) != 0) {
code = True;
if (EmptyFont(result->fs)) {
- result = xtermCloseFont(xw, result);
+ (void) xtermCloseFont(xw, result);
code = False;
} else {
result->fn = x_strdup(name);
@@ -1804,7 +1804,7 @@ xtermComputeFontInfo(XtermWidget xw,
* font-loading for fixed-fonts still goes on whether or not this chunk
* overrides it.
*/
- if (xw->misc.render_font && !IsIconWin(screen, win)) {
+ if (UsingRenderFont(xw)) {
char *face_name = getFaceName(xw, False);
int fontnum = screen->menu_font_number;
XftFont *norm = screen->renderFontNorm[fontnum].font;
@@ -2030,7 +2030,7 @@ xtermComputeFontInfo(XtermWidget xw,
/*
* Are we handling a bitmap font?
*/
- if (!xw->misc.render_font || IsIconWin(screen, win))
+ if (!UsingRenderFont(xw))
#endif /* OPT_RENDERFONT */
{
if (is_double_width_font(font) && !(screen->fnt_prop)) {
@@ -2382,10 +2382,9 @@ xtermDrawBoxChar(XtermWidget xw,
unsigned n;
for (n = 1; n < 32; n++) {
if (dec2ucs(n) == ch
- && !IsXtermMissingChar(screen, n,
- ((flags & BOLD)
- ? &screen->fnts[fBold]
- : &screen->fnts[fNorm]))) {
+ && !((flags & BOLD)
+ ? IsXtermMissingChar(screen, n, &screen->fnts[fBold])
+ : IsXtermMissingChar(screen, n, &screen->fnts[fNorm]))) {
TRACE(("...use xterm-style linedrawing\n"));
ch = n;
break;
@@ -2838,7 +2837,7 @@ HandleLargerFont(Widget w GCC_UNUSED,
if (m >= 0) {
SetVTFont(xw, m, True, NULL);
} else {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
}
}
@@ -2863,7 +2862,7 @@ HandleSmallerFont(Widget w GCC_UNUSED,
if (m >= 0) {
SetVTFont(xw, m, True, NULL);
} else {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
}
}
@@ -2955,13 +2954,13 @@ HandleSetFont(Widget w GCC_UNUSED,
maxparams = 2;
break;
default:
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
return;
}
fontnum = result;
if (*param_count > maxparams) { /* see if extra args given */
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
return;
}
switch (*param_count) { /* assign 'em */
@@ -2999,7 +2998,7 @@ SetVTFont(XtermWidget xw,
(fonts && fonts->f_b) ? fonts->f_b : "<null>"));
if (IsIcon(screen)) {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
} else if (which >= 0 && which < NMENUFONTS) {
VTFontNames myfonts;
@@ -3053,11 +3052,11 @@ SetVTFont(XtermWidget xw,
xtermLoadFont(xw,
xtermFontName(screen->MenuFontName(oldFont)),
doresize, oldFont);
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
}
} else {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
return;
}
diff --git a/app/xterm/fontutils.h b/app/xterm/fontutils.h
index 383380343..2187acc22 100644
--- a/app/xterm/fontutils.h
+++ b/app/xterm/fontutils.h
@@ -1,8 +1,8 @@
-/* $XTermId: fontutils.h,v 1.80 2010/04/16 21:23:13 tom Exp $ */
+/* $XTermId: fontutils.h,v 1.81 2010/06/15 10:58:13 tom Exp $ */
/************************************************************
-Copyright 1998-2008,2009 by Thomas E. Dickey
+Copyright 1998-2009,2010 by Thomas E. Dickey
All Rights Reserved
diff --git a/app/xterm/input.c b/app/xterm/input.c
index f4f579cff..3a586b624 100644
--- a/app/xterm/input.c
+++ b/app/xterm/input.c
@@ -1,4 +1,4 @@
-/* $XTermId: input.c,v 1.324 2010/04/18 17:50:52 tom Exp $ */
+/* $XTermId: input.c,v 1.326 2010/06/15 22:41:09 tom Exp $ */
/*
* Copyright 1999-2009,2010 by Thomas E. Dickey
@@ -187,7 +187,7 @@ AdjustAfterInput(XtermWidget xw)
if (screen->bellArmed >= 0) {
if (screen->bellArmed == screen->cur_row) {
if (screen->cur_col >= col) {
- Bell(XkbBI_MarginBell, 0);
+ Bell(xw, XkbBI_MarginBell, 0);
screen->bellArmed = -1;
}
} else {
@@ -1225,7 +1225,7 @@ Input(XtermWidget xw,
if (modifyOtherKey(&reply, input_char, modify_parm, keyboard->format_keys)) {
unparseseq(xw, &reply);
} else {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
} else
#endif /* OPT_MOD_FKEYS */
@@ -1338,7 +1338,7 @@ Input(XtermWidget xw,
}
void
-StringInput(XtermWidget xw, Char * string, size_t nbytes)
+StringInput(XtermWidget xw, const Char * string, size_t nbytes)
{
TRACE(("InputString (%s,%lu)\n",
visibleChars(string, (unsigned) nbytes),
diff --git a/app/xterm/main.c b/app/xterm/main.c
index a9f14bc66..f19399727 100644
--- a/app/xterm/main.c
+++ b/app/xterm/main.c
@@ -1,4 +1,4 @@
-/* $XTermId: main.c,v 1.610 2010/04/18 17:09:13 tom Exp $ */
+/* $XTermId: main.c,v 1.618 2010/06/20 21:11:51 tom Exp $ */
/*
* W A R N I N G
@@ -1299,7 +1299,7 @@ decode_keyvalue(char **ptr, int termcap)
#endif
#if defined(_PC_VDISABLE)
if (value == -1) {
- value = fpathconf(0, _PC_VDISABLE);
+ value = (int) fpathconf(0, _PC_VDISABLE);
if (value == -1) {
if (errno != 0)
break; /* skip this (error) */
@@ -1320,7 +1320,7 @@ decode_keyvalue(char **ptr, int termcap)
++string;
} else if (termcap && (*string == '\\')) {
char *d;
- int temp = strtol(string + 1, &d, 8);
+ int temp = (int) strtol(string + 1, &d, 8);
if (temp > 0 && d != string) {
value = temp;
string = d;
@@ -2377,7 +2377,7 @@ main(int argc, char *argv[]ENVP_ARG)
initPtyData(&VTbuffer);
#ifdef ALLOWLOGGING
if (term->misc.log_on) {
- StartLog(screen);
+ StartLog(term);
}
#endif
@@ -2996,6 +2996,12 @@ find_utmp(struct UTMP_STR *tofind)
#define close_fd(fd) close(fd), fd = -1
+#if defined(TIOCNOTTY) && (!defined(__GLIBC__) || (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))
+#define USE_NO_DEV_TTY 1
+#else
+#define USE_NO_DEV_TTY 0
+#endif
+
/*
* Inits pty and tty and forks a login process.
* Does not close fd Xsocket.
@@ -3045,7 +3051,10 @@ spawnXTerm(XtermWidget xw)
#endif /* TERMIO_STRUCT */
char *ptr, *shname, *shname_minus;
- int i, no_dev_tty = False;
+ int i;
+#if USE_NO_DEV_TTY
+ int no_dev_tty = False;
+#endif
const char **envnew; /* new environment */
char buf[64];
char *TermName = NULL;
@@ -3131,7 +3140,9 @@ spawnXTerm(XtermWidget xw)
* seem to return EIO. Solaris 2.3 is said to return EINVAL.
* Cygwin returns ENOENT.
*/
+#if USE_NO_DEV_TTY
no_dev_tty = False;
+#endif
if (ttyfd < 0) {
if (tty_got_hung || errno == ENXIO || errno == EIO ||
#ifdef ENODEV
@@ -3141,7 +3152,9 @@ spawnXTerm(XtermWidget xw)
errno == ENOENT ||
#endif
errno == EINVAL || errno == ENOTTY || errno == EACCES) {
+#if USE_NO_DEV_TTY
no_dev_tty = True;
+#endif
#ifdef HAS_LTCHARS
ltc = d_ltc;
#endif /* HAS_LTCHARS */
@@ -3179,10 +3192,12 @@ spawnXTerm(XtermWidget xw)
lmode = d_lmode;
#endif /* TIOCLSET */
#ifdef TERMIO_STRUCT
- if ((rc = ttyGetAttr(ttyfd, &tio)) == -1)
+ rc = ttyGetAttr(ttyfd, &tio);
+ if (rc == -1)
tio = d_tio;
#else /* !TERMIO_STRUCT */
- if ((rc = ioctl(ttyfd, TIOCGETP, (char *) &sg)) == -1)
+ rc = ioctl(ttyfd, TIOCGETP, (char *) &sg);
+ if (rc == -1)
sg = d_sg;
if (ioctl(ttyfd, TIOCGETC, (char *) &tc) == -1)
tc = d_tc;
@@ -3231,11 +3246,13 @@ spawnXTerm(XtermWidget xw)
if (resource.ptyInitialErase) {
#ifdef TERMIO_STRUCT
TERMIO_STRUCT my_tio;
- if ((rc = ttyGetAttr(screen->respond, &my_tio)) == 0)
+ rc = ttyGetAttr(screen->respond, &my_tio);
+ if (rc == 0)
initial_erase = my_tio.c_cc[VERASE];
#else /* !TERMIO_STRUCT */
struct sgttyb my_sg;
- if ((rc = ioctl(screen->respond, TIOCGETP, (char *) &my_sg)) == 0)
+ rc = ioctl(screen->respond, TIOCGETP, (char *) &my_sg);
+ if (rc == 0)
initial_erase = my_sg.sg_erase;
#endif /* TERMIO_STRUCT */
TRACE(("%s initial_erase:%d (from pty)\n",
@@ -3338,7 +3355,7 @@ spawnXTerm(XtermWidget xw)
resource.backarrow_is_erase ? "" : "not "));
if (resource.backarrow_is_erase) { /* see input.c */
if (initial_erase == ANSI_DEL) {
- xw->keyboard.flags &= ~MODE_DECBKM;
+ UIntClr(xw->keyboard.flags, MODE_DECBKM);
} else {
xw->keyboard.flags |= MODE_DECBKM;
xw->keyboard.reset_DECBKM = 1;
@@ -3363,14 +3380,14 @@ spawnXTerm(XtermWidget xw)
} else
#endif
{
- TTYSIZE_ROWS(ts) = MaxRows(screen);
- TTYSIZE_COLS(ts) = MaxCols(screen);
+ TTYSIZE_ROWS(ts) = (ttySize_t) MaxRows(screen);
+ TTYSIZE_COLS(ts) = (ttySize_t) MaxCols(screen);
#if defined(USE_STRUCT_WINSIZE)
- ts.ws_xpixel = FullWidth(screen);
- ts.ws_ypixel = FullHeight(screen);
+ ts.ws_xpixel = (ttySize_t) FullWidth(screen);
+ ts.ws_ypixel = (ttySize_t) FullHeight(screen);
#endif
}
- i = SET_TTYSIZE(screen->respond, ts);
+ TRACE_RC(i, SET_TTYSIZE(screen->respond, ts));
TRACE(("spawn SET_TTYSIZE %dx%d return %d\n",
TTYSIZE_ROWS(ts),
TTYSIZE_COLS(ts), i));
@@ -3400,7 +3417,7 @@ spawnXTerm(XtermWidget xw)
if (screen->pid == 0) {
#ifdef USE_USG_PTYS
- int ptyfd;
+ int ptyfd = -1;
char *pty_name;
#endif
/*
@@ -3417,32 +3434,29 @@ spawnXTerm(XtermWidget xw)
#ifdef USE_ISPTS_FLAG
if (IsPts) { /* SYSV386 supports both, which did we open? */
#endif
- ptyfd = 0;
- pty_name = 0;
-
setpgrp();
grantpt(screen->respond);
unlockpt(screen->respond);
if ((pty_name = ptsname(screen->respond)) == 0) {
SysError(ERROR_PTSNAME);
- }
- if ((ptyfd = open(pty_name, O_RDWR)) < 0) {
+ } else if ((ptyfd = open(pty_name, O_RDWR)) < 0) {
SysError(ERROR_OPPTSNAME);
}
#ifdef I_PUSH
- if (ioctl(ptyfd, I_PUSH, "ptem") < 0) {
+ else if (ioctl(ptyfd, I_PUSH, "ptem") < 0) {
SysError(ERROR_PTEM);
}
#if !defined(SVR4) && !(defined(SYSV) && defined(i386))
- if (!x_getenv("CONSEM") && ioctl(ptyfd, I_PUSH, "consem") < 0) {
+ else if (!x_getenv("CONSEM")
+ && ioctl(ptyfd, I_PUSH, "consem") < 0) {
SysError(ERROR_CONSEM);
}
#endif /* !SVR4 */
- if (ioctl(ptyfd, I_PUSH, "ldterm") < 0) {
+ else if (ioctl(ptyfd, I_PUSH, "ldterm") < 0) {
SysError(ERROR_LDTERM);
}
#ifdef SVR4 /* from Sony */
- if (ioctl(ptyfd, I_PUSH, "ttcompat") < 0) {
+ else if (ioctl(ptyfd, I_PUSH, "ttcompat") < 0) {
SysError(ERROR_TTCOMPAT);
}
#endif /* SVR4 */
@@ -3465,11 +3479,11 @@ spawnXTerm(XtermWidget xw)
} else
#endif /* OPT_TEK4014 */
{
- TTYSIZE_ROWS(ts) = MaxRows(screen);
- TTYSIZE_COLS(ts) = MaxCols(screen);
+ TTYSIZE_ROWS(ts) = (ttySize_t) MaxRows(screen);
+ TTYSIZE_COLS(ts) = (ttySize_t) MaxCols(screen);
#ifdef USE_STRUCT_WINSIZE
- ts.ws_xpixel = FullWidth(screen);
- ts.ws_ypixel = FullHeight(screen);
+ ts.ws_xpixel = (ttySize_t) FullWidth(screen);
+ ts.ws_ypixel = (ttySize_t) FullHeight(screen);
#endif
}
#endif /* TTYSIZE_STRUCT */
@@ -3537,13 +3551,13 @@ spawnXTerm(XtermWidget xw)
}
while (1) {
-#if defined(TIOCNOTTY) && (!defined(__GLIBC__) || (__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))
+#if USE_NO_DEV_TTY
if (!no_dev_tty
&& (ttyfd = open("/dev/tty", O_RDWR)) >= 0) {
ioctl(ttyfd, TIOCNOTTY, (char *) NULL);
close_fd(ttyfd);
}
-#endif /* TIOCNOTTY && !glibc >= 2.1 */
+#endif /* USE_NO_DEV_TTY */
#ifdef CSRG_BASED
IGNORE_RC(revoke(ttydev));
#endif
@@ -3585,8 +3599,8 @@ spawnXTerm(XtermWidget xw)
sizeof(handshake)));
/* get reply from parent */
- i = read(pc_pipe[0], (char *) &handshake,
- sizeof(handshake));
+ i = (int) read(pc_pipe[0], (char *) &handshake,
+ sizeof(handshake));
if (i <= 0) {
/* parent terminated */
exit(1);
@@ -3599,23 +3613,15 @@ spawnXTerm(XtermWidget xw)
/* We have a new pty to try */
free(ttydev);
- ttydev = CastMallocN(char, strlen(handshake.buffer));
- if (ttydev == NULL) {
- SysError(ERROR_SPREALLOC);
- }
- strcpy(ttydev, handshake.buffer);
+ ttydev = x_strdup(handshake.buffer);
}
/* use the same tty name that everyone else will use
* (from ttyname)
*/
if ((ptr = ttyname(ttyfd)) != 0) {
- /* it may be bigger */
- ttydev = TypeRealloc(char, strlen(ptr) + 1, ttydev);
- if (ttydev == NULL) {
- SysError(ERROR_SPREALLOC);
- }
- (void) strcpy(ttydev, ptr);
+ free(ttydev);
+ ttydev = x_strdup(ptr);
}
}
#endif /* OPT_PTY_HANDSHAKE -- from near fork */
@@ -3648,7 +3654,7 @@ spawnXTerm(XtermWidget xw)
* child pty.
*/
/* input: nl->nl, don't ignore cr, cr->nl */
- tio.c_iflag &= ~(INLCR | IGNCR);
+ UIntClr(tio.c_iflag, (INLCR | IGNCR));
tio.c_iflag |= ICRNL;
#if OPT_WIDE_CHARS && defined(linux) && defined(IUTF8)
#if OPT_LUIT_PROG
@@ -3659,15 +3665,15 @@ spawnXTerm(XtermWidget xw)
#endif
/* ouput: cr->cr, nl is not return, no delays, ln->cr/nl */
#ifndef USE_POSIX_TERMIOS
- tio.c_oflag &=
- ~(OCRNL
- | ONLRET
- | NLDLY
- | CRDLY
- | TABDLY
- | BSDLY
- | VTDLY
- | FFDLY);
+ UIntClr(tio.c_oflag,
+ (OCRNL
+ | ONLRET
+ | NLDLY
+ | CRDLY
+ | TABDLY
+ | BSDLY
+ | VTDLY
+ | FFDLY));
#endif /* USE_POSIX_TERMIOS */
#ifdef ONLCR
tio.c_oflag |= ONLCR;
@@ -3679,7 +3685,7 @@ spawnXTerm(XtermWidget xw)
# if defined(Lynx) && !defined(CBAUD)
# define CBAUD V_CBAUD
# endif
- tio.c_cflag &= ~(CBAUD);
+ UIntClr(tio.c_cflag, CBAUD);
#ifdef BAUD_0
/* baud rate is 0 (don't care) */
#elif defined(HAVE_TERMIO_C_ISPEED)
@@ -3759,7 +3765,7 @@ spawnXTerm(XtermWidget xw)
HsSysError(ERROR_TIOCSETP);
/* ignore errors here - some platforms don't work */
- tio.c_cflag &= ~CSIZE;
+ UIntClr(tio.c_cflag, CSIZE);
if (screen->input_eight_bits)
tio.c_cflag |= CS8;
else
@@ -3875,7 +3881,7 @@ spawnXTerm(XtermWidget xw)
old_erase = tio.c_cc[VERASE];
#endif
tio.c_cc[VERASE] = initial_erase;
- rc = ttySetAttr(ttyfd, &tio);
+ TRACE_RC(rc, ttySetAttr(ttyfd, &tio));
#else /* !TERMIO_STRUCT */
if (ioctl(ttyfd, TIOCGETP, (char *) &sg) == -1)
sg = d_sg;
@@ -4022,10 +4028,12 @@ spawnXTerm(XtermWidget xw)
/* position to entry in utmp file */
/* Test return value: beware of entries left behind: PSz 9 Mar 00 */
- if (!(utret = find_utmp(&utmp))) {
+ utret = find_utmp(&utmp);
+ if (utret == 0) {
(void) call_setutent();
init_utmp(USER_PROCESS, &utmp);
- if (!(utret = find_utmp(&utmp))) {
+ utret = find_utmp(&utmp);
+ if (utret == 0) {
(void) call_setutent();
}
}
@@ -4242,8 +4250,8 @@ spawnXTerm(XtermWidget xw)
sizeof(handshake)));
if (resource.wait_for_map) {
- i = read(pc_pipe[0], (char *) &handshake,
- sizeof(handshake));
+ i = (int) read(pc_pipe[0], (char *) &handshake,
+ sizeof(handshake));
if (i != sizeof(handshake) ||
handshake.status != PTY_EXEC) {
/* some very bad problem occurred */
@@ -4256,11 +4264,11 @@ spawnXTerm(XtermWidget xw)
set_max_col(screen, handshake.cols);
#ifdef TTYSIZE_STRUCT
got_handshake_size = True;
- TTYSIZE_ROWS(ts) = MaxRows(screen);
- TTYSIZE_COLS(ts) = MaxCols(screen);
+ TTYSIZE_ROWS(ts) = (ttySize_t) MaxRows(screen);
+ TTYSIZE_COLS(ts) = (ttySize_t) MaxCols(screen);
#if defined(USE_STRUCT_WINSIZE)
- ts.ws_xpixel = FullWidth(screen);
- ts.ws_ypixel = FullHeight(screen);
+ ts.ws_xpixel = (ttySize_t) FullWidth(screen);
+ ts.ws_ypixel = (ttySize_t) FullHeight(screen);
#endif
#endif /* TTYSIZE_STRUCT */
}
@@ -4309,7 +4317,7 @@ spawnXTerm(XtermWidget xw)
#if OPT_INITIAL_ERASE
unsigned len;
remove_termcap_entry(newtc, TERMCAP_ERASE "=");
- len = strlen(newtc);
+ len = (unsigned) strlen(newtc);
if (len != 0 && newtc[len - 1] == ':')
len--;
sprintf(newtc + len, ":%s=\\%03o:",
@@ -4332,7 +4340,7 @@ spawnXTerm(XtermWidget xw)
&& resource.ptySttySize
&& (got_handshake_size || !resource.wait_for_map0)) {
#ifdef TTYSIZE_STRUCT
- i = SET_TTYSIZE(0, ts);
+ TRACE_RC(i, SET_TTYSIZE(0, ts));
TRACE(("ptyHandshake SET_TTYSIZE %dx%d return %d\n",
TTYSIZE_ROWS(ts),
TTYSIZE_COLS(ts), i));
@@ -4577,7 +4585,8 @@ spawnXTerm(XtermWidget xw)
SIGNAL_T
Exit(int n)
{
- TScreen *screen = TScreenOf(term);
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
#ifdef USE_UTEMPTER
if (!resource.utmpInhibit && added_utmp_entry)
@@ -4628,15 +4637,15 @@ Exit(int n)
(void) call_pututline(utptr);
#ifdef WTMP
#if defined(WTMPX_FILE) && (defined(SVR4) || defined(__SCO__))
- if (term->misc.login_shell)
+ if (xw->misc.login_shell)
updwtmpx(WTMPX_FILE, utptr);
#elif defined(linux) && defined(__GLIBC__) && (__GLIBC__ >= 2) && !(defined(__powerpc__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0))
strncpy(utmp.ut_line, utptr->ut_line, sizeof(utmp.ut_line));
- if (term->misc.login_shell)
+ if (xw->misc.login_shell)
call_updwtmp(etc_wtmp, utptr);
#else
/* set wtmp entry if wtmp file exists */
- if (term->misc.login_shell) {
+ if (xw->misc.login_shell) {
int fd;
if ((fd = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) {
write(fd, utptr, sizeof(*utptr));
@@ -4672,7 +4681,7 @@ Exit(int n)
close(wfd);
}
#ifdef WTMP
- if (term->misc.login_shell &&
+ if (xw->misc.login_shell &&
(wfd = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) {
(void) strncpy(utmp.ut_line,
my_pty_name(ttydev),
@@ -4712,14 +4721,14 @@ Exit(int n)
close(screen->respond); /* close explicitly to avoid race with slave side */
#ifdef ALLOWLOGGING
if (screen->logging)
- CloseLog(screen);
+ CloseLog(xw);
#endif
#ifdef NO_LEAKS
if (n == 0) {
TRACE(("Freeing memory leaks\n"));
- if (term != 0) {
- Display *dpy = TScreenOf(term)->display;
+ if (xw != 0) {
+ Display *dpy = TScreenOf(xw)->display;
if (toplevel) {
XtDestroyWidget(toplevel);
@@ -4739,7 +4748,7 @@ Exit(int n)
#endif
TRACE(("closed display\n"));
}
- TRACE((0));
+ TRACE_CLOSE();
}
#endif
diff --git a/app/xterm/main.h b/app/xterm/main.h
index 7aa9c88e6..75a105ef5 100644
--- a/app/xterm/main.h
+++ b/app/xterm/main.h
@@ -1,4 +1,4 @@
-/* $XTermId: main.h,v 1.52 2010/04/14 09:51:45 tom Exp $ */
+/* $XTermId: main.h,v 1.54 2010/06/20 20:22:32 tom Exp $ */
/*
* Copyright 2000-2009,2010 by Thomas E. Dickey
@@ -87,10 +87,18 @@
#define DEFFACENAME NULL
#endif
+#ifndef DEFFACENAME_AUTO
+#define DEFFACENAME_AUTO "mono"
+#endif
+
#ifndef DEFFACESIZE
#define DEFFACESIZE "14.0"
#endif
+#ifndef DEFFACESIZE
+#define DEFFACESIZE_AUTO "8.0"
+#endif
+
#ifndef DEF_ALLOW_COLOR
#define DEF_ALLOW_COLOR True
#endif
diff --git a/app/xterm/menu.c b/app/xterm/menu.c
index 92eec1942..3179feeea 100644
--- a/app/xterm/menu.c
+++ b/app/xterm/menu.c
@@ -1,4 +1,4 @@
-/* $XTermId: menu.c,v 1.262 2010/04/17 15:52:49 tom Exp $ */
+/* $XTermId: menu.c,v 1.267 2010/06/20 21:09:10 tom Exp $ */
/*
*
@@ -597,24 +597,25 @@ domenu(Widget w,
String * params, /* mainMenu, vtMenu, or tekMenu */
Cardinal *param_count) /* 0 or 1 */
{
- TScreen *screen = TScreenOf(term);
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
MenuIndex me;
Bool created = False;
Widget mw;
if (*param_count != 1) {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
return False;
}
if ((me = indexOfMenu(params[0])) == noMenu) {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
return False;
}
if ((mw = obtain_menu(w, me)) == 0
|| sizeof_menu(w, me) == 0) {
- mw = create_menu(w, term, me);
+ mw = create_menu(w, xw, me);
created = (mw != 0);
}
if (mw == 0)
@@ -642,7 +643,7 @@ domenu(Widget w,
False);
}
#endif
- if (!xtermHasPrinter(term)) {
+ if (!xtermHasPrinter(xw)) {
SetItemSensitivity(mainMenuEntries[mainMenu_print].widget,
False);
SetItemSensitivity(mainMenuEntries[mainMenu_print_redir].widget,
@@ -742,7 +743,7 @@ domenu(Widget w,
#endif
#if OPT_DEC_CHRSET
update_font_doublesize();
- if (TScreenOf(term)->cache_doublesize == 0)
+ if (TScreenOf(xw)->cache_doublesize == 0)
SetItemSensitivity(
fontMenuEntries[fontMenu_font_doublesize].widget,
False);
@@ -763,7 +764,7 @@ domenu(Widget w,
enable_allow_xxx_ops(!(screen->allowSendEvents));
#endif
}
- FindFontSelection(term, NULL, True);
+ FindFontSelection(xw, NULL, True);
SetItemSensitivity(
fontMenuEntries[fontMenu_fontsel].widget,
(screen->menu_font_names[fontMenu_fontsel]
@@ -843,20 +844,21 @@ do_securekbd(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = TScreenOf(term);
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
Time now = CurrentTime; /* XXX - wrong */
if (screen->grabbedKbd) {
XUngrabKeyboard(screen->display, now);
- ReverseVideo(term);
+ ReverseVideo(xw);
screen->grabbedKbd = False;
} else {
if (XGrabKeyboard(screen->display, XtWindow(CURRENT_EMU()),
True, GrabModeAsync, GrabModeAsync, now)
!= GrabSuccess) {
- Bell(XkbBI_MinorError, 100);
+ Bell(xw, XkbBI_MinorError, 100);
} else {
- ReverseVideo(term);
+ ReverseVideo(xw);
screen->grabbedKbd = True;
}
}
@@ -936,12 +938,13 @@ do_logging(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = TScreenOf(term);
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
if (screen->logging) {
- CloseLog(screen);
+ CloseLog(xw);
} else {
- StartLog(screen);
+ StartLog(xw);
}
/* update_logging done by CloseLog and StartLog */
}
@@ -1335,16 +1338,17 @@ do_marginbell(Widget gw GCC_UNUSED,
static void
handle_tekshow(Widget gw GCC_UNUSED, Bool allowswitch)
{
- TScreen *screen = TScreenOf(term);
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
TRACE(("Show tek-window\n"));
- if (!TEK4014_SHOWN(term)) { /* not showing, turn on */
+ if (!TEK4014_SHOWN(xw)) { /* not showing, turn on */
set_tek_visibility(True);
} else if (screen->Vshow || allowswitch) { /* is showing, turn off */
set_tek_visibility(False);
end_tek_mode(); /* WARNING: this does a longjmp */
} else
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
/* ARGSUSED */
@@ -1469,16 +1473,17 @@ do_vtfont(Widget gw GCC_UNUSED,
XtPointer closure,
XtPointer data GCC_UNUSED)
{
+ XtermWidget xw = term;
char *entryname = (char *) closure;
int i;
for (i = 0; i < NMENUFONTS; i++) {
if (strcmp(entryname, fontMenuEntries[i].name) == 0) {
- SetVTFont(term, i, True, NULL);
+ SetVTFont(xw, i, True, NULL);
return;
}
}
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
#if OPT_DEC_CHRSET
@@ -1487,8 +1492,10 @@ do_font_doublesize(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- if (TScreenOf(term)->cache_doublesize != 0)
- ToggleFlag(TScreenOf(term)->font_doublesize);
+ XtermWidget xw = term;
+
+ if (TScreenOf(xw)->cache_doublesize != 0)
+ ToggleFlag(TScreenOf(xw)->font_doublesize);
update_font_doublesize();
Redraw();
}
@@ -1533,13 +1540,15 @@ do_font_renderfont(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
- TScreen *screen = TScreenOf(term);
+ XtermWidget xw = (XtermWidget) term;
+ TScreen *screen = TScreenOf(xw);
int fontnum = screen->menu_font_number;
- String name = TScreenOf(term)->MenuFontName(fontnum);
+ String name = TScreenOf(xw)->MenuFontName(fontnum);
- ToggleFlag(term->misc.render_font);
+ DefaultRenderFont(xw);
+ ToggleFlag(xw->misc.render_font);
update_font_renderfont();
- xtermLoadFont(term, xtermFontName(name), True, fontnum);
+ xtermLoadFont(xw, xtermFontName(name), True, fontnum);
ScrnRefresh(term, 0, 0,
MaxRows(screen),
MaxCols(screen), True);
@@ -1651,18 +1660,19 @@ do_tekcopy(Widget gw,
static void
handle_vtshow(Widget gw GCC_UNUSED, Bool allowswitch)
{
- TScreen *screen = TScreenOf(term);
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
TRACE(("Show vt-window\n"));
if (!screen->Vshow) { /* not showing, turn on */
set_vt_visibility(True);
- } else if (TEK4014_SHOWN(term) || allowswitch) { /* is showing, turn off */
+ } else if (TEK4014_SHOWN(xw) || allowswitch) { /* is showing, turn off */
set_vt_visibility(False);
- if (!TEK4014_ACTIVE(term) && tekRefreshList)
+ if (!TEK4014_ACTIVE(xw) && tekRefreshList)
TekRefresh(tekWidget);
end_vt_mode(); /* WARNING: this does a longjmp... */
} else
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
static void
@@ -1712,6 +1722,7 @@ handle_toggle(void (*proc) PROTO_XT_CALLBACK_ARGS,
XtPointer closure,
XtPointer data)
{
+ XtermWidget xw = term;
int dir = -2;
switch (nparams) {
@@ -1730,7 +1741,7 @@ handle_toggle(void (*proc) PROTO_XT_CALLBACK_ARGS,
switch (dir) {
case -2:
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
break;
case -1:
@@ -1741,14 +1752,14 @@ handle_toggle(void (*proc) PROTO_XT_CALLBACK_ARGS,
if (var)
(*proc) (w, closure, data);
else
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
break;
case 1:
if (!var)
(*proc) (w, closure, data);
else
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
break;
}
return;
@@ -1884,7 +1895,7 @@ HandleSendSignal(Widget w,
/* one could allow numeric values, but that would be a security hole */
}
- Bell(XkbBI_MinorError, 0);
+ Bell(term, XkbBI_MinorError, 0);
}
/* ARGSUSED */
@@ -2023,10 +2034,12 @@ HandleScrollbar(Widget w,
String * params,
Cardinal *param_count)
{
- if (IsIcon(TScreenOf(term))) {
- Bell(XkbBI_MinorError, 0);
+ XtermWidget xw = term;
+
+ if (IsIcon(TScreenOf(xw))) {
+ Bell(xw, XkbBI_MinorError, 0);
} else {
- handle_vt_toggle(do_scrollbar, TScreenOf(term)->fullVwin.sb_info.width,
+ handle_vt_toggle(do_scrollbar, TScreenOf(xw)->fullVwin.sb_info.width,
params, *param_count, w);
}
}
@@ -2292,7 +2305,11 @@ HandleRenderFont(Widget w,
String * params,
Cardinal *param_count)
{
- handle_vt_toggle(do_font_renderfont, term->misc.render_font,
+ XtermWidget xw = (XtermWidget) term;
+
+ DefaultRenderFont(xw);
+
+ handle_vt_toggle(do_font_renderfont, xw->misc.render_font,
params, *param_count, w);
}
#endif
@@ -2326,23 +2343,25 @@ HandleSetTerminalType(Widget w,
String * params,
Cardinal *param_count)
{
+ XtermWidget xw = term;
+
if (*param_count == 1) {
switch (params[0][0]) {
case 'v':
case 'V':
- if (TEK4014_ACTIVE(term))
+ if (TEK4014_ACTIVE(xw))
do_vtmode(w, (XtPointer) 0, (XtPointer) 0);
break;
case 't':
case 'T':
- if (!TEK4014_ACTIVE(term))
+ if (!TEK4014_ACTIVE(xw))
do_tekmode(w, (XtPointer) 0, (XtPointer) 0);
break;
default:
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
} else {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
}
@@ -2352,23 +2371,25 @@ HandleVisibility(Widget w,
String * params,
Cardinal *param_count)
{
+ XtermWidget xw = term;
+
if (*param_count == 2) {
switch (params[0][0]) {
case 'v':
case 'V':
- handle_tek_toggle(do_vtonoff, (int) TScreenOf(term)->Vshow,
+ handle_tek_toggle(do_vtonoff, (int) TScreenOf(xw)->Vshow,
params + 1, (*param_count) - 1, w);
break;
case 't':
case 'T':
- handle_tek_toggle(do_tekonoff, (int) TEK4014_SHOWN(term),
+ handle_tek_toggle(do_tekonoff, (int) TEK4014_SHOWN(xw),
params + 1, (*param_count) - 1, w);
break;
default:
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
} else {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
}
@@ -2379,6 +2400,7 @@ HandleSetTekText(Widget w,
String * params,
Cardinal *param_count)
{
+ XtermWidget xw = term;
void (*proc) PROTO_XT_CALLBACK_ARGS = 0;
switch (*param_count) {
@@ -2405,7 +2427,7 @@ HandleSetTekText(Widget w,
if (proc)
(*proc) (w, (XtPointer) 0, (XtPointer) 0);
else
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
/* ARGSUSED */
@@ -2610,7 +2632,7 @@ SetupMenus(Widget shell, Widget *forms, Widget *menus, Dimension * menu_high)
}
#if OPT_TEK4014
else { /* tek4014 */
- button_height = SetupShell(menus, tek_shell, mainMenu, -1);
+ (void) SetupShell(menus, tek_shell, mainMenu, -1);
button_height = SetupShell(menus, tek_shell, tekMenu, mainMenu);
}
#endif
@@ -2750,20 +2772,22 @@ show_toolbar(Widget w)
void
ShowToolbar(Bool enable)
{
+ XtermWidget xw = term;
+
TRACE(("ShowToolbar(%d)\n", enable));
- if (IsIcon(TScreenOf(term))) {
- Bell(XkbBI_MinorError, 0);
+ if (IsIcon(TScreenOf(xw))) {
+ Bell(xw, XkbBI_MinorError, 0);
} else {
if (enable) {
if (InitWidgetMenu(toplevel))
- show_toolbar((Widget) term);
+ show_toolbar((Widget) xw);
#if OPT_TEK4014
if (InitWidgetMenu(tekshellwidget))
show_toolbar((Widget) tekWidget);
#endif
} else {
- hide_toolbar((Widget) term);
+ hide_toolbar((Widget) xw);
#if OPT_TEK4014
hide_toolbar((Widget) tekWidget);
#endif
@@ -2779,8 +2803,10 @@ HandleToolbar(Widget w,
String * params GCC_UNUSED,
Cardinal *param_count GCC_UNUSED)
{
- if (IsIcon(TScreenOf(term))) {
- Bell(XkbBI_MinorError, 0);
+ XtermWidget xw = term;
+
+ if (IsIcon(TScreenOf(xw))) {
+ Bell(xw, XkbBI_MinorError, 0);
} else {
handle_vt_toggle(do_toolbar, resource.toolBar,
params, *param_count, w);
@@ -2793,13 +2819,15 @@ do_toolbar(Widget gw GCC_UNUSED,
XtPointer closure GCC_UNUSED,
XtPointer data GCC_UNUSED)
{
+ XtermWidget xw = term;
+
/*
* Toggle toolbars for both vt100 and tek windows, since they share the
* menu which contains the checkbox indicating whether the toolbar is
* active.
*/
- if (IsIcon(TScreenOf(term))) {
- Bell(XkbBI_MinorError, 0);
+ if (IsIcon(TScreenOf(xw))) {
+ Bell(xw, XkbBI_MinorError, 0);
} else {
ShowToolbar(ToggleFlag(resource.toolBar));
}
@@ -3226,7 +3254,7 @@ update_font_renderfont(void)
UpdateCheckbox("update_font_renderfont",
fontMenuEntries,
fontMenu_render_font,
- term->misc.render_font);
+ (term->misc.render_font == True));
SetItemSensitivity(fontMenuEntries[fontMenu_render_font].widget,
!IsEmpty(term->misc.face_name));
}
diff --git a/app/xterm/misc.c b/app/xterm/misc.c
index 3739d8a0b..7b2bb4b6c 100644
--- a/app/xterm/misc.c
+++ b/app/xterm/misc.c
@@ -1,4 +1,4 @@
-/* $XTermId: misc.c,v 1.493 2010/04/18 17:51:44 tom Exp $ */
+/* $XTermId: misc.c,v 1.503 2010/06/20 21:33:49 tom Exp $ */
/*
* Copyright 1999-2009,2010 by Thomas E. Dickey
@@ -127,7 +127,7 @@ static char *
Readlink(const char *filename)
{
char *buf = NULL;
- unsigned size = 100;
+ size_t size = 100;
int n;
for (;;) {
@@ -373,19 +373,23 @@ xevents(void)
/*
* process timeouts, relying on the fact that XtAppProcessEvent
* will process the timeout and return without blockng on the
- * XEvent queue. Other sources i.e. the pty are handled elsewhere
+ * XEvent queue. Other sources i.e., the pty are handled elsewhere
* with select().
*/
- while ((input_mask = XtAppPending(app_con)) & XtIMTimer)
- XtAppProcessEvent(app_con, XtIMTimer);
+ while ((input_mask = XtAppPending(app_con)) != 0) {
+ if (input_mask & XtIMTimer)
+ XtAppProcessEvent(app_con, (XtInputMask) XtIMTimer);
#if OPT_SESSION_MGT
- /*
- * Session management events are alternative input events. Deal with
- * them in the same way.
- */
- while ((input_mask = XtAppPending(app_con)) & XtIMAlternateInput)
- XtAppProcessEvent(app_con, XtIMAlternateInput);
+ /*
+ * Session management events are alternative input events. Deal with
+ * them in the same way.
+ */
+ else if (input_mask & XtIMAlternateInput)
+ XtAppProcessEvent(app_con, (XtInputMask) XtIMAlternateInput);
#endif
+ else
+ break;
+ }
/*
* If there's no XEvents, don't wait around...
@@ -445,6 +449,7 @@ xevents(void)
case Expose:
case NoExpose:
case PropertyNotify:
+ case ClientMessage:
break;
default:
xtermShowPointer(xw, True);
@@ -454,7 +459,7 @@ xevents(void)
XtDispatchEvent(&event);
}
- } while ((input_mask = XtAppPending(app_con)) & XtIMXEvent);
+ } while (XtAppPending(app_con) & XtIMXEvent);
}
static Cursor
@@ -562,7 +567,7 @@ HandleStringEvent(Widget w GCC_UNUSED,
StringInput(term, hexval, (size_t) 1);
}
} else {
- StringInput(term, (Char *) * params, strlen(*params));
+ StringInput(term, (const Char *) *params, strlen(*params));
}
}
@@ -592,8 +597,8 @@ HandleSpawnTerminal(Widget w GCC_UNUSED,
*/
child_exe = Readlink(PROCFS_ROOT "/self/exe");
if (!child_exe) {
- if (strncmp(ProgramName, "./", 2)
- && strncmp(ProgramName, "../", 3)) {
+ if (strncmp(ProgramName, "./", (size_t) 2)
+ && strncmp(ProgramName, "../", (size_t) 3)) {
child_exe = xtermFindShell(ProgramName, True);
} else {
fprintf(stderr, "Cannot exec-xterm given %s\n", ProgramName);
@@ -675,14 +680,14 @@ HandleInterpret(Widget w GCC_UNUSED,
Cardinal *param_count)
{
if (*param_count == 1) {
- char *value = params[0];
+ const char *value = params[0];
int need = (int) strlen(value);
int used = (int) (VTbuffer->next - VTbuffer->buffer);
int have = (int) (VTbuffer->last - VTbuffer->buffer);
if (have - used + need < BUF_SIZE) {
- fillPtyData(TScreenOf(term), VTbuffer, value, (int) strlen(value));
+ fillPtyData(term, VTbuffer, value, (int) strlen(value));
TRACE(("Interpret %s\n", value));
VTbuffer->update++;
@@ -771,7 +776,7 @@ HandleFocusChange(Widget w GCC_UNUSED,
: FOCUS));
}
if (screen->grabbedKbd && (event->mode == NotifyUngrab)) {
- Bell(XkbBI_Info, 100);
+ Bell(xw, XkbBI_Info, 100);
ReverseVideo(xw);
screen->grabbedKbd = False;
update_securekbd();
@@ -857,9 +862,8 @@ xtermBell(XtermWidget xw, int which, int percent)
}
void
-Bell(int which, int percent)
+Bell(XtermWidget xw, int which, int percent)
{
- XtermWidget xw = term;
TScreen *screen = TScreenOf(xw);
struct timeval curtime;
long now_msecs;
@@ -1099,7 +1103,11 @@ dabbrev_expand(TScreen * screen)
screen->dabbrev_working = True;
/* we are in the middle of dabbrev process */
}
+ } else {
+ return result;
}
+ } else {
+ return result;
}
if (!screen->dabbrev_working) {
if (lastexpansion != 0) {
@@ -1108,9 +1116,11 @@ dabbrev_expand(TScreen * screen)
}
return result;
}
- } else {
}
+ if (dabbrev_hint == 0)
+ return result;
+
hint_len = strlen(dabbrev_hint);
for (;;) {
if ((expansion = dabbrev_prev_word(screen, &cell, &ld)) == 0) {
@@ -1168,7 +1178,7 @@ HandleDabbrevExpand(Widget w,
if ((xw = getXtermWidget(w)) != 0) {
TScreen *screen = TScreenOf(xw);
if (!dabbrev_expand(screen))
- Bell(XkbBI_TerminalBell, 0);
+ Bell(xw, XkbBI_TerminalBell, 0);
}
}
#endif /* OPT_DABBREV */
@@ -1595,23 +1605,25 @@ xtermResetIds(TScreen * screen)
static SIGNAL_T
logpipe(int sig GCC_UNUSED)
{
- TScreen *screen = TScreenOf(term);
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
#ifdef SYSV
(void) signal(SIGPIPE, SIG_IGN);
#endif /* SYSV */
if (screen->logging)
- CloseLog(screen);
+ CloseLog(xw);
}
#endif /* ALLOWLOGFILEEXEC */
void
-StartLog(TScreen * screen)
+StartLog(XtermWidget xw)
{
static char *log_default;
#ifdef ALLOWLOGFILEEXEC
char *cp;
#endif /* ALLOWLOGFILEEXEC */
+ TScreen *screen = TScreenOf(xw);
if (screen->logging || (screen->inhibit & I_LOG))
return;
@@ -1717,8 +1729,8 @@ StartLog(TScreen * screen)
screen->logfd = p[1];
signal(SIGPIPE, logpipe);
#else
- Bell(XkbBI_Info, 0);
- Bell(XkbBI_Info, 0);
+ Bell(xw, XkbBI_Info, 0);
+ Bell(xw, XkbBI_Info, 0);
return;
#endif
} else {
@@ -1735,19 +1747,23 @@ StartLog(TScreen * screen)
}
void
-CloseLog(TScreen * screen)
+CloseLog(XtermWidget xw)
{
+ TScreen *screen = TScreenOf(xw);
+
if (!screen->logging || (screen->inhibit & I_LOG))
return;
- FlushLog(screen);
+ FlushLog(xw);
close(screen->logfd);
screen->logging = False;
update_logging();
}
void
-FlushLog(TScreen * screen)
+FlushLog(XtermWidget xw)
{
+ TScreen *screen = TScreenOf(xw);
+
if (screen->logging && !(screen->inhibit & I_LOG)) {
Char *cp;
int i;
@@ -1921,7 +1937,7 @@ find_closest_color(Display * dpy, Colormap cmap, XColor * def)
static int
AllocateAnsiColor(XtermWidget xw,
ColorRes * res,
- char *spec)
+ const char *spec)
{
int result;
XColor def;
@@ -1988,7 +2004,7 @@ xtermGetColorRes(XtermWidget xw, ColorRes * res)
#endif
static int
-ChangeOneAnsiColor(XtermWidget xw, int color, char *name)
+ChangeOneAnsiColor(XtermWidget xw, int color, const char *name)
{
int code;
@@ -2190,7 +2206,7 @@ ManipulateSelectionData(XtermWidget xw, TScreen * screen, char *buf, int final)
screen->base64_final = final;
/* terminator will be written in this call */
- xtermGetSelection((Widget) xw, 0, select_args, n, NULL);
+ xtermGetSelection((Widget) xw, (Time) 0, select_args, n, NULL);
}
} else {
if (AllowWindowOps(xw, ewSetSelection)) {
@@ -2494,7 +2510,7 @@ ResetColorsRequest(XtermWidget xw,
int code)
{
Bool result = False;
- char *thisName;
+ const char *thisName;
ScrnColors newColors;
int ndx;
@@ -2577,13 +2593,13 @@ QueryFontRequest(XtermWidget xw, char *buf, int final)
Bool success = True;
int num;
char *base = buf + 1;
- char *name = 0;
+ const char *name = 0;
char temp[10];
num = ParseShiftedFont(xw, buf, &buf);
if (num < 0
|| num > fontMenu_lastBuiltin) {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
success = False;
} else {
#if OPT_RENDERFONT
@@ -2641,7 +2657,7 @@ ChangeFontRequest(XtermWidget xw, char *buf)
if (num < 0
|| num > fontMenu_lastBuiltin) {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
success = False;
} else {
/*
@@ -2688,7 +2704,7 @@ ChangeFontRequest(XtermWidget xw, char *buf)
SetVTFont(xw, num, True, &fonts);
}
} else {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
free(name);
}
@@ -2899,8 +2915,8 @@ do_osc(XtermWidget xw, Char * oscbuf, size_t len, int final)
break;
}
#endif
- Bell(XkbBI_Info, 0);
- Bell(XkbBI_Info, 0);
+ Bell(xw, XkbBI_Info, 0);
+ Bell(xw, XkbBI_Info, 0);
break;
#endif /* ALLOWLOGGING */
@@ -3474,11 +3490,11 @@ ChangeGroup(XtermWidget xw, const char *attribute, char *value)
/* If the attribute isn't going to change, then don't bother... */
if (resource.sameName) {
- char *buf;
+ char *buf = 0;
XtSetArg(args[0], my_attr, &buf);
XtGetValues(top, args, 1);
TRACE(("...comparing{%s}\n", buf));
- if (strcmp(name, buf) == 0)
+ if (buf != 0 && strcmp(name, buf) == 0)
changed = False;
}
#endif /* OPT_SAME_NAME */
@@ -3709,7 +3725,6 @@ SysReasonMsg(int code)
{ ERROR_INIT, "spawn: can't initialize window" },
{ ERROR_TIOCKSET, "spawn: ioctl() failed on TIOCKSET" },
{ ERROR_TIOCKSETC, "spawn: ioctl() failed on TIOCKSETC" },
- { ERROR_SPREALLOC, "spawn: realloc of ttydev failed" },
{ ERROR_LUMALLOC, "luit: command-line malloc failed" },
{ ERROR_SELECT, "in_put: select() failed" },
{ ERROR_VINIT, "VTInit: can't initialize window" },
@@ -3785,7 +3800,7 @@ Cleanup(int code)
if (resource.sessionMgt) {
XtVaSetValues(toplevel,
XtNjoinSession, False,
- (XtPointer *) 0);
+ NULL);
}
#endif
}
@@ -4032,22 +4047,27 @@ set_tek_visibility(Bool on)
TRACE(("set_tek_visibility(%d)\n", on));
if (on) {
- if (!TEK4014_SHOWN(term) && (tekWidget || TekInit())) {
- Widget tekParent = SHELL_OF(tekWidget);
- XtRealizeWidget(tekParent);
- XtMapWidget(XtParent(tekWidget));
+ if (!TEK4014_SHOWN(term)) {
+ if (tekWidget == 0) {
+ TekInit(); /* will exit on failure */
+ }
+ if (tekWidget != 0) {
+ Widget tekParent = SHELL_OF(tekWidget);
+ XtRealizeWidget(tekParent);
+ XtMapWidget(XtParent(tekWidget));
#if OPT_TOOLBAR
- /* we need both of these during initialization */
- XtMapWidget(tekParent);
- XtMapWidget(tekWidget);
+ /* we need both of these during initialization */
+ XtMapWidget(tekParent);
+ XtMapWidget(tekWidget);
#endif
- XtOverrideTranslations(tekParent,
- XtParseTranslationTable
- ("<Message>WM_PROTOCOLS: DeleteWindow()"));
- (void) XSetWMProtocols(XtDisplay(tekParent),
- XtWindow(tekParent),
- &wm_delete_window, 1);
- TEK4014_SHOWN(term) = True;
+ XtOverrideTranslations(tekParent,
+ XtParseTranslationTable
+ ("<Message>WM_PROTOCOLS: DeleteWindow()"));
+ (void) XSetWMProtocols(XtDisplay(tekParent),
+ XtWindow(tekParent),
+ &wm_delete_window, 1);
+ TEK4014_SHOWN(term) = True;
+ }
}
} else {
if (TEK4014_SHOWN(term) && tekWidget) {
@@ -4068,8 +4088,10 @@ set_tek_visibility(Bool on)
void
end_tek_mode(void)
{
- if (TEK4014_ACTIVE(term)) {
- FlushLog(TScreenOf(term));
+ XtermWidget xw = term;
+
+ if (TEK4014_ACTIVE(xw)) {
+ FlushLog(xw);
longjmp(Tekend, 1);
}
return;
@@ -4078,9 +4100,11 @@ end_tek_mode(void)
void
end_vt_mode(void)
{
- if (!TEK4014_ACTIVE(term)) {
- FlushLog(TScreenOf(term));
- TEK4014_ACTIVE(term) = True;
+ XtermWidget xw = term;
+
+ if (!TEK4014_ACTIVE(xw)) {
+ FlushLog(xw);
+ TEK4014_ACTIVE(xw) = True;
longjmp(VTend, 1);
}
return;
@@ -4146,9 +4170,11 @@ sortedOptDescs(XrmOptionDescRec * descs, Cardinal res_count)
static XrmOptionDescRec *res_array = 0;
#ifdef NO_LEAKS
- if (descs == 0 && res_array != 0) {
- free(res_array);
- res_array = 0;
+ if (descs == 0) {
+ if (res_array != 0) {
+ free(res_array);
+ res_array = 0;
+ }
} else
#endif
if (res_array == 0) {
@@ -4156,9 +4182,11 @@ sortedOptDescs(XrmOptionDescRec * descs, Cardinal res_count)
/* make a sorted index to 'resources' */
res_array = TypeCallocN(XrmOptionDescRec, res_count);
- for (j = 0; j < res_count; j++)
- res_array[j] = descs[j];
- qsort(res_array, (size_t) res_count, sizeof(*res_array), cmp_resources);
+ if (res_array != 0) {
+ for (j = 0; j < res_count; j++)
+ res_array[j] = descs[j];
+ qsort(res_array, (size_t) res_count, sizeof(*res_array), cmp_resources);
+ }
}
return res_array;
}
@@ -4210,9 +4238,9 @@ sortedOpts(OptionHelp * options, XrmOptionDescRec * descs, Cardinal numDescs)
#if OPT_TRACE
for (j = 0; j < opt_count; j++) {
if (!strncmp(opt_array[j].opt, "-/+", 3)) {
- char *name = opt_array[j].opt + 3;
+ const char *name = opt_array[j].opt + 3;
for (k = 0; k < numDescs; ++k) {
- char *value = res_array[k].value;
+ const char *value = res_array[k].value;
if (res_array[k].option[0] == '-') {
code = -1;
} else if (res_array[k].option[0] == '+') {
@@ -4335,9 +4363,11 @@ xtermEnvUTF8(void)
char *
xtermVersion(void)
{
+ static char vendor_version[] = __vendorversion__;
static char *result;
+
if (result == 0) {
- char *vendor = __vendorversion__;
+ char *vendor = vendor_version;
char first[BUFSIZ];
char second[BUFSIZ];
diff --git a/app/xterm/os2main.c b/app/xterm/os2main.c
index 5cb117ee2..d560e8c90 100644
--- a/app/xterm/os2main.c
+++ b/app/xterm/os2main.c
@@ -1,4 +1,4 @@
-/* $XTermId: os2main.c,v 1.263 2010/01/01 22:26:10 tom Exp $ */
+/* $XTermId: os2main.c,v 1.265 2010/06/20 21:27:07 tom Exp $ */
/* removed all foreign stuff to get the code more clear (hv)
* and did some rewrite for the obscure OS/2 environment
@@ -1349,7 +1349,7 @@ main(int argc, char **argv ENVP_ARG)
initPtyData(&VTbuffer);
#ifdef ALLOWLOGGING
if (term->misc.log_on) {
- StartLog(screen);
+ StartLog(term);
}
#endif
@@ -1764,12 +1764,7 @@ spawnXTerm(XtermWidget xw)
*/
#ifdef EMXNOTBOGUS
if ((ptr = ttyname(ttyfd)) != 0) {
- /* it may be bigger */
- ttydev = TypeRealloc(char, strlen(ptr) + 1, ttydev);
- if (ttydev == NULL) {
- SysError(ERROR_SPREALLOC);
- }
- (void) strcpy(ttydev, ptr);
+ ttydev = x_strdup(ptr);
}
#else
ptr = ttydev;
@@ -1975,12 +1970,13 @@ spawnXTerm(XtermWidget xw)
SIGNAL_T
Exit(int n)
{
- TScreen *screen = TScreenOf(term);
- int pty = TScreenOf(term)->respond;
+ XtermWidget xw = term;
+ TScreen *screen = TScreenOf(xw);
+ int pty = TScreenOf(xw)->respond;
close(pty); /* close explicitly to avoid race with slave side */
#ifdef ALLOWLOGGING
if (screen->logging)
- CloseLog(screen);
+ CloseLog(xw);
#endif
if (am_slave < 0) {
/* restore ownership of tty and pty */
@@ -1995,14 +1991,14 @@ Exit(int n)
close(screen->respond); /* close explicitly to avoid race with slave side */
#ifdef ALLOWLOGGING
if (screen->logging)
- CloseLog(screen);
+ CloseLog(xw);
#endif
#ifdef NO_LEAKS
if (n == 0) {
TRACE(("Freeing memory leaks\n"));
- if (term != 0) {
- Display *dpy = TScreenOf(term)->display;
+ if (xw != 0) {
+ Display *dpy = TScreenOf(xw)->display;
if (toplevel) {
XtDestroyWidget(toplevel);
diff --git a/app/xterm/plink.sh b/app/xterm/plink.sh
index b6984c2d8..5fa63c1bb 100644
--- a/app/xterm/plink.sh
+++ b/app/xterm/plink.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $XTermId: plink.sh,v 1.5 2005/05/03 00:38:24 tom Exp $
+# $XTermId: plink.sh,v 1.6 2010/06/15 22:32:19 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
@@ -39,6 +39,10 @@ do
OPT="$1"
shift
case $OPT in
+ -k*)
+ OPT=`echo "$OPT" | sed -e 's/^-k/-l/'`
+ LINKIT="$LINKIT $OPT"
+ ;;
-l*)
echo "testing if $OPT is needed"
if ( eval $LINKIT $* >/dev/null 2>/dev/null )
diff --git a/app/xterm/print.c b/app/xterm/print.c
index a0dfed216..dc6e6e184 100644
--- a/app/xterm/print.c
+++ b/app/xterm/print.c
@@ -1,4 +1,4 @@
-/* $XTermId: print.c,v 1.116 2010/04/05 00:11:13 tom Exp $ */
+/* $XTermId: print.c,v 1.119 2010/06/13 17:46:27 tom Exp $ */
/************************************************************
@@ -186,8 +186,10 @@ printLine(XtermWidget xw, int row, unsigned chr, PrinterFlags * p)
)
&& ch) {
attr = CharOf(ld->attribs[col] & SGR_MASK);
+#if OPT_PRINT_COLORS
last_fg = fg;
last_bg = bg;
+#endif
if (p->print_attributes)
send_SGR(xw, attr, fg, bg);
}
@@ -277,7 +279,7 @@ xtermPrintScreen(XtermWidget xw, Bool use_DECPEX, PrinterFlags * p)
closePrinter(xw);
}
} else {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
}
@@ -405,7 +407,7 @@ charToPrinter(XtermWidget xw, unsigned chr)
SysError(ERROR_FORK);
if (Printer_pid == 0) {
- TRACE(((char *) 0));
+ TRACE_CLOSE();
close(my_pipe[1]); /* printer is silent */
close(screen->respond);
diff --git a/app/xterm/ptydata.c b/app/xterm/ptydata.c
index a90e4509c..781cce9cc 100644
--- a/app/xterm/ptydata.c
+++ b/app/xterm/ptydata.c
@@ -1,4 +1,4 @@
-/* $XTermId: ptydata.c,v 1.96 2010/04/18 17:51:56 tom Exp $ */
+/* $XTermId: ptydata.c,v 1.98 2010/06/20 21:41:15 tom Exp $ */
/************************************************************
@@ -171,13 +171,14 @@ decodeUtf8(PtyData * data)
#endif
int
-readPtyData(TScreen * screen, PtySelect * select_mask, PtyData * data)
+readPtyData(XtermWidget xw, PtySelect * select_mask, PtyData * data)
{
+ TScreen *screen = TScreenOf(xw);
int size = 0;
#ifdef VMS
if (*select_mask & pty_mask) {
- trimPtyData(screen, data);
+ trimPtyData(xw, data);
if (read_queue.flink != 0) {
size = tt_read(data->next);
if (size == 0) {
@@ -190,7 +191,7 @@ readPtyData(TScreen * screen, PtySelect * select_mask, PtyData * data)
#else /* !VMS */
if (FD_ISSET(screen->respond, select_mask)) {
int save_err;
- trimPtyData(screen, data);
+ trimPtyData(xw, data);
size = (int) read(screen->respond, (char *) data->last, (size_t) FRG_SIZE);
save_err = errno;
@@ -353,11 +354,11 @@ fakePtyData(PtyData * result, Char * next, Char * last)
* e.g., a continuation-read.
*/
void
-trimPtyData(TScreen * screen GCC_UNUSED, PtyData * data)
+trimPtyData(XtermWidget xw GCC_UNUSED, PtyData * data)
{
int i;
- FlushLog(screen);
+ FlushLog(xw);
if (data->next != data->buffer) {
int n = (int) (data->last - data->next);
@@ -377,13 +378,13 @@ trimPtyData(TScreen * screen GCC_UNUSED, PtyData * data)
* and nextPtyData() will return that.
*/
void
-fillPtyData(TScreen * screen, PtyData * data, char *value, int length)
+fillPtyData(XtermWidget xw, PtyData * data, const char *value, int length)
{
int size;
int n;
/* remove the used portion of the buffer */
- trimPtyData(screen, data);
+ trimPtyData(xw, data);
VTbuffer->last += length;
size = (int) (VTbuffer->last - VTbuffer->next);
diff --git a/app/xterm/ptyx.h b/app/xterm/ptyx.h
index f3b1e1a4d..24fa5c19a 100644
--- a/app/xterm/ptyx.h
+++ b/app/xterm/ptyx.h
@@ -1,4 +1,4 @@
-/* $XTermId: ptyx.h,v 1.666 2010/04/18 16:50:09 tom Exp $ */
+/* $XTermId: ptyx.h,v 1.670 2010/06/15 08:34:38 tom Exp $ */
/*
* Copyright 1999-2009,2010 by Thomas E. Dickey
@@ -328,8 +328,16 @@ typedef struct {
/*
* ANSI emulation, special character codes
*/
+#define ANSI_EOT 0x04
#define ANSI_BEL 0x07
+#define ANSI_BS 0x08
+#define ANSI_HT 0x09
+#define ANSI_LF 0x0A
+#define ANSI_VT 0x0B
#define ANSI_FF 0x0C /* C0, C1 control names */
+#define ANSI_CR 0x0D
+#define ANSI_SO 0x0E
+#define ANSI_SI 0x0F
#define ANSI_XON 0x11 /* DC1 */
#define ANSI_XOFF 0x13 /* DC3 */
#define ANSI_NAK 0x15
@@ -1321,6 +1329,17 @@ typedef struct {
} XTermFonts;
#if OPT_RENDERFONT
+typedef enum {
+ erFalse = 0
+ , erTrue
+ , erDefault
+ , erLast
+} RenderFont;
+
+#define DefaultRenderFont(xw) \
+ if ((xw)->misc.render_font == erDefault) \
+ (xw)->misc.render_font = erFalse
+
typedef struct {
XftFont * font;
FontMap map;
@@ -2072,6 +2091,12 @@ typedef enum { /* legal values for screen.utf8_mode */
#define KEYBOARD_TYPES NAME_TCAP_KT NAME_HP_KT NAME_SCO_KT NAME_SUN_KT NAME_VT220_KT
#if OPT_TRACE
+#define TRACE_RC(code,func) code = func
+#else
+#define TRACE_RC(code,func) func
+#endif
+
+#if OPT_TRACE
extern const char * visibleKeyboardType(xtermKeyboardType);
#endif
@@ -2192,6 +2217,7 @@ typedef struct _Misc {
char *face_name;
char *face_wide_name;
float face_size[NMENUFONTS];
+ char *render_font_s;
Boolean render_font;
#endif
} Misc;
@@ -2421,7 +2447,7 @@ typedef struct _TekWidgetRec {
/*
* Macro to check if we are iconified; do not use render for that case.
*/
-#define UsingRenderFont(xw) ((xw)->misc.render_font && !IsIcon(TScreenOf(xw)))
+#define UsingRenderFont(xw) (((xw)->misc.render_font == True) && !IsIcon(TScreenOf(xw)))
/*
* These definitions do not depend on whether xterm supports active-icon.
@@ -2531,6 +2557,10 @@ typedef struct Tek_Link
#define TRACE(p) /*nothing*/
#endif
+#ifndef TRACE_CLOSE
+#define TRACE_CLOSE() /*nothing*/
+#endif
+
#ifndef TRACE_ARGV
#define TRACE_ARGV(tag,argv) /*nothing*/
#endif
diff --git a/app/xterm/resize.c b/app/xterm/resize.c
index bc1cd1f0f..20cef5ebd 100644
--- a/app/xterm/resize.c
+++ b/app/xterm/resize.c
@@ -1,4 +1,4 @@
-/* $XTermId: resize.c,v 1.111 2010/04/18 16:35:02 tom Exp $ */
+/* $XTermId: resize.c,v 1.114 2010/05/23 16:04:32 tom Exp $ */
/*
* Copyright 2003-2009,2010 by Thomas E. Dickey
@@ -380,10 +380,11 @@ main(int argc, char **argv ENVP_ARG)
if (tmpbuf == 0) {
fprintf(stderr, "%s: Cannot query size\n", myname);
onintr(0);
+ } else {
+ sprintf(tmpbuf, setsize[emu], argv[0], argv[1]);
+ IGNORE_RC(write(tty, tmpbuf, strlen(tmpbuf)));
+ free(tmpbuf);
}
- sprintf(tmpbuf, setsize[emu], argv[0], argv[1]);
- IGNORE_RC(write(tty, tmpbuf, strlen(tmpbuf)));
- free(tmpbuf);
}
IGNORE_RC(write(tty, getsize[emu], strlen(getsize[emu])));
readstring(ttyfp, buf, size[emu]);
@@ -410,8 +411,8 @@ main(int argc, char **argv ENVP_ARG)
fprintf(stderr, "%s: Can't get window size\r\n", myname);
onintr(0);
}
- TTYSIZE_ROWS(ts) = rows;
- TTYSIZE_COLS(ts) = cols;
+ TTYSIZE_ROWS(ts) = (ttySize_t) rows;
+ TTYSIZE_COLS(ts) = (ttySize_t) cols;
SET_TTYSIZE(tty, ts);
} else if (ioctl(tty, TIOCGWINSZ, &ts) != -1) {
/* we don't have any way of directly finding out
@@ -419,11 +420,11 @@ main(int argc, char **argv ENVP_ARG)
our best by computing the font height and width from the "old"
window-size values, and multiplying by these ratios... */
if (TTYSIZE_COLS(ts) != 0)
- ts.ws_xpixel = cols * (ts.ws_xpixel / TTYSIZE_COLS(ts));
+ ts.ws_xpixel = (ttySize_t) (cols * (ts.ws_xpixel / TTYSIZE_COLS(ts)));
if (TTYSIZE_ROWS(ts) != 0)
- ts.ws_ypixel = rows * (ts.ws_ypixel / TTYSIZE_ROWS(ts));
- TTYSIZE_ROWS(ts) = rows;
- TTYSIZE_COLS(ts) = cols;
+ ts.ws_ypixel = (ttySize_t) (rows * (ts.ws_ypixel / TTYSIZE_ROWS(ts)));
+ TTYSIZE_ROWS(ts) = (ttySize_t) rows;
+ TTYSIZE_COLS(ts) = (ttySize_t) cols;
SET_TTYSIZE(tty, ts);
}
#endif /* USE_STRUCT_{TTYSIZE|WINSIZE} */
diff --git a/app/xterm/screen.c b/app/xterm/screen.c
index e05d1ee49..68fd7dd32 100644
--- a/app/xterm/screen.c
+++ b/app/xterm/screen.c
@@ -1,4 +1,4 @@
-/* $XTermId: screen.c,v 1.418 2010/04/28 23:49:28 tom Exp $ */
+/* $XTermId: screen.c,v 1.423 2010/06/14 00:00:58 tom Exp $ */
/*
* Copyright 1999-2009,2010 by Thomas E. Dickey
@@ -421,15 +421,13 @@ Reallocate(XtermWidget xw,
Char ** sbufaddr,
unsigned nrow,
unsigned ncol,
- unsigned oldrow,
- unsigned oldcol)
+ unsigned oldrow)
{
TScreen *screen = TScreenOf(xw);
ScrnBuf oldBufHead;
ScrnBuf newBufHead;
Char *newBufData;
unsigned minrows;
- unsigned mincols;
Char *oldBufData;
int move_down = 0, move_up = 0;
@@ -439,7 +437,7 @@ Reallocate(XtermWidget xw,
oldBufData = *sbufaddr;
- TRACE(("Reallocate %dx%d -> %dx%d\n", oldrow, oldcol, nrow, ncol));
+ TRACE(("Reallocate %dx%d -> %dx%d\n", oldrow, MaxCols(screen), nrow, ncol));
/*
* realloc sbuf, the pointers to all the lines.
@@ -482,7 +480,6 @@ Reallocate(XtermWidget xw,
*sbufaddr = newBufData;
minrows = (oldrow < nrow) ? oldrow : nrow;
- mincols = (oldcol < ncol) ? oldcol : ncol;
if (GravityIsSouthWest(xw)) {
if (nrow > oldrow) {
/* move data down to bottom of expanded screen */
@@ -590,7 +587,6 @@ void
ChangeToWide(XtermWidget xw)
{
TScreen *screen = TScreenOf(xw);
- int savelines = screen->scrollWidget ? screen->savelines : 0;
if (screen->wide_chars)
return;
@@ -599,8 +595,12 @@ ChangeToWide(XtermWidget xw)
if (xtermLoadWideFonts(xw, True)) {
int whichBuf = screen->whichBuf;
+#if !OPT_FIFO_LINES || !OPT_SAVE_LINES
+ int savelines = screen->scrollWidget ? screen->savelines : 0;
+
if (savelines < 0)
savelines = 0;
+#endif
/*
* If we're displaying the alternate screen, switch the pointers back
@@ -669,7 +669,7 @@ ClearCells(XtermWidget xw, int flags, unsigned len, int row, int col)
ld = getLineData(screen, row);
- UIntSet(flags, TERM_COLOR_FLAGS(xw));
+ flags = (int) ((unsigned) flags | TERM_COLOR_FLAGS(xw));
for (n = 0; n < len; ++n)
ld->charData[(unsigned) col + n] = (CharData) ' ';
@@ -744,9 +744,6 @@ ScrnWriteText(XtermWidget xw,
{
TScreen *screen = TScreenOf(xw);
LineData *ld;
-#if OPT_ISO_COLORS
- CellColor *fb = 0;
-#endif
Char *attrs;
int avail = MaxCols(screen) - screen->cur_col;
IChar *chars;
@@ -774,10 +771,6 @@ ScrnWriteText(XtermWidget xw,
chars = ld->charData + screen->cur_col;
attrs = ld->attribs + screen->cur_col;
- if_OPT_ISO_COLORS(screen, {
- fb = ld->color + screen->cur_col;
- });
-
#if OPT_WIDE_CHARS
starcol1 = *chars;
#endif
@@ -854,7 +847,7 @@ ScrnWriteText(XtermWidget xw,
if_OPT_ISO_COLORS(screen, {
unsigned j;
for (j = 0; j < real_width; ++j)
- fb[j] = (CellColor) cur_fg_bg;
+ ld->color[screen->cur_col + (int) j] = (CellColor) cur_fg_bg;
});
if_OPT_WIDE_CHARS(screen, {
@@ -1147,7 +1140,7 @@ ScrnInsertChar(XtermWidget xw, unsigned n)
int last = MaxCols(screen);
int row = screen->cur_row;
int col = screen->cur_col;
- int j, nbytes;
+ int j;
LineData *ld;
if (last <= (col + (int) n)) {
@@ -1155,7 +1148,6 @@ ScrnInsertChar(XtermWidget xw, unsigned n)
return;
n = (unsigned) (last - col);
}
- nbytes = (last - (col + (int) n));
assert(screen->cur_col >= 0);
assert(screen->cur_row >= 0);
@@ -1208,7 +1200,7 @@ ScrnDeleteChar(XtermWidget xw, unsigned n)
int last = MaxCols(screen);
int row = screen->cur_row;
int col = screen->cur_col;
- int j, nbytes;
+ int j;
LineData *ld;
if (last <= (col + (int) n)) {
@@ -1216,7 +1208,6 @@ ScrnDeleteChar(XtermWidget xw, unsigned n)
return;
n = (unsigned) (last - col);
}
- nbytes = (last - (col + (int) n));
assert(screen->cur_col >= 0);
assert(screen->cur_row >= 0);
@@ -1293,7 +1284,7 @@ ScrnRefresh(XtermWidget xw,
for (row = toprow; row <= maxrow; y += FontHeight(screen), row++) {
#if OPT_ISO_COLORS
CellColor *fb = 0;
-#define ColorOf(col) fb[col]
+#define ColorOf(col) (CellColor) (fb ? fb[col] : 0)
#endif
#if OPT_WIDE_CHARS
int wideness = 0;
@@ -1324,13 +1315,16 @@ ScrnRefresh(XtermWidget xw,
else
lastind = row - scrollamt;
+ if (lastind < 0 || lastind > screen->max_row)
+ continue;
+
TRACE2(("ScrnRefresh row=%d lastind=%d ->%d\n",
row, lastind, ROW2INX(screen, lastind)));
if ((ld = getLineData(screen, ROW2INX(screen, lastind))) == 0
|| ld->charData == 0
|| ld->attribs == 0) {
- continue;
+ break;
}
if (maxcol >= (int) ld->lineSize) {
maxcol = ld->lineSize - 1;
@@ -1339,8 +1333,6 @@ ScrnRefresh(XtermWidget xw,
chars = ld->charData;
attrs = ld->attribs;
- assert(chars != 0);
- assert(attrs != 0);
if_OPT_WIDE_CHARS(screen, {
/* This fixes an infinite recursion bug, that leads
@@ -1765,8 +1757,7 @@ ScreenResize(XtermWidget xw,
&screen->editBuf_data[!screen->whichBuf],
(unsigned) rows,
(unsigned) cols,
- (unsigned) MaxRows(screen),
- (unsigned) MaxCols(screen));
+ (unsigned) MaxRows(screen));
}
/*
@@ -1778,8 +1769,6 @@ ScreenResize(XtermWidget xw,
&& delta_rows
&& screen->saveBuf_index != 0) {
- move_down_by = delta_rows;
-
if (delta_rows < 0) {
unsigned move_up = (unsigned) (-delta_rows);
ScrnBuf dst = screen->saveBuf_index;
@@ -1791,7 +1780,6 @@ ScreenResize(XtermWidget xw,
if (amount < 0) {
/* move line-data from visible-buffer to save-buffer */
saveEditBufLines(screen, dst, (unsigned) -amount);
- move_up = (unsigned) -amount;
move_down_by = amount;
} else {
move_down_by = 0;
@@ -1832,8 +1820,7 @@ ScreenResize(XtermWidget xw,
&screen->saveBuf_data,
(unsigned) savelines,
(unsigned) cols,
- (unsigned) savelines,
- (unsigned) MaxCols(screen));
+ (unsigned) savelines);
TRACE_SCRNBUF("reallocSAVE",
screen,
screen->saveBuf_index,
@@ -1846,8 +1833,7 @@ ScreenResize(XtermWidget xw,
&screen->editBuf_data[screen->whichBuf],
(unsigned) rows,
(unsigned) cols,
- (unsigned) MaxRows(screen),
- (unsigned) MaxCols(screen));
+ (unsigned) MaxRows(screen));
TRACE_SCRNBUF("reallocEDIT",
screen,
screen->editBuf_index[screen->whichBuf],
@@ -1874,8 +1860,7 @@ ScreenResize(XtermWidget xw,
&screen->editBuf_data[screen->whichBuf],
(unsigned) rows,
(unsigned) cols,
- (unsigned) MaxRows(screen),
- (unsigned) MaxCols(screen));
+ (unsigned) MaxRows(screen));
dst = screen->editBuf_index[screen->whichBuf];
TRACE_SCRNBUF("reallocEDIT", screen, dst, rows);
@@ -1951,16 +1936,14 @@ ScreenResize(XtermWidget xw,
&screen->saveBuf_data,
(unsigned) savelines,
(unsigned) cols,
- (unsigned) savelines,
- (unsigned) MaxCols(screen));
+ (unsigned) savelines);
#endif
(void) Reallocate(xw,
&screen->editBuf_index[screen->whichBuf],
&screen->editBuf_data[screen->whichBuf],
(unsigned) rows,
(unsigned) cols,
- (unsigned) MaxRows(screen),
- (unsigned) MaxCols(screen));
+ (unsigned) MaxRows(screen));
}
#else /* !OPT_SAVE_LINES */
if (screen->whichBuf
@@ -1977,15 +1960,13 @@ ScreenResize(XtermWidget xw,
&screen->editBuf_data[1],
(unsigned) rows,
(unsigned) cols,
- (unsigned) MaxRows(screen),
- (unsigned) MaxCols(screen));
+ (unsigned) MaxRows(screen));
move_down_by = Reallocate(xw,
&screen->saveBuf_index,
&screen->saveBuf_data,
(unsigned) (rows + savelines),
(unsigned) cols,
- (unsigned) (MaxRows(screen) + savelines),
- (unsigned) MaxCols(screen));
+ (unsigned) (MaxRows(screen) + savelines));
#endif /* OPT_SAVE_LINES */
screen->visbuf = VisBuf(screen);
}
@@ -2043,9 +2024,13 @@ ScreenResize(XtermWidget xw,
MaxRows(screen) * screen->iconVwin.f_height;
changes.width = screen->iconVwin.fullwidth =
- (Dimension) (screen->iconVwin.width + 2 * xw->misc.icon_border_width);
+ (Dimension) ((unsigned) screen->iconVwin.width
+ + 2 * xw->misc.icon_border_width);
+
changes.height = screen->iconVwin.fullheight =
- (Dimension) (screen->iconVwin.height + 2 * xw->misc.icon_border_width);
+ (Dimension) ((unsigned) screen->iconVwin.height
+ + 2 * xw->misc.icon_border_width);
+
changes.border_width = (int) xw->misc.icon_border_width;
TRACE(("resizing icon window %dx%d\n", changes.height, changes.width));
@@ -2056,11 +2041,11 @@ ScreenResize(XtermWidget xw,
#ifdef TTYSIZE_STRUCT
/* Set tty's idea of window size */
- TTYSIZE_ROWS(ts) = rows;
- TTYSIZE_COLS(ts) = cols;
+ TTYSIZE_ROWS(ts) = (ttySize_t) rows;
+ TTYSIZE_COLS(ts) = (ttySize_t) cols;
#ifdef USE_STRUCT_WINSIZE
- ts.ws_xpixel = width;
- ts.ws_ypixel = height;
+ ts.ws_xpixel = (ttySize_t) width;
+ ts.ws_ypixel = (ttySize_t) height;
#endif
code = SET_TTYSIZE(screen->respond, ts);
TRACE(("return %d from SET_TTYSIZE %dx%d\n", code, rows, cols));
diff --git a/app/xterm/scrollbar.c b/app/xterm/scrollbar.c
index 39a083b7c..6e861fd31 100644
--- a/app/xterm/scrollbar.c
+++ b/app/xterm/scrollbar.c
@@ -1,4 +1,4 @@
-/* $XTermId: scrollbar.c,v 1.169 2010/04/21 00:19:04 tom Exp $ */
+/* $XTermId: scrollbar.c,v 1.173 2010/06/15 22:47:34 tom Exp $ */
/*
* Copyright 2000-2009,2010 by Thomas E. Dickey
@@ -300,8 +300,8 @@ ScrollBarDrawThumb(Widget scrollWidget)
totalHeight = thumbHeight + screen->savedlines;
XawScrollbarSetThumb(scrollWidget,
- ((float) thumbTop) / totalHeight,
- ((float) thumbHeight) / totalHeight);
+ ((float) thumbTop) / (float) totalHeight,
+ ((float) thumbHeight) / (float) totalHeight);
}
}
@@ -433,12 +433,12 @@ ScrollBarOn(XtermWidget xw, Bool init)
-ScrollBarBorder(xw),
5);
if (screen->scrollWidget == NULL) {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
}
} else if (!screen->scrollWidget || !XtIsRealized((Widget) xw)) {
- Bell(XkbBI_MinorError, 0);
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
} else {
ResizeScrollBar(xw);
@@ -491,7 +491,7 @@ ScrollBarOff(XtermWidget xw)
Redraw();
}
} else {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
}
@@ -504,7 +504,7 @@ ToggleScrollBar(XtermWidget xw)
TScreen *screen = TScreenOf(xw);
if (IsIcon(screen)) {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
} else {
TRACE(("ToggleScrollBar{{\n"));
if (screen->fullVwin.sb_info.width) {
@@ -536,7 +536,8 @@ ScrollTextTo(
* screen->savedlines : Number of offscreen text lines,
* MaxRows(screen) : Number of onscreen text lines,
*/
- thumbTop = (int) (*topPercent * (screen->savedlines + MaxRows(screen)));
+ thumbTop = (int) (*topPercent
+ * (float) (screen->savedlines + MaxRows(screen)));
newTopLine = thumbTop - screen->savedlines;
WindowScroll(xw, newTopLine, True);
}
@@ -617,7 +618,7 @@ static long
params_to_pixels(TScreen * screen, String * params, Cardinal n)
{
int mult = 1;
- char *s;
+ const char *s;
int modifier;
switch (n > 2 ? 2 : n) {
@@ -734,7 +735,9 @@ have_xkb(Display * dpy)
modStr = XGetAtomName(xkb->dpy,
xkb->names->vmods[n]);
if (modStr != 0) {
- XkbVirtualModsToReal(xkb, 1 << n, &mask);
+ XkbVirtualModsToReal(xkb,
+ (unsigned) (1 << n),
+ &mask);
TRACE((" name[%d] %s (%#x)\n", n, modStr, mask));
}
}
@@ -756,7 +759,7 @@ getXkbLED(Display * dpy, const char *name, Boolean * result)
Bool state;
if (have_xkb(dpy)) {
- my_atom = XInternAtom(dpy, name, True);
+ my_atom = XInternAtom(dpy, name, False);
if ((my_atom != None) &&
XkbGetNamedIndicator(dpy, my_atom, NULL, &state, NULL, NULL)) {
*result = (Boolean) state;
@@ -777,7 +780,7 @@ showXkbLED(Display * dpy, const char *name, Bool enable)
Boolean result = False;
if (have_xkb(dpy)) {
- my_atom = XInternAtom(dpy, name, True);
+ my_atom = XInternAtom(dpy, name, False);
if ((my_atom != None) &&
XkbGetNamedIndicator(dpy, my_atom, NULL, NULL, NULL, NULL) &&
XkbSetNamedIndicator(dpy, my_atom, True, enable, False, NULL)) {
@@ -789,6 +792,11 @@ showXkbLED(Display * dpy, const char *name, Bool enable)
}
#endif
+/*
+ * xlsatoms agrees with this list. However Num/Caps lock are generally
+ * unusable due to special treatment in X. They are used here for
+ * completeness.
+ */
static const char *led_table[] =
{
"Num Lock",
@@ -861,6 +869,9 @@ xtermClearLEDs(TScreen * screen)
XKeyboardControl values;
TRACE(("xtermClearLEDs\n"));
+#ifdef HAVE_XKBQUERYEXTENSION
+ ShowScrollLock(screen, False);
+#endif
memset(&values, 0, sizeof(values));
XChangeKeyboardControl(dpy, KBLedMode, &values);
}
diff --git a/app/xterm/trace.c b/app/xterm/trace.c
index bd4a0e26c..5fb958558 100644
--- a/app/xterm/trace.c
+++ b/app/xterm/trace.c
@@ -1,4 +1,4 @@
-/* $XTermId: trace.c,v 1.112 2010/04/15 21:45:37 tom Exp $ */
+/* $XTermId: trace.c,v 1.115 2010/06/15 22:40:28 tom Exp $ */
/*
*
@@ -68,21 +68,22 @@ extern "C" {
#endif
const char *trace_who = "parent";
+static FILE *trace_fp;
+
void
Trace(const char *fmt,...)
{
- static FILE *fp;
static const char *trace_out;
va_list ap;
- if (fp != 0
+ if (trace_fp != 0
&& trace_who != trace_out) {
- fclose(fp);
- fp = 0;
+ fclose(trace_fp);
+ trace_fp = 0;
}
trace_out = trace_who;
- if (!fp) {
+ if (!trace_fp) {
char name[BUFSIZ];
#if 0 /* usually I do not want unique names */
int unique;
@@ -91,36 +92,41 @@ Trace(const char *fmt,...)
sprintf(name, "Trace-%s.out-%d", trace_who, unique);
else
sprintf(name, "Trace-%s.out", trace_who);
- if ((fp = fopen(name, "r")) == 0) {
+ if ((trace_fp = fopen(name, "r")) == 0) {
break;
}
- fclose(fp);
+ fclose(trace_fp);
}
#else
sprintf(name, "Trace-%s.out", trace_who);
#endif
- fp = fopen(name, "w");
- if (fp != 0) {
- fprintf(fp, "%s\n", xtermVersion());
+ trace_fp = fopen(name, "w");
+ if (trace_fp != 0) {
+ fprintf(trace_fp, "%s\n", xtermVersion());
TraceIds(NULL, 0);
}
}
- if (!fp)
+ if (!trace_fp)
abort();
va_start(ap, fmt);
- if (fmt != 0) {
- vfprintf(fp, fmt, ap);
- (void) fflush(fp);
- } else {
- (void) fclose(fp);
+ vfprintf(trace_fp, fmt, ap);
+ (void) fflush(trace_fp);
+ va_end(ap);
+}
+
+void
+TraceClose(void)
+{
+ if (trace_fp != 0) {
+ (void) fclose(trace_fp);
(void) fflush(stdout);
(void) fflush(stderr);
(void) visibleChars(NULL, 0);
(void) visibleIChars(NULL, 0);
(void) visibleIChar(NULL, 0);
+ trace_fp = 0;
}
- va_end(ap);
}
void
@@ -193,7 +199,7 @@ visibleChrsetName(unsigned chrset)
#endif
char *
-visibleChars(Char * buf, unsigned len)
+visibleChars(const Char * buf, unsigned len)
{
static char *result;
static unsigned used;
@@ -206,12 +212,14 @@ visibleChars(Char * buf, unsigned len)
used = limit;
result = XtRealloc(result, used);
}
- dst = result;
- *dst = '\0';
- while (len--) {
- unsigned value = *buf++;
- formatAscii(dst, value);
- dst += strlen(dst);
+ if (result != 0) {
+ dst = result;
+ *dst = '\0';
+ while (len--) {
+ unsigned value = *buf++;
+ formatAscii(dst, value);
+ dst += strlen(dst);
+ }
}
} else if (result != 0) {
free(result);
@@ -235,17 +243,19 @@ visibleIChars(IChar * buf, unsigned len)
used = limit;
result = XtRealloc(result, used);
}
- dst = result;
- *dst = '\0';
- while (len--) {
- unsigned value = *buf++;
+ if (result != 0) {
+ dst = result;
+ *dst = '\0';
+ while (len--) {
+ unsigned value = *buf++;
#if OPT_WIDE_CHARS
- if (value > 255)
- sprintf(dst, "\\u+%04X", value);
- else
+ if (value > 255)
+ sprintf(dst, "\\u+%04X", value);
+ else
#endif
- formatAscii(dst, value);
- dst += strlen(dst);
+ formatAscii(dst, value);
+ dst += strlen(dst);
+ }
}
} else if (result != 0) {
free(result);
@@ -269,16 +279,18 @@ visibleIChar(IChar * buf, unsigned len)
used = limit;
result = XtRealloc(result, used);
}
- dst = result;
- while (len--) {
- unsigned value = *buf++;
+ if (result != 0) {
+ dst = result;
+ while (len--) {
+ unsigned value = *buf++;
#if OPT_WIDE_CHARS
- if (value > 255)
- sprintf(dst, "\\u+%04X", value);
- else
+ if (value > 255)
+ sprintf(dst, "\\u+%04X", value);
+ else
#endif
- formatAscii(dst, value);
- dst += strlen(dst);
+ formatAscii(dst, value);
+ dst += strlen(dst);
+ }
}
} else if (result != 0) {
free(result);
diff --git a/app/xterm/trace.h b/app/xterm/trace.h
index fc9176a65..13d9f9cba 100644
--- a/app/xterm/trace.h
+++ b/app/xterm/trace.h
@@ -1,4 +1,4 @@
-/* $XTermId: trace.h,v 1.52 2010/04/05 00:11:01 tom Exp $ */
+/* $XTermId: trace.h,v 1.54 2010/06/15 22:40:51 tom Exp $ */
/*
*
@@ -50,11 +50,16 @@ extern void Trace ( const char *, ... )
#undef TRACE
#define TRACE(p) Trace p
+extern void TraceClose (void);
+
+#undef TRACE_CLOSE
+#define TRACE_CLOSE TraceClose
+
#if OPT_TRACE > 1
#define TRACE2(p) Trace p
#endif
-extern char * visibleChars (Char * /* buf */, unsigned /* len */);
+extern char * visibleChars (const Char * /* buf */, unsigned /* len */);
extern char * visibleIChar (IChar *, unsigned);
extern char * visibleIChars (IChar * /* buf */, unsigned /* len */);
extern const char * visibleChrsetName(unsigned /* chrset */);
diff --git a/app/xterm/util.c b/app/xterm/util.c
index 492f91f2e..9a118ae30 100644
--- a/app/xterm/util.c
+++ b/app/xterm/util.c
@@ -1,4 +1,4 @@
-/* $XTermId: util.c,v 1.534 2010/04/18 17:06:44 tom Exp $ */
+/* $XTermId: util.c,v 1.538 2010/06/15 08:17:36 tom Exp $ */
/*
* Copyright 1999-2009,2010 by Thomas E. Dickey
@@ -703,7 +703,7 @@ WriteText(XtermWidget xw, IChar * str, Cardinal len)
}
if (AddToVisible(xw)
- && (ld = getLineData(screen, screen->cur_row)) != 0) {
+ && ((ld = getLineData(screen, screen->cur_row))) != 0) {
if (screen->cursor_state)
HideCursor();
@@ -733,12 +733,11 @@ WriteText(XtermWidget xw, IChar * str, Cardinal len)
#if OPT_ISO_COLORS
if (screen->colorAttrMode) {
fg = MapToColorMode(xw->cur_foreground, screen, flags);
- } else
-#endif
- {
+ } else {
fg = xw->cur_foreground;
}
checkVeryBoldColors(test, fg);
+#endif
/* make sure that the correct GC is current */
currentGC = updatedXtermGC(xw, flags, fg_bg, False);
@@ -2218,6 +2217,11 @@ getXftColor(XtermWidget xw, Pixel pixel)
#define XFT_FONT(name) screen->name.font
+#if OPT_ISO_COLORS
+#define UseBoldFont(screen) (!(screen)->colorBDMode || ((screen)->veryBoldColors & BOLD))
+#else
+#define UseBoldFont(screen) 1
+#endif
/*
* fontconfig/Xft combination prior to 2.2 has a problem with
* CJK truetype 'double-width' (bi-width/monospace) fonts leading
@@ -2263,9 +2267,7 @@ xtermXftDrawString(XtermWidget xw,
} else
#endif
if ((flags & BOLDATTR(screen))
-#if OPT_ISO_COLORS
- && !screen->colorBDMode
-#endif
+ && UseBoldFont(screen)
&& XFT_FONT(renderWideBold[fontnum])) {
wfont = XFT_FONT(renderWideBold[fontnum]);
} else {
@@ -2685,7 +2687,7 @@ drawXtermText(XtermWidget xw,
XFontStruct *fs = screen->double_fonts[inx].fs;
#if OPT_RENDERFONT
- if (!xw->misc.render_font || IsIconWin(screen, WhichVWin(screen)))
+ if (!UsingRenderFont(xw))
#endif
{
XRectangle rect, *rp = &rect;
@@ -2805,9 +2807,7 @@ drawXtermText(XtermWidget xw,
} else
#endif
if ((flags & BOLDATTR(screen))
-#if OPT_ISO_COLORS
- && !screen->colorBDMode
-#endif
+ && UseBoldFont(screen)
&& XFT_FONT(renderFontBold[fontnum])) {
font = XFT_FONT(renderFontBold[fontnum]);
} else {
@@ -3525,8 +3525,8 @@ resetXtermGC(XtermWidget xw, unsigned flags, Bool hilite)
#if OPT_ISO_COLORS
/*
- * Extract the foreground-color index from a one-byte color pair. If we've got
- * BOLD or UNDERLINE color-mode active, those will be used.
+ * Extract the foreground-color index from a color pair.
+ * If we've got BOLD or UNDERLINE color-mode active, those will be used.
*/
unsigned
extract_fg(XtermWidget xw, unsigned color, unsigned flags)
@@ -3541,7 +3541,7 @@ extract_fg(XtermWidget xw, unsigned color, unsigned flags)
}
/*
- * Extract the background-color index from a one-byte color pair.
+ * Extract the background-color index from a color pair.
* If we've got INVERSE color-mode active, that will be used.
*/
unsigned
diff --git a/app/xterm/uxterm.desktop b/app/xterm/uxterm.desktop
index f2b50dbf7..6937f2184 100644
--- a/app/xterm/uxterm.desktop
+++ b/app/xterm/uxterm.desktop
@@ -1,8 +1,8 @@
-# $XTermId: uxterm.desktop,v 1.8 2010/03/05 09:51:58 tom Exp $
+# $XTermId: uxterm.desktop,v 1.9 2010/06/15 10:58:13 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 2006,2007 by Thomas E. Dickey
+# Copyright 2006-2007,2010 by Thomas E. Dickey
#
# All Rights Reserved
#
diff --git a/app/xterm/version.h b/app/xterm/version.h
index 9082aab21..861a8d78b 100644
--- a/app/xterm/version.h
+++ b/app/xterm/version.h
@@ -1,5 +1,5 @@
/*
- * $XTermId: version.h,v 1.316 2010/04/23 08:43:31 tom Exp $
+ * $XTermId: version.h,v 1.319 2010/06/28 08:49:07 tom Exp $
* ----------------------------------------------------------------------------
* this file is part of xterm
*
@@ -39,7 +39,7 @@
* version of X to which this version of xterm has been built. The number in
* parentheses is my patch number (Thomas E. Dickey).
*/
-#define XTERM_PATCH 258
+#define XTERM_PATCH 261
#ifndef __vendorversion__
#define __vendorversion__ "XTerm/OpenBSD"
diff --git a/app/xterm/vms.c b/app/xterm/vms.c
index 4c4631b81..c47ac93b5 100644
--- a/app/xterm/vms.c
+++ b/app/xterm/vms.c
@@ -1,4 +1,4 @@
-/* $XTermId: vms.c,v 1.11 2009/11/28 14:58:09 tom Exp $ */
+/* $XTermId: vms.c,v 1.12 2010/06/13 17:46:27 tom Exp $ */
/* vms.c
*
@@ -547,7 +547,7 @@ static void send_xoff(void)
static void send_bell(void)
{
- Bell();
+ Bell(term);
}
/*
diff --git a/app/xterm/vttests/query-fonts.pl b/app/xterm/vttests/query-fonts.pl
new file mode 100644
index 000000000..2b86c0748
--- /dev/null
+++ b/app/xterm/vttests/query-fonts.pl
@@ -0,0 +1,166 @@
+#!/usr/bin/perl -w
+# $XTermId: query-fonts.pl,v 1.5 2010/05/24 09:01:30 tom Exp $
+# -----------------------------------------------------------------------------
+# this file is part of xterm
+#
+# Copyright 2010 by Thomas E. Dickey
+#
+# All Rights Reserved
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name(s) of the above copyright
+# holders shall not be used in advertising or otherwise to promote the
+# sale, use or other dealings in this Software without prior written
+# authorization.
+# -----------------------------------------------------------------------------
+# Test the font-query features of xterm.
+
+# TODO:
+# test relative vs absolute font numbering
+# test all font-slots
+# test selection
+# test bold / wide / widebold
+# test actual fontname vs nominal
+# extend "CSI > Ps; Ps T" to query fontname in hex
+
+use strict;
+
+use Getopt::Std;
+use IO::Handle;
+
+our ( $opt_a, $opt_r, $opt_s );
+&getopts('ars') || die(
+ "Usage: $0 [options]\n
+Options:\n
+ -a test using absolute numbers
+ -r test using relative numbers
+ -s use ^G rather than ST
+"
+);
+
+our $ST = $opt_s ? "\007" : "\x1b\\";
+
+sub no_reply($) {
+ open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n");
+ autoflush TTY 1;
+ my $old = `stty -g`;
+ system "stty raw -echo min 0 time 5";
+
+ print TTY @_;
+ close TTY;
+ system "stty $old";
+}
+
+sub get_reply($) {
+ open TTY, "+</dev/tty" or die("Cannot open /dev/tty\n");
+ autoflush TTY 1;
+ my $old = `stty -g`;
+ system "stty raw -echo min 0 time 5";
+
+ print TTY @_;
+ my $reply = <TTY>;
+ close TTY;
+ system "stty $old";
+ if ( defined $reply ) {
+ die("^C received\n") if ( "$reply" eq "\003" );
+ }
+ return $reply;
+}
+
+sub query_font($) {
+ my $param = $_[0];
+ my $reply;
+ my $n;
+ my $st = $opt_s ? qr/\007/ : qr/\x1b\\/;
+ my $osc = qr/\x1b]50/;
+ my $match = qr/${osc}.*${st}/;
+
+ $reply = get_reply( "\x1b]50;?" . $param . $ST );
+
+ printf "query{%s}%*s", $param, 3 - length($param), " ";
+
+ if ( defined $reply ) {
+ printf "%2d ", length($reply);
+ if ( $reply =~ /${match}/ ) {
+
+ $reply =~ s/^${osc}//;
+ $reply =~ s/^;//;
+ $reply =~ s/${st}$//;
+ }
+ else {
+ printf "? ";
+ }
+
+ my $result = "";
+ for ( $n = 0 ; $n < length($reply) ; ) {
+ my $c = substr( $reply, $n, 1 );
+ if ( $c =~ /[[:print:]]/ ) {
+ $result .= $c;
+ }
+ else {
+ my $k = ord substr( $reply, $n, 1 );
+ if ( ord $k == 0x1b ) {
+ $result .= "\\E";
+ }
+ elsif ( $k == 0x7f ) {
+ $result .= "^?";
+ }
+ elsif ( $k == 32 ) {
+ $result .= "\\s";
+ }
+ elsif ( $k < 32 ) {
+ $result .= sprintf( "^%c", $k + 64 );
+ }
+ elsif ( $k > 128 ) {
+ $result .= sprintf( "\\%03o", $k );
+ }
+ else {
+ $result .= chr($k);
+ }
+ }
+ $n += 1;
+ }
+
+ printf "{%s}", $result;
+ }
+ printf "\n";
+}
+
+if ($opt_r) {
+ my $n;
+ query_font("-");
+ foreach $n ( 0 .. 5 ) {
+ query_font( sprintf "-%d", $n );
+ }
+ query_font("+");
+ foreach $n ( 0 .. 5 ) {
+ query_font( sprintf "+%d", $n );
+ }
+}
+if ($opt_a) {
+ my $n;
+ foreach $n ( 0 .. 5 ) {
+ query_font( sprintf "%d", $n );
+ }
+}
+if ( not $opt_a and not $opt_r ) {
+ query_font("");
+}
diff --git a/app/xterm/xterm.desktop b/app/xterm/xterm.desktop
index 483ac68e7..82e1927c2 100644
--- a/app/xterm/xterm.desktop
+++ b/app/xterm/xterm.desktop
@@ -1,8 +1,8 @@
-# $XTermId: xterm.desktop,v 1.9 2010/03/06 16:17:35 tom Exp $
+# $XTermId: xterm.desktop,v 1.10 2010/06/15 10:58:13 tom Exp $
# -----------------------------------------------------------------------------
# this file is part of xterm
#
-# Copyright 2006,2007 by Thomas E. Dickey
+# Copyright 2006-2007,2010 by Thomas E. Dickey
#
# All Rights Reserved
#
diff --git a/app/xterm/xterm.h b/app/xterm/xterm.h
index 984933184..863f1a3fb 100644
--- a/app/xterm/xterm.h
+++ b/app/xterm/xterm.h
@@ -1,4 +1,4 @@
-/* $XTermId: xterm.h,v 1.625 2010/04/18 17:10:42 tom Exp $ */
+/* $XTermId: xterm.h,v 1.628 2010/06/20 21:34:48 tom Exp $ */
/************************************************************
@@ -882,7 +882,7 @@ extern unsigned xtermParamToState (XtermWidget /* xw */, unsigned /* param */);
extern unsigned xtermStateToParam (XtermWidget /* xw */, unsigned /* state */);
extern Bool xtermDeleteIsDEL (XtermWidget /* xw */);
extern void Input (XtermWidget /* xw */, XKeyEvent */* event */, Bool /* eightbit */);
-extern void StringInput (XtermWidget /* xw */, Char * /* string */, size_t /* nbytes */);
+extern void StringInput (XtermWidget /* xw */, const Char * /* string */, size_t /* nbytes */);
#if OPT_NUM_LOCK
extern void VTInitModifiers(XtermWidget /* xw */);
@@ -954,7 +954,7 @@ extern int open_userfile (uid_t /* uid */, gid_t /* gid */, char * /* path */,
extern int xerror (Display * /* d */, XErrorEvent * /* ev */);
extern int xioerror (Display * /* dpy */);
extern int xtermResetIds(TScreen * /* screen */);
-extern void Bell (int /* which */, int /* percent */);
+extern void Bell (XtermWidget /* xw */, int /* which */, int /* percent */);
extern void ChangeIconName (XtermWidget /* xw */, char * /* name */);
extern void ChangeTitle (XtermWidget /* xw */, char * /* name */);
extern void ChangeXprop (char * /* name */);
@@ -1026,11 +1026,11 @@ extern Bool xtermEnvUTF8(void);
#endif
#ifdef ALLOWLOGGING
-extern void StartLog (TScreen * /* screen */);
-extern void CloseLog (TScreen * /* screen */);
-extern void FlushLog (TScreen * /* screen */);
+extern void StartLog (XtermWidget /* xw */);
+extern void CloseLog (XtermWidget /* xw */);
+extern void FlushLog (XtermWidget /* xw */);
#else
-#define FlushLog(screen) /*nothing*/
+#define FlushLog(xw) /*nothing*/
#endif
/* print.c */
@@ -1051,10 +1051,10 @@ extern void xtermPrintEverything (XtermWidget /* xw */, PrinterFlags * /* p */);
#endif
extern Bool decodeUtf8 (PtyData * /* data */);
-extern int readPtyData (TScreen * /* screen */, PtySelect * /* select_mask */, PtyData * /* data */);
-extern void fillPtyData (TScreen * /* screen */, PtyData * /* data */, char * /* value */, int /* length */);
+extern int readPtyData (XtermWidget /* xw */, PtySelect * /* select_mask */, PtyData * /* data */);
+extern void fillPtyData (XtermWidget /* xw */, PtyData * /* data */, const char * /* value */, int /* length */);
extern void initPtyData (PtyData ** /* data */);
-extern void trimPtyData (TScreen * /* screen */, PtyData * /* data */);
+extern void trimPtyData (XtermWidget /* xw */, PtyData * /* data */);
#ifdef NO_LEAKS
extern void noleaks_ptydata ( void );
diff --git a/app/xterm/xterm.log.html b/app/xterm/xterm.log.html
index b3aca533d..2e33935d7 100644
--- a/app/xterm/xterm.log.html
+++ b/app/xterm/xterm.log.html
@@ -31,7 +31,7 @@
* sale, use or other dealings in this Software without prior written *
* authorization. *
*****************************************************************************
- $XTermId: xterm.log.html,v 1.933 2010/05/02 01:07:19 tom Exp $
+ $XTermId: xterm.log.html,v 1.957 2010/06/28 09:25:58 tom Exp $
-->
<HTML>
<HEAD>
@@ -56,6 +56,9 @@ Most of these are summarized in the XFree86 CHANGELOG
is the latest version of this file.
<UL>
+<LI><A HREF="#xterm_261">Patch #261 - 2010/6/28</A>
+<LI><A HREF="#xterm_260">Patch #260 - 2010/6/20</A>
+<LI><A HREF="#xterm_259">Patch #259 - 2010/6/5</A>
<LI><A HREF="#xterm_258">Patch #258 - 2010/5/1</A>
<LI><A HREF="#xterm_257">Patch #257 - 2010/4/22</A>
<LI><A HREF="#xterm_256">Patch #256 - 2010/3/6</A>
@@ -317,6 +320,98 @@ is the latest version of this file.
<LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A>
</UL>
+<H1><A NAME="xterm_261">Patch #261 - 2010/6/28</A></H1>
+<ul>
+ <li>fix regression in <code>renderFont</code> logic, from
+ <a href="#xterm_260">patch #260</a> changes
+ (report by Joseph Quinsey).
+</ul>
+
+<H1><A NAME="xterm_260">Patch #260 - 2010/6/20</A></H1>
+<ul>
+ <li>modify <code>plink.sh</code> to work around problem linking to
+ recent PCRE libraries.
+
+ <li>extend <code>renderFont</code> resource to allow deferred switch
+ to TrueType fonts without affecting existing resource settings
+ (Debian #585620).
+
+ <li>modify configure macro CF_X_TOOLKIT to work around omission of
+ ICE library from ".pc" file (report by Miroslav Lichvar).
+
+ <li>change configure script default for <code>--enable-broken-st</code>
+ i.e., the <code>brokenStringTerm</code> feature)
+ to normally enable it.
+ If the corresponding resource is enabled,
+ this feature eliminates an apparent freeze of xterm
+ when sending mis-encoded data to the screen (Debian #584801).
+
+ <li>document in manpage some actions which were overlooked:
+ <ul>
+ <li>readline-button
+ <li>scroll-lock
+ <li>set-8-bit-control
+ </ul>
+
+ <li>undo a change to limit-check in <code>ScrnRefresh</code>
+ in <a href="#xterm_257">patch #257</a>,
+ which broke <code>fastScroll</code> feature
+ (Debian #584841).
+
+ <li>modify handling of
+ <code>brokenLinuxOSC</code> and
+ <code>brokenStringTerm</code>
+ to also sound the bell.
+
+ <li>add control/D and control/Q to controls which will cause early
+ exit from control string per <code>brokenStringTerm</code>
+ resource.
+
+ <li>improve documentation of <code>brokenStringTerm</code> resource
+ in manpage.
+</ul>
+
+<H1><A NAME="xterm_259">Patch #259 - 2010/6/5</A></H1>
+<ul>
+ <li>modify configure check for
+ <a href="http://invisible-island.net/luit/">luit</a> to include new
+ aliases for the program
+ (<code>xterm-filter</code> and
+ <code>bluit</code>).
+
+ <li>add workaround in <code>xtermClearLEDs()</code> to account for
+ Xkb's override, making vttest's LED demo reset the scroll
+ lock.
+
+ <li>filter out client-message events when deciding whether to hide
+ cursor, e.g., when using SCIM
+ (patch/report by anonymous user).
+
+ <li>improve description of <code>-bd</code> option in manpage
+ (report by Guy Daniel Clotilde).
+
+ <li>modify configure checks for PCRE and other libraries to use
+ <code>pkg-config</code>, if available.
+
+ <li>amend change from <a href="#xterm_252">patch #252</a>, to take
+ <code>veryColorColors</code> resource into account when checking
+ <code>colorBDMode</code> resource for TrueType fonts
+ (report by anonymous user).
+
+ <li>add <code>vttests/query-fonts.pl</code> script for
+ demonstrating the <code>OSC&nbsp;50</code> font query.
+
+ <li>improve manpage discussion of Scroll Lock feature.
+
+ <li>improve configure macros CF_GCC_VERSION and CF_GCC_WARNINGS.
+
+ <li>fix warnings for "clang --analyze".
+
+ <li>change default for <code>allowScrollLock</code> resource to
+ <code>false</code>, noting that the supposedly unused key has
+ been useful for various rebindings (Debian #580946).
+</ul>
+
<H1><A NAME="xterm_258">Patch #258 - 2010/5/1</A></H1>
<ul>
<li>add pointer-checks in <code>ScrnRefresh</code> to fix a case in
diff --git a/app/xterm/xterm.man b/app/xterm/xterm.man
index 8e392b861..b43325319 100644
--- a/app/xterm/xterm.man
+++ b/app/xterm/xterm.man
@@ -1,5 +1,5 @@
'\" t
-.\" $XTermId: xterm.man,v 1.456 2010/04/16 08:25:08 tom Exp $
+.\" $XTermId: xterm.man,v 1.465 2010/06/15 09:38:48 tom Exp $
.\"
.\" Copyright 1996-2009,2010 by Thomas E. Dickey
.\"
@@ -449,11 +449,13 @@ systems with locale support.
.TP 8
.BI -fb " font"
This option specifies a font to be used when displaying bold text.
-This font must be the same height and width as the normal font.
+It sets the \fBboldFont\fR resource.
+.IP
+This font must be the same height and width as the normal font, otherwise it is ignored.
If only one of the normal or bold fonts is specified, it will be used as the
normal font and the bold font will be produced by overstriking this font.
-The default is to do overstriking of the normal font.
-See also the discussion of \fBboldFont\fP, \fBboldMode\fP and \fBalwaysBoldMode\fP resources.
+.IP
+See also the discussion of \fBboldMode\fP and \fBalwaysBoldMode\fP resources.
.TP 8
.BI -fa " pattern"
This option sets the pattern for fonts selected from the FreeType
@@ -462,6 +464,7 @@ This corresponds to the \fBfaceName\fP resource.
When a CJK
double-width font is specified, you also need to turn
on the \fBcjkWidth\fP resource.
+.IP
See also the \fBrenderFont\fP resource,
which combines with this to determine whether FreeType fonts are
initially active.
@@ -495,6 +498,7 @@ This corresponds to the \fBfaceNameDoublesize\fP resource.
.BI -fi " font"
This option sets the font for active icons if that feature was compiled
into \fIxterm\fP.
+.IP
See also the discussion of the \fBiconFont\fP resource.
.TP 8
.BI -fs " size"
@@ -523,6 +527,7 @@ This corresponds to the \fBwideBoldFont\fP resource.
.B -fx \fIfont\fP
This option specifies the font to be used for displaying the preedit string
in the "OverTheSpot" input method.
+.IP
See also the discussion of the \fBximFont\fP resource.
.TP 8
.BI -hc " color"
@@ -660,6 +665,7 @@ This corresponds to the \fBlocale\fR resource.
.IP
The actual list of encodings which are supported is determined by \fIluit\fR.
Consult the \fIluit\fR manual page for further details.
+.IP
See also the discussion of the \fB-u8\fP option which supports UTF-8 locales.
.TP 8
.B +lc
@@ -1122,10 +1128,12 @@ with \fIxterm\fP:
.TP 8
.B -bd \fIcolor\fP
This option specifies the color to use for the border of the window.
+The corresponding resource name is \fIborderColor\fP.
\fIxterm\fP uses the X Toolkit default, which is \*(``XtDefaultForeground\*(''.
.TP 8
.B -bg \fIcolor\fP
This option specifies the color to use for the background of the window.
+The corresponding resource name is \fIbackground\fP.
The default is \*(``XtDefaultBackground.\*(''
.TP 8
.B -bw \fInumber\fP
@@ -1144,13 +1152,14 @@ This option specifies the X server to contact; see \fIX(__miscmansuffix__)\fP.
.TP 8
.B -fg \fIcolor\fP
This option specifies the color to use for displaying text.
+The corresponding resource name is \fIforeground\fP.
The default is
\*(``XtDefaultForeground.\*(''
.TP 8
.B -fn \fIfont\fP
This option specifies the font to be used for displaying normal text.
-The
-default is \fIfixed\fP.
+The corresponding resource name is \fIfont\fP.
+The resource value default is \fIfixed\fP.
.TP 8
.B -font \fIfont\fP
This is the same as \fB-fn\fP.
@@ -1162,6 +1171,7 @@ see \fIX(__miscmansuffix__)\fP.
.B -iconic
This option indicates that \fIxterm\fP should ask the window manager to
start it as an icon rather than as the normal window.
+The corresponding resource name is \fIiconic\fP.
.TP 8
.B -name \fIname\fP
This option specifies the application name under which resources are to be
@@ -1171,6 +1181,7 @@ obtained, rather than the default executable file name.
.B -rv
This option indicates that reverse video should be simulated by swapping
the foreground and background colors.
+The corresponding resource name is \fIreverseVideo\fP.
.TP 8
.B +rv
Disable the simulation of reverse video by swapping foreground and background
@@ -1211,6 +1222,7 @@ with the shell which is no longer running.
.B "hpFunctionKeys (\fPclass\fB HpFunctionKeys)"
Specifies whether or not HP Function Key escape codes should be generated for
function keys instead of standard escape sequences.
+.IP
See also the \fBkeyboardType\fP resource.
.TP 8
.B "iconGeometry (\fPclass\fB IconGeometry)"
@@ -1282,6 +1294,7 @@ You cannot set this to a value less than 64.
If \*(``true\*('', \fIxterm\fP will perform handshaking during initialization
to ensure that the parent and child processes update the \fIutmp\fP
and \fIstty\fP state.
+.IP
See also \fBwaitForMap\fP which waits for the pseudo-terminal's notion
of the screen size,
and \fBptySttySize\fP which resets the screen size after other terminal
@@ -1296,6 +1309,7 @@ configuration, using the \fBkb\fP string from the termcap entry as
a reference, if available.
In either case, the result is applied to the TERMCAP variable
which \fIxterm\fP sets.
+.IP
See also the \fBttyModes\fP resource, which may modify this.
The default is \*(``false\*(''.
.TP 8
@@ -1306,6 +1320,7 @@ This is needed for some systems whose pseudo-terminals cannot
propagate terminal characteristics.
Where it is not needed, it can interfere with other methods for
setting the intial screen size, e.g., via window manager interaction.
+.IP
See also \fBwaitForMap\fP which waits for a handshake-message
giving the pseudo-terminal's notion of the screen size.
The default is \*(``false\*('' on Linux and OS X systems,
@@ -1325,6 +1340,7 @@ The default is \*(``true\*(''.
.B "scoFunctionKeys (\fPclass\fB ScoFunctionKeys)"
Specifies whether or not SCP Function Key escape codes should be generated for
function keys instead of standard escape sequences.
+.IP
See also the \fBkeyboardType\fP resource.
.TP 8
.B "sessionMgt (\fPclass\fB SessionMgt)"
@@ -1336,6 +1352,7 @@ The default is \*(``true\*(''.
.B "sunFunctionKeys (\fPclass\fB SunFunctionKeys)"
Specifies whether or not Sun Function Key escape codes should be generated for
function keys instead of standard escape sequences.
+.IP
See also the \fBkeyboardType\fP resource.
.TP 8
.B "sunKeyboard (\fPclass\fB SunKeyboard)"
@@ -1357,12 +1374,14 @@ The PC-style bindings are analogous to PCTerm, but not the same thing.
Normally these bindings do not conflict with the use of the Meta key
as described for the \fBeightBitInput\fP resource.
If they do, note that the PC-style bindings are evaluated first.
+.IP
See also the \fBkeyboardType\fP resource.
.TP 8
.B "tcapFunctionKeys (\fPclass\fB TcapFunctionKeys)"
Specifies whether or not function key escape codes read from the
termcap/terminfo entry should be generated for
function keys instead of standard escape sequences.
+.IP
See also the \fBkeyboardType\fP resource.
.TP 8
.B "termName (\fPclass\fB TermName)"
@@ -1502,14 +1521,28 @@ The default is \*(``true.\*(''
Specifies whether control sequences that set/query
the Scroll Lock key should be allowed,
as well as whether the Scroll Lock key responds to user's keypress.
-The default is \*(``true.\*(''
+The default is \*(``false.\*(''
+.IP
+When this feature is enabled, \fIxterm\fP will sense the state of the
+Scroll Lock key each time it acquires focus.
+Pressing the Scroll Lock key toggles \fIxterm\fP's internal state,
+as well as toggling the associated LED.
+While the Scroll Lock is active, \fIxterm\fP attempts to keep a viewport on the
+same set of lines.
+If the current viewport is scrolled past the limit set by the
+\fBsaveLines\fP resource, then Scroll Lock has no further effect.
+.IP
+The reason for setting the default to \*(``false.\*('' is to avoid
+user surprise. This key is generally unused in keyboard configurations,
+and has not acquired a standard meaning even when it is used in that manner.
+Consequently, users have assigned it for ad hoc purposes.
.TP 8
.B "allowSendEvents (\fPclass\fB AllowSendEvents)"
Specifies whether or not synthetic key and button events (generated using
the X protocol SendEvent request) should be interpreted or discarded.
The default is \*(``false\*('' meaning they are discarded.
-Note that allowing such events creates a very large security hole, and
-forcefully disables the \fBallow\fP\fIXXX\fP\fBOps\fR resources.
+Note that allowing such events would create a very large security hole, therefore
+enabling this resource forcefully disables the \fBallow\fP\fIXXX\fP\fBOps\fR resources.
The default is \*(``false.\*(''
.TP
.B "allowTcapOps (\fPclass\fB AllowTcapOps)"
@@ -1682,6 +1715,12 @@ The default is \*(``true.\*(''
.B "boldFont (\fPclass\fB BoldFont)"
Specifies the name of the bold font to use instead of overstriking.
There is no default for this resource.
+.IP
+This font must be the same height and width as the normal font, otherwise it is ignored.
+If only one of the normal or bold fonts is specified, it will be used as the
+normal font and the bold font will be produced by overstriking this font.
+.IP
+See also the discussion of \fBboldMode\fP and \fBalwaysBoldMode\fP resources.
.TP 8
.B "boldMode (\fPclass\fB BoldMode)"
This specifies whether or not text with the bold attribute should be
@@ -1752,6 +1791,56 @@ provides a work-around for some ISDN routers which start an application
control string without completing it.
Set this to \*(``true\*('' if \fIxterm\fP appears to freeze when connecting.
The default is \*(``false.\*(''
+.IP
+\fIXterm\fP's state parser recognizes
+several types of control strings which can contain text, e.g.,
+.sp
+.RS
+\fBAPC\fP (Application Program Command),
+.br
+\fBDCS\fP (Device Control String),
+.br
+\fBOSC\fP (Operating System Command),
+.br
+\fBPM\fP (Privacy Message), and
+.br
+\fBSOS\fP (Start of String),
+.RE
+.IP
+Each should end with a string-terminator (a special character which
+cannot appear in these strings).
+Ordinary control characters found within the string are not ignored;
+they are processed without interfering with the process of accumulating
+the control string's content.
+\fIXterm\fP recognizes these controls in all modes,
+although some of the functions may be suppressed after parsing the control.
+.IP
+When enabled, this feature allows the user to exit from an unterminated
+control string when any of these ordinary control characters are found:
+.sp
+.RS
+control/D (used as an end of file in many shells),
+.br
+control/H (backspace),
+.br
+control/I (tab-feed),
+.br
+control/J (line feed aka newline),
+.br
+control/K (vertical tab),
+.br
+control/L (form feed),
+.br
+control/M (carriage return),
+.br
+control/N (shift-out),
+.br
+control/O (shift-in),
+.br
+control/Q (XOFF),
+.br
+control/X (cancel)
+.RE
.TP 8
.B "c132 (\fPclass\fB C132)"
Specifies whether or not the VT102 DECCOLM escape sequence,
@@ -2212,7 +2301,8 @@ The default is an empty string, which does not override anything.
.B "faceName (\fPclass\fB FaceName)"
Specify the pattern for fonts selected from the FreeType
library if support for that library was compiled into \fIxterm\fR.
-There is no default.
+There is no default value.
+.IP
If not specified,
or if there is no match for both normal and bold fonts,
\fIxterm\fR uses the \fBfont\fP and related resources.
@@ -2220,9 +2310,10 @@ or if there is no match for both normal and bold fonts,
.B "faceNameDoublesize (\fPclass\fB FaceNameDoublesize)"
Specify an double-width font for cases where an application requires
this, e.g., in CJK applications.
-There is no default.
+There is no default value.
+.IP
If the application uses double-wide characters and this resource is not given,
-\fIxterm\fP will use a scaled version of the font given by \fBfaceName\fP.
+\fIxterm\fP will use a scaled version of the font given by \fBfaceName\fP.
.TP 8
.B "faceSize (\fPclass\fB FaceSize)"
Specify the pointsize for fonts selected from the FreeType
@@ -2230,6 +2321,15 @@ library if support for that library was compiled into \fIxterm\fR.
The default is \*(``14.\*(''
On the \fBVT\ Fonts\fP menu, this corresponds to the \fIDefault\fP entry.
.IP
+Although the default is \*(``14.\*('',
+this may not be the same as the pointsize for the default bitmap font,
+i.e., that assigned with the \fB\-fn\fP option,
+or the \fBfont\fP resource.
+For example, the "fixed" font usually has a pointsize of \*(``8.\*(''.
+If you set \fBfaceSize\fP to match the size of the bitmap font,
+then switching between bitmap and TrueType fonts via the font menu
+will give comparable sizes for the window.
+.IP
You can specify the pointsize for TrueType fonts selected with the other
size-related menu entries such as Medium, Huge, etc., by using one of
the following resource values.
@@ -2241,7 +2341,7 @@ font resources to obtain a TrueType pointsize.
.IP
If all of the \fBfaceSize\fP resources are set, then \fIxterm\fP
will use this information to determine the next smaller/larger
-TrueType font for the
+TrueType font for the
\fIlarger-vt-font()\fP and
\fIsmaller-vt-font()\fP actions.
If any are not set, \fIxterm\fP will use only the areas of the bitmap fonts.
@@ -2955,7 +3055,37 @@ The default is \*(``false.\*(''
.B "renderFont (\fPclass\fB RenderFont)"
If \fIxterm\fR is built with the Xft library,
this controls whether the \fBfaceName\fR resource is used.
-The default is \*(``true.\*(''
+The default is \*(``default.\*(''
+.IP
+The resource values are strings, evaluated as booleans after startup.
+.RS
+.TP 5
+false
+.br
+disable the feature and use the normal (bitmap) font.
+.TP 5
+true
+.br
+startup using the TrueType font specified by the \fBfaceName\fP and
+\fBfaceSize\fP resource settings.
+If there is no value for \fBfaceName\fP, disable the feature and use
+the normal (bitmap) font.
+.IP
+After startup, you can still switch to/from the bitmap font using the
+\*(``TrueType Fonts\*('' menu entry.
+.TP 5
+default
+.br
+startup using the normal (bitmap) font,
+but enable the \*(``TrueType Fonts\*(''
+menu entry to allow runtime switching to/from TrueType fonts.
+.IP
+If there is no \fBfaceName\fP resource set,
+then runtime switching to TrueType fonts is disabled.
+\fIXterm\fP has a separate compiled-in value for \fBfaceName\fP
+for the special case where \fBrenderFont\fP is \*(``default\*(''.
+That is normally \*(``mono\*(''.
+.RE
.TP 8
.B "resizeGravity (\fPclass\fB ResizeGravity)"
Affects the behavior when the window is resized to be taller or
@@ -3730,7 +3860,7 @@ by the server.
When configured to use the primary selection,
(the default) \fIxterm\fP can
provide the selection data in ways which help to retain character
-encoding information as it is pasted.
+encoding information as it is pasted.
.PP
A user "selects" text on xterm, which highlights the selected text.
A subsequent "paste" to another client forwards a request to the client owning
@@ -3755,7 +3885,7 @@ client asks for.
These are termed \fIselection targets\fP.
.PP
When asking for the selection data,
-\fIxterm\fP tries the following types in this order:
+\fIxterm\fP tries the following types in this order:
.RS
.TP 5
UTF8_STRING
@@ -4047,6 +4177,8 @@ This corresponds to the
option and the
.B scrollKey
resource.
+.IP
+As a special case, the XON / XOFF keys (control/S and control/Q) are ignored.
.
.TP
Scroll to Bottom on Tty Output (scrollttyoutput)
@@ -4707,7 +4839,7 @@ If no name is given, the original set of fontnames is restored.
Unlike \fBset-vt-font()\fR, this does not affect the escape- and select-fonts,
since those are not based on resource values.
It does affect the fonts loosely organized under the \*(``Default\*('' menu
-entry: \fBfont\fP, \fBboldFont\fP, \fBwideFont\fP and \fBwideBoldFont\fP.
+entry, including \fBfont\fP, \fBboldFont\fP, \fBwideFont\fP and \fBwideBoldFont\fP.
.TP 8
.B "maximize()"
Resizes the window to fill the screen.
@@ -4779,6 +4911,12 @@ This action sends a SIGHUP to the subprogram and exits.
It is also invoked
by the \fBquit\fP entry in \fImainMenu\fP.
.TP 8
+.B "readline-button()"
+Supports the optional readline feature by echoing repeated cursor forward
+or backward control sequences on button release event,
+to request that the host application update its notion of the cursor's
+position to match the button event.
+.TP 8
.B "redraw()"
This action redraws the window and is also invoked by the
\fIredraw\fP entry in \fImainMenu\fP.
@@ -4810,6 +4948,11 @@ This action toggles the \fISecure Keyboard\fP mode described in the
section named \fBSECURITY\fP, and is invoked from the \fBsecurekbd\fP
entry in \fImainMenu\fP.
.TP 8
+.B "scroll-lock(\fIon/off/toggle\fP)"
+This action toggles internal state which tells
+\fIxterm\fP whether Scroll Lock is active,
+subject to the \fBallowScrollLock\fP resource.
+.TP 8
.B "select-cursor-end(\fIdestname\fP [, ...])"
This action is similar to \fBselect-end\fP except that it should be used
with \fBselect-cursor-start\fP.
@@ -4859,6 +5002,10 @@ as \fItstp\fP), \fIcont\fP
\fIquit\fP,
\fIalrm\fP, \fIalarm\fP (same as \fIalrm\fP) and \fIkill\fP.
.TP 8
+.B "set-8-bit-control(\fIon/off/toggle\fP)"
+This action toggles the \fBeightBitControl\fP resource and is also invoked from the
+\fB8-bit-control\fP entry in \fIvtMenu\fP.
+.TP 8
.B "set-allow132(\fIon/off/toggle\fP)"
This action toggles the \fBc132\fP resource and is also invoked from the
\fBallow132\fP entry in \fIvtMenu\fP.
@@ -4914,10 +5061,16 @@ This action toggles the \fBjumpscroll\fP resource and is also invoked by the
This action toggles the \fIxterm\fR's state regarding whether the current font
has line-drawing characters and whether it should draw them directly.
It is also invoked by the \fBfont-linedrawing\fP entry in \fIfontMenu\fP.
+.\" .\" not implemented
+.\" .TP 8
+.\" .B "set-font-loading(\fIon/off/toggle\fP)"
+.\" This action toggles the TBD resource
+.\" which controls the ability to load VT220 soft fonts.
+.\" It is also invoked by the \fBfont-loadable\fP entry in \fIfontMenu\fP.
.TP 8
.B "set-font-packed(\fIon/off/toggle\fP)"
This action toggles the \fIforcePackedFont\fR's resource
-which controls to use the font's minimum or maximum glyph width.
+which controls use of the font's minimum or maximum glyph width.
It is also invoked by the \fBfont-packed\fP entry in \fIfontMenu\fP.
.TP 8
.B "set-keep-selection(\fIon/off/toggle\fP)"
@@ -5139,8 +5292,7 @@ which is set by the \fBselectToClipboard\fP resource:
Shift <KeyPress> Select:select-cursor-start() \\\&
select-cursor-end(SELECT, CUT_BUFFER0) \\n\\\&
Shift <KeyPress> Insert:insert-selection(SELECT, CUT_BUFFER0) \\n\\\&
- <KeyPress> XF86Paste:insert-selection(SELECT, CUT_BUFFER0) \\n\\\&
- <KeyPress> SunPaste:insert-selection(SELECT, CUT_BUFFER0) \\n\\\&
+ <KeyRelease> Scroll_Lock:scroll-lock() \\n\\\&
Shift~Ctrl <KeyPress> KP_Add:larger-vt-font() \\n\\\&
Shift Ctrl <KeyPress> KP_Add:smaller-vt-font() \\n\\\&
Shift <KeyPress> KP_Subtract:smaller-vt-font() \\n\\\&
@@ -5488,11 +5640,6 @@ ERROR_TIOCKSETC
.br
spawn: ioctl() failed on TIOCKSETC
.TP
-48
-ERROR_SPREALLOC
-.br
-spawn: realloc of ttydev failed
-.TP
49
ERROR_LUMALLOC
.br
diff --git a/app/xterm/xterm_io.h b/app/xterm/xterm_io.h
index b96d66c7a..76c71069d 100644
--- a/app/xterm/xterm_io.h
+++ b/app/xterm/xterm_io.h
@@ -1,11 +1,7 @@
-/* $XTermId: xterm_io.h,v 1.47 2006/02/13 01:15:00 tom Exp $ */
+/* $XTermId: xterm_io.h,v 1.50 2010/05/23 16:04:32 tom Exp $ */
/*
- * $XFree86: xc/programs/xterm/xterm_io.h,v 1.20 2006/02/13 01:15:00 dickey Exp $
- */
-
-/*
- * Copyright 2000-2005,2006 by Thomas E. Dickey
+ * Copyright 2000-2006,2010 by Thomas E. Dickey
*
* All Rights Reserved
*
@@ -308,4 +304,6 @@ extern int ptioctl(int fd, int func, void* data);
#define TTYSIZE_ROWS(data) data.ws_row
#endif
+typedef unsigned short ttySize_t;
+
#endif /* included_xterm_io_h */
diff --git a/app/xterm/xtermcap.c b/app/xterm/xtermcap.c
index 0a941de3d..b9f68bf43 100644
--- a/app/xterm/xtermcap.c
+++ b/app/xterm/xtermcap.c
@@ -1,4 +1,4 @@
-/* $XTermId: xtermcap.c,v 1.42 2010/03/12 00:53:05 Matthieu.Herrb Exp $ */
+/* $XTermId: xtermcap.c,v 1.44 2010/06/13 17:46:27 tom Exp $ */
/*
* Copyright 2007-2009,2010 by Thomas E. Dickey
@@ -263,7 +263,7 @@ keyIsDistinct(XtermWidget xw, int which)
char *fkey;
loadTermcapStrings(screen);
- if ((fkey = screen->tcap_fkeys[which]) != NO_STRING) {
+ if (screen->tcap_fkeys[which] != NO_STRING) {
for (k = 0; k < XtNumber(table); k++) {
if (table[k].code == table[which].code
&& table[k].param == 0) {
@@ -588,7 +588,7 @@ set_termcap(XtermWidget xw, const char *name)
TRACE(("set_termcap(%s)\n", NonNull(name)));
if (IsEmpty(name)) {
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
} else {
const char *temp;
char *value;
@@ -607,7 +607,7 @@ set_termcap(XtermWidget xw, const char *name)
}
}
if (!success)
- Bell(XkbBI_MinorError, 0);
+ Bell(xw, XkbBI_MinorError, 0);
}
void